ia64/xen-unstable

changeset 10617:d095e99392ac

[TPM] Adds a script for virtual TPM support.

It also removes a consistency check from the vtpm-common script file.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Jun 30 10:16:12 2006 +0100 (2006-06-30)
parents 5d565bb12783
children a75c1bdfe761
files tools/examples/Makefile tools/examples/vtpm-addtodb tools/examples/vtpm-common.sh
line diff
     1.1 --- a/tools/examples/Makefile	Fri Jun 30 10:14:36 2006 +0100
     1.2 +++ b/tools/examples/Makefile	Fri Jun 30 10:16:12 2006 +0100
     1.3 @@ -26,7 +26,7 @@ XEN_SCRIPTS += network-route vif-route
     1.4  XEN_SCRIPTS += network-nat vif-nat
     1.5  XEN_SCRIPTS += block
     1.6  XEN_SCRIPTS += block-enbd block-nbd
     1.7 -XEN_SCRIPTS += vtpm vtpm-delete
     1.8 +XEN_SCRIPTS += vtpm vtpm-delete vtpm-addtodb
     1.9  XEN_SCRIPTS += xen-hotplug-cleanup
    1.10  XEN_SCRIPTS += external-device-migrate
    1.11  XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/examples/vtpm-addtodb	Fri Jun 30 10:16:12 2006 +0100
     2.3 @@ -0,0 +1,10 @@
     2.4 +#!/bin/sh
     2.5 +
     2.6 +# This script must be called with the following parameters to have
     2.7 +# an entry added to the TPM-to-domain associations table in /etc/xen/vtpm.db
     2.8 +# vtpm-addtodb <dom name> <instance number>
     2.9 +
    2.10 +dir=$(dirname "$0")
    2.11 +. "$dir/vtpm-common.sh"
    2.12 +
    2.13 +vtpmdb_add_instance $1 $2
     3.1 --- a/tools/examples/vtpm-common.sh	Fri Jun 30 10:14:36 2006 +0100
     3.2 +++ b/tools/examples/vtpm-common.sh	Fri Jun 30 10:16:12 2006 +0100
     3.3 @@ -347,16 +347,9 @@ function isLocalAddress() {
     3.4  # 2nd: name of the domain to migrate
     3.5  # 3rd: the migration step to perform
     3.6  function vtpm_migration_step() {
     3.7 -	local instance res
     3.8 -	instance=$(vtpmdb_find_instance $2)
     3.9 -	if [ "$instance" == "" ]; then
    3.10 -		echo "Error: Translation of domain name ($2) to instance failed. Check /etc/xen/vtpm.db"
    3.11 -		log err "Error during translation of domain name"
    3.12 -	else
    3.13 -		res=$(isLocalAddress $1)
    3.14 -		if [ "$res" == "0" ]; then
    3.15 -			vtpm_migrate $1 $2 $3
    3.16 -		fi
    3.17 +	local res=$(isLocalAddress $1)
    3.18 +	if [ "$res" == "0" ]; then
    3.19 +		vtpm_migrate $1 $2 $3
    3.20  	fi
    3.21  }
    3.22  
     4.1 --- a/tools/python/xen/util/dictio.py	Fri Jun 30 10:14:36 2006 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,50 +0,0 @@
     4.4 -#===========================================================================
     4.5 -# This library is free software; you can redistribute it and/or
     4.6 -# modify it under the terms of version 2.1 of the GNU Lesser General Public
     4.7 -# License as published by the Free Software Foundation.
     4.8 -#
     4.9 -# This library is distributed in the hope that it will be useful,
    4.10 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.11 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    4.12 -# Lesser General Public License for more details.
    4.13 -#
    4.14 -# You should have received a copy of the GNU Lesser General Public
    4.15 -# License along with this library; if not, write to the Free Software
    4.16 -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    4.17 -#============================================================================
    4.18 -# Copyright (C) 2006 International Business Machines Corp.
    4.19 -# Author: Bryan D. Payne <bdpayne@us.ibm.com>
    4.20 -#============================================================================
    4.21 -
    4.22 -
    4.23 -def dict_read(dictname, filename):
    4.24 -    """Loads <filename> and returns the dictionary named <dictname> from
    4.25 -       the file.
    4.26 -    """
    4.27 -    dict = {}
    4.28 -
    4.29 -    # read in the config file
    4.30 -    globs = {}
    4.31 -    locs = {}
    4.32 -    execfile(filename, globs, locs)
    4.33 -
    4.34 -    for (k, v) in locs.items():
    4.35 -        if k == dictname:
    4.36 -            dict = v
    4.37 -            break
    4.38 -
    4.39 -    return dict
    4.40 -
    4.41 -def dict_write(dict, dictname, filename):
    4.42 -    """Writes <dict> to <filename> using the name <dictname>.  If the file
    4.43 -       contains any other data, it will be overwritten.
    4.44 -    """
    4.45 -    prefix = dictname + " = {\n"
    4.46 -    suffix = "}\n"
    4.47 -    fd = open(filename, "wb")
    4.48 -    fd.write(prefix)
    4.49 -    for key in dict:
    4.50 -        line = "    '" + str(key) + "': " + str(dict[key]) + ",\n"
    4.51 -        fd.write(line)
    4.52 -    fd.write(suffix)
    4.53 -    fd.close()