From 958b68fb801b1c87b1e2878738c1d74f1aae7dac Mon Sep 17 00:00:00 2001 From: Alessandro Pilotti Date: Wed, 6 Mar 2013 16:56:29 +0200 Subject: Fixes volume attach on Hyper-V with IPv6 Fixes bug: 1148536 This patch splits the target_portal address:port pair properly in case of IPv6 addresses during login on the storage target. Change-Id: I87c1153dd0289ac73fb35c2cd57a27d128042b2c --- nova/virt/hyperv/volumeutils.py | 7 ++++--- nova/virt/hyperv/volumeutilsv2.py | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/nova/virt/hyperv/volumeutils.py b/nova/virt/hyperv/volumeutils.py index e77b463fe..55604bd52 100644 --- a/nova/virt/hyperv/volumeutils.py +++ b/nova/virt/hyperv/volumeutils.py @@ -27,6 +27,7 @@ from eventlet.green import subprocess from oslo.config import cfg from nova.openstack.common import log as logging +from nova import utils from nova.virt.hyperv import basevolumeutils from nova.virt.hyperv import vmutils @@ -55,9 +56,9 @@ class VolumeUtils(basevolumeutils.BaseVolumeUtils): def login_storage_target(self, target_lun, target_iqn, target_portal): """Add target portal, list targets and logins to the target.""" - separator = target_portal.find(':') - target_address = target_portal[:separator] - target_port = target_portal[separator + 1:] + (target_address, + target_port) = utils.parse_server_string(target_portal) + #Adding target portal to iscsi initiator. Sending targets self.execute('iscsicli.exe ' + 'AddTargetPortal ' + target_address + ' ' + target_port + diff --git a/nova/virt/hyperv/volumeutilsv2.py b/nova/virt/hyperv/volumeutilsv2.py index 79d2d1876..cdc0803ee 100644 --- a/nova/virt/hyperv/volumeutilsv2.py +++ b/nova/virt/hyperv/volumeutilsv2.py @@ -29,6 +29,7 @@ if sys.platform == 'win32': from oslo.config import cfg from nova.openstack.common import log as logging +from nova import utils from nova.virt.hyperv import basevolumeutils LOG = logging.getLogger(__name__) @@ -45,9 +46,9 @@ class VolumeUtilsV2(basevolumeutils.BaseVolumeUtils): def login_storage_target(self, target_lun, target_iqn, target_portal): """Add target portal, list targets and logins to the target.""" - separator = target_portal.find(':') - target_address = target_portal[:separator] - target_port = target_portal[separator + 1:] + (target_address, + target_port) = utils.parse_server_string(target_portal) + #Adding target portal to iscsi initiator. Sending targets portal = self._conn_storage.MSFT_iSCSITargetPortal portal.New(TargetPortalAddress=target_address, -- cgit