From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 53F0D1FF0AB for ; Wed, 09 Sep 2026 16:34:11 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 9769C215EE; Wed, 09 Sep 2026 16:34:08 +0200 (CEST) Message-ID: <0d8368d9-7238-4a9d-9c87-daf8ff5fc9e1@proxmox.com> Date: Wed, 9 Sep 2026 16:34:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH qemu v2 9/9] savevm-async: restore run state from before snapshot From: Fiona Ebner To: Erik Fastermann , pve-devel@lists.proxmox.com References: <20260907094744.131193-1-e.fastermann@proxmox.com> <20260907094744.131193-10-e.fastermann@proxmox.com> <6e21c5b8-7010-478d-b4d5-333b85b129a5@proxmox.com> Content-Language: en-US In-Reply-To: <6e21c5b8-7010-478d-b4d5-333b85b129a5@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1788964435182 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.696 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: CXDHUJZ3UV6JWRR45WQFLBGN6H52IQH4 X-Message-ID-Hash: CXDHUJZ3UV6JWRR45WQFLBGN6H52IQH4 X-MailFrom: f.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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.