From nobody Thu Sep 19 01:08:50 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 171958057127691.7957622125773; Fri, 28 Jun 2024 06:16:11 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 3E02E13E0; Fri, 28 Jun 2024 09:16:10 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 980E41499; Fri, 28 Jun 2024 09:13:04 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 356AC1430; Fri, 28 Jun 2024 09:12:59 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 A949F13EB for ; Fri, 28 Jun 2024 09:12:47 -0400 (EDT) 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-526-nIEx9YXpMH-eoXuAP-LArA-1; Fri, 28 Jun 2024 09:12:45 -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 1E24519560B4 for ; Fri, 28 Jun 2024 13:12:45 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.3.102]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 69E4419560A3 for ; Fri, 28 Jun 2024 13:12:44 +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.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,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=1719580367; 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=wcBw2lzHc+3TUhIua5H0H2txw9ygBzLFVFxIiSoCKHo=; b=SUaceYjQl6WYLcT40NT3MZRGJXrSW18Fl5lj+fhYeBTrraeggHhtfc4uOnsPLjh6lEY9Rs /zv/RjMeQfY9EaFV3dtxERztNMXFm5NEbp7cJp/QL+YgO/VCBYgrLfCbBMePmDamqifo88 FtCUiJx0N1EIeux02kc1DSwPmMBjvoY= X-MC-Unique: nIEx9YXpMH-eoXuAP-LArA-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH 4/8] domain_capabilities: Introduce netdev capabilities Date: Fri, 28 Jun 2024 15:12:33 +0200 Message-ID: <86ab9de1614e0f597d9dc5136630cd0e1c716575.1719580253.git.mprivozn@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: INEPXUGY6FWMFQU62MBD6YNVLLI2CDFM X-Message-ID-Hash: INEPXUGY6FWMFQU62MBD6YNVLLI2CDFM X-MailFrom: mprivozn@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: 1719580571719100001 Content-Type: text/plain; charset="utf-8"; x-default="true" If mgmt apps on top of libvirt want to make a decision on the backend type for (e.g. whether past is supported) we currently offer them no way to learn this fact. Domain capabilities were invented exactly for this reason. Report supported net backend types there. Now, because of backwards compatibility, specifying no backend type (which translates to VIR_DOMAIN_NET_BACKEND_DEFAULT) means "use hyperviosr's builtin SLIRP". That behaviour can not be changed. But it may happen that the hypervisor has no support for SLIRP. So we have to report it. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- docs/formatdomaincaps.rst | 25 +++++++++++++++++++++++++ src/conf/domain_capabilities.c | 13 +++++++++++++ src/conf/domain_capabilities.h | 8 ++++++++ src/conf/schemas/domaincaps.rng | 10 ++++++++++ 4 files changed, 56 insertions(+) diff --git a/docs/formatdomaincaps.rst b/docs/formatdomaincaps.rst index a2ad0acc3d..be45de8996 100644 --- a/docs/formatdomaincaps.rst +++ b/docs/formatdomaincaps.rst @@ -629,6 +629,31 @@ Crypto device capabilities are exposed under the ``cry= pto`` element. For instanc ``backendModel`` Options for the ``backendModel`` attribute of the ```= ` element. =20 +Interface device +^^^^^^^^^^^^^^^^ + +Interface device corresponds to `network interface +`__ (````) in domain XML. + +:: + + + ... + + + + default + passt + + + ... + + + +``backendType`` + Options for the ``type`` attribute of the ```` element + + Features ~~~~~~~~ =20 diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 3f2d231d1c..199bac006b 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -607,6 +607,18 @@ virDomainCapsDeviceCryptoFormat(virBuffer *buf, } =20 =20 +static void +virDomainCapsDeviceNetFormat(virBuffer *buf, + const virDomainCapsDeviceNet *interface) +{ + FORMAT_PROLOGUE(interface); + + ENUM_PROCESS(interface, backendType, virDomainNetBackendTypeToString); + + FORMAT_EPILOGUE(interface); +} + + /** * virDomainCapsFeatureGICFormat: * @buf: target buffer @@ -787,6 +799,7 @@ virDomainCapsFormat(const virDomainCaps *caps) virDomainCapsDeviceRedirdevFormat(&buf, &caps->redirdev); virDomainCapsDeviceChannelFormat(&buf, &caps->channel); virDomainCapsDeviceCryptoFormat(&buf, &caps->crypto); + virDomainCapsDeviceNetFormat(&buf, &caps->net); =20 virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "\n"); diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h index 986f3cb394..3fe62ce211 100644 --- a/src/conf/domain_capabilities.h +++ b/src/conf/domain_capabilities.h @@ -250,6 +250,13 @@ struct _virDomainCapsDeviceCrypto { virDomainCapsEnum backendModel; /* virDomainCryptoBackend */ }; =20 +STATIC_ASSERT_ENUM(VIR_DOMAIN_NET_BACKEND_LAST); +typedef struct _virDomainCapsDeviceNet virDomainCapsDeviceNet; +struct _virDomainCapsDeviceNet { + virTristateBool supported; + virDomainCapsEnum backendType; /* virDomainNetBackendType */ +}; + typedef enum { VIR_DOMAIN_CAPS_FEATURE_IOTHREADS =3D 0, VIR_DOMAIN_CAPS_FEATURE_VMCOREINFO, @@ -286,6 +293,7 @@ struct _virDomainCaps { virDomainCapsDeviceRedirdev redirdev; virDomainCapsDeviceChannel channel; virDomainCapsDeviceCrypto crypto; + virDomainCapsDeviceNet net; /* add new domain devices here */ =20 virDomainCapsFeatureGIC gic; diff --git a/src/conf/schemas/domaincaps.rng b/src/conf/schemas/domaincaps.= rng index b8115fe028..f17a4e681d 100644 --- a/src/conf/schemas/domaincaps.rng +++ b/src/conf/schemas/domaincaps.rng @@ -212,6 +212,9 @@ + + + =20 @@ -285,6 +288,13 @@ =20 + + + + + + + --=20 2.44.2