On 04/20/2011 04:33 AM, Lyre wrote:
> also add flags for this function, currently not used.
> ---
>  src/libvirt-php.c |   31 +++++++++++++++++++++++++++++++
>  src/libvirt-php.h |    1 +
>  2 files changed, 32 insertions(+), 0 deletions(-)
>
> diff --git a/src/libvirt-php.c b/src/libvirt-php.c
> index d436e1c..54331bb 100644
> --- a/src/libvirt-php.c
> +++ b/src/libvirt-php.c
> @@ -129,6 +129,7 @@ static function_entry libvirt_functions[] = {
>       PHP_FE(libvirt_storagepool_refresh, NULL)
>       PHP_FE(libvirt_storagepool_set_autostart, NULL)
>       PHP_FE(libvirt_storagepool_get_autostart, NULL)
> +     PHP_FE(libvirt_storagepool_build, NULL)
>       /* Network functions */
>       PHP_FE(libvirt_network_define_xml, NULL)
>       PHP_FE(libvirt_network_undefine, NULL)
> @@ -542,6 +543,13 @@ PHP_MINIT_FUNCTION(libvirt)
>       /* Forcibly modify device (ex. force eject a cdrom) */
>       REGISTER_LONG_CONSTANT("VIR_DOMAIN_DEVICE_MODIFY_FORCE",        4, 
> CONST_CS | CONST_PERSISTENT);
>  
> +     /* REGISTER_LONG_CONSTANT */
> +     REGISTER_LONG_CONSTANT("VIR_STORAGE_POOL_BUILD_NEW",            0, 
> CONST_CS | CONST_PERSISTENT);
> +     /* Repair / reinitialize */
> +     REGISTER_LONG_CONSTANT("VIR_STORAGE_POOL_BUILD_REPAIR",         1, 
> CONST_CS | CONST_PERSISTENT); 
> +     /* Extend existing pool */
> +     REGISTER_LONG_CONSTANT("VIR_STORAGE_POOL_BUILD_RESIZE",         2, 
> CONST_CS | CONST_PERSISTENT);
> +
>       REGISTER_INI_ENTRIES();
>  
>       /* Initialize libvirt and set up error callback */
> @@ -3582,6 +3590,29 @@ PHP_FUNCTION(libvirt_storagepool_get_autostart)
>       }
>  }
>  
> +/*
> +     Function name:  libvirt_storagepool_build
> +     Since version:  0.4.2
> +     Description:    Function is used to Build the underlying storage pool, 
> e.g. create the destination directory for NFS
> +     Arguments:      @res [resource]: libvirt storagepool resource
> +     Returns:        TRUE if success, FALSE on error
> +*/
> +PHP_FUNCTION(libvirt_storagepool_build)
> +{
> +     php_libvirt_storagepool *pool = NULL;
> +     zval *zpool;
> +     int flags = 0;
> +
> +     GET_STORAGEPOOL_FROM_ARGS ("r", &zpool);
> +
> +     if (virStoragePoolBuild (pool->pool, flags) == 0)
> +     {
> +             RETURN_TRUE;
> +     }
> +     
> +     RETURN_FALSE;
> +}
> +
>  /* Listing functions */
>  /*
>       Function name:  libvirt_list_storagepools
> diff --git a/src/libvirt-php.h b/src/libvirt-php.h
> index 4e8dec6..2d79f60 100644
> --- a/src/libvirt-php.h
> +++ b/src/libvirt-php.h
> @@ -193,6 +193,7 @@ PHP_FUNCTION(libvirt_storagepool_get_volume_count);
>  PHP_FUNCTION(libvirt_storagepool_refresh);
>  PHP_FUNCTION(libvirt_storagepool_set_autostart);
>  PHP_FUNCTION(libvirt_storagepool_get_autostart);
> +PHP_FUNCTION(libvirt_storagepool_build);
>  /* Network functions */
>  PHP_FUNCTION(libvirt_network_define_xml);
>  PHP_FUNCTION(libvirt_network_undefine);
Thanks a lot for your patch Lyre! I've never used this function in
libvirt so based on this I never implemented it. Honestly, I rarely use
storage pools. It's already been pushed into the repo however ;-)

Thanks,
Michal

-- 
Michal Novotny <[email protected]>, RHCE
Virtualization Team (xen userspace), Red Hat

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to