From cd85f209ac7fda775cad4361d4bf770215d88d24 Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Mon, 26 Aug 2019 14:48:17 -0400 Subject: [PATCH] Enable boot_option to be specified The ability to set this is required as some test cases do not support a duality of local boot and network boot when using the cirros test image. This is because cirros lacks the tools to install a grub2 boot loader. Adds a ``[baremetal]partition_netboot`` configuration parameter which defaults to ``True``. This allows a test executor to tell the tests if we should expect to network boot all partition image usage. This is ultimately required to enable ironic to change the underlying default boot_option netboot to local. Story: #1619339 Change-Id: I784d5c9d98d574fc1f00dd8f5ee1e20499bf2e34 --- ironic_tempest_plugin/config.py | 9 ++++++++- .../tests/scenario/baremetal_standalone_manager.py | 14 +++++++++++++- .../scenario/ironic_standalone/test_basic_ops.py | 3 +++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ironic_tempest_plugin/config.py b/ironic_tempest_plugin/config.py index d5cdcfa1..d2327904 100644 --- a/ironic_tempest_plugin/config.py +++ b/ironic_tempest_plugin/config.py @@ -143,7 +143,14 @@ BaremetalGroup = [ "as instance_info/root_gb value."), cfg.IntOpt('available_nodes', min=0, default=None, help="The number of baremetal hosts available to use for " - "the tests.") + "the tests."), + cfg.BoolOpt('partition_netboot', + default=True, + help="Treat partition images as netbooted as opposed to " + "attempting to populate a boot loader. IF cirros is " + "being used, this option should be set to True as " + "it lacks the needed components to make it locally " + "from a partition image."), ] BaremetalFeaturesGroup = [ diff --git a/ironic_tempest_plugin/tests/scenario/baremetal_standalone_manager.py b/ironic_tempest_plugin/tests/scenario/baremetal_standalone_manager.py index bbd77829..4cf6a811 100644 --- a/ironic_tempest_plugin/tests/scenario/baremetal_standalone_manager.py +++ b/ironic_tempest_plugin/tests/scenario/baremetal_standalone_manager.py @@ -37,6 +37,7 @@ class BaremetalStandaloneManager(bm.BaremetalScenarioTest, image_ref = None image_checksum = None + boot_option = None @classmethod def skip_checks(cls): @@ -221,7 +222,8 @@ class BaremetalStandaloneManager(bm.BaremetalScenarioTest, return nodes[0] @classmethod - def boot_node(cls, image_ref=None, image_checksum=None): + def boot_node(cls, image_ref=None, image_checksum=None, + boot_option=None): """Boot ironic node. The following actions are executed: @@ -234,11 +236,16 @@ class BaremetalStandaloneManager(bm.BaremetalScenarioTest, :param image_ref: Reference to user image to boot node with. :param image_checksum: md5sum of image specified in image_ref. Needed only when direct HTTP link is provided. + :param boot_option: The defaut boot option to utilize. If not + specified, the ironic deployment default shall + be utilized. """ if image_ref is None: image_ref = cls.image_ref if image_checksum is None: image_checksum = cls.image_checksum + if boot_option is None: + boot_option = cls.boot_option network, subnet, router = cls.create_networks() n_port = cls.create_neutron_port(network_id=network['id']) @@ -253,6 +260,11 @@ class BaremetalStandaloneManager(bm.BaremetalScenarioTest, patch.append({'path': '/instance_info/root_gb', 'op': 'add', 'value': CONF.baremetal.adjusted_root_disk_size_gb}) + + if boot_option: + patch.append({'path': '/instance_info/capabilities', + 'op': 'add', + 'value': {'boot_option': boot_option}}) # TODO(vsaienko) add testing for custom configdrive cls.update_node(cls.node['uuid'], patch=patch) cls.set_node_provision_state(cls.node['uuid'], 'active') diff --git a/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_basic_ops.py b/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_basic_ops.py index 45b5271a..ecd44634 100644 --- a/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_basic_ops.py +++ b/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_basic_ops.py @@ -148,6 +148,7 @@ class BaremetalIpmiIscsiPartitioned(bsm.BaremetalStandaloneScenarioTest): deploy_interface = 'iscsi' image_ref = CONF.baremetal.partition_image_ref wholedisk_image = False + boot_option = 'netboot' if CONF.baremetal.partition_netboot else 'local' @decorators.idempotent_id('7d0b205e-edbc-4e2d-9f6d-95cd74eefecb') @utils.services('image', 'network') @@ -162,6 +163,7 @@ class BaremetalIpmiDirectPartitioned(bsm.BaremetalStandaloneScenarioTest): deploy_interface = 'direct' image_ref = CONF.baremetal.partition_image_ref wholedisk_image = False + boot_option = 'netboot' if CONF.baremetal.partition_netboot else 'local' @decorators.idempotent_id('7b4b2dcd-2bbb-44f5-991f-0964300af6b7') @utils.services('image', 'network') @@ -219,6 +221,7 @@ class BaremetalIpmiRescuePartitioned(bsm.BaremetalStandaloneScenarioTest): rescue_interface = 'agent' image_ref = CONF.baremetal.partition_image_ref wholedisk_image = False + boot_option = 'netboot' if CONF.baremetal.partition_netboot else 'local' # NOTE(jroll) the ansible deploy interface doesn't support partition images # with netboot mode. Since that's what is happening here, explicitly choose