diff mbox series

libvirt_python:fix bug of sanitytest.py script

Message ID 5d77408b.1c69fb81.b2c75.53b0@mx.google.com
State New
Headers show
Series libvirt_python:fix bug of sanitytest.py script | expand

Commit Message

oss dev Sept. 10, 2019, 6:19 a.m. UTC
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(-)

-- 
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

Comments

Cole Robinson Oct. 9, 2019, 7:19 p.m. UTC | #1
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
diff mbox series

Patch

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] = {}