summaryrefslogtreecommitdiff
path: root/nova/virt/libvirt/volume/iscsi.py
diff options
context:
space:
mode:
authorMatthew Booth <mbooth@redhat.com>2017-02-28 10:03:24 +0000
committerMatthew Booth <mbooth@redhat.com>2017-05-08 11:31:11 -0400
commitb66b7d4f9d63e7f45ebfc033696d06c632a33ff1 (patch)
treedf5c218c8194cbfb9fe3b34592ea167dbb883090 /nova/virt/libvirt/volume/iscsi.py
parentd219a3dcdc9c51bff3ebf2df086ea61a840ea3e9 (diff)
downloadnova-b66b7d4f9d63e7f45ebfc033696d06c632a33ff1.tar.gz
libvirt: Pass instance to connect_volume and disconnect_volume
When we support multi-attach volumes, for volume drivers which must make host state changes (eg mount/unmount) it is no longer enough to know only which volume is being connected; we must also know which instance it is being attached to. Consider the following sequence of calls, and the expected behaviour of the volume driver: * connect_volume(conn_info) connect the volume * connect_volume(conn_info) do nothing (volume is already connected) * disconnect_volume(conn_info) disconnect the volume * disconnect_volume(conn_info) do nothing (volume is already disconnected) Now consider these were actually connections to different instances: * connect_volume(conn_info, A) connect the volume * connect_volume(conn_info, B) do nothing (volume is already connected) * disconnect_volume(conn_info, A) ++ do nothing (volume is still connected to B) * disconnect_volume(conn_info, B) disconnect the volume IOW, it is not possible for the driver to determine the correct behaviour unless it also knows which instance is being attached. This is a non functional change which simply adds instance as an argument to all connect_volume and disconnect_volume calls in libvirt volume drivers. It is effectively a part of change I3155984d. I have split it as it is mechanical, it touches a large number of files which make the substantive change harder to read, and to isolate the substantive change from merge conflicts caused by this change. We also add a utility test class: SubclassSignatureTestCase. This is used in this patch to ensure we have found all connect_volume and disconnect_volume methods which need to be updated. We implement it in the top level tests module as we expect it to be useful elsewhere. This patch was previously submitted as change I658d7ab5 but had to be reverted as it failed to update the signatures of several volume drivers. This is also what has prompted the addition of SubclassSignatureTestCase, which ensures this hasn't happened again. Change-Id: I01c908add1312063f0db724110f7e5927ff281ff
Diffstat (limited to 'nova/virt/libvirt/volume/iscsi.py')
-rw-r--r--nova/virt/libvirt/volume/iscsi.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/nova/virt/libvirt/volume/iscsi.py b/nova/virt/libvirt/volume/iscsi.py
index 278a5e80d6..dfe72a2c36 100644
--- a/nova/virt/libvirt/volume/iscsi.py
+++ b/nova/virt/libvirt/volume/iscsi.py
@@ -57,7 +57,7 @@ class LibvirtISCSIVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
conf.driver_io = "native"
return conf
- def connect_volume(self, connection_info, disk_info):
+ def connect_volume(self, connection_info, disk_info, instance):
"""Attach the volume to instance_name."""
LOG.debug("Calling os-brick to attach iSCSI Volume")
@@ -66,7 +66,7 @@ class LibvirtISCSIVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
connection_info['data']['device_path'] = device_info['path']
- def disconnect_volume(self, connection_info, disk_dev):
+ def disconnect_volume(self, connection_info, disk_dev, instance):
"""Detach the volume from instance_name."""
LOG.debug("calling os-brick to detach iSCSI Volume")
@@ -78,4 +78,4 @@ class LibvirtISCSIVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
LOG.debug("Disconnected iSCSI Volume %s", disk_dev)
super(LibvirtISCSIVolumeDriver,
- self).disconnect_volume(connection_info, disk_dev)
+ self).disconnect_volume(connection_info, disk_dev, instance)