Re: [PATCH] virsh: fix memtune's help message for swap_hard_limit

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

 



On Wed, 16 Mar 2011 09:37:32 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:
> On Tue, 15 Mar 2011 14:27:19 +0000
> "Daniel P. Berrange" <berrange@xxxxxxxxxx> wrote:
> 
> > 
> > NACK to both these changes. The XML and public API must *never* be
> > changed once included in a release. The current names may not be
> > the perfect choices, but we can't change them now I'm afraid.
> > 
> 
> 
> Hmm. Then, only messages should be fixed. Nikunj, please fix.
> 
Ok, here is the patch with doc changes and cgroup api rename

==
From: Nikunj A. Dadhania <nikunj@xxxxxxxxxxxxxxxxxx>

* Correct the documentation for cgroup: the swap_hard_limit indicates
  mem+swap_hard_limit.
* Change cgroup private apis to: virCgroupGet/SetMemSwapHardLimit

Signed-off-by: Nikunj A. Dadhania <nikunj@xxxxxxxxxxxxxxxxxx>
---
 docs/formatdomain.html.in    |    5 +++--
 include/libvirt/libvirt.h.in |    3 ++-
 src/libvirt_private.syms     |    4 ++--
 src/lxc/lxc_controller.c     |    2 +-
 src/lxc/lxc_driver.c         |    4 ++--
 src/qemu/qemu_cgroup.c       |    2 +-
 src/qemu/qemu_driver.c       |    6 +++---
 src/util/cgroup.c            |   16 ++++++++--------
 src/util/cgroup.h            |    4 ++--
 9 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index dad268d..52bd4e6 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -231,8 +231,9 @@
 	kilobytes (i.e. blocks of 1024 bytes)</dd>
       <dt><code>swap_hard_limit</code></dt>
       <dd> The optional <code>swap_hard_limit</code> element is the maximum
