Commit Graph

6 Commits

Author SHA1 Message Date
Daniel Henrique Barboza
98bc393579 domain_conf: move vendor, product and tray checks to domain_validate.c
The 'tray' check isn't a XML parse specific code and can be pushed
to the validate callback, in virDomainDiskDefValidate().

'vendor' and 'product' string sizes are already checked by the
domaincommon.rng schema, but can be of use in the validate callback
since not all scenarios will go through the XML parsing.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-12-09 09:51:51 -03:00
Daniel Henrique Barboza
654e106397 domain_conf: move virDomainDiskDefValidate() to domain_validate.c
Next patch will add more validations to the function. Let's move
it beforehand to domain_validate.c.

virSecurityDeviceLabelDefValidateXML() is still used inside
domain_conf.c, so make it public for now until its current
caller (virDomainChrSourceDefValidate()) is also moved to
domain_validate.c.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-12-09 09:51:51 -03:00
Daniel Henrique Barboza
b628416399 domain_conf.c: move QXL attributes check to virDomainVideoDefValidate()
These checks are not related to XML parsing and can be moved to the
validate callback. Errors were changed from VIR_ERR_XML_ERROR to
VIR_ERR_CONFIG_UNSUPPORTED.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-12-09 09:51:51 -03:00
Daniel Henrique Barboza
212c58b20e domain_conf.c: move virDomainVideoDefValidate() to domain_validate.c
We'll add more video validations into the function in the next
patch. Let's move it beforehand to domain_validate.c.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-12-09 09:51:51 -03:00
Daniel Henrique Barboza
88bbae85f9 domain_conf.c: move primary video check to validate callback
This check isn't exclusive to XML parsing. Let's move it to
virDomainDefVideoValidate() in domain_validate.c

We don't have a failure test for this scenario, so a new test called
'video-multiple-primaries' was added to test this failure case.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-12-09 09:51:51 -03:00
Daniel Henrique Barboza
7ad9162961 domain_conf: move boot timeouts check to domain_validate.c
This patch creates a new function, virDomainDefBootValidate(), to host
the validation of boot menu timeout and rebootTimeout outside of parse
time. The checks in virDomainDefParseBootXML() were changed to throw
VIR_ERR_XML_ERROR in case of parse error of those values.

In an attempt to alleviate the amount of code being stacked inside
domain_conf.c, let's put this new function in a new domain_validate.c
file that will be used to place these validations.

Suggested-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-12-09 09:51:51 -03:00