• P
    block/gluster: add support for multiple gluster servers · 6c7189bb
    Prasanna Kumar Kalever 提交于
    This patch adds a way to specify multiple volfile servers to the gluster
    block backend of QEMU with tcp|rdma transport types and their port numbers.
    
    Problem:
    
    Currently VM Image on gluster volume is specified like this:
    
    file=gluster[+tcp]://host[:port]/testvol/a.img
    
    Say we have three hosts in a trusted pool with replica 3 volume in action.
    When the host mentioned in the command above goes down for some reason,
    the other two hosts are still available. But there's currently no way
    to tell QEMU about them.
    
    Solution:
    
    New way of specifying VM Image on gluster volume with volfile servers:
    (We still support old syntax to maintain backward compatibility)
    
    Basic command line syntax looks like:
    
    Pattern I:
     -drive driver=gluster,
            volume=testvol,path=/path/a.raw,[debug=N,]
            server.0.type=tcp,
            server.0.host=1.2.3.4,
            server.0.port=24007,
            server.1.type=unix,
            server.1.socket=/path/socketfile
    
    Pattern II:
     'json:{"driver":"qcow2","file":{"driver":"gluster",
           "volume":"testvol","path":"/path/a.qcow2",["debug":N,]
           "server":[{hostinfo_1}, ...{hostinfo_N}]}}'
    
       driver      => 'gluster' (protocol name)
       volume      => name of gluster volume where our VM image resides
       path        => absolute path of image in gluster volume
      [debug]      => libgfapi loglevel [(0 - 9) default 4 -> Error]
    
      {hostinfo}   => {{type:"tcp",host:"1.2.3.4"[,port=24007]},
                       {type:"unix",socket:"/path/sockfile"}}
    
       type        => transport type used to connect to gluster management daemon,
                      it can be tcp|unix
       host        => host address (hostname/ipv4/ipv6 addresses/socket path)
       port        => port number on which glusterd is listening.
       socket      => path to socket file
    
    Examples:
    1.
     -drive driver=qcow2,file.driver=gluster,
            file.volume=testvol,file.path=/path/a.qcow2,file.debug=9,
            file.server.0.type=tcp,
            file.server.0.host=1.2.3.4,
            file.server.0.port=24007,
            file.server.1.type=unix,
            file.server.1.socket=/var/run/glusterd.socket
    2.
      'json:{"driver":"qcow2","file":{"driver":"gluster","volume":"testvol",
             "path":"/path/a.qcow2","debug":9,"server":
             [{"type":"tcp","host":"1.2.3.4","port":"24007"},
              {"type":"unix","socket":"/var/run/glusterd.socket"}
             ]}}'
    
    This patch gives a mechanism to provide all the server addresses, which are in
    replica set, so in case host1 is down VM can still boot from any of the
    active hosts.
    
    This is equivalent to the backup-volfile-servers option supported by
    mount.glusterfs (FUSE way of mounting gluster volume)
    
    credits: sincere thanks to all the supporters
    Signed-off-by: NPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
    Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
    Message-id: 1468947453-5433-6-git-send-email-prasanna.kalever@redhat.com
    Signed-off-by: NJeff Cody <jcody@redhat.com>
    6c7189bb
block-core.json 85.9 KB