]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
python: Fix bindings for virDomainSnapshotGet{Domain,Connect}
authorJiri Denemark <jdenemar@redhat.com>
Wed, 23 Jan 2013 11:14:57 +0000 (12:14 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 24 Jan 2013 20:24:30 +0000 (21:24 +0100)
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.

python/generator.py
python/libvirt-override-virDomainSnapshot.py
src/libvirt.c

index a079fc57f912d5b7e3c68c73f204551dc7252c54..5d27f66c056da66bf77908841a3acc8c477247d2 100755 (executable)
@@ -527,6 +527,8 @@ skip_function = (
     "virNWFilterGetConnect",
     "virStoragePoolGetConnect",
     "virStorageVolGetConnect",
+    "virDomainSnapshotGetConnect",
+    "virDomainSnapshotGetDomain",
 
     # only useful in C code, python code uses dict for typed parameters
     "virTypedParamsAddBoolean",
@@ -953,7 +955,6 @@ classes_destructors = {
 
 class_skip_connect_impl = {
     "virConnect" : True,
-    "virDomainSnapshot": True,
 }
 
 class_domain_impl = {
@@ -1436,6 +1437,7 @@ def buildWrappers(module):
                                   "            self._conn = conn._conn\n")
                 elif classname in [ "virDomainSnapshot" ]:
                     classes.write("        self._dom = dom\n")
+                    classes.write("        self._conn = dom.connect()\n")
                 classes.write("        if _obj != None:self._o = _obj;return\n")
                 classes.write("        self._o = None\n\n");
             destruct=None
index 3da7bfd90366d2f469335a6f1c817bd6c7595568..bf708a52bd6b85b16846fbf004ee57edee2e871d 100644 (file)
@@ -1,3 +1,11 @@
+    def getConnect(self):
+        """Get the connection that owns the domain that a snapshot was created for"""
+        return self.connect()
+
+    def getDomain(self):
+        """Get the domain that a snapshot was created for"""
+        return self.domain()
+
     def listAllChildren(self, flags):
         """List all child snapshots and returns a list of snapshot objects"""
         ret = libvirtmod.virDomainSnapshotListAllChildren(self._o, flags)
index d5d561c0b59a8363f20ed45c50c06acfab1ffe54..f81a3de76b6252bea0e0314f70a9cefff9ee2fe9 100644 (file)
@@ -17850,7 +17850,12 @@ virDomainSnapshotGetName(virDomainSnapshotPtr snapshot)
  * virDomainSnapshotGetDomain:
  * @snapshot: a snapshot object
  *
- * Get the domain that a snapshot was created for
+ * Provides the domain pointer associated with a snapshot.  The
+ * reference counter on the domain is not increased by this
+ * call.
+ *
+ * WARNING: When writing libvirt bindings in other languages, do not use this
+ * function.  Instead, store the domain and the snapshot object together.
  *
  * Returns the domain or NULL.
  */
@@ -17874,7 +17879,12 @@ virDomainSnapshotGetDomain(virDomainSnapshotPtr snapshot)
  * virDomainSnapshotGetConnect:
  * @snapshot: a snapshot object
  *
- * Get the connection that owns the domain that a snapshot was created for
+ * Provides the connection pointer associated with a snapshot.  The
+ * reference counter on the connection is not increased by this
+ * call.
+ *
+ * WARNING: When writing libvirt bindings in other languages, do not use this
+ * function.  Instead, store the connection and the snapshot object together.
  *
  * Returns the connection or NULL.
  */