add new portal_port option for iscsi module
IPA supported iSCSI portal port customization by 272420 patch. With this patch, we add new portal_port argument into agent_client.start_iscsi_target() method to pass iSCSI portal port to IPA side. And add new configuration into iscsi module as below: CONF.iscsi.portal_port Reference: https://review.openstack.org/#/c/272420/ Change-Id: Ia1515cbd6723a965e362a7dfa0b58077194401f3 Closes-Bug: #1523829
This commit is contained in:
parent
1bff8ddee4
commit
cdf0a0914c
@ -1326,6 +1326,18 @@
|
|||||||
#root_helper=sudo ironic-rootwrap /etc/ironic/rootwrap.conf
|
#root_helper=sudo ironic-rootwrap /etc/ironic/rootwrap.conf
|
||||||
|
|
||||||
|
|
||||||
|
[iscsi]
|
||||||
|
|
||||||
|
#
|
||||||
|
# Options defined in ironic.drivers.modules.iscsi_deploy
|
||||||
|
#
|
||||||
|
|
||||||
|
# The port number on which the iSCSI portal listens for
|
||||||
|
# incoming connections. (port value)
|
||||||
|
# Possible values: 0-65535
|
||||||
|
#portal_port=3260
|
||||||
|
|
||||||
|
|
||||||
[keystone]
|
[keystone]
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -130,9 +130,9 @@ class AgentClient(object):
|
|||||||
params=params,
|
params=params,
|
||||||
wait=wait)
|
wait=wait)
|
||||||
|
|
||||||
def start_iscsi_target(self, node, iqn):
|
def start_iscsi_target(self, node, iqn, portal_port=3260):
|
||||||
"""Expose the node's disk as an ISCSI target."""
|
"""Expose the node's disk as an ISCSI target."""
|
||||||
params = {'iqn': iqn}
|
params = {'iqn': iqn, 'portal_port': portal_port}
|
||||||
return self._command(node=node,
|
return self._command(node=node,
|
||||||
method='iscsi.start_iscsi_target',
|
method='iscsi.start_iscsi_target',
|
||||||
params=params,
|
params=params,
|
||||||
|
@ -77,8 +77,16 @@ pxe_opts = [
|
|||||||
help=_('The disk devices to scan while doing the deploy.')),
|
help=_('The disk devices to scan while doing the deploy.')),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
iscsi_opts = [
|
||||||
|
cfg.PortOpt('portal_port',
|
||||||
|
default=3260,
|
||||||
|
help=_('The port number on which the iSCSI portal listens '
|
||||||
|
'for incoming connections.')),
|
||||||
|
]
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
CONF.register_opts(pxe_opts, group='pxe')
|
CONF.register_opts(pxe_opts, group='pxe')
|
||||||
|
CONF.register_opts(iscsi_opts, group='iscsi')
|
||||||
|
|
||||||
DISK_LAYOUT_PARAMS = ('root_gb', 'swap_mb', 'ephemeral_gb')
|
DISK_LAYOUT_PARAMS = ('root_gb', 'swap_mb', 'ephemeral_gb')
|
||||||
|
|
||||||
@ -333,7 +341,11 @@ def do_agent_iscsi_deploy(task, agent_client):
|
|||||||
iscsi_options = build_deploy_ramdisk_options(node)
|
iscsi_options = build_deploy_ramdisk_options(node)
|
||||||
|
|
||||||
iqn = iscsi_options['iscsi_target_iqn']
|
iqn = iscsi_options['iscsi_target_iqn']
|
||||||
result = agent_client.start_iscsi_target(node, iqn)
|
portal_port = iscsi_options['iscsi_portal_port']
|
||||||
|
|
||||||
|
result = agent_client.start_iscsi_target(node, iqn,
|
||||||
|
portal_port)
|
||||||
|
|
||||||
if result['command_status'] == 'FAILED':
|
if result['command_status'] == 'FAILED':
|
||||||
msg = (_("Failed to start the iSCSI target to deploy the "
|
msg = (_("Failed to start the iSCSI target to deploy the "
|
||||||
"node %(node)s. Error: %(error)s") %
|
"node %(node)s. Error: %(error)s") %
|
||||||
@ -412,6 +424,7 @@ def build_deploy_ramdisk_options(node):
|
|||||||
'deployment_id': node['uuid'],
|
'deployment_id': node['uuid'],
|
||||||
'deployment_key': deploy_key,
|
'deployment_key': deploy_key,
|
||||||
'iscsi_target_iqn': 'iqn.2008-10.org.openstack:%s' % node.uuid,
|
'iscsi_target_iqn': 'iqn.2008-10.org.openstack:%s' % node.uuid,
|
||||||
|
'iscsi_portal_port': CONF.iscsi.portal_port,
|
||||||
'ironic_api_url': ironic_api,
|
'ironic_api_url': ironic_api,
|
||||||
'disk': CONF.pxe.disk_devices,
|
'disk': CONF.pxe.disk_devices,
|
||||||
'boot_option': boot_option,
|
'boot_option': boot_option,
|
||||||
|
@ -178,9 +178,10 @@ class TestAgentClient(base.TestCase):
|
|||||||
def test_start_iscsi_target(self):
|
def test_start_iscsi_target(self):
|
||||||
self.client._command = mock.MagicMock(spec_set=[])
|
self.client._command = mock.MagicMock(spec_set=[])
|
||||||
iqn = 'fake-iqn'
|
iqn = 'fake-iqn'
|
||||||
params = {'iqn': iqn}
|
port = 3260
|
||||||
|
params = {'iqn': iqn, 'portal_port': port}
|
||||||
|
|
||||||
self.client.start_iscsi_target(self.node, iqn)
|
self.client.start_iscsi_target(self.node, iqn, port)
|
||||||
self.client._command.assert_called_once_with(
|
self.client._command.assert_called_once_with(
|
||||||
node=self.node, method='iscsi.start_iscsi_target',
|
node=self.node, method='iscsi.start_iscsi_target',
|
||||||
params=params, wait=True)
|
params=params, wait=True)
|
||||||
|
@ -174,6 +174,7 @@ class IscsiDeployMethodsTestCase(db_base.DbTestCase):
|
|||||||
expected_iqn = 'iqn.2008-10.org.openstack:%s' % self.node.uuid
|
expected_iqn = 'iqn.2008-10.org.openstack:%s' % self.node.uuid
|
||||||
expected_opts = {
|
expected_opts = {
|
||||||
'iscsi_target_iqn': expected_iqn,
|
'iscsi_target_iqn': expected_iqn,
|
||||||
|
'iscsi_portal_port': 3260,
|
||||||
'deployment_id': self.node.uuid,
|
'deployment_id': self.node.uuid,
|
||||||
'deployment_key': fake_key,
|
'deployment_key': fake_key,
|
||||||
'disk': fake_disk,
|
'disk': fake_disk,
|
||||||
@ -504,7 +505,8 @@ class IscsiDeployMethodsTestCase(db_base.DbTestCase):
|
|||||||
def test_do_agent_iscsi_deploy_okay(self, build_options_mock,
|
def test_do_agent_iscsi_deploy_okay(self, build_options_mock,
|
||||||
continue_deploy_mock):
|
continue_deploy_mock):
|
||||||
build_options_mock.return_value = {'deployment_key': 'abcdef',
|
build_options_mock.return_value = {'deployment_key': 'abcdef',
|
||||||
'iscsi_target_iqn': 'iqn-qweqwe'}
|
'iscsi_target_iqn': 'iqn-qweqwe',
|
||||||
|
'iscsi_portal_port': 3260}
|
||||||
agent_client_mock = mock.MagicMock(spec_set=agent_client.AgentClient)
|
agent_client_mock = mock.MagicMock(spec_set=agent_client.AgentClient)
|
||||||
agent_client_mock.start_iscsi_target.return_value = {
|
agent_client_mock.start_iscsi_target.return_value = {
|
||||||
'command_status': 'SUCCESS', 'command_error': None}
|
'command_status': 'SUCCESS', 'command_error': None}
|
||||||
@ -520,7 +522,7 @@ class IscsiDeployMethodsTestCase(db_base.DbTestCase):
|
|||||||
task, agent_client_mock)
|
task, agent_client_mock)
|
||||||
build_options_mock.assert_called_once_with(task.node)
|
build_options_mock.assert_called_once_with(task.node)
|
||||||
agent_client_mock.start_iscsi_target.assert_called_once_with(
|
agent_client_mock.start_iscsi_target.assert_called_once_with(
|
||||||
task.node, 'iqn-qweqwe')
|
task.node, 'iqn-qweqwe', 3260)
|
||||||
continue_deploy_mock.assert_called_once_with(
|
continue_deploy_mock.assert_called_once_with(
|
||||||
task, error=None, iqn='iqn-qweqwe', key='abcdef',
|
task, error=None, iqn='iqn-qweqwe', key='abcdef',
|
||||||
address='1.2.3.4')
|
address='1.2.3.4')
|
||||||
@ -534,7 +536,8 @@ class IscsiDeployMethodsTestCase(db_base.DbTestCase):
|
|||||||
def test_do_agent_iscsi_deploy_start_iscsi_failure(self,
|
def test_do_agent_iscsi_deploy_start_iscsi_failure(self,
|
||||||
build_options_mock):
|
build_options_mock):
|
||||||
build_options_mock.return_value = {'deployment_key': 'abcdef',
|
build_options_mock.return_value = {'deployment_key': 'abcdef',
|
||||||
'iscsi_target_iqn': 'iqn-qweqwe'}
|
'iscsi_target_iqn': 'iqn-qweqwe',
|
||||||
|
'iscsi_portal_port': 3260}
|
||||||
agent_client_mock = mock.MagicMock(spec_set=agent_client.AgentClient)
|
agent_client_mock = mock.MagicMock(spec_set=agent_client.AgentClient)
|
||||||
agent_client_mock.start_iscsi_target.return_value = {
|
agent_client_mock.start_iscsi_target.return_value = {
|
||||||
'command_status': 'FAILED', 'command_error': 'booom'}
|
'command_status': 'FAILED', 'command_error': 'booom'}
|
||||||
@ -549,7 +552,7 @@ class IscsiDeployMethodsTestCase(db_base.DbTestCase):
|
|||||||
task, agent_client_mock)
|
task, agent_client_mock)
|
||||||
build_options_mock.assert_called_once_with(task.node)
|
build_options_mock.assert_called_once_with(task.node)
|
||||||
agent_client_mock.start_iscsi_target.assert_called_once_with(
|
agent_client_mock.start_iscsi_target.assert_called_once_with(
|
||||||
task.node, 'iqn-qweqwe')
|
task.node, 'iqn-qweqwe', 3260)
|
||||||
self.node.refresh()
|
self.node.refresh()
|
||||||
self.assertEqual(states.DEPLOYFAIL, self.node.provision_state)
|
self.assertEqual(states.DEPLOYFAIL, self.node.provision_state)
|
||||||
self.assertEqual(states.ACTIVE, self.node.target_provision_state)
|
self.assertEqual(states.ACTIVE, self.node.target_provision_state)
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- IPA supported iSCSI portal port customization already.
|
||||||
|
With this patch, we added new portal_port argument into
|
||||||
|
agent_client.start_iscsi_target() method to pass iSCSI portal
|
||||||
|
port to IPA side. And add new configuration into iscsi module as
|
||||||
|
CONF.iscsi.portal_port
|
||||||
|
|
Loading…
Reference in New Issue
Block a user