On 2/20/24 23:23, Jonathon Jongsma wrote:
Minor nit: the commit subject still says "persisted"
instead of
"persistent"
Sorry I missed these. I have sent a v4 fixing these.
On 2/16/24 8:52 AM, Boris Fiuczynski wrote:
> Allow to filter node devices based on their persisted or transient
> states.
>
> Signed-off-by: Boris Fiuczynski <fiuczy(a)linux.ibm.com>
> Reviewed-by: Jonathon Jongsma <jjongsma(a)redhat.com>
> ---
> include/libvirt/libvirt-nodedev.h | 2 ++
> src/conf/node_device_conf.h | 7 ++++++-
> src/conf/virnodedeviceobj.c | 8 ++++++++
> 3 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/include/libvirt/libvirt-nodedev.h
> b/include/libvirt/libvirt-nodedev.h
> index 53ffce6c69..f7ddbfa4ad 100644
> --- a/include/libvirt/libvirt-nodedev.h
> +++ b/include/libvirt/libvirt-nodedev.h
> @@ -91,6 +91,8 @@ typedef enum {
> VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_MATRIX = 1 << 20, /*
> s390 AP Matrix (Since: 7.0.0) */
> VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPD = 1 << 21, /*
> Device with VPD (Since: 7.9.0) */
> + VIR_CONNECT_LIST_NODE_DEVICES_PERSISTENT = 1 << 28, /*
> Persisted devices (Since: 10.1.0) */
> + VIR_CONNECT_LIST_NODE_DEVICES_TRANSIENT = 1 << 29, /*
> Transient devices (Since: 10.1.0) */
> VIR_CONNECT_LIST_NODE_DEVICES_INACTIVE = 1 << 30, /*
> Inactive devices (Since: 7.3.0) */
> VIR_CONNECT_LIST_NODE_DEVICES_ACTIVE = 1U << 31, /*
> Active devices (Since: 7.3.0) */
> } virConnectListAllNodeDeviceFlags;
> diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
> index f59440dbb9..f0a5333881 100644
> --- a/src/conf/node_device_conf.h
> +++ b/src/conf/node_device_conf.h
> @@ -432,9 +432,14 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNodeDevCapsDef,
> virNodeDevCapsDefFree);
> VIR_CONNECT_LIST_NODE_DEVICES_ACTIVE | \
> VIR_CONNECT_LIST_NODE_DEVICES_INACTIVE
> +#define VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_PERSISTENT \
> + VIR_CONNECT_LIST_NODE_DEVICES_PERSISTENT | \
> + VIR_CONNECT_LIST_NODE_DEVICES_TRANSIENT
> +
> #define VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_ALL \
> VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP | \
> - VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_ACTIVE
> + VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_ACTIVE | \
> + VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_PERSISTENT
> int
> virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHost *scsi_host);
> diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c
> index cfef30d47e..31ec4249d8 100644
> --- a/src/conf/virnodedeviceobj.c
> +++ b/src/conf/virnodedeviceobj.c
> @@ -911,6 +911,14 @@ virNodeDeviceObjMatch(virNodeDeviceObj *obj,
> return false;
> }
> + if (flags & (VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_PERSISTENT)) {
> + if (!((MATCH(VIR_CONNECT_LIST_NODE_DEVICES_PERSISTENT) &&
> + virNodeDeviceObjIsPersistent(obj)) ||
> + (MATCH(VIR_CONNECT_LIST_NODE_DEVICES_TRANSIENT) &&
> + !virNodeDeviceObjIsPersistent(obj))))
> + return false;
> + }
> +
> return true;
> }
> #undef MATCH
_______________________________________________
Devel mailing list -- devel(a)lists.libvirt.org
To unsubscribe send an email to devel-leave(a)lists.libvirt.org
--
Mit freundlichen Grüßen/Kind regards
Boris Fiuczynski
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Wolfgang Wendt
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294