diff --git a/compute_hyperv/nova/volumeops.py b/compute_hyperv/nova/volumeops.py index 93b04145..8f9ff577 100644 --- a/compute_hyperv/nova/volumeops.py +++ b/compute_hyperv/nova/volumeops.py @@ -410,10 +410,13 @@ class BaseVolumeDriver(object): # on this tag. if not self._is_block_dev: disk_path = self.get_disk_resource_path(connection_info) + # In this case, we're not tagging the disks, so we want os-win + # to use the disk path to identify the attachment. + serial = None else: disk_path = None + serial = connection_info['serial'] - serial = connection_info['serial'] LOG.debug("Detaching disk from instance: %(instance_name)s. " "Disk path: %(disk_path)s. Disk serial tag: %(serial)s.", dict(disk_path=disk_path, diff --git a/compute_hyperv/tests/unit/test_volumeops.py b/compute_hyperv/tests/unit/test_volumeops.py index eea24857..4cb56a7f 100644 --- a/compute_hyperv/tests/unit/test_volumeops.py +++ b/compute_hyperv/tests/unit/test_volumeops.py @@ -624,9 +624,11 @@ class BaseVolumeDriverTestCase(test_base.HyperVBaseTestCase): mock.sentinel.instance_name) if is_block_dev: + exp_serial = connection_info['serial'] exp_disk_res_path = None self.assertFalse(mock_get_disk_resource_path.called) else: + exp_serial = None exp_disk_res_path = mock_get_disk_resource_path.return_value mock_get_disk_resource_path.assert_called_once_with( connection_info) @@ -635,7 +637,7 @@ class BaseVolumeDriverTestCase(test_base.HyperVBaseTestCase): mock.sentinel.instance_name, exp_disk_res_path, is_physical=is_block_dev, - serial=connection_info['serial']) + serial=exp_serial) def test_get_disk_ctrl_and_slot_ide(self): ctrl, slot = self._base_vol_driver._get_disk_ctrl_and_slot(