summaryrefslogtreecommitdiffstats
path: root/nova/volume
diff options
context:
space:
mode:
authorEwan Mellor <ewan.mellor@citrix.com>2011-11-30 10:34:42 -0800
committerEwan Mellor <ewan.mellor@citrix.com>2011-11-30 13:21:22 -0800
commitf6c74d6563e48df6a8a7ff09a27d812840f23d02 (patch)
tree4d60f587c17b7b6e6654ad21d1bd8f8078e8318c /nova/volume
parent486e6fb517a407d63bd1459518df92eb282fb733 (diff)
Bug #898290: iSCSI volume backend treats FLAGS.host as a hostname
Change ISCSIDriver to set volume.provider_location during create_export. This records the location of the LUN, so that nova-compute does not need to run the iSCSI discovery code itself. As part of this, include the IP address of the target (--iscsi_ip_address) in the provider_location. This means that we don't use volume's host identifier (which could be an opaque ID) when trying to connect to the iSCSI target -- we use the admin-specified IP address instead. The string-join to set provider_location is shared with ZadaraBEDriver, which was doing something similar. I've brought that into a helper function. The docstring for the --host flag has been clarified. Change-Id: I8402da86345e786a46a4d222ad4d8a4449d2bd3f
Diffstat (limited to 'nova/volume')
-rw-r--r--nova/volume/driver.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/nova/volume/driver.py b/nova/volume/driver.py
index 893691669..86161d068 100644
--- a/nova/volume/driver.py
+++ b/nova/volume/driver.py
@@ -47,6 +47,8 @@ flags.DEFINE_string('iscsi_target_prefix', 'iqn.2010-10.org.openstack:',
'prefix for iscsi volumes')
flags.DEFINE_string('iscsi_ip_address', '$my_ip',
'use this ip for iscsi')
+flags.DEFINE_integer('iscsi_port', 3260,
+ 'The port that the iSCSI daemon is listening on')
flags.DEFINE_string('rbd_pool', 'rbd',
'the rbd pool in which volumes are stored')
@@ -279,6 +281,11 @@ class ISCSIDriver(VolumeDriver):
self.tgtadm.new_target(iscsi_name, iscsi_target)
self.tgtadm.new_logicalunit(iscsi_target, 0, volume_path)
+ model_update = {}
+ model_update['provider_location'] = _iscsi_location(
+ FLAGS.iscsi_ip_address, iscsi_target, iscsi_name)
+ return model_update
+
def remove_export(self, context, volume):
"""Removes an export for a logical volume."""
try:
@@ -923,12 +930,10 @@ class ZadaraBEDriver(ISCSIDriver):
sn_ip = response_node.findtext("SnIp")
sn_iqn = response_node.findtext("IqnName")
- iscsi_portal = sn_ip + ":3260," + ("%s" % iscsi_target)
model_update = {}
- model_update['provider_location'] = ("%s %s" %
- (iscsi_portal,
- sn_iqn))
+ model_update['provider_location'] = _iscsi_location(
+ sn_ip, iscsi_target, sn_iqn)
return model_update
def _get_qosgroup_summary(self):
@@ -977,3 +982,7 @@ class ZadaraBEDriver(ISCSIDriver):
drive_info = self._get_qosgroup_summary()
return {'drive_qos_info': drive_info}
+
+
+def _iscsi_location(ip, target, iqn):
+ return "%s:%s,%s %s" % (ip, FLAGS.iscsi_port, target, iqn)