From nobody Sat May 4 11:41:31 2024 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 Reviewed-by: Michal Privoznik --- 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 From nobody Sat May 4 11:41:31 2024 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=1639405793; cv=none; d=zohomail.com; s=zohoarc; b=lbixbbv3GLl0UtqPxsu8zVpAkLKempM1J6XHTgxGgRYJvO/IsQfS4W74s+16DaftKArW8ntZzgORNzPqNQ32R5qQQfw5sPgYUecPAeN4OfeFRJ5Gss75XSnfQb3flN1ilUJ9H1n801KLNCo+7odluNFVYyxEjoGIUXYoRB4quuk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639405793; 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=rfbw7ZNI8uL1zA8bSX4upASusfOLa2JogwiWXpuYvqE=; b=QybjNvvdX1IA75HbTsblRERMQ24uIjvVmfcaR904vVi7YneO+ZAhhEv6wnqPoxkd0EynBgFXRg10HEy4XBBYQVvhpsKAH3CH5SfWdfeznWF+y1DIqpKIZhMTBIUgO3jzU3ROi2LDtKSie1n5q6j8GN9TtuXLDL4ek6os4GlxpS0= 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 163940579324826.069996211585703; Mon, 13 Dec 2021 06:29:53 -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-152-qyWIQlcKNZWucqC5hwVE0Q-1; Mon, 13 Dec 2021 09:29:48 -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 33039190A7DC; Mon, 13 Dec 2021 14:29:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F0FBD22DFC; Mon, 13 Dec 2021 14:29:43 +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 99DC51809CB8; Mon, 13 Dec 2021 14:29:41 +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 1BDETd8D005659 for ; Mon, 13 Dec 2021 09:29:39 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9F8551F305; 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 735BD16A31 for ; Mon, 13 Dec 2021 14:29:39 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id E6A29243B97; 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=1639405792; 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=rfbw7ZNI8uL1zA8bSX4upASusfOLa2JogwiWXpuYvqE=; b=EjqQeaISnaEAfdUKyX+IccLPaoW6018vqaA+qEyQbHI17LygF+UHJVFSX4Gj4z9ktuxygI 1k4chNFFKu66LEdi3XEe1bDpEPZM3Z4ZGndrEXf8Fb34NNihZZl8tBXBUQjsR699EV4ENg np5rVheYgY19cEUH4qaE7/YEH5GHa70= X-MC-Unique: qyWIQlcKNZWucqC5hwVE0Q-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 2/2] qemu: Add support for return-path migration capability Date: Mon, 13 Dec 2021 15:29:36 +0100 Message-Id: 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: 1639405793876100004 Content-Type: text/plain; charset="utf-8" When return-path is enabled, QEMU on the source host won't report completed migration until the destination QEMU sends a confirmation it successfully loaded all data. Libvirt would detect such situation in the Finish phase and report the error read from QEMU's stderr back to the source, but using return-path could give use a bit better error reporting with an earlier restart of vCPUs on the source. The capability is only enabled when the connection between QEMU processes on the source and destination hosts is bidirectional. In other words, only when VIR_MIGRATE_TUNNELLED is not set, because our tunnel only allows one-way communication from the source to the destination. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration_params.c | 6 ++++++ src/qemu/qemu_migration_params.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index dfe0253487..d2e9c372a1 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -95,6 +95,7 @@ VIR_ENUM_IMPL(qemuMigrationCapability, "late-block-activate", "multifd", "dirty-bitmaps", + "return-path", ); =20 =20 @@ -171,6 +172,11 @@ static const qemuMigrationParamsFlagMapItem qemuMigrat= ionParamsFlagMap[] =3D { VIR_MIGRATE_PARALLEL, QEMU_MIGRATION_CAP_MULTIFD, QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION}, + + {QEMU_MIGRATION_FLAG_FORBIDDEN, + VIR_MIGRATE_TUNNELLED, + QEMU_MIGRATION_CAP_RETURN_PATH, + QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION}, }; =20 /* Translation from VIR_MIGRATE_PARAM_* typed parameters to diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_par= ams.h index f770bd2576..b4de8dda7b 100644 --- a/src/qemu/qemu_migration_params.h +++ b/src/qemu/qemu_migration_params.h @@ -40,6 +40,7 @@ typedef enum { QEMU_MIGRATION_CAP_LATE_BLOCK_ACTIVATE, QEMU_MIGRATION_CAP_MULTIFD, QEMU_MIGRATION_CAP_BLOCK_DIRTY_BITMAPS, + QEMU_MIGRATION_CAP_RETURN_PATH, =20 QEMU_MIGRATION_CAP_LAST } qemuMigrationCapability; --=20 2.34.1