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

[libvirt] [libvirt-php PATCH 2/2] add wrapper function libvirt_storagepool_delete for virStoragePoolDelete



---
 src/libvirt-php.c |   25 +++++++++++++++++++++++++
 src/libvirt-php.h |    1 +
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index c50fd74..6513c52 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -156,6 +156,7 @@ static zend_function_entry libvirt_functions[] = {
 	PHP_FE(libvirt_storagepool_set_autostart, NULL)
 	PHP_FE(libvirt_storagepool_get_autostart, NULL)
 	PHP_FE(libvirt_storagepool_build, NULL)
+	PHP_FE(libvirt_storagepool_delete, NULL)
 	/* Network functions */
 	PHP_FE(libvirt_network_define_xml, NULL)
 	PHP_FE(libvirt_network_undefine, NULL)
@@ -6109,6 +6110,30 @@ PHP_FUNCTION(libvirt_storagepool_build)
 	RETURN_FALSE;
 }
 
+/*
+	Function name:	libvirt_storagepool_delete
+	Since version:	0.4.6
+	Description:	Function is used to Delete the underlying storage pool, e.g. remove the destination directory for NFS
+	Arguments:	@res [resource]: libvirt storagepool resource
+	Returns:	TRUE if success, FALSE on error
+*/
+PHP_FUNCTION(libvirt_storagepool_delete)
+{
+	php_libvirt_storagepool *pool = NULL;
+	zval *zpool;
+	int flags = 0;
+	int retval;
+
+	GET_STORAGEPOOL_FROM_ARGS ("r", &zpool);
+
+	retval = virStoragePoolDelete(pool->pool, flags);
+	DPRINTF("%s: virStoragePoolDelete(%p, %d) returned %d\n", PHPFUNC, pool->pool, flags, retval);
+	if (retval == 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 fe7b518..9b9c0f9 100644
--- a/src/libvirt-php.h
+++ b/src/libvirt-php.h
@@ -364,6 +364,7 @@ PHP_FUNCTION(libvirt_storagepool_refresh);
 PHP_FUNCTION(libvirt_storagepool_set_autostart);
 PHP_FUNCTION(libvirt_storagepool_get_autostart);
 PHP_FUNCTION(libvirt_storagepool_build);
+PHP_FUNCTION(libvirt_storagepool_delete);
 /* Network functions */
 PHP_FUNCTION(libvirt_network_define_xml);
 PHP_FUNCTION(libvirt_network_undefine);
-- 
1.7.8.5


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