提交 4b5652d0 编写于 作者: D Doug Goldstein

Allow <source> for type=block to have no dev

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.
上级 caf65892
......@@ -1140,9 +1140,11 @@
<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>
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册