From nobody Tue Feb 10 07:40:12 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1616777467; cv=none; d=zohomail.com; s=zohoarc; b=RLdjjW0wtdIiCJjZsR5SdKk8HVM0SCg1h0wszBAnJ95M/ff8TCWvjF8Ad7iNYNlHulYqrLLAyPwN3DvHqU0QtcgytnqPEQ5OhxBlXUeNhP64o52JnxCi4Wpnporw9ZDgyh1zuf8mjqudHTDe/fJWyblFGaIcH2l5Trq8MPxStr8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616777467; h=Content-Type:Content-Transfer-Encoding:Cc: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=xWGaTHvGUXR6qcfJjb5jjYIOFSknL9umRWV7ko2g6m0=; b=MRWS2z1iQ/RrhGKJ4ArrZnVfTXp9pXFP6UNvJjhzpjokuoUzGErZnOsEc2IrTBhPosLMXnY5HZMWH5m8uGMXzlVnLy4dMrbJ3+BLT5fPEm8/vN3u+EH61d46VF6xXMYeNOSwcMOCVf6YMWZmdOtzAwLNGj/ilqk+FauxGCF44PY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1616777467228637.2765656085758; Fri, 26 Mar 2021 09:51:07 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-231-nFpiBCPNOuihBAb4YjedAQ-1; Fri, 26 Mar 2021 12:49:19 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6C62B107BEFA; Fri, 26 Mar 2021 16:49:11 +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 43C47226FC; Fri, 26 Mar 2021 16:49:11 +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 ED37A180214A; Fri, 26 Mar 2021 16:49:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12QGmgQ9003092 for ; Fri, 26 Mar 2021 12:48:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3AEED5D755; Fri, 26 Mar 2021 16:48:42 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-113-51.phx2.redhat.com [10.3.113.51]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0337E5D72E; Fri, 26 Mar 2021 16:48:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616777466; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=xWGaTHvGUXR6qcfJjb5jjYIOFSknL9umRWV7ko2g6m0=; b=NcYikw4rvMYyPGRCchLgHeZ/GcTPpMK81eXP5veH5iUfYbHfFJjof06RPYBkTKOqhJtwAE 8COUcM0RiilUSIowLWpeTM4RjvulV+xyQrjJXhuNL/xiZnCY+Z2kYp37g3FPWDpXtvUo7/ 0Wq91AesrqgCky0UbIJSBTHU1v6rOfA= X-MC-Unique: nFpiBCPNOuihBAb4YjedAQ-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v6 25/30] nodedev: add element to mdev caps Date: Fri, 26 Mar 2021 11:48:21 -0500 Message-Id: <20210326164826.1720062-26-jjongsma@redhat.com> In-Reply-To: <20210326164826.1720062-1-jjongsma@redhat.com> References: <20210326164826.1720062-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: eskultet@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.79 on 10.5.11.13 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) Content-Type: text/plain; charset="utf-8" It will be useful to be able to specify a particular UUID for a mediated device when defining the node device. To accomodate that, allow this to be specified in the xml schema. This patch also parses and formats that value to the xml, but does not yet use it. Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- docs/schemas/nodedev.rng | 43 +++++++++++-------- src/conf/node_device_conf.c | 14 ++++++ .../mdevctl-list-multiple.out.xml | 4 ++ 3 files changed, 43 insertions(+), 18 deletions(-) diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng index 5840dc9f0d..777227c38a 100644 --- a/docs/schemas/nodedev.rng +++ b/docs/schemas/nodedev.rng @@ -606,27 +606,34 @@ =20 - - mdev - - - - + + + mdev - - - - - + + + - - - - - - - + + + + + + + + + + + + + + + + + + + =20 diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index b1739ceb01..d167da6171 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -527,6 +527,7 @@ virNodeDeviceCapMdevDefFormat(virBufferPtr buf, size_t i; =20 virBufferEscapeString(buf, "\n", data->mdev.type); + virBufferEscapeString(buf, "%s\n", data->mdev.uuid); virBufferAsprintf(buf, "\n", data->mdev.iommuGroupNumber); =20 @@ -1948,6 +1949,7 @@ virNodeDevCapMdevParseXML(xmlXPathContextPtr ctxt, int nattrs =3D 0; g_autofree xmlNodePtr *attrs =3D NULL; size_t i; + g_autofree char *uuidstr =3D NULL; =20 ctxt->node =3D node; =20 @@ -1957,6 +1959,18 @@ virNodeDevCapMdevParseXML(xmlXPathContextPtr ctxt, return -1; } =20 + if ((uuidstr =3D virXPathString("string(./uuid[1])", ctxt))) { + unsigned char uuidbuf[VIR_UUID_BUFLEN]; + /* make sure that the provided uuid is valid */ + if (virUUIDParse(uuidstr, uuidbuf) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid uuid '%s' for new mdev device"), uui= dstr); + return -1; + } + mdev->uuid =3D g_new0(char, VIR_UUID_STRING_BUFLEN); + virUUIDFormat(uuidbuf, mdev->uuid); + } + /* 'iommuGroup' is optional, only report an error if the supplied valu= e is * invalid (-2), not if it's missing (-1) */ if (virXPathUInt("number(./iommuGroup[1]/@number)", diff --git a/tests/nodedevmdevctldata/mdevctl-list-multiple.out.xml b/tests= /nodedevmdevctldata/mdevctl-list-multiple.out.xml index 543ad916b7..cf7e966256 100644 --- a/tests/nodedevmdevctldata/mdevctl-list-multiple.out.xml +++ b/tests/nodedevmdevctldata/mdevctl-list-multiple.out.xml @@ -3,6 +3,7 @@ 0000:00:02.0 + 200f228a-c80a-4d50-bfb7-f5a0e4e34045 @@ -11,6 +12,7 @@ 0000:00:02.0 + de807ffc-1923-4d5f-b6c9-b20ecebc6d4b @@ -19,6 +21,7 @@ 0000:00:02.0 + 435722ea-5f43-468a-874f-da34f1217f13 @@ -28,6 +31,7 @@ matrix + 783e6dbb-ea0e-411f-94e2-717eaad438bf --=20 2.26.3