Commit 8bc10912 authored by Yann Bordenave's avatar Yann Bordenave Committed by Antoine Millet
Browse files

Add a waiting loop in cold migration and clone

We used to wait the end of the export_volume job before doing anything
else. Now, we have a timeout waiting inside a loop, so we can update the
job status by getting information from the node.

This patch comes with the commit named 'Handler to get data from the
child of a ForkedJob' in cc-node which implements the handler needed
to get the information from the job.
parent 74355f69
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -185,7 +185,16 @@ class CloneJob(Job):
        watcher.register(source.conn, 'vol_export', pool, name, dest.ip, xferprop['port'])
        watcher.register(dest.conn, 'vol_import_wait', xferprop['id'])

        msgs = watcher.wait()
        # Loop to poll status while job is running
        job_running = True
        while job_running:
            # Timeout to get transfered bytes and update status
            msgs = watcher.wait(timeout=10)
            if not msgs:
                _, percent = dest.proxy.vol_transfer_status(xferprop['id'])
                self.report('copy %s/%s: %d%% done' % (pool, name, percent))
            else:
                job_running = False
        self._func_cancel_xfer = None

        # Compare checksum of two answers:
+10 −1
Original line number Diff line number Diff line
@@ -169,7 +169,16 @@ class ColdMigrationJob(Job):
        watcher.register(source.conn, 'vol_export', pool, name, dest.ip, xferprop['port'])
        watcher.register(dest.conn, 'vol_import_wait', xferprop['id'])

        msgs = watcher.wait()
        # Loop to poll status while job is running
        job_running = True
        while job_running:
            # Timeout to get transfered bytes and update status
            msgs = watcher.wait(timeout=10)
            if not msgs:
                _, percent = dest.proxy.vol_transfer_status(xferprop['id'])
                self.report('copy %s/%s: %s%% done' % (pool, name, percent))
            else:
                job_running = False
        self._func_cancel_xfer = None

        # Compare checksum of two answers: