[libvirt] [PATCH 1/3] setmem: introduce VIR_DOMAIN_MEM_CURRENT flag

Taku Izumi izumi.taku at jp.fujitsu.com
Wed Mar 23 05:47:21 UTC 2011


This patch introduces VIR_DOMAIN_MEM_CURRENT flag and
modifies virDomainSetMemoryFlags function to support it.


Signed-off-by: Taku Izumi <izumi.taku at jp.fujitsu.com>
---
 include/libvirt/libvirt.h.in |    1 +
 src/libvirt.c                |   13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)

Index: libvirt/include/libvirt/libvirt.h.in
===================================================================
--- libvirt.orig/include/libvirt/libvirt.h.in
+++ libvirt/include/libvirt/libvirt.h.in
@@ -854,6 +854,7 @@ int     virDomainGetMemoryParameters(vir

 /* Memory size modification flags. */
 typedef enum {
+    VIR_DOMAIN_MEM_CURRENT= 0,        /* affect current domain */
     VIR_DOMAIN_MEM_LIVE   = (1 << 0), /* affect active domain */
     VIR_DOMAIN_MEM_CONFIG = (1 << 1), /* affect next boot */
 } virDomainMemoryModFlags;
Index: libvirt/src/libvirt.c
===================================================================
--- libvirt.orig/src/libvirt.c
+++ libvirt/src/libvirt.c
@@ -2862,10 +2862,12 @@ error:
  * to Domain0 i.e. the domain where the application runs.
  * This funcation may requires privileged access to the hypervisor.
  *
- * @flags must include VIR_DOMAIN_MEM_LIVE to affect a running
- * domain (which may fail if domain is not active), or
- * VIR_DOMAIN_MEM_CONFIG to affect the next boot via the XML
- * description of the domain. Both flags may be set.
+ * @flags may include VIR_DOMAIN_MEM_LIVE or VIR_DOMAIN_MEM_CONFIG.
+ * Both flags may be set. If VIR_DOMAIN_MEM_LIVE is set, the change affects
+ * a running domain and may fail if domain is not active.
+ * If VIR_DOMAIN_MEM_CONFIG is set, the change affects the next boot via
+ * the XML description on the domain. If neither flag is specified
+ * (=VIR_DOMAIN_MEM_CURRENT), behavior is different depending on hypervisor.
  *
  * Returns 0 in case of success, -1 in case of failure.
  */
@@ -2891,8 +2893,7 @@ virDomainSetMemoryFlags(virDomainPtr dom
         goto error;
     }

-    if (memory < 4096 ||
-        (flags & (VIR_DOMAIN_MEM_LIVE | VIR_DOMAIN_MEM_CONFIG)) == 0) {
+    if (memory < 4096) {
         virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         goto error;
     }





More information about the libvir-list mailing list