On 11.01.2016 13:31, Vasiliy Tolstov wrote:
libvirt_domain_create_xml miss ability to pass flags when create
domain,
fixing it.
Signed-off-by: Vasiliy Tolstov <v.tolstov(a)selfip.ru>
---
src/libvirt-php.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index f3b3f9f..39199da 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -1274,6 +1274,14 @@ PHP_MINIT_FUNCTION(libvirt)
REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_REVERT_PAUSED",
VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_REVERT_FORCE",
VIR_DOMAIN_SNAPSHOT_REVERT_FORCE, CONST_CS | CONST_PERSISTENT);
+ /* Create flags */
+ REGISTER_LONG_CONSTANT("VIR_DOMAIN_NONE", VIR_DOMAIN_NONE, CONST_CS |
CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_DOMAIN_START_PAUSED", VIR_DOMAIN_START_PAUSED,
CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_DOMAIN_START_AUTODESTROY",
VIR_DOMAIN_START_AUTODESTROY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_DOMAIN_START_BYPASS_CACHE",
VIR_DOMAIN_START_BYPASS_CACHE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_DOMAIN_START_FORCE_BOOT",
VIR_DOMAIN_START_FORCE_BOOT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_DOMAIN_START_VALIDATE",
VIR_DOMAIN_START_VALIDATE, CONST_CS | CONST_PERSISTENT);
+
/* Memory constants */
REGISTER_LONG_CONSTANT("VIR_MEMORY_VIRTUAL", 1, CONST_CS |
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VIR_MEMORY_PHYSICAL", 2, CONST_CS |
CONST_PERSISTENT);
@@ -5911,10 +5919,11 @@ PHP_FUNCTION(libvirt_domain_create_xml)
virDomainPtr domain=NULL;
char *xml;
int xml_len;
+ long flags=0;
- GET_CONNECTION_FROM_ARGS("rs",&zconn,&xml,&xml_len);
+
GET_CONNECTION_FROM_ARGS("rs|l",&zconn,&xml,&xml_len,&flags);
I prefer space after comma.
- domain=virDomainCreateXML(conn->conn,xml,0);
+ domain=virDomainCreateXML(conn->conn,xml,flags);
DPRINTF("%s: virDomainCreateXML(%p, <xml>, 0) returned %p\n",
PHPFUNC, conn->conn, domain);
if (domain==NULL) RETURN_FALSE;
ACKed and pushed.
Michal