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.
Cause: Python bindings for libvirt contained incorrect implementation of
getDomain() and getConnect() methods in virDomainSnapshot class.
Consequence: An application using these methods may fail or crash.
Fix: Python bindings now provide proper domain() and connect() accessors that
fetch python objects stored internally within virDomainSnapshot instance. For
backward compatibility, getDomain() and getConnect() methods call these
accessors.
Result: An application using either of these methods works as expected.
The bus is also reproducible upstream, although the python client segfaults there rather than reporting invalid pointers.
In any case, we have a nasty bug in python bindings. virDomainSnapshotGetDomain() API (called as snapshot.getDomain() in python) returns the domain object but does not increment its reference counter. However, we just take it and wrap it as virDomain object in python and once the object is deleted, it calls virDomainFree. And virDomainFree is called once more when the snapshot object is deleted (as it holds a reference to the domain). Thus, before creating a virDomain object from the domain pointer returned by virDomainSnapshotGetDomain, we need to call virDomainRef to increment its reference counter.
Unfortunately, it seems virDomainSnapshotGetDomain API is not the only one affected and we have similar bugs in other APIs too.
Fixed upstream by v1.0.2-rc1-6-g7b35fd7:
commit 7b35fd718d2156224797ace08f752dfbb9884520
Author: Jiri Denemark <jdenemar>
Date: Wed Jan 23 12:14:57 2013 +0100
python: Fix bindings for virDomainSnapshotGet{Domain,Connect}
https://bugzilla.redhat.com/show_bug.cgi?id=895882
virDomainSnapshot.getDomain() and virDomainSnapshot.getConnect()
wrappers around virDomainSnapshotGet{Domain,Connect} were not supposed
to be ever implemented. The class should contain proper domain() and
connect() accessors that fetch python objects stored internally within
the class. While domain() was already provided, connect() was missing.
This patch adds connect() method to virDomainSnapshot class and
reimplements getDomain() and getConnect() methods as aliases to domain()
and connect() for backward compatibility.
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.
http://rhn.redhat.com/errata/RHBA-2013-1581.html
Description of problem: The following error occurs when use domain object from snapshot object 's getdomain method libvir: Domain error : invalid domain pointer in virDomainFree When looping through snapshot list , the following error occurs. libvir: Domain Snapshot error : Invalid snapshot: virDomainSnapshotFree Version-Release number of selected component (if applicable): libvirt-python-0.10.2-15.el6.x86_64 How reproducible: 100% Steps to Reproduce: # virsh snapshot-list snapshot Name Creation Time State ------------------------------------------------------------ 1358243306 2013-01-15 17:48:26 +0800 running 1358243555 2013-01-15 17:52:35 +0800 running # cat snapshot.py #!/usr/bin/env python import libvirt def snapshot(): con = libvirt.open('') dom = con.lookupByName('snapshot') snapshot_list = dom.listAllSnapshots(0) print "snapshot object list:%s" % snapshot_list domain = snapshot_list[0].getDomain() domain_name = domain.name() print "domain name:%s" % domain_name if __name__=='__main__': # python snapshot.py snapshot object list:[<libvirt.virDomainSnapshot instance at 0x7f2202d3fea8>, <libvirt.virDomainSnapshot instance at 0x7f2202d3fef0>] domain name:snapshot libvir: Domain error : invalid domain pointer in virDomainFree # cat snapshot1.py #!/usr/bin/env python import libvirt def snapshot(): con = libvirt.open('') dom = con.lookupByName('snapshot') snapshot_list = dom.listAllSnapshots(0) print "snapshot object list: %s" % snapshot_list for snapshot_item in snapshot_list: domain = snapshot_item.getDomain() print "domain name: %s " % domain.name() if __name__=='__main__': snapshot() # python snapshot1.py snapshot object list: [<libvirt.virDomainSnapshot instance at 0x7fb9e89d1ef0>, <libvirt.virDomainSnapshot instance at 0x7fb9e89d1f38>] domain name: snapshot domain name: snapshot libvir: Domain Snapshot error : Invalid snapshot: virDomainSnapshotFree libvir: Domain error : invalid domain pointer in virDomainFree Actual results: as above Expected results: It works fine Additional info: