mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
conf: reject duplicate virtiofs tags
https://gitlab.com/libvirt/libvirt/-/issues/178 Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
9e2a2f4d6d
commit
56dcdec1ac
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user