提交 4a091764 编写于 作者: X Xueqiang Wei

add new case "uefi_boot_from_device"

1. boot from ide-hd/ide-cd
2. boot from scsi-hd/scsi-cd
3. boot from virtio-blk
4. boot from usb-storage
Signed-off-by: NXueqiang Wei <xuwei@redhat.com>
上级 9271db6a
- uefi_boot_from_device:
virt_test_type = qemu
type = uefi_boot_from_device
only q35
only ovmf
image_boot = no
boot_menu = on
enable_sga = yes
boot_menu_key = "esc;down;down;kp_enter"
boot_menu_hint = "Boot Options"
images = "stg"
image_name_stg = "images/stg"
image_size_stg = 100M
force_create_image_stg = yes
remove_image_stg = yes
variants:
- cdrom:
cdroms = "test"
cdrom_test = "/tmp/test.iso"
boot_entry_info = "Booting UEFI QEMU .*(QEMU CD-ROM|DVD-ROM QM)"
start_vm = no
dev_name = cdrom
variants:
- with_bootindex:
bootindex_test = 0
- with_specific_device:
boot_dev = "UEFI QEMU (?:QEMU CD-ROM|DVD-ROM QM)"
variants:
- ahci_cd:
cd_format_test = ahci
- scsi_cd:
cd_format_test = scsi-cd
- ahci_disk:
drive_format_stg = ahci
dev_name = ahci_disk
boot_entry_info = "Booting UEFI QEMU HARDDISK QM"
variants:
- with_bootindex:
bootindex_stg = 0
- with_specific_device:
boot_dev = "UEFI QEMU HARDDISK QM"
- virtio_blk_disk:
drive_format_stg = virtio
dev_name = virtio_blk
boot_entry_info = "Booting UEFI Misc Device"
variants:
- with_bootindex:
bootindex_stg = 0
- with_specific_device:
boot_dev = "UEFI Misc Device"
- scsi_hd_disk:
drive_format_stg = scsi-hd
dev_name = scsi_hd
boot_entry_info = "Booting UEFI QEMU QEMU HARDDISK"
variants:
- with_bootindex:
bootindex_stg = 0
- with_specific_device:
boot_dev = "UEFI QEMU QEMU HARDDISK"
- usb_storage_disk:
dev_name = usb_storage
usb_devices = ""
usbs = usb1
boot_entry_info = "Booting UEFI QEMU QEMU USB"
variants:
- with_bootindex:
bootindex_stg = 0
- with_specific_device:
boot_dev = "UEFI QEMU QEMU USB"
variants:
- usb_uhci:
usb_type_usb1 = ich9-usb-uhci1
drive_format_stg = "usb1"
- usb_ehci:
usb_type_usb1 = usb-ehci
drive_format_stg = "usb2"
- usb_xhci:
no RHEL.3, RHEL.4, RHEL.5
no Win2000, WinXP, Win2003, WinVista
no Host_RHEL.m6
usb_type_usb1 = nec-usb-xhci
drive_format_stg = "usb3"
import os
import re
import logging
from avocado.utils import process
from virttest import error_context
from virttest import utils_misc
from virttest import env_process
@error_context.context_aware
def run(test, params, env):
"""
QEMU boot from device:
1) Start guest from device
ide-hd/virtio-blk/scsi-hd/usb-storage
ide-cd/scsi-cd
2) Check the boot result
:param test: QEMU test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environment.
"""
def create_cdroms(cdrom_test):
"""
Create 'test' cdrom with one file on it
"""
logging.info("creating test cdrom")
process.run("dd if=/dev/urandom of=test bs=10M count=1")
process.run("mkisofs -o %s test" % cdrom_test)
process.run("rm -f test")
def cleanup_cdroms(cdrom_test):
"""
Removes created cdrom
"""
logging.info("cleaning up temp cdrom images")
os.remove(cdrom_test)
def boot_check(info):
"""
boot info check
"""
return re.search(info, vm.logsessions['seabios'].get_output(), re.S)
def count_of_move_step(boot_dev):
"""
get the number of steps to move
"""
logs = vm.logsessions['seabios'].get_output()
boot_dev = re.findall(boot_dev, logs, re.S)[0]
return len(re.findall(r"Boot\d+:\sUEFI", logs.split(boot_dev)[0], re.S))
timeout = int(params.get("login_timeout", 360))
boot_menu_key = params["boot_menu_key"].split(";")
boot_menu_hint = params["boot_menu_hint"]
boot_entry_info = params["boot_entry_info"]
boot_dev = params.get("boot_dev")
dev_name = params.get("dev_name")
if dev_name == "cdrom":
cdrom_test = params["cdrom_test"]
create_cdroms(cdrom_test)
params["start_vm"] = "yes"
env_process.preprocess_vm(test, params, env, params.get("main_vm"))
vm = env.get_vm(params["main_vm"])
vm.verify_alive()
try:
if boot_dev:
if not utils_misc.wait_for(lambda: boot_check(boot_menu_hint),
timeout, 1):
test.fail("Could not get boot menu message")
# Navigate to boot manager menu
for i in boot_menu_key:
vm.send_key(i)
for i in range(count_of_move_step(boot_dev)):
vm.send_key("down")
vm.send_key("kp_enter")
error_context.context("Check boot result", logging.info)
if not utils_misc.wait_for(lambda: boot_check(boot_entry_info),
timeout, 1):
test.fail("Could not boot from '%s'" % dev_name)
finally:
if dev_name == "cdrom":
cleanup_cdroms(cdrom_test)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册