[libvirt] [PATCH 1/8] lifecycle: add flag VIR_DOMAIN_MEM_GUEST for viDomainSetMemoryFlags

Zhang Bo oscar.zhangbo at huawei.com
Tue Jun 9 09:33:25 UTC 2015


just add the flag and description for function virDomainSetMemoryFlags().

Signed-off-by: Zhang Bo <oscar.zhangbo at huawei.com>
Signed-off-by: Li Bin <binlibin.li at huawei.com>
---
 include/libvirt/libvirt-domain.h | 1 +
 src/libvirt-domain.c             | 4 ++++
 src/qemu/qemu_driver.c           | 3 ++-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index d851225..103266a 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -1163,6 +1163,7 @@ typedef enum {
 
     /* Additionally, these flags may be bitwise-OR'd in.  */
     VIR_DOMAIN_MEM_MAXIMUM = (1 << 2), /* affect Max rather than current */
+    VIR_DOMAIN_MEM_GUEST   = (1 << 3), /* logically change memory size in the guest */
 } virDomainMemoryModFlags;
 
 
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 7e6d749..155fb92 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -1945,6 +1945,10 @@ virDomainSetMemory(virDomainPtr domain, unsigned long memory)
  * on whether just live or both live and persistent state is changed.
  * If VIR_DOMAIN_MEM_MAXIMUM is set, the change affects domain's maximum memory
  * size rather than current memory size.
+ * If VIR_DOMAIN_MEM_GUEST is set, it changes the domain's memory size inside
+ * the guest instead of the hypervisor. This flag can only be used with live guests.
+ * The usage of this flag may require a guest agent configured.
+ *
  * Not all hypervisors can support all flag combinations.
  *
  * Returns 0 in case of success, -1 in case of failure.
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 34e5581..580cd60 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2310,7 +2310,8 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
 
     virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
                   VIR_DOMAIN_AFFECT_CONFIG |
-                  VIR_DOMAIN_MEM_MAXIMUM, -1);
+                  VIR_DOMAIN_MEM_MAXIMUM |
+                  VIR_DOMAIN_MEM_GUEST, -1);
 
     if (!(vm = qemuDomObjFromDomain(dom)))
         goto cleanup;
-- 
1.7.12.4





More information about the libvir-list mailing list