[libvirt] [libvirt-php] add flags support to virStorageVolCreateXML

Vasiliy Tolstov v.tolstov at selfip.ru
Thu Jan 28 14:46:08 UTC 2016


Signed-off-by: Vasiliy Tolstov <v.tolstov at selfip.ru>
---
 src/libvirt-php.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index f3b3f9f81e6d..a0c960957edc 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -1238,6 +1238,8 @@ PHP_MINIT_FUNCTION(libvirt)
     REGISTER_LONG_CONSTANT("VIR_STORAGE_VOL_RESIZE_ALLOCATE",        1, CONST_CS | CONST_PERSISTENT);
     REGISTER_LONG_CONSTANT("VIR_STORAGE_VOL_RESIZE_DELTA",           2, CONST_CS | CONST_PERSISTENT);
     REGISTER_LONG_CONSTANT("VIR_STORAGE_VOL_RESIZE_SHRINK",          4, CONST_CS | CONST_PERSISTENT);
+    REGISTER_LONG_CONSTANT("VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA", VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, CONST_CS | CONST_PERSISTENT);
+    REGISTER_LONG_CONSTANT("VIR_STORAGE_VOL_CREATE_REFLINK", VIR_STORAGE_VOL_CREATE_REFLINK, CONST_CS | CONST_PERSISTENT);
 
     /* Domain vCPU flags */
     REGISTER_LONG_CONSTANT("VIR_DOMAIN_VCPU_CONFIG",    VIR_DOMAIN_VCPU_CONFIG, CONST_CS | CONST_PERSISTENT);
@@ -7105,6 +7107,7 @@ PHP_FUNCTION(libvirt_storagevolume_get_xml_desc)
  * Description:     Function is used to create the new storage pool and return the handle to new storage pool
  * Arguments:       @res [resource]: libvirt storagepool resource
  *                  @xml [string]: XML string to create the storage volume in the storage pool
+ *                  @flags [int]: virStorageVolCreateXML flags
  * Returns:         libvirt storagevolume resource
  */
 PHP_FUNCTION(libvirt_storagevolume_create_xml)
@@ -7114,11 +7117,12 @@ PHP_FUNCTION(libvirt_storagevolume_create_xml)
     zval *zpool;
     virStorageVolPtr volume=NULL;
     char *xml;
+    long flags = 0;
     int xml_len;
 
-    GET_STORAGEPOOL_FROM_ARGS("rs",&zpool,&xml,&xml_len);
+    GET_STORAGEPOOL_FROM_ARGS("rs|l",&zpool,&xml,&xml_len, &flags);
 
-    volume=virStorageVolCreateXML(pool->pool,xml,0);
+    volume=virStorageVolCreateXML(pool->pool, xml, flags);
     DPRINTF("%s: virStorageVolCreateXML(%p, <xml>, 0) returned %p\n", PHPFUNC, pool->pool, volume);
     if (volume==NULL) RETURN_FALSE;
 
-- 
2.7.0




More information about the libvir-list mailing list