Add context param to confirm_migration virt call
those param will be helpful like other virt layers e.g do some auditing or log. Change-Id: I6f4a8ab65de51ec006726aa3da27bf58d141c94f Closes-Bug: 1631347
This commit is contained in:
parent
80306af88b
commit
41bf42a393
|
@ -3481,7 +3481,7 @@ class ComputeManager(manager.Manager):
|
|||
|
||||
network_info = self.network_api.get_instance_nw_info(context,
|
||||
instance)
|
||||
self.driver.confirm_migration(migration, instance,
|
||||
self.driver.confirm_migration(context, migration, instance,
|
||||
network_info)
|
||||
|
||||
migration.status = 'confirmed'
|
||||
|
|
|
@ -388,10 +388,12 @@ class HyperVDriverTestCase(test_base.HyperVBaseTestCase):
|
|||
|
||||
def test_confirm_migration(self):
|
||||
self.driver.confirm_migration(
|
||||
mock.sentinel.context,
|
||||
mock.sentinel.migration, mock.sentinel.instance,
|
||||
mock.sentinel.network_info)
|
||||
|
||||
self.driver._migrationops.confirm_migration.assert_called_once_with(
|
||||
mock.sentinel.context,
|
||||
mock.sentinel.migration, mock.sentinel.instance,
|
||||
mock.sentinel.network_info)
|
||||
|
||||
|
|
|
@ -215,6 +215,7 @@ class MigrationOpsTestCase(test_base.HyperVBaseTestCase):
|
|||
def test_confirm_migration(self):
|
||||
mock_instance = fake_instance.fake_instance_obj(self.context)
|
||||
self._migrationops.confirm_migration(
|
||||
context=self.context,
|
||||
migration=mock.sentinel.migration, instance=mock_instance,
|
||||
network_info=mock.sentinel.network_info)
|
||||
get_instance_migr_revert_dir = (
|
||||
|
|
|
@ -16070,8 +16070,8 @@ class LibvirtDriverTestCase(test.NoDBTestCase):
|
|||
_fake_network_info(self, 1))
|
||||
|
||||
self.mox.ReplayAll()
|
||||
self.drvr.confirm_migration("migration_ref", ins_ref,
|
||||
_fake_network_info(self, 1))
|
||||
self.drvr.confirm_migration(self.context, "migration_ref", ins_ref,
|
||||
_fake_network_info(self, 1))
|
||||
|
||||
def test_cleanup_resize_same_host(self):
|
||||
CONF.set_override('policy_dirs', [], group='oslo_policy')
|
||||
|
|
|
@ -585,12 +585,11 @@ class ComputeDriver(object):
|
|||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def confirm_migration(self, migration, instance, network_info):
|
||||
def confirm_migration(self, context, migration, instance, network_info):
|
||||
"""Confirms a resize/migration, destroying the source VM.
|
||||
|
||||
:param instance: nova.objects.instance.Instance
|
||||
"""
|
||||
# TODO(Vek): Need to pass context in for access to auth_token
|
||||
raise NotImplementedError()
|
||||
|
||||
def finish_revert_migration(self, context, instance, network_info,
|
||||
|
|
|
@ -498,7 +498,7 @@ class FakeDriver(driver.ComputeDriver):
|
|||
block_device_info=None, power_on=True):
|
||||
return
|
||||
|
||||
def confirm_migration(self, migration, instance, network_info):
|
||||
def confirm_migration(self, context, migration, instance, network_info):
|
||||
return
|
||||
|
||||
def pre_live_migration(self, context, instance, block_device_info,
|
||||
|
|
|
@ -309,8 +309,9 @@ class HyperVDriver(driver.ComputeDriver):
|
|||
timeout,
|
||||
retry_interval)
|
||||
|
||||
def confirm_migration(self, migration, instance, network_info):
|
||||
self._migrationops.confirm_migration(migration, instance, network_info)
|
||||
def confirm_migration(self, context, migration, instance, network_info):
|
||||
self._migrationops.confirm_migration(context, migration,
|
||||
instance, network_info)
|
||||
|
||||
def finish_revert_migration(self, context, instance, network_info,
|
||||
block_device_info=None, power_on=True):
|
||||
|
|
|
@ -134,7 +134,7 @@ class MigrationOps(object):
|
|||
# disk_info is not used
|
||||
return ""
|
||||
|
||||
def confirm_migration(self, migration, instance, network_info):
|
||||
def confirm_migration(self, context, migration, instance, network_info):
|
||||
LOG.debug("confirm_migration called", instance=instance)
|
||||
|
||||
self._pathutils.get_instance_migr_revert_dir(instance.name,
|
||||
|
|
|
@ -7385,7 +7385,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
LOG.debug("finish_revert_migration finished successfully.",
|
||||
instance=instance)
|
||||
|
||||
def confirm_migration(self, migration, instance, network_info):
|
||||
def confirm_migration(self, context, migration, instance, network_info):
|
||||
"""Confirms a resize, destroying the source VM."""
|
||||
self._cleanup_resize(instance, network_info)
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ class VMwareVCDriver(driver.ComputeDriver):
|
|||
return self._vmops.migrate_disk_and_power_off(context, instance,
|
||||
dest, flavor)
|
||||
|
||||
def confirm_migration(self, migration, instance, network_info):
|
||||
def confirm_migration(self, context, migration, instance, network_info):
|
||||
"""Confirms a resize, destroying the source VM."""
|
||||
self._vmops.confirm_migration(migration, instance, network_info)
|
||||
|
||||
|
|
|
@ -165,9 +165,8 @@ class XenAPIDriver(driver.ComputeDriver):
|
|||
self._vmops.spawn(context, instance, image_meta, injected_files,
|
||||
admin_password, network_info, block_device_info)
|
||||
|
||||
def confirm_migration(self, migration, instance, network_info):
|
||||
def confirm_migration(self, context, migration, instance, network_info):
|
||||
"""Confirms a resize, destroying the source VM."""
|
||||
# TODO(Vek): Need to pass context in for access to auth_token
|
||||
self._vmops.confirm_migration(migration, instance, network_info)
|
||||
|
||||
def finish_revert_migration(self, context, instance, network_info,
|
||||
|
|
Loading…
Reference in New Issue