My pleasure. Here's what I tried:

Part 1: 
 - Create a VM with the wrong firmware. Try to start it (fails). Abort using 
the Cancel button. 
 - Verify that /var/lib/libvirt/qemu/nvram/TEST123_VARS.fd exists.
 - Run virsh: 

$ virsh undefine --nvram TEST123
error: failed to get domain 'TEST123'
error: Domain not found: no domain with matching name 'TEST123'

So the cancel does remove the domain. Move on to part 2.

Part 2:

Looking for ways to "abort it hard" in the GUI: Once the VM has started
with the wrong firmware there are three ways out of the customize
hardware window:

  1. Begin Installation: Fails and takes you back where you started. 
  2. Cancel Installation: Causes the problem reported. 
  3. Swatting the window with the "X": Same as #2 

So at this point it looks like there's no way to abort the leak of the
firmware file. So, I checked for a denial by AppArmor:

$ dmesg -T | tail -n 5 
[Tue Jul 11 10:40:18 2017] audit: type=1400 audit(1499794771.816:77): 
apparmor="STATUS" operation="profile_replace" profile="unconfined" 
name="libvirt-239ba97a-d01b-4127-916c-0f07d7c66e0a" pid=2242 
comm="apparmor_parser"
[Tue Jul 11 10:40:18 2017] audit: type=1400 audit(1499794771.844:78): 
apparmor="STATUS" operation="profile_replace" profile="unconfined" 
name="libvirt-239ba97a-d01b-4127-916c-0f07d7c66e0a//qemu_bridge_helper" 
pid=2242 comm="apparmor_parser"
[Tue Jul 11 10:40:18 2017] br0: port 2(vnet0) entered disabled state
[Tue Jul 11 10:40:18 2017] device vnet0 left promiscuous mode
[Tue Jul 11 10:40:18 2017] br0: port 2(vnet0) entered disabled state

Those are not denials. They look like what happens when you create a VM,
but I'm not certain.

Next, I checked if using virsh from the command line leaks the NVRAM
file:

  1. Create a VM, customize it to use UEFI with the correct arch. 
  2. Start the installer and force-off the VM.
  3. Check for deletion: 

# ls /var/lib/libvirt/qemu/nvram/
TEST1234_VARS.fd
# virsh undefine --nvram TEST1234 
Domain TEST1234 has been undefined
# ls /var/lib/libvirt/qemu/nvram/
TEST1234_VARS.fd

virsh does not delete the file. So it's conclusively an issue with both
the command line and the GUI. So looking at the code you provided I went
to find the corresponding XML and I found this fragment:

  <os>
    <type arch='x86_64' machine='pc-i440fx-xenial'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.fd</loader>
    <boot dev='hd'/>
  </os>

I've never used XML in Python, so I can't be certain, but it seems like
this line:

            if (self.get_xmlobj().os.loader_ro is True and

Should look like this:

            if (self.get_xmlobj().os.loader_readonly is True and

The second line matches the XML attribute exactly.

Hope this helps!

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1701344

Title:
  virt-manager fails to delete
  /var/lib/libvirt/qemu/nvram/VMName_VARS.fd  after installation is
  cancelled.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/virt-manager/+bug/1701344/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to