[PATCH 06/11] nodedev: add persisted and transient filter on list

Boris Fiuczynski posted 11 patches 7 months, 3 weeks ago
There is a newer version of this series
[PATCH 06/11] nodedev: add persisted and transient filter on list
Posted by Boris Fiuczynski 7 months, 3 weeks ago
Allow to filter node devices based on their persisted or transient states.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.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 d18246e2f6..dff394ec86 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_PERSISTED         = 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..3ee1fbc665 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_PERSIST \
+    VIR_CONNECT_LIST_NODE_DEVICES_PERSISTED | \
+    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_PERSIST
 
 int
 virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHost *scsi_host);
diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c
index cfef30d47e..0b9ca8c864 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_PERSIST)) {
+        if (!((MATCH(VIR_CONNECT_LIST_NODE_DEVICES_PERSISTED) &&
+              virNodeDeviceObjIsPersistent(obj)) ||
+              (MATCH(VIR_CONNECT_LIST_NODE_DEVICES_TRANSIENT) &&
+               !virNodeDeviceObjIsPersistent(obj))))
+            return false;
+    }
+
     return true;
 }
 #undef MATCH
-- 
2.42.0
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [PATCH 06/11] nodedev: add persisted and transient filter on list
Posted by Jonathon Jongsma 7 months, 1 week ago
On 1/19/24 10:38 AM, Boris Fiuczynski wrote:
> Allow to filter node devices based on their persisted or transient states.
> 
> Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.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 d18246e2f6..dff394ec86 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_PERSISTED         = 1 << 28, /* Persisted devices (Since: 10.1.0) */

s/PERSISTED/PERSISTENT/

> +    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..3ee1fbc665 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_PERSIST \

s/PERSIST/PERSISTENT/

> +    VIR_CONNECT_LIST_NODE_DEVICES_PERSISTED | \

s/PERSISTED/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_PERSIST
>   
>   int
>   virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHost *scsi_host);
> diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c
> index cfef30d47e..0b9ca8c864 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_PERSIST)) {
> +        if (!((MATCH(VIR_CONNECT_LIST_NODE_DEVICES_PERSISTED) &&
> +              virNodeDeviceObjIsPersistent(obj)) ||
> +              (MATCH(VIR_CONNECT_LIST_NODE_DEVICES_TRANSIENT) &&
> +               !virNodeDeviceObjIsPersistent(obj))))
> +            return false;
> +    }
> +
>       return true;
>   }
>   #undef MATCH

Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [PATCH 06/11] nodedev: add persisted and transient filter on list
Posted by Boris Fiuczynski 7 months, 1 week ago
On 1/31/24 22:38, Jonathon Jongsma wrote:
> On 1/19/24 10:38 AM, Boris Fiuczynski wrote:
>> Allow to filter node devices based on their persisted or transient 
>> states.
>>
>> Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.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 d18246e2f6..dff394ec86 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_PERSISTED         = 1 << 28, /* 
>> Persisted devices (Since: 10.1.0) */
> 
> s/PERSISTED/PERSISTENT/
> 
>> +    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..3ee1fbc665 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_PERSIST \
> 
> s/PERSIST/PERSISTENT/
> 
>> +    VIR_CONNECT_LIST_NODE_DEVICES_PERSISTED | \
> 
> s/PERSISTED/PERSISTENT/

All changed

> 
>> +    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_PERSIST
>>   int
>>   virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHost *scsi_host);
>> diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c
>> index cfef30d47e..0b9ca8c864 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_PERSIST)) {
>> +        if (!((MATCH(VIR_CONNECT_LIST_NODE_DEVICES_PERSISTED) &&
>> +              virNodeDeviceObjIsPersistent(obj)) ||
>> +              (MATCH(VIR_CONNECT_LIST_NODE_DEVICES_TRANSIENT) &&
>> +               !virNodeDeviceObjIsPersistent(obj))))
>> +            return false;
>> +    }
>> +
>>       return true;
>>   }
>>   #undef MATCH
> 
> Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>

Thanks

> _______________________________________________
> Devel mailing list -- devel@lists.libvirt.org
> To unsubscribe send an email to devel-leave@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
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org