[TPM] Adds a script for virtual TPM support.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 30 Jun 2006 09:16:12 +0000 (10:16 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 30 Jun 2006 09:16:12 +0000 (10:16 +0100)
It also removes a consistency check from the vtpm-common script file.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
tools/examples/Makefile
tools/examples/vtpm-addtodb [new file with mode: 0644]
tools/examples/vtpm-common.sh
tools/python/xen/util/dictio.py [deleted file]

index c5ccb6c8af1fd94045649ed58a06227d5b6d15b1..fb93063570ad29758ece8f771429f7dacc7849ec 100644 (file)
@@ -26,7 +26,7 @@ XEN_SCRIPTS += network-route vif-route
 XEN_SCRIPTS += network-nat vif-nat
 XEN_SCRIPTS += block
 XEN_SCRIPTS += block-enbd block-nbd
-XEN_SCRIPTS += vtpm vtpm-delete
+XEN_SCRIPTS += vtpm vtpm-delete vtpm-addtodb
 XEN_SCRIPTS += xen-hotplug-cleanup
 XEN_SCRIPTS += external-device-migrate
 XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh
diff --git a/tools/examples/vtpm-addtodb b/tools/examples/vtpm-addtodb
new file mode 100644 (file)
index 0000000..482b161
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# This script must be called with the following parameters to have
+# an entry added to the TPM-to-domain associations table in /etc/xen/vtpm.db
+# vtpm-addtodb <dom name> <instance number>
+
+dir=$(dirname "$0")
+. "$dir/vtpm-common.sh"
+
+vtpmdb_add_instance $1 $2
index 0a6c5430024f8e379e68031a949bf13dcd906454..e4210d1669fe07b1821a9e7f27ca2d0e77ec816e 100644 (file)
@@ -347,16 +347,9 @@ function isLocalAddress() {
 # 2nd: name of the domain to migrate
 # 3rd: the migration step to perform
 function vtpm_migration_step() {
-       local instance res
-       instance=$(vtpmdb_find_instance $2)
-       if [ "$instance" == "" ]; then
-               echo "Error: Translation of domain name ($2) to instance failed. Check /etc/xen/vtpm.db"
-               log err "Error during translation of domain name"
-       else
-               res=$(isLocalAddress $1)
-               if [ "$res" == "0" ]; then
-                       vtpm_migrate $1 $2 $3
-               fi
+       local res=$(isLocalAddress $1)
+       if [ "$res" == "0" ]; then
+               vtpm_migrate $1 $2 $3
        fi
 }
 
diff --git a/tools/python/xen/util/dictio.py b/tools/python/xen/util/dictio.py
deleted file mode 100644 (file)
index 4fcebdb..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#===========================================================================
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of version 2.1 of the GNU Lesser General Public
-# License as published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-#============================================================================
-# Copyright (C) 2006 International Business Machines Corp.
-# Author: Bryan D. Payne <bdpayne@us.ibm.com>
-#============================================================================
-
-
-def dict_read(dictname, filename):
-    """Loads <filename> and returns the dictionary named <dictname> from
-       the file.
-    """
-    dict = {}
-
-    # read in the config file
-    globs = {}
-    locs = {}
-    execfile(filename, globs, locs)
-
-    for (k, v) in locs.items():
-        if k == dictname:
-            dict = v
-            break
-
-    return dict
-
-def dict_write(dict, dictname, filename):
-    """Writes <dict> to <filename> using the name <dictname>.  If the file
-       contains any other data, it will be overwritten.
-    """
-    prefix = dictname + " = {\n"
-    suffix = "}\n"
-    fd = open(filename, "wb")
-    fd.write(prefix)
-    for key in dict:
-        line = "    '" + str(key) + "': " + str(dict[key]) + ",\n"
-        fd.write(line)
-    fd.write(suffix)
-    fd.close()