[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] This patch adds a test case for local virtual machine migration with a



# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID 73d847cafc8799a186171df59dd04158fc2c79bf
# Parent  6af7b456e6845ca14362a9e0553d6a6722ba7b6e
This patch adds a test case for local virtual machine migration with a
virtual TPM attached.

Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx>

diff -r 6af7b456e684 -r 73d847cafc87 tools/xm-test/tests/vtpm/Makefile.am
--- a/tools/xm-test/tests/vtpm/Makefile.am      Fri Apr 21 11:54:12 2006 +0100
+++ b/tools/xm-test/tests/vtpm/Makefile.am      Fri Apr 21 11:56:40 2006 +0100
@@ -2,7 +2,8 @@ SUBDIRS =
 
 TESTS = 01_vtpm-list_pos.test \
         02_vtpm-cat_pcrs.test \
-        03_vtpm-susp_res.test
+        03_vtpm-susp_res.test \
+        04_vtpm-loc_migr.test
 
 XFAIL_TESTS =
 
diff -r 6af7b456e684 -r 73d847cafc87 
tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py      Fri Apr 21 11:56:40 
2006 +0100
@@ -0,0 +1,99 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2006
+# Author: Stefan Berger <stefanb@xxxxxxxxxx>
+
+# Positive Test: create domain with virtual TPM attached at build time,
+#                check list of pcrs; locally migrate the domain and
+#                check list of pcrs again
+
+from XmTestLib import *
+from vtpm_utils import *
+import commands
+import os
+import os.path
+
+config = {"vtpm":"instance=1,backend=0"}
+domain = XmTestDomain(extraConfig=config)
+
+try:
+    domain.start()
+except DomainError, e:
+    if verbose:
+        print e.extra
+    vtpm_cleanup(domain.getName())
+    FAIL("Unable to create domain")
+
+domName = domain.getName()
+
+try:
+    console = XmConsole(domain.getName())
+except ConsoleError, e:
+    vtpm_cleanup(domName)
+    FAIL(str(e))
+
+try:
+    console.sendInput("input")
+except ConsoleError, e:
+    saveLog(console.getHistory())
+    vtpm_cleanup(domName)
+    FAIL(str(e))
+
+try:
+    run = console.runCmd("cat /sys/devices/platform/tpm_vtpm/pcrs")
+except ConsoleError, e:
+    saveLog(console.getHistory())
+    vtpm_cleanup(domName)
+    FAIL(str(e))
+
+if re.search("No such file",run["output"]):
+    vtpm_cleanup(domName)
+    FAIL("TPM frontend support not compiled into (domU?) kernel")
+
+console.closeConsole()
+
+old_domid = domid(domName)
+
+try:
+    status, ouptut = traceCommand("xm migrate -l %s localhost" %
+                                  domName,
+                                  timeout=90)
+except TimeoutError, e:
+    saveLog(console.getHistory())
+    vtpm_cleanup(domName)
+    FAIL(str(e))
+
+if status != 0:
+    saveLog(console.getHistory())
+    vtpm_cleanup(domName)
+    FAIL("xm migrate did not succeed. External device migration activated?")
+
+
+domName = domain.getName()
+new_domid = domid(domName)
+
+if (old_domid == new_domid):
+    vtpm_cleanup(domName)
+    FAIL("xm migrate failed, domain id is still %s" % old_domid)
+
+try:
+    console = XmConsole(domain.getName())
+except ConsoleError, e:
+    vtpm_cleanup(domName)
+    FAIL(str(e))
+
+try:
+    run = console.runCmd("cat /sys/devices/platform/tpm_vtpm/pcrs")
+except ConsoleError, e:
+    saveLog(console.getHistory())
+    vtpm_cleanup(domName)
+    FAIL(str(e))
+
+console.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")

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.