Commit d399f67704ddc29704e397b3e4f866a7c1052a3d

Authored by Paolo Bonzini
Committed by Anthony Liguori
1 parent 86635821

fix migration to obey -S

Since migration returns right away, starting the VM right
after calling qemu_start_incoming_migration is wrong even
if -S is not passed.  We have to do this after migration
has completed.

Cc: Glauber Costa  <glommer@redhat.com>
Cc: Anthony Liguori  <aliguori@us.ibm.com>

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
migration-exec.c
... ... @@ -118,6 +118,8 @@ static void exec_accept_incoming_migration(void *opaque)
118 118 dprintf("successfully loaded vm state\n");
119 119 /* we've successfully migrated, close the fd */
120 120 qemu_set_fd_handler2(qemu_popen_fd(f), NULL, NULL, NULL, NULL);
  121 + if (autostart)
  122 + vm_start();
121 123  
122 124 err:
123 125 qemu_fclose(f);
... ...
migration-tcp.c
... ... @@ -166,6 +166,8 @@ static void tcp_accept_incoming_migration(void *opaque)
166 166 /* we've successfully migrated, close the server socket */
167 167 qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
168 168 close(s);
  169 + if (autostart)
  170 + vm_start();
169 171  
170 172 out_fopen:
171 173 qemu_fclose(f);
... ...
sysemu.h
... ... @@ -104,6 +104,7 @@ typedef enum DisplayType
104 104 DT_NOGRAPHIC,
105 105 } DisplayType;
106 106  
  107 +extern int autostart;
107 108 extern int bios_size;
108 109 extern int cirrus_vga_enabled;
109 110 extern int std_vga_enabled;
... ...
... ... @@ -187,7 +187,7 @@ ram_addr_t ram_size;
187 187 int nb_nics;
188 188 NICInfo nd_table[MAX_NICS];
189 189 int vm_running;
190   -static int autostart;
  190 +int autostart;
191 191 static int rtc_utc = 1;
192 192 static int rtc_date_offset = -1; /* -1 means no change */
193 193 int cirrus_vga_enabled = 1;
... ... @@ -6091,7 +6091,7 @@ int main(int argc, char **argv, char **envp)
6091 6091 qemu_start_incoming_migration(incoming);
6092 6092 }
6093 6093  
6094   - if (autostart)
  6094 + else if (autostart)
6095 6095 vm_start();
6096 6096  
6097 6097 #ifndef _WIN32
... ...