Re: [libvirt] [PATCH] New APIs for checking some object properties

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 21, 2009 at 11:54:14AM +0100, Daniel P. Berrange wrote:
> Introduce a number of new APIs to  expose some boolean properties
> of objects, which cannot otherwise reliably determined, nor are
> aspects of the XML configuration.
> 
>  * virDomainIsActive: Checking virDomainGetID is not reliable
>    since it is not possible to distinguish between error condition
>    and inactive domain for ID of -1.
>  * virDomainIsPersistent: Check whether a persistent config exists
>    for the domain
> 
>  * virNetworkIsActive: Check whether the network is active
>  * virNetworkIsPersistent: Check whether a persistent config exists
>    for the network
> 
>  * virStoragePoolIsActive: Check whether the storage pool is active
>  * virStoragePoolIsPersistent: Check whether a persistent config exists
>    for the storage pool
> 
>  * virInterfaceIsActive: Check whether the host interface is active
> 
>  * virConnectIsSecure: whether the communication channel to the
>    hypervisor is secure
>  * virConnectIsEncrypted: whether any network based commnunication
>    channels are encrypted
> 
> NB, a channel can be secure, even if not encrypted, eg if it does
> not involve the network, like a UNIX socket, or pipe.

  Okay, this makes sense !

>  include/libvirt/libvirt.h.in |   16 +++
>  src/libvirt.c                |  298 ++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 314 insertions(+), 0 deletions(-)
> 
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index 6186d4e..05a164b 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -1649,6 +1649,22 @@ int virStreamAbort(virStreamPtr st);
>  int virStreamFree(virStreamPtr st);
>  
>  
> +int virDomainIsActive(virDomainPtr dom);
> +int virDomainIsPersistent(virDomainPtr dom);
> +
> +int virNetworkIsActive(virNetworkPtr net);
> +int virNetworkIsPersistent(virNetworkPtr net);
> +
> +int virStoragePoolIsActive(virStoragePoolPtr pool);
> +int virStoragePoolIsPersistent(virStoragePoolPtr pool);
> +
> +int virInterfaceIsActive(virInterfacePtr iface);
> +
> +int virConnectIsEncrypted(virConnectPtr conn);
> +int virConnectIsSecure(virConnectPtr conn);

  The only small remark I would have is that it's not consistent with
int                     virDomainGetAutostart   (virDomainPtr domain,
                                                 int *autostart);

which is also looking at a boolean value. But since we don't expect to
add a way to modify those properties (i.e. no Set operation) I think
it's fine to go with the simpler signature you suggest.

[...]
> +/**
> + * virDomainIsPersistent:
> + *
> + * Determine if the domain has a persistent configuration

maybe emphasise a bit on the definition and try to hook up to
the 'Defined' terminology used in the API for example:

    * which means it will still be defined after being terminated


> +/**
> + * virNetworkIsPersistent:
> + *
> + * Determine if the network has a persistent configuration

similar

> + * Returns > 0 if persistent, 0 if transient, -1 on error
> + */
C[...]
> +/**
> + * virStoragepoolIsActive:

typo

  virStoragePoolIsActive

> + *
> + * Determine if the storagepool is currently running

missing space

  * Determine if the storage pool is currently running

> + *
> + * Returns > 0 if running, 0 if inactive, -1 on error

> +/**
> + * virStoragepoolIsPersistent:

  StoragePool

> + *
> + * Determine if the storagepool has a persistent configuration

 -> defined
> + *
> + * Returns > 0 if persistent, 0 if transient, -1 on error
> + */

  With those small fixes in, ACK !

   thanks !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]