https://gitlab.com/libvirt/libvirt/-/issues/178 Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/conf/domain_validate.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 98202a3adc..9422b00964 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -1495,6 +1495,33 @@ virDomainDefIOMMUValidate(const virDomainDef *def) } +static int +virDomainDefFSValidate(const virDomainDef *def) +{ + size_t i; + g_autoptr(GHashTable) dsts = virHashNew(NULL); + + for (i = 0; i < def->nfss; i++) { + const virDomainFSDef *fs = def->fss[i]; + + if (fs->fsdriver != VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) + continue; + + if (virHashHasEntry(dsts, fs->dst)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("filesystem target '%s' specified twice"), + fs->dst); + return -1; + } + + if (virHashAddEntry(dsts, fs->dst, (void *) 0x1) < 0) + return -1; + } + + return 0; +} + + static int virDomainDefValidateInternal(const virDomainDef *def, virDomainXMLOption *xmlopt) @@ -1541,6 +1568,9 @@ virDomainDefValidateInternal(const virDomainDef *def, if (virDomainNumaDefValidate(def->numa) < 0) return -1; + if (virDomainDefFSValidate(def) < 0) + return -1; + return 0; } -- 2.31.1