Package: glustercli2
= GlusterCLI - Python bindings for GlusterFS Commands== Gluster CLI instance.Example:[source,python]----from glustercli2 import GlusterCLI# With default Optionsgcli = GlusterCLI()# With custom gluster executable pathgcli = GlusterCLI(exec_path="/usr/local/sbin/gluster")# Set Current Host to replace `localhost` in Peers list outputgcli = GlusterCLI(current_host="server1.kadalu")# Set Glusterd socket Pathgcli = GlusterCLI(exec_path="/usr/local/sbin/gluster",current_host="server1.kadalu",socket_path="/usr/local/var/run/glusterd.sock")----== Peer Add/ProbeAdd a Peer to Cluster.Example:[source,python]----from glustercli2 import GlusterCLIgcli = GlusterCLI()gcli.add_peer("server2.kadalu")----== Volume CreateCreate a Volume.Example:[source,python]----from glustercli2 import GlusterCLI, VolumeCreateOptionsgcli = GlusterCLI()opts = VolumeCreateOptions()opts.replica_count = 3opts.force = Truebricks = ["server1.kadalu:/bricks/gvol1/brick1/brick","server2.kadalu:/bricks/gvol1/brick2/brick","server3.kadalu:/bricks/gvol1/brick3/brick"]gcli.create_volume("gvol1", bricks, opts)----== Peers ListList Peers available.Example:[source,python]----from glustercli2 import GlusterCLIgcli = GlusterCLI()gcli.list_peers()----== Volumes List and StatusList Volumes available.Example:[source,python]----from glustercli2 import GlusterCLIgcli = GlusterCLI()gcli.list_volumes()gcli.list_volumes(status=True)----== Get Peer instance.Example:[source,python]----from glustercli2 import GlusterCLIgcli = GlusterCLI()gcli.peer("server2.kadalu")----== Docker execSet Remote plugin as docker and set the container nameExample:[source,python]----from glustercli2 import GlusterCLIgcli = GlusterCLI()gcli.set_container_name("server1.kadalu")----== Execute over SSHSet Remote plugin as ssh and set the SSH parametersExample:[source,python]----from glustercli2 import GlusterCLIgcli = GlusterCLI()gcli.set_ssh_params("remote1.kadalu",port=22,user="root",key="/root/.ssh/id_rsa",use_sudo=False)----== GlusterFS VersionReturn the GlusterFS version[source,python]----from glustercli2 import GlusterCLIgcli = GlusterCLI()print(gcli.version())----== Get Volume instance.Example:[source,python]----from glustercli2 import GlusterCLIgcli = GlusterCLI()gcli.volume("gvol1")----== Volume DeleteDelete the Volume.Example:[source,python]----from glustercli2 import GlusterCLIgcli = GlusterCLI()gcli.volume("gvol1").delete()----== Volume Info and StatusGet Volume info or Status.Example:[source,python]----from glustercli2 import GlusterCLIgcli = GlusterCLI()gcli.volume("gvol1").info()gcli.volume("gvol1").info(status=True)----== Reset Volume OptionReset Volume Option.Example:[source,python]----from glustercli2 import GlusterCLIgcli = GlusterCLI()gcli.volume("gvol1").option_reset(["changelog.changelog"])----== Set Volume OptionSet Volume Option.Example:[source,python]----from glustercli2 import GlusterCLIgcli = GlusterCLI()gcli.volume("gvol1").option_set({"changelog.changelog": "on"})----== Volume StartStart the Volume.Example:[source,python]----from glustercli2 import GlusterCLIgcli = GlusterCLI()gcli.volume("gvol1").start()# or using force optiongcli.volume("gvol1").start(force=True)----== Volume StopStop the Volume.Example:[source,python]----from glustercli2 import GlusterCLIgcli = GlusterCLI()gcli.volume("gvol1").stop()# or using force optiongcli.volume("gvol1").stop(force=True)----== Peer Delete/DetachDelete or Detach a Peer from Cluster.Example:[source,python]----from glustercli2 import GlusterCLIgcli = GlusterCLI()gcli.peer("server2.kadalu").delete()----