Guo Lian Yun wrote:
libvirt-cim-bounces(a)redhat.com wrote on 2008-10-10 18:08:20:
> # HG changeset patch
> # User Guolian Yun <yunguol(a)cn.ibm.com>
> # Date 1223633292 25200
> # Node ID 387761e3c93111fd1b73c0becda45ff1c261ce3a
> # Parent 285bc0174fb36512228e1cfcaba2186a0aa112c5
> [TEST] #3 Fix a false positive in HostedResourcePool/01_forward.py
>
> Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
>
> diff -r 285bc0174fb3 -r 387761e3c931 suites/libvirt-
> cim/cimtest/HostedResourcePool/01_forward.py
> --- a/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py
> Wed Oct 08 03:03:37 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py
> Fri Oct 10 03:08:12 2008 -0700
> @@ -39,7 +39,6 @@ sup_types = ['Xen', 'KVM', 'XenFV',
'LXC
> @do_main(sup_types)
> def main():
> options = main.options
> - status = FAIL
>
> keys = ['Name', 'CreationClassName']
> status, host_sys, host_cn = get_host_info(options.ip, options.virt)
> @@ -68,20 +67,30 @@ def main():
> logger.error("No pool returned")
> return FAIL
>
> - for items in pool:
> - cname = items.classname
> - if cname.find("MemoryPool") >=0 and
items['InstanceID'] ==
> "MemoryPool/0":
> - status = PASS
> - if cname.find("ProcessorPool") >=0 and
items['InstanceID']
> == "ProcessorPool/0":
> - status = PASS
> - if cname.find("NetworkPool") >=0 and \
> - items['InstanceID'] == "NetworkPool/%s"
%default_network_name:
> - status = PASS
> - if cname.find("DiskPool") >=0 and \
> - items['InstanceID'] == "DiskPool/%s" %
default_pool_name:
> - status = PASS
> + try:
> + for items in pool:
> + cname = items.classname
> + if cname.find("MemoryPool") >=0 and
items['InstanceID']
!= \
Is it necessary slash \ here, it will report syntax error if I
remove it.
Yes the \ is necessary here as we logical comparision cannot be
completed in the single line.
> + "MemoryPool/0":
> + raise Exception("%s does not match MemoryPool/0",
> + items['InstanceID'])
> + elif cname.find("ProcessorPool") >=0 and
items['InstanceID'] != \
> + "ProcessorPool/0":
> + raise Exception("%s does not match ProcessorPool/0",
> + items['InstanceID'])
> + elif cname.find("NetworkPool") >=0 and
items['InstanceID'] != \
> + "NetworkPool/%s" %default_network_name:
> + raise Exception("%s does not match NetworkPool/%s",
> + items['InstanceID'], default_network_name)
> + elif cname.find("DiskPool") >=0 and
items['InstanceID']
!= \
> + "DiskPool/%s" % default_pool_name:
> + raise Exception("%s does not match DiskPool/%s",
> + items['InstanceID'], default_pool_name)
> + except Exception, details:
> + logger.error(details)
> + return FAIL
>
>
> - return status
> + return PASS
> if __name__ == "__main__":
> sys.exit(main())
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim(a)redhat.com
>
https://www.redhat.com/mailman/listinfo/libvirt-cim
------------------------------------------------------------------------
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim