ia64/xen-unstable

changeset 6764:38a29ec8d021

Switch block 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:55:57 2005 +0000 (2005-09-12)
parents 3aa853185afe
children cdaaaa027bf8
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Mon Sep 12 19:49:59 2005 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Mon Sep 12 19:55:57 2005 +0000
     1.3 @@ -397,31 +397,28 @@ class XendDomainInfo:
     1.4              typedev = sxp.child_value(devconfig, 'dev')
     1.5              if re.match('^ioemu:', typedev):
     1.6  	        return;
     1.7 +
     1.8              backdom = domain_exists(sxp.child_value(devconfig, 'backend', '0'))
     1.9  
    1.10              devnum = blkdev_name_to_number(sxp.child_value(devconfig, 'dev'))
    1.11  
    1.12 -            # create backend db
    1.13 -            backdb = backdom.db.addChild("/backend/%s/%s/%d" %
    1.14 -                                         (type, self.uuid, devnum))
    1.15 +            backpath = "%s/backend/%s/%s/%d" % (backdom.path, type,
    1.16 +                                                self.uuid, devnum)
    1.17 +            frontpath = "%s/device/%s/%d" % (self.path, type, devnum)
    1.18  
    1.19 -            # create frontend db
    1.20 -            db = self.db.addChild("/device/%s/%d" % (type, devnum))
    1.21 -            
    1.22 -            db['virtual-device'] = "%i" % devnum
    1.23 -            #db['backend'] = sxp.child_value(devconfig, 'backend', '0')
    1.24 -            db['backend'] = backdb.getPath()
    1.25 -            db['backend-id'] = "%i" % backdom.id
    1.26 +            front = { 'backend' : backpath,
    1.27 +                      'backend-id' : "%i" % backdom.id,
    1.28 +                      'virtual-device' : "%i" % devnum }
    1.29 +            xstransact.Write(frontpath, front)
    1.30  
    1.31 -            (type, params) = string.split(sxp.child_value(devconfig, 'uname'), ':', 1)
    1.32 -            backdb['type'] = type
    1.33 -            backdb['params'] = params
    1.34 -            backdb['frontend'] = db.getPath()
    1.35 -            backdb['frontend-id'] = "%i" % self.id
    1.36 -            backdb.saveDB(save=True)
    1.37 +            (type, params) = string.split(sxp.child_value(devconfig,
    1.38 +                                                          'uname'), ':', 1)
    1.39 +            back = { 'type' : type,
    1.40 +                     'params' : params,
    1.41 +                     'frontend' : frontpath,
    1.42 +                     'frontend-id' : "%i" % self.id }
    1.43 +            xstransact.Write(backpath, back)
    1.44  
    1.45 -            db.saveDB(save=True)
    1.46 -            
    1.47              return
    1.48  
    1.49          if type == 'vif':
    1.50 @@ -794,16 +791,13 @@ class XendDomainInfo:
    1.51              if ctrl.isDestroyed(): continue
    1.52              ctrl.destroyController(reboot=reboot)
    1.53          t = xstransact("%s/device" % self.path)
    1.54 +        for d in t.list("vbd"):
    1.55 +            t.remove(d)
    1.56          for d in t.list("vif"):
    1.57              t.remove(d)
    1.58          t.commit()
    1.59          ddb = self.db.addChild("/device")
    1.60          for type in ddb.keys():
    1.61 -            if type == 'vbd':
    1.62 -                typedb = ddb.addChild(type)
    1.63 -                for dev in typedb.keys():
    1.64 -                    typedb[dev].delete()
    1.65 -                typedb.saveDB(save=True)
    1.66              if type == 'vtpm':
    1.67                  typedb = ddb.addChild(type)
    1.68                  for dev in typedb.keys():