Created
May 4, 2016 21:00
-
-
Save WaltHP/e54ed8e32a8b96bea44396643837bdc2 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
diff --git a/nova/virt/block_device.py b/nova/virt/block_device.py | |
index e86abb7..75d8808 100644 | |
--- a/nova/virt/block_device.py | |
+++ b/nova/virt/block_device.py | |
@@ -338,6 +338,8 @@ class DriverVolumeBlockDevice(DriverBlockDevice): | |
if 'serial' not in connection_info: | |
connection_info['serial'] = self.volume_id | |
self._preserve_multipath_id(connection_info) | |
+ original_info = self['connection_info'] | |
+ connection_info['_original_info'] = original_info | |
self['connection_info'] = connection_info | |
def save(self): | |
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py | |
index e77eace..a882b56 100644 | |
--- a/nova/virt/libvirt/driver.py | |
+++ b/nova/virt/libvirt/driver.py | |
@@ -6827,10 +6827,18 @@ class LibvirtDriver(driver.ComputeDriver): | |
for vol in block_device_mapping: | |
# Retrieve connection info from Cinder's initialize_connection API. | |
# The info returned will be accurate for the source server. | |
- volume_id = vol['connection_info']['serial'] | |
- connection_info = volume_api.initialize_connection(context, | |
- volume_id, | |
- connector) | |
+ if '_original_info' in vol['connection_info']: | |
+ # don't call Cinder if we already have the source host | |
+ # information | |
+ connection_info = vol['connection_info']['_original_info'] | |
+ del vol['connection_info']['_original_info'] | |
+ else: | |
+ # we don't have the source host's connection_info | |
+ # so we have to ask Cinder for it. | |
+ volume_id = vol['connection_info']['serial'] | |
+ connection_info = volume_api.initialize_connection(context, | |
+ volume_id, | |
+ connector) | |
# TODO(leeantho) The following multipath_id logic is temporary | |
# and will be removed in the future once os-brick is updated |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment