Commit 89befdd1a6b18215153b8976682d57b7d03d5782

Authored by Paolo Bonzini
Committed by Anthony Liguori
1 parent 8167ee88

honor -S on incoming migration

-S is not honored by qemu on incoming migration.  If a domain is migrated
while paused, thus, it will start running on the remote machine; this
is wrong.

Given the trivial patch to fix this, it looks more like a thinko
than anything else, probably dating back to the qemu-kvm merge.
The interesting part is that the -S mechanism was in fact *used* when
migrating (setting autostart = 0) and the incoming migration code was
starting the VM at the end of the migration.

Since I was removing the vm_start from there, I also corrected a related
imprecision.  The code was doing a vm_stop "just in case", but we can
be sure that the VM is not running---the vm_start call in vl.c has not
been reached yet.  So the vm_stop is removed together with the vm_start.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
migration-exec.c
@@ -109,7 +109,6 @@ static void exec_accept_incoming_migration(void *opaque) @@ -109,7 +109,6 @@ static void exec_accept_incoming_migration(void *opaque)
109 QEMUFile *f = opaque; 109 QEMUFile *f = opaque;
110 int ret; 110 int ret;
111 111
112 - vm_stop(0); /* just in case */  
113 ret = qemu_loadvm_state(f); 112 ret = qemu_loadvm_state(f);
114 if (ret < 0) { 113 if (ret < 0) {
115 fprintf(stderr, "load of migration failed\n"); 114 fprintf(stderr, "load of migration failed\n");
@@ -119,7 +118,6 @@ static void exec_accept_incoming_migration(void *opaque) @@ -119,7 +118,6 @@ static void exec_accept_incoming_migration(void *opaque)
119 dprintf("successfully loaded vm state\n"); 118 dprintf("successfully loaded vm state\n");
120 /* we've successfully migrated, close the fd */ 119 /* we've successfully migrated, close the fd */
121 qemu_set_fd_handler2(qemu_popen_fd(f), NULL, NULL, NULL, NULL); 120 qemu_set_fd_handler2(qemu_popen_fd(f), NULL, NULL, NULL, NULL);
122 - vm_start();  
123 121
124 err: 122 err:
125 qemu_fclose(f); 123 qemu_fclose(f);
migration-tcp.c
@@ -155,7 +155,6 @@ static void tcp_accept_incoming_migration(void *opaque) @@ -155,7 +155,6 @@ static void tcp_accept_incoming_migration(void *opaque)
155 goto out; 155 goto out;
156 } 156 }
157 157
158 - vm_stop(0); /* just in case */  
159 ret = qemu_loadvm_state(f); 158 ret = qemu_loadvm_state(f);
160 if (ret < 0) { 159 if (ret < 0) {
161 fprintf(stderr, "load of migration failed\n"); 160 fprintf(stderr, "load of migration failed\n");
@@ -168,8 +167,6 @@ static void tcp_accept_incoming_migration(void *opaque) @@ -168,8 +167,6 @@ static void tcp_accept_incoming_migration(void *opaque)
168 qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL); 167 qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
169 close(s); 168 close(s);
170 169
171 - vm_start();  
172 -  
173 out_fopen: 170 out_fopen:
174 qemu_fclose(f); 171 qemu_fclose(f);
175 out: 172 out:
@@ -6070,10 +6070,8 @@ int main(int argc, char **argv, char **envp) @@ -6070,10 +6070,8 @@ int main(int argc, char **argv, char **envp)
6070 if (loadvm) 6070 if (loadvm)
6071 do_loadvm(cur_mon, loadvm); 6071 do_loadvm(cur_mon, loadvm);
6072 6072
6073 - if (incoming) {  
6074 - autostart = 0; /* fixme how to deal with -daemonize */ 6073 + if (incoming)
6075 qemu_start_incoming_migration(incoming); 6074 qemu_start_incoming_migration(incoming);
6076 - }  
6077 6075
6078 if (autostart) 6076 if (autostart)
6079 vm_start(); 6077 vm_start();