summaryrefslogtreecommitdiffstats
path: root/Libraries/GlusterCommands/ATFGlusterPeer.py
blob: 9e40f509d0bfd5cf56609ac46bc70f80bcdfdff3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
import ATFUtils
import ATFTestEnv

def probe():
    """
    Description:
        probe peer specified by <HOSTNAME>

    Parameters:
        None

    Returns:
        Success: 0
        Failure: 1
    """

    command = "gluster peer probe "
    servers = ATFUtils.TestEnvObj.get_servershostlist()

    length = len(servers)
    if (length == 1):
        ATFUtils.Logger.warning("Self Probing of Server Not Required")
        return 0
    else:
        fromhost = servers.pop(0)
        for host in servers:
            command = command + host + " "

        status, stdin, stdout, stderr = ATFUtils.execute_command(command,
                                                                host=fromhost,
                                                                user='root')

        if (status == 1):
            return 1
        else:
            return ATFUtils.parse_output(stdout, stderr)