summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2017-10-25 07:43:01 +0000
committerGerrit Code Review <review@openstack.org>2017-10-25 07:43:01 +0000
commitcf3665fe1c60d43aa39f1880e427875c9c571058 (patch)
treebd1f18d62ec4e99e7f6a278e89a78921256d30b1
parent6d54c627703522921f41b5a83548380f1961034b (diff)
parent3929bcbf8e48d21c4a8c344891cec0caf0376c00 (diff)
Merge "[bfv] Set the correct iqn for pxe" into stable/pike9.1.2
-rw-r--r--ironic/drivers/modules/pxe.py8
-rw-r--r--ironic/tests/unit/drivers/modules/test_pxe.py22
-rw-r--r--releasenotes/notes/bfv-pxe-boot-3375d331ee2f04f2.yaml5
3 files changed, 31 insertions, 4 deletions
diff --git a/ironic/drivers/modules/pxe.py b/ironic/drivers/modules/pxe.py
index 0cf4167..76cc5f5 100644
--- a/ironic/drivers/modules/pxe.py
+++ b/ironic/drivers/modules/pxe.py
@@ -297,10 +297,14 @@ def _get_volume_pxe_options(task):
297 pxe_options['username'] = properties['auth_username'] 297 pxe_options['username'] = properties['auth_username']
298 if 'auth_password' in properties: 298 if 'auth_password' in properties:
299 pxe_options['password'] = properties['auth_password'] 299 pxe_options['password'] = properties['auth_password']
300 iscsi_initiator_iqn = None
301 for vc in task.volume_connectors:
302 if vc.type == 'iqn':
303 iscsi_initiator_iqn = vc.connector_id
304
300 pxe_options.update( 305 pxe_options.update(
301 {'iscsi_boot_url': __generate_iscsi_url(volume.properties), 306 {'iscsi_boot_url': __generate_iscsi_url(volume.properties),
302 'iscsi_initiator_iqn': (__get_property(properties, 307 'iscsi_initiator_iqn': iscsi_initiator_iqn})
303 'target_iqn') or None)})
304 # NOTE(TheJulia): This may be the route to multi-path, define 308 # NOTE(TheJulia): This may be the route to multi-path, define
305 # volumes via sanhook in the ipxe template and let the OS sort it out. 309 # volumes via sanhook in the ipxe template and let the OS sort it out.
306 additional_targets = [] 310 additional_targets = []
diff --git a/ironic/tests/unit/drivers/modules/test_pxe.py b/ironic/tests/unit/drivers/modules/test_pxe.py
index 85ac9d9..44ccf29 100644
--- a/ironic/tests/unit/drivers/modules/test_pxe.py
+++ b/ironic/tests/unit/drivers/modules/test_pxe.py
@@ -378,7 +378,7 @@ class PXEPrivateMethodsTestCase(db_base.DbTestCase):
378 expected_options.update({ 378 expected_options.update({
379 'boot_from_volume': True, 379 'boot_from_volume': True,
380 'iscsi_boot_url': 'iscsi:fake_host::3260:0:fake_iqn', 380 'iscsi_boot_url': 'iscsi:fake_host::3260:0:fake_iqn',
381 'iscsi_initiator_iqn': 'fake_iqn', 381 'iscsi_initiator_iqn': 'fake_iqn_initiator',
382 'iscsi_volumes': ['iscsi:fake_host::3260:1:fake_iqn'], 382 'iscsi_volumes': ['iscsi:fake_host::3260:1:fake_iqn'],
383 'username': 'fake_username', 383 'username': 'fake_username',
384 'password': 'fake_password'}) 384 'password': 'fake_password'})
@@ -419,6 +419,12 @@ class PXEPrivateMethodsTestCase(db_base.DbTestCase):
419 def test__build_pxe_config_options_ipxe_and_iscsi_boot(self): 419 def test__build_pxe_config_options_ipxe_and_iscsi_boot(self):
420 vol_id = uuidutils.generate_uuid() 420 vol_id = uuidutils.generate_uuid()
421 vol_id2 = uuidutils.generate_uuid() 421 vol_id2 = uuidutils.generate_uuid()
422 obj_utils.create_test_volume_connector(
423 self.context,
424 uuid=uuidutils.generate_uuid(),
425 type='iqn',
426 node_id=self.node.id,
427 connector_id='fake_iqn_initiator')
422 obj_utils.create_test_volume_target( 428 obj_utils.create_test_volume_target(
423 self.context, node_id=self.node.id, volume_type='iscsi', 429 self.context, node_id=self.node.id, volume_type='iscsi',
424 boot_index=0, volume_id='1234', uuid=vol_id, 430 boot_index=0, volume_id='1234', uuid=vol_id,
@@ -439,6 +445,12 @@ class PXEPrivateMethodsTestCase(db_base.DbTestCase):
439 def test__build_pxe_config_options_ipxe_and_iscsi_boot_from_lists(self): 445 def test__build_pxe_config_options_ipxe_and_iscsi_boot_from_lists(self):
440 vol_id = uuidutils.generate_uuid() 446 vol_id = uuidutils.generate_uuid()
441 vol_id2 = uuidutils.generate_uuid() 447 vol_id2 = uuidutils.generate_uuid()
448 obj_utils.create_test_volume_connector(
449 self.context,
450 uuid=uuidutils.generate_uuid(),
451 type='iqn',
452 node_id=self.node.id,
453 connector_id='fake_iqn_initiator')
442 obj_utils.create_test_volume_target( 454 obj_utils.create_test_volume_target(
443 self.context, node_id=self.node.id, volume_type='iscsi', 455 self.context, node_id=self.node.id, volume_type='iscsi',
444 boot_index=0, volume_id='1234', uuid=vol_id, 456 boot_index=0, volume_id='1234', uuid=vol_id,
@@ -460,6 +472,12 @@ class PXEPrivateMethodsTestCase(db_base.DbTestCase):
460 def test__get_volume_pxe_options(self): 472 def test__get_volume_pxe_options(self):
461 vol_id = uuidutils.generate_uuid() 473 vol_id = uuidutils.generate_uuid()
462 vol_id2 = uuidutils.generate_uuid() 474 vol_id2 = uuidutils.generate_uuid()
475 obj_utils.create_test_volume_connector(
476 self.context,
477 uuid=uuidutils.generate_uuid(),
478 type='iqn',
479 node_id=self.node.id,
480 connector_id='fake_iqn_initiator')
463 obj_utils.create_test_volume_target( 481 obj_utils.create_test_volume_target(
464 self.context, node_id=self.node.id, volume_type='iscsi', 482 self.context, node_id=self.node.id, volume_type='iscsi',
465 boot_index=0, volume_id='1234', uuid=vol_id, 483 boot_index=0, volume_id='1234', uuid=vol_id,
@@ -483,7 +501,7 @@ class PXEPrivateMethodsTestCase(db_base.DbTestCase):
483 expected = {'boot_from_volume': True, 501 expected = {'boot_from_volume': True,
484 'username': 'fake_username', 'password': 'fake_password', 502 'username': 'fake_username', 'password': 'fake_password',
485 'iscsi_boot_url': 'iscsi:fake_host::3260:0:fake_iqn', 503 'iscsi_boot_url': 'iscsi:fake_host::3260:0:fake_iqn',
486 'iscsi_initiator_iqn': 'fake_iqn', 504 'iscsi_initiator_iqn': 'fake_iqn_initiator',
487 'iscsi_volumes': ['iscsi:fake_host::3260:1:fake_iqn']} 505 'iscsi_volumes': ['iscsi:fake_host::3260:1:fake_iqn']}
488 with task_manager.acquire(self.context, self.node.uuid, 506 with task_manager.acquire(self.context, self.node.uuid,
489 shared=True) as task: 507 shared=True) as task:
diff --git a/releasenotes/notes/bfv-pxe-boot-3375d331ee2f04f2.yaml b/releasenotes/notes/bfv-pxe-boot-3375d331ee2f04f2.yaml
new file mode 100644
index 0000000..8aae1ce
--- /dev/null
+++ b/releasenotes/notes/bfv-pxe-boot-3375d331ee2f04f2.yaml
@@ -0,0 +1,5 @@
1---
2fixes:
3 - Fixes a problem when using boot from volume with the pxe boot interface,
4 now when booting the correct iscsi initiator is used.
5 `bug 1724275 <https://bugs.launchpad.net/ironic/+bug/1724275>`_