Fixes the agent message for uefi netboot for partition image

The agent returns "efi_system_partition_uuid=None" in the
status message for uefi netboot for partition images.
This commit fixes to remove this unwanted message
from the status message as efi partition is created only
for localboot.

Closes-bug: 1526289

Change-Id: I6376406cdde29493619f50b0a6cd8b6ce3784d6e
This commit is contained in:
Nisha Agarwal 2016-03-21 18:02:59 +00:00
parent c3e9aca2c0
commit 936b2e4c4a
2 changed files with 18 additions and 2 deletions
ironic_python_agent
extensions
tests/unit/extensions

@ -160,7 +160,8 @@ def _message_format(msg, image_info, device, partition_uuids):
root_uuid = partition_uuids.get('root uuid')
efi_system_partition_uuid = (
partition_uuids.get('efi system partition uuid'))
if image_info.get('deploy_boot_mode') == 'uefi':
if (image_info.get('deploy_boot_mode') == 'uefi' and
image_info.get('boot_option') == 'local'):
result_msg = msg + 'root_uuid={2} efi_system_partition_uuid={3}'
message = result_msg.format(image_info['id'], device,
root_uuid,

@ -852,9 +852,24 @@ class TestStandbyExtension(test_base.BaseTestCase):
'/dev/fake root_uuid=root_uuid')
self.assertEqual(expected_msg, result_msg)
def test__message_format_partition_uefi(self):
def test__message_format_partition_uefi_netboot(self):
image_info = _build_fake_partition_image_info()
image_info['deploy_boot_mode'] = 'uefi'
image_info['boot_option'] = 'netboot'
msg = ('image ({0}) already present on device {1} ')
device = '/dev/fake'
partition_uuids = {'root uuid': 'root_uuid',
'efi system partition uuid': None}
result_msg = standby._message_format(msg, image_info,
device, partition_uuids)
expected_msg = ('image (fake_id) already present on device '
'/dev/fake root_uuid=root_uuid')
self.assertEqual(expected_msg, result_msg)
def test__message_format_partition_uefi_localboot(self):
image_info = _build_fake_partition_image_info()
image_info['deploy_boot_mode'] = 'uefi'
image_info['boot_option'] = 'local'
msg = ('image ({0}) already present on device {1} ')
device = '/dev/fake'
partition_uuids = {'root uuid': 'root_uuid',