summaryrefslogtreecommitdiffstats
path: root/test/features/qdevice_setup_remove.feature
blob: df7af3d44e99d381d406a3bdb91c9d2c5c6823a2 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
@qdevice
Feature: corosync qdevice/qnetd setup/remove process

  Test corosync qdevice/qnetd setup/remove process
  Tag @clean means need to stop cluster service if the service is available
  Need nodes: hanode1 hanode2 hanode3 hanode4 qnetd-node

  Background: Cluster and qdevice service are stopped
    Given   Cluster service is "stopped" on "hanode1"
    And     Cluster service is "stopped" on "hanode2"
    And     Service "corosync-qdevice" is "stopped" on "hanode1"
    And     Service "corosync-qdevice" is "stopped" on "hanode2"

  @clean
  Scenario: Setup qdevice/qnetd during init/join process
    When    Run "crm cluster init --qnetd-hostname=qnetd-node -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    # for bsc#1181415
    Then    Expected "Restarting cluster service" in stdout
    And     Service "corosync-qdevice" is "started" on "hanode1"
    When    Run "crm cluster join -c hanode1 -y" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    And     Online nodes are "hanode1 hanode2"
    And     Service "corosync-qdevice" is "started" on "hanode2"
    And     Service "corosync-qnetd" is "started" on "qnetd-node"
    And     Show status from qnetd
    And     Show corosync qdevice configuration
    And     Show qdevice status

  @clean
  Scenario: Setup qdevice/qnetd on running cluster
    When    Run "crm cluster init -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    And     Service "corosync-qdevice" is "stopped" on "hanode1"
    When    Run "crm cluster join -c hanode1 -y" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    And     Online nodes are "hanode1 hanode2"
    And     Service "corosync-qdevice" is "stopped" on "hanode2"
    When    Write multi lines to file "/etc/corosync/corosync.conf" on "hanode1"
      """
      # This is a test for bsc#1166684

      """
    When    Write multi lines to file "/etc/corosync/corosync.conf" on "hanode2"
      """
      # This is a test for bsc#1166684

      """
    When    Run "crm cluster init qdevice --qnetd-hostname=qnetd-node -y" on "hanode1"
    # for bsc#1181415
    Then    Expected "Starting corosync-qdevice.service in cluster" in stdout
    Then    Service "corosync-qdevice" is "started" on "hanode1"
    And     Service "corosync-qdevice" is "started" on "hanode2"
    And     Service "corosync-qnetd" is "started" on "qnetd-node"
    And     Show status from qnetd
    And     Show corosync qdevice configuration

  @clean
  Scenario: Remove qdevice from a two nodes cluster
    When    Run "crm cluster init --qnetd-hostname=qnetd-node -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    And     Service "corosync-qdevice" is "started" on "hanode1"
    When    Run "crm cluster join -c hanode1 -y" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    And     Online nodes are "hanode1 hanode2"
    And     Service "corosync-qdevice" is "started" on "hanode2"
    And     Show corosync qdevice configuration
    When    Run "crm cluster remove --qdevice -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    And     Cluster service is "started" on "hanode2"
    And     Service "corosync-qdevice" is "stopped" on "hanode1"
    And     Service "corosync-qdevice" is "stopped" on "hanode2"
    And     Show corosync qdevice configuration

  @clean
  Scenario: Setup qdevice on multi nodes
    When    Run "crm cluster init --qnetd-hostname=qnetd-node -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    And     Service "corosync-qdevice" is "started" on "hanode1"
    When    Run "crm cluster join -c hanode1 -y" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    And     Online nodes are "hanode1 hanode2"
    And     Service "corosync-qdevice" is "started" on "hanode2"
    And     Expected votes will be "3"
    When    Run "crm cluster join -c hanode1 -y" on "hanode3"
    Then    Cluster service is "started" on "hanode3"
    And     Online nodes are "hanode1 hanode2 hanode3"
    And     Service "corosync-qdevice" is "started" on "hanode3"
    And     Expected votes will be "4"
    When    Run "crm cluster join -c hanode1 -y" on "hanode4"
    Then    Cluster service is "started" on "hanode4"
    And     Online nodes are "hanode1 hanode2 hanode3 hanode4"
    And     Service "corosync-qdevice" is "started" on "hanode4"
    And     Expected votes will be "5"
    And     Show corosync qdevice configuration
    And     Show status from qnetd

  @clean
  Scenario: Setup qdevice on multi nodes existing cluster
    When    Run "crm cluster init -u -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    When    Run "crm cluster join -c hanode1 -y" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    And     Online nodes are "hanode1 hanode2"
    When    Run "crm cluster join -c hanode1 -y" on "hanode3"
    Then    Cluster service is "started" on "hanode3"
    And     Online nodes are "hanode1 hanode2 hanode3"
    When    Run "crm cluster join -c hanode1 -y" on "hanode4"
    Then    Cluster service is "started" on "hanode4"
    And     Online nodes are "hanode1 hanode2 hanode3 hanode4"
    And     Expected votes will be "4"
    When    Run "crm cluster init qdevice --qnetd-hostname=qnetd-node -y" on "hanode1"
    Then    Show corosync qdevice configuration
    And     Expected votes will be "5"
    And     Service "corosync-qdevice" is "started" on "hanode4"
    And     Service "corosync-qdevice" is "started" on "hanode3"
    And     Service "corosync-qdevice" is "started" on "hanode2"
    And     Service "corosync-qdevice" is "started" on "hanode1"
    And     Show status from qnetd

  @clean
  Scenario: Setup qdevice using IPv6
    When    Run "crm cluster init -u -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    When    Run "crm cluster join -c hanode1 -y" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    And     Online nodes are "hanode1 hanode2"
    When    Run "crm cluster init qdevice --qnetd-hostname @qnetd-node.ip6.0 -y" on "hanode1"
    Then    Show corosync qdevice configuration
    And     Service "corosync-qdevice" is "started" on "hanode2"
    And     Service "corosync-qdevice" is "started" on "hanode1"
    And     Show status from qnetd

  @skip_non_root
  @clean
  Scenario: Passwordless for root, not for sudoer (bsc#1209193)
    When    Run "crm cluster init -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    When    Run "crm cluster join -c hanode1 -y" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    When    Run "useradd -m -s /bin/bash xin" on "hanode1"
    When    Run "echo "xin ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/xin" on "hanode1"
    When    Run "rm -f /root/.config/crm/crm.conf" on "hanode1"
    When    Run "useradd -m -s /bin/bash xin" on "hanode2"
    When    Run "echo "xin ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/xin" on "hanode2"
    When    Run "rm -f /root/.config/crm/crm.conf" on "hanode2"
    When    Run "su xin -c "sudo crm cluster init qdevice --qnetd-hostname=qnetd-node -y"" on "hanode1"
    Then    Service "corosync-qdevice" is "started" on "hanode1"
    And     Service "corosync-qdevice" is "started" on "hanode2"

  @skip_non_root
  @clean
  Scenario: Missing crm/crm.conf (bsc#1209193)
    When    Run "crm cluster init -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    When    Run "crm cluster join -c hanode1 -y" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    When    Run "rm -f /root/.config/crm/crm.conf" on "hanode1"
    When    Run "rm -f /root/.config/crm/crm.conf" on "hanode2"
    When    Run "crm cluster init qdevice --qnetd-hostname=qnetd-node -y" on "hanode1"
    Then    Service "corosync-qdevice" is "started" on "hanode1"
    And     Service "corosync-qdevice" is "started" on "hanode2"

  @clean
  Scenario: One qnetd for multi cluster, add in parallel
    When    Run "crm cluster init -n cluster1 -y" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    When    Run "crm cluster init -n cluster2 -y" on "hanode3"
    Then    Cluster service is "started" on "hanode3"
    When    Run "crm cluster init qdevice --qnetd-hostname qnetd-node -y" on "hanode2,hanode3"
    Then    Service "corosync-qdevice" is "started" on "hanode2"
    And     Service "corosync-qdevice" is "started" on "hanode3"
    And     Service "corosync-qnetd" is "started" on "qnetd-node"