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

[libvirt] [libvirt-php PATCH 1/2] Implement libvirt_domain_migrate_to_uri2 for virDomainMigrateToURI2



---
 src/libvirt-php.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/libvirt-php.h |  1 +
 2 files changed, 54 insertions(+)

diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index 19c97e8..b795667 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -111,6 +111,7 @@ static zend_function_entry libvirt_functions[] = {
 	PHP_FE(libvirt_domain_get_connect, NULL)
 	PHP_FE(libvirt_domain_migrate, NULL)
 	PHP_FE(libvirt_domain_migrate_to_uri, NULL)
+	PHP_FE(libvirt_domain_migrate_to_uri2, NULL)
 	PHP_FE(libvirt_domain_get_job_info, NULL)
 	PHP_FE(libvirt_domain_xml_xpath, NULL)
 	PHP_FE(libvirt_domain_get_block_info, NULL)
@@ -5367,6 +5368,58 @@ PHP_FUNCTION(libvirt_domain_migrate_to_uri)
 	RETURN_FALSE;
 }
 
+/*
+	Function name:	libvirt_domain_migrate_to_uri2
+	Since version:	0.4.6(-1)
+	Description:	Function is used migrate domain to another libvirt daemon specified by it's URI
+	Arguments:	@res [resource]: libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
+			@dconnuri [string]: URI for target libvirtd
+			@miguri [string]: URI for invoking the migration
+			@dxml [string]: XML config for launching guest on target
+			@flags [int]: migration flags
+			@dname [string]: domain name to rename domain to on destination side
+			@bandwidth [int]: migration bandwidth in Mbps
+	Returns:	TRUE for success, FALSE on error
+*/
+PHP_FUNCTION(libvirt_domain_migrate_to_uri2)
+{
+	php_libvirt_domain *domain=NULL;
+	zval *zdomain;
+	int retval;
+	char *dconnuri;
+	int dconnuri_len;
+	char *miguri;
+	int miguri_len;
+	char *dxml;
+	int dxml_len;
+	long flags=0;
+	char *dname;
+	int dname_len;
+	long bandwidth;	 
+ 
+ 	dconnuri=NULL;
+	dconnuri_len=0;
+	miguri=NULL;
+	miguri_len=0;
+	dxml=NULL;
+	dxml_len=0;
+	dname=NULL;
+	dname_len=0;
+	bandwidth=0;
+	GET_DOMAIN_FROM_ARGS("r|ssslsl",&zdomain,&dconnuri,&dconnuri_len,&miguri,&miguri_len,&dxml,&dxml_len,&flags,&dname,&dname_len,&bandwidth);
+
+	// set to NULL if empty string
+	if (dconnuri_len == 0) dconnuri=NULL;
+	if (miguri_len == 0) miguri=NULL;
+	if (dxml_len == 0) dxml=NULL;
+	if (dname_len == 0) dname=NULL;
+
+	retval=virDomainMigrateToURI2(domain->domain,dconnuri,miguri,dxml,flags,dname,bandwidth);
+	DPRINTF("%s: virDomainMigrateToURI2() returned %d\n", PHPFUNC, retval);
+
+	if (retval == 0) RETURN_TRUE;
+	RETURN_FALSE;
+}
 
 /*
 	Function name:	libvirt_domain_migrate
diff --git a/src/libvirt-php.h b/src/libvirt-php.h
index c0a4b50..bbcb3f2 100644
--- a/src/libvirt-php.h
+++ b/src/libvirt-php.h
@@ -336,6 +336,7 @@ PHP_FUNCTION(libvirt_domain_xml_xpath);
 PHP_FUNCTION(libvirt_domain_get_block_info);
 PHP_FUNCTION(libvirt_domain_get_network_info);
 PHP_FUNCTION(libvirt_domain_migrate_to_uri);
+PHP_FUNCTION(libvirt_domain_migrate_to_uri2);
 PHP_FUNCTION(libvirt_domain_get_autostart);
 PHP_FUNCTION(libvirt_domain_set_autostart);
 PHP_FUNCTION(libvirt_domain_is_active);
-- 
1.7.12.4


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