ia64/xen-unstable

changeset 2163:92bb28b18ae7

bitkeeper revision 1.1159.14.4 (4118d2b68g453DSG6YDQBLmCyvKVgA)

Sundry fixes to domain restore.
author mjw@wray-m-3.hpl.hp.com
date Tue Aug 10 13:50:46 2004 +0000 (2004-08-10)
parents 4af7ef741f16
children 01bf507e2306
files tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xm/main.py tools/xfrd/xen_domain.c
line diff
     1.1 --- a/tools/python/xen/xend/XendDomain.py	Tue Aug 10 13:21:15 2004 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Tue Aug 10 13:50:46 2004 +0000
     1.3 @@ -375,7 +375,7 @@ class XendDomain:
     1.4          def cbok(dominfo):
     1.5              self._add_domain(dominfo)
     1.6              return dominfo
     1.7 -        deferred = dominfo.construct(config)
     1.8 +        deferred = dominfo.dom_construct(dominfo.dom, config)
     1.9          deferred.addCallback(cbok)
    1.10          return deferred
    1.11      
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Tue Aug 10 13:21:15 2004 +0000
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Aug 10 13:50:46 2004 +0000
     2.3 @@ -295,7 +295,6 @@ def vm_restore(src, progress=0):
     2.4      raises   VmError for invalid configuration
     2.5      """
     2.6      vm = XendDomainInfo()
     2.7 -    vm.restore = 1
     2.8      ostype = "linux" #todo Set from somewhere (store in the src?).
     2.9      restorefn = getattr(xc, "%s_restore" % ostype)
    2.10      d = restorefn(state_file=src, progress=progress)
    2.11 @@ -304,11 +303,10 @@ def vm_restore(src, progress=0):
    2.12          raise VmError('restore failed')
    2.13      try:
    2.14          vmconfig = sxp.from_string(d['vmconfig'])
    2.15 -        vm.config = sxp.child_value(vmconfig, 'config')
    2.16 +        config = sxp.child_value(vmconfig, 'config')
    2.17      except Exception, ex:
    2.18          raise VmError('config error: ' + str(ex))
    2.19 -    deferred = vm.dom_construct(dom)
    2.20 -    vm.restore = 0
    2.21 +    deferred = vm.dom_construct(dom, config)
    2.22      def vifs_cb(val, vm):
    2.23          vif_up(vm.ipaddrs)
    2.24      deferred.addCallback(vifs_cb, vm)
    2.25 @@ -930,7 +928,7 @@ class XendDomainInfo:
    2.26          d.addCallback(_vm_configure1, self)
    2.27          return d
    2.28  
    2.29 -    def dom_construct(self, dom):
    2.30 +    def dom_construct(self, dom, config):
    2.31          """Construct a vm for an existing domain.
    2.32  
    2.33          @param dom:    domain id
    2.34 @@ -940,6 +938,8 @@ class XendDomainInfo:
    2.35          if not d:
    2.36              raise VmError("Domain not found: %d" % dom)
    2.37          try:
    2.38 +            self.config = config
    2.39 +            self.restore = 1
    2.40              self.setdom(dom)
    2.41              self.name = d['name']
    2.42              self.memory = d['memory']/1024
    2.43 @@ -948,6 +948,7 @@ class XendDomainInfo:
    2.44                  self.destroy()
    2.45                  return err
    2.46              deferred.addErrback(cberr)
    2.47 +            self.restore = 0
    2.48          except StandardError, ex:
    2.49              self.destroy()
    2.50              raise
     3.1 --- a/tools/python/xen/xm/main.py	Tue Aug 10 13:21:15 2004 +0000
     3.2 +++ b/tools/python/xen/xm/main.py	Tue Aug 10 13:50:46 2004 +0000
     3.3 @@ -290,6 +290,9 @@ class ProgRestore(Prog):
     3.4          savefile = os.path.abspath(args[1])
     3.5          info = server.xend_domain_restore(savefile)
     3.6          PrettyPrint.prettyprint(info)
     3.7 +        id = sxp.child_value(info, 'id')
     3.8 +        if id is not None:
     3.9 +            server.xend_domain_unpause(id)
    3.10  
    3.11  xm.prog(ProgRestore)
    3.12  
     4.1 --- a/tools/xfrd/xen_domain.c	Tue Aug 10 13:21:15 2004 +0000
     4.2 +++ b/tools/xfrd/xen_domain.c	Tue Aug 10 13:50:46 2004 +0000
     4.3 @@ -127,6 +127,9 @@ int xen_domain_rcv(IOStream *io, uint32_
     4.4      ioctxt->err = iostderr;
     4.5  
     4.6      err = xc_linux_restore(xcinit(), ioctxt);
     4.7 +    *dom = ioctxt->domain;
     4.8 +    *vmconfig = ioctxt->vmconfig;
     4.9 +    *vmconfig_n = ioctxt->vmconfig_n;
    4.10  #endif   
    4.11      dprintf("< err=%d\n", err);
    4.12      return err;