From nobody Mon Feb 9 09:34:26 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=1689694370; cv=none; d=zohomail.com; s=zohoarc; b=Soi8NYScQaED6eNCEkFI19UalMLojTMjXolZLsccUdWhsOOYObK0rxH8hvmlo4U6Rz34Ke99n7csFZj0B7+t7Vj9jSVu2RdcENFlHxZslnWOz8IYbJDsxH4ypdRIvgbq7yC4BfSPOku0EdotYNQd4saYyyrUsf+DbULg5gUaXnQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689694370; 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=IlxvslDRtKZGx3T73fvX99Eu5vLGDs1Bm6J+sHrIGIo=; b=OGW4q3KsTXybd33seFyu96sTJBq2wWBQyUlkfnLQeciT3dULvZteQHyXW45yVFwdPpZNz7IQfjFUtsRzcaYoOi0c2iRxnxF8SY3Pvas+dhwzMGqDHnqhIzJ93Si7QH5DQcpFSR9Pwn/6yfTNkTPc+ZmD17EGC9enMKwIzIEdMSE= 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 1689694370598371.7450572775091; Tue, 18 Jul 2023 08:32:50 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-210-rt0kmGB7PZK87wfQApXagw-1; Tue, 18 Jul 2023 11:32:46 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 19E9D18FEAB8; Tue, 18 Jul 2023 15:28:26 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 06141492B02; Tue, 18 Jul 2023 15:28:26 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C4DF5194658F; Tue, 18 Jul 2023 15:28:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 942C7194658D for ; Tue, 18 Jul 2023 15:28:24 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 68E1AF66D6; Tue, 18 Jul 2023 15:28:24 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FE6AF6CD6 for ; Tue, 18 Jul 2023 15:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689694369; 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=IlxvslDRtKZGx3T73fvX99Eu5vLGDs1Bm6J+sHrIGIo=; b=UxbKJeCQoE0A/zVxgwWMMgEMI8Ap7kbB/k4+/+HkRw8vFoTkzqF3M4TqapyPHVvJEEEMaB 5Xle7qCtGSANzo4GTFCPgAH/KIwjGdugVbJZbSp8SDm41+gW+ymEC6vsujv59drPu2Boh/ F14hXIeCrby3m6AAIhM/3f2QEnEaa7w= X-MC-Unique: rt0kmGB7PZK87wfQApXagw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 4/5] test_driver: Pass virt_type to virNodeDeviceDefParse() in testNodeDeviceCreateXML() Date: Tue, 18 Jul 2023 17:27:37 +0200 Message-ID: <25054d87fa4bf78a864fca7e5abe474d5a83d79b.1689693984.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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: 1689694371868100001 Content-Type: text/plain; charset="utf-8"; x-default="true" This brings the code closer to real implementation: nodeDeviceCreateXML(). For the unique OUI, let's take the value from tests/virrandommock.c: 100000. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/test/test_driver.c | 7 +++++-- src/util/virrandom.c | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index e7fce053b4..3767908d9d 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -7685,11 +7685,14 @@ testNodeDeviceCreateXML(virConnectPtr conn, g_autofree char *wwnn =3D NULL; g_autofree char *wwpn =3D NULL; bool validate =3D flags & VIR_NODE_DEVICE_CREATE_XML_VALIDATE; + const char *virt_type; =20 virCheckFlags(VIR_NODE_DEVICE_CREATE_XML_VALIDATE, NULL); =20 - if (!(def =3D virNodeDeviceDefParse(xmlDesc, NULL, CREATE_DEVICE, NULL= , NULL, - NULL, validate))) + virt_type =3D virConnectGetType(conn); + + if (!(def =3D virNodeDeviceDefParse(xmlDesc, NULL, CREATE_DEVICE, virt= _type, + NULL, NULL, validate))) goto cleanup; =20 /* We run this simply for validation - it essentially validates that diff --git a/src/util/virrandom.c b/src/util/virrandom.c index 38fcfbc6ba..11f3a94611 100644 --- a/src/util/virrandom.c +++ b/src/util/virrandom.c @@ -124,6 +124,7 @@ virRandomBytes(unsigned char *buf, #define VMWARE_OUI "000569" #define MICROSOFT_OUI "0050f2" #define XEN_OUI "00163e" +#define TEST_DRIVER_OUI "100000" =20 =20 int @@ -154,6 +155,8 @@ virRandomGenerateWWN(char **wwn, oui =3D VMWARE_OUI; } else if (STREQ(virt_type, "HYPER-V")) { oui =3D MICROSOFT_OUI; + } else if (STREQ(virt_type, "TEST")) { + oui =3D TEST_DRIVER_OUI; } else { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unsupported virt type")); --=20 2.41.0