summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Wiebalck <Arne.Wiebalck@cern.ch>2021-11-06 13:28:06 +0100
committerArne Wiebalck <Arne.Wiebalck@cern.ch>2021-11-09 08:48:50 +0100
commit56fa7c9651386120eb63d65f3714625363deab1a (patch)
tree64aca088d4bd93c16746581efeb63699cb6c3637
parent198f06e001b237debaa718d87b8d112e542db1fa (diff)
downloadironic-python-agent-56fa7c9651386120eb63d65f3714625363deab1a.tar.gz
Re-read the partition table with partx -a
Re-read the partition table with 'partx -a', rather than 'partx -u'. This should fix an timing issue where the bootloader installation fails to mount the EFI partition from a whole disk image since it is not yet aware of the new partitions (observed with both, the iscsi and the direct deploy interface). Change-Id: If5da3075e813ae01df3decf8f0647aba111b0515 (cherry picked from commit dc8c1f16f9a00e2bff21612d1a9cf0ea0f3addf0)
-rw-r--r--ironic_python_agent/extensions/image.py2
-rw-r--r--ironic_python_agent/tests/unit/extensions/test_image.py30
-rw-r--r--releasenotes/notes/fix-rescan-device-7b00c6836b687ce8.yaml5
3 files changed, 21 insertions, 16 deletions
diff --git a/ironic_python_agent/extensions/image.py b/ironic_python_agent/extensions/image.py
index cd4245db..97526829 100644
--- a/ironic_python_agent/extensions/image.py
+++ b/ironic_python_agent/extensions/image.py
@@ -62,7 +62,7 @@ def _rescan_device(device):
kernel partition records.
"""
try:
- utils.execute('partx', '-u', device, attempts=3,
+ utils.execute('partx', '-a', device, attempts=3,
delay_on_retry=True)
utils.execute('udevadm', 'settle')
except processutils.ProcessExecutionError:
diff --git a/ironic_python_agent/tests/unit/extensions/test_image.py b/ironic_python_agent/tests/unit/extensions/test_image.py
index 05e937b8..a8021d3e 100644
--- a/ironic_python_agent/tests/unit/extensions/test_image.py
+++ b/ironic_python_agent/tests/unit/extensions/test_image.py
@@ -231,7 +231,7 @@ class TestImageExtension(base.IronicAgentTest):
('', ''), ('', '')])
expected = [mock.call('efibootmgr', '--version'),
- mock.call('partx', '-u', '/dev/fake', attempts=3,
+ mock.call('partx', '-a', '/dev/fake', attempts=3,
delay_on_retry=True),
mock.call('udevadm', 'settle'),
mock.call('mount', self.fake_efi_system_part,
@@ -278,7 +278,7 @@ class TestImageExtension(base.IronicAgentTest):
('', ''), ('', '')])
expected = [mock.call('efibootmgr', '--version'),
- mock.call('partx', '-u', '/dev/fake', attempts=3,
+ mock.call('partx', '-a', '/dev/fake', attempts=3,
delay_on_retry=True),
mock.call('udevadm', 'settle'),
mock.call('mount', self.fake_efi_system_part,
@@ -330,7 +330,7 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
('', ''), ('', '')])
expected = [mock.call('efibootmgr', '--version'),
- mock.call('partx', '-u', '/dev/fake', attempts=3,
+ mock.call('partx', '-a', '/dev/fake', attempts=3,
delay_on_retry=True),
mock.call('udevadm', 'settle'),
mock.call('mount', self.fake_efi_system_part,
@@ -382,7 +382,7 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
('', '')])
expected = [mock.call('efibootmgr', '--version'),
- mock.call('partx', '-u', '/dev/fake', attempts=3,
+ mock.call('partx', '-a', '/dev/fake', attempts=3,
delay_on_retry=True),
mock.call('udevadm', 'settle'),
mock.call('mount', self.fake_efi_system_part,
@@ -1826,7 +1826,7 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
efi_system_part_uuid=self.fake_efi_system_part_uuid,
target_boot_mode='uefi')
- expected = [mock.call('partx', '-u', '/dev/fake', attempts=3,
+ expected = [mock.call('partx', '-a', '/dev/fake', attempts=3,
delay_on_retry=True),
mock.call('udevadm', 'settle'),
mock.call('mount', '/dev/fake2', self.fake_dir),
@@ -2001,7 +2001,7 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
root_part = image._get_partition(self.fake_dev, self.fake_root_uuid)
self.assertEqual('/dev/test2', root_part)
- expected = [mock.call('partx', '-u', self.fake_dev, attempts=3,
+ expected = [mock.call('partx', '-a', self.fake_dev, attempts=3,
delay_on_retry=True),
mock.call('udevadm', 'settle'),
mock.call('lsblk', '-PbioKNAME,UUID,PARTUUID,TYPE,LABEL',
@@ -2025,7 +2025,7 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
self.assertRaises(errors.DeviceNotFound,
image._get_partition, self.fake_dev,
self.fake_root_uuid)
- expected = [mock.call('partx', '-u', self.fake_dev, attempts=3,
+ expected = [mock.call('partx', '-a', self.fake_dev, attempts=3,
delay_on_retry=True),
mock.call('udevadm', 'settle'),
mock.call('lsblk', '-PbioKNAME,UUID,PARTUUID,TYPE,LABEL',
@@ -2048,7 +2048,7 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
result = image._get_partition(self.fake_dev, self.fake_root_uuid)
self.assertEqual('/dev/loop0', result)
- expected = [mock.call('partx', '-u', self.fake_dev, attempts=3,
+ expected = [mock.call('partx', '-a', self.fake_dev, attempts=3,
delay_on_retry=True),
mock.call('udevadm', 'settle'),
mock.call('lsblk', '-PbioKNAME,UUID,PARTUUID,TYPE,LABEL',
@@ -2068,7 +2068,7 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
image._get_partition, self.fake_dev,
self.fake_root_uuid)
- expected = [mock.call('partx', '-u', self.fake_dev, attempts=3,
+ expected = [mock.call('partx', '-a', self.fake_dev, attempts=3,
delay_on_retry=True),
mock.call('udevadm', 'settle'),
mock.call('lsblk', '-PbioKNAME,UUID,PARTUUID,TYPE,LABEL',
@@ -2088,7 +2088,7 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
root_part = image._get_partition(self.fake_dev, self.fake_root_uuid)
self.assertEqual('/dev/test2', root_part)
- expected = [mock.call('partx', '-u', self.fake_dev, attempts=3,
+ expected = [mock.call('partx', '-a', self.fake_dev, attempts=3,
delay_on_retry=True),
mock.call('udevadm', 'settle'),
mock.call('lsblk', '-PbioKNAME,UUID,PARTUUID,TYPE,LABEL',
@@ -2107,7 +2107,7 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
root_part = image._get_partition(self.fake_dev, self.fake_root_uuid)
self.assertEqual('/dev/test2', root_part)
- expected = [mock.call('partx', '-u', self.fake_dev, attempts=3,
+ expected = [mock.call('partx', '-a', self.fake_dev, attempts=3,
delay_on_retry=True),
mock.call('udevadm', 'settle'),
mock.call('lsblk', '-PbioKNAME,UUID,PARTUUID,TYPE,LABEL',
@@ -2221,7 +2221,7 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
('', ''), ('', ''),
('', '')])
- expected = [mock.call('partx', '-u', '/dev/fake', attempts=3,
+ expected = [mock.call('partx', '-a', '/dev/fake', attempts=3,
delay_on_retry=True),
mock.call('udevadm', 'settle'),
mock.call('mount', self.fake_efi_system_part,
@@ -2265,7 +2265,7 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
('', ''), ('', ''),
('', '')])
- expected = [mock.call('partx', '-u', '/dev/fake', attempts=3,
+ expected = [mock.call('partx', '-a', '/dev/fake', attempts=3,
delay_on_retry=True),
mock.call('udevadm', 'settle'),
mock.call('mount', self.fake_efi_system_part,
@@ -2305,7 +2305,7 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
('', ''), ('', ''),
('', '')])
- expected = [mock.call('partx', '-u', '/dev/fakenvme0', attempts=3,
+ expected = [mock.call('partx', '-a', '/dev/fakenvme0', attempts=3,
delay_on_retry=True),
mock.call('udevadm', 'settle'),
mock.call('mount', '/dev/fakenvme0p1',
@@ -2345,7 +2345,7 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
('', ''), ('', ''),
('', '')])
- expected = [mock.call('partx', '-u', '/dev/fake', attempts=3,
+ expected = [mock.call('partx', '-a', '/dev/fake', attempts=3,
delay_on_retry=True),
mock.call('udevadm', 'settle'),
mock.call('mount', self.fake_efi_system_part,
diff --git a/releasenotes/notes/fix-rescan-device-7b00c6836b687ce8.yaml b/releasenotes/notes/fix-rescan-device-7b00c6836b687ce8.yaml
new file mode 100644
index 00000000..05dee911
--- /dev/null
+++ b/releasenotes/notes/fix-rescan-device-7b00c6836b687ce8.yaml
@@ -0,0 +1,5 @@
+---
+fixes:
+ - |
+ Fixes an issue where partitions are not visible due to a
+ incorrect call to have the partition table re-read.