ia64/xen-unstable

changeset 7021:eba5afe9aa37

A number of changes to get save-restore working again:

Fix the use of configuration inside domain_configure. The config written by
XendDomainInfo.sxpr has moved, and this function needs to change to match.

Re-add a call to _add_domain inside domain_restore.

Inside XendDomainInfo.restore, perform the appropriate configuration to restore
the domain.

Validate maxmem_KiB, and cap it at memory_KiB if over that value. Save
requires that value to be correct, as the logic for saving only the pages
in use is not in place inside Xen.

Output the device configuration in sxpr(), as required for save-restore.

Check for image being null when trying to call createDeviceModel -- configure
is called on restore as well as create, and the ImageHandler instance is not
present in the former.

Remove dead code create_blkif.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@ewan
date Thu Sep 22 16:05:44 2005 +0100 (2005-09-22)
parents 4cff74aa6246
children 10759a44ce3b
files tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/image.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomain.py	Thu Sep 22 14:01:01 2005 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Thu Sep 22 16:05:44 2005 +0100
     1.3 @@ -299,13 +299,12 @@ class XendDomain:
     1.4                             [dominfo.getName(), dominfo.getDomain(), "fail"])
     1.5          return dominfo
     1.6  
     1.7 -    def domain_configure(self, vmconfig):
     1.8 +    def domain_configure(self, config):
     1.9          """Configure an existing domain. This is intended for internal
    1.10          use by domain restore and migrate.
    1.11  
    1.12          @param vmconfig: vm configuration
    1.13          """
    1.14 -        config = sxp.child_value(vmconfig, 'config')
    1.15          return XendDomainInfo.restore(self.dbmap.getPath(), config)
    1.16  
    1.17      def domain_restore(self, src, progress=False):
    1.18 @@ -317,7 +316,9 @@ class XendDomain:
    1.19  
    1.20          try:
    1.21              fd = os.open(src, os.O_RDONLY)
    1.22 -            return XendCheckpoint.restore(self, fd)
    1.23 +            dominfo = XendCheckpoint.restore(self, fd)
    1.24 +            self._add_domain(dominfo)
    1.25 +            return dominfo
    1.26          except OSError, ex:
    1.27              raise XendError("can't read guest state file %s: %s" %
    1.28                              (src, ex[1]))
    1.29 @@ -502,7 +503,7 @@ class XendDomain:
    1.30          """
    1.31  
    1.32          if domid == PRIV_DOMAIN:
    1.33 -            raise XendError("Cannot destroy priviliged domain %i" % domid)
    1.34 +            raise XendError("Cannot destroy privileged domain %i" % domid)
    1.35          
    1.36          self.domain_restart_schedule(domid, reason, force=True)
    1.37          dominfo = self.domain_lookup(domid)
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Thu Sep 22 14:01:01 2005 +0100
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Sep 22 16:05:44 2005 +0100
     2.3 @@ -172,7 +172,7 @@ class XendDomainInfo:
     2.4          @param uuid:      uuid to use
     2.5          """
     2.6          
     2.7 -        log.debug("XendDomainInfo.restore(%s, ..., %s)", dompath, uuid)
     2.8 +        log.debug("XendDomainInfo.restore(%s, %s, %s)", dompath, config, uuid)
     2.9  
    2.10          if not uuid:
    2.11              uuid = getUuid()
    2.12 @@ -187,6 +187,9 @@ class XendDomainInfo:
    2.13          vm = cls(uuid, dompath, cls.parseConfig(config),
    2.14                   xc.domain_create(ssidref = ssidref))
    2.15          vm.clear_shutdown()
    2.16 +        vm.create_channel()
    2.17 +        vm.configure()
    2.18 +        vm.exportToDB()
    2.19          return vm
    2.20  
    2.21      restore = classmethod(restore)
    2.22 @@ -382,6 +385,9 @@ class XendDomainInfo:
    2.23              if not self.info['maxmem_KiB']:
    2.24                  self.info['maxmem_KiB'] = 1 << 30
    2.25  
    2.26 +            if self.info['maxmem_KiB'] > self.info['memory_KiB']:
    2.27 +                self.info['maxmem_KiB'] = self.info['memory_KiB']
    2.28 +
    2.29              # Validate the given backend names.
    2.30              for s in self.info['backend']:
    2.31                  if s not in backendFlags:
    2.32 @@ -607,6 +613,10 @@ class XendDomainInfo:
    2.33          if self.info:
    2.34              sxpr.append(['maxmem', self.info['maxmem_KiB'] / 1024])
    2.35  
    2.36 +            if self.infoIsSet('device'):
    2.37 +                for (n, c) in self.info['device']:
    2.38 +                    sxpr.append(['device', c])
    2.39 +
    2.40              def stateChar(name):
    2.41                  if name in self.info:
    2.42                      if self.info[name]:
    2.43 @@ -864,7 +874,8 @@ class XendDomainInfo:
    2.44          """
    2.45          if not self.rebooting():
    2.46              self.create_configured_devices()
    2.47 -        self.image.createDeviceModel()
    2.48 +        if self.image:
    2.49 +            self.image.createDeviceModel()
    2.50  
    2.51      def device_create(self, dev_config):
    2.52          """Create a new device.
    2.53 @@ -979,15 +990,6 @@ class XendDomainInfo:
    2.54          """
    2.55          self.configure_maxmem()
    2.56          self.create_devices()
    2.57 -        self.create_blkif()
    2.58 -
    2.59 -    def create_blkif(self):
    2.60 -        """Create the block device interface (blkif) for the vm.
    2.61 -        The vm needs a blkif even if it doesn't have any disks
    2.62 -        at creation time, for example when it uses NFS root.
    2.63 -
    2.64 -        """
    2.65 -        return
    2.66  
    2.67  
    2.68      def configure_maxmem(self):