[PATCH] Add ability to managed save libvirt domains

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

 



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

diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index f590595..1c39e31 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -91,6 +91,7 @@ static function_entry libvirt_functions[] = {
 	PHP_FE(libvirt_domain_core_dump, NULL)
 	PHP_FE(libvirt_domain_shutdown, NULL)
 	PHP_FE(libvirt_domain_suspend, NULL)
+	PHP_FE(libvirt_domain_managedsave, NULL)
 	PHP_FE(libvirt_domain_undefine, NULL)
 	PHP_FE(libvirt_domain_reboot, NULL)
 	PHP_FE(libvirt_domain_define_xml, NULL)
@@ -3625,6 +3626,26 @@ PHP_FUNCTION(libvirt_domain_suspend)
 }
 
 /*
+	Function name:  libvirt_domain_managedsave
+	Since version:  0.4.1(-1)
+	Description:    Function is used to managed save the domain (domain was unloaded from memory and its state was saved to disk) identified by it's resource
+	Arguments:      @res [resource]: libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
+	Returns:        TRUE for success, FALSE on error	
+*/
+PHP_FUNCTION(libvirt_domain_managedsave)
+{
+	php_libvirt_domain *domain=NULL;
+	zval *zdomain;
+	int retval;
+	
+	GET_DOMAIN_FROM_ARGS("r",&zdomain);
+	retval=virDomainManagedSave(domain->domain, 0);
+	DPRINTF("%s: virDomainManagedSave(%p) returned %d\n", PHPFUNC, domain->domain, retval);
+	if (retval != 0) RETURN_FALSE;
+	RETURN_TRUE;
+}
+
+/*
 	Function name:	libvirt_domain_undefine
 	Since version:	0.4.1(-1)
 	Description:	Function is used to undefine the domain identified by it's resource
diff --git a/src/libvirt-php.h b/src/libvirt-php.h
index 2addae2..8a3f4ff 100644
--- a/src/libvirt-php.h
+++ b/src/libvirt-php.h
@@ -237,6 +237,7 @@ PHP_FUNCTION(libvirt_domain_resume);
 PHP_FUNCTION(libvirt_domain_core_dump);
 PHP_FUNCTION(libvirt_domain_shutdown);
 PHP_FUNCTION(libvirt_domain_suspend);
+PHP_FUNCTION(libvirt_domain_managedsave);
 PHP_FUNCTION(libvirt_domain_undefine);
 PHP_FUNCTION(libvirt_domain_reboot);
 PHP_FUNCTION(libvirt_domain_define_xml);
-- 
1.7.2.5

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