Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virsh_restore: enable tests for VMs with boot order #6148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions libvirt/tests/cfg/virsh_cmd/domain/virsh_restore.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
restore_extra_param = "--running"
- xml_option:
restore_extra_param = "--xml"
os_update_dict = '{"boots": ["cdrom"]}'
s390-virtio:
os_update_dict = '{"bootmenu_enable": "yes"}'
- xml_option_dac:
only non_acl
restore_extra_param = "--xml"
Expand Down
16 changes: 7 additions & 9 deletions libvirt/tests/src/virsh_cmd/domain/virsh_restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def check_file_own(file_path, exp_uid, exp_gid):
check_log = params.get("check_log")
check_str_not_in_log = params.get("check_str_not_in_log")
qemu_conf_dict = eval(params.get("qemu_conf_dict", "{}"))
os_update_dict = eval(params.get("os_update_dict"))

vm_ref_uid = None
vm_ref_gid = None
Expand All @@ -88,12 +89,7 @@ def check_file_own(file_path, exp_uid, exp_gid):
os.chmod(vmxml.xml, stat.S_IRWXU | stat.S_IRGRP | stat.S_IROTH)
if not setup_nfs:
extra_param = "--xml %s" % vmxml.xml
dict_os_attrs = {}
if "hd" in vmxml.os.boots:
dict_os_attrs.update({"boots": ["cdrom"]})
vmxml.set_os_attrs(**dict_os_attrs)
else:
test.cancel("Please add 'hd' in boots for --xml testing")
vmxml.set_os_attrs(**os_update_dict)
logging.info("vmxml os is %s after update"
% vmxml.os.xmltreefile)
else:
Expand Down Expand Up @@ -196,9 +192,11 @@ def check_file_own(file_path, exp_uid, exp_gid):
if extra_param.count("xml"):
if not setup_nfs:
aft_vmxml = vm_xml.VMXML.new_from_dumpxml(vm_name)
boots_list = aft_vmxml.os.boots
if "hd" in boots_list or "cdrom" not in boots_list:
test.fail("Update xml with restore failed")
for attr in os_update_dict:
got = getattr(aft_vmxml.os, attr, "")
expected = os_update_dict[attr]
if got != expected:
test.fail("Update xml with restore failed")
else:
if vm_ref_uid and vm_ref_gid:
check_file_own(vm_ref, vm_ref_uid, vm_ref_gid)
Expand Down