Add these XML formats validation in manpage or script: cpu, domainbackup, domaincaps, domaincheckpoint, networkport, storagepoolcaps. Signed-off-by: Han Han <hhan@xxxxxxxxxx> --- Diff from v1: Add domainbackup, domaincaps, networkport, storagepoolcaps v1: https://listman.redhat.com/archives/libvir-list/2021-November/225070.html --- docs/manpages/virt-xml-validate.rst | 24 ++++++++++++++++++++++++ tools/virt-xml-validate.in | 15 +++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/docs/manpages/virt-xml-validate.rst b/docs/manpages/virt-xml-validate.rst index 940eada3a8..503ddbd35a 100644 --- a/docs/manpages/virt-xml-validate.rst +++ b/docs/manpages/virt-xml-validate.rst @@ -31,18 +31,42 @@ from the name of the root element in the XML document. Valid schema names currently include +- ``cpu`` + +The schema for the XML format of cpu + - ``domainsnapshot`` The schema for the XML format used by domain snapshot configuration +- ``domaincheckpoint`` + +The schema for the XML format used by domain checkpoint configuration + +- ``domainbackup`` + +The schema for the XML format used by domain backup configuration + +- ``domaincaps`` + +The schema for the XML format of domain capabilities + - ``domain`` The schema for the XML format used by guest domains configuration +- ``networkport`` + +The schema for the XML format used by network port configuration + - ``network`` The schema for the XML format used by virtual network configuration +- ``storagepoolcaps`` + +The schema for the XML format of storage pool capabilities + - ``storagepool`` The schema for the XML format used by storage pool configuration diff --git a/tools/virt-xml-validate.in b/tools/virt-xml-validate.in index 249bcf7eef..e444ef2fbc 100644 --- a/tools/virt-xml-validate.in +++ b/tools/virt-xml-validate.in @@ -74,9 +74,21 @@ if [ -z "$TYPE" ]; then ROOT=`xmllint --stream --debug "$XMLFILE" 2>/dev/null | grep "^0 1 " | awk '{ print $3 }'` fi case "$ROOT" in + *cpu*) + TYPE="cpu" + ;; *domainsnapshot*) # Must come first, since *domain* is a substring TYPE="domainsnapshot" ;; + *domaincheckpoint*) + TYPE="domaincheckpoint" + ;; + *domainbackup*) + TYPE="domainbackup" + ;; + *domaincaps*) + TYPE="domaincaps" + ;; *domain*) TYPE="domain" ;; @@ -86,6 +98,9 @@ if [ -z "$TYPE" ]; then *network*) TYPE="network" ;; + *storagepoolcaps*) + TYPE="storagepoolcaps" + ;; *pool*) TYPE="storagepool" ;; -- 2.36.0