Pass user context to virt driver when detaching volume

A recent nova commit [1] changed the contract for the virt driver
detach_volume method, adding context. This updates the out-of-tree
driver accordingly.

[1] d2941bfd165055348dd584b630d4e631ef05e328

Change-Id: Idd9391570431c1a4b42894751f4e7b53f0c2595a
This commit is contained in:
Matthew Edmonds 2018-03-21 16:17:18 -04:00
parent aa8ce81026
commit 4387c0cf6a
2 changed files with 7 additions and 7 deletions

View File

@ -1219,8 +1219,8 @@ class TestPowerVMDriver(test.NoDBTestCase):
# BDMs
mock_bdm = self._fake_bdms()['block_device_mapping'][0]
# Invoke the method, good path test.
self.drv.detach_volume(mock_bdm.get('connection_info'), self.inst,
mock.Mock())
self.drv.detach_volume('context', mock_bdm.get('connection_info'),
self.inst, mock.Mock())
mock_bld_slot_mgr.assert_called_once_with(self.inst,
self.drv.store_api)
@ -1231,8 +1231,8 @@ class TestPowerVMDriver(test.NoDBTestCase):
# Invoke the method, instance doesn't exist, no migration
self.vol_drv.disconnect_volume.reset_mock()
self.drv.detach_volume(mock_bdm.get('connection_info'), self.inst,
mock.Mock())
self.drv.detach_volume('context', mock_bdm.get('connection_info'),
self.inst, mock.Mock())
# Verify the disconnect volume was not invoked
self.assertEqual(0, self.vol_drv.disconnect_volume.call_count)
@ -1241,8 +1241,8 @@ class TestPowerVMDriver(test.NoDBTestCase):
mig = lpm.LiveMigrationDest(self.drv, self.inst)
self.drv.live_migrations[self.inst.uuid] = mig
with mock.patch.object(mig, 'cleanup_volume') as mock_clnup:
self.drv.detach_volume(mock_bdm.get('connection_info'), self.inst,
mock.Mock())
self.drv.detach_volume('context', mock_bdm.get('connection_info'),
self.inst, mock.Mock())
# The cleanup should have been called since there was a migration
self.assertEqual(1, mock_clnup.call_count)
# Verify the disconnect volume was not invoked

View File

@ -760,7 +760,7 @@ class PowerVMDriver(driver.ComputeDriver):
self.adapter, self.host_uuid, instance, connection_info)
vol_drv.extend_volume()
def detach_volume(self, connection_info, instance, mountpoint,
def detach_volume(self, context, connection_info, instance, mountpoint,
encryption=None):
"""Detach the volume attached to the instance."""
self._log_operation('detach_volume', instance)