Use this check to create a virDomainDefTunablesPostParse() function, that is called on post parse time.
Signed-off-by: Daniel Henrique Barboza <danielhb...@gmail.com> --- src/conf/domain_conf.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index cced9aee50..220224cebe 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -5933,6 +5933,27 @@ virDomainDefBootPostParse(virDomainDefPtr def) } +static int +virDomainDefTunablesPostParse(virDomainDefPtr def) +{ + size_t i, j; + + for (i = 0; i < def->blkio.ndevices; i++) { + for (j = 0; j < i; j++) { + if (STREQ(def->blkio.devices[j].path, + def->blkio.devices[i].path)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("duplicate blkio device path '%s'"), + def->blkio.devices[i].path); + return -1; + } + } + } + + return 0; +} + + static int virDomainDefPostParseVideo(virDomainDefPtr def, void *opaque) @@ -6020,6 +6041,9 @@ virDomainDefPostParseCommon(virDomainDefPtr def, if (virDomainDefBootPostParse(def) < 0) return -1; + if (virDomainDefTunablesPostParse(def) < 0) + return -1; + if (def->os.type == VIR_DOMAIN_OSTYPE_HVM && !(data->xmlopt->config.features & VIR_DOMAIN_DEF_FEATURE_NO_BOOT_ORDER) && virDomainDefBootOrderPostParse(def) < 0) @@ -21395,7 +21419,7 @@ virDomainDefTunablesParse(virDomainDefPtr def, unsigned int flags) { g_autofree xmlNodePtr *nodes = NULL; - size_t i, j; + size_t i; int n; /* Extract blkio cgroup tunables */ @@ -21416,15 +21440,6 @@ virDomainDefTunablesParse(virDomainDefPtr def, &def->blkio.devices[i]) < 0) return -1; def->blkio.ndevices++; - for (j = 0; j < i; j++) { - if (STREQ(def->blkio.devices[j].path, - def->blkio.devices[i].path)) { - virReportError(VIR_ERR_XML_ERROR, - _("duplicate blkio device path '%s'"), - def->blkio.devices[i].path); - return -1; - } - } } VIR_FREE(nodes); -- 2.26.2