Commit b28e5321 authored by Anael Beutot's avatar Anael Beutot Committed by Antoine Millet
Browse files

Set autostart attribute after cold migration

parent c5d2eac1
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -61,6 +61,8 @@ class ColdMigrationJob(BaseJob):
            if not vm['status'] == 'stopped':
                raise JobCancelError('vm is not stopped')

            before_migrate_autostart = vm['autostart'].lower() == 'yes'

            # Create storages on destination:
            self.report('create volumes')
            for disk in vm.get('disk', '').split():
@@ -118,6 +120,10 @@ class ColdMigrationJob(BaseJob):
            # Cleanup the VM:
            source.proxy.vm_undefine(self['vm_name'])

            # Setup autostart as it was before the migration
            dest.proxy.vm_set_autostart(self['vm_name'],
                                        before_migrate_autostart)

            self.logger.info('Job-%s: Migration completed with success', self['id'])