Commit e333ea93 authored by Antoine Millet's avatar Antoine Millet
Browse files

Now use the new sjrpc async call API

parent d130adcc
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -13,6 +13,8 @@ import time
from datetime import datetime
from threading import Thread, Lock

from sjrpc.core import AsyncWatcher

from ccserver.exceptions import (BadJobTypeError, UnknownJobError, JobError,
                                 UnknownObjectError)
from ccserver.utils import AcquiresAllOrNone
@@ -397,11 +399,11 @@ class ColdMigrationJob(BaseMigrationJob):
        self['func_cancel_xfer'] = cancel_xfer

        # Wait for the end of transfert:
        cids = set()
        cids.add(source.connection.async_call('vol_export', pool, name,
                                              dest.get_ip(), xferprop['port']))
        cids.add(dest.connection.async_call('vol_import_wait', xferprop['id']))
        msgs = self.manager.server.manager.wait(frozenset(cids))
        watcher = AsyncWatcher()
        watcher.register(source.conn, 'vol_export', pool, name, dest.ip, xferprop['port'])
        watcher.register(dest.conn, 'vol_import_wait', xferprop['id'])

        msgs = watcher.wait()
        del self['func_cancel_xfer']

        # Compare checksum of two answers: