Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
c9e6c8c0
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c9e6c8c0
编写于
5月 21, 2009
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add virInterface APIs to python code generator
上级
8d963487
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
72 addition
and
3 deletion
+72
-3
ChangeLog
ChangeLog
+5
-0
python/generator.py
python/generator.py
+42
-3
python/libvirt_wrap.h
python/libvirt_wrap.h
+10
-0
python/types.c
python/types.c
+15
-0
未找到文件。
ChangeLog
浏览文件 @
c9e6c8c0
Thu May 21 11:52:22 BST 2009 Daniel P. Berrange <berrange@redhat.com>
* python/generator.py, python/libvirt_wrap.h, python/types.c: Add
rules for generating virInterface APIs in python
Thu May 21 10:01:43 CEST 2009 Daniel Veillard <veillard@redhat.com>
Thu May 21 10:01:43 CEST 2009 Daniel Veillard <veillard@redhat.com>
* docs/formatstorage.html[.in]: fix a error in format type example
* docs/formatstorage.html[.in]: fix a error in format type example
...
...
python/generator.py
浏览文件 @
c9e6c8c0
...
@@ -246,6 +246,11 @@ py_types = {
...
@@ -246,6 +246,11 @@ py_types = {
'virNetwork *'
:
(
'O'
,
"virNetwork"
,
"virNetworkPtr"
,
"virNetworkPtr"
),
'virNetwork *'
:
(
'O'
,
"virNetwork"
,
"virNetworkPtr"
,
"virNetworkPtr"
),
'const virNetwork *'
:
(
'O'
,
"virNetwork"
,
"virNetworkPtr"
,
"virNetworkPtr"
),
'const virNetwork *'
:
(
'O'
,
"virNetwork"
,
"virNetworkPtr"
,
"virNetworkPtr"
),
'virInterfacePtr'
:
(
'O'
,
"virInterface"
,
"virInterfacePtr"
,
"virInterfacePtr"
),
'const virInterfacePtr'
:
(
'O'
,
"virInterface"
,
"virInterfacePtr"
,
"virInterfacePtr"
),
'virInterface *'
:
(
'O'
,
"virInterface"
,
"virInterfacePtr"
,
"virInterfacePtr"
),
'const virInterface *'
:
(
'O'
,
"virInterface"
,
"virInterfacePtr"
,
"virInterfacePtr"
),
'virStoragePoolPtr'
:
(
'O'
,
"virStoragePool"
,
"virStoragePoolPtr"
,
"virStoragePoolPtr"
),
'virStoragePoolPtr'
:
(
'O'
,
"virStoragePool"
,
"virStoragePoolPtr"
,
"virStoragePoolPtr"
),
'const virStoragePoolPtr'
:
(
'O'
,
"virStoragePool"
,
"virStoragePoolPtr"
,
"virStoragePoolPtr"
),
'const virStoragePoolPtr'
:
(
'O'
,
"virStoragePool"
,
"virStoragePoolPtr"
,
"virStoragePoolPtr"
),
'virStoragePool *'
:
(
'O'
,
"virStoragePool"
,
"virStoragePoolPtr"
,
"virStoragePoolPtr"
),
'virStoragePool *'
:
(
'O'
,
"virStoragePool"
,
"virStoragePoolPtr"
,
"virStoragePoolPtr"
),
...
@@ -289,6 +294,8 @@ skip_impl = (
...
@@ -289,6 +294,8 @@ skip_impl = (
'virConnectListDefinedDomains'
,
'virConnectListDefinedDomains'
,
'virConnectListNetworks'
,
'virConnectListNetworks'
,
'virConnectListDefinedNetworks'
,
'virConnectListDefinedNetworks'
,
'virConnectListInterfaces'
,
'virConnectListDefinedInterfaces'
,
'virConnectListStoragePools'
,
'virConnectListStoragePools'
,
'virConnectListDefinedStoragePools'
,
'virConnectListDefinedStoragePools'
,
'virConnectListStorageVols'
,
'virConnectListStorageVols'
,
...
@@ -608,6 +615,8 @@ classes_type = {
...
@@ -608,6 +615,8 @@ classes_type = {
"virDomain *"
:
(
"._o"
,
"virDomain(self, _obj=%s)"
,
"virDomain"
),
"virDomain *"
:
(
"._o"
,
"virDomain(self, _obj=%s)"
,
"virDomain"
),
"virNetworkPtr"
:
(
"._o"
,
"virNetwork(self, _obj=%s)"
,
"virNetwork"
),
"virNetworkPtr"
:
(
"._o"
,
"virNetwork(self, _obj=%s)"
,
"virNetwork"
),
"virNetwork *"
:
(
"._o"
,
"virNetwork(self, _obj=%s)"
,
"virNetwork"
),
"virNetwork *"
:
(
"._o"
,
"virNetwork(self, _obj=%s)"
,
"virNetwork"
),
"virInterfacePtr"
:
(
"._o"
,
"virInterface(self, _obj=%s)"
,
"virInterface"
),
"virInterface *"
:
(
"._o"
,
"virInterface(self, _obj=%s)"
,
"virInterface"
),
"virStoragePoolPtr"
:
(
"._o"
,
"virStoragePool(self, _obj=%s)"
,
"virStoragePool"
),
"virStoragePoolPtr"
:
(
"._o"
,
"virStoragePool(self, _obj=%s)"
,
"virStoragePool"
),
"virStoragePool *"
:
(
"._o"
,
"virStoragePool(self, _obj=%s)"
,
"virStoragePool"
),
"virStoragePool *"
:
(
"._o"
,
"virStoragePool(self, _obj=%s)"
,
"virStoragePool"
),
"virStorageVolPtr"
:
(
"._o"
,
"virStorageVol(self, _obj=%s)"
,
"virStorageVol"
),
"virStorageVolPtr"
:
(
"._o"
,
"virStorageVol(self, _obj=%s)"
,
"virStorageVol"
),
...
@@ -621,7 +630,8 @@ classes_type = {
...
@@ -621,7 +630,8 @@ classes_type = {
converter_type
=
{
converter_type
=
{
}
}
primary_classes
=
[
"virDomain"
,
"virNetwork"
,
"virStoragePool"
,
"virStorageVol"
,
primary_classes
=
[
"virDomain"
,
"virNetwork"
,
"virInterface"
,
"virStoragePool"
,
"virStorageVol"
,
"virConnect"
,
"virNodeDevice"
]
"virConnect"
,
"virNodeDevice"
]
classes_ancestor
=
{
classes_ancestor
=
{
...
@@ -629,6 +639,7 @@ classes_ancestor = {
...
@@ -629,6 +639,7 @@ classes_ancestor = {
classes_destructors
=
{
classes_destructors
=
{
"virDomain"
:
"virDomainFree"
,
"virDomain"
:
"virDomainFree"
,
"virNetwork"
:
"virNetworkFree"
,
"virNetwork"
:
"virNetworkFree"
,
"virInterface"
:
"virInterfaceFree"
,
"virStoragePool"
:
"virStoragePoolFree"
,
"virStoragePool"
:
"virStoragePoolFree"
,
"virStorageVol"
:
"virStorageVolFree"
,
"virStorageVol"
:
"virStorageVolFree"
,
"virNodeDevice"
:
"virNodeDeviceFree"
"virNodeDevice"
:
"virNodeDeviceFree"
...
@@ -638,6 +649,7 @@ functions_noexcept = {
...
@@ -638,6 +649,7 @@ functions_noexcept = {
'virDomainGetID'
:
True
,
'virDomainGetID'
:
True
,
'virDomainGetName'
:
True
,
'virDomainGetName'
:
True
,
'virNetworkGetName'
:
True
,
'virNetworkGetName'
:
True
,
'virInterfaceGetName'
:
True
,
'virStoragePoolGetName'
:
True
,
'virStoragePoolGetName'
:
True
,
'virStorageVolGetName'
:
True
,
'virStorageVolGetName'
:
True
,
'virStorageVolGetkey'
:
True
,
'virStorageVolGetkey'
:
True
,
...
@@ -690,6 +702,15 @@ def nameFixup(name, classe, type, file):
...
@@ -690,6 +702,15 @@ def nameFixup(name, classe, type, file):
elif
name
[
0
:
16
]
==
"virNetworkLookup"
:
elif
name
[
0
:
16
]
==
"virNetworkLookup"
:
func
=
name
[
3
:]
func
=
name
[
3
:]
func
=
string
.
lower
(
func
[
0
:
1
])
+
func
[
1
:]
func
=
string
.
lower
(
func
[
0
:
1
])
+
func
[
1
:]
elif
name
[
0
:
18
]
==
"virInterfaceDefine"
:
func
=
name
[
3
:]
func
=
string
.
lower
(
func
[
0
:
1
])
+
func
[
1
:]
elif
name
[
0
:
21
]
==
"virInterfaceCreateXML"
:
func
=
name
[
3
:]
func
=
string
.
lower
(
func
[
0
:
1
])
+
func
[
1
:]
elif
name
[
0
:
18
]
==
"virInterfaceLookup"
:
func
=
name
[
3
:]
func
=
string
.
lower
(
func
[
0
:
1
])
+
func
[
1
:]
elif
name
[
0
:
20
]
==
"virStoragePoolDefine"
:
elif
name
[
0
:
20
]
==
"virStoragePoolDefine"
:
func
=
name
[
3
:]
func
=
name
[
3
:]
func
=
string
.
lower
(
func
[
0
:
1
])
+
func
[
1
:]
func
=
string
.
lower
(
func
[
0
:
1
])
+
func
[
1
:]
...
@@ -717,6 +738,12 @@ def nameFixup(name, classe, type, file):
...
@@ -717,6 +738,12 @@ def nameFixup(name, classe, type, file):
elif
name
[
0
:
10
]
==
"virNetwork"
:
elif
name
[
0
:
10
]
==
"virNetwork"
:
func
=
name
[
10
:]
func
=
name
[
10
:]
func
=
string
.
lower
(
func
[
0
:
1
])
+
func
[
1
:]
func
=
string
.
lower
(
func
[
0
:
1
])
+
func
[
1
:]
elif
name
[
0
:
15
]
==
"virInterfaceGet"
:
func
=
name
[
13
:]
func
=
string
.
lower
(
func
[
0
:
1
])
+
func
[
1
:]
elif
name
[
0
:
12
]
==
"virInterface"
:
func
=
name
[
10
:]
func
=
string
.
lower
(
func
[
0
:
1
])
+
func
[
1
:]
elif
name
[
0
:
17
]
==
"virStoragePoolGet"
:
elif
name
[
0
:
17
]
==
"virStoragePoolGet"
:
func
=
name
[
17
:]
func
=
name
[
17
:]
func
=
string
.
lower
(
func
[
0
:
1
])
+
func
[
1
:]
func
=
string
.
lower
(
func
[
0
:
1
])
+
func
[
1
:]
...
@@ -988,7 +1015,7 @@ def buildWrappers():
...
@@ -988,7 +1015,7 @@ def buildWrappers():
else
:
else
:
txt
.
write
(
"Class %s()
\n
"
%
(
classname
))
txt
.
write
(
"Class %s()
\n
"
%
(
classname
))
classes
.
write
(
"class %s:
\n
"
%
(
classname
))
classes
.
write
(
"class %s:
\n
"
%
(
classname
))
if
classname
in
[
"virDomain"
,
"virNetwork"
,
"virStoragePool"
,
"virStorageVol"
,
"virNodeDevice"
]:
if
classname
in
[
"virDomain"
,
"virNetwork"
,
"vir
Interface"
,
"vir
StoragePool"
,
"virStorageVol"
,
"virNodeDevice"
]:
classes
.
write
(
" def __init__(self, conn, _obj=None):
\n
"
)
classes
.
write
(
" def __init__(self, conn, _obj=None):
\n
"
)
else
:
else
:
classes
.
write
(
" def __init__(self, _obj=None):
\n
"
)
classes
.
write
(
" def __init__(self, _obj=None):
\n
"
)
...
@@ -996,7 +1023,7 @@ def buildWrappers():
...
@@ -996,7 +1023,7 @@ def buildWrappers():
list
=
reference_keepers
[
classname
]
list
=
reference_keepers
[
classname
]
for
ref
in
list
:
for
ref
in
list
:
classes
.
write
(
" self.%s = None
\n
"
%
ref
[
1
])
classes
.
write
(
" self.%s = None
\n
"
%
ref
[
1
])
if
classname
in
[
"virDomain"
,
"virNetwork"
,
"virNodeDevice"
]:
if
classname
in
[
"virDomain"
,
"virNetwork"
,
"vir
Interface"
,
"vir
NodeDevice"
]:
classes
.
write
(
" self._conn = conn
\n
"
)
classes
.
write
(
" self._conn = conn
\n
"
)
elif
classname
in
[
"virStorageVol"
,
"virStoragePool"
]:
elif
classname
in
[
"virStorageVol"
,
"virStoragePool"
]:
classes
.
write
(
" self._conn = conn
\n
"
+
\
classes
.
write
(
" self._conn = conn
\n
"
+
\
...
@@ -1095,6 +1122,10 @@ def buildWrappers():
...
@@ -1095,6 +1122,10 @@ def buildWrappers():
(
name
))
(
name
))
elif
classname
==
"virNetwork"
:
elif
classname
==
"virNetwork"
:
classes
.
write
(
classes
.
write
(
" if ret is None:raise libvirtError('%s() failed', net=self)
\n
"
%
(
name
))
elif
classname
==
"virInterface"
:
classes
.
write
(
" if ret is None:raise libvirtError('%s() failed', net=self)
\n
"
%
" if ret is None:raise libvirtError('%s() failed', net=self)
\n
"
%
(
name
))
(
name
))
elif
classname
==
"virStoragePool"
:
elif
classname
==
"virStoragePool"
:
...
@@ -1177,6 +1208,10 @@ def buildWrappers():
...
@@ -1177,6 +1208,10 @@ def buildWrappers():
classes
.
write
((
" if "
+
test
+
classes
.
write
((
" if "
+
test
+
": raise libvirtError ('%s() failed', net=self)
\n
"
)
%
": raise libvirtError ('%s() failed', net=self)
\n
"
)
%
(
"ret"
,
name
))
(
"ret"
,
name
))
elif
classname
==
"virInterface"
:
classes
.
write
((
" if "
+
test
+
": raise libvirtError ('%s() failed', net=self)
\n
"
)
%
(
"ret"
,
name
))
elif
classname
==
"virStoragePool"
:
elif
classname
==
"virStoragePool"
:
classes
.
write
((
" if "
+
test
+
classes
.
write
((
" if "
+
test
+
": raise libvirtError ('%s() failed', pool=self)
\n
"
)
%
": raise libvirtError ('%s() failed', pool=self)
\n
"
)
%
...
@@ -1215,6 +1250,10 @@ def buildWrappers():
...
@@ -1215,6 +1250,10 @@ def buildWrappers():
classes
.
write
((
" if "
+
test
+
classes
.
write
((
" if "
+
test
+
": raise libvirtError ('%s() failed', net=self)
\n
"
)
%
": raise libvirtError ('%s() failed', net=self)
\n
"
)
%
(
"ret"
,
name
))
(
"ret"
,
name
))
elif
classname
==
"virInterface"
:
classes
.
write
((
" if "
+
test
+
": raise libvirtError ('%s() failed', net=self)
\n
"
)
%
(
"ret"
,
name
))
elif
classname
==
"virStoragePool"
:
elif
classname
==
"virStoragePool"
:
classes
.
write
((
" if "
+
test
+
classes
.
write
((
" if "
+
test
+
": raise libvirtError ('%s() failed', pool=self)
\n
"
)
%
": raise libvirtError ('%s() failed', pool=self)
\n
"
)
%
...
...
python/libvirt_wrap.h
浏览文件 @
c9e6c8c0
...
@@ -48,6 +48,15 @@ typedef struct {
...
@@ -48,6 +48,15 @@ typedef struct {
}
PyvirNetwork_Object
;
}
PyvirNetwork_Object
;
#define PyvirInterface_Get(v) (((v) == Py_None) ? NULL : \
(((PyvirInterface_Object *)(v))->obj))
typedef
struct
{
PyObject_HEAD
virInterfacePtr
obj
;
}
PyvirInterface_Object
;
#define PyvirStoragePool_Get(v) (((v) == Py_None) ? NULL : \
#define PyvirStoragePool_Get(v) (((v) == Py_None) ? NULL : \
(((PyvirStoragePool_Object *)(v))->obj))
(((PyvirStoragePool_Object *)(v))->obj))
...
@@ -118,6 +127,7 @@ PyObject * libvirt_charPtrConstWrap(const char *str);
...
@@ -118,6 +127,7 @@ PyObject * libvirt_charPtrConstWrap(const char *str);
PyObject
*
libvirt_virConnectPtrWrap
(
virConnectPtr
node
);
PyObject
*
libvirt_virConnectPtrWrap
(
virConnectPtr
node
);
PyObject
*
libvirt_virDomainPtrWrap
(
virDomainPtr
node
);
PyObject
*
libvirt_virDomainPtrWrap
(
virDomainPtr
node
);
PyObject
*
libvirt_virNetworkPtrWrap
(
virNetworkPtr
node
);
PyObject
*
libvirt_virNetworkPtrWrap
(
virNetworkPtr
node
);
PyObject
*
libvirt_virInterfacePtrWrap
(
virInterfacePtr
node
);
PyObject
*
libvirt_virStoragePoolPtrWrap
(
virStoragePoolPtr
node
);
PyObject
*
libvirt_virStoragePoolPtrWrap
(
virStoragePoolPtr
node
);
PyObject
*
libvirt_virStorageVolPtrWrap
(
virStorageVolPtr
node
);
PyObject
*
libvirt_virStorageVolPtrWrap
(
virStorageVolPtr
node
);
PyObject
*
libvirt_virEventHandleCallbackWrap
(
virEventHandleCallback
node
);
PyObject
*
libvirt_virEventHandleCallbackWrap
(
virEventHandleCallback
node
);
...
...
python/types.c
浏览文件 @
c9e6c8c0
...
@@ -118,6 +118,21 @@ libvirt_virNetworkPtrWrap(virNetworkPtr node)
...
@@ -118,6 +118,21 @@ libvirt_virNetworkPtrWrap(virNetworkPtr node)
return
(
ret
);
return
(
ret
);
}
}
PyObject
*
libvirt_virInterfacePtrWrap
(
virInterfacePtr
node
)
{
PyObject
*
ret
;
if
(
node
==
NULL
)
{
Py_INCREF
(
Py_None
);
return
(
Py_None
);
}
ret
=
PyCObject_FromVoidPtrAndDesc
((
void
*
)
node
,
(
char
*
)
"virInterfacePtr"
,
NULL
);
return
(
ret
);
}
PyObject
*
PyObject
*
libvirt_virStoragePoolPtrWrap
(
virStoragePoolPtr
node
)
libvirt_virStoragePoolPtrWrap
(
virStoragePoolPtr
node
)
{
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录