ia64/xen-unstable

changeset 6765:cdaaaa027bf8

Switch vtpm device setup/teardown over to xstransact.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Mon Sep 12 19:59:40 2005 +0000 (2005-09-12)
parents 38a29ec8d021
children 219d96d545fc
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Mon Sep 12 19:55:57 2005 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Mon Sep 12 19:59:40 2005 +0000
     1.3 @@ -473,22 +473,19 @@ class XendDomainInfo:
     1.4              devnum = int(sxp.child_value(devconfig, 'instance', '0'))
     1.5              log.error("The domain has a TPM with instance %d." % devnum)
     1.6  
     1.7 -            # create backend db
     1.8 -            backdb = backdom.db.addChild("/backend/%s/%s/%d" %
     1.9 -                                         (type, self.uuid, devnum))
    1.10 -            # create frontend db
    1.11 -            db = self.db.addChild("/device/%s/%d" % (type, devnum))
    1.12 +            backpath = "%s/backend/%s/%s/%d" % (backdom.path, type,
    1.13 +                                                self.uuid, devnum)
    1.14 +            frontpath = "%s/device/%s/%d" % (self.path, type, devnum)
    1.15  
    1.16 -            backdb['frontend'] = db.getPath()
    1.17 -            backdb['frontend-id'] = "%i" % self.id
    1.18 -            backdb['instance'] = sxp.child_value(devconfig, 'instance', '0')
    1.19 -            backdb.saveDB(save=True)
    1.20 +            front = { 'backend' : backpath,
    1.21 +                      'backend-id' : "%i" % backdom.id,
    1.22 +                      'handle' : "%i" % devnum }
    1.23 +            xstransact.Write(frontpath, front)
    1.24  
    1.25 -            db['handle'] = "%i" % devnum
    1.26 -            db['backend'] = backdb.getPath()
    1.27 -            db['backend-id'] = "%i" % int(sxp.child_value(devconfig,
    1.28 -                                                          'backend', '0'))
    1.29 -            db.saveDB(save=True)
    1.30 +            back = { 'instance' : "%i" % devnum,
    1.31 +                     'frontend' : frontpath,
    1.32 +                     'frontend-id' : "%i" % self.id }
    1.33 +            xstransact.Write(backpath, back)
    1.34  
    1.35              return
    1.36  
    1.37 @@ -795,14 +792,9 @@ class XendDomainInfo:
    1.38              t.remove(d)
    1.39          for d in t.list("vif"):
    1.40              t.remove(d)
    1.41 +        for d in t.list("vtpm"):
    1.42 +            t.remove(d)
    1.43          t.commit()
    1.44 -        ddb = self.db.addChild("/device")
    1.45 -        for type in ddb.keys():
    1.46 -            if type == 'vtpm':
    1.47 -                typedb = ddb.addChild(type)
    1.48 -                for dev in typedb.keys():
    1.49 -                    typedb[dev].delete()
    1.50 -                typedb.saveDB(save=True)
    1.51  
    1.52      def show(self):
    1.53          """Print virtual machine info.