提交 9e09f313 编写于 作者: C Cole Robinson

python: Use a pure python implementation of 'vir*GetConnect'

The API docs explictly warn that we shouldn't use the C vir*GetConnect calls
in bindings: doing so can close the internal connection pointer and cause
things to get screwy. Implement these calls in python.
Signed-off-by: NCole Robinson <crobinso@redhat.com>
上级 97648a97
...@@ -343,6 +343,16 @@ skip_function = ( ...@@ -343,6 +343,16 @@ skip_function = (
"virSecretRef", "virSecretRef",
"virStoragePoolRef", "virStoragePoolRef",
"virStorageVolRef", "virStorageVolRef",
# This functions shouldn't be called via the bindings (and even the docs
# contain an explicit warning to that effect). The equivalent should be
# implemented in pure python for each class
"virDomainGetConnect",
"virInterfaceGetConnect",
"virNetworkGetConnect",
"virSecretGetConnect",
"virStoragePoolGetConnect",
"virStorageVolGetConnect",
) )
...@@ -641,6 +651,11 @@ classes_destructors = { ...@@ -641,6 +651,11 @@ classes_destructors = {
#"virStream": "virStreamFree", #"virStream": "virStreamFree",
} }
class_skip_connect_impl = {
"virConnect" : True
}
functions_noexcept = { functions_noexcept = {
'virDomainGetID': True, 'virDomainGetID': True,
'virDomainGetName': True, 'virDomainGetName': True,
...@@ -1065,6 +1080,12 @@ def buildWrappers(): ...@@ -1065,6 +1080,12 @@ def buildWrappers():
classes_destructors[classname]); classes_destructors[classname]);
classes.write(" self._o = None\n\n"); classes.write(" self._o = None\n\n");
destruct=classes_destructors[classname] destruct=classes_destructors[classname]
if not class_skip_connect_impl.has_key(classname):
# Build python safe 'connect' method
classes.write(" def connect(self):\n")
classes.write(" return self._conn\n\n")
flist = function_classes[classname] flist = function_classes[classname]
flist.sort(functionCompare) flist.sort(functionCompare)
oldfile = "" oldfile = ""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册