]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: match RNG to supported driver types
authorEric Blake <eblake@redhat.com>
Fri, 28 Sep 2012 18:57:54 +0000 (12:57 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 19 Oct 2012 23:35:09 +0000 (17:35 -0600)
At one point, the code passed through arbitrary strings for file
formats, which supposedly lets qemu handle a new file type even
before libvirt has been taught to handle it.  However, to properly
label files, libvirt has to learn the file type anyway, so we
might as well make our life easier by only accepting file types
that we are prepared to handle.  This patch lets the RNG validation
ensure that only known strings are let through.

* docs/schemas/domaincommon.rng (driverFormat): Limit to list of
supported strings.
* docs/schemas/domainsnapshot.rng (driver): Likewise.

docs/schemas/domaincommon.rng
docs/schemas/domainsnapshot.rng

index 17ad86b907960a709c87345a483129ce1731531d..2beb035035f9d4a92849639462ee5764bf6cd8f5 100644 (file)
       <ref name="genericName"/>
     </attribute>
     <optional>
-      <attribute name="type">
-        <ref name="genericName"/>
+      <attribute name='type'>
+        <choice>
+          <ref name='diskFormat'/>
+          <value>aio</value> <!-- back-compat for 'raw' -->
+        </choice>
       </attribute>
     </optional>
   </define>
+  <define name='diskFormat'>
+    <choice>
+      <value>raw</value>
+      <value>dir</value>
+      <value>bochs</value>
+      <value>cloop</value>
+      <value>cow</value>
+      <value>dmg</value>
+      <value>iso</value>
+      <value>qcow</value>
+      <value>qcow2</value>
+      <value>qed</value>
+      <value>vmdk</value>
+      <value>vpc</value>
+      <value>fat</value>
+      <value>vhd</value>
+    </choice>
+  </define>
   <define name="driverCache">
     <attribute name="cache">
       <choice>
       </attribute>
       <optional>
         <attribute name='format'>
-          <ref name="genericName"/>
+          <ref name='diskFormat'/>
         </attribute>
       </optional>
       <optional>
index 0ef0631246c003952023675f306fc8857fc90957..ecaafe9baeafb4d44081de69545c586f80f8ce05 100644 (file)
               <element name='driver'>
                 <optional>
                   <attribute name='type'>
-                    <ref name='genericName'/>
+                    <ref name='diskFormat'/>
                   </attribute>
                 </optional>
                 <empty/>