direct-io.hg

changeset 2296:97a16adf6fc1

bitkeeper revision 1.1159.1.89 (4124b984t6aam6ddcud4Iu0TZs1CVA)

Remove limit (15) on domain names.
author mjw@wray-m-3.hpl.hp.com
date Thu Aug 19 14:30:28 2004 +0000 (2004-08-19)
parents bf56990784b2
children b2b49059dfef
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Thu Aug 19 14:02:48 2004 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Aug 19 14:30:28 2004 +0000
     1.3 @@ -34,6 +34,12 @@ xend = server.SrvDaemon.instance()
     1.4  
     1.5  from XendError import VmError
     1.6  
     1.7 +"""The length of domain names that Xen can handle.
     1.8 +The names stored in Xen itself are not used for much, and
     1.9 +xend can handle domain names of any length.
    1.10 +"""
    1.11 +MAX_DOMAIN_NAME = 15
    1.12 +
    1.13  """Flag for a block device backend domain."""
    1.14  SIF_BLK_BE_DOMAIN = (1<<4)
    1.15  
    1.16 @@ -270,7 +276,7 @@ def vm_recreate(savedinfo, info):
    1.17      vm = XendDomainInfo()
    1.18      vm.recreate = 1
    1.19      vm.setdom(info['dom'])
    1.20 -    vm.name = info['name']
    1.21 +    #vm.name = info['name']
    1.22      vm.memory = info['mem_kb']/1024
    1.23      start_time = sxp.child_value(savedinfo, 'start_time')
    1.24      if start_time is not None:
    1.25 @@ -283,8 +289,8 @@ def vm_recreate(savedinfo, info):
    1.26      if config:
    1.27          d = vm.construct(config)
    1.28      else:
    1.29 -        d = defer.Deferred()
    1.30 -        d.callback(vm)
    1.31 +        vm.name = info['name']
    1.32 +        d = defer.succeed(vm)
    1.33      vm.recreate = 0
    1.34      return d
    1.35  
    1.36 @@ -701,14 +707,17 @@ class XendDomainInfo:
    1.37              self.start_time = time.time()
    1.38          if self.restore:
    1.39              return
    1.40 +        dom = self.dom or 0
    1.41          memory = self.memory
    1.42          name = self.name
    1.43 +        # If the name is over the xen limit, use the end of it.
    1.44 +        if len(name) > MAX_DOMAIN_NAME:
    1.45 +            name = name[-MAX_DOMAIN_NAME:]
    1.46          try:
    1.47              cpu = int(sxp.child_value(self.config, 'cpu', '-1'))
    1.48          except:
    1.49              raise VmError('invalid cpu')
    1.50          cpu_weight = self.cpu_weight
    1.51 -        dom = self.dom or 0
    1.52          dom = xc.domain_create(dom= dom, mem_kb= memory * 1024,
    1.53                                 name= name, cpu= cpu, cpu_weight= cpu_weight)
    1.54          if dom <= 0:
    1.55 @@ -946,7 +955,7 @@ class XendDomainInfo:
    1.56          try:
    1.57              self.restore = 1
    1.58              self.setdom(dom)
    1.59 -            self.name = d['name']
    1.60 +            #self.name = d['name']
    1.61              self.memory = d['mem_kb']/1024
    1.62              deferred = self.construct(config)
    1.63          finally: