Call per-device post-parse callback even on implicit video

Commit 6879be48 moved adding of an implicit video device after XML
parsing. As a result, libxlDomainDeviceDefPostParse() is no longer
called to set the default vram when adding an implicit device.
Commit 6879be48 assumes virDomainVideoDefaultRAM() will set the
default vram, but it returns 0 if the domain virtType is
VIR_DOMAIN_VIRT_XEN. Attempting to start an HVM domain with vram=0
results in

error: unsupported configuration: videoram must be at least 4MB for CIRRUS

The default vram setting for Xen HVM domains depends on the device
model used (qemu-xen vs qemu-traditional), hence setting the
default is deferred to libxlDomainDeviceDefPostParse().

Call the device post-parse callback even for implicit video,
to fill out the default vram even for VIR_DOMAIN_VIRT_XEN.

https://bugzilla.redhat.com/show_bug.cgi?id=1334557
Most-of-commit-message-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
Ján Tomko 2016-05-11 12:13:51 +02:00
parent e4d131b8cb
commit 3e42867032

View File

@ -4362,8 +4362,7 @@ virDomainDefPostParseDeviceIterator(virDomainDefPtr def ATTRIBUTE_UNUSED,
static int
virDomainDefPostParseInternal(virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED,
unsigned int parseFlags)
struct virDomainDefPostParseDeviceIteratorData *data)
{
/* verify init path for container based domains */
if (def->os.type == VIR_DOMAIN_OSTYPE_EXE && !def->os.init) {
@ -4372,7 +4371,7 @@ virDomainDefPostParseInternal(virDomainDefPtr def,
return -1;
}
if (virDomainDefPostParseMemory(def, parseFlags) < 0)
if (virDomainDefPostParseMemory(def, data->parseFlags) < 0)
return -1;
if (virDomainDefRejectDuplicateControllers(def) < 0)
@ -4387,11 +4386,22 @@ virDomainDefPostParseInternal(virDomainDefPtr def,
if (virDomainDefAddImplicitDevices(def) < 0)
return -1;
/* Mark the first video as primary. If the user specified primary="yes",
* the parser already inserted the device at def->videos[0] */
if (def->nvideos != 0)
if (def->nvideos != 0) {
virDomainDeviceDef device = {
.type = VIR_DOMAIN_DEVICE_VIDEO,
.data.video = def->videos[0],
};
/* Mark the first video as primary. If the user specified primary="yes",
* the parser already inserted the device at def->videos[0] */
def->videos[0]->primary = true;
/* videos[0] might have been added in AddImplicitDevices, after we've
* done the per-device post-parse */
if (virDomainDefPostParseDeviceIterator(NULL, &device, NULL, data) < 0)
return -1;
}
/* clean up possibly duplicated metadata entries */
virDomainDefMetadataSanitize(def);
@ -4429,7 +4439,7 @@ virDomainDefPostParse(virDomainDefPtr def,
return ret;
if ((ret = virDomainDefPostParseInternal(def, caps, parseFlags)) < 0)
if ((ret = virDomainDefPostParseInternal(def, &data)) < 0)
return ret;
if (virDomainDefPostParseCheckFeatures(def, xmlopt) < 0)