]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: update domain live xml for virsh memtune with --live flag
authorGuannan Ren <gren@redhat.com>
Tue, 5 Mar 2013 16:24:57 +0000 (00:24 +0800)
committerGuannan Ren <gren@redhat.com>
Wed, 6 Mar 2013 03:46:33 +0000 (11:46 +0800)
virsh subcommand memtune forgot updating domain live xml
after setting cgroup value.

src/qemu/qemu_driver.c

index 42b8c77b21b7488803d61aee80766a5e4da0c8b3..32b05229fc82e789e95c77c61324744bab292d9d 100644 (file)
@@ -7303,11 +7303,13 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
     }
 
     if (set_swap_hard_limit) {
-        if (flags & VIR_DOMAIN_AFFECT_LIVE &&
-            (rc = virCgroupSetMemSwapHardLimit(group, swap_hard_limit)) < 0) {
-            virReportSystemError(-rc, "%s",
-                                 _("unable to set memory swap_hard_limit tunable"));
-            goto cleanup;
+        if (flags & VIR_DOMAIN_AFFECT_LIVE) {
+            if ((rc = virCgroupSetMemSwapHardLimit(group, swap_hard_limit)) < 0) {
+                virReportSystemError(-rc, "%s",
+                                     _("unable to set memory swap_hard_limit tunable"));
+                goto cleanup;
+            }
+            vm->def->mem.swap_hard_limit = swap_hard_limit;
         }
 
         if (flags & VIR_DOMAIN_AFFECT_CONFIG)
@@ -7315,11 +7317,13 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
     }
 
     if (set_memory_hard_limit) {
-        if (flags & VIR_DOMAIN_AFFECT_LIVE &&
-            (rc = virCgroupSetMemoryHardLimit(group, memory_hard_limit)) < 0) {
-            virReportSystemError(-rc, "%s",
-                                 _("unable to set memory hard_limit tunable"));
-            goto cleanup;
+        if (flags & VIR_DOMAIN_AFFECT_LIVE) {
+            if ((rc = virCgroupSetMemoryHardLimit(group, memory_hard_limit)) < 0) {
+                virReportSystemError(-rc, "%s",
+                                     _("unable to set memory hard_limit tunable"));
+                goto cleanup;
+            }
+            vm->def->mem.hard_limit = memory_hard_limit;
         }
 
         if (flags & VIR_DOMAIN_AFFECT_CONFIG)
@@ -7327,11 +7331,13 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
     }
 
     if (set_memory_soft_limit) {
-        if (flags & VIR_DOMAIN_AFFECT_LIVE &&
-            (rc = virCgroupSetMemorySoftLimit(group, memory_soft_limit)) < 0) {
-            virReportSystemError(-rc, "%s",
-                                 _("unable to set memory soft_limit tunable"));
-            goto cleanup;
+        if (flags & VIR_DOMAIN_AFFECT_LIVE) {
+            if ((rc = virCgroupSetMemorySoftLimit(group, memory_soft_limit)) < 0) {
+                virReportSystemError(-rc, "%s",
+                                     _("unable to set memory soft_limit tunable"));
+                goto cleanup;
+            }
+            vm->def->mem.soft_limit = memory_soft_limit;
         }
 
         if (flags & VIR_DOMAIN_AFFECT_CONFIG)