]> xenbits.xensource.com Git - libvirt.git/commitdiff
cputune: Support cputune for lxc driver
authorOsier Yang <jyang@redhat.com>
Tue, 29 Mar 2011 13:42:54 +0000 (21:42 +0800)
committerOsier Yang <jyang@redhat.com>
Tue, 29 Mar 2011 14:13:46 +0000 (22:13 +0800)
LXC driver doesn't support vcpu affinity yet, so just need
to modify it to support cpu shares.

src/lxc/lxc_controller.c
src/lxc/lxc_driver.c

index 1ab6351df27144ebf67d90fce9b7853050954f96..7ea69fbb5ac00b17142bb62151b1f34f3f9a6704 100644 (file)
@@ -117,6 +117,16 @@ static int lxcSetContainerResources(virDomainDefPtr def)
         }
     }
 
+    if (def->cputune.shares) {
+        rc = virCgroupSetCpuShares(cgroup, def->cputune.shares);
+        if (rc != 0) {
+            virReportSystemError(-rc,
+                                 _("Unable to set cpu shares for domain %s"),
+                                 def->name);
+            goto cleanup;
+        }
+    }
+
     rc = virCgroupSetMemory(cgroup, def->mem.max_balloon);
     if (rc != 0) {
         virReportSystemError(-rc,
index 96f6c4b4c101d9ee7c0daa962554f06a3e99f4ca..e90530284c41b2da6a656321b940cd0ba9aa0031 100644 (file)
@@ -2292,6 +2292,8 @@ static int lxcSetSchedulerParameters(virDomainPtr domain,
                                  params[i].value.ul);
             goto cleanup;
         }
+
+        vm->def->cputune.shares = params[i].value.ul;
     }
     ret = 0;