[libvirt] [PATCH 2/3] virt-xml-validate: add missing schemas

Eric Blake eblake at redhat.com
Mon Aug 19 22:43:14 UTC 2013


We were failing to autoprobe which schema to use for several
top-level XML elements.

* tools/virt-xml-validate.in (TYPE): Recognize <domainsnapshot>,
<filter>, and <secret>.

Signed-off-by: Eric Blake <eblake at redhat.com>
---
 tools/virt-xml-validate.in | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/tools/virt-xml-validate.in b/tools/virt-xml-validate.in
index 9744612..82686f4 100644
--- a/tools/virt-xml-validate.in
+++ b/tools/virt-xml-validate.in
@@ -56,6 +56,9 @@ fi
 if [ -z "$TYPE" ]; then
   ROOT=`xmllint --stream --debug "$XMLFILE" 2>/dev/null | grep "^0 1 " | awk '{ print $3 }'`
   case "$ROOT" in
+     *domainsnapshot*) # Must come first, since *domain* is a substring
+        TYPE="domainsnapshot"
+        ;;
      *domain*)
         TYPE="domain"
         ;;
@@ -74,8 +77,14 @@ if [ -z "$TYPE" ]; then
      *device*)
         TYPE="nodedev"
         ;;
+     *filter*)
+        TYPE="nwfilter"
+        ;;
+     *secret*)
+        TYPE="secret"
+        ;;
      *)
-       echo "$0: cannot determine schema type for $XMLFILE"
+       echo "$0: cannot determine schema type for $XMLFILE" >&2
        exit 3
   esac
 fi
@@ -83,7 +92,7 @@ fi
 SCHEMA="@schemadir@/${TYPE}.rng"

 if [ ! -f "$SCHEMA" ]; then
-  echo "$0: schema $SCHEMA does not exist"
+  echo "$0: schema $SCHEMA does not exist" >&2
   exit 4
 fi

-- 
1.8.3.1




More information about the libvir-list mailing list