ia64/xen-unstable

changeset 6729:578c19d1ed49

Setup network devices in xenstore using xstransact.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Fri Sep 09 16:08:17 2005 +0000 (2005-09-09)
parents fbdb56cd611b
children 54af57682431
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Fri Sep 09 16:07:26 2005 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Fri Sep 09 16:08:17 2005 +0000
     1.3 @@ -47,6 +47,7 @@ from xen.xend.XendRoot import get_compon
     1.4  
     1.5  from xen.xend.uuid import getUuid
     1.6  from xen.xend.xenstore import DBVar, XenNode, DBMap
     1.7 +from xen.xend.xenstore.xstransact import xstransact
     1.8  
     1.9  """Shutdown code for poweroff."""
    1.10  DOMAIN_POWEROFF = 0
    1.11 @@ -452,30 +453,28 @@ class XendDomainInfo:
    1.12              mac = sxp.child_value(devconfig, 'mac')
    1.13              ipaddr = _get_config_ipaddr(devconfig)
    1.14  
    1.15 -            # create backend db
    1.16 -            backdb = backdom.db.addChild("/backend/%s/%s/%d" %
    1.17 -                                         (type, self.uuid, devnum))
    1.18 +            backpath = "%s/backend/%s/%s/%d" % (backdom.path, type,
    1.19 +                                                self.uuid, devnum)
    1.20 +            frontpath = "%s/device/%s/%d" % (self.path, type, devnum)
    1.21  
    1.22 -            # create frontend db
    1.23 -            db = self.db.addChild("/device/%s/%d" % (type, devnum))
    1.24 -            
    1.25 -            backdb['script'] = script
    1.26 -            backdb['domain'] = self.name
    1.27 -            backdb['mac'] = mac
    1.28 -            backdb['bridge'] = bridge
    1.29 +            frontt = xstransact(frontpath)
    1.30 +            frontt.write('backend', backpath)
    1.31 +            frontt.write('backend-id', "%i" % backdom.id)
    1.32 +            frontt.write('handle', "%i" % devnum)
    1.33 +            frontt.write('mac', mac)
    1.34 +            frontt.commit()
    1.35 +
    1.36 +            backt = xstransact(backpath)
    1.37 +            backt.write('script', script)
    1.38 +            backt.write('domain', self.name)
    1.39 +            backt.write('mac', mac)
    1.40 +            backt.write('bridge', bridge)
    1.41              if ipaddr:
    1.42 -                backdb['ip'] = ' '.join(ipaddr)
    1.43 -            backdb['frontend'] = db.getPath()
    1.44 -            backdb['frontend-id'] = "%i" % self.id
    1.45 -            backdb['handle'] = "%i" % devnum
    1.46 -            backdb.saveDB(save=True)
    1.47 -
    1.48 -            db['backend'] = backdb.getPath()
    1.49 -            db['backend-id'] = "%i" % backdom.id
    1.50 -            db['handle'] = "%i" % devnum
    1.51 -            db['mac'] = mac
    1.52 -
    1.53 -            db.saveDB(save=True)
    1.54 +                backt.write('ip', ' '.join(ipaddr))
    1.55 +            backt.write('frontend', frontpath)
    1.56 +            backt.write('frontend-id', "%i" % self.id)
    1.57 +            backt.write('handle', "%i" % devnum)
    1.58 +            backt.commit()
    1.59  
    1.60              return
    1.61