Re: [PATCH 1/1] qemu: add support for multiple gluster hosts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 05.10.2015 um 13:01 hat Peter Krempa geschrieben:
> On Mon, Oct 05, 2015 at 15:30:42 +0530, Prasanna Kumar Kalever wrote:
> > 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
> > 
> > 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,,
> 
> The double commas look like a result of our command line escaping
> function. Are they actually required with 'json:' sources? If no, we
> will need probably a way to avoid them.

This looks like it's used on the command line (i.e. the file=...
parameter of -drive). In this case, the escaping is necessary so the
string isn't split in the middle of the JSON object.

If you used the same thing in a blockdev-add QMP command, you wouldn't
need escaping, obviously, and double commas would be a syntax error.

It's possible to avoid JSON syntax on the command line, but as you
mentioned yourself below, it's necessary in other contexts (backing file
strings), so it probably makes sense to use it here as well.

For the record, the version without JSON would look like this (without
the whitespace; only formatting it this way for readability):

-drive file.driver=gluster,
       file.volname=testvol,
       file.image-path=/a.qcow2,
       file.volfile-servers.0.server=1.2.3.4,
       file.volfile-servers.0.port=24009,
       ...

> >                 "transport": "tcp"
> >             }
> >         ]
> >     },,
> >     "driver": "qcow2"
> > }
> > ,if=none,id=drive-virtio-disk0,cache=none
> > 
> > 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
> > 
> > this patch requires qemu latest patch
> > https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg07062.html
> 
> So this patch, if it will be acked needs to wait until qemu accepts the
> patch as final.

Yes, definitely.

> > 
> > Credits: Sincere thanks to Kevin Wolf <kwolf@xxxxxxxxxx> and
> > "Deepak C Shetty" <deepakcs@xxxxxxxxxx> for their support
> > 
> > Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@xxxxxxxxxx>

[...]

> Since libvirt is loading the backing chain to be able to traverse it and
> set correct permissions on individual images. This equals to two
> additional parts of the code that need modification:
> 
> 1) virStorageFileBackendGlusterInit has the same "src->nhosts != 1"
> condition and is not prepared to work with multiple protocols
> 
> 2) I presume (I didn't test it yet) that the qemu patch that adds this
> stuff will result into using the "json:{" protocol string in the
> 'backing_store' field once you do a snapshot of a gluster disk that uses
> this new syntax. If that happens the VM will not be able to start in
> libvirt any more, as libvirt does not have a 'json:{' protocol parser to
> parse the backing store.

Yes, the json: pseudo-protocol is the only way to put structured options
into the backing file string that image formats provide. If qemu can't
generate a simpler filename string (like a URI) that contains all of the
necessary information, this is what it puts there.

Kevin

Attachment: pgp0gVUG2_rLc.pgp
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]