From nobody Sun Feb 8 21:33:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639405818; cv=none; d=zohomail.com; s=zohoarc; b=W/aVTKHyhPKZJeoafgRbY3lygbqcrNQqw5aXquziuXcz5OUBQ20GzIx0kfa/sH3EIyyJh6mNOc9IjXYoc3JydlOCj5kD4lo30ldO05o8tVI9y5gfK+L1kcJ4vmbGGiI0b1o0MhEmgimkfAHr/gew05W6/pRxH3XSqGKSY6XnJZk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639405818; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1SG1G84Ib8DXLo2Ye5nxwp+AMztGnj2G13CqP8sUdf4=; b=B5/bJ5wbYmh5HQxogt2lmPJkZ/b6e7izoaSjlUAGoy08H/EMup2+L6Arv0ia3y2oNM13jMCY1ft5RdOQ3bGyWjGKanjnIctesG7E3aipkhJxnUra0dzRvF/RUgggTjrnlCKnd1cTeSvIRPHMz7qlQp7ESM/3dcT1f/kA4UjJruw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1639405818867914.6697612676757; Mon, 13 Dec 2021 06:30:18 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-342-Y7_-dO4VMCG9y0MeNTtftw-1; Mon, 13 Dec 2021 09:30:15 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DB052802C94; Mon, 13 Dec 2021 14:30:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BA52B45D9; Mon, 13 Dec 2021 14:30:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7C4AE4BB7B; Mon, 13 Dec 2021 14:30:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDETdwl005660 for ; Mon, 13 Dec 2021 09:29:39 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9F80B16A32; Mon, 13 Dec 2021 14:29:39 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.187]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 734A245D9 for ; Mon, 13 Dec 2021 14:29:39 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id E4FE0240147; Mon, 13 Dec 2021 15:29:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639405817; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=1SG1G84Ib8DXLo2Ye5nxwp+AMztGnj2G13CqP8sUdf4=; b=ZcCVBKoRDvQ8A4PNMg7NVUNrO6deOAq4qSBjsS5NhKdDOTK0jdOlwoOPjocdUo7jO63IbE MyEa+7/k4qUH3kSCyl7XRlkApp7JEfr4asttOQ0dfKxrLucmqVtx1E0HQC+rHqIBR3xoNt j6huesbYwn8yf853csRHIfJ35CkqAOQ= X-MC-Unique: Y7_-dO4VMCG9y0MeNTtftw-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 1/2] qemu: Support enabling migration caps unless a flag is used Date: Mon, 13 Dec 2021 15:29:35 +0100 Message-Id: <909db0f7569dd193ab5a4445a069d9267ea89948.1639405699.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639405820307100001 Content-Type: text/plain; charset="utf-8" So far we were enabling specific migration capabilities when a corresponding API flag is set. We need to generalize our code to be able to enable some migration capabilities unless a particular API flag is used. Signed-off-by: Jiri Denemark --- src/qemu/qemu_migration_params.c | 33 +++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index 837ee6d635..dfe0253487 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -47,6 +47,11 @@ typedef enum { QEMU_MIGRATION_PARAM_TYPE_STRING, } qemuMigrationParamType; =20 +typedef enum { + QEMU_MIGRATION_FLAG_REQUIRED, + QEMU_MIGRATION_FLAG_FORBIDDEN, +} qemuMigrationFlagMatch; + typedef struct _qemuMigrationParamValue qemuMigrationParamValue; struct _qemuMigrationParamValue { bool set; @@ -119,6 +124,7 @@ struct _qemuMigrationParamsAlwaysOnItem { =20 typedef struct _qemuMigrationParamsFlagMapItem qemuMigrationParamsFlagMapI= tem; struct _qemuMigrationParamsFlagMapItem { + qemuMigrationFlagMatch match; virDomainMigrateFlags flag; qemuMigrationCapability cap; int party; /* bit-wise OR of qemuMigrationParty */ @@ -146,19 +152,23 @@ static const qemuMigrationParamsAlwaysOnItem qemuMigr= ationParamsAlwaysOn[] =3D { =20 /* Translation from virDomainMigrateFlags to qemuMigrationCapability. */ static const qemuMigrationParamsFlagMapItem qemuMigrationParamsFlagMap[] = =3D { - {VIR_MIGRATE_RDMA_PIN_ALL, + {QEMU_MIGRATION_FLAG_REQUIRED, + VIR_MIGRATE_RDMA_PIN_ALL, QEMU_MIGRATION_CAP_RDMA_PIN_ALL, QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION}, =20 - {VIR_MIGRATE_AUTO_CONVERGE, + {QEMU_MIGRATION_FLAG_REQUIRED, + VIR_MIGRATE_AUTO_CONVERGE, QEMU_MIGRATION_CAP_AUTO_CONVERGE, QEMU_MIGRATION_SOURCE}, =20 - {VIR_MIGRATE_POSTCOPY, + {QEMU_MIGRATION_FLAG_REQUIRED, + VIR_MIGRATE_POSTCOPY, QEMU_MIGRATION_CAP_POSTCOPY, QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION}, =20 - {VIR_MIGRATE_PARALLEL, + {QEMU_MIGRATION_FLAG_REQUIRED, + VIR_MIGRATE_PARALLEL, QEMU_MIGRATION_CAP_MULTIFD, QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION}, }; @@ -553,13 +563,18 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr par= ams, return NULL; =20 for (i =3D 0; i < G_N_ELEMENTS(qemuMigrationParamsFlagMap); i++) { - qemuMigrationCapability cap =3D qemuMigrationParamsFlagMap[i].cap; + const qemuMigrationParamsFlagMapItem *item =3D &qemuMigrationParam= sFlagMap[i]; + int match; + + if (item->match =3D=3D QEMU_MIGRATION_FLAG_REQUIRED) + match =3D item->flag; + else + match =3D 0; =20 - if (qemuMigrationParamsFlagMap[i].party & party && - flags & qemuMigrationParamsFlagMap[i].flag) { + if (item->party & party && (flags & item->flag) =3D=3D match) { VIR_DEBUG("Enabling migration capability '%s'", - qemuMigrationCapabilityTypeToString(cap)); - ignore_value(virBitmapSetBit(migParams->caps, cap)); + qemuMigrationCapabilityTypeToString(item->cap)); + ignore_value(virBitmapSetBit(migParams->caps, item->cap)); } } =20 --=20 2.34.1