Re: [libvirt-php] add get name and path for storage volume

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

 



On 03/22/2011 05:11 AM, Lyre wrote:
---
  src/libvirt.c     |   44 ++++++++++++++++++++++++++++++++++++++++++++
  src/libvirt_php.h |    2 ++
  2 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index 1608774..3678974 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -90,6 +90,8 @@ static function_entry libvirt_functions[] = {
  	PHP_FE(libvirt_storagepool_lookup_by_name,NULL)
  	PHP_FE(libvirt_storagepool_get_info,NULL)
  	PHP_FE(libvirt_storagevolume_lookup_by_name,NULL)
+	PHP_FE(libvirt_storagevolume_get_name,NULL)
+	PHP_FE(libvirt_storagevolume_get_path,NULL)
  	PHP_FE(libvirt_storagevolume_get_info,NULL)
  	PHP_FE(libvirt_storagevolume_get_xml_desc,NULL)
  	PHP_FE(libvirt_storagevolume_create_xml,NULL)
@@ -2644,6 +2646,48 @@ PHP_FUNCTION(libvirt_storagevolume_lookup_by_name)
  }

  /*
+	Function name:	libvirt_storagevolume_get_name
+	Since version:	0.4.1(-1)
+	Description:	Function is used to get the storage volume name
+	Arguments:		@res [resource]: libvirt storagevolume resource
+	Returns:		 storagevolume name
+*/
+PHP_FUNCTION(libvirt_storagevolume_get_name)
+{
+	php_libvirt_volume *volume = NULL;
+	zval *zvolume;
+	const char *val;
+
+	GET_VOLUME_FROM_ARGS ("r",&zvolume);
+
+	val = virStorageVolGetName (volume->volume);
+	if (val == NULL) RETURN_FALSE;
+
+	RETURN_STRING (val, 1);
+}
+
+/*
+	Function name:	libvirt_storagevolume_path
+	Since version:	0.4.1(-1)
+	Description:	Function is used to get the  storage volume path
+	Arguments:		@res [resource]: libvirt storagevolume resource
+	Returns:		storagevolume path
+*/
+PHP_FUNCTION(libvirt_storagevolume_get_path)
+{
+	php_libvirt_volume *volume = NULL;
+	zval *zvolume;
+	char *val;
+
+	GET_VOLUME_FROM_ARGS ("r",&zvolume);
+
+	val = virStorageVolGetPath (volume->volume);
+	if (val == NULL) RETURN_FALSE;
+
+	RETURN_STRING (val, 1);
+}
+
+/*
  	Function name:	libvirt_storagevolume_get_info
  	Since version:	0.4.1(-1)
  	Description:	Function is used to get the storage volume information
diff --git a/src/libvirt_php.h b/src/libvirt_php.h
index 3367943..60203de 100644
--- a/src/libvirt_php.h
+++ b/src/libvirt_php.h
@@ -154,6 +154,8 @@ PHP_FUNCTION(libvirt_storagepool_lookup_by_name);
  PHP_FUNCTION(libvirt_storagepool_list_volumes);
  PHP_FUNCTION(libvirt_storagepool_get_info);
  PHP_FUNCTION(libvirt_storagevolume_lookup_by_name);
+PHP_FUNCTION(libvirt_storagevolume_get_name);
+PHP_FUNCTION(libvirt_storagevolume_get_path);
  PHP_FUNCTION(libvirt_storagevolume_get_info);
  PHP_FUNCTION(libvirt_storagevolume_get_xml_desc);
  PHP_FUNCTION(libvirt_storagevolume_create_xml);
Thanks! Pushed now.

Michal

--
Michal Novotny<minovotn@xxxxxxxxxx>, RHCE
Virtualization Team (xen userspace), Red Hat

--
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]