Revision c2a0947d qa/qa_cluster.py
b/qa/qa_cluster.py | ||
---|---|---|
37 | 37 |
from qa_utils import AssertEqual, AssertCommand, GetCommandOutput |
38 | 38 |
|
39 | 39 |
|
40 |
#: cluster verify command |
|
41 |
_CLUSTER_VERIFY = ["gnt-cluster", "verify"] |
|
42 |
|
|
40 | 43 |
def _RemoveFileFromAllNodes(filename): |
41 | 44 |
"""Removes a file from all nodes. |
42 | 45 |
|
... | ... | |
108 | 111 |
print qa_utils.FormatError('"rename" entry is missing') |
109 | 112 |
return |
110 | 113 |
|
111 |
cmd_verify = ["gnt-cluster", "verify"] |
|
112 |
|
|
113 | 114 |
for data in [ |
114 | 115 |
cmd + [rename_target], |
115 |
cmd_verify,
|
|
116 |
_CLUSTER_VERIFY,
|
|
116 | 117 |
cmd + [original_name], |
117 |
cmd_verify,
|
|
118 |
_CLUSTER_VERIFY,
|
|
118 | 119 |
]: |
119 | 120 |
AssertCommand(data) |
120 | 121 |
|
... | ... | |
123 | 124 |
"""out-of-band framework""" |
124 | 125 |
oob_path_exists = "/tmp/ganeti-qa-oob-does-exist-%s" % utils.NewUUID() |
125 | 126 |
|
126 |
AssertCommand(["gnt-cluster", "verify"])
|
|
127 |
AssertCommand(_CLUSTER_VERIFY)
|
|
127 | 128 |
AssertCommand(["gnt-cluster", "modify", "--node-parameters", |
128 | 129 |
"oob_program=/tmp/ganeti-qa-oob-does-not-exist-%s" % |
129 | 130 |
utils.NewUUID()]) |
130 | 131 |
|
131 |
AssertCommand(["gnt-cluster", "verify"], fail=True)
|
|
132 |
AssertCommand(_CLUSTER_VERIFY, fail=True)
|
|
132 | 133 |
|
133 | 134 |
AssertCommand(["touch", oob_path_exists]) |
134 | 135 |
AssertCommand(["chmod", "0400", oob_path_exists]) |
... | ... | |
138 | 139 |
AssertCommand(["gnt-cluster", "modify", "--node-parameters", |
139 | 140 |
"oob_program=%s" % oob_path_exists]) |
140 | 141 |
|
141 |
AssertCommand(["gnt-cluster", "verify"], fail=True)
|
|
142 |
AssertCommand(_CLUSTER_VERIFY, fail=True)
|
|
142 | 143 |
|
143 | 144 |
AssertCommand(["chmod", "0500", oob_path_exists]) |
144 | 145 |
AssertCommand(["gnt-cluster", "copyfile", oob_path_exists]) |
145 | 146 |
|
146 |
AssertCommand(["gnt-cluster", "verify"])
|
|
147 |
AssertCommand(_CLUSTER_VERIFY)
|
|
147 | 148 |
finally: |
148 | 149 |
AssertCommand(["gnt-cluster", "command", "rm", oob_path_exists]) |
149 | 150 |
|
... | ... | |
191 | 192 |
|
192 | 193 |
def TestClusterVerify(): |
193 | 194 |
"""gnt-cluster verify""" |
194 |
AssertCommand(["gnt-cluster", "verify"])
|
|
195 |
AssertCommand(_CLUSTER_VERIFY)
|
|
195 | 196 |
AssertCommand(["gnt-cluster", "verify-disks"]) |
196 | 197 |
|
197 | 198 |
|
... | ... | |
202 | 203 |
|
203 | 204 |
def TestClusterReservedLvs(): |
204 | 205 |
"""gnt-cluster reserved lvs""" |
205 |
CVERIFY = ["gnt-cluster", "verify"] |
|
206 | 206 |
for fail, cmd in [ |
207 |
(False, CVERIFY),
|
|
207 |
(False, _CLUSTER_VERIFY),
|
|
208 | 208 |
(False, ["gnt-cluster", "modify", "--reserved-lvs", ""]), |
209 | 209 |
(False, ["lvcreate", "-L1G", "-nqa-test", "xenvg"]), |
210 |
(True, CVERIFY),
|
|
210 |
(True, _CLUSTER_VERIFY),
|
|
211 | 211 |
(False, ["gnt-cluster", "modify", "--reserved-lvs", |
212 | 212 |
"xenvg/qa-test,.*/other-test"]), |
213 |
(False, CVERIFY),
|
|
213 |
(False, _CLUSTER_VERIFY),
|
|
214 | 214 |
(False, ["gnt-cluster", "modify", "--reserved-lvs", ".*/qa-.*"]), |
215 |
(False, CVERIFY),
|
|
215 |
(False, _CLUSTER_VERIFY),
|
|
216 | 216 |
(False, ["gnt-cluster", "modify", "--reserved-lvs", ""]), |
217 |
(True, CVERIFY),
|
|
217 |
(True, _CLUSTER_VERIFY),
|
|
218 | 218 |
(False, ["lvremove", "-f", "xenvg/qa-test"]), |
219 |
(False, CVERIFY),
|
|
219 |
(False, _CLUSTER_VERIFY),
|
|
220 | 220 |
]: |
221 | 221 |
AssertCommand(cmd, fail=fail) |
222 | 222 |
|
Also available in: Unified diff