From nobody Tue Feb 10 07:40:14 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=1616777340; cv=none; d=zohomail.com; s=zohoarc; b=fze99Np/+N2VA7fPMKN9PuF7lky0k7T+2UksA2ABcxIjKO/ZW65TTeSTactl7vTa+ZoQYoBt9AUGZPEeVHR1+Q90lVGeDjYVCLgJyJ3KDEH91+hHbBrJwjuV5JA7RZWZ48F1OLhFn+/imUhaK/WxcPBKvqJgFEROFM1JiMc5B/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616777340; 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=pM/wLnH4u7q9ms91nAdYPOGOuQByBX+lW0Frb1Y/eCw=; b=Q5ykRmGh9LsSIiewLLFP5vu7f+ccpHhjULPDgq5/R2xPBdFTEh6uByDBeSUHOuQP5ah8iIQAxljWI8jmY82RB0/hdjBNTQusIl2lL5ieo6UxmKIrh5JwsRWmVLumhQnEY/uYZH/Tn6Jvt+yRwf0+jpAQL7VONkTUQTsoI0Re1D4= 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 1616777340824527.8973268487558; Fri, 26 Mar 2021 09:49:00 -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-273-s6JCrj1fP9WC7aTFXB-obQ-1; Fri, 26 Mar 2021 12:48:56 -0400 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 EB69410866AB; Fri, 26 Mar 2021 16:48:49 +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 C9D7E5D6DC; Fri, 26 Mar 2021 16:48:49 +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 8CDA21802137; Fri, 26 Mar 2021 16:48:49 +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 12QGmbq8002972 for ; Fri, 26 Mar 2021 12:48:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 063125D755; Fri, 26 Mar 2021 16:48:37 +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 C2DFE5D6DC; Fri, 26 Mar 2021 16:48:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616777339; 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=pM/wLnH4u7q9ms91nAdYPOGOuQByBX+lW0Frb1Y/eCw=; b=XEZ8NfyR55kknNjUtvnCs2Rpa/j6J4xCwPxgqQKafTuGgkJ+jrDHVCJdr0yer28wZ8vKso faFjCdZvuDAFYcjHk6ji9NLZaKnQryUOwwNbx8o4w8OM+6Jek7EsYO6e6bJgOsn3miCLk1 8IsJfQoTuBqOlW+nhpZAoMeucE6eXvc= X-MC-Unique: s6JCrj1fP9WC7aTFXB-obQ-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v6 10/30] nodedev: add DEFINED/UNDEFINED lifecycle events Date: Fri, 26 Mar 2021 11:48:06 -0500 Message-Id: <20210326164826.1720062-11-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.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 Reviewed-by: Erik Skultety --- 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 76d4f3f6e8..10c707e66b 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 2deead0791..77d814935e 100644 --- a/include/libvirt/libvirt-nodedev.h +++ b/include/libvirt/libvirt-nodedev.h @@ -196,6 +196,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 fedc8497f8..b9fe9b8be1 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.3