Am 08.09.26 um 4:22 PM schrieb Fiona Ebner:
> Am 07.09.26 um 11:49 AM schrieb Erik Fastermann:
>> @@ -230,6 +231,24 @@ index 0000000000..56c60b345f
>> + return snap_state.state == SAVE_STATE_COMPLETED &&
>> snap_state.skip_vm_start;
>> +}
>> +
>> ++static void restore_vm_old_state(void)
>> ++{
>> ++ RunState old_state = snap_state.vm_old_state;
>> ++
>> ++ if (old_state == RUN_STATE__MAX) {
>> ++ return;
>> ++ }
>> ++ snap_state.vm_old_state = RUN_STATE__MAX;
>> ++
>> ++ if (runstate_is_live(old_state)) {
>> ++ if (!should_skip_vm_start() &&
>> !runstate_check(RUN_STATE_SHUTDOWN)) {
>> ++ vm_start();
>> ++ }
>> ++ } else if (runstate_check(RUN_STATE_FINISH_MIGRATE)) {
>
> I'd prefer this condition to be dropped or extended to also check for
> RUN_STATE_SAVE_VM. Because when not using a statefile, we call
> vm_stop(RUN_STATE_SAVE_VM) and do not set the state to
> RUN_STATE_FINISH_MIGRATE. It might be fine in practice, because if the
> runstate was not live, then RUN_STATE_SAVE_VM is not actually applied,
> as vm_stop() skips setting the state if already not live. But still, it
> would be good to be explicit about it.
According to the RunStateTransition struct in system/runstate.c,
RUN_STATE_SAVE_VM cannot go back to RUN_STATE_PAUSED. So my suggested
check would be confusing too. Maybe we can just keep it as is, but we
should add a code comment where we (attempt to) set RUN_STATE_SAVE_VM,
that this does not apply if already in a non-live state.