[libvirt] [PATCH] test: Implement virConnectListAllInterfaces
John Ferlan
jferlan at redhat.com
Wed Jul 18 12:12:01 UTC 2018
On 07/10/2018 05:09 PM, Cole Robinson wrote:
> This adds some generic virinterfaceobj code, roughly matching what
> is used by other stateful drivers like network, storage, etc.
>
> Signed-off-by: Cole Robinson <crobinso at redhat.com>
> ---
> src/conf/virinterfaceobj.c | 105 +++++++++++++++++++++++++++++++++++++
> src/conf/virinterfaceobj.h | 7 +++
> src/libvirt_private.syms | 1 +
> src/test/test_driver.c | 15 ++++++
> 4 files changed, 128 insertions(+)
>
> diff --git a/src/conf/virinterfaceobj.c b/src/conf/virinterfaceobj.c
> index a1d7346eb2..87ce188117 100644
> --- a/src/conf/virinterfaceobj.c
> +++ b/src/conf/virinterfaceobj.c
> @@ -241,6 +241,111 @@ virInterfaceObjListFindByName(virInterfaceObjListPtr interfaces,
> return obj;
> }
>
2 blank lines
> +#define MATCH(FLAG) (flags & (FLAG))
> +static bool
> +virInterfaceMatch(virInterfaceObjPtr obj,
virInterfaceObjMatch
> + unsigned int flags)
> +{
> + /* filter by active state */
> + if (MATCH(VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE) &&
> + !((MATCH(VIR_CONNECT_LIST_INTERFACES_ACTIVE) &&
> + virInterfaceObjIsActive(obj)) ||
> + (MATCH(VIR_CONNECT_LIST_INTERFACES_INACTIVE) &&
> + !virInterfaceObjIsActive(obj))))
> + return false;
> +
> + return true;
> +}
> +#undef MATCH
> +
> +
> +struct virInterfaceObjListData {
> + virConnectPtr conn;
> + virInterfacePtr *ifaces;
> + virInterfaceObjListFilter filter;
> + unsigned int flags;
> + int nifaces;
> + bool error;
> +};
> +
> +static int
> +virInterfaceObjListPopulate(void *payload,
This follows the NetworkObj code and I'll just point that the naming is
still not common on what's done between:
virDomainObjListCollectIterator
virNetworkObjListPopulate
virNodeDeviceObjListExportCallback
virNWFilterBindingObjListCollectIterator
virSecretObjListExportCallback
virStoragePoolObjVolumeListExportCb
virStoragePoolObjListExportCb
Perhaps a common name could be a bite sized task. I never quite got to
where I wanted to get to with the common object code mainly because of
varying opinions and not having the energy to continue 0-).
With the virInterfaceObjMatch adjustment,
Reviewed-by: John Ferlan <jferlan at redhat.com>
John
[...]
More information about the libvir-list
mailing list