[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Switch block device setup/teardown over to xstransact.



# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 38a29ec8d021821f9d2dec1f9177468056544b6c
# Parent  3aa853185afe00a4c6417b65a37f6f78c0fb6a77
Switch block device setup/teardown over to xstransact.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r 3aa853185afe -r 38a29ec8d021 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Mon Sep 12 19:49:59 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py   Mon Sep 12 19:55:57 2005
@@ -397,31 +397,28 @@
             typedev = sxp.child_value(devconfig, 'dev')
             if re.match('^ioemu:', typedev):
                return;
+
             backdom = domain_exists(sxp.child_value(devconfig, 'backend', '0'))
 
             devnum = blkdev_name_to_number(sxp.child_value(devconfig, 'dev'))
 
-            # create backend db
-            backdb = backdom.db.addChild("/backend/%s/%s/%d" %
-                                         (type, self.uuid, devnum))
-
-            # create frontend db
-            db = self.db.addChild("/device/%s/%d" % (type, devnum))
-            
-            db['virtual-device'] = "%i" % devnum
-            #db['backend'] = sxp.child_value(devconfig, 'backend', '0')
-            db['backend'] = backdb.getPath()
-            db['backend-id'] = "%i" % backdom.id
-
-            (type, params) = string.split(sxp.child_value(devconfig, 'uname'), 
':', 1)
-            backdb['type'] = type
-            backdb['params'] = params
-            backdb['frontend'] = db.getPath()
-            backdb['frontend-id'] = "%i" % self.id
-            backdb.saveDB(save=True)
-
-            db.saveDB(save=True)
-            
+            backpath = "%s/backend/%s/%s/%d" % (backdom.path, type,
+                                                self.uuid, devnum)
+            frontpath = "%s/device/%s/%d" % (self.path, type, devnum)
+
+            front = { 'backend' : backpath,
+                      'backend-id' : "%i" % backdom.id,
+                      'virtual-device' : "%i" % devnum }
+            xstransact.Write(frontpath, front)
+
+            (type, params) = string.split(sxp.child_value(devconfig,
+                                                          'uname'), ':', 1)
+            back = { 'type' : type,
+                     'params' : params,
+                     'frontend' : frontpath,
+                     'frontend-id' : "%i" % self.id }
+            xstransact.Write(backpath, back)
+
             return
 
         if type == 'vif':
@@ -794,16 +791,13 @@
             if ctrl.isDestroyed(): continue
             ctrl.destroyController(reboot=reboot)
         t = xstransact("%s/device" % self.path)
+        for d in t.list("vbd"):
+            t.remove(d)
         for d in t.list("vif"):
             t.remove(d)
         t.commit()
         ddb = self.db.addChild("/device")
         for type in ddb.keys():
-            if type == 'vbd':
-                typedb = ddb.addChild(type)
-                for dev in typedb.keys():
-                    typedb[dev].delete()
-                typedb.saveDB(save=True)
             if type == 'vtpm':
                 typedb = ddb.addChild(type)
                 for dev in typedb.keys():

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.