* libvirt_domain_set_max_memory
* libvirt_domain_set_memory
* libvirt_domain_set_memory_flags
Signed-off-by: Vasiliy Tolstov <v.tolstov(a)selfip.ru>
---
src/libvirt-php.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
src/libvirt-php.h | 3 +++
2 files changed, 77 insertions(+), 1 deletion(-)
diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index 0adc4be..b2ace23 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -1361,6 +1361,11 @@ PHP_MINIT_FUNCTION(libvirt)
REGISTER_LONG_CONSTANT("VIR_DOMAIN_AFFECT_LIVE", 1, CONST_CS |
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VIR_DOMAIN_AFFECT_CONFIG", 2, CONST_CS |
CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_DOMAIN_MEM_CONFIG", VIR_DOMAIN_MEM_CONFIG,
CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_DOMAIN_MEM_CURRENT", VIR_DOMAIN_MEM_CURRENT,
CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_DOMAIN_MEM_LIVE", VIR_DOMAIN_MEM_LIVE, CONST_CS |
CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_DOMAIN_MEM_MAXIMUM", VIR_DOMAIN_MEM_MAXIMUM,
CONST_CS | CONST_PERSISTENT);
+
/* Connect flags */
REGISTER_LONG_CONSTANT("VIR_CONNECT_FLAG_SOUNDHW_GET_NAMES", CONNECT_FLAG_SOUNDHW_GET_NAMES,
CONST_CS | CONST_PERSISTENT);
@@ -3286,6 +3291,75 @@ PHP_FUNCTION(libvirt_domain_is_persistent)
}
/*
+ Function name: libvirt_domain_set_max_memory
+ Since version: 0.5.1
+ Description: Function to set max memory for domain
+ Arguments: @res [resource]: libvirt domain resource
+ @memory [int]: memory size in 1024 bytes (Kb)
+ Returns: TRUE for success, FALSE for failure
+*/
+PHP_FUNCTION(libvirt_domain_set_max_memory)
+{
+ php_libvirt_domain *domain = NULL;
+ zval *zdomain;
+ long memory = 0;
+
+ GET_DOMAIN_FROM_ARGS ("rl", &zdomain, &memory);
+
+ if (virDomainSetMaxMemory(domain->domain, memory) != 0)
+ RETURN_FALSE;
+
+ RETURN_TRUE;
+}
+
+/*
+ Function name: libvirt_domain_set_memory
+ Since version: 0.5.1
+ Description: Function to set memory for domain
+ Arguments: @res [resource]: libvirt domain resource
+ @memory [int]: memory size in 1024 bytes (Kb)
+ Returns: TRUE for success, FALSE for failure
+*/
+PHP_FUNCTION(libvirt_domain_set_memory)
+{
+ php_libvirt_domain *domain = NULL;
+ zval *zdomain;
+ long memory = 0;
+
+ GET_DOMAIN_FROM_ARGS ("rl", &zdomain, &memory);
+
+ if (virDomainSetMemory(domain->domain, memory) != 0)
+ RETURN_FALSE;
+
+ RETURN_TRUE;
+}
+
+/*
+ Function name: libvirt_domain_set_memory_flags
+ Since version: 0.5.1
+ Description: Function to set max memory for domain
+ Arguments: @res [resource]: libvirt domain resource
+ @memory [int]: memory size in 1024 bytes (Kb)
+ @flags [int]: bitwise-OR VIR_DOMAIN_MEM_* flags
+ Returns: TRUE for success, FALSE for failure
+*/
+PHP_FUNCTION(libvirt_domain_set_memory_flags)
+{
+ php_libvirt_domain *domain = NULL;
+ zval *zdomain;
+ long memory = 0;
+ long flags = 0;
+
+ GET_DOMAIN_FROM_ARGS ("rl|l", &zdomain, &memory, &flags);
+
+ if (virDomainSetMemoryFlags(domain->domain, memory, flags) != 0)
+ RETURN_FALSE;
+
+ RETURN_TRUE;
+}
+
+
+/*
Function name: libvirt_domain_get_autostart
Since version: 0.4.1(-1)
Description: Function is getting the autostart value for the domain
@@ -8863,4 +8937,3 @@ PHP_FUNCTION(libvirt_logfile_set)
RETURN_TRUE;
}
#endif
-
diff --git a/src/libvirt-php.h b/src/libvirt-php.h
index 3bcc682..cd3d0a9 100644
--- a/src/libvirt-php.h
+++ b/src/libvirt-php.h
@@ -399,6 +399,9 @@ PHP_FUNCTION(libvirt_domain_undefine);
PHP_FUNCTION(libvirt_domain_reboot);
PHP_FUNCTION(libvirt_domain_define_xml);
PHP_FUNCTION(libvirt_domain_create_xml);
+PHP_FUNCTION(libvirt_domain_set_max_memory);
+PHP_FUNCTION(libvirt_domain_set_memory);
+PHP_FUNCTION(libvirt_domain_set_memory_flags);
PHP_FUNCTION(libvirt_domain_memory_peek);
PHP_FUNCTION(libvirt_domain_memory_stats);
PHP_FUNCTION(libvirt_domain_update_device);
--
2.3.3
Show replies by date
On 12.06.2015 14:40, Vasiliy Tolstov wrote:
* libvirt_domain_set_max_memory
* libvirt_domain_set_memory
* libvirt_domain_set_memory_flags
Signed-off-by: Vasiliy Tolstov <v.tolstov(a)selfip.ru>
---
src/libvirt-php.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
src/libvirt-php.h | 3 +++
2 files changed, 77 insertions(+), 1 deletion(-)
ACKed and pushed.
Michal