
Nice work here Deepti - I just pushed this feature in recently =) Just a minor change..
+ try: + cxml = vxml.get_class(virt)(default_dom, vnc_passwd=passwd) + ret = cxml.cim_define(server) + if not ret: + raise Exception("Failed to define the dom: %s" % default_dom) + + ret = cxml.cim_start(server) + if ret != PASS: + cxml.undefine(server) + raise Exception("Failed to start the dom: %s" % default_dom) + + status = verify_grasd_passwd_value(virt, server) + if status != PASS: + logger.error("Failed to verify the Password field for domain '%s'", + default_dom) + + cxml.cim_destroy(server) + cxml.undefine(server)
I'd place this after the exception. If for some reason, a random exception is hit in the try block before cim_distroy() is called, the guest will still be cleaned up.
+ + except Exception, details: + logger.error(details) + status = FAIL + + return status + +if __name__ == "__main__": + sys.exit(main()) +
-- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com