Skip to content

Commit bce22e2

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Re-read the partition table with partx -a" into stable/wallaby
2 parents 434a739 + ab3e8a7 commit bce22e2

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

ironic_python_agent/extensions/image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def _rescan_device(device):
6363
kernel partition records.
6464
"""
6565
try:
66-
utils.execute('partx', '-u', device, attempts=3,
66+
utils.execute('partx', '-a', device, attempts=3,
6767
delay_on_retry=True)
6868
utils.execute('udevadm', 'settle')
6969
except processutils.ProcessExecutionError:

ironic_python_agent/tests/unit/extensions/test_image.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def test__uefi_bootloader_given_partition(
254254
('', ''), ('', '')])
255255

256256
expected = [mock.call('efibootmgr', '--version'),
257-
mock.call('partx', '-u', '/dev/fake', attempts=3,
257+
mock.call('partx', '-a', '/dev/fake', attempts=3,
258258
delay_on_retry=True),
259259
mock.call('udevadm', 'settle'),
260260
mock.call('mount', self.fake_efi_system_part,
@@ -302,7 +302,7 @@ def test__uefi_bootloader_find_partition(
302302
('', ''), ('', '')])
303303

304304
expected = [mock.call('efibootmgr', '--version'),
305-
mock.call('partx', '-u', '/dev/fake', attempts=3,
305+
mock.call('partx', '-a', '/dev/fake', attempts=3,
306306
delay_on_retry=True),
307307
mock.call('udevadm', 'settle'),
308308
mock.call('mount', self.fake_efi_system_part,
@@ -355,7 +355,7 @@ def test__uefi_bootloader_with_entry_removal(
355355
('', ''), ('', '')])
356356

357357
expected = [mock.call('efibootmgr', '--version'),
358-
mock.call('partx', '-u', '/dev/fake', attempts=3,
358+
mock.call('partx', '-a', '/dev/fake', attempts=3,
359359
delay_on_retry=True),
360360
mock.call('udevadm', 'settle'),
361361
mock.call('mount', self.fake_efi_system_part,
@@ -408,7 +408,7 @@ def test__add_multi_bootloaders(
408408
('', '')])
409409

410410
expected = [mock.call('efibootmgr', '--version'),
411-
mock.call('partx', '-u', '/dev/fake', attempts=3,
411+
mock.call('partx', '-a', '/dev/fake', attempts=3,
412412
delay_on_retry=True),
413413
mock.call('udevadm', 'settle'),
414414
mock.call('mount', self.fake_efi_system_part,
@@ -1917,7 +1917,7 @@ def test__get_partition(self, mock_is_md_device, mock_is_bootloader,
19171917

19181918
root_part = image._get_partition(self.fake_dev, self.fake_root_uuid)
19191919
self.assertEqual('/dev/test2', root_part)
1920-
expected = [mock.call('partx', '-u', self.fake_dev, attempts=3,
1920+
expected = [mock.call('partx', '-a', self.fake_dev, attempts=3,
19211921
delay_on_retry=True),
19221922
mock.call('udevadm', 'settle'),
19231923
mock.call('lsblk', '-PbioKNAME,UUID,PARTUUID,TYPE,LABEL',
@@ -1941,7 +1941,7 @@ def test__get_partition_no_device_found(self, mock_is_md_device,
19411941
self.assertRaises(errors.DeviceNotFound,
19421942
image._get_partition, self.fake_dev,
19431943
self.fake_root_uuid)
1944-
expected = [mock.call('partx', '-u', self.fake_dev, attempts=3,
1944+
expected = [mock.call('partx', '-a', self.fake_dev, attempts=3,
19451945
delay_on_retry=True),
19461946
mock.call('udevadm', 'settle'),
19471947
mock.call('lsblk', '-PbioKNAME,UUID,PARTUUID,TYPE,LABEL',
@@ -1964,7 +1964,7 @@ def test__get_partition_fallback_partuuid(self, mock_is_md_device,
19641964

19651965
result = image._get_partition(self.fake_dev, self.fake_root_uuid)
19661966
self.assertEqual('/dev/loop0', result)
1967-
expected = [mock.call('partx', '-u', self.fake_dev, attempts=3,
1967+
expected = [mock.call('partx', '-a', self.fake_dev, attempts=3,
19681968
delay_on_retry=True),
19691969
mock.call('udevadm', 'settle'),
19701970
mock.call('lsblk', '-PbioKNAME,UUID,PARTUUID,TYPE,LABEL',
@@ -1984,7 +1984,7 @@ def test__get_partition_command_fail(self, mock_is_md_device,
19841984
image._get_partition, self.fake_dev,
19851985
self.fake_root_uuid)
19861986

1987-
expected = [mock.call('partx', '-u', self.fake_dev, attempts=3,
1987+
expected = [mock.call('partx', '-a', self.fake_dev, attempts=3,
19881988
delay_on_retry=True),
19891989
mock.call('udevadm', 'settle'),
19901990
mock.call('lsblk', '-PbioKNAME,UUID,PARTUUID,TYPE,LABEL',
@@ -2004,7 +2004,7 @@ def test__get_partition_partuuid(self, mock_is_md_device, mock_execute,
20042004

20052005
root_part = image._get_partition(self.fake_dev, self.fake_root_uuid)
20062006
self.assertEqual('/dev/test2', root_part)
2007-
expected = [mock.call('partx', '-u', self.fake_dev, attempts=3,
2007+
expected = [mock.call('partx', '-a', self.fake_dev, attempts=3,
20082008
delay_on_retry=True),
20092009
mock.call('udevadm', 'settle'),
20102010
mock.call('lsblk', '-PbioKNAME,UUID,PARTUUID,TYPE,LABEL',
@@ -2023,7 +2023,7 @@ def test__get_partition_label(self, mock_is_md_device, mock_execute,
20232023

20242024
root_part = image._get_partition(self.fake_dev, self.fake_root_uuid)
20252025
self.assertEqual('/dev/test2', root_part)
2026-
expected = [mock.call('partx', '-u', self.fake_dev, attempts=3,
2026+
expected = [mock.call('partx', '-a', self.fake_dev, attempts=3,
20272027
delay_on_retry=True),
20282028
mock.call('udevadm', 'settle'),
20292029
mock.call('lsblk', '-PbioKNAME,UUID,PARTUUID,TYPE,LABEL',
@@ -2137,7 +2137,7 @@ def test__manage_uefi(self, mkdir_mock, mock_utils_efi_part,
21372137
('', ''), ('', ''),
21382138
('', '')])
21392139

2140-
expected = [mock.call('partx', '-u', '/dev/fake', attempts=3,
2140+
expected = [mock.call('partx', '-a', '/dev/fake', attempts=3,
21412141
delay_on_retry=True),
21422142
mock.call('udevadm', 'settle'),
21432143
mock.call('mount', self.fake_efi_system_part,
@@ -2181,7 +2181,7 @@ def test__manage_uefi_found_csv(self, mkdir_mock, mock_utils_efi_part,
21812181
('', ''), ('', ''),
21822182
('', '')])
21832183

2184-
expected = [mock.call('partx', '-u', '/dev/fake', attempts=3,
2184+
expected = [mock.call('partx', '-a', '/dev/fake', attempts=3,
21852185
delay_on_retry=True),
21862186
mock.call('udevadm', 'settle'),
21872187
mock.call('mount', self.fake_efi_system_part,
@@ -2221,7 +2221,7 @@ def test__manage_uefi_nvme_device(self, mkdir_mock, mock_utils_efi_part,
22212221
('', ''), ('', ''),
22222222
('', '')])
22232223

2224-
expected = [mock.call('partx', '-u', '/dev/fakenvme0', attempts=3,
2224+
expected = [mock.call('partx', '-a', '/dev/fakenvme0', attempts=3,
22252225
delay_on_retry=True),
22262226
mock.call('udevadm', 'settle'),
22272227
mock.call('mount', '/dev/fakenvme0p1',
@@ -2261,7 +2261,7 @@ def test__manage_uefi_wholedisk(
22612261
('', ''), ('', ''),
22622262
('', '')])
22632263

2264-
expected = [mock.call('partx', '-u', '/dev/fake', attempts=3,
2264+
expected = [mock.call('partx', '-a', '/dev/fake', attempts=3,
22652265
delay_on_retry=True),
22662266
mock.call('udevadm', 'settle'),
22672267
mock.call('mount', self.fake_efi_system_part,
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
Fixes an issue where partitions are not visible due to a
5+
incorrect call to have the partition table re-read.

0 commit comments

Comments
 (0)