From 68fabab3f9e19fc8d0dd55d4f94decbff11c9cda Mon Sep 17 00:00:00 2001 From: Nisha Agarwal Date: Tue, 22 Mar 2016 12:12:12 +0000 Subject: [PATCH] Add disk_label and node_uuid for agent drivers This fix adds the 'disk_label' and 'node_uuid' options in image_info for partition images for agent drivers. Closes-Bug: 1560560 Change-Id: Ife9897f293a0ddff8e01d1c57a2f0bc4ad2e9016 --- ironic/drivers/modules/agent.py | 4 ++++ ironic/tests/unit/drivers/modules/test_agent.py | 7 +++++-- releasenotes/notes/disk-label-fix-7580de913835ff44.yaml | 5 +++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/disk-label-fix-7580de913835ff44.yaml diff --git a/ironic/drivers/modules/agent.py b/ironic/drivers/modules/agent.py index 65aba00c51..0c9814bd8d 100644 --- a/ironic/drivers/modules/agent.py +++ b/ironic/drivers/modules/agent.py @@ -486,6 +486,10 @@ class AgentVendorInterface(agent_base_vendor.BaseAgentVendor): else: image_info['deploy_boot_mode'] = 'bios' image_info['boot_option'] = boot_option + disk_label = deploy_utils.get_disk_label(node) + if disk_label is not None: + image_info['disk_label'] = disk_label + image_info['node_uuid'] = node.uuid # Tell the client to download and write the image with the given args self._client.prepare_image(node, image_info) diff --git a/ironic/tests/unit/drivers/modules/test_agent.py b/ironic/tests/unit/drivers/modules/test_agent.py index 147612e3ee..c22a4c1e47 100644 --- a/ironic/tests/unit/drivers/modules/test_agent.py +++ b/ironic/tests/unit/drivers/modules/test_agent.py @@ -690,7 +690,8 @@ class TestAgentVendor(db_base.DbTestCase): i_info['image_type'] = 'partition' i_info['root_mb'] = 10240 i_info['deploy_boot_mode'] = 'bios' - i_info['capabilities'] = '{"boot_option": "local"}' + i_info['capabilities'] = {"boot_option": "local", + "disk_label": "msdos"} self.node.instance_info = i_info driver_internal_info = self.node.driver_internal_info driver_internal_info['is_whole_disk_image'] = False @@ -700,6 +701,7 @@ class TestAgentVendor(db_base.DbTestCase): expected_image_info = { 'urls': [test_temp_url], 'id': 'fake-image', + 'node_uuid': self.node.uuid, 'checksum': 'checksum', 'disk_format': 'qcow2', 'container_format': 'bare', @@ -715,7 +717,8 @@ class TestAgentVendor(db_base.DbTestCase): 'image_type': 'partition', 'root_mb': 10240, 'boot_option': 'local', - 'deploy_boot_mode': 'bios' + 'deploy_boot_mode': 'bios', + 'disk_label': 'msdos' } client_mock = mock.MagicMock(spec_set=['prepare_image']) diff --git a/releasenotes/notes/disk-label-fix-7580de913835ff44.yaml b/releasenotes/notes/disk-label-fix-7580de913835ff44.yaml new file mode 100644 index 0000000000..b7a8d53143 --- /dev/null +++ b/releasenotes/notes/disk-label-fix-7580de913835ff44.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - Fixes the bug where the user specified + disk_label is ignored for the agent + drivers for partition images.