ia64/xen-unstable

changeset 7025:40a0f049e344

Rename XendDomainInfo and DevController.getDomain to getDomid.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@ewan
date Thu Sep 22 17:58:43 2005 +0100 (2005-09-22)
parents f5e33f4d0238
children 2f83ff9f6bd2
files tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/image.py tools/python/xen/xend/server/DevController.py tools/python/xen/xend/server/pciif.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomain.py	Thu Sep 22 17:52:07 2005 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Thu Sep 22 17:58:43 2005 +0100
     1.3 @@ -179,13 +179,13 @@ class XendDomain:
     1.4          @param info:   domain info object
     1.5          @param notify: send a domain created event if true
     1.6          """
     1.7 -        if info.getDomain() in self.domains:
     1.8 +        if info.getDomid() in self.domains:
     1.9              notify = False
    1.10 -        self.domains[info.getDomain()] = info
    1.11 +        self.domains[info.getDomid()] = info
    1.12          info.exportToDB(save=True)
    1.13          if notify:
    1.14              eserver.inject('xend.domain.create', [info.getName(),
    1.15 -                                                  info.getDomain()])
    1.16 +                                                  info.getDomid()])
    1.17  
    1.18      def _delete_domain(self, id, notify=True):
    1.19          """Remove a domain from the tables.
    1.20 @@ -200,7 +200,7 @@ class XendDomain:
    1.21              info.delete()
    1.22              if notify:
    1.23                  eserver.inject('xend.domain.died', [info.getName(),
    1.24 -                                                    info.getDomain()])
    1.25 +                                                    info.getDomid()])
    1.26          # XXX this should not be needed
    1.27          for domdb in self.dbmap.values():
    1.28              if not domdb.has_key("xend"):
    1.29 @@ -246,11 +246,11 @@ class XendDomain:
    1.30          # Remove entries for domains that no longer exist.
    1.31          # Update entries for existing domains.
    1.32          for d in self.domains.values():
    1.33 -            info = doms.get(d.getDomain())
    1.34 +            info = doms.get(d.getDomid())
    1.35              if info:
    1.36                  d.update(info)
    1.37              elif not d.restart_pending():
    1.38 -                self._delete_domain(d.getDomain())
    1.39 +                self._delete_domain(d.getDomid())
    1.40  
    1.41      def update_domain(self, id):
    1.42          """Update information for a single domain.
    1.43 @@ -281,22 +281,22 @@ class XendDomain:
    1.44          @param dominfo: domain object
    1.45          """
    1.46          log.info("Restarting domain: name=%s id=%s", dominfo.getName(),
    1.47 -                 dominfo.getDomain())
    1.48 +                 dominfo.getDomid())
    1.49          eserver.inject("xend.domain.restart",
    1.50 -                       [dominfo.getName(), dominfo.getDomain(), "begin"])
    1.51 +                       [dominfo.getName(), dominfo.getDomid(), "begin"])
    1.52          try:
    1.53              dominfo.restart()
    1.54              log.info('Restarted domain name=%s id=%s', dominfo.getName(),
    1.55 -                     dominfo.getDomain())
    1.56 +                     dominfo.getDomid())
    1.57              eserver.inject("xend.domain.restart",
    1.58 -                           [dominfo.getName(), dominfo.getDomain(),
    1.59 +                           [dominfo.getName(), dominfo.getDomid(),
    1.60                              "success"])
    1.61 -            self.domain_unpause(dominfo.getDomain())
    1.62 +            self.domain_unpause(dominfo.getDomid())
    1.63          except Exception, ex:
    1.64              log.exception("Exception restarting domain: name=%s id=%s",
    1.65 -                          dominfo.getName(), dominfo.getDomain())
    1.66 +                          dominfo.getName(), dominfo.getDomid())
    1.67              eserver.inject("xend.domain.restart",
    1.68 -                           [dominfo.getName(), dominfo.getDomain(), "fail"])
    1.69 +                           [dominfo.getName(), dominfo.getDomid(), "fail"])
    1.70          return dominfo
    1.71  
    1.72      def domain_configure(self, config):
    1.73 @@ -386,9 +386,9 @@ class XendDomain:
    1.74          """
    1.75          dominfo = self.domain_lookup(id)
    1.76          eserver.inject('xend.domain.unpause', [dominfo.getName(),
    1.77 -                                               dominfo.getDomain()])
    1.78 +                                               dominfo.getDomid()])
    1.79          try:
    1.80 -            return xc.domain_unpause(dom=dominfo.getDomain())
    1.81 +            return xc.domain_unpause(dom=dominfo.getDomid())
    1.82          except Exception, ex:
    1.83              raise XendError(str(ex))
    1.84      
    1.85 @@ -399,9 +399,9 @@ class XendDomain:
    1.86          """
    1.87          dominfo = self.domain_lookup(id)
    1.88          eserver.inject('xend.domain.pause', [dominfo.getName(),
    1.89 -                                             dominfo.getDomain()])
    1.90 +                                             dominfo.getDomid()])
    1.91          try:
    1.92 -            return xc.domain_pause(dom=dominfo.getDomain())
    1.93 +            return xc.domain_pause(dom=dominfo.getDomid())
    1.94          except Exception, ex:
    1.95              raise XendError(str(ex))
    1.96      
    1.97 @@ -417,9 +417,9 @@ class XendDomain:
    1.98          @param reason: shutdown type: poweroff, reboot, suspend, halt
    1.99          """
   1.100          dominfo = self.domain_lookup(id)
   1.101 -        self.domain_restart_schedule(dominfo.getDomain(), reason, force=True)
   1.102 +        self.domain_restart_schedule(dominfo.getDomid(), reason, force=True)
   1.103          eserver.inject('xend.domain.shutdown', [dominfo.getName(),
   1.104 -                                                dominfo.getDomain(), reason])
   1.105 +                                                dominfo.getDomid(), reason])
   1.106          if reason == 'halt':
   1.107              reason = 'poweroff'
   1.108          val = dominfo.shutdown(reason)
   1.109 @@ -443,7 +443,7 @@ class XendDomain:
   1.110              if not dominfo.shutdown_pending:
   1.111                  # domain doesn't need shutdown
   1.112                  continue
   1.113 -            id = dominfo.getDomain()
   1.114 +            id = dominfo.getDomid()
   1.115              left = dominfo.shutdown_time_left(SHUTDOWN_TIMEOUT)
   1.116              if left <= 0:
   1.117                  # Shutdown expired - destroy domain.
   1.118 @@ -474,16 +474,16 @@ class XendDomain:
   1.119          restart = (force and reason == 'reboot') or dominfo.restart_needed(reason)
   1.120          if restart:
   1.121              log.info('Scheduling restart for domain: name=%s id=%s',
   1.122 -                     dominfo.getName(), dominfo.getDomain())
   1.123 +                     dominfo.getName(), dominfo.getDomid())
   1.124              eserver.inject("xend.domain.restart",
   1.125 -                           [dominfo.getName(), dominfo.getDomain(),
   1.126 +                           [dominfo.getName(), dominfo.getDomid(),
   1.127                              "schedule"])
   1.128              dominfo.restarting()
   1.129          else:
   1.130              log.info('Cancelling restart for domain: name=%s id=%s',
   1.131 -                     dominfo.getName(), dominfo.getDomain())
   1.132 +                     dominfo.getName(), dominfo.getDomid())
   1.133              eserver.inject("xend.domain.restart",
   1.134 -                           [dominfo.getName(), dominfo.getDomain(), "cancel"])
   1.135 +                           [dominfo.getName(), dominfo.getDomid(), "cancel"])
   1.136              dominfo.restart_cancel()
   1.137  
   1.138      def domain_restarts(self):
   1.139 @@ -493,7 +493,7 @@ class XendDomain:
   1.140          for dominfo in self.domains.values():
   1.141              if not dominfo.restart_pending():
   1.142                  continue
   1.143 -            info = doms.get(dominfo.getDomain())
   1.144 +            info = doms.get(dominfo.getDomid())
   1.145              if info:
   1.146                  # Don't execute restart for domains still running.
   1.147                  continue
   1.148 @@ -578,7 +578,7 @@ class XendDomain:
   1.149          """
   1.150          dominfo = self.domain_lookup(id)
   1.151          try:
   1.152 -            return xc.domain_pincpu(dominfo.getDomain(), vcpu, cpumap)
   1.153 +            return xc.domain_pincpu(dominfo.getDomid(), vcpu, cpumap)
   1.154          except Exception, ex:
   1.155              raise XendError(str(ex))
   1.156  
   1.157 @@ -587,7 +587,7 @@ class XendDomain:
   1.158          """
   1.159          dominfo = self.domain_lookup(id)
   1.160          try:
   1.161 -            return xc.bvtsched_domain_set(dom=dominfo.getDomain(),
   1.162 +            return xc.bvtsched_domain_set(dom=dominfo.getDomid(),
   1.163                                            mcuadv=mcuadv,
   1.164                                            warpback=warpback,
   1.165                                            warpvalue=warpvalue, 
   1.166 @@ -600,7 +600,7 @@ class XendDomain:
   1.167          """
   1.168          dominfo = self.domain_lookup(id)
   1.169          try:
   1.170 -            return xc.bvtsched_domain_get(dominfo.getDomain())
   1.171 +            return xc.bvtsched_domain_get(dominfo.getDomid())
   1.172          except Exception, ex:
   1.173              raise XendError(str(ex))
   1.174      
   1.175 @@ -610,7 +610,7 @@ class XendDomain:
   1.176          """
   1.177          dominfo = self.domain_lookup(id)
   1.178          try:
   1.179 -            return xc.sedf_domain_set(dominfo.getDomain(), period, slice,
   1.180 +            return xc.sedf_domain_set(dominfo.getDomid(), period, slice,
   1.181                                        latency, extratime, weight)
   1.182          except Exception, ex:
   1.183              raise XendError(str(ex))
   1.184 @@ -620,7 +620,7 @@ class XendDomain:
   1.185          """
   1.186          dominfo = self.domain_lookup(id)
   1.187          try:
   1.188 -            return xc.sedf_domain_get(dominfo.getDomain())
   1.189 +            return xc.sedf_domain_get(dominfo.getDomid())
   1.190          except Exception, ex:
   1.191              raise XendError(str(ex))
   1.192  
   1.193 @@ -709,7 +709,7 @@ class XendDomain:
   1.194          """
   1.195          dominfo = self.domain_lookup(id)
   1.196          try:
   1.197 -            return xc.shadow_control(dominfo.getDomain(), op)
   1.198 +            return xc.shadow_control(dominfo.getDomid(), op)
   1.199          except Exception, ex:
   1.200              raise XendError(str(ex))
   1.201  
   1.202 @@ -723,7 +723,7 @@ class XendDomain:
   1.203          dominfo = self.domain_lookup(id)
   1.204          maxmem = int(mem) * 1024
   1.205          try:
   1.206 -            return xc.domain_setmaxmem(dominfo.getDomain(),
   1.207 +            return xc.domain_setmaxmem(dominfo.getDomid(),
   1.208                                         maxmem_kb = maxmem)
   1.209          except Exception, ex:
   1.210              raise XendError(str(ex))
   1.211 @@ -757,12 +757,12 @@ class XendDomain:
   1.212          """
   1.213          dominfo = self.domain_lookup(id)
   1.214          corefile = "/var/xen/dump/%s.%s.core" % (dominfo.getName(),
   1.215 -                                                 dominfo.getDomain())
   1.216 +                                                 dominfo.getDomid())
   1.217          try:
   1.218 -            xc.domain_dumpcore(dom=dominfo.getDomain(), corefile=corefile)
   1.219 +            xc.domain_dumpcore(dom=dominfo.getDomid(), corefile=corefile)
   1.220          except Exception, ex:
   1.221              log.warning("Dumpcore failed, id=%s name=%s: %s",
   1.222 -                        dominfo.getDomain(), dominfo.getName(), ex)
   1.223 +                        dominfo.getDomid(), dominfo.getName(), ex)
   1.224          
   1.225  def instance():
   1.226      """Singleton constructor. Use this instead of the class constructor.
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Thu Sep 22 17:52:07 2005 +0100
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Sep 22 17:58:43 2005 +0100
     2.3 @@ -474,7 +474,7 @@ class XendDomainInfo:
     2.4          self.domid = domid
     2.5          self.storeDom("domid", self.domid)
     2.6  
     2.7 -    def getDomain(self):
     2.8 +    def getDomid(self):
     2.9          return self.domid
    2.10  
    2.11      def setName(self, name):
     3.1 --- a/tools/python/xen/xend/image.py	Thu Sep 22 17:52:07 2005 +0100
     3.2 +++ b/tools/python/xen/xend/image.py	Thu Sep 22 17:58:43 2005 +0100
     3.3 @@ -161,14 +161,14 @@ class ImageHandler:
     3.4              raise VmError('Kernel ramdisk does not exist: %s' % self.ramdisk)
     3.5          if len(self.cmdline) >= MAX_GUEST_CMDLINE:
     3.6              log.warning('kernel cmdline too long, domain %d',
     3.7 -                        self.vm.getDomain())
     3.8 +                        self.vm.getDomid())
     3.9          
    3.10          log.info("buildDomain os=%s dom=%d vcpus=%d", self.ostype,
    3.11 -                 self.vm.getDomain(), self.vm.getVCpuCount())
    3.12 +                 self.vm.getDomid(), self.vm.getVCpuCount())
    3.13          err = self.buildDomain()
    3.14          if err != 0:
    3.15              raise VmError('Building domain failed: ostype=%s dom=%d err=%d'
    3.16 -                          % (self.ostype, self.vm.getDomain(), err))
    3.17 +                          % (self.ostype, self.vm.getDomid(), err))
    3.18  
    3.19      def getDomainMemory(self, mem):
    3.20          """@return The memory required, in KiB, by the domain to store the
    3.21 @@ -210,7 +210,7 @@ class LinuxImageHandler(ImageHandler):
    3.22          else:
    3.23              console_evtchn = 0
    3.24  
    3.25 -        log.debug("dom            = %d", self.vm.getDomain())
    3.26 +        log.debug("dom            = %d", self.vm.getDomid())
    3.27          log.debug("image          = %s", self.kernel)
    3.28          log.debug("store_evtchn   = %d", store_evtchn)
    3.29          log.debug("console_evtchn = %d", console_evtchn)
    3.30 @@ -219,7 +219,7 @@ class LinuxImageHandler(ImageHandler):
    3.31          log.debug("flags          = %d", self.flags)
    3.32          log.debug("vcpus          = %d", self.vm.getVCpuCount())
    3.33  
    3.34 -        ret = xc.linux_build(dom            = self.vm.getDomain(),
    3.35 +        ret = xc.linux_build(dom            = self.vm.getDomid(),
    3.36                               image          = self.kernel,
    3.37                               store_evtchn   = store_evtchn,
    3.38                               console_evtchn = console_evtchn,
    3.39 @@ -266,14 +266,14 @@ class VmxImageHandler(ImageHandler):
    3.40  
    3.41      def buildDomain(self):
    3.42          # Create an event channel
    3.43 -        self.device_channel = channel.eventChannel(0, self.vm.getDomain())
    3.44 +        self.device_channel = channel.eventChannel(0, self.vm.getDomid())
    3.45          log.info("VMX device model port: %d", self.device_channel.port2)
    3.46          if self.vm.store_channel:
    3.47              store_evtchn = self.vm.store_channel.port2
    3.48          else:
    3.49              store_evtchn = 0
    3.50  
    3.51 -        log.debug("dom            = %d", self.vm.getDomain())
    3.52 +        log.debug("dom            = %d", self.vm.getDomid())
    3.53          log.debug("image          = %s", self.kernel)
    3.54          log.debug("control_evtchn = %d", self.device_channel.port2)
    3.55          log.debug("store_evtchn   = %d", store_evtchn)
    3.56 @@ -284,7 +284,7 @@ class VmxImageHandler(ImageHandler):
    3.57          log.debug("flags          = %d", self.flags)
    3.58          log.debug("vcpus          = %d", self.vm.getVCpuCount())
    3.59  
    3.60 -        ret = xc.vmx_build(dom            = self.vm.getDomain(),
    3.61 +        ret = xc.vmx_build(dom            = self.vm.getDomid(),
    3.62                             image          = self.kernel,
    3.63                             control_evtchn = self.device_channel.port2,
    3.64                             store_evtchn   = store_evtchn,
    3.65 @@ -370,7 +370,7 @@ class VmxImageHandler(ImageHandler):
    3.66          elif vnc:
    3.67              ret = ret + ['-vnc', '-k', 'en-us']
    3.68          if vnc:
    3.69 -            vncport = int(self.vm.getDomain()) + 5900
    3.70 +            vncport = int(self.vm.getDomid()) + 5900
    3.71              ret = ret + ['-vncport', '%d' % vncport]
    3.72          return ret
    3.73  
    3.74 @@ -384,7 +384,7 @@ class VmxImageHandler(ImageHandler):
    3.75          vnc = self.vncParams()
    3.76          if len(vnc):
    3.77              args = args + vnc
    3.78 -        args = args + ([ "-d",  "%d" % self.vm.getDomain(),
    3.79 +        args = args + ([ "-d",  "%d" % self.vm.getDomid(),
    3.80                    "-p", "%d" % self.device_channel.port1,
    3.81                    "-m", "%s" % (self.vm.getMemoryTarget() / 1024)])
    3.82          args = args + self.dmargs
     4.1 --- a/tools/python/xen/xend/server/DevController.py	Thu Sep 22 17:52:07 2005 +0100
     4.2 +++ b/tools/python/xen/xend/server/DevController.py	Thu Sep 22 17:58:43 2005 +0100
     4.3 @@ -84,7 +84,7 @@ class DevController:
     4.4      def sxpr(self, devid):
     4.5          """@return an s-expression describing the specified device.
     4.6          """
     4.7 -        return [self.deviceClass, ['dom', self.vm.getDomain(),
     4.8 +        return [self.deviceClass, ['dom', self.vm.getDomid(),
     4.9                                     'id', devid]]
    4.10  
    4.11  
    4.12 @@ -110,11 +110,11 @@ class DevController:
    4.13          raise NotImplementedError()
    4.14  
    4.15  
    4.16 -    def getDomain(self):
    4.17 -        """Stub to {@link XendDomainInfo.getDomain}, for use by our
    4.18 +    def getDomid(self):
    4.19 +        """Stub to {@link XendDomainInfo.getDomid}, for use by our
    4.20          subclasses.
    4.21          """
    4.22 -        return self.vm.getDomain()
    4.23 +        return self.vm.getDomid()
    4.24  
    4.25  
    4.26      def allocateDeviceID(self):
    4.27 @@ -167,14 +167,14 @@ class DevController:
    4.28          
    4.29          frontDetails.update({
    4.30              'backend' : backpath,
    4.31 -            'backend-id' : "%i" % backdom.getDomain()
    4.32 +            'backend-id' : "%i" % backdom.getDomid()
    4.33              })
    4.34  
    4.35  
    4.36          backDetails.update({
    4.37              'domain' : self.vm.getName(),
    4.38              'frontend' : frontpath,
    4.39 -            'frontend-id' : "%i" % self.vm.getDomain()
    4.40 +            'frontend-id' : "%i" % self.vm.getDomid()
    4.41              })
    4.42  
    4.43          log.debug('DevController: writing %s to %s.', str(frontDetails),
     5.1 --- a/tools/python/xen/xend/server/pciif.py	Thu Sep 22 17:52:07 2005 +0100
     5.2 +++ b/tools/python/xen/xend/server/pciif.py	Thu Sep 22 17:58:43 2005 +0100
     5.3 @@ -68,7 +68,7 @@ class PciController(DevController):
     5.4          dev  = get_param('dev')
     5.5          func = get_param('func')
     5.6  
     5.7 -        rc = xc.physdev_pci_access_modify(dom    = self.getDomain(),
     5.8 +        rc = xc.physdev_pci_access_modify(dom    = self.getDomid(),
     5.9                                            bus    = bus,
    5.10                                            dev    = dev,
    5.11                                            func   = func,