diff -r ebecbe5caa03 -r b07cd92a30e9 src/virsh.c
--- a/src/virsh.c Tue Oct 07 08:21:50 2008 -0700
+++ b/src/virsh.c Tue Oct 07 08:21:50 2008 -0700
@@ -1114,6 +1114,7 @@
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("domain name, id
or uuid")},
{"weight", VSH_OT_INT, VSH_OFLAG_NONE, gettext_noop("weight for
XEN_CREDIT")},
{"cap", VSH_OT_INT, VSH_OFLAG_NONE, gettext_noop("cap for
XEN_CREDIT")},
+ {"cpu_shares", VSH_OT_INT, VSH_OFLAG_NONE, gettext_noop("cpu shares
for LXC")},
{NULL, 0, 0, NULL}
};
@@ -1128,11 +1129,14 @@
int nr_inputparams = 0;
int inputparams = 0;
int weightfound = 0;
+ int sharesfound = 0;
int weight = 0;
int capfound = 0;
+ int shares = 0;
int cap = 0;
char str_weight[] = "weight";
char str_cap[] = "cap";
+ char str_shares[] = "cpu_shares";
int ret_val = FALSE;
if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
@@ -1152,6 +1156,7 @@
}
}
+ /* Currently supports Xen Credit only */
if(vshCommandOptBool(cmd, "cap")) {
cap = vshCommandOptInt(cmd, "cap", &capfound);
if (!capfound) {
@@ -1162,6 +1167,17 @@
}
}
+ /* Currently supports LXC cgroup only */
+ if(vshCommandOptBool(cmd, "cpu_shares")) {
+ shares = vshCommandOptInt(cmd, "cpu_shares", &sharesfound);
+ if (!sharesfound) {
+ vshError(ctl, FALSE, "%s", _("Invalid value of
cpu_shares"));
+ goto cleanup;
+ } else {
+ nr_inputparams++;
+ }
+ }
+
params = vshMalloc(ctl, sizeof (virSchedParameter) * nr_inputparams);
if (params == NULL) {
goto cleanup;
@@ -1180,7 +1196,13 @@
params[inputparams].value.ui = cap;
inputparams++;
}
- /* End Currently supports Xen Credit only */
+
+ if (sharesfound) {
+ strncpy(params[inputparams].field,str_shares,sizeof(str_shares));
+ params[inputparams].type = VIR_DOMAIN_SCHED_FIELD_UINT;
+ params[inputparams].value.ul = shares;
+ inputparams++;
+ }
assert (inputparams == nr_inputparams);