From nobody Tue Feb 10 04:13:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1612373987; cv=none; d=zohomail.com; s=zohoarc; b=mbV19sFz9OMLfZ5dVIAPTspXZBD+BytbRF6bMdfCUuDV2i+AoqCIBh/oSIVYks+TsqsB7bEMPqPpa3kg7DjJVPJMNauvVV8LyjO72ejtTQi2NyzNFRxZjAXANjykaC0vSnsi9n8MtK/mIHQLd0XgchN09zAqo8opNlpYhlKsZ7c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612373987; 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=F/8kNX4yni49bC3aHExpFgX/xcsqGHjPGUlwjwTPfQo=; b=Izy6hM/2RBAL7DOtInowgqnSXzOgZm6H3Ya1iuHGHUFRh2heOM2qzc7augCUIHs9nPM+AoSUGuFDYOPgDVD8FUNectMmNrzfDGs5FZF4Y3AB42Z+WNqQhDxKETGYRfnkSHXy1re7RiiUaVEPX/0IS0bjh2Jeb6AJ0ClZSkwD+AQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612373987687131.5493394160237; Wed, 3 Feb 2021 09:39:47 -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-161-QlOXx8wpNf2bIVdKi0BWaw-1; Wed, 03 Feb 2021 12:39:33 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F07FB80196B; Wed, 3 Feb 2021 17:39:23 +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 935735B692; Wed, 3 Feb 2021 17:39:23 +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 5A69E1809C8F; Wed, 3 Feb 2021 17:39:23 +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 113HdGgk024304 for ; Wed, 3 Feb 2021 12:39:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id E25445B4AE; Wed, 3 Feb 2021 17:39:16 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-113-7.phx2.redhat.com [10.3.113.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9D324722CA; Wed, 3 Feb 2021 17:39:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612373986; 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=F/8kNX4yni49bC3aHExpFgX/xcsqGHjPGUlwjwTPfQo=; b=DubMHMr9HAuVgTAmUSvlIAU136h8LUdPkw2z96ga1T8lvD0s9hghdiwHOpf6bwUA9zRhV3 t7EnozTSdFz0NB7uhdpe5LAuyu77SkqM/hyiy+5Z0ViatBcCTPrOWWM65rUjS6Wi0LKpFJ JB128HqAVTsgMeer97rF6AhMZwk/IJY= X-MC-Unique: QlOXx8wpNf2bIVdKi0BWaw-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v4 08/25] nodedev: add DEFINED/UNDEFINED lifecycle events Date: Wed, 3 Feb 2021 11:38:52 -0600 Message-Id: <20210203173909.1273000-9-jjongsma@redhat.com> In-Reply-To: <20210203173909.1273000-1-jjongsma@redhat.com> References: <20210203173909.1273000-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 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.15 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" Since a mediated device can be persistently defined by the mdevctl backend, we need additional lifecycle events beyond CREATED/DELETED to indicate that e.g. the device has been stopped but the device definition still exists. Signed-off-by: Jonathon Jongsma --- examples/c/misc/event-test.c | 4 ++++ include/libvirt/libvirt-nodedev.h | 2 ++ tools/virsh-nodedev.c | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/c/misc/event-test.c b/examples/c/misc/event-test.c index f164e825e1..bd6218cce6 100644 --- a/examples/c/misc/event-test.c +++ b/examples/c/misc/event-test.c @@ -381,6 +381,10 @@ nodeDeviceEventToString(int event) return "Created"; case VIR_NODE_DEVICE_EVENT_DELETED: return "Deleted"; + case VIR_NODE_DEVICE_EVENT_DEFINED: + return "Defined"; + case VIR_NODE_DEVICE_EVENT_UNDEFINED: + return "Undefined"; case VIR_NODE_DEVICE_EVENT_LAST: break; } diff --git a/include/libvirt/libvirt-nodedev.h b/include/libvirt/libvirt-no= dedev.h index d304283871..7cd679dac4 100644 --- a/include/libvirt/libvirt-nodedev.h +++ b/include/libvirt/libvirt-nodedev.h @@ -197,6 +197,8 @@ int virConnectNodeDeviceEventDeregisterAny(virConnectPt= r conn, typedef enum { VIR_NODE_DEVICE_EVENT_CREATED =3D 0, VIR_NODE_DEVICE_EVENT_DELETED =3D 1, + VIR_NODE_DEVICE_EVENT_DEFINED =3D 2, + VIR_NODE_DEVICE_EVENT_UNDEFINED =3D 3, =20 # ifdef VIR_ENUM_SENTINELS VIR_NODE_DEVICE_EVENT_LAST diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 69422e20f5..428ead7384 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -775,7 +775,9 @@ VIR_ENUM_DECL(virshNodeDeviceEvent); VIR_ENUM_IMPL(virshNodeDeviceEvent, VIR_NODE_DEVICE_EVENT_LAST, N_("Created"), - N_("Deleted")); + N_("Deleted"), + N_("Defined"), + N_("Undefined")); =20 static const char * virshNodeDeviceEventToString(int event) --=20 2.26.2