[libvirt] [PATCH] libvirt_python:fix bug of sanitytest.py script

ossdev@puresoftware.com posted 1 patch 24 weeks ago
Failed in applying to current master (apply log)
sanitytest.py | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)

[libvirt] [PATCH] libvirt_python:fix bug of sanitytest.py script

Posted by ossdev@puresoftware.com 24 weeks ago
From: ossdev <ossdev@puresoftware.com>

libvirt-python:fix bug of sanitytest.py script

Signed-off-by: ossdev <ossdev@puresoftware.com>
---
 sanitytest.py | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/sanitytest.py b/sanitytest.py
index e87b57d..c5d1f42 100644
--- a/sanitytest.py
+++ b/sanitytest.py
@@ -22,6 +22,21 @@ def get_libvirt_api_xml_path():
         sys.exit(proc.returncode)
     return stdout.splitlines()[0]
 
+def sanitize_enum_val(value):
+    if value == 'VIR_TYPED_PARAM_INT':
+        value = 1
+    elif value == 'VIR_TYPED_PARAM_UINT':
+        value = 2
+    elif value == 'VIR_TYPED_PARAM_LLONG':
+        value = 3
+    elif value == 'VIR_TYPED_PARAM_ULLONG':
+        value = 4
+    elif value == 'VIR_TYPED_PARAM_DOUBLE':
+        value = 5
+    elif value == 'VIR_TYPED_PARAM_BOOLEAN':
+        value = 6
+    return value
+
 # Path to the libvirt API XML file
 if len(sys.argv) >= 3:
     xml = sys.argv[2]
@@ -48,8 +63,8 @@ set = tree.xpath('/api/symbols/enum')
 for n in set:
     typ = n.attrib['type']
     name = n.attrib['name']
-    val = n.attrib['value']
-
+    #val = n.attrib['value']
+    val = sanitize_enum_val(n.attrib['value'])
     if typ not in enumvals:
         enumvals[typ] = {}
 
-- 
2.17.1


-- 


*Disclaimer* -The information transmitted is intended solely for the 
individual
or entity to which it is addressed and may contain confidential 
and/or
privileged material. Any review, re-transmission, dissemination or 
other use of
or taking action in reliance upon this information by persons 
or entities other
than the intended recipient is prohibited. If you have 
received this email in
error please contact the sender and delete the 
material from any computer. In
such instances you are further prohibited 
from reproducing, disclosing,
distributing or taking any action in reliance 
on it.As a recipient of this email,
you are responsible for screening its 
contents and the contents of any
attachments for the presence of viruses. 
No liability is accepted for any
damages caused by any virus transmitted by 
this email.

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] libvirt_python:fix bug of sanitytest.py script

Posted by Cole Robinson 19 weeks ago
On 9/10/19 2:19 AM, ossdev@puresoftware.com wrote:
> From: ossdev <ossdev@puresoftware.com>
> 
> libvirt-python:fix bug of sanitytest.py script
> 

Hmm, what exactly is the bug you are hitting? Are you seeing an error? I 
don't exactly follow what the patch is achieving

> Signed-off-by: ossdev <ossdev@puresoftware.com>

This needs to list your real name, more info at #6 in this section:
https://libvirt.org/hacking.html#patches

- Cole

> ---
>   sanitytest.py | 19 +++++++++++++++++--
>   1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/sanitytest.py b/sanitytest.py
> index e87b57d..c5d1f42 100644
> --- a/sanitytest.py
> +++ b/sanitytest.py
> @@ -22,6 +22,21 @@ def get_libvirt_api_xml_path():
>           sys.exit(proc.returncode)
>       return stdout.splitlines()[0]
>   
> +def sanitize_enum_val(value):
> +    if value == 'VIR_TYPED_PARAM_INT':
> +        value = 1
> +    elif value == 'VIR_TYPED_PARAM_UINT':
> +        value = 2
> +    elif value == 'VIR_TYPED_PARAM_LLONG':
> +        value = 3
> +    elif value == 'VIR_TYPED_PARAM_ULLONG':
> +        value = 4
> +    elif value == 'VIR_TYPED_PARAM_DOUBLE':
> +        value = 5
> +    elif value == 'VIR_TYPED_PARAM_BOOLEAN':
> +        value = 6
> +    return value
> +
>   # Path to the libvirt API XML file
>   if len(sys.argv) >= 3:
>       xml = sys.argv[2]
> @@ -48,8 +63,8 @@ set = tree.xpath('/api/symbols/enum')
>   for n in set:
>       typ = n.attrib['type']
>       name = n.attrib['name']
> -    val = n.attrib['value']
> -
> +    #val = n.attrib['value']
> +    val = sanitize_enum_val(n.attrib['value'])
>       if typ not in enumvals:
>           enumvals[typ] = {}
>   
>

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list