[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 2/2] migration: unix migration should obey autos
From: |
Juan Quintela |
Subject: |
[Qemu-devel] Re: [PATCH 2/2] migration: unix migration should obey autostart are the other ones |
Date: |
Thu, 11 Mar 2010 21:42:48 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Anthony Liguori <address@hidden> 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<address@hidden>
>> ---
>> 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);
>>