[Libvirt-cim] [PATCH] [TEST] Fixing the 04_defineStartVS.py tc failure
Kaitlin Rupert
kaitlin at linux.vnet.ibm.com
Fri Apr 11 02:27:54 UTC 2008
> + # Need to poll for XenFV, since enabState is not getting set otherwise.
> + for i in range(1, (timeout + 1)):
> + sleep(1)
> + cs = computersystem.get_cs_class(options.virt)(options.ip, test_dom)
> + if cs.Name == test_dom:
> + enabState = cs.EnabledState
> + else:
> + Globals.logger.error("VS %s is not defined" % test_dom)
You will print this message every time through the loop. Instead,
you'll want to break here and then return a failure.
> + # Success: VS is in Enabled State after Define and Start
> + if enabState == 2:
> + status = PASS
> + break
>
> except Exception, detail:
> Globals.logger.error(Globals.CIM_ERROR_GETINSTANCE,
>
I'd structure the loop differently:
if cs.Name != test_dom:
# log error, set status message as failure and break
enabState = cs.EnabledState
if enabState == 2:
# set status and break
It's not really much different, but it places the enabState closer
together, which makes it a bit easier to read.
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com
More information about the Libvirt-cim
mailing list