Skip to main content
= 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()
----

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.3.0.tar.gz (9.4 kB view details)

Uploaded Source

File details

Details for the file glustercli2-0.3.0.tar.gz.

File metadata

  • Download URL: glustercli2-0.3.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for glustercli2-0.3.0.tar.gz
Algorithm Hash digest
SHA256 270197be6473db189282d3c9cbf78f377396605d3133aacacd67ac309bad9a50
MD5 05c6f7e7698645e9964e251b9a2093b8
BLAKE2b-256 76c1dbc6bee87f509c49e5a2bb9a5df38082f570f3b24024a9b6e6150775edd4

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 file

0.2.0

1 file

0.1.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page