summaryrefslogtreecommitdiff
path: root/ironic_python_agent
diff options
context:
space:
mode:
authorArne Wiebalck <Arne.Wiebalck@cern.ch>2021-10-04 16:57:56 +0200
committerArne Wiebalck <Arne.Wiebalck@cern.ch>2021-10-05 11:42:49 +0200
commit9d707e9f4bab40109b7e29df2136e86d65325ea3 (patch)
tree4318b14031e100705d9ceebebe6ddacb2be69778 /ironic_python_agent
parent8d901ff0dca45fb94a3ae079fee66626747285c0 (diff)
downloadironic-python-agent-9d707e9f4bab40109b7e29df2136e86d65325ea3.tar.gz
Software RAID: Call udev_settle before creation
This patch fixes a race during software RAID creation: we create the partition with parted, the kernel then notifies udev, but we need to wait for udevd to create the device files before calling mdadm to create the md device. Credits to jcosmao for finding this. Change-Id: I642f28acc351cf50263e37dfbc8468bf59de2cc5
Diffstat (limited to 'ironic_python_agent')
-rw-r--r--ironic_python_agent/hardware.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/ironic_python_agent/hardware.py b/ironic_python_agent/hardware.py
index fb743744..3f3e4e0c 100644
--- a/ironic_python_agent/hardware.py
+++ b/ironic_python_agent/hardware.py
@@ -2152,6 +2152,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