提交 4bc97d59 编写于 作者: D Dmitry Guryanov 提交者: Daniel Veillard

parallels: handle unlimited cpus on containers

User may set "unlimited" cpus for containers, which means to
take all available cpus on the node.
Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
上级 fb583a8f
......@@ -468,12 +468,29 @@ parallelsLoadDomain(parallelsConnPtr privconn, virJSONValuePtr jobj)
goto cleanup;
}
if (virJSONValueObjectGetNumberUint(jobj3, "cpus", &x) < 0) {
if (virJSONValueObjectGetNumberUint(jobj3, "cpus", &x) == 0) {
def->vcpus = x;
def->maxvcpus = x;
} else if ((tmp = virJSONValueObjectGetString(jobj3, "cpus"))) {
if (STREQ(tmp, "unlimited")) {
virNodeInfo nodeinfo;
if (nodeGetInfo(NULL, &nodeinfo) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Can't get node info"));
goto cleanup;
}
def->vcpus = nodeinfo.cpus;
def->maxvcpus = def->vcpus;
} else {
parallelsParseError();
goto cleanup;
}
} else {
parallelsParseError();
goto cleanup;
}
def->vcpus = x;
def->maxvcpus = x;
if (!(jobj3 = virJSONValueObjectGet(jobj2, "memory"))) {
parallelsParseError();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册