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

[libvirt] [PATCH] esx: Implement esxDomainSetMemoryFlags



---
 src/esx/esx_driver.c |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index b55ef45..3962bf1 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -2187,6 +2187,27 @@ esxDomainSetMemory(virDomainPtr domain, unsigned long memory)
 
 
 
+static int
+esxDomainSetMemoryFlags(virDomainPtr domain, unsigned long memory,
+                        unsigned int flags)
+{
+    if (flags != VIR_DOMAIN_MEM_CURRENT &&
+        flags != VIR_DOMAIN_MEM_LIVE &&
+        flags != (VIR_DOMAIN_MEM_CURRENT | VIR_DOMAIN_MEM_MAXIMUM) &&
+        flags != (VIR_DOMAIN_MEM_LIVE | VIR_DOMAIN_MEM_MAXIMUM)) {
+        virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
+        return -1;
+    }
+
+    if (flags & VIR_DOMAIN_MEM_MAXIMUM) {
+        return esxDomainSetMaxMemory(domain, memory);
+    } else {
+        return esxDomainSetMemory(domain, memory);
+    }
+}
+
+
+
 /*
  * libvirt exposed virtual CPU usage in absolute time, ESX doesn't provide this
  * information in this format. It exposes it in 20 seconds slots, but it's hard
@@ -5286,6 +5307,7 @@ static virDriver esxDriver = {
     .domainGetMaxMemory = esxDomainGetMaxMemory, /* 0.7.0 */
     .domainSetMaxMemory = esxDomainSetMaxMemory, /* 0.7.0 */
     .domainSetMemory = esxDomainSetMemory, /* 0.7.0 */
+    .domainSetMemoryFlags = esxDomainSetMemoryFlags, /* 1.0.6 */
     .domainSetMemoryParameters = esxDomainSetMemoryParameters, /* 0.8.6 */
     .domainGetMemoryParameters = esxDomainGetMemoryParameters, /* 0.8.6 */
     .domainGetInfo = esxDomainGetInfo, /* 0.7.0 */
-- 
1.7.9.5


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