-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
guest_os_booting: Add a case of booting vm without a bootable device
This PR adds: VIRT-297948 - Boot vm without any bootable devices Signed-off-by: Yingshun Cui <[email protected]>
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
libvirt/tests/cfg/guest_os_booting/negative/boot_without_bootable_devices.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- guest_os_booting.boot_without_bootable_devices: | ||
type = boot_from_cdrom_device | ||
start_vm = no | ||
remove_device_types = ["disk", "interface"] |
33 changes: 33 additions & 0 deletions
33
libvirt/tests/src/guest_os_booting/negative/boot_without_bootable_devices.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from virttest import remote | ||
from virttest.libvirt_xml import vm_xml | ||
from virttest.utils_libvirt import libvirt_vmxml | ||
|
||
from provider.guest_os_booting import guest_os_booting_base | ||
|
||
|
||
def run(test, params, env): | ||
""" | ||
Test whether VM without a bootable disk cannot boot | ||
""" | ||
vm_name = guest_os_booting_base.get_vm(params) | ||
remove_devices = eval(params.get("remove_device_types", "[]")) | ||
vm = env.get_vm(vm_name) | ||
vmxml = vm_xml.VMXML.new_from_inactive_dumpxml(vm.name) | ||
bkxml = vmxml.copy() | ||
|
||
try: | ||
test.log.info("TEST_SETUP: Remove disk device and interface device.") | ||
for dev in remove_devices: | ||
libvirt_vmxml.remove_vm_devices_by_type(vm, dev) | ||
|
||
test.log.info("TEST_STEP: Check if VM is working.") | ||
vm.start() | ||
try: | ||
vm.wait_for_serial_login().close() | ||
except remote.LoginTimeoutError as detail: | ||
test.log.debug("Found the expected error: %s", detail) | ||
else: | ||
test.fail("VM without bootable devices should be inaccessible!") | ||
finally: | ||
test.log.info("TEST_TEARDOWN: Recover test environment.") | ||
bkxml.sync() |