From nobody Tue Feb 10 04:13:34 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=1614724333; cv=none; d=zohomail.com; s=zohoarc; b=MWmsIfb3dNvrn2RN+SKO9yINnj1GiTl+niFnWnBoi1FqowWIp/TFak0AIRAVtNpGGjcdooax3HI32x+7HtbQBXy5r4a3Vu8rZysy+dFV6csP6OCiAvUnJ7u47NeTp9p6mQSL6dXSDB8l7IFJdRlKbkMAATe1+wAtNoeS2bdH9Ww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614724333; 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=Fyt0XdsVzrO5i5+Wg/dKv01JyVqD/Mz9we8GgdTuocQ=; b=H8u1DQQgWSdg8mzkA0kNkOSR+N3j6I5chQUQP0D3JjlBNWURHUDBevkaINllE6XCU9fwGFUuC0A5x+vY+G7n29HJqSGjCzVZ7arr26QTkrYDK1nbwOJtgae8VyZ8IEdaWE9zC63OmyUIxwGLH53DXqIB9ju0DthKPZ7qdym8rJc= 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 1614724333710134.1808413483775; Tue, 2 Mar 2021 14:32:13 -0800 (PST) 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-323-jNfFFp7rOV-xSPZIoxae7g-1; Tue, 02 Mar 2021 17:31:36 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B0A54803F48; Tue, 2 Mar 2021 22:31:30 +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 8DCF75F9A6; Tue, 2 Mar 2021 22:31:30 +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 55FF7E183; Tue, 2 Mar 2021 22:31:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 122MVAwP007720 for ; Tue, 2 Mar 2021 17:31:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id 733A760C6D; Tue, 2 Mar 2021 22:31:10 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-115-28.phx2.redhat.com [10.3.115.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2DDB060BFA; Tue, 2 Mar 2021 22:31:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614724332; 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=Fyt0XdsVzrO5i5+Wg/dKv01JyVqD/Mz9we8GgdTuocQ=; b=GyygO98aR5ss0kaUjBrzbOFFVCPk8qh7yyPMTwU9SkwmH5H7doxkeuxWADTWMevRArDwEz HmuD7KkB4Moevv1ZE3GPVrcqfDK95mBAUcoUgHJlZJRPYZsw2XMmYXJ6eZIjvXW4txajcj +6i4+l6zDA2nydrN7rRK1p+TNfEsQ74= X-MC-Unique: jNfFFp7rOV-xSPZIoxae7g-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v5 03/30] nodedev: introduce concept of 'active' node devices Date: Tue, 2 Mar 2021 16:30:38 -0600 Message-Id: <20210302223105.314580-4-jjongsma@redhat.com> In-Reply-To: <20210302223105.314580-1-jjongsma@redhat.com> References: <20210302223105.314580-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.16 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" 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 Reviewed-by: Erik Skultety --- src/conf/virnodedeviceobj.c | 16 ++++++++++++++++ src/conf/virnodedeviceobj.h | 7 +++++++ src/libvirt_private.syms | 2 ++ src/node_device/node_device_udev.c | 3 +++ 4 files changed, 28 insertions(+) diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index c9bda77b2e..7155f77a94 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 { @@ -976,3 +977,18 @@ 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 2a3bbdc577..17461bcea0 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1265,6 +1265,7 @@ virNetworkPortDefSaveStatus; # conf/virnodedeviceobj.h virNodeDeviceObjEndAPI; virNodeDeviceObjGetDef; +virNodeDeviceObjIsActive; virNodeDeviceObjListAssignDef; virNodeDeviceObjListExport; virNodeDeviceObjListFindByName; @@ -1277,6 +1278,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 09048fb23f..3bae579a6c 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1539,6 +1539,7 @@ udevAddOneDevice(struct udev_device *device) else event =3D virNodeDeviceEventUpdateNew(objdef->name); =20 + virNodeDeviceObjSetActive(obj, true); virNodeDeviceObjEndAPI(&obj); =20 ret =3D 0; @@ -1924,6 +1925,8 @@ udevSetupSystemDev(void) if (!(obj =3D virNodeDeviceObjListAssignDef(driver->devs, def))) goto cleanup; =20 + virNodeDeviceObjSetActive(obj, true); + virNodeDeviceObjEndAPI(&obj); =20 ret =3D 0; --=20 2.26.2