
Il 26/10/2012 11:36, Harsh Bora ha scritto:
On 10/05/2012 05:27 PM, Paolo Bonzini wrote:
Il 04/10/2012 15:31, Harsh Prateek Bora ha scritto:
Qemu accepts gluster protocol as supported storage backend beside others. This patch allows users to specify disks on gluster backends like this:
<disk type='network' device='disk'> <driver name='qemu' type='raw'/> <source protocol='gluster' name='volume/image'> <host name='example.org' port='6000' transport='tcp'/> </source> <target dev='vda' bus='virtio'/> </disk>
Note: In the <host> element above, transport is an optional attribute. Valid transport values are tcp, unix or rdma. If none specified, tcp is assumed. If transport type is unix, host name specifies path to unix socket.
I would rather add a new attribute "socket" than overload the host name. The host name for Unix sockets is really localhost.
After looking into the URI infra, I realized, it is better to have the new attribute name as 'query' since socket=</path/to/socket> in qemu-gluster commandline is nothing but a query in the whole URI following by a '?' character.
Since, the _virURI struct in libvirt also has a member 'query' for the query string in a URI, it makes sense to keep the XML attribute as generic as that so that it can be used by others for related purpose.
No, each query parameter should map to a separate XML attribute or element.
Needless to say, users will have to specify sockets as <host name='example.org' port='6000' transport='unix' query='socket=/path/to/sock' />
Also, since the libvirt mandates the host element to be provided a name and port
Then change the schema. In RNG it would be like this: <zeroOrMore> <element name="host"> <choice> <group> <optional> <attribute name="transport"> <choice> <value>tcp</value> <value>rdma</value> </choice> </attribute> </optional> <attribute name="name"> <ref name="dnsName"/> </attribute> <attribute name="port"> <ref name="unsignedInt"/> </attribute> </group> <group> <attribute name="transport"> <value>unix</value> </attribute> <attribute name="socket"> <ref name="absFilePath"/> </attribute> </group> </choice> </element> </zeroOrMore>
, but the qemu-gluster commandline doesnt allow server-port for the unix transport, it will have to be handled differently, otherwise the virURIFormat will add in the server, port info into the URI.
An empty host and port will return gluster+unix:///volname?server=/path correctly after virURIFormat. Paolo