aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xm-test
diff options
context:
space:
mode:
Diffstat (limited to 'tools/xm-test')
-rw-r--r--tools/xm-test/tests/vtpm/01_vtpm-list_pos.py8
-rw-r--r--tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py9
-rw-r--r--tools/xm-test/tests/vtpm/03_vtpm-susp_res.py16
-rw-r--r--tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py15
-rw-r--r--tools/xm-test/tests/vtpm/05_vtpm-loc_migr.py15
-rw-r--r--tools/xm-test/tests/vtpm/06_vtpm-susp_res_pcrs.py20
-rw-r--r--tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py19
-rw-r--r--tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py19
-rw-r--r--tools/xm-test/tests/vtpm/vtpm_utils.py14
9 files changed, 38 insertions, 97 deletions
diff --git a/tools/xm-test/tests/vtpm/01_vtpm-list_pos.py b/tools/xm-test/tests/vtpm/01_vtpm-list_pos.py
index a427bf2fde..dfd1227a00 100644
--- a/tools/xm-test/tests/vtpm/01_vtpm-list_pos.py
+++ b/tools/xm-test/tests/vtpm/01_vtpm-list_pos.py
@@ -11,6 +11,7 @@ from XmTestLib import *
from vtpm_utils import *
import commands
import os
+import atexit
config = {"vtpm":"instance=1,backend=0"}
domain = XmTestDomain(extraConfig=config)
@@ -23,18 +24,17 @@ except DomainError, e:
vtpm_cleanup(domain.getName())
FAIL("Unable to create domain")
+
domName = domain.getName()
+atexit.register(vtpm_cleanup, vtpm_get_uuid(domid(domName)))
+
status, output = traceCommand("xm vtpm-list %s" % domain.getId())
eyecatcher = "/local/domain/0/backend/vtpm"
where = output.find(eyecatcher)
if status != 0:
- vtpm_cleanup(domName)
FAIL("xm vtpm-list returned bad status, expected 0, status is %i" % status)
elif where < 0:
- vtpm_cleanup(domName)
FAIL("Fail to list virtual TPM device")
domain.stop()
-
-vtpm_cleanup(domName)
diff --git a/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py b/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py
index 62ecfb86bd..a18cbab2f7 100644
--- a/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py
+++ b/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py
@@ -11,6 +11,7 @@ from vtpm_utils import *
import commands
import os
import os.path
+import atexit
config = {"vtpm":"instance=1,backend=0"}
domain = XmTestDomain(extraConfig=config)
@@ -21,32 +22,28 @@ try:
except DomainError, e:
if verbose:
print e.extra
- vtpm_cleanup(domName)
FAIL("Unable to create domain (%s)" % domName)
+atexit.register(vtpm_cleanup, vtpm_get_uuid(domid(domName)))
+
try:
console.sendInput("input")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL(str(e))
try:
run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("No result from dumping the PCRs")
if re.search("No such file",run["output"]):
- vtpm_cleanup(domName)
FAIL("TPM frontend support not compiled into (domU?) kernel")
domain.closeConsole()
domain.stop()
-vtpm_cleanup(domName)
-
if not re.search("PCR-00:",run["output"]):
FAIL("Virtual TPM is not working correctly on /dev/vtpm on backend side")
diff --git a/tools/xm-test/tests/vtpm/03_vtpm-susp_res.py b/tools/xm-test/tests/vtpm/03_vtpm-susp_res.py
index 4740cdef18..b863f27494 100644
--- a/tools/xm-test/tests/vtpm/03_vtpm-susp_res.py
+++ b/tools/xm-test/tests/vtpm/03_vtpm-susp_res.py
@@ -12,6 +12,7 @@ from vtpm_utils import *
import commands
import os
import os.path
+import atexit
config = {"vtpm":"instance=1,backend=0"}
domain = XmTestDomain(extraConfig=config)
@@ -23,25 +24,23 @@ try:
except DomainError, e:
if verbose:
print e.extra
- vtpm_cleanup(domName)
FAIL("Unable to create domain (%s)" % domName)
+atexit.register(vtpm_cleanup, vtpm_get_uuid(domid(domName)))
+
try:
console.sendInput("input")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL(str(e))
try:
run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("No result from dumping the PCRs")
if re.search("No such file",run["output"]):
- vtpm_cleanup(domName)
FAIL("TPM frontend support not compiled into (domU?) kernel")
consoleHistory = console.getHistory()
@@ -56,12 +55,10 @@ while loop < 3:
except TimeoutError, e:
saveLog(consoleHistory)
- vtpm_cleanup(domName)
FAIL(str(e))
if status != 0:
saveLog(consoleHistory)
- vtpm_cleanup(domName)
FAIL("xm save did not succeed")
try:
@@ -71,32 +68,27 @@ while loop < 3:
except TimeoutError, e:
os.remove("%s.save" % domName)
saveLog(consoleHistory)
- vtpm_cleanup(domName)
FAIL(str(e))
os.remove("%s.save" % domName)
if status != 0:
saveLog(consoleHistory)
- vtpm_cleanup(domName)
FAIL("xm restore did not succeed")
try:
console = domain.getConsole()
except ConsoleError, e:
- vtpm_cleanup(domName)
FAIL(str(e))
try:
run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL(str(e))
if not re.search("PCR-00:",run["output"]):
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Virtual TPM is not working correctly on /dev/vtpm on backend side")
loop += 1
@@ -105,5 +97,3 @@ domain.closeConsole()
domain.stop()
-vtpm_cleanup(domName)
-
diff --git a/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py b/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py
index 0a2f32cb53..ccc8b73782 100644
--- a/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py
+++ b/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py
@@ -13,6 +13,7 @@ from vtpm_utils import *
import commands
import os
import os.path
+import atexit
config = {"vtpm":"instance=1,backend=0"}
domain = XmTestDomain(extraConfig=config)
@@ -24,25 +25,23 @@ try:
except DomainError, e:
if verbose:
print e.extra
- vtpm_cleanup(domName)
FAIL("Unable to create domain (%s)" % domName)
+atexit.register(vtpm_cleanup, vtpm_get_uuid(domid(domName)))
+
try:
console.sendInput("input")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL(str(e))
try:
run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("No result from dumping the PCRs")
if re.search("No such file",run["output"]):
- vtpm_cleanup(domName)
FAIL("TPM frontend support not compiled into (domU?) kernel")
consoleHistory = console.getHistory()
@@ -58,12 +57,10 @@ while loop < 3:
timeout=90)
except TimeoutError, e:
saveLog(consoleHistory)
- vtpm_cleanup(domName)
FAIL(str(e))
if status != 0:
saveLog(consoleHistory)
- vtpm_cleanup(domName)
FAIL("xm migrate did not succeed. External device migration activated?")
@@ -71,26 +68,22 @@ while loop < 3:
new_domid = domid(domName)
if (old_domid == new_domid):
- vtpm_cleanup(domName)
FAIL("xm migrate failed, domain id is still %s (loop=%d)" %
(old_domid,loop))
try:
console = domain.getConsole()
except ConsoleError, e:
- vtpm_cleanup(domName)
FAIL(str(e))
try:
run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("No result from dumping the PCRs")
if not re.search("PCR-00:",run["output"]):
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Virtual TPM is not working correctly on /dev/vtpm on backend side")
loop += 1
@@ -98,5 +91,3 @@ while loop < 3:
domain.closeConsole()
domain.stop()
-
-vtpm_cleanup(domName)
diff --git a/tools/xm-test/tests/vtpm/05_vtpm-loc_migr.py b/tools/xm-test/tests/vtpm/05_vtpm-loc_migr.py
index 14102c7331..57b87dfda8 100644
--- a/tools/xm-test/tests/vtpm/05_vtpm-loc_migr.py
+++ b/tools/xm-test/tests/vtpm/05_vtpm-loc_migr.py
@@ -13,6 +13,7 @@ from vtpm_utils import *
import commands
import os
import os.path
+import atexit
config = {"vtpm":"instance=1,backend=0"}
domain = XmTestDomain(extraConfig=config)
@@ -24,25 +25,23 @@ try:
except DomainError, e:
if verbose:
print e.extra
- vtpm_cleanup(domName)
FAIL("Unable to create domain (%s)" % domName)
+atexit.register(vtpm_cleanup, vtpm_get_uuid(domid(domName)))
+
try:
console.sendInput("input")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL(str(e))
try:
run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("No result from dumping the PCRs")
if re.search("No such file",run["output"]):
- vtpm_cleanup(domName)
FAIL("TPM frontend support not compiled into (domU?) kernel")
consoleHistory = console.getHistory()
@@ -58,12 +57,10 @@ while loop < 3:
timeout=90)
except TimeoutError, e:
saveLog(consoleHistory)
- vtpm_cleanup(domName)
FAIL(str(e))
if status != 0:
saveLog(consoleHistory)
- vtpm_cleanup(domName)
FAIL("xm migrate did not succeed. External device migration activated?")
@@ -71,26 +68,22 @@ while loop < 3:
new_domid = domid(domName)
if (old_domid == new_domid):
- vtpm_cleanup(domName)
FAIL("xm migrate failed, domain id is still %s (loop=%d)" %
(old_domid,loop))
try:
console = domain.getConsole()
except ConsoleError, e:
- vtpm_cleanup(domName)
FAIL(str(e))
try:
run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("No result from dumping the PCRs")
if not re.search("PCR-00:",run["output"]):
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Virtual TPM is not working correctly on /dev/vtpm on backend side")
loop += 1
@@ -98,5 +91,3 @@ while loop < 3:
domain.closeConsole()
domain.stop()
-
-vtpm_cleanup(domName)
diff --git a/tools/xm-test/tests/vtpm/06_vtpm-susp_res_pcrs.py b/tools/xm-test/tests/vtpm/06_vtpm-susp_res_pcrs.py
index 77a216cf16..c70691d8e7 100644
--- a/tools/xm-test/tests/vtpm/06_vtpm-susp_res_pcrs.py
+++ b/tools/xm-test/tests/vtpm/06_vtpm-susp_res_pcrs.py
@@ -13,6 +13,7 @@ from vtpm_utils import *
import commands
import os
import os.path
+import atexit
config = {"vtpm":"instance=1,backend=0"}
domain = XmTestDomain(extraConfig=config)
@@ -24,45 +25,40 @@ try:
except DomainError, e:
if verbose:
print e.extra
- vtpm_cleanup(domName)
FAIL("Unable to create domain (%s)" % domName)
+atexit.register(vtpm_cleanup, vtpm_get_uuid(domid(domName)))
+
try:
console.sendInput("input")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL(str(e))
try:
run = console.runCmd("mknod /dev/tpm0 c 10 224")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Error while creating /dev/tpm0")
try:
run = console.runCmd("echo -ne \"\\x00\\xc1\\x00\\x00\\x00\\x22\\x00\\x00\\x00\\x14\\x00\\x00\\x00\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\0xf\\x10\\x11\\x12\\x13\\x14\" > seq; cat seq > /dev/tpm0")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Error while extending PCR 0")
try:
run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("No result from dumping the PCRs")
if re.search("No such file",run["output"]):
- vtpm_cleanup(domName)
FAIL("TPM frontend support not compiled into (domU?) kernel")
if not re.search("PCR-00:",run["output"]):
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Virtual TPM is not working correctly on /dev/vtpm on backend side: \n%s" % run["output"])
if not re.search("PCR-00: 1E A7 BD",run["output"]):
@@ -81,12 +77,10 @@ while loop < 3:
except TimeoutError, e:
saveLog(consoleHistory)
- vtpm_cleanup(domName)
FAIL(str(e))
if status != 0:
saveLog(consoleHistory)
- vtpm_cleanup(domName)
FAIL("xm save did not succeed")
try:
@@ -96,37 +90,31 @@ while loop < 3:
except TimeoutError, e:
os.remove("%s.save" % domName)
saveLog(consoleHistory)
- vtpm_cleanup(domName)
FAIL(str(e))
os.remove("%s.save" % domName)
if status != 0:
saveLog(consoleHistory)
- vtpm_cleanup(domName)
FAIL("xm restore did not succeed")
try:
console = domain.getConsole()
except ConsoleError, e:
- vtpm_cleanup(domName)
FAIL(str(e))
try:
run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL(str(e))
if not re.search("PCR-00:",run["output"]):
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Virtual TPM is not working correctly on /dev/vtpm on backend side")
if not re.search("PCR-00: 1E A7 BD",run["output"]):
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Virtual TPM lost PCR 0 value: \n%s" % run["output"])
loop += 1
@@ -135,5 +123,3 @@ domain.closeConsole()
domain.stop()
-vtpm_cleanup(domName)
-
diff --git a/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py b/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py
index 0f59677f7d..4ff33600a0 100644
--- a/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py
+++ b/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py
@@ -14,6 +14,7 @@ from vtpm_utils import *
import commands
import os
import os.path
+import atexit
config = {"vtpm":"instance=1,backend=0"}
domain = XmTestDomain(extraConfig=config)
@@ -25,45 +26,40 @@ try:
except DomainError, e:
if verbose:
print e.extra
- vtpm_cleanup(domName)
FAIL("Unable to create domain (%s)" % domName)
+atexit.register(vtpm_cleanup, vtpm_get_uuid(domid(domName)))
+
try:
console.sendInput("input")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL(str(e))
try:
run = console.runCmd("mknod /dev/tpm0 c 10 224")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Error while creating /dev/tpm0")
try:
run = console.runCmd("echo -ne \"\\x00\\xc1\\x00\\x00\\x00\\x22\\x00\\x00\\x00\\x14\\x00\\x00\\x00\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\0xf\\x10\\x11\\x12\\x13\\x14\" > seq; cat seq > /dev/tpm0")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Error while extending PCR 0")
try:
run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("No result from dumping the PCRs")
if re.search("No such file",run["output"]):
- vtpm_cleanup(domName)
FAIL("TPM frontend support not compiled into (domU?) kernel")
if not re.search("PCR-00:",run["output"]):
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Virtual TPM is not working correctly on /dev/vtpm on backend side: \n%s" % run["output"])
if not re.search("PCR-00: 1E A7 BD",run["output"]):
@@ -83,12 +79,10 @@ while loop < 3:
timeout=90)
except TimeoutError, e:
saveLog(consoleHistory)
- vtpm_cleanup(domName)
FAIL(str(e))
if status != 0:
saveLog(consoleHistory)
- vtpm_cleanup(domName)
FAIL("xm migrate did not succeed. External device migration activated?")
@@ -96,31 +90,26 @@ while loop < 3:
new_domid = domid(domName)
if (old_domid == new_domid):
- vtpm_cleanup(domName)
FAIL("xm migrate failed, domain id is still %s (loop=%d)" %
(old_domid,loop))
try:
console = domain.getConsole()
except ConsoleError, e:
- vtpm_cleanup(domName)
FAIL(str(e))
try:
run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("No result from dumping the PCRs")
if not re.search("PCR-00:",run["output"]):
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Virtual TPM is not working correctly on /dev/vtpm on backend side")
if not re.search("PCR-00: 1E A7 BD",run["output"]):
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Virtual TPM lost PCR 0 value: \n%s" % run["output"])
loop += 1
@@ -128,5 +117,3 @@ while loop < 3:
domain.closeConsole()
domain.stop()
-
-vtpm_cleanup(domName)
diff --git a/tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py b/tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py
index 2061992f64..27125fca44 100644
--- a/tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py
+++ b/tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py
@@ -14,6 +14,7 @@ from vtpm_utils import *
import commands
import os
import os.path
+import atexit
config = {"vtpm":"instance=1,backend=0"}
domain = XmTestDomain(extraConfig=config)
@@ -25,45 +26,40 @@ try:
except DomainError, e:
if verbose:
print e.extra
- vtpm_cleanup(domName)
FAIL("Unable to create domain (%s)" % domName)
+atexit.register(vtpm_cleanup, vtpm_get_uuid(domid(domName)))
+
try:
console.sendInput("input")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL(str(e))
try:
run = console.runCmd("mknod /dev/tpm0 c 10 224")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Error while creating /dev/tpm0")
try:
run = console.runCmd("echo -ne \"\\x00\\xc1\\x00\\x00\\x00\\x22\\x00\\x00\\x00\\x14\\x00\\x00\\x00\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\0xf\\x10\\x11\\x12\\x13\\x14\" > seq; cat seq > /dev/tpm0")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Error while extending PCR 0")
try:
run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("No result from dumping the PCRs")
if re.search("No such file",run["output"]):
- vtpm_cleanup(domName)
FAIL("TPM frontend support not compiled into (domU?) kernel")
if not re.search("PCR-00:",run["output"]):
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Virtual TPM is not working correctly on /dev/vtpm on backend side: \n%s" % run["output"])
if not re.search("PCR-00: 1E A7 BD",run["output"]):
@@ -83,12 +79,10 @@ while loop < 3:
timeout=90)
except TimeoutError, e:
saveLog(consoleHistory)
- vtpm_cleanup(domName)
FAIL(str(e))
if status != 0:
saveLog(consoleHistory)
- vtpm_cleanup(domName)
FAIL("xm migrate did not succeed. External device migration activated?")
@@ -96,31 +90,26 @@ while loop < 3:
new_domid = domid(domName)
if (old_domid == new_domid):
- vtpm_cleanup(domName)
FAIL("xm migrate failed, domain id is still %s (loop=%d)" %
(old_domid,loop))
try:
console = domain.getConsole()
except ConsoleError, e:
- vtpm_cleanup(domName)
FAIL(str(e))
try:
run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("No result from dumping the PCRs")
if not re.search("PCR-00:",run["output"]):
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Virtual TPM is not working correctly on /dev/vtpm on backend side")
if not re.search("PCR-00: 1E A7 BD",run["output"]):
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Virtual TPM lost PCR 0 value: \n%s" % run["output"])
loop += 1
@@ -128,5 +117,3 @@ while loop < 3:
domain.closeConsole()
domain.stop()
-
-vtpm_cleanup(domName)
diff --git a/tools/xm-test/tests/vtpm/vtpm_utils.py b/tools/xm-test/tests/vtpm/vtpm_utils.py
index da65aab5fb..4e5b281bb8 100644
--- a/tools/xm-test/tests/vtpm/vtpm_utils.py
+++ b/tools/xm-test/tests/vtpm/vtpm_utils.py
@@ -15,4 +15,16 @@ if output == "":
"need /dev/tpm0")
def vtpm_cleanup(domName):
- traceCommand("/etc/xen/scripts/vtpm-delete %s" % domName)
+ traceCommand("/etc/xen/scripts/vtpm-delete "
+ "`xenstore-read /local/domain/0/backend/vtpm/%s/0/uuid`" %
+ str(domid(domName)))
+
+def vtpm_cleanup(uuid):
+ from xen.xm import main
+ if main.serverType != main.SERVER_XEN_API:
+ traceCommand("/etc/xen/scripts/vtpm-delete %s" % uuid)
+
+def vtpm_get_uuid(domainid):
+ s, o = traceCommand("xenstore-read "
+ "/local/domain/0/backend/vtpm/%s/0/uuid" % domainid)
+ return o