From 342af7c4cf552a29cc089d1735ba100ac9df40df Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Tue, 3 Aug 2021 12:10:44 +0100 Subject: [PATCH] Output verbose info from efibootmgr When debugging boot manager problems it can be advantageous to see all the full entries rather then just their labels. Depends-On: https://review.opendev.org/c/openstack/ironic/+/818735 Change-Id: I6a1bb78acaf5a4284727bdf533d4be6db2099f50 (cherry picked from commit caf695f70ab366498b46cb6f07f6751369c67e30) (cherry picked from commit 9753b61a51008da4f0b948b0c89665b762eb95c4) (cherry picked from commit 750934a20794efdcfe8340eec75996466c4c7665) (cherry picked from commit 76576ad73f85851d803d436ee7a7ca563606ecfa) --- ironic_python_agent/extensions/image.py | 6 +-- .../tests/unit/extensions/test_image.py | 38 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ironic_python_agent/extensions/image.py b/ironic_python_agent/extensions/image.py index f581756f7..0fdf3c5e0 100644 --- a/ironic_python_agent/extensions/image.py +++ b/ironic_python_agent/extensions/image.py @@ -267,8 +267,8 @@ def _run_efibootmgr(valid_efi_bootloaders, device, efi_partition, """ # Before updating let's get information about the bootorder - LOG.debug("Getting information about boot order") - utils.execute('efibootmgr') + LOG.debug("Getting information about boot order.") + utils.execute('efibootmgr', '-v') # NOTE(iurygregory): regex used to identify the Warning in the stderr after # we add the new entry. Example: # "efibootmgr: ** Warning ** : Boot0004 has same label ironic" @@ -300,7 +300,7 @@ def _run_efibootmgr(valid_efi_bootloaders, device, efi_partition, 'dev': device}) # Update the nvram using efibootmgr # https://linux.die.net/man/8/efibootmgr - cmd = utils.execute('efibootmgr', '-c', '-d', device, + cmd = utils.execute('efibootmgr', '-v', '-c', '-d', device, '-p', efi_partition, '-w', '-L', label, '-l', v_efi_bl_path) for line in cmd[1].split('\n'): diff --git a/ironic_python_agent/tests/unit/extensions/test_image.py b/ironic_python_agent/tests/unit/extensions/test_image.py index 8807b8891..52969dd22 100644 --- a/ironic_python_agent/tests/unit/extensions/test_image.py +++ b/ironic_python_agent/tests/unit/extensions/test_image.py @@ -233,8 +233,8 @@ class TestImageExtension(base.IronicAgentTest): mock.call('udevadm', 'settle'), mock.call('mount', self.fake_efi_system_part, self.fake_dir + '/boot/efi'), - mock.call('efibootmgr'), - mock.call('efibootmgr', '-c', '-d', self.fake_dev, + mock.call('efibootmgr', '-v'), + mock.call('efibootmgr', '-v', '-c', '-d', self.fake_dev, '-p', '1', '-w', '-L', 'ironic1', '-l', '\\EFI\\BOOT\\BOOTX64.EFI'), @@ -281,8 +281,8 @@ class TestImageExtension(base.IronicAgentTest): mock.call('udevadm', 'settle'), mock.call('mount', self.fake_efi_system_part, self.fake_dir + '/boot/efi'), - mock.call('efibootmgr'), - mock.call('efibootmgr', '-c', '-d', self.fake_dev, + mock.call('efibootmgr', '-v'), + mock.call('efibootmgr', '-v', '-c', '-d', self.fake_dev, '-p', '1', '-w', '-L', 'ironic1', '-l', '\\EFI\\BOOT\\BOOTX64.EFI'), @@ -334,8 +334,8 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n mock.call('udevadm', 'settle'), mock.call('mount', self.fake_efi_system_part, self.fake_dir + '/boot/efi'), - mock.call('efibootmgr'), - mock.call('efibootmgr', '-c', '-d', self.fake_dev, + mock.call('efibootmgr', '-v'), + mock.call('efibootmgr', '-v', '-c', '-d', self.fake_dev, '-p', '1', '-w', '-L', 'ironic1', '-l', '\\EFI\\BOOT\\BOOTX64.EFI'), @@ -387,12 +387,12 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n mock.call('udevadm', 'settle'), mock.call('mount', self.fake_efi_system_part, self.fake_dir + '/boot/efi'), - mock.call('efibootmgr'), - mock.call('efibootmgr', '-c', '-d', self.fake_dev, + mock.call('efibootmgr', '-v'), + mock.call('efibootmgr', '-v', '-c', '-d', self.fake_dev, '-p', '1', '-w', '-L', 'ironic1', '-l', '\\EFI\\BOOT\\BOOTX64.EFI'), - mock.call('efibootmgr', '-c', '-d', self.fake_dev, + mock.call('efibootmgr', '-v', '-c', '-d', self.fake_dev, '-p', '1', '-w', '-L', 'ironic2', '-l', '\\WINDOWS\\system32\\winload.efi'), @@ -1651,8 +1651,8 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n mock.call('udevadm', 'settle'), mock.call('mount', self.fake_efi_system_part, self.fake_dir + '/boot/efi'), - mock.call('efibootmgr'), - mock.call('efibootmgr', '-c', '-d', self.fake_dev, + mock.call('efibootmgr', '-v'), + mock.call('efibootmgr', '-v', '-c', '-d', self.fake_dev, '-p', '1', '-w', '-L', 'ironic1', '-l', '\\EFI\\BOOT\\BOOTX64.EFI'), @@ -1695,8 +1695,8 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n mock.call('udevadm', 'settle'), mock.call('mount', self.fake_efi_system_part, self.fake_dir + '/boot/efi'), - mock.call('efibootmgr'), - mock.call('efibootmgr', '-c', '-d', self.fake_dev, + mock.call('efibootmgr', '-v'), + mock.call('efibootmgr', '-v', '-c', '-d', self.fake_dev, '-p', '1', '-w', '-L', 'Vendor String', '-l', '\\EFI\\vendor\\shimx64.efi'), @@ -1740,8 +1740,8 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n mock.call('udevadm', 'settle'), mock.call('mount', '/dev/fakenvme0p1', self.fake_dir + '/boot/efi'), - mock.call('efibootmgr'), - mock.call('efibootmgr', '-c', '-d', '/dev/fakenvme0', + mock.call('efibootmgr', '-v'), + mock.call('efibootmgr', '-v', '-c', '-d', '/dev/fakenvme0', '-p', '1', '-w', '-L', 'ironic1', '-l', '\\EFI\\BOOT\\BOOTX64.EFI'), @@ -1780,8 +1780,8 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n mock.call('udevadm', 'settle'), mock.call('mount', self.fake_efi_system_part, self.fake_dir + '/boot/efi'), - mock.call('efibootmgr'), - mock.call('efibootmgr', '-c', '-d', self.fake_dev, + mock.call('efibootmgr', '-v'), + mock.call('efibootmgr', '-v', '-c', '-d', self.fake_dev, '-p', '1', '-w', '-L', 'ironic1', '-l', '\\EFI\\BOOT\\BOOTX64.EFI'), @@ -1887,8 +1887,8 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n self.fake_dev, self.fake_efi_system_part, self.fake_dir) - expected = [mock.call('efibootmgr'), - mock.call('efibootmgr', '-c', '-d', self.fake_dev, + expected = [mock.call('efibootmgr', '-v'), + mock.call('efibootmgr', '-v', '-c', '-d', self.fake_dev, '-p', self.fake_efi_system_part, '-w', '-L', 'ironic1', '-l', '\\EFI\\BOOT\\BOOTX64.EFI')]