Re: [PATCH] Python bindings: Use virDomain/NetworkGetConnect instead of storing connection in domain/network object

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here is a patch which adds a large warning to those functions, and removes a comment from the Python code.

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
Index: src/libvirt.c
===================================================================
RCS file: /data/cvs/libvirt/src/libvirt.c,v
retrieving revision 1.90
diff -u -p -r1.90 libvirt.c
--- src/libvirt.c	17 Jul 2007 14:40:26 -0000	1.90
+++ src/libvirt.c	24 Jul 2007 14:57:46 -0000
@@ -750,6 +750,13 @@ virConnectNumOfDomains(virConnectPtr con
  * 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 domain object together.  The only safe use of this
+ * function is when doing manual memory allocation, and then
+ * only with great care.
+ * [https://www.redhat.com/archives/libvir-list/2007-July/msg00389.html]
+ *
  * Returns the virConnectPtr or NULL in case of failure.
  */
 virConnectPtr
@@ -2324,6 +2331,13 @@ virDomainDetachDevice(virDomainPtr domai
  * 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 network object together.  The only safe use of this
+ * function is when doing manual memory allocation, and then
+ * only with great care.
+ * [https://www.redhat.com/archives/libvir-list/2007-July/msg00389.html]
+ *
  * Returns the virConnectPtr or NULL in case of failure.
  */
 virConnectPtr
Index: python/generator.py
===================================================================
RCS file: /data/cvs/libvirt/python/generator.py,v
retrieving revision 1.22
diff -u -p -r1.22 generator.py
--- python/generator.py	25 Jun 2007 15:56:18 -0000	1.22
+++ python/generator.py	24 Jul 2007 14:57:47 -0000
@@ -870,10 +870,6 @@ def buildWrappers():
 		txt.write("Class %s()\n" % (classname))
 		classes.write("class %s:\n" % (classname))
                 if classname == "virDomain" or classname == "virNetwork":
-                    # NB: Earlier versions of libvirt did not provide
-                    # vir{Domain,Network}GetConnect, so we had to explicitly
-                    # store the connection object in _conn.  In future
-                    # we won't need to do this.
                     classes.write("    def __init__(self, conn, _obj=None):\n")
                 else:
                     classes.write("    def __init__(self, _obj=None):\n")

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]