summaryrefslogtreecommitdiffstats
path: root/test/features/bootstrap_sbd_normal.feature
blob: 8c5d4218ed67602364fc5c21fdf499f9296f0d81 (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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
@sbd
Feature: crmsh bootstrap sbd management

  Tag @clean means need to stop cluster service if the service is available

  @clean
  Scenario: Verify sbd device
    When    Try "crm cluster init -s "/dev/sda1;/dev/sda2;/dev/sda3;/dev/sda4" -y"
    Then    Except "ERROR: cluster.init: Maximum number of SBD device is 3"
    When    Try "crm cluster init -s "/dev/sda1;/dev/sdaxxxx" -y"
    Then    Except "ERROR: cluster.init: /dev/sdaxxxx doesn't look like a block device"
    When    Try "crm cluster init -s "/dev/sda1;/dev/sda1" -y"
    Then    Except multiple lines
      """
      usage: init [options] [STAGE]
      crm: error: Duplicated input for '-s/--sbd-device' option
      """

  @clean
  Scenario: Setup sbd with init and join process(bsc#1170999)
    Given   Has disk "/dev/sda1" on "hanode1"
    Given   Cluster service is "stopped" on "hanode1"
    Given   Has disk "/dev/sda1" on "hanode2"
    Given   Cluster service is "stopped" on "hanode2"
    When    Run "crm cluster init -s /dev/sda1 -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    And     Service "sbd" is "started" on "hanode1"
    And     Resource "stonith-sbd" type "external/sbd" is "Started"
    When    Run "crm cluster join -c hanode1 -y" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    And     Service "sbd" is "started" on "hanode2"

  @clean
  Scenario: Re-setup cluster without sbd(bsc#1166967)
    Given   Cluster service is "stopped" on "hanode1"
    Given   Cluster service is "stopped" on "hanode2"
    When    Run "crm cluster init -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    And     Service "sbd" is "stopped" on "hanode1"
    When    Run "crm cluster join -c hanode1 -y" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    And     Service "sbd" is "stopped" on "hanode2"
    And     Resource "stonith:external/sbd" not configured

  @clean
  Scenario: Configure diskless sbd(bsc#1181907)
    Given   Cluster service is "stopped" on "hanode1"
    Given   Cluster service is "stopped" on "hanode2"
    When    Run "crm cluster init -S -y" on "hanode1"
    Then    Expected "Diskless SBD requires cluster with three or more nodes." in stderr
    Then    Cluster service is "started" on "hanode1"
    And     Service "sbd" is "started" on "hanode1"
    When    Run "crm cluster join -c hanode1 -y" on "hanode2"
    Then    Expected "Diskless SBD requires cluster with three or more nodes." in stderr
    Then    Cluster service is "started" on "hanode2"
    And     Service "sbd" is "started" on "hanode2"
    When    Run "crm cluster join -c hanode1 -y" on "hanode3"
    Then    Expected "Diskless SBD requires cluster with three or more nodes." not in stderr
    Then    Cluster service is "started" on "hanode3"
    And     Service "sbd" is "started" on "hanode3"
    And     Resource "stonith:external/sbd" not configured

  @clean
  Scenario: Configure multi disks sbd
    Given   Has disk "/dev/sda1" on "hanode1"
    Given   Has disk "/dev/sda2" on "hanode1"
    Given   Cluster service is "stopped" on "hanode1"
    Given   Has disk "/dev/sda1" on "hanode2"
    Given   Has disk "/dev/sda2" on "hanode2"
    Given   Cluster service is "stopped" on "hanode2"
    When    Run "crm cluster init -s /dev/sda1 -s /dev/sda2 -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    And     Service "sbd" is "started" on "hanode1"
    And     Resource "stonith-sbd" type "external/sbd" is "Started"
    When    Run "crm cluster join -c hanode1 -y" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    And     Service "sbd" is "started" on "hanode2"

  @clean
  Scenario: Configure sbd in several stages(bsc#1175057)
    Given   Cluster service is "stopped" on "hanode1"
    Given   Cluster service is "stopped" on "hanode2"
    When    Run "crm cluster init ssh -y" on "hanode1"
    And     Run "crm cluster init csync2 -y" on "hanode1"
    And     Run "crm cluster init corosync -y" on "hanode1"
    And     Run "crm cluster init sbd -s /dev/sda1 -y" on "hanode1"
    And     Run "crm cluster init cluster -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    And     Service "sbd" is "started" on "hanode1"
    When    Run "crm cluster join ssh -y -c hanode1" on "hanode2"
    And     Run "crm cluster join csync2 -y -c hanode1" on "hanode2"
    And     Run "crm cluster join ssh_merge -y -c hanode1" on "hanode2"
    And     Run "crm cluster join cluster -y -c hanode1" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    And     Service "sbd" is "started" on "hanode2"
    And     Resource "stonith-sbd" type "external/sbd" is "Started"

  @clean
  Scenario: Configure diskless sbd in several stages(bsc#1175057)
    Given   Cluster service is "stopped" on "hanode1"
    Given   Cluster service is "stopped" on "hanode2"
    When    Run "crm cluster init ssh -y" on "hanode1"
    And     Run "crm cluster init csync2 -y" on "hanode1"
    And     Run "crm cluster init corosync -y" on "hanode1"
    And     Run "crm cluster init sbd -S -y" on "hanode1"
    And     Run "crm cluster init cluster -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    And     Service "sbd" is "started" on "hanode1"
    When    Run "crm cluster join ssh -y -c hanode1" on "hanode2"
    And     Run "crm cluster join csync2 -y -c hanode1" on "hanode2"
    And     Run "crm cluster join ssh_merge -y -c hanode1" on "hanode2"
    And     Run "crm cluster join cluster -y -c hanode1" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    And     Service "sbd" is "started" on "hanode2"
    And     Resource "stonith:external/sbd" not configured

  @clean
  Scenario: Configure sbd on running cluster via stage(bsc#1181906)
    Given   Cluster service is "stopped" on "hanode1"
    Given   Cluster service is "stopped" on "hanode2"
    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"
    And     Online nodes are "hanode1 hanode2"
    When    Run "crm cluster init sbd -s /dev/sda1 -y" on "hanode1"
    Then    Service "sbd" is "started" on "hanode1"
    And     Service "sbd" is "started" on "hanode2"
    And     Resource "stonith-sbd" type "external/sbd" is "Started"

  @clean
  Scenario: Configure sbd on running cluster via stage with ra running(bsc#1181906)
    Given   Cluster service is "stopped" on "hanode1"
    Given   Cluster service is "stopped" on "hanode2"
    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"
    And     Online nodes are "hanode1 hanode2"
    When    Run "crm configure primitive d Dummy op monitor interval=3s" on "hanode1"
    When    Run "crm cluster init sbd -s /dev/sda1 -y" on "hanode1"
    Then    Expected "WARNING: To start sbd.service, need to restart cluster service manually on each node" in stderr
    Then    Service "sbd" is "stopped" on "hanode1"
    And     Service "sbd" is "stopped" on "hanode2"
    When    Run "crm cluster restart" on "hanode1"
    Then    Service "sbd" is "started" on "hanode1"
    When    Run "crm cluster restart" on "hanode2"
    Then    Service "sbd" is "started" on "hanode2"
    When    Run "sleep 20" on "hanode1"
    Then    Resource "stonith-sbd" type "external/sbd" is "Started"

  @clean
  Scenario: Configure sbd when no watchdog device(bsc#1154927, bsc#1178869)
    Given   Cluster service is "stopped" on "hanode1"
    Given   Cluster service is "stopped" on "hanode2"
    When    Try "lsmod |grep softdog && rmmod softdog" on "hanode1"
    And     Try "lsmod |grep softdog && rmmod softdog" on "hanode2"
    When    Run "crm cluster init -s /dev/sda1 -w softdog -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    And     Service "sbd" is "started" on "hanode1"
    When    Try "lsmod |grep softdog"
    Then    Expected return code is "0"
    When    Run "crm cluster join -c hanode1 -y" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    And     Service "sbd" is "started" on "hanode2"
    And     Resource "stonith-sbd" type "external/sbd" is "Started"

  @clean
  Scenario: Setup sbd and test fence node
    Given   Has disk "/dev/sda1" on "hanode1"
    Given   Cluster service is "stopped" on "hanode1"
    Given   Has disk "/dev/sda1" on "hanode2"
    Given   Cluster service is "stopped" on "hanode2"
    When    Run "crm cluster init -s /dev/sda1 -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    And     Service "sbd" is "started" on "hanode1"
    And     Resource "stonith-sbd" type "external/sbd" is "Started"
    When    Run "crm cluster join -c hanode1 -y" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    And     Service "sbd" is "started" on "hanode2"
    When    Run "stonith_admin -H hanode2 -c" on "hanode1"
    When    Run "crm -F node fence hanode2" on "hanode1"
    Then    Expected return code is "0"
    Then    Node "hanode2" is UNCLEAN
    Then    Wait "60" seconds for "hanode2" successfully fenced

  @skip_non_root
  @clean
  Scenario: Setup sbd and test fence node, use hacluster to fence
    Given   Has disk "/dev/sda1" on "hanode1"
    Given   Cluster service is "stopped" on "hanode1"
    Given   Has disk "/dev/sda1" on "hanode2"
    Given   Cluster service is "stopped" on "hanode2"
    When    Run "crm cluster init -s /dev/sda1 -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    And     Service "sbd" is "started" on "hanode1"
    And     Resource "stonith-sbd" type "external/sbd" is "Started"
    When    Run "crm cluster join -c hanode1 -y" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    And     Service "sbd" is "started" on "hanode2"
    When    Run "stonith_admin -H hanode2 -c" on "hanode1"
    When    Run "su hacluster -c '/usr/sbin/crm -F node fence hanode2'" on "hanode1"
    Then    Expected return code is "0"
    Then    Node "hanode2" is UNCLEAN
    Then    Wait "60" seconds for "hanode2" successfully fenced

  @clean
  Scenario: Change existing diskbased sbd cluster as diskless sbd
    Given   Has disk "/dev/sda1" on "hanode1"
    Given   Cluster service is "stopped" on "hanode1"
    Given   Has disk "/dev/sda1" on "hanode2"
    Given   Cluster service is "stopped" on "hanode2"
    When    Run "crm cluster init -s /dev/sda1 -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    And     Service "sbd" is "started" on "hanode1"
    And     Resource "stonith-sbd" type "external/sbd" is "Started"
    When    Run "crm cluster join -c hanode1 -y" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    And     Service "sbd" is "started" on "hanode2"
    And     Run "ps -ef|grep -v grep|grep 'watcher: /dev/sda1 '" OK

    When    Run "crm -F cluster init sbd -S -y" on "hanode1"
    Then    Service "sbd" is "started" on "hanode1"
    And     Service "sbd" is "started" on "hanode2"
    And     Resource "stonith:external/sbd" not configured
    When    Try "ps -ef|grep -v grep|grep 'watcher: /dev/sda1 '"
    Then    Expected return code is "1"

  @clean
  Scenario: Change existing diskless sbd cluster as diskbased sbd
    Given   Has disk "/dev/sda1" on "hanode1"
    Given   Cluster service is "stopped" on "hanode1"
    Given   Has disk "/dev/sda1" on "hanode2"
    Given   Cluster service is "stopped" on "hanode2"
    When    Run "crm cluster init -S -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    And     Service "sbd" is "started" on "hanode1"
    When    Run "crm cluster join -c hanode1 -y" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    And     Service "sbd" is "started" on "hanode2"
    And     Resource "stonith:external/sbd" not configured

    When    Run "crm -F cluster init sbd -s /dev/sda1 -y" on "hanode1"
    Then    Service "sbd" is "started" on "hanode1"
    And     Service "sbd" is "started" on "hanode2"
    And     Resource "stonith-sbd" type "external/sbd" is "Started"
    And     Run "ps -ef|grep -v grep|grep 'watcher: /dev/sda1 '" OK

  @clean
  Scenario: Change sbd device
    Given   Has disk "/dev/sda1" on "hanode1"
    Given   Has disk "/dev/sda2" on "hanode1"
    Given   Cluster service is "stopped" on "hanode1"
    Given   Has disk "/dev/sda1" on "hanode2"
    Given   Has disk "/dev/sda2" on "hanode2"
    Given   Cluster service is "stopped" on "hanode2"
    When    Run "crm cluster init -s /dev/sda1 -y" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    And     Service "sbd" is "started" on "hanode1"
    When    Run "crm cluster join -c hanode1 -y" on "hanode2"
    Then    Cluster service is "started" on "hanode2"
    And     Service "sbd" is "started" on "hanode2"
    And     Resource "stonith-sbd" type "external/sbd" is "Started"
    And     Run "ps -ef|grep -v grep|grep 'watcher: /dev/sda1 '" OK

    When    Run "crm -F cluster init sbd -s /dev/sda2 -y" on "hanode1"
    Then    Service "sbd" is "started" on "hanode1"
    And     Service "sbd" is "started" on "hanode2"
    And     Resource "stonith-sbd" type "external/sbd" is "Started"
    And     Run "ps -ef|grep -v grep|grep 'watcher: /dev/sda2 '" OK
    When    Try "ps -ef|grep -v grep|grep 'watcher: /dev/sda1 '"
    Then    Expected return code is "1"