diff mbox

[2/2] migration: unix migration should obey autostart are the other ones

Message ID df010a71b58fcd4ae080fed1652daef2a74b1ec2.1268176134.git.quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela March 9, 2010, 11:10 p.m. UTC
This was the only incoming migration without autostart check

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration-unix.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

Anthony Liguori March 11, 2010, 8:27 p.m. UTC | #1
On 03/09/2010 05:10 PM, Juan Quintela wrote:
> This was the only incoming migration without autostart check
>
> Signed-off-by: Juan Quintela<quintela@redhat.com>
> ---
>   migration-unix.c |    2 ++
>   1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/migration-unix.c b/migration-unix.c
> index ce59a2a..49de1b9 100644
> --- a/migration-unix.c
> +++ b/migration-unix.c
> @@ -176,6 +176,8 @@ static void unix_accept_incoming_migration(void *opaque)
>       qemu_announce_self();
>       DPRINTF("successfully loaded vm state\n");
>
> +    if (autostart)
> +        vm_start();
>    

Maybe a better thing to do is make accept_incoming_migration return an 
error code and do the vm_start in common code.

Regards,

Anthony Liguori

>   out_fopen:
>       qemu_fclose(f);
>
Juan Quintela March 11, 2010, 8:42 p.m. UTC | #2
Anthony Liguori <anthony@codemonkey.ws> wrote:
> On 03/09/2010 05:10 PM, Juan Quintela wrote:
>> This was the only incoming migration without autostart check
>>
>> Signed-off-by: Juan Quintela<quintela@redhat.com>
>> ---
>>   migration-unix.c |    2 ++
>>   1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/migration-unix.c b/migration-unix.c
>> index ce59a2a..49de1b9 100644
>> --- a/migration-unix.c
>> +++ b/migration-unix.c
>> @@ -176,6 +176,8 @@ static void unix_accept_incoming_migration(void *opaque)
>>       qemu_announce_self();
>>       DPRINTF("successfully loaded vm state\n");
>>
>> +    if (autostart)
>> +        vm_start();
>>    
>
> Maybe a better thing to do is make accept_incoming_migration return an
> error code and do the vm_start in common code.

It is uglier than that (got the ones from migration-fd but idea is the
same, removed uinteresting bits)

static void fd_accept_incoming_migration(void *opaque)
{
    ret = qemu_loadvm_state(f);
    ....
    if (autostart)
        vm_start();
    ....
}

int fd_start_incoming_migration(const char *infd)
{
    ....
    qemu_set_fd_handler2(fd, NULL, fd_accept_incoming_migration, NULL,
			 (void *)(unsigned long)f);

    return 0;
}

function call chain is:

main() ->
qemu_start_incoming_migration() ->
fd_start_migration() ->

here they got an fd, and call fd_accept_incoming_migration asyncronously
on that fd.  We can't call vm_start() until migration finish.  And we
have gone async a long time ago.

As a related note, you can see that exec_accept_incoming_migration() is
identical to fd_start_incoming_migration().  I was going to share the
code for all migrations until I found that unix & tcp migration do the
accept also asynchronously, breaking the common function.

My plan was to make the accept in {unix,tcp}_start_incoming_migration()
and then have a shared qemu_accept_incoming_migration() for all four
kinds of migration.

Notice that it don't make sense to make the accept async, because qemu
is not going to do _anything_ until incoming migration is finished,
anyways.  Just didn't want to merge the bugfix with the other change.

Later, Juan.


> Regards,
>
> Anthony Liguori
>
>>   out_fopen:
>>       qemu_fclose(f);
>>
diff mbox

Patch

diff --git a/migration-unix.c b/migration-unix.c
index ce59a2a..49de1b9 100644
--- a/migration-unix.c
+++ b/migration-unix.c
@@ -176,6 +176,8 @@  static void unix_accept_incoming_migration(void *opaque)
     qemu_announce_self();
     DPRINTF("successfully loaded vm state\n");

+    if (autostart)
+        vm_start();

 out_fopen:
     qemu_fclose(f);