Merge "Ramdisk iso boot tempest scenario test"

This commit is contained in:
Zuul 2020-08-07 18:27:34 +00:00 committed by Gerrit Code Review
commit dcd1bf77a0
3 changed files with 107 additions and 0 deletions

View File

@ -113,6 +113,9 @@ BaremetalGroup = [
help="An MD5 checksum of the image."),
cfg.StrOpt('partition_image_ref',
help="UUID of the partitioned image to use in the tests."),
cfg.StrOpt('ramdisk_iso_image_ref',
help=("UUID (or url) of an ISO image for the ramdisk boot "
"tests.")),
cfg.ListOpt('enabled_drivers',
default=['fake', 'pxe_ipmitool', 'agent_ipmitool'],
help="List of Ironic enabled drivers."),

View File

@ -649,3 +649,58 @@ class BaremetalStandaloneScenarioTest(BaremetalStandaloneManager):
self.unrescue_node(self.node['uuid'])
self.assertTrue(self.ping_ip_address(self.node_ip,
should_succeed=True))
@classmethod
def boot_node_ramdisk(cls, ramdisk_ref, iso=False):
"""Boot ironic using a ramdisk node.
The following actions are executed:
* Create/Pick networks to boot node in.
* Create Neutron port and attach it to node.
* Update node image_source.
* Deploy node.
* Wait until node is deployed.
:param ramdisk_ref: Reference to user image or ramdisk to boot
the node with.
:param iso: Boolean, default False, to indicate if the image ref
us actually an ISO image.
"""
if ramdisk_ref is None:
ramdisk_ref = cls.image_ref
network, subnet, router = cls.create_networks()
n_port = cls.create_neutron_port(network_id=network['id'])
cls.vif_attach(node_id=cls.node['uuid'], vif_id=n_port['id'])
if iso:
patch_path = '/instance_info/boot_iso'
else:
# NOTE(TheJulia): The non ISO ramdisk path supports this
# and it being here makes it VERY easy for us to add a test
# of just a kernel/ramdisk loading from glance at some point.
patch_path = '/instance_info/image_source'
patch = [{'path': patch_path,
'op': 'add',
'value': ramdisk_ref}]
cls.update_node(cls.node['uuid'], patch=patch)
cls.set_node_provision_state(cls.node['uuid'], 'active')
if CONF.validation.connect_method == 'floating':
cls.node_ip = cls.add_floatingip_to_node(cls.node['uuid'])
elif CONF.validation.connect_method == 'fixed':
cls.node_ip = cls.get_server_ip(cls.node['uuid'])
else:
m = ('Configuration option "[validation]/connect_method" '
'must be set.')
raise lib_exc.InvalidConfiguration(m)
cls.wait_power_state(cls.node['uuid'],
bm.BaremetalPowerStates.POWER_ON)
cls.wait_provisioning_state(cls.node['uuid'],
bm.BaremetalProvisionStates.ACTIVE,
timeout=CONF.baremetal.active_timeout,
interval=30)
def boot_and_verify_ramdisk_node(self, ramdisk_ref=None, iso=False,
should_succeed=True):
self.boot_node_ramdisk(ramdisk_ref, iso)
self.assertTrue(self.ping_ip_address(self.node_ip,
should_succeed=should_succeed))

View File

@ -0,0 +1,49 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_log import log as logging
from tempest.common import utils
from tempest import config
from tempest.lib import decorators
from ironic_tempest_plugin.tests.scenario import \
baremetal_standalone_manager as bsm
LOG = logging.getLogger(__name__)
CONF = config.CONF
class BaremetalRamdiskBootIso(bsm.BaremetalStandaloneScenarioTest):
if 'redfish' in CONF.baremetal.enabled_hardware_types:
driver = 'redfish'
boot_interface = 'redfish-virtual-media'
else:
driver = 'ipmi'
boot_interface = 'ipxe'
delete_node = False
deploy_interface = 'ramdisk'
api_microversion = '1.66'
image_ref = CONF.baremetal.ramdisk_iso_image_ref
wholedisk_image = False
@classmethod
def skip_checks(cls):
super(BaremetalRamdiskBootIso, cls).skip_checks()
if not cls.image_ref:
raise cls.skipException('Skipping ramdisk ISO booting as'
'no ramdisk_iso_image_ref is defined.')
@decorators.idempotent_id('2859d115-9266-4461-9286-79b146e65dc9')
@utils.services('image', 'network')
def test_ramdisk_boot(self):
self.boot_and_verify_ramdisk_node(self.image_ref, iso=True)