mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
domain_conf.c: move blkio path check to domain_validate.c
Move this check to a new virDomainDefTunablesValidate(), which is called by virDomainDefValidateInternal(). Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
fee929dd20
commit
388ad4432d
@ -6983,6 +6983,9 @@ virDomainDefValidateInternal(const virDomainDef *def,
|
||||
if (virDomainDefVideoValidate(def) < 0)
|
||||
return -1;
|
||||
|
||||
if (virDomainDefTunablesValidate(def) < 0)
|
||||
return -1;
|
||||
|
||||
if (virDomainNumaDefValidate(def->numa) < 0)
|
||||
return -1;
|
||||
|
||||
@ -20880,7 +20883,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 */
|
||||
@ -20901,15 +20904,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);
|
||||
|
||||
|
@ -496,3 +496,24 @@ virDomainSmartcardDefValidate(const virDomainSmartcardDef *smartcard,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
virDomainDefTunablesValidate(const virDomainDef *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;
|
||||
}
|
||||
|
@ -42,3 +42,4 @@ int virDomainRNGDefValidate(const virDomainRNGDef *rng,
|
||||
const virDomainDef *def);
|
||||
int virDomainSmartcardDefValidate(const virDomainSmartcardDef *smartcard,
|
||||
const virDomainDef *def);
|
||||
int virDomainDefTunablesValidate(const virDomainDef *def);
|
||||
|
Loading…
x
Reference in New Issue
Block a user