-	swap the guest can use. The units for this value are kilobytes
-	(i.e. blocks of 1024 bytes)</dd>
+	memory plus swap the guest can use. The units for this value are
+	kilobytes (i.e. blocks of 1024 bytes). This has to be more than
+	hard_limit value provided</dd>
       <dt><code>min_guarantee</code></dt>
       <dd> The optional <code>min_guarantee</code> element is the guaranteed
 	minimum memory allocation for the guest. The units for this value are
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 055eb2e..87bb9c5 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -729,7 +729,8 @@ typedef enum {
  * VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT:
  *
  * Macro for the swap tunable swap_hard_limit: it represents the maximum swap
- * the guest can use.
+ * plus memory the guest can use. This limit has to be more than
+ * VIR_DOMAIN_MEMORY_HARD_LIMIT.
  */
 
 #define VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT "swap_hard_limit"
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 2ce4bed..025988e 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -72,7 +72,7 @@ virCgroupGetFreezerState;
 virCgroupGetMemoryHardLimit;
 virCgroupGetMemorySoftLimit;
 virCgroupGetMemoryUsage;
-virCgroupGetSwapHardLimit;
+virCgroupGetMemSwapHardLimit;
 virCgroupMounted;
 virCgroupRemove;
 virCgroupSetCpuShares;
@@ -80,7 +80,7 @@ virCgroupSetFreezerState;
 virCgroupSetMemory;
 virCgroupSetMemoryHardLimit;
 virCgroupSetMemorySoftLimit;
-virCgroupSetSwapHardLimit;
+virCgroupSetMemSwapHardLimit;
 
 
 # command.h
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index af0b70c..cfb0356 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -135,7 +135,7 @@ static int lxcSetContainerResources(virDomainDefPtr def)
     }
 
     if(def->mem.swap_hard_limit) {
-        rc = virCgroupSetSwapHardLimit(cgroup, def->mem.swap_hard_limit);
+        rc = virCgroupSetMemSwapHardLimit(cgroup, def->mem.swap_hard_limit);
         if (rc != 0) {
             virReportSystemError(-rc,
                                  _("Unable to set swap hard limit for domain %s"),
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index c4fe936..0eca48e 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -780,7 +780,7 @@ static int lxcDomainSetMemoryParameters(virDomainPtr dom,
                 continue;
             }
 
-            rc = virCgroupSetSwapHardLimit(cgroup, params[i].value.ul);
+            rc = virCgroupSetMemSwapHardLimit(cgroup, params[i].value.ul);
             if (rc != 0) {
                 virReportSystemError(-rc, "%s",
                                      _("unable to set swap_hard_limit tunable"));
@@ -886,7 +886,7 @@ static int lxcDomainGetMemoryParameters(virDomainPtr dom,
             break;
 
         case 2: /* fill swap hard limit here */
-            rc = virCgroupGetSwapHardLimit(cgroup, &val);
+            rc = virCgroupGetMemSwapHardLimit(cgroup, &val);
             if (rc != 0) {
                 virReportSystemError(-rc, "%s",
                                      _("unable to get swap hard limit"));
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index e5536c0..a25b486 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -291,7 +291,7 @@ int qemuSetupCgroup(struct qemud_driver *driver,
         }
 
         if (vm->def->mem.swap_hard_limit != 0) {
-            rc = virCgroupSetSwapHardLimit(cgroup, vm->def->mem.swap_hard_limit);
+            rc = virCgroupSetMemSwapHardLimit(cgroup, vm->def->mem.swap_hard_limit);
             if (rc != 0) {
                 virReportSystemError(-rc,
                                      _("Unable to set swap hard limit for domain %s"),
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 395f72f..9b5fdec 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7002,7 +7002,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom,
                 continue;
             }
 
-            rc = virCgroupSetSwapHardLimit(group, params[i].value.ul);
+            rc = virCgroupSetMemSwapHardLimit(group, params[i].value.ul);
             if (rc != 0) {
                 virReportSystemError(-rc, "%s",
                                      _("unable to set swap_hard_limit tunable"));
@@ -7112,8 +7112,8 @@ static int qemuDomainGetMemoryParameters(virDomainPtr dom,
             param->value.ul = val;
             break;
 
-        case 2: /* fill swap hard limit here */
-            rc = virCgroupGetSwapHardLimit(group, &val);
+        case 2: /* fill mem+swap hard limit here */
+            rc = virCgroupGetMemSwapHardLimit(group, &val);
             if (rc != 0) {
                 virReportSystemError(-rc, "%s",
                                      _("unable to get swap hard limit"));
diff --git a/src/util/cgroup.c b/src/util/cgroup.c
index cd9caba..71c928e 100644
--- a/src/util/cgroup.c
+++ b/src/util/cgroup.c
@@ -977,14 +977,14 @@ int virCgroupGetMemorySoftLimit(virCgroupPtr group, unsigned long long *kb)
 }
 
 /**
- * virCgroupSetSwapHardLimit:
+ * virCgroupSetMemSwapHardLimit:
  *
- * @group: The cgroup to change swap hard limit for
- * @kb: The swap amount in kilobytes
+ * @group: The cgroup to change mem+swap hard limit for
+ * @kb: The mem+swap amount in kilobytes
  *
  * Returns: 0 on success
  */
-int virCgroupSetSwapHardLimit(virCgroupPtr group, unsigned long long kb)
+int virCgroupSetMemSwapHardLimit(virCgroupPtr group, unsigned long long kb)
 {
     unsigned long long maxkb = VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
 
@@ -1003,14 +1003,14 @@ int virCgroupSetSwapHardLimit(virCgroupPtr group, unsigned long long kb)
 }
 
 /**
- * virCgroupGetSwapHardLimit:
+ * virCgroupGetMemSwapHardLimit:
  *
- * @group: The cgroup to get swap hard limit for
- * @kb: The swap amount in kilobytes
+ * @group: The cgroup to get mem+swap hard limit for
+ * @kb: The mem+swap amount in kilobytes
  *
  * Returns: 0 on success
  */
-int virCgroupGetSwapHardLimit(virCgroupPtr group, unsigned long long *kb)
+int virCgroupGetMemSwapHardLimit(virCgroupPtr group, unsigned long long *kb)
 {
     long long unsigned int limit_in_bytes;
     int ret;
diff --git a/src/util/cgroup.h b/src/util/cgroup.h
index 964da7a..8333b1b 100644
--- a/src/util/cgroup.h
+++ b/src/util/cgroup.h
@@ -47,8 +47,8 @@ int virCgroupSetMemoryHardLimit(virCgroupPtr group, unsigned long long kb);
 int virCgroupGetMemoryHardLimit(virCgroupPtr group, unsigned long long *kb);
 int virCgroupSetMemorySoftLimit(virCgroupPtr group, unsigned long long kb);
 int virCgroupGetMemorySoftLimit(virCgroupPtr group, unsigned long long *kb);
-int virCgroupSetSwapHardLimit(virCgroupPtr group, unsigned long long kb);
-int virCgroupGetSwapHardLimit(virCgroupPtr group, unsigned long long *kb);
+int virCgroupSetMemSwapHardLimit(virCgroupPtr group, unsigned long long kb);
+int virCgroupGetMemSwapHardLimit(virCgroupPtr group, unsigned long long *kb);
 
 int virCgroupDenyAllDevices(virCgroupPtr group);
 



--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]