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 then it would not have the leading "<source ", resulting in invalid XML. --- docs/schemas/domaincommon.rng | 8 +++++--- src/conf/domain_conf.c | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index ecd3a42..2f596bf 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -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> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 19bb82e..0704411 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14204,8 +14204,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); -- 1.8.1.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list