ossobv / proxmove

Migrate virtual machines between different Proxmox VE clusters with minimal downtime

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Better logging against pebcak?

vilitux opened this issue Β· comments

πŸ‘Œ

Also 'uptime' in nodes list appears to be gone in version 6.x:

[{'level': '', 'id': 'node/pve2', 'node': 'pve2', 'ssl_fingerprint': '...:12...', 'status': 'online', 'type': 'node'},
 {'type': 'node', 'status': 'online', 'ssl_fingerprint': '...13...', 'node': 'pve1', 'id': 'node/pve1', 'level': ''}]
--- proxmove	2020-01-16 16:28:50.497264274 +0100
+++ /usr/local/bin/proxmove	2020-01-16 16:18:52.832366571 +0100
@@ -282,9 +282,10 @@ class ProxmoxCluster(object):
     def get_nodes(self):
         if 'nodes' not in self._cache:
             tmp = self.api.nodes.get()
+            print(tmp)
             nodes = [
                 node['node'] for node in tmp
-                if node.get('uptime') and node['type'] == 'node']
+                if node['type'] == 'node']
             self._cache['nodes'] = nodes
         return self._cache['nodes']

@@ -557,6 +547,7 @@ class ProxmoxStorage(object):
         if hide_stderr:
             kwargs['stderr'] = subprocess.DEVNULL

+        print('LOG', command)
         if tty:
             # We don't need to catch KeyboardInterrupt and SystemExit
             # now that we have ssh -t.
@@ -572,13 +563,14 @@ class ProxmoxStorage(object):

     def has_commands(self, commands):
         try:
-            result = self.ssh_command(['which'] + commands, hide_stderr=True)
+            result = self.ssh_command(['which'] + commands) #, hide_stderr=True)
         except subprocess.CalledProcessError:
             return False
         result = result.decode('ascii', 'replace').strip()
         found = set([i.rsplit('/', 1)[-1] for i in result.split('\n')])
         expected = set(commands)
         assert not (found - expected), (expected, found)
+        print(expected, found, not (expected - found))
         return not (expected - found)  # should have them all

     def ssh_command(self, command, hide_stderr=False, tty=False):
@@ -1576,10 +1568,11 @@ class CommandLoader(object):
         return cluster

     def process_nodes(self):
-        if self.args.nodeid not in self.args.destination.get_nodes():
+        nodes = self.args.destination.get_nodes()
+        if self.args.nodeid not in nodes:
             self.parser.error(
-                'destination node {!r} not found in cluster'.format(
-                    self.args.nodeid))
+                'destination node {!r} not found in cluster; '
+                'did find: {!r}'.format(self.args.nodeid, nodes))

         try:
             self.args.storage = self.args.destination.get_storage(