Hi,
This started as a simple NVDIMM change, then I realized there
is a Gitlab work item for it [1], so I took the extra
mile and did a bit more. I'll copy/paste here the motivation
for this kind of change, provided by Cole in [1]:
-----
The code that handles domain/VM XML parsing (virDomainDefParseXML in
src/domain/domain_conf.c) has various validation checks sprinkled
within it. Many of these checks should be moved out of the parse step
and into virDomainDefPostParse, so they can be shared by various
places in the code that build a domain definition without XML, such
as converting from native vmware/virtualbox/xen formats.
-----
There are still checks to be moved after this work. If this is
accepted I'll update [1] with more details/tips about how to proceed
with the remaining checks.
Some g_auto* cleanups were done along the way.
[1]
https://gitlab.com/libvirt/libvirt/-/issues/7
Daniel Henrique Barboza (21):
domain_conf.c: move NVDIMM 'labelsize' check to post parse
domain_conf.c: use g_autofree in 'dev' in virDomainDefParseBootXML()
domain_conf.c: modernize virDomainDefBootOrderPostParse()
domain_conf.c: move boot related timeouts check to post parse
domain_conf.c: do not leak 'video' in virDomainDefParseXML()
domain_conf.c: move primary video check to
virDomainDefPostParseVideo()
domain_conf.c: use g_autoptr() with virDomainVideoDefPtr
domain_conf.c: move QXL attributes check to
virDomainVideoDefPostParse()
virstorageencryption.h: add AUTOPTR_CLEANUP_FUNC for
virStorageEncryptionPtr
domain_conf: modernize virDomainDiskDefParseXML()
domain_conf.c: move vendor, product and tray checks to post parse
domain_conf.c: move smartcard address check to post parse
domain_conf.c: modernize virDomainSmartcardDefParseXML
domain_conf.c: remove 'error' label in virDomainDefTunablesParse()
domain_conf.c: move duplicate blkio path check to post parse
domain_conf.c: move virDomainPCIControllerOpts checks to post parse
domain_conf.c: move pci-root/pcie-root address check to post parse
domain_conf.c: modernize virDomainControllerDefParseXML()
domain_conf.c: modernize virDomainDefControllersParse()
domain_conf.c: use VIR_ERR_CONFIG_UNSUPPORTED in post parse
domain_conf.c: move idmapEntry checks to post parse
src/conf/domain_conf.c | 762 ++++++++++--------
src/conf/domain_conf.h | 4 +
src/util/virstorageencryption.h | 1 +
tests/qemuxml2argvdata/pci-root-address.err | 2 +-
.../pseries-default-phb-numa-node.err | 2 +-
.../video-multiple-primaries.err | 1 +
.../video-multiple-primaries.xml | 32 +
tests/qemuxml2argvtest.c | 5 +
8 files changed, 451 insertions(+), 358 deletions(-)
create mode 100644 tests/qemuxml2argvdata/video-multiple-primaries.err
create mode 100644 tests/qemuxml2argvdata/video-multiple-primaries.xml