diff --git a/ccserver/jobs.py b/ccserver/jobs.py index 215cbcd2feb546db4e5300700d6c52a90ef42a08..79f7539517c3287e2a88c9574379e9d8a7c55124 100644 --- a/ccserver/jobs.py +++ b/ccserver/jobs.py @@ -243,7 +243,22 @@ class KillOldCliJob(BaseJob): time.sleep(delay) -class ColdMigrationJob(BaseJob): +class BaseMigrationJob(BaseJob): + + ''' + Base class for migration jobs. + ''' + + def _check_status(self, vm_id, status): + ''' + Check the status of the VM. + ''' + + answer = self.manager.server.list('id=%s&status=%s' % (vm_id, status)) + return bool(answer) + + +class ColdMigrationJob(BaseMigrationJob): ''' A cold vm migration job. @@ -362,13 +377,6 @@ class ColdMigrationJob(BaseJob): logging.info('Job-%s: Migration completed with success', self['id']) - def _check_status(self, vm_id, status): - ''' - Check the status of the VM. - ''' - - answer = self.manager.server.list('id=%s&status=%s' % (vm_id, status)) - return bool(answer) def _copy_disk(self, source, dest, vm, disk): '''