ia64/xen-unstable

changeset 6732:31c257b9a360

Make vif cleanup use xstransact and use classmethods for setup.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Fri Sep 09 17:36:39 2005 +0000 (2005-09-09)
parents 1a27091a1e7a
children 813c37b68376
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Fri Sep 09 17:34:40 2005 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Fri Sep 09 17:36:39 2005 +0000
     1.3 @@ -457,24 +457,22 @@ class XendDomainInfo:
     1.4                                                  self.uuid, devnum)
     1.5              frontpath = "%s/device/%s/%d" % (self.path, type, devnum)
     1.6  
     1.7 -            frontt = xstransact(frontpath)
     1.8 -            frontt.write('backend', backpath)
     1.9 -            frontt.write('backend-id', "%i" % backdom.id)
    1.10 -            frontt.write('handle', "%i" % devnum)
    1.11 -            frontt.write('mac', mac)
    1.12 -            frontt.commit()
    1.13 +            front = { 'backend' : backpath,
    1.14 +                      'backend-id' : "%i" % backdom.id,
    1.15 +                      'handle' : "%i" % devnum,
    1.16 +                      'mac' : mac }
    1.17 +            xstransact.Write(frontpath, front)
    1.18  
    1.19 -            backt = xstransact(backpath)
    1.20 -            backt.write('script', script)
    1.21 -            backt.write('domain', self.name)
    1.22 -            backt.write('mac', mac)
    1.23 -            backt.write('bridge', bridge)
    1.24 +            back = { 'script' : script,
    1.25 +                     'domain' : self.name,
    1.26 +                     'mac' : mac,
    1.27 +                     'bridge' : bridge,
    1.28 +                     'frontend' : frontpath,
    1.29 +                     'frontend-id' : "%i" % self.id,
    1.30 +                     'handle' : "%i" % devnum }
    1.31              if ipaddr:
    1.32 -                backt.write('ip', ' '.join(ipaddr))
    1.33 -            backt.write('frontend', frontpath)
    1.34 -            backt.write('frontend-id', "%i" % self.id)
    1.35 -            backt.write('handle', "%i" % devnum)
    1.36 -            backt.commit()
    1.37 +                back['ip'] = ' '.join(ipaddr)
    1.38 +            xstransact.Write(backpath, back)
    1.39  
    1.40              return
    1.41          
    1.42 @@ -801,6 +799,10 @@ class XendDomainInfo:
    1.43          for ctrl in self.getDeviceControllers():
    1.44              if ctrl.isDestroyed(): continue
    1.45              ctrl.destroyController(reboot=reboot)
    1.46 +        t = xstransact("%s/device" % self.path)
    1.47 +        for d in t.list("vif"):
    1.48 +            t.remove(d)
    1.49 +        t.commit()
    1.50          ddb = self.db.addChild("/device")
    1.51          for type in ddb.keys():
    1.52              if type == 'vbd':
    1.53 @@ -811,11 +813,6 @@ class XendDomainInfo:
    1.54                                   devdb['node'].getData())
    1.55                      typedb[dev].delete()
    1.56                  typedb.saveDB(save=True)
    1.57 -            if type == 'vif':
    1.58 -                typedb = ddb.addChild(type)
    1.59 -                for dev in typedb.keys():
    1.60 -                    typedb[dev].delete()
    1.61 -                typedb.saveDB(save=True)
    1.62              if type == 'vtpm':
    1.63                  typedb = ddb.addChild(type)
    1.64                  for dev in typedb.keys():