Created
February 28, 2018 17:25
-
-
Save prof-griffith/b213431666dca0056f4d2f87e7da67af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ubuntu@stack-2:/opt/stack/nova$ git diff | |
diff --git a/nova/objects/block_device.py b/nova/objects/block_device.py | |
index f6410f3..fbcc71e 100644 | |
--- a/nova/objects/block_device.py | |
+++ b/nova/objects/block_device.py | |
@@ -445,7 +445,6 @@ class BlockDeviceMappingList(base.ObjectListBase, base.NovaObject): | |
return base.obj_make_list( | |
context, cls(), objects.BlockDeviceMapping, db_bdms or []) | |
- | |
def root_bdm(self): | |
"""It only makes sense to call this method when the | |
BlockDeviceMappingList contains BlockDeviceMappings from | |
diff --git a/nova/tests/unit/objects/test_objects.py b/nova/tests/unit/objects/test_objects.py | |
index 72fa614..930e08b 100644 | |
--- a/nova/tests/unit/objects/test_objects.py | |
+++ b/nova/tests/unit/objects/test_objects.py | |
@@ -1065,7 +1065,7 @@ object_data = { | |
'BandwidthUsage': '1.2-c6e4c779c7f40f2407e3d70022e3cd1c', | |
'BandwidthUsageList': '1.2-5fe7475ada6fe62413cbfcc06ec70746', | |
'BlockDeviceMapping': '1.19-407e75274f48e60a76e56283333c9dbc', | |
- 'BlockDeviceMappingList': '1.17-1e568eecb91d06d4112db9fd656de235', | |
+ 'BlockDeviceMappingList': '1.18-7c22133208c06a5ad7bd61485ef08307', | |
'BuildRequest': '1.3-077dee42bed93f8a5b62be77657b7152', | |
'BuildRequestList': '1.0-cd95608eccb89fbc702c8b52f38ec738', | |
'CellMapping': '1.0-7f1a7e85a22bbb7559fc730ab658b9bd', | |
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py | |
index 74b9aea..2697843 100644 | |
--- a/nova/virt/libvirt/driver.py | |
+++ b/nova/virt/libvirt/driver.py | |
@@ -1246,24 +1246,25 @@ class LibvirtDriver(driver.ComputeDriver): | |
encryption=None): | |
self._detach_encryptor(context, connection_info, encryption=encryption) | |
vol_driver = self._get_volume_driver(connection_info) | |
- # BOOKMARK(jdg): Don't call this if it's multiattach and shares a | |
- # connection on the same node!! | |
if connection_info.get('multiattach', False): | |
# If multiattach take care to ensure there aren't any other | |
# instances sharing this connection | |
- #bdm object .get_by_volume_id(cls, context, volume_id, | |
# iterate through to see if any match instance.host | |
- # NOTE the bdm entry has an instance object so we | |
- # should be able to do something like `bdm.instance.host == instance.host` | |
- # nova_context.get_admin_context(), | |
- import remote_pdb;remote_pdb.set_trace() | |
bdm_list = objects.BlockDeviceMappingList.get_by_volume_id( | |
nova_context.get_admin_context(), connection_info['volume_id']) | |
for bdm in bdm_list: | |
- if bdm.instance.host == instance.host: | |
- LOG.debug('skipping initiator destroy for volume %(vol)s because another attachment exists on the same host', | |
- {'vol': connection_info['volume_id']}) | |
- return | |
+ if bdm.deleted: | |
+ continue | |
+ con_info = jsonutils.loads(bdm.connection_info) | |
+ if (bdm.instance.host == instance.host and | |
+ con_info['data']['target_iqn'] == | |
+ connection_info['data']['target_iqn']): | |
+ | |
+ LOG.debug('skipping initiator destroy for volume %(vol)s ' | |
+ 'because another attachment exists on the same ' | |
+ 'host', | |
+ {'vol': connection_info['volume_id']}) | |
+ return | |
vol_driver.disconnect_volume(connection_info, instance) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment