From: ossdev <ossdev@xxxxxxxxxxxxxxxx> libvirt-python:fix bug of sanitytest.py script Signed-off-by: ossdev <ossdev@xxxxxxxxxxxxxxxx> --- 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@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list