diff options
author | Zuul <zuul@review.opendev.org> | 2021-11-09 11:59:56 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-11-09 11:59:56 +0000 |
commit | bce22e27488a870928e42e30fcf2f40c6320643e (patch) | |
tree | dcca25a1de2a4e5f07bb3a2ebe1ec9f883530e41 | |
parent | 434a7391293cea8bfdc9faa373187ad102f030f6 (diff) | |
parent | ab3e8a75badf2719602b2416af9e3c19d7511c79 (diff) | |
download | ironic-python-agent-bce22e27488a870928e42e30fcf2f40c6320643e.tar.gz |
Merge "Re-read the partition table with partx -a" into stable/wallaby
-rw-r--r-- | ironic_python_agent/extensions/image.py | 2 | ||||
-rw-r--r-- | ironic_python_agent/tests/unit/extensions/test_image.py | 28 | ||||
-rw-r--r-- | releasenotes/notes/fix-rescan-device-7b00c6836b687ce8.yaml | 5 |
3 files changed, 20 insertions, 15 deletions
diff --git a/ironic_python_agent/extensions/image.py b/ironic_python_agent/extensions/image.py index a39ed353..500f2ba4 100644 --- a/ironic_python_agent/extensions/image.py +++ b/ironic_python_agent/extensions/image.py @@ -63,7 +63,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 f524bc5b..ddc416d4 100644 --- a/ironic_python_agent/tests/unit/extensions/test_image.py +++ b/ironic_python_agent/tests/unit/extensions/test_image.py @@ -254,7 +254,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, @@ -302,7 +302,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, @@ -355,7 +355,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, @@ -408,7 +408,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, @@ -1917,7 +1917,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', @@ -1941,7 +1941,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', @@ -1964,7 +1964,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', @@ -1984,7 +1984,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', @@ -2004,7 +2004,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', @@ -2023,7 +2023,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', @@ -2137,7 +2137,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, @@ -2181,7 +2181,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, @@ -2221,7 +2221,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', @@ -2261,7 +2261,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. |