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

[Xen-changelog] controller.py:



ChangeSet 1.1662.1.9, 2005/06/06 18:20:16+01:00, cl349@xxxxxxxxxxxxxxxxxxxx

        controller.py:
          Rename name -> type and use cls instead of klass.
        XendDomainInfo.py:
          g/c unneeded code.
          Use vm.id after setdom.
        Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>



 XendDomainInfo.py    |    6 +-----
 server/controller.py |   29 +++++++++++++++--------------
 2 files changed, 16 insertions(+), 19 deletions(-)


diff -Nru a/tools/python/xen/xend/XendDomainInfo.py 
b/tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   2005-06-09 13:07:17 -04:00
+++ b/tools/python/xen/xend/XendDomainInfo.py   2005-06-09 13:07:17 -04:00
@@ -217,7 +217,7 @@
         vm = cls._create()
         dom = xc.domain_create()
         vm.setdom(dom)
-        vm.dom_construct(dom, config)
+        vm.dom_construct(vm.id, config)
         return vm
 
     restore = classmethod(restore)
@@ -598,10 +598,6 @@
             return
         if self.start_time is None:
             self.start_time = time.time()
-        if self.restore:
-            return
-        dom = self.id or 0
-        memory = self.memory
         try:
             cpu = int(sxp.child_value(self.config, 'cpu', '-1'))
         except:
diff -Nru a/tools/python/xen/xend/server/controller.py 
b/tools/python/xen/xend/server/controller.py
--- a/tools/python/xen/xend/server/controller.py        2005-06-09 13:07:17 
-04:00
+++ b/tools/python/xen/xend/server/controller.py        2005-06-09 13:07:17 
-04:00
@@ -115,18 +115,18 @@
     def getDevControllerClass(self, type):
         return self.controllerClasses.get(type)
 
-    def addDevControllerClass(self, klass):
-        self.controllerClasses[klass.getType()] = klass
+    def addDevControllerClass(self, cls):
+        self.controllerClasses[cls.getType()] = cls
 
     def delDevControllerClass(self, type):
         if type in self.controllerClasses:
             del self.controllerClasses[type]
 
     def createDevController(self, type, vm, recreate=False):
-        klass = self.getDevControllerClass(type)
-        if not klass:
+        cls = self.getDevControllerClass(type)
+        if not cls:
             raise XendError("unknown device type: " + type)
-        return klass.createDevController(vm, recreate=recreate)
+        return cls.createDevController(vm, recreate=recreate)
 
 def getDevControllerTable():
     """Singleton constructor for the controller table.
@@ -138,11 +138,11 @@
         devControllerTable = DevControllerTable()
     return devControllerTable
 
-def addDevControllerClass(name, klass):
+def addDevControllerClass(name, cls):
     """Add a device controller class to the controller table.
     """
-    klass.name = name
-    getDevControllerTable().addDevControllerClass(klass)
+    cls.type = name
+    getDevControllerTable().addDevControllerClass(cls)
 
 def createDevController(name, vm, recreate=False):
     return getDevControllerTable().createDevController(name, vm, 
recreate=recreate)
@@ -155,21 +155,22 @@
 
     """
 
-    name = None
-
-    def createDevController(klass, vm, recreate=False):
+    def createDevController(cls, vm, recreate=False):
         """Class method to create a dev controller.
         """
-        ctrl = klass(vm, recreate=recreate)
+        ctrl = cls(vm, recreate=recreate)
         ctrl.initController(recreate=recreate)
         return ctrl
 
     createDevController = classmethod(createDevController)
 
-    def getType(klass):
-        return klass.name
+    def getType(cls):
+        return cls.type
 
     getType = classmethod(getType)
+
+    # Set when registered.
+    type = None
 
     def __init__(self, vm, recreate=False):
         self.destroyed = False

_______________________________________________
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®.