[libvirt] Which symbols can be used in file paths in libvirt's XMLs?

Dmitry Guryanov dguryanov at virtuozzo.com
Wed Jul 1 16:22:33 UTC 2015


There is an absFilePatch type in docs/schemas/basictypes.rng rng schema:

   <define name="absFilePath">
     <data type="string">

There are quite few symbols in this set of the ones, which linux allows 
to have in file paths. For example spaces or curly braces are not 
allowed. There are a lot of elements of this type in other rng schems, 
for example:

   <define name="diskSourceFile">
       <attribute name="type">
         <element name="source">
             <attribute name="file">
               <ref name="absFilePath"/>

There is no checks in libvirt if the the xml, given to, for example, 
virDomainDefineXML function conforms to this schema. I've added a disk 
to the domain with curly braces in path and there were no errors:

     <disk type='file' device='disk'>
       <driver name='qemu' type='qcow2'/>
       <source file='/home/libvirt/{123}.qcow2'/>
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>

The domain was successfully defined and virsh dumpxml shows this path in 

So the question is, where did this path pattern come from? Is it 
possible to use file paths with another symbols or there will be some 

Dmitry Guryanov

More information about the libvir-list mailing list