Merge "[bfv] Set the correct iqn for pxe"

This commit is contained in:
Zuul 2017-10-19 18:02:34 +00:00 committed by Gerrit Code Review
commit 4613de06a7
3 changed files with 31 additions and 4 deletions

View File

@ -297,10 +297,14 @@ def _get_volume_pxe_options(task):
pxe_options['username'] = properties['auth_username']
if 'auth_password' in properties:
pxe_options['password'] = properties['auth_password']
iscsi_initiator_iqn = None
for vc in task.volume_connectors:
if vc.type == 'iqn':
iscsi_initiator_iqn = vc.connector_id
pxe_options.update(
{'iscsi_boot_url': __generate_iscsi_url(volume.properties),
'iscsi_initiator_iqn': (__get_property(properties,
'target_iqn') or None)})
'iscsi_initiator_iqn': iscsi_initiator_iqn})
# NOTE(TheJulia): This may be the route to multi-path, define
# volumes via sanhook in the ipxe template and let the OS sort it out.
additional_targets = []

View File

@ -378,7 +378,7 @@ class PXEPrivateMethodsTestCase(db_base.DbTestCase):
expected_options.update({
'boot_from_volume': True,
'iscsi_boot_url': 'iscsi:fake_host::3260:0:fake_iqn',
'iscsi_initiator_iqn': 'fake_iqn',
'iscsi_initiator_iqn': 'fake_iqn_initiator',
'iscsi_volumes': ['iscsi:fake_host::3260:1:fake_iqn'],
'username': 'fake_username',
'password': 'fake_password'})
@ -419,6 +419,12 @@ class PXEPrivateMethodsTestCase(db_base.DbTestCase):
def test__build_pxe_config_options_ipxe_and_iscsi_boot(self):
vol_id = uuidutils.generate_uuid()
vol_id2 = uuidutils.generate_uuid()
obj_utils.create_test_volume_connector(
self.context,
uuid=uuidutils.generate_uuid(),
type='iqn',
node_id=self.node.id,
connector_id='fake_iqn_initiator')
obj_utils.create_test_volume_target(
self.context, node_id=self.node.id, volume_type='iscsi',
boot_index=0, volume_id='1234', uuid=vol_id,
@ -439,6 +445,12 @@ class PXEPrivateMethodsTestCase(db_base.DbTestCase):
def test__build_pxe_config_options_ipxe_and_iscsi_boot_from_lists(self):
vol_id = uuidutils.generate_uuid()
vol_id2 = uuidutils.generate_uuid()
obj_utils.create_test_volume_connector(
self.context,
uuid=uuidutils.generate_uuid(),
type='iqn',
node_id=self.node.id,
connector_id='fake_iqn_initiator')
obj_utils.create_test_volume_target(
self.context, node_id=self.node.id, volume_type='iscsi',
boot_index=0, volume_id='1234', uuid=vol_id,
@ -460,6 +472,12 @@ class PXEPrivateMethodsTestCase(db_base.DbTestCase):
def test__get_volume_pxe_options(self):
vol_id = uuidutils.generate_uuid()
vol_id2 = uuidutils.generate_uuid()
obj_utils.create_test_volume_connector(
self.context,
uuid=uuidutils.generate_uuid(),
type='iqn',
node_id=self.node.id,
connector_id='fake_iqn_initiator')
obj_utils.create_test_volume_target(
self.context, node_id=self.node.id, volume_type='iscsi',
boot_index=0, volume_id='1234', uuid=vol_id,
@ -483,7 +501,7 @@ class PXEPrivateMethodsTestCase(db_base.DbTestCase):
expected = {'boot_from_volume': True,
'username': 'fake_username', 'password': 'fake_password',
'iscsi_boot_url': 'iscsi:fake_host::3260:0:fake_iqn',
'iscsi_initiator_iqn': 'fake_iqn',
'iscsi_initiator_iqn': 'fake_iqn_initiator',
'iscsi_volumes': ['iscsi:fake_host::3260:1:fake_iqn']}
with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task:

View File

@ -0,0 +1,5 @@
---
fixes:
- Fixes a problem when using boot from volume with the pxe boot interface,
now when booting the correct iscsi initiator is used.
`bug 1724275 <https://bugs.launchpad.net/ironic/+bug/1724275>`_