summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulia Kreger <juliaashleykreger@gmail.com>2022-08-04 10:10:00 -0700
committerJay Faulkner <jay@jvf.cc>2022-09-20 13:37:05 -0700
commit42b6941f878e8db36a0265c0139dd10025ec673f (patch)
tree9d4c2d055332b4dc51f91bdb76b50f375d652ae6
parente80c7c088962a72be8f723d92703174ce79bd425 (diff)
downloadironic-42b6941f878e8db36a0265c0139dd10025ec673f.tar.gz
Fix pxe image lookups
Image lookups in the PXE interface, for anaconda specific code, were previously hard coded to try and invoke use of glance if needed. Except, not everything is glance. Conflicts: ironic/tests/unit/common/test_pxe_utils.py Change-Id: I8791623be95e7e47739ee051753de97eb0e5e2a3 (cherry picked from commit 7b47e09a385d388854a3c81bc13c333b36c18a36)
-rw-r--r--ironic/common/pxe_utils.py17
-rw-r--r--releasenotes/notes/fix-pxe-glance-lookup-anaconda-86fe616c6286ec08.yaml6
2 files changed, 17 insertions, 6 deletions
diff --git a/ironic/common/pxe_utils.py b/ironic/common/pxe_utils.py
index b0f1d906f..4a763ee27 100644
--- a/ironic/common/pxe_utils.py
+++ b/ironic/common/pxe_utils.py
@@ -681,8 +681,10 @@ def get_instance_image_info(task, ipxe_enabled=False):
def _get_image_properties():
nonlocal image_properties
if not image_properties:
- glance_service = service.GlanceImageService(context=ctx)
- image_properties = glance_service.show(
+ i_service = service.get_image_service(
+ d_info['image_source'],
+ context=ctx)
+ image_properties = i_service.show(
d_info['image_source'])['properties']
labels = ('kernel', 'ramdisk')
@@ -691,10 +693,13 @@ def get_instance_image_info(task, ipxe_enabled=False):
# we won't use any of them. We'll use the values specified
# with the image, which we assume have been set.
_get_image_properties()
- for label in labels:
- i_info[label] = str(image_properties[label + '_id'])
- node.instance_info = i_info
- node.save()
+ if image_properties:
+ # This is intended for Glance usage, but all image properties
+ # should be routed through the image service request routing.
+ for label in labels:
+ i_info[label] = str(image_properties[label + '_id'])
+ node.instance_info = i_info
+ node.save()
anaconda_labels = ()
if deploy_utils.get_boot_option(node) == 'kickstart':
diff --git a/releasenotes/notes/fix-pxe-glance-lookup-anaconda-86fe616c6286ec08.yaml b/releasenotes/notes/fix-pxe-glance-lookup-anaconda-86fe616c6286ec08.yaml
new file mode 100644
index 000000000..bf6b8ea85
--- /dev/null
+++ b/releasenotes/notes/fix-pxe-glance-lookup-anaconda-86fe616c6286ec08.yaml
@@ -0,0 +1,6 @@
+---
+fixes:
+ - |
+ Fixes an issue in the ``anaconda`` deployment interface where PXE argument
+ processing and preparation was erroniously directly connecting to Glance,
+ potentially leading to an exception in the standalone use case.