mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
conf: reject multiple panic devices of same model
Only one panic device per model is allowed.
This commit is contained in:
parent
59fc0d0609
commit
e720e530be
@ -3747,6 +3747,28 @@ virDomainDefRejectDuplicateControllers(virDomainDefPtr def)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
virDomainDefRejectDuplicatePanics(virDomainDefPtr def)
|
||||
{
|
||||
bool exists[VIR_DOMAIN_PANIC_MODEL_LAST];
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < VIR_DOMAIN_PANIC_MODEL_LAST; i++)
|
||||
exists[i] = false;
|
||||
|
||||
for (i = 0; i < def->npanics; i++) {
|
||||
virDomainPanicModel model = def->panics[i]->model;
|
||||
if (exists[model]) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("Multiple panic devices with model '%s'"),
|
||||
virDomainPanicModelTypeToString(model));
|
||||
return -1;
|
||||
}
|
||||
exists[model] = true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* virDomainDefMetadataSanitize:
|
||||
@ -3976,6 +3998,9 @@ virDomainDefPostParseInternal(virDomainDefPtr def,
|
||||
if (virDomainDefRejectDuplicateControllers(def) < 0)
|
||||
return -1;
|
||||
|
||||
if (virDomainDefRejectDuplicatePanics(def) < 0)
|
||||
return -1;
|
||||
|
||||
/* verify settings of guest timers */
|
||||
for (i = 0; i < def->clock.ntimers; i++) {
|
||||
virDomainTimerDefPtr timer = def->clock.timers[i];
|
||||
|
Loading…
Reference in New Issue
Block a user