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
This commit is contained in:
Ewan Mellor
2011年11月30日 10:34:42 -08:00
parent 486e6fb517
commit f6c74d6563

View File

@@ -440,7 +440,8 @@ DEFINE_string('image_service', 'nova.image.glance.GlanceImageService',
'The service to use for retrieving and searching for images.')
DEFINE_string('host', socket.gethostname(),
'name of this node')
'Name of this node. This can be an opaque identifier. It is '
'not necessarily a hostname, FQDN, or IP address.')
DEFINE_string('node_availability_zone', 'nova',
'availability zone of this node')

View File

@@ -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)
Reference in New Issue
openstack/nova
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.

The note is not visible to the blocked user.