[libvirt] [test-API][PATCH v2] Add and update functions in domainAPI
by Wayne Sun
* add 9 new block related functions
block_pull(self, domname, device, bandwidth = 0, flag = 0)
block_resize(self, domname, device, size, flag = 0)
block_job_abort(self, domname, device, flag = 0)
block_job_set_speed(self, domname, device, bandwidth, flag = 0)
get_block_job_info(self, domname, device, flag = 0)
get_blkio_parameters(self, domname, flag)
get_block_io_tune(self, domname, device, flag)
set_blkio_parameters(self, domname, params, flag)
set_block_io_tune(self, domname, device, params, flag)
2 bugs related to parameters for 4 functions(get_blkio_parameters,
get_block_io_tune, set_blkio_parameters and set_block_io_tune),
it is considered in this patch, it could be updated later anyway.
* Add 2 memory parameters function
get_memory_parameters(self, domname, flag)
set_memory_parameters(self, domname, params, flag)
For set_memory_parameters(), the 'params' arguments should be a
dictionary contains selectable keys: hard_limit, soft_limit,
swap_hard_limit.
e.g.
{'hard_limit':10240, 'soft_limit':100000, 'swap_hard_limit':102400}
* Fix problems of 2 functions
memory_peek(self, domname)
set_sched_params_flags(self, domname, params, flags)
---
lib/domainAPI.py | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 101 insertions(+), 2 deletions(-)
diff --git a/lib/domainAPI.py b/lib/domainAPI.py
index a6efab7..91f2ba3 100644
--- a/lib/domainAPI.py
+++ b/lib/domainAPI.py
@@ -546,7 +546,7 @@ class DomainAPI(object):
def set_sched_params_flags(self, domname, params, flags):
try:
dom_obj = self.get_domain_by_name(domname)
- retval = dom_obj.setSchedulerParameters(params, flags)
+ retval = dom_obj.setSchedulerParametersFlags(params, flags)
return retval
except libvirt.libvirtError, e:
message = e.get_error_message()
@@ -581,6 +581,105 @@ class DomainAPI(object):
code = e.get_error_code()
raise exception.LibvirtAPI(message, code)
+ def block_pull(self, domname, device, bandwidth = 0, flag = 0):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.blockPull(device, bandwidth, flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def block_resize(self, domname, device, size, flag = 0):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.blockResize(device, size, flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def block_job_abort(self, domname, device, flag = 0):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.blockJobAbort(device, flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def block_job_set_speed(self, domname, device, bandwidth, flag = 0):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.blockJobSetSpeed(device, bandwidth, flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def get_block_job_info(self, domname, device, flag = 0):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.blockJobInfo(device, flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def get_blkio_parameters(self, domname, flag):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.blkioParameters(flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def get_block_io_tune(self, domname, device, flag):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.blockIoTune(device, params, flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def set_blkio_parameters(self, domname, params, flag):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.setBlkioParameters(params, flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def set_block_io_tune(self, domname, device, params, flag):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.setBlockIoTune(device, params, flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def get_memory_parameters(self, domname, flag):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.memoryParameters(flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def set_memory_parameters(self, domname, params, flag):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.setMemoryParameters(params, flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
def memory_stats(self, domname):
try:
dom_obj = self.get_domain_by_name(domname)
@@ -593,7 +692,7 @@ class DomainAPI(object):
def memory_peek(self, domname, start, size, buffer, flag = 0):
try:
dom_obj = self.get_domain_by_name(domname)
- return dom_obj.blockPeek(start, size, buffer, flag)
+ return dom_obj.memoryPeek(start, size, buffer, flag)
except libvirt.libvirtError, e:
message = e.get_error_message()
code = e.get_error_code()
--
1.7.1
13 years, 3 months
[libvirt] [test-API][PATCH] Add and update functions in domainAPI
by Wayne Sun
* add 9 new block related functions
block_pull(self, domname, path, bandwidth = 0, flag = 0)
block_resize(self, domname, path, size, flag = 0)
block_job_abort(self, domname, path, flag = 0)
block_job_set_speed(self, domname, path, bandwidth, flag = 0)
get_block_job_info(self, domname, path, flag = 0)
get_blkio_parameters(self, domname, flag)
get_block_io_tune(self, domname, path, flag)
set_blkio_parameters(self, domname, params, flag)
set_block_io_tune(self, domname, path, params, flag)
2 bugs related to parameters for 4 functions(get_blkio_parameters,
get_block_io_tune, set_blkio_parameters and set_block_io_tune),
it is considered in this patch, it could be updated later anyway.
* Add 2 memory parameters function
get_memory_parameters(self, domname, flag)
set_memory_parameters(self, domname, params, flag)
For set_memory_parameters(), the 'params' arguments should be a
dictionary contains selectable keys: hard_limit, soft_limit,
swap_hard_limit.
e.g.
{'hard_limit':10240, 'soft_limit':100000, 'swap_hard_limit':102400}
* update 2 functions with problem
memory_stats(self, domname)
set_sched_params_flags(self, domname, params, flags)
---
lib/domainAPI.py | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 101 insertions(+), 2 deletions(-)
diff --git a/lib/domainAPI.py b/lib/domainAPI.py
index a6efab7..1f6ef49 100644
--- a/lib/domainAPI.py
+++ b/lib/domainAPI.py
@@ -546,7 +546,7 @@ class DomainAPI(object):
def set_sched_params_flags(self, domname, params, flags):
try:
dom_obj = self.get_domain_by_name(domname)
- retval = dom_obj.setSchedulerParameters(params, flags)
+ retval = dom_obj.setSchedulerParametersFlags(params, flags)
return retval
except libvirt.libvirtError, e:
message = e.get_error_message()
@@ -581,6 +581,105 @@ class DomainAPI(object):
code = e.get_error_code()
raise exception.LibvirtAPI(message, code)
+ def block_pull(self, domname, path, bandwidth = 0, flag = 0):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.blockPull(path, bandwidth, flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def block_resize(self, domname, path, size, flag = 0):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.blockResize(path, size, flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def block_job_abort(self, domname, path, flag = 0):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.blockJobAbort(path, flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def block_job_set_speed(self, domname, path, bandwidth, flag = 0):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.blockJobSetSpeed(path, bandwidth, flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def get_block_job_info(self, domname, path, flag = 0):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.blockJobInfo(path, flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def get_blkio_parameters(self, domname, flag):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.blkioParameters(flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def get_block_io_tune(self, domname, path, flag):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.blockIoTune(path, params, flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def set_blkio_parameters(self, domname, params, flag):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.setBlkioParameters(params, flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def set_block_io_tune(self, domname, path, params, flag):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.setBlockIoTune(path, params, flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def get_memory_parameters(self, domname, flag):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.memoryParameters(flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
+ def set_memory_parameters(self, domname, params, flag):
+ try:
+ dom_obj = self.get_domain_by_name(domname)
+ return dom_obj.setMemoryParameters(params, flag)
+ except libvirt.libvirtError, e:
+ message = e.get_error_message()
+ code = e.get_error_code()
+ raise exception.LibvirtAPI(message, code)
+
def memory_stats(self, domname):
try:
dom_obj = self.get_domain_by_name(domname)
@@ -593,7 +692,7 @@ class DomainAPI(object):
def memory_peek(self, domname, start, size, buffer, flag = 0):
try:
dom_obj = self.get_domain_by_name(domname)
- return dom_obj.blockPeek(start, size, buffer, flag)
+ return dom_obj.memoryPeek(start, size, buffer, flag)
except libvirt.libvirtError, e:
message = e.get_error_message()
code = e.get_error_code()
--
1.7.1
13 years, 3 months
[libvirt] How to connect to a remote VM ESXi server with Python language?
by ice
Hi, Dear Mr/Mrs.
I have trouble in connecting to a VM ESXi server with python.
I am a developer using libvirt to control remote VM ESXi with python
language. But I am not able to connect to a remote VM ESXi server.
I make my try to solve this issue:
1: I use the function libvirt.Open() to open the remote VM ESXi Server, but
I don't know how to input the password. It seems that there is no parameter
for password input.
2: I use "virsh connect ---". It is succeed when it is executed on locale
machine manual, but failed when I invoke this command in python environment.
I use "subprocess.Popen" to execute the command "virsh", but this function
would be hung on after command "communicate" executed.
-bash-4.1# python
Python 2.6.6 (r266:84292, May 20 2011, 16:42:11)
[GCC 4.4.5 20110214 (Red Hat 4.4.5-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from subprocess import Popen,PIPE,STDOUT
>>> command=['virsh', '-c', 'esx://192.168.58.144/?no_verify=1','list',
'--all']
>>> p=Popen(command, stdin=PIPE,stdout=PIPE, stderr=STDOUT)
>>> output = p.communicate()[0]
How to fix it?
Thanks for help!
Best regards!
13 years, 3 months
[libvirt] [PATCH] Fix build on s390(x) and other stange arches
by Daniel Veillard
The blocks to extract node information on a per-arch
basis wasn't well balanced leading to a compilation
failure if not on one of the handled arches (PCs and PPCs)
Pushed under the build breaker rule, but is not part of 0.9.9-rc1
as I discovered it after the release.
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 7537918..e0b66f7 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -249,6 +249,7 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
/* Accept trailing fractional part. */
&& (*p == '\0' || *p == '.' || c_isspace(*p)))
nodeinfo->mhz = ui;
+ }
# elif defined(__powerpc__) || \
defined(__powerpc64__)
if (STRPREFIX(buf, "clock")) {
@@ -271,10 +272,10 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
* identification and machine, but we don't want it to be caught
* and parsed in next iteration, because it is not in expected
* format and thus lead to error. */
+ }
# else
# warning Parser for /proc/cpuinfo needs to be adapted for your architecture
# endif
- }
}
/* OK, we've parsed clock speed out of /proc/cpuinfo. Get the core, socket
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
13 years, 3 months
[libvirt] [PATCH] python: Fix problems of virDomain{Set, Get}BlkioParameters bindings
by ajia@redhat.com
From: Alex Jia <ajia(a)redhat.com>
The parameter 'device_weight' is a string, however, the 'VIR_TYPED_PARAM_STRING'
type condition is missed by libvirt_virDomain{Set, Get}BlkioParameters bindings,
the result is we can't get or change 'device_weight' value.
* python/libvirt-override.c: Add missing 'VIR_TYPED_PARAM_STRING' condition into
libvirt_virDomain{Set, Get}BlkioParameters bindings.
https://bugzilla.redhat.com/show_bug.cgi?id=770795
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
python/libvirt-override.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index d2aad0f..c8ea3dc 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -726,6 +726,10 @@ libvirt_virDomainSetBlkioParameters(PyObject *self ATTRIBUTE_UNUSED,
}
break;
+ case VIR_TYPED_PARAM_STRING:
+ params[i].value.s = PyString_AsString(val);
+ break;
+
default:
free(params);
return VIR_PY_INT_FAIL;
@@ -811,6 +815,10 @@ libvirt_virDomainGetBlkioParameters(PyObject *self ATTRIBUTE_UNUSED,
val = PyBool_FromLong((long)params[i].value.b);
break;
+ case VIR_TYPED_PARAM_STRING:
+ val = PyString_FromString((char *)params[i].value.s);
+ break;
+
default:
free(params);
Py_DECREF(info);
--
1.7.1
13 years, 3 months
[libvirt] [PATCH] remove a static limit on max domains in python bindings
by Daniel Veillard
* python/libvirt-override.c: remove the predefined array in the
virConnectListDomainsID binding and call virConnectNumOfDomains
to do a proper allocation
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 8a643a3..2dea16b 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -1616,7 +1616,7 @@ static PyObject *
libvirt_virConnectListDomainsID(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args) {
PyObject *py_retval;
- int ids[500], c_retval, i;
+ int *ids = NULL, c_retval, i;
virConnectPtr conn;
PyObject *pyobj_conn;
@@ -1626,14 +1626,34 @@ libvirt_virConnectListDomainsID(PyObject *self ATTRIBUTE_UNUSED,
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
- c_retval = virConnectListDomains(conn, &ids[0], 500);
+ c_retval = virConnectNumOfDomains(conn);
LIBVIRT_END_ALLOW_THREADS;
if (c_retval < 0)
return VIR_PY_NONE;
+
+ if (c_retval) {
+ ids = malloc(sizeof(*ids) * c_retval);
+ if (!ids)
+ return VIR_PY_NONE;
+
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ c_retval = virConnectListDomains(conn, ids, c_retval);
+ LIBVIRT_END_ALLOW_THREADS;
+ if (c_retval < 0) {
+ free(ids);
+ return VIR_PY_NONE;
+ }
+ }
py_retval = PyList_New(c_retval);
- for (i = 0;i < c_retval;i++) {
- PyList_SetItem(py_retval, i, libvirt_intWrap(ids[i]));
+
+ if (ids) {
+ for (i = 0;i < c_retval;i++) {
+ PyList_SetItem(py_retval, i, libvirt_intWrap(ids[i]));
+ }
+ free(ids);
}
+
return(py_retval);
}
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
13 years, 3 months
[libvirt] [PATCHv3] python: Fixup python binding for virDomain{Set, Get}BlockIoTune APIs
by ajia@redhat.com
From: Alex Jia <ajia(a)redhat.com>
The parameter 'params' is useless for virDomainGetBlockIoTune API, and the
return value type should be a virTypedParameterPtr not integer. In addition,
the parameter number is also incorrect in libvirt_virDomain{Set, Get}BlockIoTune APIs.
* libvirt-override-api.xml: Remove useless the parameter 'params' from
virDomainGetBlockIoTune API, and change return value type from integer
to virTypedParameterPtr.
* python/libvirt-override.c: Fix the parameter number match issue.
https://bugzilla.redhat.com/show_bug.cgi?id=770683
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
python/libvirt-override-api.xml | 3 +--
python/libvirt-override.c | 4 ++--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/python/libvirt-override-api.xml b/python/libvirt-override-api.xml
index 07e4a78..a2fd219 100644
--- a/python/libvirt-override-api.xml
+++ b/python/libvirt-override-api.xml
@@ -401,9 +401,8 @@
<info>Get the I/O tunables for a block device</info>
<arg name='dom' type='virDomainPtr' info='pointer to the domain'/>
<arg name='disk' type='const char *' info='disk name'/>
- <arg name='params' type='virTypedParameterPtr' info='Pointer to blkio tuning params object'/>
<arg name='flags' type='unsigned int' info='an OR'ed set of virDomainModificationImpact'/>
- <return type='int' info='0 in case of success, -1 in case of failure'/>
+ <return type='virTypedParameterPtr' info='the I/O tunables value or None in case of error'/>
</function>
<function name='virDomainBlockPeek' file='python'>
<info>Read the contents of domain's disk device</info>
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 8a643a3..a704e78 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -3301,7 +3301,7 @@ libvirt_virDomainSetBlockIoTune(PyObject *self ATTRIBUTE_UNUSED,
int nparams = 0, i;
int c_ret;
- if (!PyArg_ParseTuple(args, (char *)"Ozi:virDomainSetBlockIoTune",
+ if (!PyArg_ParseTuple(args, (char *)"OzOi:virDomainSetBlockIoTune",
&pyobj_domain, &disk, &pyinfo, &flags))
return(NULL);
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
@@ -3395,7 +3395,7 @@ libvirt_virDomainGetBlockIoTune(PyObject *self ATTRIBUTE_UNUSED,
virTypedParameterPtr params;
int c_ret;
- if (!PyArg_ParseTuple(args, (char *)"Oi:virDomainGetBlockIoTune",
+ if (!PyArg_ParseTuple(args, (char *)"Ozi:virDomainGetBlockIoTune",
&pyobj_domain, &disk, &flags))
return(NULL);
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
--
1.7.1
13 years, 3 months
[libvirt] [PATCHv2] python: Fixup python binding for virDomain{Set, Get}BlockIoTune APIs
by ajia@redhat.com
From: Alex Jia <ajia(a)redhat.com>
python: Fixup python binding for virDomain{Set, Get}BlockIoTune APIs
The parameter 'params' is useless for virDomainGetBlockIoTune API, and the
return value type should be a virTypedParameterPtr not integer. In addition,
the parameter number is also incorrect in libvirt_virDomain{Set, Get}BlockIoTune APIs.
* libvirt-override-api.xml: Remove useless the parameter 'params' from
virDomainGetBlockIoTune API, and change return value type from integer
to virTypedParameterPtr.
* python/libvirt-override.c: Fix the parameter number match issue.
https://bugzilla.redhat.com/show_bug.cgi?id=770683
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
python/libvirt-override-api.xml | 3 +--
python/libvirt-override.c | 4 ++--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/python/libvirt-override-api.xml b/python/libvirt-override-api.xml
index 07e4a78..a2fd219 100644
--- a/python/libvirt-override-api.xml
+++ b/python/libvirt-override-api.xml
@@ -401,9 +401,8 @@
<info>Get the I/O tunables for a block device</info>
<arg name='dom' type='virDomainPtr' info='pointer to the domain'/>
<arg name='disk' type='const char *' info='disk name'/>
- <arg name='params' type='virTypedParameterPtr' info='Pointer to blkio tuning params object'/>
<arg name='flags' type='unsigned int' info='an OR'ed set of virDomainModificationImpact'/>
- <return type='int' info='0 in case of success, -1 in case of failure'/>
+ <return type='virTypedParameterPtr *' info='the I/O tunables value or None in case of error'/>
</function>
<function name='virDomainBlockPeek' file='python'>
<info>Read the contents of domain's disk device</info>
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 8a643a3..a704e78 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -3301,7 +3301,7 @@ libvirt_virDomainSetBlockIoTune(PyObject *self ATTRIBUTE_UNUSED,
int nparams = 0, i;
int c_ret;
- if (!PyArg_ParseTuple(args, (char *)"Ozi:virDomainSetBlockIoTune",
+ if (!PyArg_ParseTuple(args, (char *)"OzOi:virDomainSetBlockIoTune",
&pyobj_domain, &disk, &pyinfo, &flags))
return(NULL);
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
@@ -3395,7 +3395,7 @@ libvirt_virDomainGetBlockIoTune(PyObject *self ATTRIBUTE_UNUSED,
virTypedParameterPtr params;
int c_ret;
- if (!PyArg_ParseTuple(args, (char *)"Oi:virDomainGetBlockIoTune",
+ if (!PyArg_ParseTuple(args, (char *)"Ozi:virDomainGetBlockIoTune",
&pyobj_domain, &disk, &flags))
return(NULL);
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
--
1.7.1
13 years, 3 months
[libvirt] [PATCH] python: Fixup python binding for virDomain{Set, Get}BlockIoTune APIs
by ajia@redhat.com
From: Alex Jia <ajia(a)redhat.com>
python: Fixup python binding for virDomain{Set, Get}BlockIoTune APIs
The parameter 'params' is useless for virDomainGetBlockIoTune API, and the
return value should be a string not integer. In addition, the parameter
number is also incorrect in libvirt_virDomain{Set, Get}BlockIoTune APIs.
* libvirt-override-api.xml: Remove useless the parameter 'params' from virDomainGetBlockIoTune
API, and change return value type from integer to string.
* python/libvirt-override.c: Fix the parameter number match issue.
https://bugzilla.redhat.com/show_bug.cgi?id=770683
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
python/libvirt-override-api.xml | 3 +--
python/libvirt-override.c | 4 ++--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/python/libvirt-override-api.xml b/python/libvirt-override-api.xml
index 07e4a78..a2fd219 100644
--- a/python/libvirt-override-api.xml
+++ b/python/libvirt-override-api.xml
@@ -401,9 +401,8 @@
<info>Get the I/O tunables for a block device</info>
<arg name='dom' type='virDomainPtr' info='pointer to the domain'/>
<arg name='disk' type='const char *' info='disk name'/>
- <arg name='params' type='virTypedParameterPtr' info='Pointer to blkio tuning params object'/>
<arg name='flags' type='unsigned int' info='an OR'ed set of virDomainModificationImpact'/>
- <return type='int' info='0 in case of success, -1 in case of failure'/>
+ <return type='char *' info='the I/O tunables value or None in case of error'/>
</function>
<function name='virDomainBlockPeek' file='python'>
<info>Read the contents of domain's disk device</info>
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 8a643a3..a704e78 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -3301,7 +3301,7 @@ libvirt_virDomainSetBlockIoTune(PyObject *self ATTRIBUTE_UNUSED,
int nparams = 0, i;
int c_ret;
- if (!PyArg_ParseTuple(args, (char *)"Ozi:virDomainSetBlockIoTune",
+ if (!PyArg_ParseTuple(args, (char *)"OzOi:virDomainSetBlockIoTune",
&pyobj_domain, &disk, &pyinfo, &flags))
return(NULL);
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
@@ -3395,7 +3395,7 @@ libvirt_virDomainGetBlockIoTune(PyObject *self ATTRIBUTE_UNUSED,
virTypedParameterPtr params;
int c_ret;
- if (!PyArg_ParseTuple(args, (char *)"Oi:virDomainGetBlockIoTune",
+ if (!PyArg_ParseTuple(args, (char *)"Ozi:virDomainGetBlockIoTune",
&pyobj_domain, &disk, &flags))
return(NULL);
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
--
1.7.1
13 years, 3 months