summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-08-17 12:47:45 +0000
committerGerrit Code Review <review@openstack.org>2022-08-17 12:47:45 +0000
commitf89d54f4b89cdf3b5b079f6b48d26983f266b6a2 (patch)
tree050fb1873f192eef7a658f94dc1742b09012b53f
parent3a4baa637fb6a661e88f07b79c46f532ebd898c9 (diff)
parent1ac61e1dbd11458ced58fb77e599ca88363b1b1b (diff)
downloadironic-python-agent-f89d54f4b89cdf3b5b079f6b48d26983f266b6a2.tar.gz
Merge "Improve function list_block_devices_check_skip_list"
-rw-r--r--doc/source/admin/hardware_managers.rst9
-rw-r--r--ironic_python_agent/hardware.py36
2 files changed, 20 insertions, 25 deletions
diff --git a/doc/source/admin/hardware_managers.rst b/doc/source/admin/hardware_managers.rst
index ddc7dacf..6c72ba1a 100644
--- a/doc/source/admin/hardware_managers.rst
+++ b/doc/source/admin/hardware_managers.rst
@@ -113,10 +113,13 @@ unsafe conditions from occuring.
Devices Skip List
~~~~~~~~~~~~~~~~~
-A list of devices that Ironic does not touch during the cleaning process
-can be specified in the node properties field under
+A list of devices that Ironic does not touch during the cleaning and deployment
+process can be specified in the node properties field under
``skip_block_devices``. This should be a list of dictionaries
-containing hints to identify the drives.
+containing hints to identify the drives. For example::
+
+ 'skip_block_devices': [{'name': '/dev/vda', 'vendor': '0x1af4'}]
+
Shared Disk Cluster Filesystems
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/ironic_python_agent/hardware.py b/ironic_python_agent/hardware.py
index ffc1090d..ebd48098 100644
--- a/ironic_python_agent/hardware.py
+++ b/ironic_python_agent/hardware.py
@@ -1396,28 +1396,20 @@ class GenericHardwareManager(HardwareManager):
include_partitions=include_partitions)
properties = node.get('properties', {})
skip_list_hints = properties.get("skip_block_devices", [])
- if skip_list_hints is not None:
- skip_list = None
- serialized_devs = [dev.serialize() for dev in block_devices]
- for hint in skip_list_hints:
- found_devs = il_utils.find_devices_by_hints(serialized_devs,
- hint)
- excluded_devs = {dev['name'] for dev in found_devs}
- skipped_devices = None
- if skip_list is None:
- skip_list = excluded_devs
- skipped_devices = excluded_devs
- else:
- skipped_devices = excluded_devs.difference(skip_list)
- skip_list = skip_list.union(excluded_devs)
- if skipped_devices is not None and len(skipped_devices) > 0:
- for d in skipped_devices:
- LOG.warning("Skipping device %(device)s "
- "using hint %(hint)s",
- {'device': d, 'hint': hint})
- if skip_list is not None:
- block_devices = [d for d in block_devices
- if d.name not in skip_list]
+ if not skip_list_hints:
+ return block_devices
+ skip_list = set()
+ serialized_devs = [dev.serialize() for dev in block_devices]
+ for hint in skip_list_hints:
+ found_devs = il_utils.find_devices_by_hints(serialized_devs, hint)
+ excluded_devs = {dev['name'] for dev in found_devs}
+ skipped_devices = excluded_devs.difference(skip_list)
+ skip_list = skip_list.union(excluded_devs)
+ if skipped_devices:
+ LOG.warning("Using hint %(hint)s skipping devices: %(devs)s",
+ {'hint': hint, 'devs': ','.join(skipped_devices)})
+ block_devices = [d for d in block_devices
+ if d.name not in skip_list]
return block_devices
def get_os_install_device(self, permit_refresh=False):