From nobody Wed Nov 27 08:31:05 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 --- 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