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

parallels: apply config after VM creation

New VM will have default values for all parameters, like
cpu number, we have to change its configuration as provided
by xml definition, given to parallelsDomainDefineXML.
Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
上级 b4f0c19e
......@@ -2013,20 +2013,6 @@ parallelsDomainDefineXML(virConnectPtr conn, const char *xml)
if (dupVM == 1) {
olddom = virDomainFindByUUID(&privconn->domains, def->uuid);
if (parallelsApplyChanges(conn, olddom, def) < 0) {
virDomainObjUnlock(olddom);
goto cleanup;
}
virDomainObjUnlock(olddom);
if (!(dom = virDomainAssignDef(privconn->caps,
&privconn->domains, def, false))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Can't allocate domobj"));
goto cleanup;
}
def = NULL;
} else {
if (STREQ(def->os.type, "hvm")) {
if (parallelsCreateVm(conn, def))
......@@ -2041,8 +2027,8 @@ parallelsDomainDefineXML(virConnectPtr conn, const char *xml)
}
if (parallelsLoadDomains(privconn, def->name))
goto cleanup;
dom = virDomainFindByName(&privconn->domains, def->name);
if (!dom) {
olddom = virDomainFindByName(&privconn->domains, def->name);
if (!olddom) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Domain for '%s' is not defined after creation"),
def->name ? def->name : _("(unnamed)"));
......@@ -2050,6 +2036,21 @@ parallelsDomainDefineXML(virConnectPtr conn, const char *xml)
}
}
if (parallelsApplyChanges(conn, olddom, def) < 0) {
virDomainObjUnlock(olddom);
goto cleanup;
}
virDomainObjUnlock(olddom);
if (!(dom = virDomainAssignDef(privconn->caps,
&privconn->domains, def, false))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Can't allocate domobj"));
goto cleanup;
}
def = NULL;
ret = virGetDomain(conn, dom->def->name, dom->def->uuid);
if (ret)
ret->id = dom->def->id;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册