diff options
author | Cole Robinson <crobinso@redhat.com> | 2022-06-18 16:16:38 -0400 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2022-06-20 09:37:26 -0400 |
commit | d51541e155bd29389f804425356690ea55465551 (patch) | |
tree | e4cdae049046ebc8dc31828a38699450e7a7ec98 /tests | |
parent | 9da917b8ace8be2f93e4a8f071e65d83b31c1eb7 (diff) | |
download | virt-manager-d51541e155bd29389f804425356690ea55465551.tar.gz |
Fix UI rename with firmware='efi'
Our code to duplicate nvram wasn't expecting the XML to be devoid
of an nvram path.
Resolves: https://github.com/virt-manager/virt-manager/issues/372
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/uitests/data/live/uitests-firmware-efi.xml | 14 | ||||
-rw-r--r-- | tests/uitests/test_livetests.py | 44 |
2 files changed, 57 insertions, 1 deletions
diff --git a/tests/uitests/data/live/uitests-firmware-efi.xml b/tests/uitests/data/live/uitests-firmware-efi.xml new file mode 100644 index 00000000..b7463818 --- /dev/null +++ b/tests/uitests/data/live/uitests-firmware-efi.xml @@ -0,0 +1,14 @@ +<domain type="kvm"> + <name>uitests-firmware-efi</name> + <memory>65536</memory> + <currentMemory>65536</currentMemory> + <vcpu>1</vcpu> + <os firmware='efi'> + <type arch="x86_64">hvm</type> + <boot dev="hd"/> + </os> + <features> + <acpi/> + </features> +</domain> + diff --git a/tests/uitests/test_livetests.py b/tests/uitests/test_livetests.py index 28884298..7ac2ee48 100644 --- a/tests/uitests/test_livetests.py +++ b/tests/uitests/test_livetests.py @@ -38,7 +38,7 @@ def _vm_wrapper(vmname, uri="qemu:///system", opts=None): except Exception: pass try: - dom.undefine() + dom.undefineFlags(libvirt.VIR_DOMAIN_UNDEFINE_NVRAM) dom.destroy() except Exception: pass @@ -499,3 +499,45 @@ def testLiveHotplug(app, dom): pool.undefine() except Exception: log.debug("Error cleaning up pool", exc_info=True) + + +@_vm_wrapper("uitests-firmware-efi") +def testFirmwareRename(app, dom): + from virtinst import cli, DeviceDisk + win = app.topwin + dom.destroy() + + # First we refresh the 'nvram' pool, so we can reliably + # check if nvram files are created/deleted as expected + conn = cli.getConnection(app.conn.getURI()) + origname = dom.name() + nvramdir = conn.get_libvirt_data_root_dir() + "/qemu/nvram" + + fakedisk = DeviceDisk(conn) + fakedisk.set_source_path(nvramdir + "/FAKE-UITEST-FILE") + nvram_pool = fakedisk.get_parent_pool() + nvram_pool.refresh() + + origpath = "%s/%s_VARS.fd" % (nvramdir, origname) + newname = "uitests-firmware-efi-renamed" + newpath = "%s/%s_VARS.fd" % (nvramdir, newname) + assert DeviceDisk.path_definitely_exists(app.conn, origpath) + assert not DeviceDisk.path_definitely_exists(app.conn, newpath) + + # Now do the actual UI clickage + win.find("Details", "radio button").click() + win.find("Hypervisor Details", "label") + win.find("Overview", "table cell").click() + + newname = "uitests-firmware-efi-renamed" + win.find("Name:", "text").set_text(newname) + appl = win.find("config-apply") + appl.click() + lib.utils.check(lambda: not appl.sensitive) + + # Confirm window was updated + app.find_window("%s on" % newname) + + # Confirm nvram paths were altered as expected + assert not DeviceDisk.path_definitely_exists(app.conn, origpath) + assert DeviceDisk.path_definitely_exists(app.conn, newpath) |