Skip to contentSkip to conversation

make VTPM.destroy return void upon success

PATCH Applied Stefan Berger 2 participants 2 messages Feb 23, 2007 – Mar 9, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 make VTPM.destroy return void upon success

Make the VTPM.destroy method return 'void' upon success and adapt the test case to reflect that.

tools/python/xen/xend/XendAPI.py +1 -1
diff -r f62a052384a5 tools/python/xen/xend/XendAPI.py
@@ -1900,7 +1900,7 @@ class XendAPI(object):
                  XendDomain.POWER_STATE_NAMES[dom.state]])
             from xen.xend.server import tpmif
             tpmif.destroy_vtpmstate(dom.getName())
-            return xen_api_success(True)
+            return xen_api_success_void()
         else:
             return xen_api_error(['HANDLE_INVALID', 'VM', vtpm_struct['VM']])
 
tools/xm-test/tests/vtpm/09_vtpm-xapi.py +5 -4
diff -r f62a052384a5 tools/xm-test/tests/vtpm/09_vtpm-xapi.py
@@ -113,7 +113,7 @@ if not re.search("PCR-00:",run["output"]
     FAIL("1. Virtual TPM is not working correctly on /dev/vtpm on backend side: \n%s" % run["output"])
 
 try:
-    rc = session.xenapi.VTPM.destroy(vtpm_uuid)
+    session.xenapi.VTPM.destroy(vtpm_uuid)
     #Should never get here
     FAIL("Could destroy vTPM while VM is running")
 except:
@@ -124,7 +124,7 @@ if rc:
     FAIL("Could not suspend VM")
 
 try:
-    rc = session.xenapi.VTPM.destroy(vtpm_uuid)
+    session.xenapi.VTPM.destroy(vtpm_uuid)
     #May not throw an exception in 'suspend' state
 except:
     pass
@@ -150,8 +150,9 @@ if not re.search("PCR-00:",run["output"]
 
 domain.stop()
 
-rc = session.xenapi.VTPM.destroy(vtpm_uuid)
-if not rc:
+try:
+    session.xenapi.VTPM.destroy(vtpm_uuid)
+except:
     FAIL("Could NOT destroy vTPM while domain is halted.")
 
 domain.destroy()

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel