From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 40FB31FF38C for ; Fri, 17 May 2024 13:39:57 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A00BF11B5A; Fri, 17 May 2024 13:40:09 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Fri, 17 May 2024 13:39:34 +0200 Message-Id: <20240517113934.232063-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.065 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [RFC qemu] savevm-async: improve check for blockers X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Same rationale as with upstream QEMU commit 5aaac46793 ("migration: savevm: consult migration blockers"), migration and (async) snapshot are essentially the same operation and thus snapshot also needs to check for migration blockers. For example, this catches passed-through PCI devices, where the driver does not support migration. However, the commit notes: > There is really no difference between live migration and savevm, except > that savevm does not require bdrv_invalidate_cache to be implemented > by all disks. However, it is unlikely that savevm is used with anything > except qcow2 disks, so the penalty is small and worth the improvement > in catching bad usage of savevm. and for Proxmox VE, suspend-to-disk with VMDK does use savevm-async and would be broken by simply using migration_is_blocked(). To keep this working, introduce a new helper that filters blockers with the prefix used by the VMDK migration blocker. The function qemu_savevm_state_blocked() is called as part of migration_is_blocked_allow_prefix() so no check is lost with this patch. Signed-off-by: Fiona Ebner --- An alternative would be to mark the VMDK blocker as a "live-migration-only" blocker and extending migration_is_blocked() or using separate helpers to check for migration and snapshot blockers differently. But that requires touching more machinery and probably needs more adaptation going forward than the approach here. migration/migration.c | 22 ++++++++++++++++++++++ migration/migration.h | 1 + migration/savevm-async.c | 7 ++++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index b8d7e471a4..6235309a00 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1897,6 +1897,28 @@ void qmp_migrate_pause(Error **errp) "during postcopy-active or postcopy-recover state"); } +/* + * HACK to allow hibernation in Proxmox VE even when VMDK image is present. + */ +bool migration_is_blocked_allow_prefix(Error **errp, const char *prefix) +{ + GSList *blockers = migration_blockers[migrate_mode()]; + + if (qemu_savevm_state_blocked(errp)) { + return true; + } + + while (blockers) { + if (!g_str_has_prefix(error_get_pretty(blockers->data), prefix)) { + error_propagate(errp, error_copy(blockers->data)); + return true; + } + blockers = g_slist_next(blockers); + } + + return false; +} + bool migration_is_blocked(Error **errp) { GSList *blockers = migration_blockers[migrate_mode()]; diff --git a/migration/migration.h b/migration/migration.h index 8045e39c26..575805a8e2 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -484,6 +484,7 @@ int migration_call_notifiers(MigrationState *s, MigrationEventType type, Error **errp); int migrate_init(MigrationState *s, Error **errp); +bool migration_is_blocked_allow_prefix(Error **errp, const char *prefix); bool migration_is_blocked(Error **errp); /* True if outgoing migration has entered postcopy phase */ bool migration_in_postcopy(void); diff --git a/migration/savevm-async.c b/migration/savevm-async.c index bf36fc06d2..33085446e1 100644 --- a/migration/savevm-async.c +++ b/migration/savevm-async.c @@ -363,7 +363,12 @@ void qmp_savevm_start(const char *statefile, Error **errp) return; } - if (qemu_savevm_state_blocked(errp)) { + /* + * The limitation for VMDK images only applies to live-migration, not + * snapshots, see commit 5aaac46793 ("migration: savevm: consult migration + * blockers"). + */ + if (migration_is_blocked_allow_prefix(errp, "The vmdk format used by node")) { return; } -- 2.39.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel