virt-xml-validate: Add more XML formats support

Add these XML formats validation in manpage or script:
cpu, domainbackup, domaincaps, domaincheckpoint, networkport,
storagepoolcaps.

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Han Han 2022-05-11 14:18:32 +08:00 committed by Ján Tomko
parent af1933713b
commit 7b0e2e4a55
2 changed files with 39 additions and 0 deletions

View File

@ -31,18 +31,42 @@ from the name of the root element in the XML document.
Valid schema names currently include Valid schema names currently include
- ``cpu``
The schema for the XML format of cpu
- ``domainsnapshot`` - ``domainsnapshot``
The schema for the XML format used by domain snapshot configuration 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`` - ``domain``
The schema for the XML format used by guest domains configuration The schema for the XML format used by guest domains configuration
- ``networkport``
The schema for the XML format used by network port configuration
- ``network`` - ``network``
The schema for the XML format used by virtual network configuration The schema for the XML format used by virtual network configuration
- ``storagepoolcaps``
The schema for the XML format of storage pool capabilities
- ``storagepool`` - ``storagepool``
The schema for the XML format used by storage pool configuration The schema for the XML format used by storage pool configuration

View File

@ -74,9 +74,21 @@ if [ -z "$TYPE" ]; then
ROOT=`xmllint --stream --debug "$XMLFILE" 2>/dev/null | grep "^0 1 " | awk '{ print $3 }'` ROOT=`xmllint --stream --debug "$XMLFILE" 2>/dev/null | grep "^0 1 " | awk '{ print $3 }'`
fi fi
case "$ROOT" in case "$ROOT" in
*cpu*)
TYPE="cpu"
;;
*domainsnapshot*) # Must come first, since *domain* is a substring *domainsnapshot*) # Must come first, since *domain* is a substring
TYPE="domainsnapshot" TYPE="domainsnapshot"
;; ;;
*domaincheckpoint*)
TYPE="domaincheckpoint"
;;
*domainbackup*)
TYPE="domainbackup"
;;
*domaincaps*)
TYPE="domaincaps"
;;
*domain*) *domain*)
TYPE="domain" TYPE="domain"
;; ;;
@ -86,6 +98,9 @@ if [ -z "$TYPE" ]; then
*network*) *network*)
TYPE="network" TYPE="network"
;; ;;
*storagepoolcaps*)
TYPE="storagepoolcaps"
;;
*pool*) *pool*)
TYPE="storagepool" TYPE="storagepool"
;; ;;