From nobody Mon Feb 9 10:27:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1594938123; cv=none; d=zohomail.com; s=zohoarc; b=FzpWS8u77bhp9khGLwFWnTYznhFf92V3hOtB4I7rNju33gbJwTCpCP68eSdgU08PhdT8N69axE+1uXfZEiwBtFgGkc7x2VxRLosFkUGY4WJrVkqBxcvB3f/rMbyNQbcXKjuufUl9XnlF8S9IxkvLWbPGLcDXd/XV2Mv07cIVk9Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594938123; 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=u0aicxJaqnZNmj0bnrNeHQDasRz+wBin+Iy1uqzeWFg=; b=MuVV/UUaDnF76jZDkfWETM3VmCBM/IuT6HW/Et8nM55z4u0WytPLn/IDJND5ammgkdRAj0W4ayS0Z/VydtUu05SMabB15LVKHButqjtXCTJbulLgs8hBTgFWeb3wjoRJ+ZXZnxi/rJfYNp2wS/XkEN26jizSqGxnZ9rX+TkI70c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1594938123224544.1656760745745; Thu, 16 Jul 2020 15:22:03 -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-469-EOWdCIjGMyCkhZHyIPzGNw-1; Thu, 16 Jul 2020 18:22:00 -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 1B4EE8015FB; Thu, 16 Jul 2020 22:21:55 +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 BFA7F7B42D; Thu, 16 Jul 2020 22:21:54 +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 D049E96235; Thu, 16 Jul 2020 22:21:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06GMLosH022272 for ; Thu, 16 Jul 2020 18:21:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id D10E771664; Thu, 16 Jul 2020 22:21:50 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-112-38.phx2.redhat.com [10.3.112.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A2DF86FED1 for ; Thu, 16 Jul 2020 22:21:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594938122; 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=u0aicxJaqnZNmj0bnrNeHQDasRz+wBin+Iy1uqzeWFg=; b=fjRS4cAy5/p03tkDiSb+kNukE07nZzqHNH62PADMriY8s6tw3NilvBF5hQorbc1LcRQd1+ NJODBWEdz1d3tqIXLmflT9wGXTY6pOm1r1FaOGLbNlPjG75OTZm8fyDxd6/OZIkrNzCm2e EPP7y7LyZXVF2KuXF1HGE/GkQNsHPmU= X-MC-Unique: EOWdCIjGMyCkhZHyIPzGNw-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH 02/16] nodedev: introduce concept of 'active' node devices Date: Thu, 16 Jul 2020 17:21:32 -0500 Message-Id: <20200716222146.1241-3-jjongsma@redhat.com> In-Reply-To: <20200716222146.1241-1-jjongsma@redhat.com> References: <20200716222146.1241-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.79 on 10.5.11.13 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" we will be able to define mediated devices that can be started or stopped, so we need to be able to indicate whether the device is active or not, similar to other resources (storage pools, domains, etc.) Signed-off-by: Jonathon Jongsma --- src/conf/virnodedeviceobj.c | 14 ++++++++++++++ src/conf/virnodedeviceobj.h | 7 +++++++ src/libvirt_private.syms | 2 ++ src/node_device/node_device_udev.c | 3 +++ 4 files changed, 26 insertions(+) diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index bfd524121c..88a7746b27 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -39,6 +39,7 @@ struct _virNodeDeviceObj { virNodeDeviceDefPtr def; /* device definition */ bool skipUpdateCaps; /* whether to skip checking host c= aps, used by testdriver */ + bool active; }; =20 struct _virNodeDeviceObjList { @@ -959,3 +960,16 @@ virNodeDeviceObjSetSkipUpdateCaps(virNodeDeviceObjPtr = obj, { obj->skipUpdateCaps =3D skipUpdateCaps; } + +bool +virNodeDeviceObjIsActive(virNodeDeviceObjPtr obj) +{ + return obj->active; +} + +void +virNodeDeviceObjSetActive(virNodeDeviceObjPtr obj, + bool active) +{ + obj->active =3D active; +} diff --git a/src/conf/virnodedeviceobj.h b/src/conf/virnodedeviceobj.h index 6efdb23d36..c119f4c51f 100644 --- a/src/conf/virnodedeviceobj.h +++ b/src/conf/virnodedeviceobj.h @@ -121,3 +121,10 @@ virNodeDeviceObjSetSkipUpdateCaps(virNodeDeviceObjPtr = obj, virNodeDeviceObjPtr virNodeDeviceObjListFindMediatedDeviceByUUID(virNodeDeviceObjListPtr devs, const char *uuid); + +bool +virNodeDeviceObjIsActive(virNodeDeviceObjPtr obj); + +void +virNodeDeviceObjSetActive(virNodeDeviceObjPtr obj, + bool active); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 73b72c9e10..6e4ee1fec8 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1187,6 +1187,7 @@ virNetworkPortDefSaveStatus; # conf/virnodedeviceobj.h virNodeDeviceObjEndAPI; virNodeDeviceObjGetDef; +virNodeDeviceObjIsActive; virNodeDeviceObjListAssignDef; virNodeDeviceObjListExport; virNodeDeviceObjListFindByName; @@ -1199,6 +1200,7 @@ virNodeDeviceObjListGetParentHost; virNodeDeviceObjListNew; virNodeDeviceObjListNumOfDevices; virNodeDeviceObjListRemove; +virNodeDeviceObjSetActive; =20 =20 # conf/virnwfilterbindingdef.h diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index ff558efb83..bce5466131 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1350,6 +1350,7 @@ udevAddOneDevice(struct udev_device *device) else event =3D virNodeDeviceEventUpdateNew(objdef->name); =20 + virNodeDeviceObjSetActive(obj, true); virNodeDeviceObjEndAPI(&obj); =20 ret =3D 0; @@ -1741,6 +1742,8 @@ udevSetupSystemDev(void) if (!(obj =3D virNodeDeviceObjListAssignDef(driver->devs, def))) goto cleanup; =20 + virNodeDeviceObjSetActive(obj, true); + virNodeDeviceObjEndAPI(&obj); =20 ret =3D 0; --=20 2.21.3