提交 c273d72d 编写于 作者: J Ján Tomko 提交者: Cole Robinson

conf: move default video addition after XML parsing

Separate parsing of the XML from auto-generating the device.

(cherry picked from commit 6879be48)
上级 4dacbcf2
...@@ -16374,28 +16374,6 @@ virDomainDefParseXML(xmlDocPtr xml, ...@@ -16374,28 +16374,6 @@ virDomainDefParseXML(xmlDocPtr xml,
VIR_FREE(nodes); VIR_FREE(nodes);
/* For backwards compatibility, if no <video> tag is set but there
* is a <graphics> tag, then we add a single video tag */
if (def->ngraphics && !def->nvideos) {
virDomainVideoDefPtr video;
if (VIR_ALLOC(video) < 0)
goto error;
video->type = virDomainVideoDefaultType(def);
if (video->type < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot determine default video type"));
VIR_FREE(video);
goto error;
}
video->vram = virDomainVideoDefaultRAM(def, video->type);
video->heads = 1;
if (VIR_ALLOC_N(def->videos, 1) < 0) {
virDomainVideoDefFree(video);
goto error;
}
def->videos[def->nvideos++] = video;
}
/* analysis of the host devices */ /* analysis of the host devices */
if ((n = virXPathNodeSet("./devices/hostdev", ctxt, &nodes)) < 0) if ((n = virXPathNodeSet("./devices/hostdev", ctxt, &nodes)) < 0)
goto error; goto error;
...@@ -18592,6 +18570,37 @@ virDomainDefAddImplicitControllers(virDomainDefPtr def) ...@@ -18592,6 +18570,37 @@ virDomainDefAddImplicitControllers(virDomainDefPtr def)
return 0; return 0;
} }
static int
virDomainDefAddImplicitVideo(virDomainDefPtr def)
{
int ret = -1;
virDomainVideoDefPtr video = NULL;
/* For backwards compatibility, if no <video> tag is set but there
* is a <graphics> tag, then we add a single video tag */
if (def->ngraphics && !def->nvideos) {
if (VIR_ALLOC(video) < 0)
goto cleanup;
video->type = virDomainVideoDefaultType(def);
if (video->type < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot determine default video type"));
goto cleanup;
}
video->vram = virDomainVideoDefaultRAM(def, video->type);
video->heads = 1;
if (VIR_ALLOC_N(def->videos, 1) < 0)
goto cleanup;
def->videos[def->nvideos++] = video;
video = NULL;
}
ret = 0;
cleanup:
virDomainVideoDefFree(video);
return ret;
}
int int
virDomainDefAddImplicitDevices(virDomainDefPtr def) virDomainDefAddImplicitDevices(virDomainDefPtr def)
{ {
...@@ -18601,6 +18610,9 @@ virDomainDefAddImplicitDevices(virDomainDefPtr def) ...@@ -18601,6 +18610,9 @@ virDomainDefAddImplicitDevices(virDomainDefPtr def)
if (virDomainDefAddImplicitControllers(def) < 0) if (virDomainDefAddImplicitControllers(def) < 0)
return -1; return -1;
if (virDomainDefAddImplicitVideo(def) < 0)
return -1;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册