Python bindings for GlusterFS CLI
Project description
= GlusterCLI - Python bindings for GlusterFS Commands
== Gluster CLI instance.
Example:
[source,python]
----
from glustercli2 import GlusterCLI
# With default Options
gcli = GlusterCLI()
# With custom gluster executable path
gcli = GlusterCLI(exec_path="/usr/local/sbin/gluster")
# Set Current Host to replace `localhost` in Peers list output
gcli = GlusterCLI(current_host="server1.kadalu")
# Set Glusterd socket Path
gcli = GlusterCLI(
exec_path="/usr/local/sbin/gluster",
current_host="server1.kadalu",
socket_path="/usr/local/var/run/glusterd.sock"
)
----
== Peer Add/Probe
Add a Peer to Cluster.
Example:
[source,python]
----
from glustercli2 import GlusterCLI
gcli = GlusterCLI()
gcli.add_peer("server2.kadalu")
----
== Volume Create
Create a Volume.
Example:
[source,python]
----
from glustercli2 import GlusterCLI, VolumeCreateOptions
gcli = GlusterCLI()
opts = VolumeCreateOptions()
opts.replica_count = 3
opts.force = True
bricks = [
"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 List
List Peers available.
Example:
[source,python]
----
from glustercli2 import GlusterCLI
gcli = GlusterCLI()
gcli.list_peers()
----
== Volumes List and Status
List Volumes available.
Example:
[source,python]
----
from glustercli2 import GlusterCLI
gcli = GlusterCLI()
gcli.list_volumes()
gcli.list_volumes(status=True)
----
== Get Peer instance.
Example:
[source,python]
----
from glustercli2 import GlusterCLI
gcli = GlusterCLI()
gcli.peer("server2.kadalu")
----
== Docker exec
Set Remote plugin as docker and set the container name
Example:
[source,python]
----
from glustercli2 import GlusterCLI
gcli = GlusterCLI()
gcli.set_container_name("server1.kadalu")
----
== Execute over SSH
Set Remote plugin as ssh and set the SSH parameters
Example:
[source,python]
----
from glustercli2 import GlusterCLI
gcli = GlusterCLI()
gcli.set_ssh_params(
"remote1.kadalu",
port=22,
user="root",
key="/root/.ssh/id_rsa",
use_sudo=False
)
----
== GlusterFS Version
Return the GlusterFS version
[source,python]
----
from glustercli2 import GlusterCLI
gcli = GlusterCLI()
print(gcli.version())
----
== Get Volume instance.
Example:
[source,python]
----
from glustercli2 import GlusterCLI
gcli = GlusterCLI()
gcli.volume("gvol1")
----
== Volume Delete
Delete the Volume.
Example:
[source,python]
----
from glustercli2 import GlusterCLI
gcli = GlusterCLI()
gcli.volume("gvol1").delete()
----
== Volume Info and Status
Get Volume info or Status.
Example:
[source,python]
----
from glustercli2 import GlusterCLI
gcli = GlusterCLI()
gcli.volume("gvol1").info()
gcli.volume("gvol1").info(status=True)
----
== Reset Volume Option
Reset Volume Option.
Example:
[source,python]
----
from glustercli2 import GlusterCLI
gcli = GlusterCLI()
gcli.volume("gvol1").option_reset(["changelog.changelog"])
----
== Set Volume Option
Set Volume Option.
Example:
[source,python]
----
from glustercli2 import GlusterCLI
gcli = GlusterCLI()
gcli.volume("gvol1").option_set({
"changelog.changelog": "on"
})
----
== Volume Start
Start the Volume.
Example:
[source,python]
----
from glustercli2 import GlusterCLI
gcli = GlusterCLI()
gcli.volume("gvol1").start()
# or using force option
gcli.volume("gvol1").start(force=True)
----
== Volume Stop
Stop the Volume.
Example:
[source,python]
----
from glustercli2 import GlusterCLI
gcli = GlusterCLI()
gcli.volume("gvol1").stop()
# or using force option
gcli.volume("gvol1").stop(force=True)
----
== Peer Delete/Detach
Delete or Detach a Peer from Cluster.
Example:
[source,python]
----
from glustercli2 import GlusterCLI
gcli = GlusterCLI()
gcli.peer("server2.kadalu").delete()
----
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
glustercli2-0.2.0.tar.gz
(8.8 kB
view hashes)