summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 9861d70b..e9bf67a5 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 1648db15..1a4c6f28 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,
@@ -334,7 +334,7 @@ Boot0002: VENDMAGIC FvFile(9f3c6294-bf9b-4208-9808-be45dfc34b51)
('', ''), ('', '')])
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,
@@ -385,7 +385,7 @@ Boot0002: VENDMAGIC FvFile(9f3c6294-bf9b-4208-9808-be45dfc34b51)
('', '')])
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,
@@ -1829,7 +1829,7 @@ Boot0002: VENDMAGIC FvFile(9f3c6294-bf9b-4208-9808-be45dfc34b51)
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),
@@ -2004,7 +2004,7 @@ Boot0002: VENDMAGIC FvFile(9f3c6294-bf9b-4208-9808-be45dfc34b51)
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',
@@ -2028,7 +2028,7 @@ Boot0002: VENDMAGIC FvFile(9f3c6294-bf9b-4208-9808-be45dfc34b51)
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',
@@ -2051,7 +2051,7 @@ Boot0002: VENDMAGIC FvFile(9f3c6294-bf9b-4208-9808-be45dfc34b51)
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',
@@ -2071,7 +2071,7 @@ Boot0002: VENDMAGIC FvFile(9f3c6294-bf9b-4208-9808-be45dfc34b51)
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',
@@ -2091,7 +2091,7 @@ Boot0002: VENDMAGIC FvFile(9f3c6294-bf9b-4208-9808-be45dfc34b51)
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',
@@ -2110,7 +2110,7 @@ Boot0002: VENDMAGIC FvFile(9f3c6294-bf9b-4208-9808-be45dfc34b51)
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',
@@ -2224,7 +2224,7 @@ Boot0002: VENDMAGIC FvFile(9f3c6294-bf9b-4208-9808-be45dfc34b51)
('', ''), ('', ''),
('', '')])
- 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,
@@ -2279,7 +2279,7 @@ Boot0002: VENDMAGIC FvFile(9f3c6294-bf9b-4208-9808-be45dfc34b51)
('', ''), ('', ''),
('', '')])
- 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,
@@ -2321,7 +2321,7 @@ Boot0002: VENDMAGIC FvFile(9f3c6294-bf9b-4208-9808-be45dfc34b51)
('', ''), ('', ''),
('', '')])
- 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',
@@ -2361,7 +2361,7 @@ Boot0002: VENDMAGIC FvFile(9f3c6294-bf9b-4208-9808-be45dfc34b51)
('', ''), ('', ''),
('', '')])
- 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.