]> xenbits.xensource.com Git - libvirt.git/commitdiff
Allow <source> for type=block to have no dev
authorDoug Goldstein <cardoe@cardoe.com>
Mon, 9 Sep 2013 02:08:06 +0000 (21:08 -0500)
committerDoug Goldstein <cardoe@cardoe.com>
Tue, 17 Sep 2013 19:10:40 +0000 (14:10 -0500)
Currently the XML parser already allows the following syntax:
  <disk type='block' device='cdrom'>
    <source startupPolicy='optional'/>
    <target dev='hda' bus='ide'/>
    <address type='drive' controller='0' bus='0' target='0' unit='0'/>
  </disk>

But it if the dev value is NULL then it would not have the leading
"<source ", resulting in invalid XML.

docs/schemas/domaincommon.rng
src/conf/domain_conf.c

index 4d333a84e176ee96b73d6f08bd679c11eecce990..fb6a26c3bc16539f83b01fc5f75293b044d9f694 100644 (file)
           <interleave>
             <optional>
               <element name="source">
-                <attribute name="dev">
-                  <ref name="absFilePath"/>
-                </attribute>
+                <optional>
+                  <attribute name="dev">
+                    <ref name="absFilePath"/>
+                  </attribute>
+                </optional>
                 <optional>
                   <ref name="startupPolicy"/>
                 </optional>
index 05c1de4f53314110eb51d46995a3facb5df78412..c4b64645b92ade34c3e9ce07f60426a7bbbdd5e9 100644 (file)
@@ -14207,8 +14207,8 @@ virDomainDiskSourceDefFormat(virBufferPtr buf,
             }
             break;
         case VIR_DOMAIN_DISK_TYPE_BLOCK:
-            virBufferEscapeString(buf, "      <source dev='%s'",
-                                  def->src);
+            virBufferAddLit(buf, "      <source");
+            virBufferEscapeString(buf, " dev='%s'", def->src);
             if (def->startupPolicy)
                 virBufferEscapeString(buf, " startupPolicy='%s'",
                                       startupPolicy);