Pass user context to virt driver when detaching volume

We need this in a later change to pull volume attachment
information from cinder for the volume being detached so
that we can do some attachment counting for multiattach
volumes being detached from instances on the same host.

(cherry-picked from commit d2941bfd165055348dd584b630d4e631ef05e328)

Change-Id: If6e869b1c3516220b7deb0599d699caa2ed33889
Related-Bug: #1752115
This commit is contained in:
Claudiu Belu 2018-03-08 07:23:17 -08:00
parent 77b1b06f4c
commit e27b942877
2 changed files with 3 additions and 3 deletions

View File

@ -197,7 +197,7 @@ class HyperVDriver(driver.ComputeDriver):
instance,
update_device_metadata=True)
def detach_volume(self, connection_info, instance, mountpoint,
def detach_volume(self, context, connection_info, instance, mountpoint,
encryption=None):
context = nova_context.get_admin_context()
# The nova compute manager only updates the device metadata in

View File

@ -227,8 +227,8 @@ class HyperVDriverTestCase(test_base.HyperVBaseTestCase):
def test_detach_volume(self):
mock_instance = fake_instance.fake_instance_obj(self.context)
self.driver.detach_volume(
mock.sentinel.connection_info, mock_instance,
mock.sentinel.mountpoint, mock.sentinel.encryption)
mock.sentinel.context, mock.sentinel.connection_info,
mock_instance, mock.sentinel.mountpoint, mock.sentinel.encryption)
self.driver._volumeops.detach_volume.assert_called_once_with(
mock.sentinel.admin_context,