]> xenbits.xensource.com Git - libvirt.git/commit
xenconfig: support xl<->xml conversion of rbd disk devices
authorJim Fehlig <jfehlig@suse.com>
Thu, 11 Feb 2016 00:39:18 +0000 (17:39 -0700)
committerJim Fehlig <jfehlig@suse.com>
Mon, 22 Feb 2016 18:46:50 +0000 (11:46 -0700)
commit6604a3dd9f83cf2ff3686f2caba50bc06922f0f7
treee593de5140013920e3c39e143390aa66eb4bcec6
parenta44f1f85f96b443a7a6e02189d6f1f0c6b4a1dcf
xenconfig: support xl<->xml conversion of rbd disk devices

The target= setting in xl disk configuration can be used to encode
meta info that is meaningful to a backend. Leverage this fact to
support qdisk network disk types such as rbd. E.g. <disk> config
such as

   <disk type='network' device='disk'>
     <driver name='qemu' type='raw'/>
     <source protocol='rbd' name='pool/image'>
       <host name='mon1.example.org' port='6321'/>
       <host name='mon2.example.org' port='6322'/>
       <host name='mon3.example.org' port='6322'/>
     </source>
     <target dev='hdb' bus='ide'/>
     <address type='drive' controller='0' bus='0' target='0' unit='1'/>
   </disk>

can be converted to the following xl config (and vice versa)

  disk = [ "format=raw,vdev=hdb,access=rw,backendtype=qdisk,
            target=rbd:pool/image:auth_supported=none:mon_host=mon1.example.org\\:6321\\;mon2.example.org\\:6322\\;mon3.example.org\\:6322"
         ]

Note that in xl disk config, a literal backslash in target= must
be escaped with a backslash. Conversion of <auth> config is not
handled in this patch, but can be done in a follow-up patch.

Also add a test for the conversions.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
src/xenconfig/xen_xl.c
tests/xlconfigdata/test-rbd-multihost-noauth.cfg [new file with mode: 0644]
tests/xlconfigdata/test-rbd-multihost-noauth.xml [new file with mode: 0644]
tests/xlconfigtest.c