ia64/xen-unstable

changeset 2575:05ae99de2d3f

bitkeeper revision 1.1159.96.4 (415c287dKBbK9HPtAge67WfTsJsnwQ)

Delay configuring the new domain during migration to localhost.
author mjw@wray-m-3.hpl.hp.com
date Thu Sep 30 15:38:37 2004 +0000 (2004-09-30)
parents a15ab016f0c6
children b661254cb10b 8bc05c989fb3
files tools/python/xen/xend/XendMigrate.py tools/xfrd/xen_domain.c tools/xfrd/xfrd.c
line diff
     1.1 --- a/tools/python/xen/xend/XendMigrate.py	Thu Sep 30 14:22:28 2004 +0000
     1.2 +++ b/tools/python/xen/xend/XendMigrate.py	Thu Sep 30 15:38:37 2004 +0000
     1.3 @@ -302,18 +302,18 @@ class XendMigrateInfo(XfrdInfo):
     1.4                        self.dst_port,
     1.5                        self.live ])
     1.6          
     1.7 -    def xfr_vm_suspend(self, xfrd, val):
     1.8 -        def cbok(val):
     1.9 -            # Special case for localhost: destroy devices early.
    1.10 -            if self.dst_host in ["localhost", "127.0.0.1"]:
    1.11 -                self.dominfo.restart_cancel()
    1.12 -                self.dominfo.cleanup()
    1.13 -                self.dominfo.destroy_console()
    1.14 -            return val
    1.15 +##     def xfr_vm_suspend(self, xfrd, val):
    1.16 +##         def cbok(val):
    1.17 +##             # Special case for localhost: destroy devices early.
    1.18 +##             if self.dst_host in ["localhost", "127.0.0.1"]:
    1.19 +##                 self.dominfo.restart_cancel()
    1.20 +##                 self.dominfo.cleanup()
    1.21 +##                 self.dominfo.destroy_console()
    1.22 +##             return val
    1.23              
    1.24 -        d = XfrdInfo.xfr_vm_suspend(self, xfrd, val)
    1.25 -        d.addCallback(cbok)
    1.26 -        return d
    1.27 +##         d = XfrdInfo.xfr_vm_suspend(self, xfrd, val)
    1.28 +##         d.addCallback(cbok)
    1.29 +##         return d
    1.30      
    1.31      def xfr_migrate_ok(self, xfrd, val):
    1.32          dom = int(sxp.child0(val))
     2.1 --- a/tools/xfrd/xen_domain.c	Thu Sep 30 14:22:28 2004 +0000
     2.2 +++ b/tools/xfrd/xen_domain.c	Thu Sep 30 15:38:37 2004 +0000
     2.3 @@ -138,7 +138,9 @@ int xen_domain_rcv(IOStream *io,
     2.4      ioctxt->info = iostdout;
     2.5      ioctxt->err = iostderr;
     2.6      ioctxt->configure = domain_configure;
     2.7 -    ioctxt->flags |= XCFLAGS_CONFIGURE;
     2.8 +    if(!configured){
     2.9 +        ioctxt->flags |= XCFLAGS_CONFIGURE;
    2.10 +    }
    2.11  
    2.12      err = xc_linux_restore(xcinit(), ioctxt);
    2.13      *dom = ioctxt->domain;
     3.1 --- a/tools/xfrd/xfrd.c	Thu Sep 30 14:22:28 2004 +0000
     3.2 +++ b/tools/xfrd/xfrd.c	Thu Sep 30 15:38:37 2004 +0000
     3.3 @@ -841,7 +841,14 @@ int xfr_recv(Args *args, XfrState *state
     3.4      Sxpr sxpr;
     3.5      int configured=0;
     3.6  
     3.7 -    dprintf(">\n");
     3.8 +    dprintf("> peer=%s\n", inet_ntoa(peer->addr.sin_addr));
     3.9 +    // If receiving from localhost set configured so that that xen_domain_rcv()
    3.10 +    // does not attempt to configure the new domain. This is because the old
    3.11 +    // domain still exists and will make it fail.
    3.12 +    if(peer->addr.sin_addr.s_addr == htonl(INADDR_LOOPBACK)){
    3.13 +        dprintf("> Peer is localhost\n");
    3.14 +        configured = 1;
    3.15 +    }
    3.16      err = xen_domain_rcv(peer->in,
    3.17                           &state->vmid_new,
    3.18                           &state->vmconfig, &state->vmconfig_n,
    3.19 @@ -853,6 +860,7 @@ int xfr_recv(Args *args, XfrState *state
    3.20      err = Conn_sxpr(peer, &sxpr);
    3.21      if(err) goto exit;
    3.22      if(!configured){
    3.23 +        dprintf("> Configuring...\n");
    3.24          err = xen_domain_configure(state->vmid_new, state->vmconfig, state->vmconfig_n);
    3.25          if(err) goto exit;
    3.26      }
    3.27 @@ -1213,9 +1221,11 @@ int main(int argc, char *argv[]){
    3.28      int long_index = 0;
    3.29      static const char * LOGFILE = "/var/log/xfrd.log";
    3.30  
    3.31 +#ifndef DEBUG
    3.32      freopen(LOGFILE, "w+", stdout);
    3.33      fclose(stderr);
    3.34      stderr = stdout;
    3.35 +#endif
    3.36      dprintf(">\n");
    3.37      set_defaults(args);
    3.38      while(1){