]> xenbits.xensource.com Git - libvirt.git/commitdiff
setmem: introduce VIR_DOMAIN_MEM_CURRENT flag
authorTaku Izumi <izumi.taku@jp.fujitsu.com>
Wed, 23 Mar 2011 05:47:21 +0000 (14:47 +0900)
committerEric Blake <eblake@redhat.com>
Thu, 7 Apr 2011 23:13:56 +0000 (17:13 -0600)
This patch introduces VIR_DOMAIN_MEM_CURRENT flag and
modifies virDomainSetMemoryFlags function to support it.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
include/libvirt/libvirt.h.in
src/libvirt.c

index bd360154f15c25a586c733c4b05c05c0e97cc727..d7654120d115060e48aa26293f4e9973d4e5f999 100644 (file)
@@ -854,8 +854,9 @@ int     virDomainGetMemoryParameters(virDomainPtr domain,
 
 /* Memory size modification flags. */
 typedef enum {
-    VIR_DOMAIN_MEM_LIVE   = (1 << 0), /* affect active domain */
-    VIR_DOMAIN_MEM_CONFIG = (1 << 1), /* affect next boot */
+    VIR_DOMAIN_MEM_CURRENT = 0,        /* affect current domain state */
+    VIR_DOMAIN_MEM_LIVE    = (1 << 0), /* affect active domain */
+    VIR_DOMAIN_MEM_CONFIG  = (1 << 1), /* affect next boot */
 } virDomainMemoryModFlags;
 
 
index 85dfc5866e44ea9e7bb0d6f610e935b5e9cdbfd6..dde4bd443d0bcb8f61c9b7836ba87cea0193cf04 100644 (file)
@@ -2822,12 +2822,17 @@ error:
  * Dynamically change the target amount of physical memory allocated to a
  * domain. If domain is NULL, then this change the amount of memory reserved
  * to Domain0 i.e. the domain where the application runs.
- * This funcation may requires privileged access to the hypervisor.
+ * This function 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 will fail if domain is not active.
+ * If VIR_DOMAIN_MEM_CONFIG is set, the change affects persistent state,
+ * and will fail for transient domains. If neither flag is specified
+ * (that is, @flags is VIR_DOMAIN_MEM_CURRENT), then an inactive domain
+ * modifies persistent setup, while an active domain is hypervisor-dependent
+ * on whether just live or both live and persistent state is changed.
+ * Not all hypervisors can support all flag combinations.
  *
  * Returns 0 in case of success, -1 in case of failure.
  */
@@ -2853,8 +2858,7 @@ virDomainSetMemoryFlags(virDomainPtr domain, unsigned long memory,
         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;
     }