Diff for /qemu/migration-tcp.c between versions 1.1 and 1.1.1.3

version 1.1, 2018/04/24 16:50:15 version 1.1.1.3, 2018/04/24 17:33:40
Line 16 Line 16
 #include "migration.h"  #include "migration.h"
 #include "qemu-char.h"  #include "qemu-char.h"
 #include "sysemu.h"  #include "sysemu.h"
 #include "console.h"  
 #include "buffered_file.h"  #include "buffered_file.h"
 #include "block.h"  #include "block.h"
   
Line 59  static void tcp_wait_for_connect(void *o Line 58  static void tcp_wait_for_connect(void *o
   
     dprintf("connect completed\n");      dprintf("connect completed\n");
     do {      do {
         ret = getsockopt(s->fd, SOL_SOCKET, SO_ERROR, &val, &valsize);          ret = getsockopt(s->fd, SOL_SOCKET, SO_ERROR, (void *) &val, &valsize);
     } while (ret == -1 && (s->get_error(s)) == EINTR);      } while (ret == -1 && (s->get_error(s)) == EINTR);
   
     if (ret < 0) {      if (ret < 0) {
Line 77  static void tcp_wait_for_connect(void *o Line 76  static void tcp_wait_for_connect(void *o
     }      }
 }  }
   
 MigrationState *tcp_start_outgoing_migration(const char *host_port,  MigrationState *tcp_start_outgoing_migration(Monitor *mon,
                                                const char *host_port,
                                              int64_t bandwidth_limit,                                               int64_t bandwidth_limit,
                                              int async)                                               int detach,
                                                int blk,
                                                int inc)
 {  {
     struct sockaddr_in addr;      struct sockaddr_in addr;
     FdMigrationState *s;      FdMigrationState *s;
Line 97  MigrationState *tcp_start_outgoing_migra Line 99  MigrationState *tcp_start_outgoing_migra
     s->mig_state.get_status = migrate_fd_get_status;      s->mig_state.get_status = migrate_fd_get_status;
     s->mig_state.release = migrate_fd_release;      s->mig_state.release = migrate_fd_release;
   
       s->mig_state.blk = blk;
       s->mig_state.shared = inc;
   
     s->state = MIG_STATE_ACTIVE;      s->state = MIG_STATE_ACTIVE;
     s->detach = !async;      s->mon = NULL;
     s->bandwidth_limit = bandwidth_limit;      s->bandwidth_limit = bandwidth_limit;
     s->fd = socket(PF_INET, SOCK_STREAM, 0);      s->fd = qemu_socket(PF_INET, SOCK_STREAM, 0);
     if (s->fd == -1) {      if (s->fd == -1) {
         qemu_free(s);          qemu_free(s);
         return NULL;          return NULL;
Line 108  MigrationState *tcp_start_outgoing_migra Line 113  MigrationState *tcp_start_outgoing_migra
   
     socket_set_nonblock(s->fd);      socket_set_nonblock(s->fd);
   
     if (s->detach == 1) {      if (!detach) {
         dprintf("detaching from monitor\n");          migrate_fd_monitor_suspend(s, mon);
         monitor_suspend();  
         s->detach = 2;  
     }      }
   
     do {      do {
Line 143  static void tcp_accept_incoming_migratio Line 146  static void tcp_accept_incoming_migratio
     int c, ret;      int c, ret;
   
     do {      do {
         c = accept(s, (struct sockaddr *)&addr, &addrlen);          c = qemu_accept(s, (struct sockaddr *)&addr, &addrlen);
     } while (c == -1 && socket_error() == EINTR);      } while (c == -1 && socket_error() == EINTR);
   
     dprintf("accepted migration\n");      dprintf("accepted migration\n");
Line 159  static void tcp_accept_incoming_migratio Line 162  static void tcp_accept_incoming_migratio
         goto out;          goto out;
     }      }
   
     vm_stop(0); /* just in case */  
     ret = qemu_loadvm_state(f);      ret = qemu_loadvm_state(f);
     if (ret < 0) {      if (ret < 0) {
         fprintf(stderr, "load of migration failed\n");          fprintf(stderr, "load of migration failed\n");
Line 171  static void tcp_accept_incoming_migratio Line 173  static void tcp_accept_incoming_migratio
     /* we've successfully migrated, close the server socket */      /* we've successfully migrated, close the server socket */
     qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);      qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
     close(s);      close(s);
       if (autostart)
     vm_start();          vm_start();
   
 out_fopen:  out_fopen:
     qemu_fclose(f);      qemu_fclose(f);
Line 191  int tcp_start_incoming_migration(const c Line 193  int tcp_start_incoming_migration(const c
         return -EINVAL;          return -EINVAL;
     }      }
   
     s = socket(PF_INET, SOCK_STREAM, 0);      s = qemu_socket(PF_INET, SOCK_STREAM, 0);
     if (s == -1)      if (s == -1)
         return -socket_error();          return -socket_error();
   

Removed from v.1.1  
changed lines
  Added in v.1.1.1.3


unix.superglobalmegacorp.com