On 02/20/2015 12:42 PM, Pavel Hrdina wrote:
On Thu, Feb 19, 2015 at 07:59:38AM -0500, John Ferlan wrote:
> Add support for the libvirt_virDomainGetIOThreadsInfo method. This
> code mostly follows the libvirt_virDomainGetVcpuPinInfo method, but
> also takes some from the libvirt_virNodeGetCPUMap method with respect
> to building the cpumap into the returned tuple rather than two separate
> tuples which vcpu pinning generates
>
> Assuming two domains, one with IOThreads defined (eg, 'iothr-gst') and
> one without ('noiothr-gst'), execute the following in an 'iothr.py'
file:
>
> import libvirt
> con=libvirt.open("qemu:///system")
> dom=con.lookupByName('iothr-gst')
> print dom.getIOThreadsInfo()
> dom2=con.lookupByName('noiothr-gst')
> print dom2.getIOThreadsInfo()
>
> $ python iothr.py
> [(1, [False, False, True, False], ['/home/vm-images/iothr-vol1']), (2,
[False, False, False, True], ['/home/vm-images/iothr-vol2']), (3, [True, False,
False, False], [])]
> Traceback (most recent call last):
> File "iothr.py", line 6, in <module>
> print dom2.getIOThreadsInfo()
> File "/usr/lib64/python2.7/site-packages/libvirt.py", line 1197, in
getIOThreadsInfo
> if ret is None: raise libvirtError ('virDomainGetIOThreadsInfo() failed',
dom=self)
> libvirt.libvirtError: virDomainGetIOThreadsInfo() failed
>
> $
>
> Signed-off-by: John Ferlan <jferlan(a)redhat.com>
> ---
> generator.py | 5 +++
> libvirt-override-api.xml | 6 +++
> libvirt-override.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++++
> sanitytest.py | 3 ++
> 4 files changed, 110 insertions(+)
>
> diff --git a/generator.py b/generator.py
> index 0d48980..327c896 100755
> --- a/generator.py
> +++ b/generator.py
> @@ -435,6 +435,7 @@ skip_impl = (
> 'virDomainGetVcpuPinInfo',
> 'virDomainGetEmulatorPinInfo',
> 'virDomainPinEmulator',
> + 'virDomainGetIOThreadsInfo',
> 'virSecretGetValue',
> 'virSecretSetValue',
> 'virSecretGetUUID',
> @@ -592,6 +593,7 @@ skip_function = (
> 'virNetworkDHCPLeaseFree', # only useful in C, python code uses list
> 'virDomainStatsRecordListFree', # only useful in C, python uses dict
> 'virDomainFSInfoFree', # only useful in C, python code uses list
> + 'virDomainIOThreadsInfoFree', # only useful in C, python code uses list
> )
>
> lxc_skip_function = (
> @@ -1144,6 +1146,9 @@ def nameFixup(name, classe, type, file):
> elif name[0:20] == "virDomainGetCPUStats":
> func = name[9:]
> func = func[0:1].lower() + func[1:]
> + elif name[0:25] == "virDomainGetIOThreadsInfo":
> + func = name[9:]
> + func = func[0:1].lower() + func[1:]
> elif name[0:18] == "virDomainGetFSInfo":
> func = name[12:]
> func = func[0:2].lower() + func[2:]
> diff --git a/sanitytest.py b/sanitytest.py
> index f021e5a..53209b8 100644
> --- a/sanitytest.py
> +++ b/sanitytest.py
> @@ -142,6 +142,9 @@ for cname in wantfunctions:
> if name[0:19] == "virDomainFSInfoFree":
> continue
>
> + if name[0:26] == "virDomainIOThreadsInfoFree":
> + continue
> +
> if name[0:21] == "virDomainListGetStats":
> name = "virConnectDomainListGetStats"
>
> --
> 2.1.0
One more think, I would also squashed this patch in to make the test happy and
also in Python binding we usually remove the "Get" from APIs.
We we do have some, but I'm OK with changing things...
diff --git a/generator.py b/generator.py
index c79acf1..aa140ed 100755
--- a/generator.py
+++ b/generator.py
@@ -1148,8 +1148,8 @@ def nameFixup(name, classe, type, file):
func = name[9:]
func = func[0:1].lower() + func[1:]
elif name[0:25] == "virDomainGetIOThreadsInfo":
- func = name[9:]
- func = func[0:1].lower() + func[1:]
+ func = name[12:]
+ func = func[0:2].lower() + func[2:]
elif name[0:18] == "virDomainGetFSInfo":
func = name[12:]
func = func[0:2].lower() + func[2:]
diff --git a/sanitytest.py b/sanitytest.py
index 53209b8..0e6e0e5 100644
--- a/sanitytest.py
+++ b/sanitytest.py
@@ -279,6 +279,8 @@ for name in sorted(basicklassmap):
func = "nwfilter" + func[8:]
if func[0:8] == "fSFreeze" or func[0:6] == "fSThaw" or func[0:6]
== "fSInfo":
func = "fs" + func[2:]
+ if func[0:13] == "iOThreadsInfo":
+ func = "ioThreadsInfo"
if klass == "virNetwork":
func = func.replace("dHCP", "DHCP")
OK - so we'll have 'dom.ioThreadsInfo" here and in patch 2 it'll be
"dom.setIOThreads unless you think that should change too.
I'll repost the series - it cannot go in until the libvirt series gets
in, but at least it'll be ready.
Other changes...
... I'll return an empty list if there are zero IOThreads rather than error
... Obviously it wasn't very clear to me how the PyList* interactions
work exactly w/r/t Py_XDECREF - I was trying to copy other uses, but
didn't do a great job at that. I was just happy that I got results that
worked
Thanks for the review
John