Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
b6022c2a
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,发现更多精彩内容 >>
提交
b6022c2a
编写于
1月 31, 2006
作者:
D
Daniel Veillard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
* python/*: update of the python bindings, fix names, add
missing features like list of domains and domain info extraction Daniel
上级
ca586e5a
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
118 addition
and
4 deletion
+118
-4
ChangeLog
ChangeLog
+10
-0
include/libvir.h
include/libvir.h
+1
-1
python/TODO
python/TODO
+1
-1
python/generator.py
python/generator.py
+27
-2
python/libvir-python-api.xml
python/libvir-python-api.xml
+12
-0
python/libvir.c
python/libvir.c
+54
-0
python/libvir_wrap.h
python/libvir_wrap.h
+1
-0
python/types.c
python/types.c
+12
-0
未找到文件。
ChangeLog
浏览文件 @
b6022c2a
Tue Jan 31 11:22:51 CET 2006 Daniel Veillard <veillard@redhat.com>
* python/*: update of the python bindings, fix names, add
missing features like list of domains and domain info extraction
Tue Jan 31 11:21:56 CET 2006 Daniel Veillard <veillard@redhat.com>
* configure.in libvir.spec.in NEWS docs/*: commiting the state of 0.0.2
release
Sun Jan 29 11:55:13 CET 2006 Daniel Veillard <veillard@redhat.com>
* NEWS docs/news.xsl: added stylesheet to generate NEWS file
...
...
include/libvir.h
浏览文件 @
b6022c2a
...
...
@@ -167,7 +167,7 @@ typedef enum {
* version * 1,000,000 + minor * 1000 + micro
*/
#define LIBVIR_VERSION_NUMBER
1
#define LIBVIR_VERSION_NUMBER
2
int
virGetVersion
(
unsigned
long
*
libVer
,
const
char
*
type
,
...
...
python/TODO
浏览文件 @
b6022c2a
...
...
@@ -5,4 +5,4 @@
Daniel Veillard
$
d
ate$
$
D
ate$
python/generator.py
浏览文件 @
b6022c2a
...
...
@@ -202,6 +202,9 @@ def enum(type, name, value):
#
#######################################################################
functions_failed
=
[]
functions_skipped
=
[]
skipped_modules
=
{
}
...
...
@@ -254,8 +257,8 @@ foreign_encoding_args = (
# Class methods which are written by hand in libvir.c but the Python-level
# code is still automatically generated (so they are not in skip_function()).
skip_impl
=
(
'
xmlSaveFileTo
'
,
'
xmlSaveFormatFileT
o'
,
'
virConnectListDomainsID
'
,
'
virDomainGetInf
o'
,
)
def
skip_function
(
name
):
...
...
@@ -479,9 +482,11 @@ def buildStubs():
ret
=
print_function_wrapper
(
function
,
wrapper
,
export
,
include
)
if
ret
<
0
:
failed
=
failed
+
1
functions_failed
.
append
(
function
)
del
functions
[
function
]
if
ret
==
0
:
skipped
=
skipped
+
1
functions_skipped
.
append
(
function
)
del
functions
[
function
]
if
ret
==
1
:
nb_wrap
=
nb_wrap
+
1
...
...
@@ -536,6 +541,10 @@ function_classes = {}
function_classes
[
"None"
]
=
[]
function_post
=
{
'virDomainDestroy'
:
"self._o = None"
,
}
def
nameFixup
(
name
,
classe
,
type
,
file
):
listname
=
classe
+
"List"
ll
=
len
(
listname
)
...
...
@@ -557,6 +566,12 @@ def nameFixup(name, classe, type, file):
func
=
string
.
lower
(
func
[
0
:
1
])
+
func
[
1
:]
else
:
func
=
name
if
func
==
"iD"
:
func
=
"ID"
if
func
==
"oSType"
:
func
=
"OSType"
if
func
==
"xMLDesc"
:
func
=
"XMLDesc"
return
func
...
...
@@ -836,6 +851,8 @@ def buildWrappers():
classes
.
write
(
classes_type
[
arg
[
1
]][
0
])
n
=
n
+
1
classes
.
write
(
")
\n
"
);
if
function_post
.
has_key
(
name
):
classes
.
write
(
" %s
\n
"
%
(
function_post
[
name
]));
if
ret
[
0
]
!=
"void"
:
if
classes_type
.
has_key
(
ret
[
0
]):
#
...
...
@@ -893,6 +910,14 @@ def buildWrappers():
classes
.
write
(
"%s = %s
\n
"
%
(
name
,
value
))
classes
.
write
(
"
\n
"
);
if
len
(
functions_skipped
)
!=
0
:
txt
.
write
(
"
\n
Functions skipped:
\n
"
)
for
function
in
functions_skipped
:
txt
.
write
(
" %s
\n
"
%
function
)
if
len
(
functions_failed
)
!=
0
:
txt
.
write
(
"
\n
Functions failed:
\n
"
)
for
function
in
functions_failed
:
txt
.
write
(
" %s
\n
"
%
function
)
txt
.
close
()
classes
.
close
()
...
...
python/libvir-python-api.xml
浏览文件 @
b6022c2a
<?xml version="1.0"?>
<api
name=
'libvir-python'
>
<symbols>
<function
name=
"virConnectListDomainsID"
file=
'python'
>
<info>
Returns the list of the ID of the domains on the hypervisor
</info>
<arg
name=
'conn'
type=
'virConnectPtr'
info=
'pointer to the hypervisor connection'
/>
<return
type=
'int *'
info=
"the list of ID or None in case of error"
/>
</function>
<function
name=
'virDomainGetInfo'
file=
'libvir'
module=
'libvir'
>
<info>
Extract information about a domain. Note that if the connection used to get the domain is limited only a partial set of the informations can be extracted.
</info>
<return
type=
'int *'
info=
'the list of informations or None in case of error'
/>
<arg
name=
'domain'
type=
'virDomainPtr'
info=
'a domain object'
/>
</function>
</symbols>
</api>
python/libvir.c
浏览文件 @
b6022c2a
...
...
@@ -48,6 +48,58 @@ libvir_virConnectClose(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return
(
py_retval
);
}
static
PyObject
*
libvir_virConnectListDomainsID
(
PyObject
*
self
ATTRIBUTE_UNUSED
,
PyObject
*
args
)
{
PyObject
*
py_retval
;
int
ids
[
500
],
c_retval
,
i
;
virConnectPtr
conn
;
PyObject
*
pyobj_conn
;
if
(
!
PyArg_ParseTuple
(
args
,
(
char
*
)
"O:virConnectListDomains"
,
&
pyobj_conn
))
return
(
NULL
);
conn
=
(
virConnectPtr
)
PyvirConnect_Get
(
pyobj_conn
);
c_retval
=
virConnectListDomains
(
conn
,
&
ids
[
0
],
500
);
if
(
c_retval
<
0
)
{
Py_INCREF
(
Py_None
);
return
(
Py_None
);
}
py_retval
=
PyList_New
(
c_retval
);
for
(
i
=
0
;
i
<
c_retval
;
i
++
)
{
PyList_SetItem
(
py_retval
,
i
,
libvir_intWrap
(
ids
[
i
]));
}
return
(
py_retval
);
}
static
PyObject
*
libvir_virDomainGetInfo
(
PyObject
*
self
ATTRIBUTE_UNUSED
,
PyObject
*
args
)
{
PyObject
*
py_retval
;
int
c_retval
;
virDomainPtr
domain
;
PyObject
*
pyobj_domain
;
virDomainInfo
info
;
if
(
!
PyArg_ParseTuple
(
args
,
(
char
*
)
"O:virDomainGetInfo"
,
&
pyobj_domain
))
return
(
NULL
);
domain
=
(
virDomainPtr
)
PyvirDomain_Get
(
pyobj_domain
);
c_retval
=
virDomainGetInfo
(
domain
,
&
info
);
if
(
c_retval
<
0
)
{
Py_INCREF
(
Py_None
);
return
(
Py_None
);
}
py_retval
=
PyList_New
(
5
);
PyList_SetItem
(
py_retval
,
0
,
libvir_intWrap
((
int
)
info
.
state
));
PyList_SetItem
(
py_retval
,
1
,
libvir_longWrap
((
long
)
info
.
maxMem
));
PyList_SetItem
(
py_retval
,
2
,
libvir_longWrap
((
long
)
info
.
memory
));
PyList_SetItem
(
py_retval
,
3
,
libvir_intWrap
((
int
)
info
.
nrVirtCpu
));
PyList_SetItem
(
py_retval
,
4
,
libvir_longlongWrap
((
unsigned
long
long
)
info
.
cpuTime
));
return
(
py_retval
);
}
/************************************************************************
* *
* The registration stuff *
...
...
@@ -57,6 +109,8 @@ static PyMethodDef libvirMethods[] = {
#include "libvir-export.c"
{(
char
*
)
"virDomainFree"
,
libvir_virDomainFree
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virConnectClose"
,
libvir_virConnectClose
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virConnectListDomainsID"
,
libvir_virConnectListDomainsID
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virDomainGetInfo"
,
libvir_virDomainGetInfo
,
METH_VARARGS
,
NULL
},
{
NULL
,
NULL
,
0
,
NULL
}
};
...
...
python/libvir_wrap.h
浏览文件 @
b6022c2a
...
...
@@ -40,6 +40,7 @@ typedef struct {
PyObject
*
libvir_intWrap
(
int
val
);
PyObject
*
libvir_longWrap
(
long
val
);
PyObject
*
libvir_longlongWrap
(
long
long
val
);
PyObject
*
libvir_charPtrWrap
(
char
*
str
);
PyObject
*
libvir_constcharPtrWrap
(
const
char
*
str
);
PyObject
*
libvir_charPtrConstWrap
(
const
char
*
str
);
...
...
python/types.c
浏览文件 @
b6022c2a
...
...
@@ -33,6 +33,18 @@ libvir_longWrap(long val)
return
(
ret
);
}
PyObject
*
libvir_longlongWrap
(
long
long
val
)
{
PyObject
*
ret
;
#ifdef DEBUG
printf
(
"libvir_longWrap: val = %ld
\n
"
,
val
);
#endif
ret
=
PyLong_FromUnsignedLongLong
((
unsigned
long
long
)
val
);
return
(
ret
);
}
PyObject
*
libvir_charPtrWrap
(
char
*
str
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录