ia64/xen-unstable

changeset 5346:cf712d7c809c

bitkeeper revision 1.1662.1.9 (42a485d0ePlJLabsERQDyPFBJ1tF9Q)

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@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Mon Jun 06 17:20:16 2005 +0000 (2005-06-06)
parents e1cd6bd22fb9
children 9f893f674211
files tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/server/controller.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Mon Jun 06 16:59:03 2005 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Mon Jun 06 17:20:16 2005 +0000
     1.3 @@ -217,7 +217,7 @@ class XendDomainInfo:
     1.4          vm = cls._create()
     1.5          dom = xc.domain_create()
     1.6          vm.setdom(dom)
     1.7 -        vm.dom_construct(dom, config)
     1.8 +        vm.dom_construct(vm.id, config)
     1.9          return vm
    1.10  
    1.11      restore = classmethod(restore)
    1.12 @@ -598,10 +598,6 @@ class XendDomainInfo:
    1.13              return
    1.14          if self.start_time is None:
    1.15              self.start_time = time.time()
    1.16 -        if self.restore:
    1.17 -            return
    1.18 -        dom = self.id or 0
    1.19 -        memory = self.memory
    1.20          try:
    1.21              cpu = int(sxp.child_value(self.config, 'cpu', '-1'))
    1.22          except:
     2.1 --- a/tools/python/xen/xend/server/controller.py	Mon Jun 06 16:59:03 2005 +0000
     2.2 +++ b/tools/python/xen/xend/server/controller.py	Mon Jun 06 17:20:16 2005 +0000
     2.3 @@ -115,18 +115,18 @@ class DevControllerTable:
     2.4      def getDevControllerClass(self, type):
     2.5          return self.controllerClasses.get(type)
     2.6  
     2.7 -    def addDevControllerClass(self, klass):
     2.8 -        self.controllerClasses[klass.getType()] = klass
     2.9 +    def addDevControllerClass(self, cls):
    2.10 +        self.controllerClasses[cls.getType()] = cls
    2.11  
    2.12      def delDevControllerClass(self, type):
    2.13          if type in self.controllerClasses:
    2.14              del self.controllerClasses[type]
    2.15  
    2.16      def createDevController(self, type, vm, recreate=False):
    2.17 -        klass = self.getDevControllerClass(type)
    2.18 -        if not klass:
    2.19 +        cls = self.getDevControllerClass(type)
    2.20 +        if not cls:
    2.21              raise XendError("unknown device type: " + type)
    2.22 -        return klass.createDevController(vm, recreate=recreate)
    2.23 +        return cls.createDevController(vm, recreate=recreate)
    2.24  
    2.25  def getDevControllerTable():
    2.26      """Singleton constructor for the controller table.
    2.27 @@ -138,11 +138,11 @@ def getDevControllerTable():
    2.28          devControllerTable = DevControllerTable()
    2.29      return devControllerTable
    2.30  
    2.31 -def addDevControllerClass(name, klass):
    2.32 +def addDevControllerClass(name, cls):
    2.33      """Add a device controller class to the controller table.
    2.34      """
    2.35 -    klass.name = name
    2.36 -    getDevControllerTable().addDevControllerClass(klass)
    2.37 +    cls.type = name
    2.38 +    getDevControllerTable().addDevControllerClass(cls)
    2.39  
    2.40  def createDevController(name, vm, recreate=False):
    2.41      return getDevControllerTable().createDevController(name, vm, recreate=recreate)
    2.42 @@ -155,22 +155,23 @@ class DevController:
    2.43  
    2.44      """
    2.45  
    2.46 -    name = None
    2.47 -
    2.48 -    def createDevController(klass, vm, recreate=False):
    2.49 +    def createDevController(cls, vm, recreate=False):
    2.50          """Class method to create a dev controller.
    2.51          """
    2.52 -        ctrl = klass(vm, recreate=recreate)
    2.53 +        ctrl = cls(vm, recreate=recreate)
    2.54          ctrl.initController(recreate=recreate)
    2.55          return ctrl
    2.56  
    2.57      createDevController = classmethod(createDevController)
    2.58  
    2.59 -    def getType(klass):
    2.60 -        return klass.name
    2.61 +    def getType(cls):
    2.62 +        return cls.type
    2.63  
    2.64      getType = classmethod(getType)
    2.65  
    2.66 +    # Set when registered.
    2.67 +    type = None
    2.68 +
    2.69      def __init__(self, vm, recreate=False):
    2.70          self.destroyed = False
    2.71          self.vm = vm