Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
f4c331a7
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,发现更多精彩内容 >>
提交
f4c331a7
编写于
9月 05, 2011
作者:
O
Osier Yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
latency: Expose the new API for Python binding
上级
ee0d8c3b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
93 addition
and
0 deletion
+93
-0
python/generator.py
python/generator.py
+1
-0
python/libvirt-override-api.xml
python/libvirt-override-api.xml
+7
-0
python/libvirt-override.c
python/libvirt-override.c
+85
-0
未找到文件。
python/generator.py
浏览文件 @
f4c331a7
...
...
@@ -373,6 +373,7 @@ skip_impl = (
'virNodeGetMemoryStats'
,
'virDomainGetBlockJobInfo'
,
'virDomainMigrateGetMaxSpeed'
,
'virDomainBlockStatsFlags'
,
)
...
...
python/libvirt-override-api.xml
浏览文件 @
f4c331a7
...
...
@@ -128,6 +128,13 @@
<arg
name=
'domain'
type=
'virDomainPtr'
info=
'a domain object'
/>
<arg
name=
'path'
type=
'char *'
info=
'the path for the block device'
/>
</function>
<function
name=
'virDomainBlockStatsFlags'
file=
'python'
>
<info>
Extracts block device statistics parameters of a running domain
</info>
<return
type=
'virTypedParameterPtr'
info=
'None in case of error, returns a dictionary of params'
/>
<arg
name=
'domain'
type=
'virDomainPtr'
info=
'pointer to domain object'
/>
<arg
name=
'path'
type=
'char *'
info=
'the path for the block device'
/>
<arg
name=
'flags'
type=
'int'
info=
'flags (unused; pass 0)'
/>
</function>
<function
name=
'virDomainInterfaceStats'
file=
'python'
>
<info>
Extracts interface device statistics for a domain
</info>
<return
type=
'virDomainInterfaceStats'
info=
'a tuple of statistics'
/>
...
...
python/libvirt-override.c
浏览文件 @
f4c331a7
...
...
@@ -99,6 +99,90 @@ libvirt_virDomainBlockStats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return
(
info
);
}
static
PyObject
*
libvirt_virDomainBlockStatsFlags
(
PyObject
*
self
ATTRIBUTE_UNUSED
,
PyObject
*
args
)
{
virDomainPtr
domain
;
PyObject
*
pyobj_domain
,
*
info
;
int
i_retval
;
int
nparams
=
0
,
i
;
unsigned
int
flags
;
virTypedParameterPtr
params
;
const
char
*
path
;
if
(
!
PyArg_ParseTuple
(
args
,
(
char
*
)
"Ozi:virDomainBlockStatsFlags"
,
&
pyobj_domain
,
&
path
,
&
flags
))
return
(
NULL
);
domain
=
(
virDomainPtr
)
PyvirDomain_Get
(
pyobj_domain
);
LIBVIRT_BEGIN_ALLOW_THREADS
;
i_retval
=
virDomainBlockStatsFlags
(
domain
,
path
,
NULL
,
&
nparams
,
flags
);
LIBVIRT_END_ALLOW_THREADS
;
if
(
i_retval
<
0
)
return
VIR_PY_NONE
;
if
((
params
=
malloc
(
sizeof
(
*
params
)
*
nparams
))
==
NULL
)
return
VIR_PY_NONE
;
LIBVIRT_BEGIN_ALLOW_THREADS
;
i_retval
=
virDomainBlockStatsFlags
(
domain
,
path
,
params
,
&
nparams
,
flags
);
LIBVIRT_END_ALLOW_THREADS
;
if
(
i_retval
<
0
)
{
free
(
params
);
return
VIR_PY_NONE
;
}
/* convert to a Python tuple of long objects */
if
((
info
=
PyDict_New
())
==
NULL
)
{
free
(
params
);
return
VIR_PY_NONE
;
}
for
(
i
=
0
;
i
<
nparams
;
i
++
)
{
PyObject
*
key
,
*
val
;
switch
(
params
[
i
].
type
)
{
case
VIR_TYPED_PARAM_INT
:
val
=
PyInt_FromLong
((
long
)
params
[
i
].
value
.
i
);
break
;
case
VIR_TYPED_PARAM_UINT
:
val
=
PyInt_FromLong
((
long
)
params
[
i
].
value
.
ui
);
break
;
case
VIR_TYPED_PARAM_LLONG
:
val
=
PyLong_FromLongLong
((
long
long
)
params
[
i
].
value
.
l
);
break
;
case
VIR_TYPED_PARAM_ULLONG
:
val
=
PyLong_FromLongLong
((
long
long
)
params
[
i
].
value
.
ul
);
break
;
case
VIR_TYPED_PARAM_DOUBLE
:
val
=
PyFloat_FromDouble
((
double
)
params
[
i
].
value
.
d
);
break
;
case
VIR_TYPED_PARAM_BOOLEAN
:
val
=
PyBool_FromLong
((
long
)
params
[
i
].
value
.
b
);
break
;
default:
free
(
params
);
Py_DECREF
(
info
);
return
VIR_PY_NONE
;
}
key
=
libvirt_constcharPtrWrap
(
params
[
i
].
field
);
PyDict_SetItem
(
info
,
key
,
val
);
}
free
(
params
);
return
(
info
);
}
static
PyObject
*
libvirt_virDomainInterfaceStats
(
PyObject
*
self
ATTRIBUTE_UNUSED
,
PyObject
*
args
)
{
virDomainPtr
domain
;
...
...
@@ -4605,6 +4689,7 @@ static PyMethodDef libvirtMethods[] = {
{(
char
*
)
"virDomainGetAutostart"
,
libvirt_virDomainGetAutostart
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virNetworkGetAutostart"
,
libvirt_virNetworkGetAutostart
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virDomainBlockStats"
,
libvirt_virDomainBlockStats
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virDomainBlockStatsFlags"
,
libvirt_virDomainBlockStatsFlags
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virDomainInterfaceStats"
,
libvirt_virDomainInterfaceStats
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virDomainMemoryStats"
,
libvirt_virDomainMemoryStats
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virNodeGetCellsFreeMemory"
,
libvirt_virNodeGetCellsFreeMemory
,
METH_VARARGS
,
NULL
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录