[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


Hello,

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

   <define name="absFilePath">
     <data type="string">
       <param 
name="pattern">/[a-zA-Z0-9_\.\+\-\\&"'<>/%,:]+</param>
     </data>
   </define>

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">
     <optional>
       <attribute name="type">
         <value>file</value>
       </attribute>
     </optional>
     <interleave>
       <optional>
         <element name="source">
           <optional>
             <attribute name="file">
               <ref name="absFilePath"/>
             </attribute>


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'/>
     </disk>

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

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 
problems?

--
Dmitry Guryanov




More information about the libvir-list mailing list