Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1144284

Summary: Rebuild libvirt-python to pick up the new flag for removing NVRAM files in virDomainUndefineFlags
Product: Red Hat Enterprise Linux 7 Reporter: Jiri Denemark <jdenemar>
Component: libvirt-pythonAssignee: Jiri Denemark <jdenemar>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: ajia, dyuan, gsun, honzhang, jiahu, lersek, lsu, mprivozn, pbonzini, rbalakri, virt-bugs
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-python-1.2.8-3.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1026772 Environment:
Last Closed: 2015-03-05 07:56:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1026772    
Bug Blocks:    

Description Jiri Denemark 2014-09-19 07:22:52 UTC
+++ This bug was initially created as a clone of Bug #1026772 +++

commit 273b6581ca8dae11e6ff40e3d13813fdbb37d41b
Author: Michal Privoznik <mprivozn>
Date:   Thu Sep 11 13:17:11 2014 +0200

    virDomainUndefineFlags: Allow NVRAM unlinking
    
    When a domain is undefined, there are options to remove it's
    managed save state or snapshots. However, there's another file
    that libvirt creates per domain: the NVRAM variable store file.
    Make sure that the file is not left behind if the domain is
    undefined.
    
    Signed-off-by: Michal Privoznik <mprivozn>

added VIR_DOMAIN_UNDEFINE_NVRAM flag for virDomainUndefineFlags. We need to rebuild libvirt-python to pick up this new flag.

Version-Release number of selected component (if applicable):

libvirt-python-1.2.8-2.el7

Steps to Reproduce:
1. python -c "import libvirt; print libvirt.VIR_DOMAIN_UNDEFINE_NVRAM

Expected results:
4

Comment 2 hongming 2014-10-14 07:32:51 UTC
Verify it as follows. The result is expected. Move its status to VERIFIED.


[root@sriov images]# rpm -q libvirt libvirt-python
libvirt-1.2.8-5.el7.x86_64
libvirt-python-1.2.8-4.el7.x86_64

[root@sriov images]# virsh define r7.xml
Domain r7 defined from r7.xml

[root@sriov images]# virsh start r7
Domain r7 started

[root@sriov images]# virsh dumpxml r7| grep "/os" -B5
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.fd</loader>
    <nvram template='/usr/share/OVMF/OVMF_VARS.fd'>/var/lib/libvirt/qemu/nvram/r7_VARS.fd</nvram>
    <boot dev='hd'/>
  </os>
[root@sriov images]# ll /var/lib/libvirt/qemu/nvram/r7_VARS.fd
-rw-------. 1 qemu qemu 131072 Oct 14 15:19 /var/lib/libvirt/qemu/nvram/r7_VARS.fd
[root@sriov images]# python
Python 2.7.5 (default, Feb 11 2014, 07:46:25) 
[GCC 4.8.2 20140120 (Red Hat 4.8.2-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
[root@sriov images]# rpm -q libvirt libvirt-python
libvirt-1.2.8-5.el7.x86_64
libvirt-python-1.2.8-4.el7.x86_64
[root@sriov images]# python 
Python 2.7.5 (default, Feb 11 2014, 07:46:25) 
[GCC 4.8.2 20140120 (Red Hat 4.8.2-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> con = libvirt.open('')
>>> dom = con.lookupByName('r7')
>>> dom.destroy()
0
>>> dom.undefineFlags(4)
0
>>> quit()
[root@sriov images]# ll /var/lib/libvirt/qemu/nvram/r7_VARS.fd
ls: cannot access /var/lib/libvirt/qemu/nvram/r7_VARS.fd: No such file or directory

Comment 3 Jiri Denemark 2014-10-14 08:27:20 UTC
You haven't really verify anything. The steps you did will work even with old libvirt-python that doesn't know anything about the new flag. Instead of using the vale of the new flag (4), you should use its name, that is:

    dom.undefineFlags(libvirt.VIR_DOMAIN_UNDEFINE_NVRAM)

Comment 4 hongming 2014-10-14 09:22:09 UTC
Sorry.I made the mistake. Verify it using libvirt.VIR_DOMAIN_UNDEFINE_NVRAM again. The result is expected.

I thought the libvirt-python can check the validity of the flag value. 
  

[root@sriov images]# virsh define r7.xml
Domain r7 defined from r7.xml

[root@sriov images]# virsh start r7
Domain r7 started

[root@sriov images]# virsh dumpxml r7| grep "/os" -B5
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.fd</loader>
    <nvram template='/usr/share/OVMF/OVMF_VARS.fd'>/var/lib/libvirt/qemu/nvram/r7_VARS.fd</nvram>
    <boot dev='hd'/>
  </os>
[root@sriov images]# python
Python 2.7.5 (default, Feb 11 2014, 07:46:25) 
[GCC 4.8.2 20140120 (Red Hat 4.8.2-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> con = libvirt.open('')
>>> quit()
[root@sriov images]# ll /var/lib/libvirt/qemu/nvram/r7_VARS.fd
-rw-------. 1 qemu qemu 131072 Oct 14 16:50 /var/lib/libvirt/qemu/nvram/r7_VARS.fd
[root@sriov images]# python
Python 2.7.5 (default, Feb 11 2014, 07:46:25) 
[GCC 4.8.2 20140120 (Red Hat 4.8.2-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> con = libvirt.open('')
>>> dom = con.lookupByName('r7')
>>> dom.destroy()
0
>>> dom.undefineFlags(libvirt.VIR_DOMAIN_UNDEFINE_NVRAM)
0
>>> quit()
[root@sriov images]# ll /var/lib/libvirt/qemu/nvram/r7_VARS.fd
ls: cannot access /var/lib/libvirt/qemu/nvram/r7_VARS.fd: No such file or directory

Comment 6 errata-xmlrpc 2015-03-05 07:56:55 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0334.html