Use oslo.utils implementation to parse server address
... so that the address can be properly parsed even when IPv6 address is used. Change-Id: Ic3e043e9272518f73252ea9a8f0524ed092204b9
This commit is contained in:
parent
462f86889b
commit
1f5798bced
@ -26,6 +26,7 @@ from oslo_concurrency import processutils
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
from oslo_utils import fileutils
|
from oslo_utils import fileutils
|
||||||
|
from oslo_utils import netutils
|
||||||
|
|
||||||
from ironic.common import dhcp_factory
|
from ironic.common import dhcp_factory
|
||||||
from ironic.common import exception
|
from ironic.common import exception
|
||||||
@ -1089,10 +1090,8 @@ def get_volume_pxe_options(task):
|
|||||||
return __return_item_or_first_if_list(properties.get(key + 's', ''))
|
return __return_item_or_first_if_list(properties.get(key + 's', ''))
|
||||||
|
|
||||||
def __format_portal(portal, iqn, lun):
|
def __format_portal(portal, iqn, lun):
|
||||||
if ':' in portal:
|
host, port = netutils.parse_host_port(portal)
|
||||||
host, port = portal.split(':')
|
if port is None:
|
||||||
else:
|
|
||||||
host = portal
|
|
||||||
port = ''
|
port = ''
|
||||||
return ("iscsi:%(host)s::%(port)s:%(lun)x:%(iqn)s" %
|
return ("iscsi:%(host)s::%(port)s:%(lun)x:%(iqn)s" %
|
||||||
{'host': host, 'port': port, 'lun': lun, 'iqn': iqn})
|
{'host': host, 'port': port, 'lun': lun, 'iqn': iqn})
|
||||||
|
@ -25,6 +25,7 @@ from ironic_lib import metrics_utils
|
|||||||
from ironic_lib import utils as ironic_utils
|
from ironic_lib import utils as ironic_utils
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
|
from oslo_utils import netutils
|
||||||
|
|
||||||
from ironic.common import boot_devices
|
from ironic.common import boot_devices
|
||||||
from ironic.common import exception
|
from ironic.common import exception
|
||||||
@ -843,12 +844,9 @@ class IRMCVolumeBootMixIn(object):
|
|||||||
def _set_iscsi_target(self, task, viom_conf, target):
|
def _set_iscsi_target(self, task, viom_conf, target):
|
||||||
"""Set information for iSCSI boot to VIOM configuration."""
|
"""Set information for iSCSI boot to VIOM configuration."""
|
||||||
connectors = self._get_volume_connectors_by_type(task)
|
connectors = self._get_volume_connectors_by_type(task)
|
||||||
target_portal = target.properties['target_portal']
|
target_host, target_port = netutils.parse_host_port(
|
||||||
if ':' in target_portal:
|
target.properties['target_portal'])
|
||||||
target_host, target_port = target_portal.split(':')
|
|
||||||
else:
|
|
||||||
target_host = target_portal
|
|
||||||
target_port = None
|
|
||||||
if target.properties.get('auth_method') == 'CHAP':
|
if target.properties.get('auth_method') == 'CHAP':
|
||||||
chap_user = target.properties.get('auth_username')
|
chap_user = target.properties.get('auth_username')
|
||||||
chap_secret = target.properties.get('auth_password')
|
chap_secret = target.properties.get('auth_password')
|
||||||
|
@ -1719,7 +1719,7 @@ class IRMCVirtualMediaBootWithVolumeTestCase(test_common.BaseIRMCTest):
|
|||||||
initiator_netmask=24,
|
initiator_netmask=24,
|
||||||
target_iqn='iqn.target',
|
target_iqn='iqn.target',
|
||||||
target_ip='192.168.22.22',
|
target_ip='192.168.22.22',
|
||||||
target_port='3260',
|
target_port=3260,
|
||||||
target_lun=1,
|
target_lun=1,
|
||||||
boot_prio=1,
|
boot_prio=1,
|
||||||
chap_user=None,
|
chap_user=None,
|
||||||
@ -1753,7 +1753,7 @@ class IRMCVirtualMediaBootWithVolumeTestCase(test_common.BaseIRMCTest):
|
|||||||
initiator_netmask=24,
|
initiator_netmask=24,
|
||||||
target_iqn='iqn.target',
|
target_iqn='iqn.target',
|
||||||
target_ip='192.168.22.22',
|
target_ip='192.168.22.22',
|
||||||
target_port='3260',
|
target_port=3260,
|
||||||
target_lun=1,
|
target_lun=1,
|
||||||
boot_prio=1,
|
boot_prio=1,
|
||||||
chap_user=None,
|
chap_user=None,
|
||||||
@ -1779,7 +1779,7 @@ class IRMCVirtualMediaBootWithVolumeTestCase(test_common.BaseIRMCTest):
|
|||||||
initiator_netmask=24,
|
initiator_netmask=24,
|
||||||
target_iqn='iqn.target',
|
target_iqn='iqn.target',
|
||||||
target_ip='192.168.22.22',
|
target_ip='192.168.22.22',
|
||||||
target_port='3260',
|
target_port=3260,
|
||||||
target_lun=1,
|
target_lun=1,
|
||||||
boot_prio=1,
|
boot_prio=1,
|
||||||
chap_user=None,
|
chap_user=None,
|
||||||
@ -1836,7 +1836,7 @@ class IRMCVirtualMediaBootWithVolumeTestCase(test_common.BaseIRMCTest):
|
|||||||
initiator_netmask=24,
|
initiator_netmask=24,
|
||||||
target_iqn='iqn.target',
|
target_iqn='iqn.target',
|
||||||
target_ip='192.168.22.22',
|
target_ip='192.168.22.22',
|
||||||
target_port='3260',
|
target_port=3260,
|
||||||
target_lun=1,
|
target_lun=1,
|
||||||
boot_prio=1,
|
boot_prio=1,
|
||||||
chap_user='chapuser',
|
chap_user='chapuser',
|
||||||
|
Loading…
Reference in New Issue
Block a user