@@ -16,7 +16,6 @@ source "${SCRIPTDIR}/common.sh"
1616# shellcheck source=test/bin/common_versions.sh
1717source " ${SCRIPTDIR} /common_versions.sh"
1818
19- DEFAULT_BOOT_BLUEPRINT=" rhel-9.6"
2019LVM_SYSROOT_SIZE=" 15360"
2120PULL_SECRET=" ${PULL_SECRET:- ${HOME} / .pull-secret.json} "
2221PULL_SECRET_CONTENT=" $( jq -c . " ${PULL_SECRET} " ) "
@@ -675,12 +674,11 @@ EOF
675674# Creates a new VM using the scenario name and the vmname given to
676675# create a unique name. Uses the boot_blueprint and network
677676# arguments to select the ISO and networks from which to boot.
678- # If no boot_blueprint is specified, uses DEFAULT_BOOT_BLUEPRINT.
679677# If no network is specified, uses the "default" network.
680678#
681679# Usage: launch_vm \
680+ # <boot_blueprint> \
682681# [--vmname <name>] \
683- # [--boot_blueprint <blueprint>] \
684682# [--network <name>[,<name>...]] \
685683# [--vm_vcpus <vcpus>] \
686684# [--vm_memory <memory>] \
@@ -689,35 +687,44 @@ EOF
689687# [--no_network]
690688#
691689# Arguments:
692- # [--vmname <name>]: The short name of the VM in the scenario (e.g., "host1").
693- # [--boot_blueprint <blueprint>]: The image blueprint used to create the ISO that
694- # should be used to boot the VM. This is _not_
695- # necessarily the image to be installed (see
696- # prepare_kickstart).
690+ # <boot_blueprint>: Mandatory. The name of the image blueprint
691+ # used to create the ISO that should be used
692+ # to boot the VM. This is _not_ necessarily the
693+ # image to be installed (see prepare_kickstart).
694+ # [--vmname <name>]: The short name of the VM in the scenario
695+ # (e.g., "host1").
697696# [--network <name>[,<name>...]]: A comma-separated list for the networks used
698697# when creating the VM. Each network entry will
699698# create a NIC and they are repeatable.
700- # [--no-network]: Do not configure any network attachments (and therefore no
701- # NICs) for the VM.
702- # [--vm_vcpus <vcpus>]: Number of vCPUs for the VM.
703- # [--vm_memory <memory>]: Size of RAM in MB for the VM.
704- # [--vm_disksize <disksize>]: Size of disk in GB for the VM.
705- # [--fips]: Enable FIPS mode
706-
699+ # [--no_network]: Do not configure any network attachments (and
700+ # therefore no NICs) for the VM.
701+ # [--vm_vcpus <vcpus>]: Number of vCPUs for the VM.
702+ # [--vm_memory <memory>]: Size of RAM in MB for the VM.
703+ # [--vm_disksize <disksize>]: Size of disk in GB for the VM.
704+ # [--fips]: Enable FIPS mode for the VM.
707705launch_vm () {
708- # set defaults
706+ # Set default values for the optional arguments
709707 local vmname=" host1"
710- local boot_blueprint=" ${DEFAULT_BOOT_BLUEPRINT} "
711708 local network=" default"
712709 local vm_memory=4096
713710 local vm_vcpus=2
714711 local vm_disksize=20
715712 local fips_mode=0
716713 local kernel_location=" images/pxeboot"
717714
715+ # Parse the mandatory arguments
716+ local -r boot_blueprint=" ${1:- } "
717+ if [ -z " ${boot_blueprint} " ]; then
718+ error " Boot blueprint is not set"
719+ record_junit " ${vmname} " " vm-launch-args" " FAILED"
720+ exit 1
721+ fi
722+ shift
723+
724+ # Parse the optional arguments
718725 while [ $# -gt 0 ]; do
719726 case " $1 " in
720- --vmname|--boot_blueprint|-- vm_vcpus|--vm_memory|--vm_disksize)
727+ --vmname|--vm_vcpus|--vm_memory|--vm_disksize)
721728 var=" ${1/ --/ } "
722729 if [ -n " $2 " ] && [ " ${2: 0: 1} " != " -" ]; then
723730 declare " ${var} =$2 "
0 commit comments