[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/5] migration: never fail in global_state_store()
|
From: |
Juan Quintela |
|
Subject: |
Re: [PATCH 2/5] migration: never fail in global_state_store() |
|
Date: |
Thu, 18 May 2023 13:18:25 +0200 |
|
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> wrote:
> Actually global_state_store() can never fail. Let's get rid of extra
> error paths.
>
> To make things clear, use new runstate_get() and use same approach for
> global_state_store() and global_state_store_running().
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
I don't know.
On one hand, you have removed a lot of code that "can't" happen.
On the other:
> +static void global_state_do_store(RunState state)
> {
> - if (!runstate_store((char *)global_state.runstate,
> - sizeof(global_state.runstate))) {
> - error_report("runstate name too big: %s", global_state.runstate);
> - trace_migrate_state_too_big();
> - return -EINVAL;
> - }
> - return 0;
> + const char *state_str = RunState_str(state);
> + assert(strlen(state_str) < sizeof(global_state.runstate));
First: g_assert() please.
Second: We try really hard not to fail during migration and get the
whole qemu back. One assert is bad. Specially in a place like this
one, where we know that nothing is broken, simpli that we can't migrate.
Later, Juan.
- [PATCH 0/5] Restore vmstate on cancelled/failed migration, Vladimir Sementsov-Ogievskiy, 2023/05/17
- [PATCH 1/5] runstate: add runstate_get(), Vladimir Sementsov-Ogievskiy, 2023/05/17
- [PATCH 2/5] migration: never fail in global_state_store(), Vladimir Sementsov-Ogievskiy, 2023/05/17
- [PATCH 4/5] migration: switch from .vm_was_running to .vm_old_state, Vladimir Sementsov-Ogievskiy, 2023/05/17
- [PATCH 3/5] runstate: drop unused runstate_store(), Vladimir Sementsov-Ogievskiy, 2023/05/17
- [PATCH 5/5] migration: restore vmstate on migration failure, Vladimir Sementsov-Ogievskiy, 2023/05/17
- Re: [PATCH 0/5] Restore vmstate on cancelled/failed migration, Juan Quintela, 2023/05/18