summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-02-25 19:14:11 +0000
committerGerrit Code Review <review@openstack.org>2016-02-25 19:14:12 +0000
commit4419d2a669f24b722b5ddd4b078d958f742d8c26 (patch)
tree657ddaa063c40c7834e37dc0b879f7d5fa1d7a65
parent19f13c8f373b534845e7336f329fc2496b78c8cd (diff)
parent82bf282dd599d9c1528a34a032513e6721ae9876 (diff)
downloadnova-4419d2a669f24b722b5ddd4b078d958f742d8c26.tar.gz
Merge "HyperV: Set disk serial number for attached volumes"
-rw-r--r--nova/tests/unit/virt/hyperv/test_volumeops.py9
-rw-r--r--nova/virt/hyperv/volumeops.py4
2 files changed, 9 insertions, 4 deletions
diff --git a/nova/tests/unit/virt/hyperv/test_volumeops.py b/nova/tests/unit/virt/hyperv/test_volumeops.py
index 78bdf2329e..186094bfbc 100644
--- a/nova/tests/unit/virt/hyperv/test_volumeops.py
+++ b/nova/tests/unit/virt/hyperv/test_volumeops.py
@@ -44,7 +44,8 @@ def get_fake_block_dev_info():
def get_fake_connection_info(**kwargs):
- return {'data': dict(connection_data, **kwargs)}
+ return {'data': dict(connection_data, **kwargs),
+ 'serial': mock.sentinel.serial}
class VolumeOpsTestCase(test_base.HyperVBaseTestCase):
@@ -274,13 +275,15 @@ class ISCSIVolumeDriverTestCase(test_base.HyperVBaseTestCase):
mock.sentinel.instance_name, 0)
attach_vol.assert_called_once_with(mock.sentinel.instance_name,
fake_ide_path, 0,
- fake_mounted_disk_path)
+ fake_mounted_disk_path,
+ serial=mock.sentinel.serial)
else:
get_scsi_path.assert_called_once_with(mock.sentinel.instance_name)
get_free_slot.assert_called_once_with(fake_scsi_path)
attach_vol.assert_called_once_with(mock.sentinel.instance_name,
fake_scsi_path, 1,
- fake_mounted_disk_path)
+ fake_mounted_disk_path,
+ serial=mock.sentinel.serial)
def test_attach_volume_ebs(self):
self._check_attach_volume(ebs_root=True)
diff --git a/nova/virt/hyperv/volumeops.py b/nova/virt/hyperv/volumeops.py
index d2a8e55660..3dbbd57906 100644
--- a/nova/virt/hyperv/volumeops.py
+++ b/nova/virt/hyperv/volumeops.py
@@ -234,6 +234,7 @@ class ISCSIVolumeDriver(object):
data = connection_info['data']
target_lun = data['target_lun']
target_iqn = data['target_iqn']
+ serial = connection_info['serial']
# Getting the mounted disk
mounted_disk_path = self._get_mounted_disk_from_lun(target_iqn,
@@ -254,7 +255,8 @@ class ISCSIVolumeDriver(object):
self._vmutils.attach_volume_to_controller(instance_name,
ctrller_path,
slot,
- mounted_disk_path)
+ mounted_disk_path,
+ serial=serial)
except Exception:
with excutils.save_and_reraise_exception():
LOG.error(_LE('Unable to attach volume to instance %s'),