summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulia Kreger <juliaashleykreger@gmail.com>2020-08-21 07:35:55 -0700
committerJulia Kreger <juliaashleykreger@gmail.com>2020-08-24 13:47:06 +0000
commit23dcf0a719f07f97d48204002c500c6814190159 (patch)
tree8fded38ee2c41ae6ce9be7426c1cb4c24a077858
parent2118b4146f0024975b08afab7a4c199263b53ec4 (diff)
downloadironic-23dcf0a719f07f97d48204002c500c6814190159.tar.gz
Ansible deploy - Ignore invalid devices
This change updates the ansible deploy driver to exclude devices with "sr", "loop", and "mem" which can appear in the devices list for consideration as the root device. This change effectively causes them to be ignored. Change-Id: I72a422553ee992d313b83df091af2c9deb8393b5 (cherry picked from commit 0071d28460f1c0baa449d8f7920f4cf36e876bdc)
-rw-r--r--ironic/drivers/modules/ansible/playbooks/library/root_hints.py6
-rw-r--r--releasenotes/notes/ansible-device-name-filtering-0adfca7d8ba4cbcc.yaml9
2 files changed, 15 insertions, 0 deletions
diff --git a/ironic/drivers/modules/ansible/playbooks/library/root_hints.py b/ironic/drivers/modules/ansible/playbooks/library/root_hints.py
index eeb9b7e68..2826666e6 100644
--- a/ironic/drivers/modules/ansible/playbooks/library/root_hints.py
+++ b/ironic/drivers/modules/ansible/playbooks/library/root_hints.py
@@ -17,6 +17,8 @@ GIB = 1 << 30
EXTRA_PARAMS = set(['wwn', 'serial', 'wwn_with_extension',
'wwn_vendor_extension'])
+IGNORE_DEVICES = ['sr', 'loop', 'mem', 'fd']
+
# NOTE: ansible calculates device size as float with 2-digits precision,
# Ironic requires size in GiB, if we will use ansible size parameter
@@ -46,6 +48,10 @@ def root_hint(hints, devices):
hint = None
name = hints.pop('name', None)
for device in devices:
+ if any(x in device for x in IGNORE_DEVICES):
+ # NOTE(TheJulia): Devices like CD roms, Loop devices, and ramdisks
+ # should not be considered as target devices.
+ continue
for key in hints:
if hints[key] != devices[device].get(key):
break
diff --git a/releasenotes/notes/ansible-device-name-filtering-0adfca7d8ba4cbcc.yaml b/releasenotes/notes/ansible-device-name-filtering-0adfca7d8ba4cbcc.yaml
new file mode 100644
index 000000000..8cc47230c
--- /dev/null
+++ b/releasenotes/notes/ansible-device-name-filtering-0adfca7d8ba4cbcc.yaml
@@ -0,0 +1,9 @@
+---
+fixes:
+ - |
+ Fixes an issue with the ``ansible`` deployment interface where automatic
+ root deviec selection would accidently choose the system CD-ROM device,
+ which was likely to occur when the ansible deployment interface was used
+ with virtual media boot.
+ The ``ansible`` deployment interface now ignores all Ramdisks, Loopbacks,
+ CD-ROMs, and floppy disk devices.