summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ironic_python_agent/hardware.py7
-rw-r--r--releasenotes/notes/fix-nvme-software-raid-race-2e0e104de9611228.yaml7
2 files changed, 14 insertions, 0 deletions
diff --git a/ironic_python_agent/hardware.py b/ironic_python_agent/hardware.py
index be955727..256af6f6 100644
--- a/ironic_python_agent/hardware.py
+++ b/ironic_python_agent/hardware.py
@@ -2029,6 +2029,13 @@ class GenericHardwareManager(HardwareManager):
utils.execute('parted', device, '-s', '-a',
'optimal', '--', 'mkpart', 'primary',
start_str, end_str)
+
+ # Parted/udev partition creation is asynchronous.
+ # Wait for udev events to be processed before going to
+ # next step. This avoids getting errors at mdadm
+ # create because a device is not ready yet.
+ _udev_settle()
+
# Necessary, if we want to avoid hitting
# an error when creating the mdadm array below
# 'mdadm: cannot open /dev/nvme1n1p1: No such file
diff --git a/releasenotes/notes/fix-nvme-software-raid-race-2e0e104de9611228.yaml b/releasenotes/notes/fix-nvme-software-raid-race-2e0e104de9611228.yaml
new file mode 100644
index 00000000..1a6bfa57
--- /dev/null
+++ b/releasenotes/notes/fix-nvme-software-raid-race-2e0e104de9611228.yaml
@@ -0,0 +1,7 @@
+---
+fixes:
+ - |
+ Fixes a race on software RAID creation: since the creation of
+ partitions is asynchronous, we need to wait for all udev events
+ to be processed before we can use the partitions to create an
+ md device.