diff options
Diffstat (limited to 'nova/compute/manager.py')
-rw-r--r-- | nova/compute/manager.py | 80 |
1 files changed, 47 insertions, 33 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index d29b58534b..fc0bdcb04e 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -7548,37 +7548,16 @@ class ComputeManager(manager.Manager): return (do_cleanup, destroy_disks) - @wrap_exception() - @wrap_instance_fault - def _post_live_migration(self, ctxt, instance, dest, - block_migration=False, migrate_data=None, - source_bdms=None): - """Post operations for live migration. - - This method is called from live_migration - and mainly updating database record. - - :param ctxt: security context - :param instance: instance dict - :param dest: destination host - :param block_migration: if true, prepare for block migration - :param migrate_data: if not None, it is a dict which has data - :param source_bdms: BDMs prior to modification by the destination - compute host. Set by _do_live_migration and not - part of the callback interface, so this is never - None - required for live migration without shared storage + def _post_live_migration_remove_source_vol_connections( + self, context, instance, source_bdms): + """Disconnect volume connections from the source host during + _post_live_migration. + :param context: nova auth RequestContext + :param instance: Instance object being live migrated + :param source_bdms: BlockDeviceMappingList representing the attached + volumes with connection_info set for the source host """ - LOG.info('_post_live_migration() is started..', - instance=instance) - - # Cleanup source host post live-migration - block_device_info = self._get_instance_block_device_info( - ctxt, instance, bdms=source_bdms) - self.driver.post_live_migration(ctxt, instance, block_device_info, - migrate_data) - # Detaching volumes. connector = self.driver.get_volume_connector(instance) for bdm in source_bdms: @@ -7600,27 +7579,62 @@ class ComputeManager(manager.Manager): # remove the volume connection without detaching from # hypervisor because the instance is not running # anymore on the current host - self.volume_api.terminate_connection(ctxt, + self.volume_api.terminate_connection(context, bdm.volume_id, connector) else: # cinder v3.44 api flow - delete the old attachment # for the source host - self.volume_api.attachment_delete(ctxt, + self.volume_api.attachment_delete(context, bdm.attachment_id) except Exception as e: if bdm.attachment_id is None: LOG.error('Connection for volume %s not terminated on ' 'source host %s during post_live_migration: ' - '%s', bdm.volume_id, self.host, - six.text_type(e), instance=instance) + '%s', bdm.volume_id, self.host, + six.text_type(e), instance=instance) else: LOG.error('Volume attachment %s not deleted on source ' 'host %s during post_live_migration: %s', bdm.attachment_id, self.host, six.text_type(e), instance=instance) + @wrap_exception() + @wrap_instance_fault + def _post_live_migration(self, ctxt, instance, dest, + block_migration=False, migrate_data=None, + source_bdms=None): + """Post operations for live migration. + + This method is called from live_migration + and mainly updating database record. + + :param ctxt: security context + :param instance: instance dict + :param dest: destination host + :param block_migration: if true, prepare for block migration + :param migrate_data: if not None, it is a dict which has data + :param source_bdms: BDMs prior to modification by the destination + compute host. Set by _do_live_migration and not + part of the callback interface, so this is never + None + required for live migration without shared storage + + """ + LOG.info('_post_live_migration() is started..', + instance=instance) + + # Cleanup source host post live-migration + block_device_info = self._get_instance_block_device_info( + ctxt, instance, bdms=source_bdms) + self.driver.post_live_migration(ctxt, instance, block_device_info, + migrate_data) + + # Disconnect volumes from this (the source) host. + self._post_live_migration_remove_source_vol_connections( + ctxt, instance, source_bdms) + # Releasing vlan. # (not necessary in current implementation?) |