Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
795d9200
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,发现更多精彩内容 >>
提交
795d9200
编写于
9月 30, 2007
作者:
D
Daniel Veillard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
* python/generator.py python/libvir.c python/libvirt-python-api.xml:
provide bindings for block and interface statistics Daniel
上级
c4461ff5
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
90 addition
and
0 deletion
+90
-0
ChangeLog
ChangeLog
+5
-0
python/generator.py
python/generator.py
+2
-0
python/libvir.c
python/libvir.c
+71
-0
python/libvirt-python-api.xml
python/libvirt-python-api.xml
+12
-0
未找到文件。
ChangeLog
浏览文件 @
795d9200
Sun Sep 30 22:51:11 CEST 2007 Daniel Veillard <veillard@redhat.com>
* python/generator.py python/libvir.c python/libvirt-python-api.xml:
provide bindings for block and interface statistics
Sun Sep 30 12:27:36 EST 2007 Daniel P. Berrange <berrange@redhat.com>
Sun Sep 30 12:27:36 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* src/xend_internal.c: Don't include <bootloader/> for HVM guests
* src/xend_internal.c: Don't include <bootloader/> for HVM guests
...
...
python/generator.py
浏览文件 @
795d9200
...
@@ -276,6 +276,8 @@ skip_impl = (
...
@@ -276,6 +276,8 @@ skip_impl = (
'virDomainLookupByUUID'
,
'virDomainLookupByUUID'
,
'virNetworkGetUUID'
,
'virNetworkGetUUID'
,
'virNetworkLookupByUUID'
,
'virNetworkLookupByUUID'
,
'virDomainBlockStats'
,
'virDomainInterfaceStats'
,
)
)
def
skip_function
(
name
):
def
skip_function
(
name
):
...
...
python/libvir.c
浏览文件 @
795d9200
...
@@ -21,8 +21,77 @@ PyObject *libvirt_virDomainGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *ar
...
@@ -21,8 +21,77 @@ PyObject *libvirt_virDomainGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *ar
PyObject
*
libvirt_virNetworkGetUUID
(
PyObject
*
self
ATTRIBUTE_UNUSED
,
PyObject
*
args
);
PyObject
*
libvirt_virNetworkGetUUID
(
PyObject
*
self
ATTRIBUTE_UNUSED
,
PyObject
*
args
);
PyObject
*
libvirt_virGetLastError
(
PyObject
*
self
ATTRIBUTE_UNUSED
,
PyObject
*
args
);
PyObject
*
libvirt_virGetLastError
(
PyObject
*
self
ATTRIBUTE_UNUSED
,
PyObject
*
args
);
PyObject
*
libvirt_virConnGetLastError
(
PyObject
*
self
ATTRIBUTE_UNUSED
,
PyObject
*
args
);
PyObject
*
libvirt_virConnGetLastError
(
PyObject
*
self
ATTRIBUTE_UNUSED
,
PyObject
*
args
);
PyObject
*
libvirt_virDomainBlockStats
(
PyObject
*
self
ATTRIBUTE_UNUSED
,
PyObject
*
args
);
PyObject
*
libvirt_virDomainInterfaceStats
(
PyObject
*
self
ATTRIBUTE_UNUSED
,
PyObject
*
args
);
/************************************************************************
* *
* Statistics *
* *
************************************************************************/
PyObject
*
libvirt_virDomainBlockStats
(
PyObject
*
self
ATTRIBUTE_UNUSED
,
PyObject
*
args
)
{
virDomainPtr
domain
;
PyObject
*
pyobj_domain
;
char
*
path
;
int
c_retval
;
virDomainBlockStatsStruct
stats
;
PyObject
*
info
;
if
(
!
PyArg_ParseTuple
(
args
,
(
char
*
)
"Oz:virDomainBlockStats"
,
&
pyobj_domain
,
&
path
))
return
(
NULL
);
domain
=
(
virDomainPtr
)
PyvirDomain_Get
(
pyobj_domain
);
c_retval
=
virDomainBlockStats
(
domain
,
path
,
&
stats
,
sizeof
(
stats
));
if
(
c_retval
<
0
)
{
Py_INCREF
(
Py_None
);
return
(
Py_None
);
}
/* convert to a Python tupple of long objects */
info
=
PyTuple_New
(
5
);
PyTuple_SetItem
(
info
,
0
,
PyLong_FromLongLong
(
stats
.
rd_req
));
PyTuple_SetItem
(
info
,
1
,
PyLong_FromLongLong
(
stats
.
rd_bytes
));
PyTuple_SetItem
(
info
,
2
,
PyLong_FromLongLong
(
stats
.
wr_req
));
PyTuple_SetItem
(
info
,
3
,
PyLong_FromLongLong
(
stats
.
wr_bytes
));
PyTuple_SetItem
(
info
,
4
,
PyLong_FromLongLong
(
stats
.
errs
));
return
(
info
);
}
PyObject
*
libvirt_virDomainInterfaceStats
(
PyObject
*
self
ATTRIBUTE_UNUSED
,
PyObject
*
args
)
{
virDomainPtr
domain
;
PyObject
*
pyobj_domain
;
char
*
path
;
int
c_retval
;
virDomainInterfaceStatsStruct
stats
;
PyObject
*
info
;
if
(
!
PyArg_ParseTuple
(
args
,
(
char
*
)
"Oz:virDomainInterfaceStats"
,
&
pyobj_domain
,
&
path
))
return
(
NULL
);
domain
=
(
virDomainPtr
)
PyvirDomain_Get
(
pyobj_domain
);
c_retval
=
virDomainInterfaceStats
(
domain
,
path
,
&
stats
,
sizeof
(
stats
));
if
(
c_retval
<
0
)
{
Py_INCREF
(
Py_None
);
return
(
Py_None
);
}
/* convert to a Python tupple of long objects */
info
=
PyTuple_New
(
8
);
PyTuple_SetItem
(
info
,
0
,
PyLong_FromLongLong
(
stats
.
rx_bytes
));
PyTuple_SetItem
(
info
,
1
,
PyLong_FromLongLong
(
stats
.
rx_packets
));
PyTuple_SetItem
(
info
,
2
,
PyLong_FromLongLong
(
stats
.
rx_errs
));
PyTuple_SetItem
(
info
,
3
,
PyLong_FromLongLong
(
stats
.
rx_drop
));
PyTuple_SetItem
(
info
,
4
,
PyLong_FromLongLong
(
stats
.
tx_bytes
));
PyTuple_SetItem
(
info
,
5
,
PyLong_FromLongLong
(
stats
.
tx_packets
));
PyTuple_SetItem
(
info
,
6
,
PyLong_FromLongLong
(
stats
.
tx_errs
));
PyTuple_SetItem
(
info
,
7
,
PyLong_FromLongLong
(
stats
.
tx_drop
));
return
(
info
);
}
/************************************************************************
/************************************************************************
* *
* *
* Global error handler at the Python level *
* Global error handler at the Python level *
...
@@ -677,6 +746,8 @@ static PyMethodDef libvirtMethods[] = {
...
@@ -677,6 +746,8 @@ static PyMethodDef libvirtMethods[] = {
{(
char
*
)
"virNetworkLookupByUUID"
,
libvirt_virNetworkLookupByUUID
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virNetworkLookupByUUID"
,
libvirt_virNetworkLookupByUUID
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virDomainGetAutostart"
,
libvirt_virDomainGetAutostart
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virDomainGetAutostart"
,
libvirt_virDomainGetAutostart
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virNetworkGetAutostart"
,
libvirt_virNetworkGetAutostart
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virNetworkGetAutostart"
,
libvirt_virNetworkGetAutostart
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virDomainBlockStats"
,
libvirt_virDomainBlockStats
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virDomainInterfaceStats"
,
libvirt_virDomainInterfaceStats
,
METH_VARARGS
,
NULL
},
{
NULL
,
NULL
,
0
,
NULL
}
{
NULL
,
NULL
,
0
,
NULL
}
};
};
...
...
python/libvirt-python-api.xml
浏览文件 @
795d9200
...
@@ -63,5 +63,17 @@
...
@@ -63,5 +63,17 @@
<return
type=
'int'
info=
'the autostart flag, or None in case of error'
/>
<return
type=
'int'
info=
'the autostart flag, or None in case of error'
/>
<arg
name=
'domain'
type=
'virDomainPtr'
info=
'a network object'
/>
<arg
name=
'domain'
type=
'virDomainPtr'
info=
'a network object'
/>
</function>
</function>
<function
name=
'virDomainBlockStats'
file=
'python'
>
<info>
Extracts block device statistics for a domain
</info>
<return
type=
'virDomainBlockStats'
info=
'a tuple of statistics'
/>
<arg
name=
'domain'
type=
'virDomainPtr'
info=
'a domain object'
/>
<arg
name=
'path'
type=
'char *'
info=
'the path for the block device'
/>
</function>
<function
name=
'virDomainInterfaceStats'
file=
'python'
>
<info>
Extracts interface device statistics for a domain
</info>
<return
type=
'virDomainInterfaceStats'
info=
'a tuple of statistics'
/>
<arg
name=
'domain'
type=
'virDomainPtr'
info=
'a domain object'
/>
<arg
name=
'path'
type=
'char *'
info=
'the path for the interface device'
/>
</function>
</symbols>
</symbols>
</api>
</api>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录