Exemplo n.º 1
0
def delete(volname,
           slave_host,
           slave_vol,
           slave_user="******",
           reset_sync_time=None):
    """
    Delete Geo-replication Session

    :param volname: Master Volume Name
    :param slave_host: Slave Hostname or IP
    :param slave_vol: Slave Volume
    :param slave_user: Slave User, default is "root"
    :param reset_sync_time: True|False Reset Sync time on delete
    :returns: Output of Start command, raises
     GlusterCmdException((rc, out, err)) on error
    """
    cmd = [
        volname, "{0}@{1}::{2}".format(slave_user, slave_host, slave_vol),
        "delete"
    ]

    if reset_sync_time is not None:
        cmd += ["reset-sync-time"]

    return georep_execute(cmd)
Exemplo n.º 2
0
def config_reset(volname, slave_host, slave_vol, key, slave_user="******"):
    """
    Reset configuration of Geo-replication Session

    :param volname: Master Volume Name
    :param slave_host: Slave Hostname or IP
    :param slave_vol: Slave Volume
    :param slave_user: Slave User, default is "root"
    :param key: Config Key
    :returns: Output of Config reset command, raises
     GlusterCmdException((rc, out, err)) on error
    """
    cmd = [
        volname, "{0}@{1}::{2}".format(slave_user, slave_host, slave_vol),
        "config", "!{0}".format(key)
    ]
    return georep_execute(cmd)
Exemplo n.º 3
0
def create(volname,
           slave_host,
           slave_vol,
           slave_user="******",
           push_pem=True,
           no_verify=False,
           force=False,
           ssh_port=22):
    """
    Create Geo-replication Session

    :param volname: Master Volume Name
    :param slave_host: Slave Hostname or IP
    :param slave_vol: Slave Volume
    :param slave_user: Slave User, default is "root"
    :param push_pem: True|False Push SSH keys to Slave
    :param no_verify: True|False Skip the Slave Verification
     process before create
    :param force: True|False Force Create Session
    :param ssh_port: SSH Port, Default is 22
    :returns: Output of Create command, raises
     GlusterCmdException((rc, out, err)) on error
    """
    cmd = [
        volname, "{0}@{1}::{2}".format(slave_user, slave_host, slave_vol),
        "create"
    ]

    if ssh_port != 22:
        cmd += ["ssh-port", "{0}".format(ssh_port)]

    if push_pem:
        cmd += ["push-pem"]

    if no_verify:
        cmd += ["no-verify"]

    if force:
        cmd += ["force"]

    return georep_execute(cmd)
Exemplo n.º 4
0
def stop(volname, slave_host, slave_vol, slave_user="******", force=False):
    """
    Stop Geo-replication Session

    :param volname: Master Volume Name
    :param slave_host: Slave Hostname or IP
    :param slave_vol: Slave Volume
    :param slave_user: Slave User, default is "root"
    :param force: True|False Force Stop the Session
    :returns: Output of Stop command, raises
     GlusterCmdException((rc, out, err)) on error
    """
    cmd = [
        volname, "{0}@{1}::{2}".format(slave_user, slave_host, slave_vol),
        "stop"
    ]

    if force:
        cmd += ["force"]

    return georep_execute(cmd)