Commit 919a6926 authored by Antoine Millet's avatar Antoine Millet
Browse files

Added a base class for migration jobs.

parent 7e1dd555
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -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):
        '''