summaryrefslogtreecommitdiffstats
path: root/nova/volume
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2012-02-09 15:05:21 -0800
committerRenuka Apte <renuka.apte@citrix.com>2012-02-16 16:45:15 -0800
commit509e5ad9ef6ed38caa69d2c76b1adccedcdd315e (patch)
tree982eabc1e080a1d0825fe871ecf418c5f182e6c8 /nova/volume
parent844035b6c0f725c685cdff56a7bb77efe7825a5f (diff)
Fixes nova-volume support for multiple luns
* stores lun in provider_location if specified * passes lun in iscsi_properties instead of hard coding * adds call to libvirt to list all used block devices * make sure to synchronize connect and disconnect commands * only disconnect from target if no luns are in use * allow double logins to targets * fixes typo in get_volume_connector in xenapi_connection * fixes bug 929790 Change-Id: I2466dc750a6fa5e0b07f94314d38873740aa6b29
Diffstat (limited to 'nova/volume')
-rw-r--r--nova/volume/driver.py40
1 files changed, 23 insertions, 17 deletions
diff --git a/nova/volume/driver.py b/nova/volume/driver.py
index a92c51c6b..924991860 100644
--- a/nova/volume/driver.py
+++ b/nova/volume/driver.py
@@ -295,8 +295,12 @@ class ISCSIDriver(VolumeDriver):
self.tgtadm.new_logicalunit(iscsi_target, 0, volume_path)
model_update = {}
+ if FLAGS.iscsi_helper == 'tgtadm':
+ lun = 1
+ else:
+ lun = 0
model_update['provider_location'] = _iscsi_location(
- FLAGS.iscsi_ip_address, iscsi_target, iscsi_name)
+ FLAGS.iscsi_ip_address, iscsi_target, iscsi_name, lun)
return model_update
def remove_export(self, context, volume):
@@ -349,6 +353,8 @@ class ISCSIDriver(VolumeDriver):
:target_portal: the portal of the iSCSI target
+ :target_lun: the lun of the iSCSI target
+
:volume_id: the id of the volume (currently used by xen)
:auth_method:, :auth_username:, :auth_password:
@@ -376,16 +382,20 @@ class ISCSIDriver(VolumeDriver):
LOG.debug(_("ISCSI Discovery: Found %s") % (location))
properties['target_discovered'] = True
- (iscsi_target, _sep, iscsi_name) = location.partition(" ")
-
- iscsi_portal = iscsi_target.split(",")[0]
+ results = location.split(" ")
+ properties['target_portal'] = results[0].split(",")[0]
+ properties['target_iqn'] = results[1]
+ try:
+ properties['target_lun'] = int(results[2])
+ except (IndexError, ValueError):
+ if FLAGS.iscsi_helper == 'tgtadm':
+ properties['target_lun'] = 1
+ else:
+ properties['target_lun'] = 0
properties['volume_id'] = volume['id']
- properties['target_iqn'] = iscsi_name
- properties['target_portal'] = iscsi_portal
auth = volume['provider_auth']
-
if auth:
(auth_method, auth_username, auth_secret) = auth.split()
@@ -794,14 +804,10 @@ class ZadaraBEDriver(ISCSIDriver):
self._iscsiadm_update(iscsi_properties, "node.startup", "automatic")
- if FLAGS.iscsi_helper == 'tgtadm':
- mount_device = ("/dev/disk/by-path/ip-%s-iscsi-%s-lun-1" %
- (iscsi_properties['target_portal'],
- iscsi_properties['target_iqn']))
- else:
- mount_device = ("/dev/disk/by-path/ip-%s-iscsi-%s-lun-0" %
- (iscsi_properties['target_portal'],
- iscsi_properties['target_iqn']))
+ mount_device = ("/dev/disk/by-path/ip-%s-iscsi-%s-lun-%s" %
+ (iscsi_properties['target_portal'],
+ iscsi_properties['target_iqn'],
+ iscsi_properties['target_lun']))
# The /dev/disk/by-path/... node is not always present immediately
# TODO(justinsb): This retry-with-delay is a pattern, move to utils?
@@ -1007,5 +1013,5 @@ class ZadaraBEDriver(ISCSIDriver):
return {'drive_qos_info': drive_info}
-def _iscsi_location(ip, target, iqn):
- return "%s:%s,%s %s" % (ip, FLAGS.iscsi_port, target, iqn)
+def _iscsi_location(ip, target, iqn, lun=None):
+ return "%s:%s,%s %s %s" % (ip, FLAGS.iscsi_port, target, iqn, lun)