diff --git a/ironic_python_agent/tests/unit/extensions/test_image.py b/ironic_python_agent/tests/unit/extensions/test_image.py index b2506b9c1..ba0828ed0 100644 --- a/ironic_python_agent/tests/unit/extensions/test_image.py +++ b/ironic_python_agent/tests/unit/extensions/test_image.py @@ -234,7 +234,7 @@ class TestImageExtension(base.IronicAgentTest): ('', ''), ('', '')]) expected = [mock.call('efibootmgr', '--version'), - mock.call('partx', '-a', '/dev/fake', attempts=3, + mock.call('partx', '-av', '/dev/fake', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('mount', self.fake_efi_system_part, @@ -281,7 +281,7 @@ class TestImageExtension(base.IronicAgentTest): ('', ''), ('', '')]) expected = [mock.call('efibootmgr', '--version'), - mock.call('partx', '-a', '/dev/fake', attempts=3, + mock.call('partx', '-av', '/dev/fake', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('mount', self.fake_efi_system_part, @@ -337,7 +337,7 @@ Boot0002 VENDMAGIC FvFile(9f3c6294-bf9b-4208-9808-be45dfc34b51) ('', ''), ('', '')]) expected = [mock.call('efibootmgr', '--version'), - mock.call('partx', '-a', '/dev/fake', attempts=3, + mock.call('partx', '-av', '/dev/fake', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('mount', self.fake_efi_system_part, @@ -398,7 +398,7 @@ Boot0004* ironic1 HD(1,GPT,55db8d03-c8f6-4a5b-9155-790dddc348fa,0x800,0x640 ('', ''), ('', ''), ('', ''), ('', '')]) expected = [mock.call('efibootmgr', '--version'), - mock.call('partx', '-a', '/dev/fake', attempts=3, + mock.call('partx', '-av', '/dev/fake', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('mount', self.fake_efi_system_part, @@ -450,7 +450,7 @@ Boot0004* ironic1 HD(1,GPT,55db8d03-c8f6-4a5b-9155-790dddc348fa,0x800,0x640 ('', '')]) expected = [mock.call('efibootmgr', '--version'), - mock.call('partx', '-a', '/dev/fake', attempts=3, + mock.call('partx', '-av', '/dev/fake', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('mount', self.fake_efi_system_part, @@ -1908,7 +1908,7 @@ Boot0004* ironic1 HD(1,GPT,55db8d03-c8f6-4a5b-9155-790dddc348fa,0x800,0x640 efi_system_part_uuid=self.fake_efi_system_part_uuid, target_boot_mode='uefi') - expected = [mock.call('partx', '-a', '/dev/fake', attempts=3, + expected = [mock.call('partx', '-av', '/dev/fake', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('mount', '/dev/fake2', self.fake_dir), diff --git a/ironic_python_agent/tests/unit/test_hardware.py b/ironic_python_agent/tests/unit/test_hardware.py index 7b19931b3..a9deb79b8 100644 --- a/ironic_python_agent/tests/unit/test_hardware.py +++ b/ironic_python_agent/tests/unit/test_hardware.py @@ -2563,22 +2563,22 @@ class TestGenericHardwareManager(base.IronicAgentTest): mock.call('sgdisk', '-F', '/dev/sdb'), mock.call('parted', '/dev/sda', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '42s', '10GiB'), - mock.call('partx', '-a', '/dev/sda', attempts=3, + mock.call('partx', '-av', '/dev/sda', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdb', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '42s', '10GiB'), - mock.call('partx', '-a', '/dev/sdb', attempts=3, + mock.call('partx', '-av', '/dev/sdb', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sda', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '10GiB', '-1'), - mock.call('partx', '-a', '/dev/sda', attempts=3, + mock.call('partx', '-av', '/dev/sda', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdb', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '10GiB', '-1'), - mock.call('partx', '-a', '/dev/sdb', attempts=3, + mock.call('partx', '-av', '/dev/sdb', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('mdadm', '--create', '/dev/md0', '--force', '--run', @@ -2658,32 +2658,32 @@ class TestGenericHardwareManager(base.IronicAgentTest): mock.call('sgdisk', '-F', '/dev/sdc'), mock.call('parted', '/dev/sda', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '42s', '10GiB'), - mock.call('partx', '-a', '/dev/sda', attempts=3, + mock.call('partx', '-av', '/dev/sda', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdb', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '42s', '10GiB'), - mock.call('partx', '-a', '/dev/sdb', attempts=3, + mock.call('partx', '-av', '/dev/sdb', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdc', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '42s', '10GiB'), - mock.call('partx', '-a', '/dev/sdc', attempts=3, + mock.call('partx', '-av', '/dev/sdc', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sda', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '10GiB', '-1'), - mock.call('partx', '-a', '/dev/sda', attempts=3, + mock.call('partx', '-av', '/dev/sda', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdb', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '10GiB', '-1'), - mock.call('partx', '-a', '/dev/sdb', attempts=3, + mock.call('partx', '-av', '/dev/sdb', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdc', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '10GiB', '-1'), - mock.call('partx', '-a', '/dev/sdc', attempts=3, + mock.call('partx', '-av', '/dev/sdc', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('mdadm', '--create', '/dev/md0', '--force', '--run', @@ -2764,42 +2764,42 @@ class TestGenericHardwareManager(base.IronicAgentTest): mock.call('sgdisk', '-F', '/dev/sdd'), mock.call('parted', '/dev/sda', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '42s', '10GiB'), - mock.call('partx', '-a', '/dev/sda', attempts=3, + mock.call('partx', '-av', '/dev/sda', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdb', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '42s', '10GiB'), - mock.call('partx', '-a', '/dev/sdb', attempts=3, + mock.call('partx', '-av', '/dev/sdb', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdc', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '42s', '10GiB'), - mock.call('partx', '-a', '/dev/sdc', attempts=3, + mock.call('partx', '-av', '/dev/sdc', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdd', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '42s', '10GiB'), - mock.call('partx', '-a', '/dev/sdd', attempts=3, + mock.call('partx', '-av', '/dev/sdd', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sda', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '10GiB', '-1'), - mock.call('partx', '-a', '/dev/sda', attempts=3, + mock.call('partx', '-av', '/dev/sda', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdb', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '10GiB', '-1'), - mock.call('partx', '-a', '/dev/sdb', attempts=3, + mock.call('partx', '-av', '/dev/sdb', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdc', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '10GiB', '-1'), - mock.call('partx', '-a', '/dev/sdc', attempts=3, + mock.call('partx', '-av', '/dev/sdc', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdd', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '10GiB', '-1'), - mock.call('partx', '-a', '/dev/sdd', attempts=3, + mock.call('partx', '-av', '/dev/sdd', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('mdadm', '--create', '/dev/md0', '--force', '--run', @@ -2865,22 +2865,22 @@ class TestGenericHardwareManager(base.IronicAgentTest): mock.call('parted', '/dev/sdb', '-s', '--', 'mklabel', 'gpt'), mock.call('parted', '/dev/sda', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '551MiB', '10GiB'), - mock.call('partx', '-a', '/dev/sda', attempts=3, + mock.call('partx', '-av', '/dev/sda', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdb', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '551MiB', '10GiB'), - mock.call('partx', '-a', '/dev/sdb', attempts=3, + mock.call('partx', '-av', '/dev/sdb', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sda', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '10GiB', '-1'), - mock.call('partx', '-a', '/dev/sda', attempts=3, + mock.call('partx', '-av', '/dev/sda', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdb', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '10GiB', '-1'), - mock.call('partx', '-a', '/dev/sdb', attempts=3, + mock.call('partx', '-av', '/dev/sdb', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('mdadm', '--create', '/dev/md0', '--force', '--run', @@ -2952,22 +2952,22 @@ class TestGenericHardwareManager(base.IronicAgentTest): mock.call('parted', '/dev/sdb', '-s', '--', 'mklabel', 'gpt'), mock.call('parted', '/dev/sda', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '8MiB', '10GiB'), - mock.call('partx', '-a', '/dev/sda', attempts=3, + mock.call('partx', '-av', '/dev/sda', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdb', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '8MiB', '10GiB'), - mock.call('partx', '-a', '/dev/sdb', attempts=3, + mock.call('partx', '-av', '/dev/sdb', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sda', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '10GiB', '-1'), - mock.call('partx', '-a', '/dev/sda', attempts=3, + mock.call('partx', '-av', '/dev/sda', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdb', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '10GiB', '-1'), - mock.call('partx', '-a', '/dev/sdb', attempts=3, + mock.call('partx', '-av', '/dev/sdb', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('mdadm', '--create', '/dev/md0', '--force', '--run', @@ -3034,22 +3034,22 @@ class TestGenericHardwareManager(base.IronicAgentTest): mock.call('sgdisk', '-F', '/dev/sdb'), mock.call('parted', '/dev/sda', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '42s', '10GiB'), - mock.call('partx', '-a', '/dev/sda', attempts=3, + mock.call('partx', '-av', '/dev/sda', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdb', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '42s', '10GiB'), - mock.call('partx', '-a', '/dev/sdb', attempts=3, + mock.call('partx', '-av', '/dev/sdb', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sda', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '10GiB', '30GiB'), - mock.call('partx', '-a', '/dev/sda', attempts=3, + mock.call('partx', '-av', '/dev/sda', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdb', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '10GiB', '30GiB'), - mock.call('partx', '-a', '/dev/sdb', attempts=3, + mock.call('partx', '-av', '/dev/sdb', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('mdadm', '--create', '/dev/md0', '--force', '--run', @@ -3118,22 +3118,22 @@ class TestGenericHardwareManager(base.IronicAgentTest): mock.call('sgdisk', '-F', '/dev/sdb'), mock.call('parted', '/dev/sda', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '42s', '20GiB'), - mock.call('partx', '-a', '/dev/sda', attempts=3, + mock.call('partx', '-av', '/dev/sda', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdb', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '42s', '20GiB'), - mock.call('partx', '-a', '/dev/sdb', attempts=3, + mock.call('partx', '-av', '/dev/sdb', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sda', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '20GiB', '-1'), - mock.call('partx', '-a', '/dev/sda', attempts=3, + mock.call('partx', '-av', '/dev/sda', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdb', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '20GiB', '-1'), - mock.call('partx', '-a', '/dev/sdb', attempts=3, + mock.call('partx', '-av', '/dev/sdb', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('mdadm', '--create', '/dev/md0', '--force', '--run', @@ -3211,22 +3211,22 @@ class TestGenericHardwareManager(base.IronicAgentTest): mock.call('sgdisk', '-F', '/dev/sdb'), mock.call('parted', '/dev/sda', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '42s', '10GiB'), - mock.call('partx', '-a', '/dev/sda', attempts=3, + mock.call('partx', '-av', '/dev/sda', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdb', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '42s', '10GiB'), - mock.call('partx', '-a', '/dev/sdb', attempts=3, + mock.call('partx', '-av', '/dev/sdb', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sda', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '10GiB', '-1'), - mock.call('partx', '-a', '/dev/sda', attempts=3, + mock.call('partx', '-av', '/dev/sda', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/sdb', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '10GiB', '-1'), - mock.call('partx', '-a', '/dev/sdb', attempts=3, + mock.call('partx', '-av', '/dev/sdb', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('mdadm', '--create', '/dev/md0', '--force', '--run', @@ -3558,22 +3558,22 @@ class TestGenericHardwareManager(base.IronicAgentTest): 'gpt'), mock.call('parted', '/dev/nvme0n1', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '551MiB', '10GiB'), - mock.call('partx', '-a', '/dev/nvme0n1', attempts=3, + mock.call('partx', '-av', '/dev/nvme0n1', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/nvme1n1', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '551MiB', '10GiB'), - mock.call('partx', '-a', '/dev/nvme1n1', attempts=3, + mock.call('partx', '-av', '/dev/nvme1n1', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/nvme0n1', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '10GiB', '-1'), - mock.call('partx', '-a', '/dev/nvme0n1', attempts=3, + mock.call('partx', '-av', '/dev/nvme0n1', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('parted', '/dev/nvme1n1', '-s', '-a', 'optimal', '--', 'mkpart', 'primary', '10GiB', '-1'), - mock.call('partx', '-a', '/dev/nvme1n1', attempts=3, + mock.call('partx', '-av', '/dev/nvme1n1', attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('mdadm', '--create', '/dev/md0', '--force', '--run', diff --git a/ironic_python_agent/tests/unit/test_partition_utils.py b/ironic_python_agent/tests/unit/test_partition_utils.py index f6f56695b..ee34d9065 100644 --- a/ironic_python_agent/tests/unit/test_partition_utils.py +++ b/ironic_python_agent/tests/unit/test_partition_utils.py @@ -1199,7 +1199,7 @@ class TestGetPartition(base.IronicAgentTest): root_part = partition_utils.get_partition( self.fake_dev, self.fake_root_uuid) self.assertEqual('/dev/test2', root_part) - expected = [mock.call('partx', '-a', self.fake_dev, attempts=3, + expected = [mock.call('partx', '-av', self.fake_dev, attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('lsblk', '-PbioKNAME,UUID,PARTUUID,TYPE,LABEL', @@ -1219,7 +1219,7 @@ class TestGetPartition(base.IronicAgentTest): self.assertRaises(errors.DeviceNotFound, partition_utils.get_partition, self.fake_dev, self.fake_root_uuid) - expected = [mock.call('partx', '-a', self.fake_dev, attempts=3, + expected = [mock.call('partx', '-av', self.fake_dev, attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('lsblk', '-PbioKNAME,UUID,PARTUUID,TYPE,LABEL', @@ -1240,7 +1240,7 @@ class TestGetPartition(base.IronicAgentTest): result = partition_utils.get_partition( self.fake_dev, self.fake_root_uuid) self.assertEqual('/dev/loop0', result) - expected = [mock.call('partx', '-a', self.fake_dev, attempts=3, + expected = [mock.call('partx', '-av', self.fake_dev, attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('lsblk', '-PbioKNAME,UUID,PARTUUID,TYPE,LABEL', @@ -1257,7 +1257,7 @@ class TestGetPartition(base.IronicAgentTest): partition_utils.get_partition, self.fake_dev, self.fake_root_uuid) - expected = [mock.call('partx', '-a', self.fake_dev, attempts=3, + expected = [mock.call('partx', '-av', self.fake_dev, attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('lsblk', '-PbioKNAME,UUID,PARTUUID,TYPE,LABEL', @@ -1275,7 +1275,7 @@ class TestGetPartition(base.IronicAgentTest): root_part = partition_utils.get_partition( self.fake_dev, self.fake_root_uuid) self.assertEqual('/dev/test2', root_part) - expected = [mock.call('partx', '-a', self.fake_dev, attempts=3, + expected = [mock.call('partx', '-av', self.fake_dev, attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('lsblk', '-PbioKNAME,UUID,PARTUUID,TYPE,LABEL', @@ -1292,7 +1292,7 @@ class TestGetPartition(base.IronicAgentTest): root_part = partition_utils.get_partition( self.fake_dev, self.fake_root_uuid) self.assertEqual('/dev/test2', root_part) - expected = [mock.call('partx', '-a', self.fake_dev, attempts=3, + expected = [mock.call('partx', '-av', self.fake_dev, attempts=3, delay_on_retry=True), mock.call('udevadm', 'settle'), mock.call('lsblk', '-PbioKNAME,UUID,PARTUUID,TYPE,LABEL', diff --git a/ironic_python_agent/utils.py b/ironic_python_agent/utils.py index 71e29d16b..7c86cdac5 100644 --- a/ironic_python_agent/utils.py +++ b/ironic_python_agent/utils.py @@ -888,7 +888,7 @@ def rescan_device(device): kernel partition records. """ try: - execute('partx', '-a', device, attempts=3, delay_on_retry=True) + execute('partx', '-av', device, attempts=3, delay_on_retry=True) except processutils.ProcessExecutionError: LOG.warning("Couldn't re-read the partition table " "on device %s", device)