From nobody Wed Nov 27 06:52:09 2024 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 1723122144893243.5342761532412; Thu, 8 Aug 2024 06:02:24 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id CDDF91353; Thu, 8 Aug 2024 09:02:23 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 5C9D81464; Thu, 8 Aug 2024 09:01:32 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 9B1B6108B; Thu, 8 Aug 2024 09:01:26 -0400 (EDT) Received: from mx2.osci.io (francine.osci.io [8.43.85.230]) (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 13B4DE75 for ; Thu, 8 Aug 2024 09:01:26 -0400 (EDT) Received: by mx2.osci.io (Postfix, from userid 995) id E62ED3FDA8; Thu, 8 Aug 2024 08:16:52 -0400 (EDT) Received: from mx3.osci.io (carla.osci.io [IPv6:2607:f0d0:1e02:35::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-256)) (No client certificate requested) by mx2.osci.io (Postfix) with ESMTPS id A3A5C3FDB6 for ; Thu, 8 Aug 2024 08:16:48 -0400 (EDT) Received: by mx3.osci.io (Postfix, from userid 990) id B2C90306E0F0; Thu, 8 Aug 2024 06:51:13 -0500 (CDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by mx3.osci.io (Postfix) with ESMTPS id A8CB23072439 for ; Thu, 8 Aug 2024 06:51:10 -0500 (CDT) Received: from mx-prod-mc-02.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-19-JFzceVa-PyKt_msXwSkfjg-1; Thu, 08 Aug 2024 07:43:17 -0400 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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0DE9A18BC4DB for ; Thu, 8 Aug 2024 11:41:09 +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 733551955F35 for ; Thu, 8 Aug 2024 11:41:08 +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=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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=1723117684; 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=GVr2a7srIIhGpw36gwwQWxg9U8UXNFLbsRukt4Amp4Y=; b=imAN6UldUlAeRGyzxkd2kNLsW3T6V84476jQBIntw+kPzNYyh6Ut1Ac4jRbS8OB7MtHECz 6wYNWPoTbz05psQcrbo/P+C15ha3ZbRW/zzsOTy/tZ7ZMBhQw/NoSrwmfNPhuVlKbssslp 5IKgYkjOaVoz/MQyebMTq4NaDFsHXZo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723117700; 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=GVr2a7srIIhGpw36gwwQWxg9U8UXNFLbsRukt4Amp4Y=; b=UWoaiZ5l6k1aEi55k6kwPrNGIJ7EsBMsDky96SAiqB46fCNPbkEkUrzyxoHhWxQ+0qrkhY lOj+NcVzPAkRN1jgpfKSt5DEO7JjXAdAp84izm/p3xT6GEh+9+AiOk7FTv7olBiYqtmq8H J15ypGcV/M0ZD1pXGvYeb6MuO97xm8w= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723117829; 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=GVr2a7srIIhGpw36gwwQWxg9U8UXNFLbsRukt4Amp4Y=; b=AtVy7pFs/F09IcE6ozLOaMO99taKZechAA9FuZa08IJEnMTu1AjIP0Xu40iJDFRzW7Arfd xc4mg3rL+RMslOf/Z4a5/ALtbAe0bP/GBIzy1Z6Sb+UK+MrnfcQQj73QF05Hpt3HW2K6/R nhuSohSWscgZdCAcL1B0ixkIVw8QrO0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723117869; 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=GVr2a7srIIhGpw36gwwQWxg9U8UXNFLbsRukt4Amp4Y=; b=eo9F+stFnk8/b8pUFwzOAhUvke3mIKN6dEEO5Mk9VS12G6gQNFUT8il9v5Hj0vUWoAZwHP 99BLSQCX7skZGIEeUPKtHR42ecZ9xR2SPPCIhok71T9oPZ+A7WLeqp6R6d8Nz0ZnD7bBgv +o/bIrAZOuol/XgK2Oi8yi2IQ3B+xmo= X-MC-Unique: JFzceVa-PyKt_msXwSkfjg-1 From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 1/2] qemu: Add support for postcopy-recover-setup migration state Date: Thu, 8 Aug 2024 13:41:03 +0200 Message-ID: <70b11bd3158f9405153067c13261f4bb830afc9a.1723117197.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-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ZPRMBYTFGXY5OVDOXALXB627RIG3FLSD X-Message-ID-Hash: ZPRMBYTFGXY5OVDOXALXB627RIG3FLSD 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 (found 4 invalid signatures) X-ZM-MESSAGEID: 1723122146987116600 Content-Type: text/plain; charset="utf-8" This patch adds support for recognizing the new migration state reported by QEMU when post-copy recovery is requested. It is not actually used for anything yet. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- src/conf/virdomainjob.c | 1 + src/conf/virdomainjob.h | 1 + src/qemu/qemu_domain.h | 4 ++++ src/qemu/qemu_driver.c | 1 + src/qemu/qemu_migration.c | 7 +++++++ src/qemu/qemu_monitor.c | 1 + src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 1 + src/qemu/qemu_process.c | 4 ++++ 9 files changed, 21 insertions(+) diff --git a/src/conf/virdomainjob.c b/src/conf/virdomainjob.c index 38f08f1d18..2d5a857a8c 100644 --- a/src/conf/virdomainjob.c +++ b/src/conf/virdomainjob.c @@ -106,6 +106,7 @@ virDomainJobStatusToType(virDomainJobStatus status) case VIR_DOMAIN_JOB_STATUS_HYPERVISOR_COMPLETED: case VIR_DOMAIN_JOB_STATUS_POSTCOPY: case VIR_DOMAIN_JOB_STATUS_POSTCOPY_PAUSED: + case VIR_DOMAIN_JOB_STATUS_POSTCOPY_RECOVER: case VIR_DOMAIN_JOB_STATUS_PAUSED: return VIR_DOMAIN_JOB_UNBOUNDED; =20 diff --git a/src/conf/virdomainjob.h b/src/conf/virdomainjob.h index 0d62bab287..8b2dccd298 100644 --- a/src/conf/virdomainjob.h +++ b/src/conf/virdomainjob.h @@ -89,6 +89,7 @@ typedef enum { VIR_DOMAIN_JOB_STATUS_PAUSED, VIR_DOMAIN_JOB_STATUS_POSTCOPY, VIR_DOMAIN_JOB_STATUS_POSTCOPY_PAUSED, + VIR_DOMAIN_JOB_STATUS_POSTCOPY_RECOVER, VIR_DOMAIN_JOB_STATUS_COMPLETED, VIR_DOMAIN_JOB_STATUS_FAILED, VIR_DOMAIN_JOB_STATUS_CANCELED, diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index a5092dd7f0..af0bb04c45 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -199,6 +199,10 @@ struct _qemuDomainObjPrivate { * private XML. */ virBitmap *migrationCaps; =20 + /* True if QEMU supports "postcopy-recover-setup" migration state. Che= cked + * QEMU enters the state, not to be stored in private XML. */ + bool migrationRecoverSetup; + /* true if qemu-pr-helper process is running for the domain */ bool prDaemonRunning; =20 diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 736602333e..3801ad623a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -11963,6 +11963,7 @@ qemuDomainGetJobInfoMigrationStats(virDomainObj *vm, case VIR_DOMAIN_JOB_STATUS_POSTCOPY: case VIR_DOMAIN_JOB_STATUS_PAUSED: case VIR_DOMAIN_JOB_STATUS_POSTCOPY_PAUSED: + case VIR_DOMAIN_JOB_STATUS_POSTCOPY_RECOVER: if (qemuMigrationAnyFetchStats(vm, VIR_ASYNC_JOB_NONE, jobData, NULL) < 0) return -1; diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 4fd7a0aafb..4f02a9a053 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1802,6 +1802,10 @@ qemuMigrationUpdateJobType(virDomainJobData *jobData) jobData->status =3D VIR_DOMAIN_JOB_STATUS_POSTCOPY; break; =20 + case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP: + jobData->status =3D VIR_DOMAIN_JOB_STATUS_POSTCOPY_RECOVER; + break; + case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_PAUSED: jobData->status =3D VIR_DOMAIN_JOB_STATUS_POSTCOPY_PAUSED; break; @@ -1943,6 +1947,7 @@ qemuMigrationJobCheckStatus(virDomainObj *vm, case VIR_DOMAIN_JOB_STATUS_MIGRATING: case VIR_DOMAIN_JOB_STATUS_HYPERVISOR_COMPLETED: case VIR_DOMAIN_JOB_STATUS_POSTCOPY: + case VIR_DOMAIN_JOB_STATUS_POSTCOPY_RECOVER: case VIR_DOMAIN_JOB_STATUS_PAUSED: break; } @@ -2028,6 +2033,7 @@ qemuMigrationAnyCompleted(virDomainObj *vm, case VIR_DOMAIN_JOB_STATUS_MIGRATING: case VIR_DOMAIN_JOB_STATUS_POSTCOPY: case VIR_DOMAIN_JOB_STATUS_PAUSED: + case VIR_DOMAIN_JOB_STATUS_POSTCOPY_RECOVER: /* The migration was aborted by us rather than QEMU itself. */ jobData->status =3D VIR_DOMAIN_JOB_STATUS_FAILED; return -2; @@ -4669,6 +4675,7 @@ qemuMigrationSrcIsCanceled(virDomainObj *vm) =20 case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY: case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER: + case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP: case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_PAUSED: case QEMU_MONITOR_MIGRATION_STATUS_PRE_SWITCHOVER: case QEMU_MONITOR_MIGRATION_STATUS_DEVICE: diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index b1c0c6a064..7f65c23748 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -152,6 +152,7 @@ VIR_ENUM_IMPL(qemuMonitorMigrationStatus, "postcopy-active", "postcopy-paused", "postcopy-recover", + "postcopy-recover-setup", "completed", "failed", "cancelling", diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 76c859a888..57d1b45bf5 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -762,6 +762,7 @@ typedef enum { QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY, QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_PAUSED, QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER, + QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP, QEMU_MONITOR_MIGRATION_STATUS_COMPLETED, QEMU_MONITOR_MIGRATION_STATUS_ERROR, QEMU_MONITOR_MIGRATION_STATUS_CANCELLING, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 8a20ce57e6..2db38c1007 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2969,6 +2969,7 @@ qemuMonitorJSONGetMigrationStatsReply(virJSONValue *r= eply, case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY: case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_PAUSED: case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER: + case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP: case QEMU_MONITOR_MIGRATION_STATUS_COMPLETED: case QEMU_MONITOR_MIGRATION_STATUS_CANCELLING: case QEMU_MONITOR_MIGRATION_STATUS_PRE_SWITCHOVER: diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index cec739c984..a69878e8bb 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1503,6 +1503,10 @@ qemuProcessHandleMigrationStatus(qemuMonitor *mon G_= GNUC_UNUSED, } break; =20 + case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP: + priv->migrationRecoverSetup =3D true; + break; + case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER: if (virDomainObjIsFailedPostcopy(vm, vm->job)) { int eventType =3D -1; --=20 2.45.2 From nobody Wed Nov 27 06:52:09 2024 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 1723123911834225.4233939094995; Thu, 8 Aug 2024 06:31:51 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B41D912AA; Thu, 8 Aug 2024 09:31:50 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id C377CE3A; Thu, 8 Aug 2024 09:31:29 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C2B69A4C; Thu, 8 Aug 2024 09:31:26 -0400 (EDT) Received: from mx2.osci.io (francine.osci.io [8.43.85.230]) (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 EBC8B9F1 for ; Thu, 8 Aug 2024 09:31:25 -0400 (EDT) Received: by mx2.osci.io (Postfix, from userid 995) id EE1263FDA7; Thu, 8 Aug 2024 08:15:57 -0400 (EDT) Received: from mx3.osci.io (carla.osci.io [IPv6:2607:f0d0:1e02:35::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-256)) (No client certificate requested) by mx2.osci.io (Postfix) with ESMTPS id 94CCE3FD76 for ; Thu, 8 Aug 2024 08:15:53 -0400 (EDT) Received: by mx3.osci.io (Postfix, from userid 990) id 5B7C130727A4; Thu, 8 Aug 2024 06:49:11 -0500 (CDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by mx3.osci.io (Postfix) with ESMTPS id DEB863072439 for ; Thu, 8 Aug 2024 06:49:09 -0500 (CDT) 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-464-BJeHqvIhNuqWBlpPKx4VCg-1; Thu, 08 Aug 2024 07:41:47 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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 BBBFE1944A87 for ; Thu, 8 Aug 2024 11:41:46 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 49C5719560AA for ; Thu, 8 Aug 2024 11:41:46 +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=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-Greylist: delayed 302 seconds by postgrey-1.37 at francine.osci.io; Thu, 08 Aug 2024 08:15:53 EDT X-Greylist: delayed 253 seconds by postgrey-1.37 at carla.osci.io; Thu, 08 Aug 2024 06:49:09 CDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723117562; 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=fAda+ipG2Dy/GoQWz3/LtAQ8Cj1pRFMUAGRK5G5Sn3M=; b=Wr6FjezcPbVNA8ZRjRJRFrFXWHvyfGsWlNcyAyM1wsYwmRLeYSnxtdaq7580E4vixPaBfJ Xdeq6XrXkbo7GEl9XBSOTVImKyMr0bk7xn3bj/4MBsd3UKa0MNEhpaVPigDa0CsVOKHPQv C6Y3ue9mbk+cyGACfN20oPtOLgUGExw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723117577; 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=fAda+ipG2Dy/GoQWz3/LtAQ8Cj1pRFMUAGRK5G5Sn3M=; b=WXcwl0WhcewcifaYvuR8idYZZrrujda+H2mmNHjLZGimW9hMdY08oU47055w4pLMpF7NGe GUylLwKbwIVzYs7WKz+QQg1cCC4oaD6ZpF5I1ArMlKi3n9ccUS4klsriUVMD8W6XcFrV7H 8jxi/J97TkayRSFV1ZUqZsqI0FHUbPw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723117706; 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=fAda+ipG2Dy/GoQWz3/LtAQ8Cj1pRFMUAGRK5G5Sn3M=; b=giTrJb7ksgxTuRv8FY4fIufwj9qWQrTq1G0FGssiCJ1TGpaEWAIgcAMIchpXxmVAIKm5Vd xw/jIEi+/88XD1AefaG+FCkHupuQEH9L/1vbMIA1qZAplFDwRexs8bT93TXTGR2/urgT3J SLecqpvVgmVxGwr5saeBS8cztQWP8Bw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723117749; 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=fAda+ipG2Dy/GoQWz3/LtAQ8Cj1pRFMUAGRK5G5Sn3M=; b=Z1yzYE8Azvs1FQhuD7y11McsuVZl8UnxVzlDu7UkA20mwnkmMjY1YnfRQ1Ma5NGsHhSA+X ZVj9e/liIH/mFrDASvGYYcx6BgUdoPkhE+bM4Aw6RICYBLsmYxuyXmJ9tPf8GpfEWz1SU0 SjB6BTHFoASBGXASlzPbmYOEzgbMCng= X-MC-Unique: BJeHqvIhNuqWBlpPKx4VCg-1 From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 2/2] qemu: Avoid false failure when resuming post-copy migration Date: Thu, 8 Aug 2024 13:41:04 +0200 Message-ID: <16b9b585a3f67901bc1980d79988c458cf34833a.1723117197.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: EYQWAAFKNTFK2VYFBWQRZW76U2APEL73 X-Message-ID-Hash: EYQWAAFKNTFK2VYFBWQRZW76U2APEL73 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 (found 4 invalid signatures) X-ZM-MESSAGEID: 1723123912872116600 Content-Type: text/plain; charset="utf-8" Depending on timing between QEMU and libvirt an attempt to resume failed post-copy migration could immediately report a failure in post-copy phase again even though the migration actually resumed and is progressing just fine. This is caused by QEMU reporting the original migration state (i.e., postcopy-paused) until migration is successfully resumed and QEMU switches to postcopy-active. QEMU 9.1 introduced a new postcopy-recover-setup migration state which is entered immediately after requesting migration to be resumed and we can reliably wait for the migration to either continue or fail without being confused by the old state. https://issues.redhat.com/browse/RHEL-22166 Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 4f02a9a053..7f905f8584 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1962,6 +1962,7 @@ enum qemuMigrationCompletedFlags { QEMU_MIGRATION_COMPLETED_CHECK_STORAGE =3D (1 << 1), QEMU_MIGRATION_COMPLETED_POSTCOPY =3D (1 << 2), QEMU_MIGRATION_COMPLETED_PRE_SWITCHOVER =3D (1 << 3), + QEMU_MIRGATION_COMPLETED_RECOVERY =3D (1 << 4), }; =20 =20 @@ -2023,6 +2024,16 @@ qemuMigrationAnyCompleted(virDomainObj *vm, return 1; } =20 + /* When QEMU is new enough to enter postcopy-recover-setup state during + * post-copy recovery, the source waits for the recovery to start + * before letting the destination wait for migration to complete. + */ + if (flags & QEMU_MIRGATION_COMPLETED_RECOVERY && + jobData->status =3D=3D VIR_DOMAIN_JOB_STATUS_POSTCOPY) { + VIR_DEBUG("Post-copy recovery active"); + return 1; + } + if (jobData->status =3D=3D VIR_DOMAIN_JOB_STATUS_HYPERVISOR_COMPLETED) return 1; else @@ -5115,6 +5126,7 @@ qemuMigrationSrcResume(virDomainObj *vm, char **cookieout, int *cookieoutlen, qemuMigrationSpec *spec, + virConnectPtr dconn, unsigned int flags) { qemuDomainObjPrivate *priv =3D vm->privateData; @@ -5145,6 +5157,17 @@ qemuMigrationSrcResume(virDomainObj *vm, if (rc < 0) return -1; =20 + /* Wait for postcopy recovery to start (or fail) if QEMU is new enough= to + * support postcopy-recover-setup migration state. */ + if (priv->migrationRecoverSetup) { + VIR_DEBUG("Waiting for post-copy recovery to start"); + if (qemuMigrationSrcWaitForCompletion(vm, VIR_ASYNC_JOB_MIGRATION_= OUT, dconn, + QEMU_MIRGATION_COMPLETED_REC= OVERY) < 0) + return -1; + } else { + VIR_WARN("QEMU is too old, we may report a failure in post-copy ph= ase even though the migration may be running just fine"); + } + if (qemuMigrationCookieFormat(mig, driver, vm, QEMU_MIGRATION_SOURCE, cookieout, cookieoutlen, @@ -5249,7 +5272,7 @@ qemuMigrationSrcPerformNative(virQEMUDriver *driver, =20 if (flags & VIR_MIGRATE_POSTCOPY_RESUME) { ret =3D qemuMigrationSrcResume(vm, migParams, cookiein, cookieinle= n, - cookieout, cookieoutlen, &spec, flags= ); + cookieout, cookieoutlen, &spec, dconn= , flags); } else { ret =3D qemuMigrationSrcRun(driver, vm, xmlin, persist_xml, cookie= in, cookieinlen, cookieout, cookieoutlen, flags, resource, --=20 2.45.2