From nobody Thu Jan 2 14:38:33 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1734523602496451.2774327637338; Wed, 18 Dec 2024 04:06:42 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 807B415F8; Wed, 18 Dec 2024 07:06:41 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 2EA731568; Wed, 18 Dec 2024 07:05:54 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id EDD32153B; Wed, 18 Dec 2024 07:05:48 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 5BACB153C for ; Wed, 18 Dec 2024 07:05:48 -0500 (EST) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-628-4NsYPZolM0iXK4TzLTiCxg-1; Wed, 18 Dec 2024 07:05:46 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 35F881944F07 for ; Wed, 18 Dec 2024 12:05:44 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B40A419560A2 for ; Wed, 18 Dec 2024 12:05:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734523548; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ryky3LtozljrwlDMmDL1bYT6nbzhfulrhCLvmoo/KvQ=; b=fynGD77j91Z0ibmWcKcl3Tq6HQMzqbljqApHgGnGoxaHZNz98lFS6WAh11Y09I9UCf9Pd9 qr/QBhpBerQ/+IM+Qc8CCWgtwcEIQ6KobHGRNiv4e8hd0wevUCkzpOpL9nW4Ii1f+CBciy Asbi0RpOS3iw/jaXvrsV3cRYMTDMCWU= X-MC-Unique: 4NsYPZolM0iXK4TzLTiCxg-1 X-Mimecast-MFC-AGG-ID: 4NsYPZolM0iXK4TzLTiCxg From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 1/3] qemu: Detect exit-on-error argument of migrate-incoming Date: Wed, 18 Dec 2024 13:05:36 +0100 Message-ID: <9837691abce772a5a3289b966632339bb0650db5.1734523378.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: nJPyZGTSQsp6W1Hjw7RzVBQ0YePZxHzP28cvIavM3Yg_1734523545 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: AWC7AVDLMLPQED2OHKTTOD625BMRTBO6 X-Message-ID-Hash: AWC7AVDLMLPQED2OHKTTOD625BMRTBO6 X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1734523604351116600 Content-Type: text/plain; charset="utf-8" The exit-on-error argument (added in QEMU 9.1.0) can be used to tell QEMU not to exit when incoming migration fails so that the error can be retrieved via QMP. This patch adds a new capability bit indicating support for the new argument. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 4 ++++ src/qemu/qemu_capabilities.h | 3 +++ tests/qemucapabilitiesdata/caps_9.1.0_riscv64.xml | 1 + tests/qemucapabilitiesdata/caps_9.1.0_s390x.xml | 1 + tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_9.2.0_s390x.xml | 1 + tests/qemucapabilitiesdata/caps_9.2.0_x86_64.xml | 1 + 7 files changed, 12 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index eda3e6a4df..bc765b91b2 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -722,6 +722,9 @@ VIR_ENUM_IMPL(virQEMUCaps, "virtio-ccw.loadparm", /* QEMU_CAPS_VIRTIO_CCW_DEVICE_LOADPA= RM */ "netdev-stream-reconnect-miliseconds", /* QEMU_CAPS_NETDEV_S= TREAM_RECONNECT_MILISECONDS */ "query-cpu-model-expansion.deprecated-props", /* QEMU_CAPS_Q= UERY_CPU_MODEL_EXPANSION_DEPRECATED_PROPS */ + + /* 470 */ + "migrate-incoming.exit-on-error", /* QEMU_CAPS_MIGRATE_INCOM= ING_EXIT_ON_ERROR */ ); =20 =20 @@ -1596,6 +1599,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSc= hemaQueries[] =3D { { "screendump/arg-type/format/^png", QEMU_CAPS_SCREENSHOT_FORMAT_PNG }, { "set-numa-node/arg-type/+hmat-lb", QEMU_CAPS_NUMA_HMAT }, { "query-cpu-model-expansion/ret-type/deprecated-props", QEMU_CAPS_QUE= RY_CPU_MODEL_EXPANSION_DEPRECATED_PROPS }, + { "migrate-incoming/arg-type/exit-on-error", QEMU_CAPS_MIGRATE_INCOMIN= G_EXIT_ON_ERROR }, }; =20 typedef struct _virQEMUCapsObjectTypeProps virQEMUCapsObjectTypeProps; diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 6bfe99fce4..398749a136 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -702,6 +702,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_NETDEV_STREAM_RECONNECT_MILISECONDS, /* 'reconnect-ms' optio= n for netdev stream supported */ QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_DEPRECATED_PROPS, /* query-cpu-mod= el-expansion may report deprecated CPU properties */ =20 + /* 470 */ + QEMU_CAPS_MIGRATE_INCOMING_EXIT_ON_ERROR, /* exit-on-error argument of= migrate-incoming command */ + QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; =20 diff --git a/tests/qemucapabilitiesdata/caps_9.1.0_riscv64.xml b/tests/qemu= capabilitiesdata/caps_9.1.0_riscv64.xml index 1e7b1e622b..77f4deca03 100644 --- a/tests/qemucapabilitiesdata/caps_9.1.0_riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_9.1.0_riscv64.xml @@ -168,6 +168,7 @@ + 9001000 0 v9.1.0 diff --git a/tests/qemucapabilitiesdata/caps_9.1.0_s390x.xml b/tests/qemuca= pabilitiesdata/caps_9.1.0_s390x.xml index b3265dcc18..a20b63051e 100644 --- a/tests/qemucapabilitiesdata/caps_9.1.0_s390x.xml +++ b/tests/qemucapabilitiesdata/caps_9.1.0_s390x.xml @@ -134,6 +134,7 @@ + 9001000 39100246 v9.1.0 diff --git a/tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_9.1.0_x86_64.xml index 06600f48fb..196bab7797 100644 --- a/tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml @@ -208,6 +208,7 @@ + 9001000 43100246 v9.1.0 diff --git a/tests/qemucapabilitiesdata/caps_9.2.0_s390x.xml b/tests/qemuca= pabilitiesdata/caps_9.2.0_s390x.xml index c3a9b62ec0..767a95bd3e 100644 --- a/tests/qemucapabilitiesdata/caps_9.2.0_s390x.xml +++ b/tests/qemucapabilitiesdata/caps_9.2.0_s390x.xml @@ -137,6 +137,7 @@ + 9001050 39100247 v9.1.0-1348-g11b8920ed2 diff --git a/tests/qemucapabilitiesdata/caps_9.2.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_9.2.0_x86_64.xml index 982b7ad436..4eb395b6bc 100644 --- a/tests/qemucapabilitiesdata/caps_9.2.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_9.2.0_x86_64.xml @@ -210,6 +210,7 @@ + 9001090 43100247 v9.2.0-rc0-42-g3428a3894c --=20 2.47.1 From nobody Thu Jan 2 14:38:33 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1734523626300159.4373451265859; Wed, 18 Dec 2024 04:07:06 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 3ECE915FC; Wed, 18 Dec 2024 07:07:05 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id EF1181544; Wed, 18 Dec 2024 07:05:55 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 3A701153B; Wed, 18 Dec 2024 07:05:51 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id ADF0E1539 for ; Wed, 18 Dec 2024 07:05:50 -0500 (EST) Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-692-y98cqBq5MjCzEER-1A3orw-1; Wed, 18 Dec 2024 07:05:49 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 55B971955D62 for ; Wed, 18 Dec 2024 12:05:46 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D19DA300F9B9 for ; Wed, 18 Dec 2024 12:05:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734523550; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kPEG1HF44prkPYjEYx5GHQti4xa0JK4GZvwtFsYm40g=; b=Pd0rNZ+PL93NWfqHH6HE0il8K4ZHDUxN5ZK+yJYjbTVSgxFtCz9iOXWetgDUHNF4z1Qnhb Ml80ZXhrVGt6LC2cJe8ZLHMbhIyLeG+VOHviLYJsNDdabkqvyeHbHgzjHCPphHcmwrUZas 4J8iiEWCslMoHze9Ur1cYbVB7a7hrbg= X-MC-Unique: y98cqBq5MjCzEER-1A3orw-1 X-Mimecast-MFC-AGG-ID: y98cqBq5MjCzEER-1A3orw From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 2/3] qemu: Replace qemuDomainCheckMonitor with qemuMigrationJobCheckStatus Date: Wed, 18 Dec 2024 13:05:37 +0100 Message-ID: <669e3588187a90d20e90eef2f301bb9dd380bbe0.1734523378.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: DwYWHysGDlROmxim0snWPGxwEWMLTQV7pjBxt_TMwDA_1734523548 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: FRJMN3TFYIERHLS22TETUOAJYIQRI25F X-Message-ID-Hash: FRJMN3TFYIERHLS22TETUOAJYIQRI25F X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1734523626517116600 Content-Type: text/plain; charset="utf-8" The function is only used during incoming migration in the beginning of Finish phase to detect if QEMU already died but EOF handler haven't had a chance to do its job yet. It calls query-status QMP command, but ignores the result. By calling query-migrate instead we can achieve the same functionality if QEMU is dead and even get meaningful error from "error-desc" in case the incoming migration failed and QEMU is still running. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- src/qemu/qemu_domain.c | 18 ------------------ src/qemu/qemu_domain.h | 3 --- src/qemu/qemu_migration.c | 7 ++++--- src/qemu/qemu_monitor.c | 8 -------- src/qemu/qemu_monitor.h | 1 - 5 files changed, 4 insertions(+), 33 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 3366346624..f15ba58179 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9007,24 +9007,6 @@ qemuDomainVcpuPersistOrder(virDomainDef *def) } =20 =20 -int -qemuDomainCheckMonitor(virDomainObj *vm, - virDomainAsyncJob asyncJob) -{ - qemuDomainObjPrivate *priv =3D vm->privateData; - int ret; - - if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) - return -1; - - ret =3D qemuMonitorCheck(priv->mon); - - qemuDomainObjExitMonitor(vm); - - return ret; -} - - bool qemuDomainSupportsVideoVga(const virDomainVideoDef *video, virQEMUCaps *qemuCaps) diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index e810f79599..86e24ad54b 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -968,9 +968,6 @@ bool qemuDomainVcpuHotplugIsInOrder(virDomainDef *def) void qemuDomainVcpuPersistOrder(virDomainDef *def) ATTRIBUTE_NONNULL(1); =20 -int qemuDomainCheckMonitor(virDomainObj *vm, - virDomainAsyncJob asyncJob); - bool qemuDomainSupportsVideoVga(const virDomainVideoDef *video, virQEMUCaps *qemuCaps); =20 diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 26a92d8ee2..f9f40a2b03 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -6850,10 +6850,11 @@ qemuMigrationDstFinishActive(virQEMUDriver *driver, goto error; =20 if (retcode !=3D 0) { - /* Check for a possible error on the monitor in case Finish was ca= lled - * earlier than monitor EOF handler got a chance to process the er= ror + /* Checking the migration status will read the migration error if + * set and QEMU is still alive. If the process died and EOF handler + * was not run yet, the appropriate monitor error will be set. */ - qemuDomainCheckMonitor(vm, VIR_ASYNC_JOB_MIGRATION_IN); + qemuMigrationJobCheckStatus(vm, VIR_ASYNC_JOB_MIGRATION_IN); goto error; } =20 diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index df7e0d8997..c198ddb625 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1430,14 +1430,6 @@ qemuMonitorStopCPUs(qemuMonitor *mon) } =20 =20 -int -qemuMonitorCheck(qemuMonitor *mon) -{ - bool running; - return qemuMonitorGetStatus(mon, &running, NULL); -} - - int qemuMonitorGetStatus(qemuMonitor *mon, bool *running, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index d4d9b98ba7..ac3a7b6db3 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -558,7 +558,6 @@ typedef enum { VIR_ENUM_DECL(qemuMonitorVMStatus); int qemuMonitorVMStatusToPausedReason(const char *status); =20 -int qemuMonitorCheck(qemuMonitor *mon); int qemuMonitorGetStatus(qemuMonitor *mon, bool *running, virDomainPausedReason *reason) --=20 2.47.1 From nobody Thu Jan 2 14:38:33 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1734523652630143.45519615877583; Wed, 18 Dec 2024 04:07:32 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 9678E1550; Wed, 18 Dec 2024 07:07:31 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id AB86215A0; Wed, 18 Dec 2024 07:06:04 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id C7E9E15FC; Wed, 18 Dec 2024 07:06:00 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 56DAF15AF for ; Wed, 18 Dec 2024 07:05:52 -0500 (EST) Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-519-6hoLxJtFMx-L-0V9p0RmZA-1; Wed, 18 Dec 2024 07:05:49 -0500 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3E8F91944B12 for ; Wed, 18 Dec 2024 12:05:48 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BC3A8195608A for ; Wed, 18 Dec 2024 12:05:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734523552; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LPmmwF/kwOpFaMCSX2N3SR3aL5XrvJh+KKvznguCe/0=; b=I7AcC/3PkNxyLUueit7HQzHLE4V6++xsAKaI6JUqjsi0vAxwBZNjITKz+gNJfujFF+TVMP Jv0OOeX1v61gwzUbCGgA4cbJ5KfNVl70yS/pxa2v8wYKmY07vqlATOMmblkPcauY8JpH80 ZqRjKPJIPqPkU0SdituacOUuhRA4Dcs= X-MC-Unique: 6hoLxJtFMx-L-0V9p0RmZA-1 X-Mimecast-MFC-AGG-ID: 6hoLxJtFMx-L-0V9p0RmZA From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 3/3] qemu: Call migrate-incoming with exit-on-error=false Date: Wed, 18 Dec 2024 13:05:38 +0100 Message-ID: <03f81be78e363486152dfd53af018464454bcb0d.1734523378.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: nDv_zChiM56n39aEG1INhMHQne3FhDsCGHCqCeiSLlg_1734523548 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: B2DIH6JZGNE7A2QSH6Q6PZAP6OR7BU7C X-Message-ID-Hash: B2DIH6JZGNE7A2QSH6Q6PZAP6OR7BU7C X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1734523654979116600 Content-Type: text/plain; charset="utf-8" The exit-on-error=3Dfalse argument of migrate-incoming tells the QEMU process to keep running when incoming migration fails, which helps us in two ways: 1. When migration enters Finish phase to cleanup the process, the domain might not even exist on the destination (because it has already been cleaned up by EOF monitor callback) and we would get rather unhelpful "operation failed: domain is no longer running" error message. 2. We can get the error that caused incoming migration to fail directly from QEMU via query-migrate QMP command. https://issues.redhat.com/browse/RHEL-7041 Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration.c | 9 ++++++++- src/qemu/qemu_monitor.c | 8 +++++--- src/qemu/qemu_monitor.h | 3 ++- src/qemu/qemu_monitor_json.c | 4 +++- src/qemu/qemu_monitor_json.h | 3 ++- 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index f9f40a2b03..50e350b0c4 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2378,11 +2378,18 @@ qemuMigrationDstRun(virDomainObj *vm, const char *uri, virDomainAsyncJob asyncJob) { + virTristateBool exitOnError =3D VIR_TRISTATE_BOOL_ABSENT; qemuDomainObjPrivate *priv =3D vm->privateData; int rv; =20 VIR_DEBUG("Setting up incoming migration with URI %s", uri); =20 + /* Ask QEMU not to exit on failure during incoming migration (if suppo= rted) + * so that we can properly check and report error during Finish phase. + */ + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_INCOMING_EXIT_ON_= ERROR)) + exitOnError =3D VIR_TRISTATE_BOOL_NO; + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; =20 @@ -2390,7 +2397,7 @@ qemuMigrationDstRun(virDomainObj *vm, if (rv < 0) goto exit_monitor; =20 - rv =3D qemuMonitorMigrateIncoming(priv->mon, uri); + rv =3D qemuMonitorMigrateIncoming(priv->mon, uri, exitOnError); =20 exit_monitor: qemuDomainObjExitMonitor(vm); diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index c198ddb625..ec2f166785 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3811,13 +3811,15 @@ qemuMonitorGetMemoryDeviceInfo(qemuMonitor *mon, =20 int qemuMonitorMigrateIncoming(qemuMonitor *mon, - const char *uri) + const char *uri, + virTristateBool exitOnError) { - VIR_DEBUG("uri=3D%s", uri); + VIR_DEBUG("uri=3D%s, exitOnError=3D%s", + uri, virTristateBoolTypeToString(exitOnError)); =20 QEMU_CHECK_MONITOR(mon); =20 - return qemuMonitorJSONMigrateIncoming(mon, uri); + return qemuMonitorJSONMigrateIncoming(mon, uri, exitOnError); } =20 =20 diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index ac3a7b6db3..c74892c4dc 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1294,7 +1294,8 @@ int qemuMonitorGetMemoryDeviceInfo(qemuMonitor *mon, ATTRIBUTE_NONNULL(2); =20 int qemuMonitorMigrateIncoming(qemuMonitor *mon, - const char *uri); + const char *uri, + virTristateBool exitOnError); =20 int qemuMonitorMigrateStartPostCopy(qemuMonitor *mon); =20 diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 6500e01d3f..9f417d27c6 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -7269,13 +7269,15 @@ qemuMonitorJSONFindLinkPath(qemuMonitor *mon, =20 int qemuMonitorJSONMigrateIncoming(qemuMonitor *mon, - const char *uri) + const char *uri, + virTristateBool exitOnError) { g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; =20 if (!(cmd =3D qemuMonitorJSONMakeCommand("migrate-incoming", "s:uri", uri, + "T:exit-on-error", exitOnError, NULL))) return -1; =20 diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 0214e9e9ff..2f5a021f56 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -607,7 +607,8 @@ qemuMonitorJSONFindLinkPath(qemuMonitor *mon, =20 int qemuMonitorJSONMigrateIncoming(qemuMonitor *mon, - const char *uri) + const char *uri, + virTristateBool exitOnError) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); =20 int --=20 2.47.1