From b918dce5bb2a665a34ff893a9df5392fb8ea429d Mon Sep 17 00:00:00 2001 From: Matthew Fioravante Date: Tue, 13 Nov 2012 10:47:00 +0000 Subject: tools: Remove the vtpm process model Remove the old vtpm process model. It doesn't work very well and is no longer supported. Signed-off-by: Matthew Fioravante Acked-by: Ian Campbell Committed-by: Ian Campbell --- tools/xm-test/configure.ac | 1 - tools/xm-test/grouptest/default | 1 - tools/xm-test/grouptest/medium | 1 - tools/xm-test/grouptest/xapi | 1 - tools/xm-test/lib/XmTestLib/XenDomain.py | 1 - tools/xm-test/tests/Makefile.am | 1 - tools/xm-test/tests/vtpm/01_vtpm-list_pos.py | 40 ------ tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py | 49 ------- tools/xm-test/tests/vtpm/03_vtpm-susp_res.py | 99 -------------- tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py | 93 ------------- tools/xm-test/tests/vtpm/05_vtpm-loc_migr.py | 93 ------------- tools/xm-test/tests/vtpm/06_vtpm-susp_res_pcrs.py | 125 ----------------- tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py | 119 ---------------- tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py | 119 ---------------- tools/xm-test/tests/vtpm/09_vtpm-xapi.py | 158 ---------------------- tools/xm-test/tests/vtpm/Makefile.am | 27 ---- tools/xm-test/tests/vtpm/vtpm_utils.py | 30 ---- 17 files changed, 958 deletions(-) delete mode 100644 tools/xm-test/tests/vtpm/01_vtpm-list_pos.py delete mode 100644 tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py delete mode 100644 tools/xm-test/tests/vtpm/03_vtpm-susp_res.py delete mode 100644 tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py delete mode 100644 tools/xm-test/tests/vtpm/05_vtpm-loc_migr.py delete mode 100644 tools/xm-test/tests/vtpm/06_vtpm-susp_res_pcrs.py delete mode 100644 tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py delete mode 100644 tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py delete mode 100644 tools/xm-test/tests/vtpm/09_vtpm-xapi.py delete mode 100644 tools/xm-test/tests/vtpm/Makefile.am delete mode 100644 tools/xm-test/tests/vtpm/vtpm_utils.py (limited to 'tools/xm-test') diff --git a/tools/xm-test/configure.ac b/tools/xm-test/configure.ac index ad1eb78391..c1421406cd 100644 --- a/tools/xm-test/configure.ac +++ b/tools/xm-test/configure.ac @@ -143,7 +143,6 @@ AC_CONFIG_FILES([ tests/unpause/Makefile tests/vcpu-pin/Makefile tests/vcpu-disable/Makefile - tests/vtpm/Makefile tests/xapi/Makefile tests/enforce_dom0_cpus/Makefile tests/cpupool/Makefile diff --git a/tools/xm-test/grouptest/default b/tools/xm-test/grouptest/default index f0516b2949..e04591b44e 100644 --- a/tools/xm-test/grouptest/default +++ b/tools/xm-test/grouptest/default @@ -27,5 +27,4 @@ sysrq unpause vcpu-disable vcpu-pin -vtpm xapi diff --git a/tools/xm-test/grouptest/medium b/tools/xm-test/grouptest/medium index bafc988903..5c3e1b16e3 100644 --- a/tools/xm-test/grouptest/medium +++ b/tools/xm-test/grouptest/medium @@ -22,4 +22,3 @@ sysrq 01_sysrq_basic_neg.test 02_sysrq_sync_pos.test unpause vcpu-disable vcpu-pin -vtpm diff --git a/tools/xm-test/grouptest/xapi b/tools/xm-test/grouptest/xapi index 3b049219dd..7a08b7786a 100644 --- a/tools/xm-test/grouptest/xapi +++ b/tools/xm-test/grouptest/xapi @@ -1,2 +1 @@ xapi -vtpm 09_vtpm-xapi.test diff --git a/tools/xm-test/lib/XmTestLib/XenDomain.py b/tools/xm-test/lib/XmTestLib/XenDomain.py index ae8c550c48..3ba7433e2b 100644 --- a/tools/xm-test/lib/XmTestLib/XenDomain.py +++ b/tools/xm-test/lib/XmTestLib/XenDomain.py @@ -59,7 +59,6 @@ class XenConfig: # These options need to be lists self.defaultOpts["disk"] = [] self.defaultOpts["vif"] = [] - self.defaultOpts["vtpm"] = [] self.opts = self.defaultOpts diff --git a/tools/xm-test/tests/Makefile.am b/tools/xm-test/tests/Makefile.am index 8d673ed525..455f50cf09 100644 --- a/tools/xm-test/tests/Makefile.am +++ b/tools/xm-test/tests/Makefile.am @@ -25,7 +25,6 @@ SUBDIRS = \ unpause \ vcpu-disable \ vcpu-pin \ - vtpm \ enforce_dom0_cpus \ save restore migrate \ cpupool diff --git a/tools/xm-test/tests/vtpm/01_vtpm-list_pos.py b/tools/xm-test/tests/vtpm/01_vtpm-list_pos.py deleted file mode 100644 index dfd1227a00..0000000000 --- a/tools/xm-test/tests/vtpm/01_vtpm-list_pos.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/python - -# Copyright (C) International Business Machines Corp., 2006 -# Author: Stefan Berger - -# Positive Test: create domain with virtual TPM attached at build time, -# verify list - - -from XmTestLib import * -from vtpm_utils import * -import commands -import os -import atexit - -config = {"vtpm":"instance=1,backend=0"} -domain = XmTestDomain(extraConfig=config) - -try: - domain.start(noConsole=True) -except DomainError, e: - if verbose: - print e.extra - 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: - FAIL("xm vtpm-list returned bad status, expected 0, status is %i" % status) -elif where < 0: - FAIL("Fail to list virtual TPM device") - -domain.stop() diff --git a/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py b/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py deleted file mode 100644 index a18cbab2f7..0000000000 --- a/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/python - -# Copyright (C) International Business Machines Corp., 2006 -# Author: Stefan Berger - -# Positive Test: create domain with virtual TPM attached at build time, -# check list of pcrs - -from XmTestLib import * -from vtpm_utils import * -import commands -import os -import os.path -import atexit - -config = {"vtpm":"instance=1,backend=0"} -domain = XmTestDomain(extraConfig=config) -domName = domain.getName() - -try: - console = domain.start() -except DomainError, e: - if verbose: - print e.extra - 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()) - FAIL(str(e)) - -try: - run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs") -except ConsoleError, e: - saveLog(console.getHistory()) - FAIL("No result from dumping the PCRs") - -if re.search("No such file",run["output"]): - FAIL("TPM frontend support not compiled into (domU?) kernel") - -domain.closeConsole() - -domain.stop() - -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 deleted file mode 100644 index b863f27494..0000000000 --- a/tools/xm-test/tests/vtpm/03_vtpm-susp_res.py +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/python - -# Copyright (C) International Business Machines Corp., 2006 -# Author: Stefan Berger - -# Positive Test: create domain with virtual TPM attached at build time, -# check list of pcrs; suspend and resume the domain and -# check list of pcrs again - -from XmTestLib import * -from vtpm_utils import * -import commands -import os -import os.path -import atexit - -config = {"vtpm":"instance=1,backend=0"} -domain = XmTestDomain(extraConfig=config) -domName = domain.getName() -consoleHistory = "" - -try: - console = domain.start() -except DomainError, e: - if verbose: - print e.extra - 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()) - FAIL(str(e)) - -try: - run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs") -except ConsoleError, e: - saveLog(console.getHistory()) - FAIL("No result from dumping the PCRs") - -if re.search("No such file",run["output"]): - FAIL("TPM frontend support not compiled into (domU?) kernel") - -consoleHistory = console.getHistory() -domain.closeConsole() - -loop = 0 -while loop < 3: - try: - status, ouptut = traceCommand("xm save %s %s.save" % - (domName, domName), - timeout=30) - - except TimeoutError, e: - saveLog(consoleHistory) - FAIL(str(e)) - - if status != 0: - saveLog(consoleHistory) - FAIL("xm save did not succeed") - - try: - status, ouptut = traceCommand("xm restore %s.save" % - (domName), - timeout=30) - except TimeoutError, e: - os.remove("%s.save" % domName) - saveLog(consoleHistory) - FAIL(str(e)) - - os.remove("%s.save" % domName) - - if status != 0: - saveLog(consoleHistory) - FAIL("xm restore did not succeed") - - try: - console = domain.getConsole() - except ConsoleError, e: - FAIL(str(e)) - - try: - run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs") - except ConsoleError, e: - saveLog(console.getHistory()) - FAIL(str(e)) - - if not re.search("PCR-00:",run["output"]): - saveLog(console.getHistory()) - FAIL("Virtual TPM is not working correctly on /dev/vtpm on backend side") - - loop += 1 - -domain.closeConsole() - -domain.stop() - diff --git a/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py b/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py deleted file mode 100644 index ccc8b73782..0000000000 --- a/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/python - -# Copyright (C) International Business Machines Corp., 2006 -# Author: Stefan Berger - -# 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 -# This test does local live migration. - -from XmTestLib import * -from vtpm_utils import * -import commands -import os -import os.path -import atexit - -config = {"vtpm":"instance=1,backend=0"} -domain = XmTestDomain(extraConfig=config) -domName = domain.getName() -consoleHistory = "" - -try: - console = domain.start() -except DomainError, e: - if verbose: - print e.extra - 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()) - FAIL(str(e)) - -try: - run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs") -except ConsoleError, e: - saveLog(console.getHistory()) - FAIL("No result from dumping the PCRs") - -if re.search("No such file",run["output"]): - FAIL("TPM frontend support not compiled into (domU?) kernel") - -consoleHistory = console.getHistory() -domain.closeConsole() - -old_domid = domid(domName) - -loop = 0 -while loop < 3: - try: - status, ouptut = traceCommand("xm migrate -l %s localhost" % - domName, - timeout=90) - except TimeoutError, e: - saveLog(consoleHistory) - FAIL(str(e)) - - if status != 0: - saveLog(consoleHistory) - FAIL("xm migrate did not succeed. External device migration activated?") - - - domName = domain.getName() - new_domid = domid(domName) - - if (old_domid == new_domid): - FAIL("xm migrate failed, domain id is still %s (loop=%d)" % - (old_domid,loop)) - - try: - console = domain.getConsole() - except ConsoleError, e: - FAIL(str(e)) - - try: - run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs") - except ConsoleError, e: - saveLog(console.getHistory()) - FAIL("No result from dumping the PCRs") - - if not re.search("PCR-00:",run["output"]): - saveLog(console.getHistory()) - FAIL("Virtual TPM is not working correctly on /dev/vtpm on backend side") - - loop += 1 - -domain.closeConsole() - -domain.stop() diff --git a/tools/xm-test/tests/vtpm/05_vtpm-loc_migr.py b/tools/xm-test/tests/vtpm/05_vtpm-loc_migr.py deleted file mode 100644 index 57b87dfda8..0000000000 --- a/tools/xm-test/tests/vtpm/05_vtpm-loc_migr.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/python - -# Copyright (C) International Business Machines Corp., 2006 -# Author: Stefan Berger - -# 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 -# This test does local (non-live) migration. - -from XmTestLib import * -from vtpm_utils import * -import commands -import os -import os.path -import atexit - -config = {"vtpm":"instance=1,backend=0"} -domain = XmTestDomain(extraConfig=config) -domName = domain.getName() -consoleHistory = "" - -try: - console = domain.start() -except DomainError, e: - if verbose: - print e.extra - 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()) - FAIL(str(e)) - -try: - run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs") -except ConsoleError, e: - saveLog(console.getHistory()) - FAIL("No result from dumping the PCRs") - -if re.search("No such file",run["output"]): - FAIL("TPM frontend support not compiled into (domU?) kernel") - -consoleHistory = console.getHistory() -domain.closeConsole() - -old_domid = domid(domName) - -loop = 0 -while loop < 3: - try: - status, ouptut = traceCommand("xm migrate %s localhost" % - domName, - timeout=90) - except TimeoutError, e: - saveLog(consoleHistory) - FAIL(str(e)) - - if status != 0: - saveLog(consoleHistory) - FAIL("xm migrate did not succeed. External device migration activated?") - - - domName = domain.getName() - new_domid = domid(domName) - - if (old_domid == new_domid): - FAIL("xm migrate failed, domain id is still %s (loop=%d)" % - (old_domid,loop)) - - try: - console = domain.getConsole() - except ConsoleError, e: - FAIL(str(e)) - - try: - run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs") - except ConsoleError, e: - saveLog(console.getHistory()) - FAIL("No result from dumping the PCRs") - - if not re.search("PCR-00:",run["output"]): - saveLog(console.getHistory()) - FAIL("Virtual TPM is not working correctly on /dev/vtpm on backend side") - - loop += 1 - -domain.closeConsole() - -domain.stop() 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 deleted file mode 100644 index c70691d8e7..0000000000 --- a/tools/xm-test/tests/vtpm/06_vtpm-susp_res_pcrs.py +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/python - -# Copyright (C) International Business Machines Corp., 2006 -# Author: Stefan Berger - -# Positive Test: create domain with virtual TPM attached at build time, -# extend a pcr -# check list of pcrs; suspend and resume the domain and -# check list of pcrs again and validate extended pcr - -from XmTestLib import * -from vtpm_utils import * -import commands -import os -import os.path -import atexit - -config = {"vtpm":"instance=1,backend=0"} -domain = XmTestDomain(extraConfig=config) -domName = domain.getName() -consoleHistory = "" - -try: - console = domain.start() -except DomainError, e: - if verbose: - print e.extra - 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()) - FAIL(str(e)) - -try: - run = console.runCmd("mknod /dev/tpm0 c 10 224") -except ConsoleError, e: - saveLog(console.getHistory()) - 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()) - FAIL("Error while extending PCR 0") - -try: - run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs") -except ConsoleError, e: - saveLog(console.getHistory()) - FAIL("No result from dumping the PCRs") - - -if re.search("No such file",run["output"]): - FAIL("TPM frontend support not compiled into (domU?) kernel") - -if not re.search("PCR-00:",run["output"]): - saveLog(console.getHistory()) - 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"]): - saveLog(console.getHistory()) - FAIL("Extend did not lead to expected result (1E A7 BD ...): \n%s" % run["output"]) - -consoleHistory = console.getHistory() -domain.closeConsole() - -loop = 0 -while loop < 3: - try: - status, ouptut = traceCommand("xm save %s %s.save" % - (domName, domName), - timeout=30) - - except TimeoutError, e: - saveLog(consoleHistory) - FAIL(str(e)) - - if status != 0: - saveLog(consoleHistory) - FAIL("xm save did not succeed") - - try: - status, ouptut = traceCommand("xm restore %s.save" % - (domName), - timeout=30) - except TimeoutError, e: - os.remove("%s.save" % domName) - saveLog(consoleHistory) - FAIL(str(e)) - - os.remove("%s.save" % domName) - - if status != 0: - saveLog(consoleHistory) - FAIL("xm restore did not succeed") - - try: - console = domain.getConsole() - except ConsoleError, e: - FAIL(str(e)) - - try: - run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs") - except ConsoleError, e: - saveLog(console.getHistory()) - FAIL(str(e)) - - if not re.search("PCR-00:",run["output"]): - saveLog(console.getHistory()) - 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()) - FAIL("Virtual TPM lost PCR 0 value: \n%s" % run["output"]) - - loop += 1 - -domain.closeConsole() - -domain.stop() - diff --git a/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py b/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py deleted file mode 100644 index 4ff33600a0..0000000000 --- a/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/python - -# Copyright (C) International Business Machines Corp., 2006 -# Author: Stefan Berger - -# Positive Test: create domain with virtual TPM attached at build time, -# extend a pcr -# check list of pcrs; locally migrate the domain and -# check list of pcrs again and validate extended pcr -# This test does local live migration. - -from XmTestLib import * -from vtpm_utils import * -import commands -import os -import os.path -import atexit - -config = {"vtpm":"instance=1,backend=0"} -domain = XmTestDomain(extraConfig=config) -domName = domain.getName() -consoleHistory = "" - -try: - console = domain.start() -except DomainError, e: - if verbose: - print e.extra - 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()) - FAIL(str(e)) - -try: - run = console.runCmd("mknod /dev/tpm0 c 10 224") -except ConsoleError, e: - saveLog(console.getHistory()) - 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()) - FAIL("Error while extending PCR 0") - -try: - run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs") -except ConsoleError, e: - saveLog(console.getHistory()) - FAIL("No result from dumping the PCRs") - - -if re.search("No such file",run["output"]): - FAIL("TPM frontend support not compiled into (domU?) kernel") - -if not re.search("PCR-00:",run["output"]): - saveLog(console.getHistory()) - 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"]): - saveLog(console.getHistory()) - FAIL("Extend did not lead to expected result (1E A7 BD ...): \n%s" % run["output"]) - -consoleHistory = console.getHistory() -domain.closeConsole() - -old_domid = domid(domName) - -loop = 0 -while loop < 3: - try: - status, ouptut = traceCommand("xm migrate -l %s localhost" % - domName, - timeout=90) - except TimeoutError, e: - saveLog(consoleHistory) - FAIL(str(e)) - - if status != 0: - saveLog(consoleHistory) - FAIL("xm migrate did not succeed. External device migration activated?") - - - domName = domain.getName() - new_domid = domid(domName) - - if (old_domid == new_domid): - FAIL("xm migrate failed, domain id is still %s (loop=%d)" % - (old_domid,loop)) - - try: - console = domain.getConsole() - except ConsoleError, e: - FAIL(str(e)) - - try: - run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs") - except ConsoleError, e: - saveLog(console.getHistory()) - FAIL("No result from dumping the PCRs") - - if not re.search("PCR-00:",run["output"]): - saveLog(console.getHistory()) - 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()) - FAIL("Virtual TPM lost PCR 0 value: \n%s" % run["output"]) - - loop += 1 - -domain.closeConsole() - -domain.stop() diff --git a/tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py b/tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py deleted file mode 100644 index 27125fca44..0000000000 --- a/tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/python - -# Copyright (C) International Business Machines Corp., 2006 -# Author: Stefan Berger - -# Positive Test: create domain with virtual TPM attached at build time, -# extend a pcr -# check list of pcrs; locally migrate the domain and -# check list of pcrs again and validate extended pcr -# This test does local (non-live) migration. - -from XmTestLib import * -from vtpm_utils import * -import commands -import os -import os.path -import atexit - -config = {"vtpm":"instance=1,backend=0"} -domain = XmTestDomain(extraConfig=config) -domName = domain.getName() -consoleHistory = "" - -try: - console = domain.start() -except DomainError, e: - if verbose: - print e.extra - 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()) - FAIL(str(e)) - -try: - run = console.runCmd("mknod /dev/tpm0 c 10 224") -except ConsoleError, e: - saveLog(console.getHistory()) - 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()) - FAIL("Error while extending PCR 0") - -try: - run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs") -except ConsoleError, e: - saveLog(console.getHistory()) - FAIL("No result from dumping the PCRs") - - -if re.search("No such file",run["output"]): - FAIL("TPM frontend support not compiled into (domU?) kernel") - -if not re.search("PCR-00:",run["output"]): - saveLog(console.getHistory()) - 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"]): - saveLog(console.getHistory()) - FAIL("Extend did not lead to expected result (1E A7 BD ...): \n%s" % run["output"]) - -consoleHistory = console.getHistory() -domain.closeConsole() - -old_domid = domid(domName) - -loop = 0 -while loop < 3: - try: - status, ouptut = traceCommand("xm migrate %s localhost" % - domName, - timeout=90) - except TimeoutError, e: - saveLog(consoleHistory) - FAIL(str(e)) - - if status != 0: - saveLog(consoleHistory) - FAIL("xm migrate did not succeed. External device migration activated?") - - - domName = domain.getName() - new_domid = domid(domName) - - if (old_domid == new_domid): - FAIL("xm migrate failed, domain id is still %s (loop=%d)" % - (old_domid,loop)) - - try: - console = domain.getConsole() - except ConsoleError, e: - FAIL(str(e)) - - try: - run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs") - except ConsoleError, e: - saveLog(console.getHistory()) - FAIL("No result from dumping the PCRs") - - if not re.search("PCR-00:",run["output"]): - saveLog(console.getHistory()) - 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()) - FAIL("Virtual TPM lost PCR 0 value: \n%s" % run["output"]) - - loop += 1 - -domain.closeConsole() - -domain.stop() diff --git a/tools/xm-test/tests/vtpm/09_vtpm-xapi.py b/tools/xm-test/tests/vtpm/09_vtpm-xapi.py deleted file mode 100644 index a1aa8b3c70..0000000000 --- a/tools/xm-test/tests/vtpm/09_vtpm-xapi.py +++ /dev/null @@ -1,158 +0,0 @@ -#!/usr/bin/python - -# Copyright (C) International Business Machines Corp., 2006 -# Author: Stefan Berger - -# Test to test the vtpm class through the Xen-API -# -# Tested methods: -# VTPM: get_uuid, get_backend, get_by_uuid, get_record -# create, destroy, get_VM -# VM: get_VTPMS - -from XmTestLib import xapi -from XmTestLib.XenAPIDomain import XmTestAPIDomain -from XmTestLib import * -from vtpm_utils import * -import commands -import os - -VTPM_RECORD_KEYS = [ 'backend', 'VM', 'uuid', 'other_config' ] - -try: - # XmTestAPIDomain tries to establish a connection to XenD - domain = XmTestAPIDomain() -except Exception, e: - SKIP("Skipping test. Error: %s" % str(e)) -vm_uuid = domain.get_uuid() - -vtpmcfg = {} -vtpmcfg['backend'] = DOM0_UUID -vtpmcfg['VM'] = vm_uuid - -session = xapi.connect() - -vtpm_uuid = session.xenapi.VTPM.create(vtpmcfg) - -vtpm_be = session.xenapi.VTPM.get_backend(vtpm_uuid) -if vtpm_be != vtpmcfg['backend']: - FAIL("vTPM's backend is in '%s', expected: '%s'" % - (vtpm_be, vtpmcfg['backend'])) - -vtpm_rec = session.xenapi.VTPM.get_record(vtpm_uuid) - -miss_keys = [] -for k in VTPM_RECORD_KEYS: - if k not in vtpm_rec.keys(): - miss_keys.append(k) -if len(miss_keys) > 0: - FAIL("vTPM record is missing key(s): %s" % miss_keys) - -if vtpm_rec['uuid'] != vtpm_uuid: - FAIL("vTPM record shows vtpm uuid '%s', expected: '%s'" % - (vtpm_rec['uuid'], vtpm_uuid)) -if vtpm_rec['VM'] != vm_uuid: - FAIL("vTPM record shows VM uuid '%s', expected: '%s'" % - (vtpm_rec['VM'], vm_uuid)) -if vtpm_rec['backend'] != vtpmcfg['backend']: - FAIL("vTPM record shows VM bakcned '%s', expected: '%s'" % - (vtpm_rev['backend'], vtpmcfg['backend'])) - -badkeys = [] -keys = vtpm_rec.keys() -for k in keys: - if k not in VTPM_RECORD_KEYS: - badkeys.append(k) -if len(badkeys) > 0: - FAIL("Unexpected attributes in result: %s" % badkeys) - -if vm_uuid != session.xenapi.VTPM.get_VM(vtpm_uuid): - FAIL("VM uuid from VTPM.get_VM different (%s) than expected (%s)." % - (vm_ref, vm_uuid)) - -uuid = session.xenapi.VTPM.get_uuid(vtpm_uuid) -if uuid != vtpm_uuid: - FAIL("vTPM from VTPM.get_uuid different (%s) than expected (%s)." % - (uuid, vtpm_uuid)) - -vtpm_ref = session.xenapi.VTPM.get_by_uuid(vtpm_uuid) -if vtpm_ref != vtpm_uuid: - FAIL("vTPM from VTPM.get_by_uuid different (%s) than expected (%s)." % - (vtpm_ref, vtpm_uuid)) - -vm_vtpms = session.xenapi.VM.get_VTPMs(vm_uuid) -if len(vm_vtpms) != 1: - FAIL("Number of vTPMs from get_VTPMs is (%d) not what was expected (%d)" % - (len(vm_vtpms), 1)) -if vtpm_uuid not in vm_vtpms: - FAIL("Other vTPM uuid (%s) returned from VM.get_VTPMs than expected (%s)" % - (vm_vtpms[0], vtpm_uuid)) - -try: - console = domain.start() -except DomainError, e: - FAIL("Unable to create domain.") - -try: - console.sendInput("input") -except ConsoleError, e: - saveLog(console.getHistory()) - FAIL(str(e)) - -try: - run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs") -except ConsoleError, e: - saveLog(console.getHistory()) - FAIL("1. No result from dumping the PCRs") - -if re.search("No such file",run["output"]): - FAIL("TPM frontend support not compiled into (domU?) kernel") - -if not re.search("PCR-00:",run["output"]): - saveLog(console.getHistory()) - FAIL("1. Virtual TPM is not working correctly on /dev/vtpm on backend side: \n%s" % run["output"]) - -try: - session.xenapi.VTPM.destroy(vtpm_uuid) - #Should never get here - FAIL("Could destroy vTPM while VM is running") -except: - pass - -rc = session.xenapi.VM.suspend(vm_uuid) -if rc: - FAIL("Could not suspend VM") - -try: - session.xenapi.VTPM.destroy(vtpm_uuid) - #May not throw an exception in 'suspend' state -except: - pass - -rc = session.xenapi.VM.resume(vm_uuid, False) -if rc: - FAIL("Could not resume VM") - -try: - console = domain.getConsole() -except ConsoleError, e: - FAIL(str(e)) - -try: - run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs") -except ConsoleError, e: - saveLog(console.getHistory()) - FAIL("2. No result from dumping the PCRs. vTPM has been removed?") - -if not re.search("PCR-00:",run["output"]): - saveLog(console.getHistory()) - FAIL("2. Virtual TPM is not working correctly on /dev/vtpm on backend side: \n%s" % run["output"]) - -domain.stop() - -try: - session.xenapi.VTPM.destroy(vtpm_uuid) -except: - FAIL("Could NOT destroy vTPM while domain is halted.") - -domain.destroy() diff --git a/tools/xm-test/tests/vtpm/Makefile.am b/tools/xm-test/tests/vtpm/Makefile.am deleted file mode 100644 index dd67e459ec..0000000000 --- a/tools/xm-test/tests/vtpm/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -SUBDIRS = - -TESTS = 01_vtpm-list_pos.test \ - 02_vtpm-cat_pcrs.test \ - 03_vtpm-susp_res.test \ - 04_vtpm-loc_migr.test \ - 05_vtpm-loc_migr.test \ - 06_vtpm-susp_res_pcrs.test \ - 07_vtpm-mig_pcrs.test \ - 08_vtpm-mig_pcrs.test \ - 09_vtpm-xapi.test - -XFAIL_TESTS = - -EXTRA_DIST = $(TESTS) $(XFAIL_TESTS) vtpm_utils.py -TESTS_ENVIRONMENT=@TENV@ - -%.test: %.py - cp $< $@ - chmod +x $@ - -clean-local: am_config_clean-local - -am_config_clean-local: - rm -f *test - rm -f *log - rm -f *~ diff --git a/tools/xm-test/tests/vtpm/vtpm_utils.py b/tools/xm-test/tests/vtpm/vtpm_utils.py deleted file mode 100644 index 4e5b281bb8..0000000000 --- a/tools/xm-test/tests/vtpm/vtpm_utils.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/python - -# Copyright (C) International Business Machines Corp., 2006 -# Author: Stefan Berger - -from XmTestLib import * - -if ENABLE_HVM_SUPPORT: - SKIP("vtpm tests not supported for HVM domains") - -status, output = traceCommand("COLUMNS=200 ; " - "ps aux | grep vtpm_manager | grep -v grep") -if output == "": - SKIP("virtual TPM manager must be started to run this test; might " - "need /dev/tpm0") - -def vtpm_cleanup(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 -- cgit v1.2.3