~ubuntu-branches/debian/sid/glusterfs/sid

« back to all changes in this revision

Viewing changes to tests/cluster.rc

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2014-04-22 10:00:41 UTC
  • mfrom: (1.3.25)
  • Revision ID: package-import@ubuntu.com-20140422100041-6mur2ttyvb8zzpfq
Tags: 3.5.0-1
* New upstream release.
  - Rewrite patch 01-spelling-error.
  - Adjust lintian overrides.
  - Install new files.
  - The offical tarball is not properly generated, hack it around.
  - Add symlink from fusermount-glusterfs manpage to mount.glusterfs.
  - Move gsync-sync-gfid from /usr/share to /usr/lib.
  - Add benchmarking directory.
* Remove old versioned build dependencies and build depend on libglib2.0-dev.
* Add lintian override for possible-gpl-code-linked-with-openssl. It is the
  same false positive like with the gluster-server package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
CLUSTER_PFX="127.1.1"; # ".x" for each glusterd
 
4
CLUSTER_COUNT=1; # Just initial definition
 
5
 
 
6
function launch_cluster() {
 
7
    local count=$1;
 
8
 
 
9
    CLUSTER_COUNT=$count;
 
10
 
 
11
    define_backends $count;
 
12
    define_hosts $count;
 
13
    define_glusterds $count;
 
14
    define_clis $count;
 
15
 
 
16
    start_glusterds;
 
17
}
 
18
 
 
19
 
 
20
function define_backends() {
 
21
    local b;
 
22
 
 
23
    for i in `seq 1 $count`; do
 
24
        eval "B$i=$B0/$i";
 
25
    done
 
26
 
 
27
    for i in `seq 1 $count`; do
 
28
        b="B$i";
 
29
        mkdir -pv ${!b}/glusterd;
 
30
    done
 
31
}
 
32
 
 
33
 
 
34
function define_glusterds() {
 
35
    local count=$1;
 
36
    local h;
 
37
    local b;
 
38
    local wopt;
 
39
    local bopt;
 
40
    local popt;
 
41
 
 
42
    for i in `seq 1 $count`; do
 
43
        b="B$i";
 
44
        h="H$i";
 
45
        wopt="management.working-directory=${!b}/glusterd";
 
46
        bopt="management.transport.socket.bind-address=${!h}";
 
47
        popt="--pid-file=${!b}/glusterd.pid";
 
48
        sopt="management.glusterd-sockfile=${!b}/glusterd/gd.sock"
 
49
        lopt="--log-file=${!b}/glusterd.log"
 
50
        eval "glusterd_$i='glusterd --xlator-option $wopt --xlator-option $bopt --xlator-option $sopt $lopt $popt'";
 
51
        eval "glusterd$i='glusterd --xlator-option $wopt --xlator-option $bopt --xlator-option $sopt $lopt $popt'";
 
52
    done
 
53
}
 
54
 
 
55
 
 
56
function start_glusterds() {
 
57
    local g;
 
58
 
 
59
    for i in `seq 1 $CLUSTER_COUNT`; do
 
60
        g="glusterd_$i";
 
61
        ${!g};
 
62
    done
 
63
}
 
64
 
 
65
 
 
66
function kill_glusterd() {
 
67
    local index=$1;
 
68
    local b;
 
69
    local pidfile;
 
70
 
 
71
    b="B$index";
 
72
    pidfile="${!b}/glusterd.pid";
 
73
 
 
74
    kill `cat $pidfile`;
 
75
}
 
76
 
 
77
 
 
78
function kill_node() {
 
79
    local index=$1;
 
80
    local h;
 
81
 
 
82
    h="H$index";
 
83
 
 
84
    kill -9 $(ps -ef | grep gluster | grep ${!h} | awk '{print $2}');
 
85
}
 
86
 
 
87
 
 
88
function define_hosts() {
 
89
    local count=$1;
 
90
 
 
91
    for i in `seq 1 $count`; do
 
92
        eval "H_$i=${CLUSTER_PFX}.$i"
 
93
        eval "H$i=${CLUSTER_PFX}.$i";
 
94
    done
 
95
}
 
96
 
 
97
 
 
98
function define_clis() {
 
99
    local count=$1;
 
100
    local h;
 
101
 
 
102
    for i in `seq 1 $count`; do
 
103
        b="B$i";
 
104
        eval "CLI_$i='$CLI --glusterd-sock=${!b}/glusterd/gd.sock'";
 
105
        eval "CLI$i='$CLI --glusterd-sock=${!b}/glusterd/gd.sock'";
 
106
    done
 
107
}
 
108