diff --git a/libvirt/tests/cfg/bios/boot_order_ovmf.cfg b/libvirt/tests/cfg/bios/boot_order_ovmf.cfg index ed5d163680..b9bd9a7713 100644 --- a/libvirt/tests/cfg/bios/boot_order_ovmf.cfg +++ b/libvirt/tests/cfg/bios/boot_order_ovmf.cfg @@ -8,16 +8,37 @@ start_vm = "no" only x86_64 variants: - - bootable_first: + - boot_dev: + xml_boot_in_os = "yes" + target_bus = "sata" + target_dev = "sda" variants: - - boot_order_element: + - hd_dev: + boot_dev = "hd" + image_size = "1G" + - boot_order: + xml_boot_in_os = "no" + variants: + - file_disk: + variants: + - positive_test: + status_error = "no" + variants: + - bootable_dev: use_bootable_dev = "yes" boot_order_bootable_first = "yes" target_dev = "sda" - - bootable_second: - variants: - - boot_order_element: + - unbootable_dev_first: + only boot_dev use_unbootable_dev_first = "yes" boot_order_bootable_first = "no" unbootable_target_dev = "sda" target_dev = "sdb" + - negative_test: + status_error = "yes" + variants: + - no_dev: + only boot_dev + - unbootable_dev: + only boot_dev + use_unbootable_dev = "yes" diff --git a/libvirt/tests/src/bios/boot_order_ovmf.py b/libvirt/tests/src/bios/boot_order_ovmf.py index d6db093ad9..918f0e9a91 100644 --- a/libvirt/tests/src/bios/boot_order_ovmf.py +++ b/libvirt/tests/src/bios/boot_order_ovmf.py @@ -65,6 +65,7 @@ def set_domain_disk(vm, blk_source, params): use_unbootable_dev = "yes" == params.get("use_unbootable_dev", "no") use_unbootable_dev_first = "yes" == params.get("use_unbootable_dev_first", "no") boot_order_bootable_first = "yes" == params.get("boot_order_bootable_first") + xml_boot_in_os = "yes" == params.get("xml_boot_in_os") # use_unbootable_dev_first means the xml contain both type of device # the one which is not bootable has higher order without "boot order" element @@ -74,14 +75,16 @@ def set_domain_disk(vm, blk_source, params): vmxml = vm_xml.VMXML.new_from_dumpxml(vm.name) vmxml.remove_all_disk() - vmxml.remove_all_boots() + if not xml_boot_in_os: + vmxml.remove_all_boots() + vmxml.sync() if use_unbootable_dev: unbootable_source = os.path.join(data_dir.get_data_dir(), "unbootable.img") unbootable_disk_params = {'source': {'attrs': {'file': unbootable_source}}, 'driver': {'name': driver_name, 'type': driver_type}, 'target': {'dev': unbootable_target_dev, 'bus': target_bus}, 'device': disk_device} - if not boot_order_bootable_first: + if not xml_boot_in_os and not boot_order_bootable_first: unbootable_disk_params["boot"] = 1 libvirt.create_local_disk(disk_type, unbootable_source, image_size, disk_format) @@ -94,10 +97,11 @@ def set_domain_disk(vm, blk_source, params): 'driver': {'name': driver_name, 'type': driver_type}, 'target': {'dev': target_dev, 'bus': target_bus}, 'device': disk_device} - if boot_order_bootable_first: - bootable_disk_params["boot"] = 1 - else: - bootable_disk_params["boot"] = 2 + if not xml_boot_in_os: + if boot_order_bootable_first: + bootable_disk_params["boot"] = 1 + else: + bootable_disk_params["boot"] = 2 libvirt_vmxml.modify_vm_device(vmxml=vmxml, dev_type='disk', dev_dict=bootable_disk_params, index=1)