Merge "Fix iscsi url generate method for ipxe"

This commit is contained in:
Zuul 2024-04-29 22:57:31 +00:00 committed by Gerrit Code Review
commit 384c692f59
3 changed files with 33 additions and 1 deletions

View File

@ -1083,7 +1083,7 @@ def get_volume_pxe_options(task):
else:
host = portal
port = ''
return ("iscsi:%(host)s::%(port)s:%(lun)s:%(iqn)s" %
return ("iscsi:%(host)s::%(port)s:%(lun)x:%(iqn)s" %
{'host': host, 'port': port, 'lun': lun, 'iqn': iqn})
def __generate_iscsi_url(properties):

View File

@ -2428,6 +2428,30 @@ class iPXEBuildConfigOptionsTestCase(db_base.DbTestCase):
options = pxe_utils.get_volume_pxe_options(task)
self.assertEqual([], options['iscsi_volumes'])
def test_get_volume_pxe_options_hexadecimal_lunid(self):
vol_id = uuidutils.generate_uuid()
object_utils.create_test_volume_target(
self.context, node_id=self.node.id, volume_type='iscsi',
boot_index=0, volume_id='1234', uuid=vol_id,
properties={'target_lun': 16,
'target_portal': 'fake_host:3260',
'target_iqns': 'fake_iqn'})
self.node.driver_internal_info.update({'boot_from_volume': vol_id})
driver_internal_info = self.node.driver_internal_info
driver_internal_info['boot_from_volume'] = vol_id
self.node.driver_internal_info = driver_internal_info
self.node.save()
expected = {'boot_from_volume': True,
'iscsi_boot_url': 'iscsi:fake_host::3260:10:fake_iqn',
'iscsi_initiator_iqn': None,
'iscsi_volumes': []
}
with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task:
options = pxe_utils.get_volume_pxe_options(task)
self.assertEqual(expected, options)
def test_build_pxe_config_options_ipxe_rescue(self):
self._test_build_pxe_config_options_ipxe(mode='rescue')

View File

@ -0,0 +1,8 @@
---
fixes:
- |
[`bug 2011053 <https://storyboard.openstack.org/#!/story/2011053>`_]
Fix issue with boot from volume feature. Convert lun field from
decimal to hexadecimal when generating iscsi url so that ipxe firmware
could be able to identify the iSCSI SAN URI correctly, according to
SAN URIs description at https://ipxe.org/sanuri.