From nobody Sat Jan 4 23:41:13 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 --- 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