[libvirt] [PATCH 2/3] qemu: add support for multiple gluster hosts/servers

Daniel P. Berrange berrange at redhat.com
Thu Oct 8 12:57:22 UTC 2015


On Thu, Oct 08, 2015 at 05:25:52PM +0530, Prasanna Kumar Kalever wrote:
> This patch adds support for gluster specific JSON formatter functionality
> 
> currently libvirt has the capability to parse only one host and convert that
> into URI formatted string, with the help of this patch libvirt will be able
> to parse multiple hosts from the domain xml and can convert that into JSON
> formatted string
> 
> if the number of hosts supplied is only one, then we use existing URI format
> for backward compatibility and if number of hosts is greater than one we switch
> to the new JSON format
> 
> before:
> ------
> example.xml:
> ...
>     <disk type='network' device='disk'>
>       <driver name='qemu' type='qcow2' cache='none'/>
>       <source protocol='gluster' name='testvol/a.qcow2'>
>         <host name='1.2.3.4' port='24007' transport="tcp"/>
>       </source>
>        <target dev='vda' bus='virtio'/>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
>     </disk>
> ...
> 
> resultant string:
> file=gluster://1.2.3.4:24007/testvol/a.qcow2, \
>                            if=none,id=drive-virtio-disk0,format=qcow2,cache=none
> 
> after:
> -----
> example.xml:
> ...
>     <disk type='network' device='disk'>
>       <driver name='qemu' type='qcow2' cache='none'/>
>       <source protocol='gluster' name='testvol/a.qcow2'>
>         <host name='1.2.3.4' port='24009' transport="tcp"/>
>         <host name='3.4.5.6' port="24008"/>
>         <host name='5.6.7.8' />
>       </source>
>        <target dev='vda' bus='virtio'/>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
>     </disk>
> ...
> 
> resultant string:
> -drive file=json:{
>     "file": {
>         "driver": "gluster",,
>         "volname": "testvol",,
>         "image-path": "/a.qcow2",,
>         "volfile-servers": [
>             {
>                 "server": "1.2.3.4",,
>                 "port": 24009,,
>                 "transport": "tcp"
>             },,
>             {
>                 "server": "3.4.5.6",,
>                 "port": 24008,,
>                 "transport": "tcp"
>             },,
>             {
>                 "server": "5.6.7.8",,
>                 "port": 24007,,
>                 "transport": "tcp"
>             }
>         ]
>     },,
>     "driver": "qcow2"
> }
> ,if=none,id=drive-virtio-disk0,cache=none
> 
> this patch requires qemu latest patch
> https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg07062.html
> 
> Credits: Sincere thanks to Kevin Wolf <kwolf at redhat.com> and
> "Deepak C Shetty" <deepakcs at redhat.com> for their support
> 
> Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever at redhat.com>
> ---
> v1: add support to gluster json formatter
> 
> v2: addressing "Peter Krempa" <pkrempa at redhat.com> comments
> ---
>  src/qemu/qemu_command.c | 216 ++++++++++++++++++++++++++++++++++++------------

Any time qemu_command.c is extended, you need to add to the test suite
qemuxml2argvtest.c at the very minimum, ideally qemuxml2xmltest and
qemuargv2xmltest too if poissible


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list