[libvirt-php PATCH] Add ability to managed save libvirt domains

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

 



From: Pavel Odintsov <pavel.odintsov@xxxxxxxxx>

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

diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index 20e5d27..9cdfd0e 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -99,6 +99,7 @@ static zend_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)
@@ -4470,6 +4471,27 @@ PHP_FUNCTION(libvirt_domain_shutdown)
 }
 
 /*
+	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 it state 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_suspend
 	Since version:	0.4.1(-1)
 	Description:	Function is used to suspend the domain identified by it's resource
diff --git a/src/libvirt-php.h b/src/libvirt-php.h
index 3c7f254..b06836c 100644
--- a/src/libvirt-php.h
+++ b/src/libvirt-php.h
@@ -307,6 +307,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]