[libvirt] [PATCH 2/6] esx: Add various vir*Flags API

Eric Blake eblake at redhat.com
Tue Jul 9 03:36:59 UTC 2019


Even though we don't accept any flags, it is unfriendly to callers
that use the modern API to have to fall back to the flag-free API.

Signed-off-by: Eric Blake <eblake at redhat.com>
---
 src/esx/esx_driver.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index deb800a6b7..47d95abd6d 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -1984,7 +1984,9 @@ esxDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)


 static int
-esxDomainSetMemory(virDomainPtr domain, unsigned long memory)
+esxDomainSetMemoryFlags(virDomainPtr domain,
+                        unsigned long memory,
+                        unsigned int flags)
 {
     int result = -1;
     esxPrivate *priv = domain->conn->privateData;
@@ -1994,6 +1996,8 @@ esxDomainSetMemory(virDomainPtr domain, unsigned long memory)
     esxVI_TaskInfoState taskInfoState;
     char *taskInfoErrorMessage = NULL;

+    virCheckFlags(0, -1);
+
     if (esxVI_EnsureSession(priv->primary) < 0)
         return -1;

@@ -2037,6 +2041,12 @@ esxDomainSetMemory(virDomainPtr domain, unsigned long memory)
 }


+static int
+esxDomainSetMemory(virDomainPtr domain, unsigned long memory)
+{
+    return esxDomainSetMemoryFlags(domain, memory, 0);
+}
+

 /*
  * libvirt exposed virtual CPU usage in absolute time, ESX doesn't provide this
@@ -5122,6 +5132,7 @@ static virHypervisorDriver esxHypervisorDriver = {
     .domainGetMaxMemory = esxDomainGetMaxMemory, /* 0.7.0 */
     .domainSetMaxMemory = esxDomainSetMaxMemory, /* 0.7.0 */
     .domainSetMemory = esxDomainSetMemory, /* 0.7.0 */
+    .domainSetMemoryFlags = esxDomainSetMemoryFlags, /* 5.6.0 */
     .domainSetMemoryParameters = esxDomainSetMemoryParameters, /* 0.8.6 */
     .domainGetMemoryParameters = esxDomainGetMemoryParameters, /* 0.8.6 */
     .domainGetInfo = esxDomainGetInfo, /* 0.7.0 */
-- 
2.20.1




More information about the libvir-list mailing list