root / qa / qa_cluster.py @ 3039e2dc
History | View | Annotate | Download (36.4 kB)
1 | c68d1f43 | Michael Hanselmann | #
|
---|---|---|---|
2 | c68d1f43 | Michael Hanselmann | #
|
3 | c68d1f43 | Michael Hanselmann | |
4 | 587f8ff6 | Bernardo Dal Seno | # Copyright (C) 2007, 2010, 2011, 2012, 2013 Google Inc.
|
5 | cec9845c | Michael Hanselmann | #
|
6 | cec9845c | Michael Hanselmann | # This program is free software; you can redistribute it and/or modify
|
7 | cec9845c | Michael Hanselmann | # it under the terms of the GNU General Public License as published by
|
8 | cec9845c | Michael Hanselmann | # the Free Software Foundation; either version 2 of the License, or
|
9 | cec9845c | Michael Hanselmann | # (at your option) any later version.
|
10 | cec9845c | Michael Hanselmann | #
|
11 | cec9845c | Michael Hanselmann | # This program is distributed in the hope that it will be useful, but
|
12 | cec9845c | Michael Hanselmann | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | cec9845c | Michael Hanselmann | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | cec9845c | Michael Hanselmann | # General Public License for more details.
|
15 | cec9845c | Michael Hanselmann | #
|
16 | cec9845c | Michael Hanselmann | # You should have received a copy of the GNU General Public License
|
17 | cec9845c | Michael Hanselmann | # along with this program; if not, write to the Free Software
|
18 | cec9845c | Michael Hanselmann | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
19 | cec9845c | Michael Hanselmann | # 02110-1301, USA.
|
20 | cec9845c | Michael Hanselmann | |
21 | cec9845c | Michael Hanselmann | |
22 | cec9845c | Michael Hanselmann | """Cluster related QA tests.
|
23 | cec9845c | Michael Hanselmann |
|
24 | cec9845c | Michael Hanselmann | """
|
25 | cec9845c | Michael Hanselmann | |
26 | 587f8ff6 | Bernardo Dal Seno | import re |
27 | cec9845c | Michael Hanselmann | import tempfile |
28 | 49ceab21 | Michael Hanselmann | import os.path |
29 | cec9845c | Michael Hanselmann | |
30 | 6d4a1656 | Michael Hanselmann | from ganeti import constants |
31 | 66d1f035 | René Nussbaumer | from ganeti import compat |
32 | cec9845c | Michael Hanselmann | from ganeti import utils |
33 | 304d9f02 | Michael Hanselmann | from ganeti import pathutils |
34 | cec9845c | Michael Hanselmann | |
35 | cec9845c | Michael Hanselmann | import qa_config |
36 | e4889779 | Thomas Thrainer | import qa_daemon |
37 | cec9845c | Michael Hanselmann | import qa_utils |
38 | cec9845c | Michael Hanselmann | import qa_error |
39 | 462f0faa | Helga Velroyen | import qa_instance |
40 | cec9845c | Michael Hanselmann | |
41 | 66d1f035 | René Nussbaumer | from qa_utils import AssertEqual, AssertCommand, GetCommandOutput |
42 | cec9845c | Michael Hanselmann | |
43 | cec9845c | Michael Hanselmann | |
44 | 23610ff8 | Bernardo Dal Seno | # Prefix for LVM volumes created by QA code during tests
|
45 | 23610ff8 | Bernardo Dal Seno | _QA_LV_PREFIX = "qa-"
|
46 | 23610ff8 | Bernardo Dal Seno | |
47 | c2a0947d | Iustin Pop | #: cluster verify command
|
48 | c2a0947d | Iustin Pop | _CLUSTER_VERIFY = ["gnt-cluster", "verify"] |
49 | c2a0947d | Iustin Pop | |
50 | 21bf2e2e | Andrea Spadaccini | |
51 | 830da270 | Michael Hanselmann | def _RemoveFileFromAllNodes(filename): |
52 | 830da270 | Michael Hanselmann | """Removes a file from all nodes.
|
53 | 830da270 | Michael Hanselmann |
|
54 | 830da270 | Michael Hanselmann | """
|
55 | 2f4b4f78 | Iustin Pop | for node in qa_config.get("nodes"): |
56 | 2f4b4f78 | Iustin Pop | AssertCommand(["rm", "-f", filename], node=node) |
57 | 830da270 | Michael Hanselmann | |
58 | 830da270 | Michael Hanselmann | |
59 | 830da270 | Michael Hanselmann | def _CheckFileOnAllNodes(filename, content): |
60 | 830da270 | Michael Hanselmann | """Verifies the content of the given file on all nodes.
|
61 | 830da270 | Michael Hanselmann |
|
62 | 830da270 | Michael Hanselmann | """
|
63 | 830da270 | Michael Hanselmann | cmd = utils.ShellQuoteArgs(["cat", filename])
|
64 | 2f4b4f78 | Iustin Pop | for node in qa_config.get("nodes"): |
65 | aecba21e | Michael Hanselmann | AssertEqual(qa_utils.GetCommandOutput(node.primary, cmd), content) |
66 | 830da270 | Michael Hanselmann | |
67 | 830da270 | Michael Hanselmann | |
68 | 0e79564a | Bernardo Dal Seno | def _GetClusterField(field_path): |
69 | 0e79564a | Bernardo Dal Seno | """Get the value of a cluster field.
|
70 | 17cfeee9 | Bernardo Dal Seno |
|
71 | 0e79564a | Bernardo Dal Seno | @type field_path: list of strings
|
72 | 0e79564a | Bernardo Dal Seno | @param field_path: Names of the groups/fields to navigate to get the desired
|
73 | 0e79564a | Bernardo Dal Seno | value, e.g. C{["Default node parameters", "oob_program"]}
|
74 | 0e79564a | Bernardo Dal Seno | @return: The effective value of the field (the actual type depends on the
|
75 | 0e79564a | Bernardo Dal Seno | chosen field)
|
76 | 17cfeee9 | Bernardo Dal Seno |
|
77 | 17cfeee9 | Bernardo Dal Seno | """
|
78 | 0e79564a | Bernardo Dal Seno | assert isinstance(field_path, list) |
79 | 0e79564a | Bernardo Dal Seno | assert field_path
|
80 | 0e79564a | Bernardo Dal Seno | ret = qa_utils.GetObjectInfo(["gnt-cluster", "info"]) |
81 | 0e79564a | Bernardo Dal Seno | for key in field_path: |
82 | 0e79564a | Bernardo Dal Seno | ret = ret[key] |
83 | 0e79564a | Bernardo Dal Seno | return ret
|
84 | 17cfeee9 | Bernardo Dal Seno | |
85 | 17cfeee9 | Bernardo Dal Seno | |
86 | 587f8ff6 | Bernardo Dal Seno | # Cluster-verify errors (date, "ERROR", then error code)
|
87 | ab4832d1 | Bernardo Dal Seno | _CVERROR_RE = re.compile(r"^[\w\s:]+\s+- (ERROR|WARNING):([A-Z0-9_-]+):")
|
88 | 587f8ff6 | Bernardo Dal Seno | |
89 | 587f8ff6 | Bernardo Dal Seno | |
90 | 587f8ff6 | Bernardo Dal Seno | def _GetCVErrorCodes(cvout): |
91 | ab4832d1 | Bernardo Dal Seno | errs = set()
|
92 | ab4832d1 | Bernardo Dal Seno | warns = set()
|
93 | 587f8ff6 | Bernardo Dal Seno | for l in cvout.splitlines(): |
94 | 587f8ff6 | Bernardo Dal Seno | m = _CVERROR_RE.match(l) |
95 | 587f8ff6 | Bernardo Dal Seno | if m:
|
96 | ab4832d1 | Bernardo Dal Seno | etype = m.group(1)
|
97 | ab4832d1 | Bernardo Dal Seno | ecode = m.group(2)
|
98 | ab4832d1 | Bernardo Dal Seno | if etype == "ERROR": |
99 | ab4832d1 | Bernardo Dal Seno | errs.add(ecode) |
100 | ab4832d1 | Bernardo Dal Seno | elif etype == "WARNING": |
101 | ab4832d1 | Bernardo Dal Seno | warns.add(ecode) |
102 | ab4832d1 | Bernardo Dal Seno | return (errs, warns)
|
103 | 587f8ff6 | Bernardo Dal Seno | |
104 | 587f8ff6 | Bernardo Dal Seno | |
105 | ab4832d1 | Bernardo Dal Seno | def _CheckVerifyErrors(actual, expected, etype): |
106 | ab4832d1 | Bernardo Dal Seno | exp_codes = compat.UniqueFrozenset(e for (_, e, _) in expected) |
107 | ab4832d1 | Bernardo Dal Seno | if not actual.issuperset(exp_codes): |
108 | ab4832d1 | Bernardo Dal Seno | missing = exp_codes.difference(actual) |
109 | ab4832d1 | Bernardo Dal Seno | raise qa_error.Error("Cluster-verify didn't return these expected" |
110 | ab4832d1 | Bernardo Dal Seno | " %ss: %s" % (etype, utils.CommaJoin(missing)))
|
111 | ab4832d1 | Bernardo Dal Seno | |
112 | ab4832d1 | Bernardo Dal Seno | |
113 | ab4832d1 | Bernardo Dal Seno | def AssertClusterVerify(fail=False, errors=None, warnings=None): |
114 | 587f8ff6 | Bernardo Dal Seno | """Run cluster-verify and check the result
|
115 | 587f8ff6 | Bernardo Dal Seno |
|
116 | 587f8ff6 | Bernardo Dal Seno | @type fail: bool
|
117 | 587f8ff6 | Bernardo Dal Seno | @param fail: if cluster-verify is expected to fail instead of succeeding
|
118 | 587f8ff6 | Bernardo Dal Seno | @type errors: list of tuples
|
119 | 587f8ff6 | Bernardo Dal Seno | @param errors: List of CV_XXX errors that are expected; if specified, all the
|
120 | 587f8ff6 | Bernardo Dal Seno | errors listed must appear in cluster-verify output. A non-empty value
|
121 | 587f8ff6 | Bernardo Dal Seno | implies C{fail=True}.
|
122 | ab4832d1 | Bernardo Dal Seno | @type warnings: list of tuples
|
123 | ab4832d1 | Bernardo Dal Seno | @param warnings: Same as C{errors} but for warnings.
|
124 | 587f8ff6 | Bernardo Dal Seno |
|
125 | 587f8ff6 | Bernardo Dal Seno | """
|
126 | 587f8ff6 | Bernardo Dal Seno | cvcmd = "gnt-cluster verify"
|
127 | 587f8ff6 | Bernardo Dal Seno | mnode = qa_config.GetMasterNode() |
128 | ab4832d1 | Bernardo Dal Seno | if errors or warnings: |
129 | aecba21e | Michael Hanselmann | cvout = GetCommandOutput(mnode.primary, cvcmd + " --error-codes",
|
130 | ab4832d1 | Bernardo Dal Seno | fail=(fail or errors))
|
131 | ab4832d1 | Bernardo Dal Seno | (act_errs, act_warns) = _GetCVErrorCodes(cvout) |
132 | ab4832d1 | Bernardo Dal Seno | if errors:
|
133 | ab4832d1 | Bernardo Dal Seno | _CheckVerifyErrors(act_errs, errors, "error")
|
134 | ab4832d1 | Bernardo Dal Seno | if warnings:
|
135 | ab4832d1 | Bernardo Dal Seno | _CheckVerifyErrors(act_warns, warnings, "warning")
|
136 | 587f8ff6 | Bernardo Dal Seno | else:
|
137 | 587f8ff6 | Bernardo Dal Seno | AssertCommand(cvcmd, fail=fail, node=mnode) |
138 | 587f8ff6 | Bernardo Dal Seno | |
139 | 587f8ff6 | Bernardo Dal Seno | |
140 | 92cb4940 | Andrea Spadaccini | # data for testing failures due to bad keys/values for disk parameters
|
141 | 92cb4940 | Andrea Spadaccini | _FAIL_PARAMS = ["nonexistent:resync-rate=1",
|
142 | 92cb4940 | Andrea Spadaccini | "drbd:nonexistent=1",
|
143 | 92cb4940 | Andrea Spadaccini | "drbd:resync-rate=invalid",
|
144 | 92cb4940 | Andrea Spadaccini | ] |
145 | 92cb4940 | Andrea Spadaccini | |
146 | 92cb4940 | Andrea Spadaccini | |
147 | 92cb4940 | Andrea Spadaccini | def TestClusterInitDisk(): |
148 | 92cb4940 | Andrea Spadaccini | """gnt-cluster init -D"""
|
149 | 92cb4940 | Andrea Spadaccini | name = qa_config.get("name")
|
150 | 92cb4940 | Andrea Spadaccini | for param in _FAIL_PARAMS: |
151 | 92cb4940 | Andrea Spadaccini | AssertCommand(["gnt-cluster", "init", "-D", param, name], fail=True) |
152 | 92cb4940 | Andrea Spadaccini | |
153 | 92cb4940 | Andrea Spadaccini | |
154 | 725ec2f1 | René Nussbaumer | def TestClusterInit(rapi_user, rapi_secret): |
155 | cec9845c | Michael Hanselmann | """gnt-cluster init"""
|
156 | cec9845c | Michael Hanselmann | master = qa_config.GetMasterNode() |
157 | cec9845c | Michael Hanselmann | |
158 | 734fd6b4 | Michael Hanselmann | rapi_users_path = qa_utils.MakeNodePath(master, pathutils.RAPI_USERS_FILE) |
159 | 734fd6b4 | Michael Hanselmann | rapi_dir = os.path.dirname(rapi_users_path) |
160 | 49ceab21 | Michael Hanselmann | |
161 | 725ec2f1 | René Nussbaumer | # First create the RAPI credentials
|
162 | a62d1901 | Michael Hanselmann | fh = tempfile.NamedTemporaryFile() |
163 | a62d1901 | Michael Hanselmann | try:
|
164 | a62d1901 | Michael Hanselmann | fh.write("%s %s write\n" % (rapi_user, rapi_secret))
|
165 | a62d1901 | Michael Hanselmann | fh.flush() |
166 | a62d1901 | Michael Hanselmann | |
167 | aecba21e | Michael Hanselmann | tmpru = qa_utils.UploadFile(master.primary, fh.name) |
168 | a62d1901 | Michael Hanselmann | try:
|
169 | 49ceab21 | Michael Hanselmann | AssertCommand(["mkdir", "-p", rapi_dir]) |
170 | 734fd6b4 | Michael Hanselmann | AssertCommand(["mv", tmpru, rapi_users_path])
|
171 | a62d1901 | Michael Hanselmann | finally:
|
172 | 2f4b4f78 | Iustin Pop | AssertCommand(["rm", "-f", tmpru]) |
173 | a62d1901 | Michael Hanselmann | finally:
|
174 | a62d1901 | Michael Hanselmann | fh.close() |
175 | a62d1901 | Michael Hanselmann | |
176 | a62d1901 | Michael Hanselmann | # Initialize cluster
|
177 | 3039e2dc | Helga Velroyen | enabled_disk_templates = qa_config.GetEnabledDiskTemplates() |
178 | e7b6183b | Michael Hanselmann | cmd = [ |
179 | e7b6183b | Michael Hanselmann | "gnt-cluster", "init", |
180 | e7b6183b | Michael Hanselmann | "--primary-ip-version=%d" % qa_config.get("primary_ip_version", 4), |
181 | 59c1d41e | Michael Hanselmann | "--enabled-hypervisors=%s" % ",".join(qa_config.GetEnabledHypervisors()), |
182 | 2dae8d64 | Helga Velroyen | "--enabled-disk-templates=%s" %
|
183 | 3039e2dc | Helga Velroyen | ",".join(enabled_disk_templates),
|
184 | e7b6183b | Michael Hanselmann | ] |
185 | 3039e2dc | Helga Velroyen | if constants.DT_FILE in enabled_disk_templates: |
186 | 3039e2dc | Helga Velroyen | cmd.append( |
187 | 3039e2dc | Helga Velroyen | "--file-storage-dir=%s" %
|
188 | 3039e2dc | Helga Velroyen | qa_config.get("file-storage-dir", pathutils.DEFAULT_FILE_STORAGE_DIR))
|
189 | 20286f7c | René Nussbaumer | |
190 | 20286f7c | René Nussbaumer | for spec_type in ("mem-size", "disk-size", "disk-count", "cpu-count", |
191 | 20286f7c | René Nussbaumer | "nic-count"):
|
192 | 20286f7c | René Nussbaumer | for spec_val in ("min", "max", "std"): |
193 | 20286f7c | René Nussbaumer | spec = qa_config.get("ispec_%s_%s" %
|
194 | 3601d488 | Michael Hanselmann | (spec_type.replace("-", "_"), spec_val), None) |
195 | 00650761 | Michael Hanselmann | if spec is not None: |
196 | 20286f7c | René Nussbaumer | cmd.append("--specs-%s=%s=%d" % (spec_type, spec_val, spec))
|
197 | 9486f6ae | Manuel Franceschini | |
198 | aecba21e | Michael Hanselmann | if master.secondary:
|
199 | aecba21e | Michael Hanselmann | cmd.append("--secondary-ip=%s" % master.secondary)
|
200 | cec9845c | Michael Hanselmann | |
201 | 912737ba | Helga Velroyen | if utils.IsLvmEnabled(qa_config.GetEnabledDiskTemplates()):
|
202 | 912737ba | Helga Velroyen | vgname = qa_config.get("vg-name", constants.DEFAULT_VG)
|
203 | 912737ba | Helga Velroyen | if vgname:
|
204 | 912737ba | Helga Velroyen | cmd.append("--vg-name=%s" % vgname)
|
205 | 912737ba | Helga Velroyen | else:
|
206 | 912737ba | Helga Velroyen | raise qa_error.Error("Please specify a volume group if you enable" |
207 | 912737ba | Helga Velroyen | " lvm-based disk templates in the QA.")
|
208 | 23610ff8 | Bernardo Dal Seno | |
209 | 3601d488 | Michael Hanselmann | master_netdev = qa_config.get("master-netdev", None) |
210 | 3601d488 | Michael Hanselmann | if master_netdev:
|
211 | 3601d488 | Michael Hanselmann | cmd.append("--master-netdev=%s" % master_netdev)
|
212 | 3601d488 | Michael Hanselmann | |
213 | 3601d488 | Michael Hanselmann | nicparams = qa_config.get("default-nicparams", None) |
214 | 3601d488 | Michael Hanselmann | if nicparams:
|
215 | 3601d488 | Michael Hanselmann | cmd.append("--nic-parameters=%s" %
|
216 | 3601d488 | Michael Hanselmann | ",".join(utils.FormatKeyValue(nicparams)))
|
217 | cec9845c | Michael Hanselmann | |
218 | 6a0f22e1 | Bernardo Dal Seno | # Cluster value of the exclusive-storage node parameter
|
219 | 6a0f22e1 | Bernardo Dal Seno | e_s = qa_config.get("exclusive-storage")
|
220 | 6a0f22e1 | Bernardo Dal Seno | if e_s is not None: |
221 | 6a0f22e1 | Bernardo Dal Seno | cmd.extend(["--node-parameters", "exclusive_storage=%s" % e_s]) |
222 | 6a0f22e1 | Bernardo Dal Seno | else:
|
223 | 6a0f22e1 | Bernardo Dal Seno | e_s = False
|
224 | 6a0f22e1 | Bernardo Dal Seno | qa_config.SetExclusiveStorage(e_s) |
225 | 6a0f22e1 | Bernardo Dal Seno | |
226 | becf9d5c | Michael Hanselmann | extra_args = qa_config.get("cluster-init-args")
|
227 | becf9d5c | Michael Hanselmann | if extra_args:
|
228 | becf9d5c | Michael Hanselmann | cmd.extend(extra_args) |
229 | becf9d5c | Michael Hanselmann | |
230 | 13d2e231 | Andrea Spadaccini | cmd.append(qa_config.get("name"))
|
231 | becf9d5c | Michael Hanselmann | |
232 | 2f4b4f78 | Iustin Pop | AssertCommand(cmd) |
233 | cec9845c | Michael Hanselmann | |
234 | 5abecc1c | Iustin Pop | cmd = ["gnt-cluster", "modify"] |
235 | 13d2e231 | Andrea Spadaccini | |
236 | 5abecc1c | Iustin Pop | # hypervisor parameter modifications
|
237 | 5abecc1c | Iustin Pop | hvp = qa_config.get("hypervisor-parameters", {})
|
238 | 5abecc1c | Iustin Pop | for k, v in hvp.items(): |
239 | 5abecc1c | Iustin Pop | cmd.extend(["-H", "%s:%s" % (k, v)]) |
240 | 5abecc1c | Iustin Pop | # backend parameter modifications
|
241 | 5abecc1c | Iustin Pop | bep = qa_config.get("backend-parameters", "") |
242 | 5abecc1c | Iustin Pop | if bep:
|
243 | 5abecc1c | Iustin Pop | cmd.extend(["-B", bep])
|
244 | 5abecc1c | Iustin Pop | |
245 | 5abecc1c | Iustin Pop | if len(cmd) > 2: |
246 | 5abecc1c | Iustin Pop | AssertCommand(cmd) |
247 | 5abecc1c | Iustin Pop | |
248 | 5abecc1c | Iustin Pop | # OS parameters
|
249 | 5abecc1c | Iustin Pop | osp = qa_config.get("os-parameters", {})
|
250 | 5abecc1c | Iustin Pop | for k, v in osp.items(): |
251 | 5abecc1c | Iustin Pop | AssertCommand(["gnt-os", "modify", "-O", v, k]) |
252 | 5abecc1c | Iustin Pop | |
253 | 5abecc1c | Iustin Pop | # OS hypervisor parameters
|
254 | 5abecc1c | Iustin Pop | os_hvp = qa_config.get("os-hvp", {})
|
255 | 5abecc1c | Iustin Pop | for os_name in os_hvp: |
256 | 5abecc1c | Iustin Pop | for hv, hvp in os_hvp[os_name].items(): |
257 | 5abecc1c | Iustin Pop | AssertCommand(["gnt-os", "modify", "-H", "%s:%s" % (hv, hvp), os_name]) |
258 | 5abecc1c | Iustin Pop | |
259 | cec9845c | Michael Hanselmann | |
260 | caea3b32 | Iustin Pop | def TestClusterRename(): |
261 | caea3b32 | Iustin Pop | """gnt-cluster rename"""
|
262 | d0c8c01d | Iustin Pop | cmd = ["gnt-cluster", "rename", "-f"] |
263 | caea3b32 | Iustin Pop | |
264 | d0c8c01d | Iustin Pop | original_name = qa_config.get("name")
|
265 | d0c8c01d | Iustin Pop | rename_target = qa_config.get("rename", None) |
266 | caea3b32 | Iustin Pop | if rename_target is None: |
267 | caea3b32 | Iustin Pop | print qa_utils.FormatError('"rename" entry is missing') |
268 | caea3b32 | Iustin Pop | return
|
269 | caea3b32 | Iustin Pop | |
270 | 2f4b4f78 | Iustin Pop | for data in [ |
271 | 2f4b4f78 | Iustin Pop | cmd + [rename_target], |
272 | c2a0947d | Iustin Pop | _CLUSTER_VERIFY, |
273 | 2f4b4f78 | Iustin Pop | cmd + [original_name], |
274 | c2a0947d | Iustin Pop | _CLUSTER_VERIFY, |
275 | 2f4b4f78 | Iustin Pop | ]: |
276 | 2f4b4f78 | Iustin Pop | AssertCommand(data) |
277 | caea3b32 | Iustin Pop | |
278 | caea3b32 | Iustin Pop | |
279 | 69df9d2b | Iustin Pop | def TestClusterOob(): |
280 | 69df9d2b | Iustin Pop | """out-of-band framework"""
|
281 | f55312bd | René Nussbaumer | oob_path_exists = "/tmp/ganeti-qa-oob-does-exist-%s" % utils.NewUUID()
|
282 | f55312bd | René Nussbaumer | |
283 | c2a0947d | Iustin Pop | AssertCommand(_CLUSTER_VERIFY) |
284 | f55312bd | René Nussbaumer | AssertCommand(["gnt-cluster", "modify", "--node-parameters", |
285 | f55312bd | René Nussbaumer | "oob_program=/tmp/ganeti-qa-oob-does-not-exist-%s" %
|
286 | f55312bd | René Nussbaumer | utils.NewUUID()]) |
287 | f55312bd | René Nussbaumer | |
288 | c2a0947d | Iustin Pop | AssertCommand(_CLUSTER_VERIFY, fail=True)
|
289 | f55312bd | René Nussbaumer | |
290 | 69df9d2b | Iustin Pop | AssertCommand(["touch", oob_path_exists])
|
291 | 69df9d2b | Iustin Pop | AssertCommand(["chmod", "0400", oob_path_exists]) |
292 | 69df9d2b | Iustin Pop | AssertCommand(["gnt-cluster", "copyfile", oob_path_exists]) |
293 | f55312bd | René Nussbaumer | |
294 | f55312bd | René Nussbaumer | try:
|
295 | f55312bd | René Nussbaumer | AssertCommand(["gnt-cluster", "modify", "--node-parameters", |
296 | f55312bd | René Nussbaumer | "oob_program=%s" % oob_path_exists])
|
297 | f55312bd | René Nussbaumer | |
298 | c2a0947d | Iustin Pop | AssertCommand(_CLUSTER_VERIFY, fail=True)
|
299 | f55312bd | René Nussbaumer | |
300 | 69df9d2b | Iustin Pop | AssertCommand(["chmod", "0500", oob_path_exists]) |
301 | 69df9d2b | Iustin Pop | AssertCommand(["gnt-cluster", "copyfile", oob_path_exists]) |
302 | f55312bd | René Nussbaumer | |
303 | c2a0947d | Iustin Pop | AssertCommand(_CLUSTER_VERIFY) |
304 | f55312bd | René Nussbaumer | finally:
|
305 | 69df9d2b | Iustin Pop | AssertCommand(["gnt-cluster", "command", "rm", oob_path_exists]) |
306 | f55312bd | René Nussbaumer | |
307 | f55312bd | René Nussbaumer | AssertCommand(["gnt-cluster", "modify", "--node-parameters", |
308 | f55312bd | René Nussbaumer | "oob_program="])
|
309 | 69df9d2b | Iustin Pop | |
310 | 69df9d2b | Iustin Pop | |
311 | 66d1f035 | René Nussbaumer | def TestClusterEpo(): |
312 | 66d1f035 | René Nussbaumer | """gnt-cluster epo"""
|
313 | 66d1f035 | René Nussbaumer | master = qa_config.GetMasterNode() |
314 | 66d1f035 | René Nussbaumer | |
315 | 66d1f035 | René Nussbaumer | # Assert that OOB is unavailable for all nodes
|
316 | aecba21e | Michael Hanselmann | result_output = GetCommandOutput(master.primary, |
317 | 58ea8d17 | Michael Hanselmann | "gnt-node list --verbose --no-headers -o"
|
318 | 66d1f035 | René Nussbaumer | " powered")
|
319 | 66d1f035 | René Nussbaumer | AssertEqual(compat.all(powered == "(unavail)"
|
320 | 66d1f035 | René Nussbaumer | for powered in result_output.splitlines()), True) |
321 | 66d1f035 | René Nussbaumer | |
322 | 66d1f035 | René Nussbaumer | # Conflicting
|
323 | 66d1f035 | René Nussbaumer | AssertCommand(["gnt-cluster", "epo", "--groups", "--all"], fail=True) |
324 | 66d1f035 | René Nussbaumer | # --all doesn't expect arguments
|
325 | 66d1f035 | René Nussbaumer | AssertCommand(["gnt-cluster", "epo", "--all", "some_arg"], fail=True) |
326 | 66d1f035 | René Nussbaumer | |
327 | 66d1f035 | René Nussbaumer | # Unless --all is given master is not allowed to be in the list
|
328 | aecba21e | Michael Hanselmann | AssertCommand(["gnt-cluster", "epo", "-f", master.primary], fail=True) |
329 | 66d1f035 | René Nussbaumer | |
330 | 66d1f035 | René Nussbaumer | # This shouldn't fail
|
331 | 66d1f035 | René Nussbaumer | AssertCommand(["gnt-cluster", "epo", "-f", "--all"]) |
332 | 66d1f035 | René Nussbaumer | |
333 | 66d1f035 | René Nussbaumer | # All instances should have been stopped now
|
334 | aecba21e | Michael Hanselmann | result_output = GetCommandOutput(master.primary, |
335 | 58ea8d17 | Michael Hanselmann | "gnt-instance list --no-headers -o status")
|
336 | 3e0ed18c | René Nussbaumer | # ERROR_down because the instance is stopped but not recorded as such
|
337 | 3e0ed18c | René Nussbaumer | AssertEqual(compat.all(status == "ERROR_down"
|
338 | 66d1f035 | René Nussbaumer | for status in result_output.splitlines()), True) |
339 | 66d1f035 | René Nussbaumer | |
340 | 66d1f035 | René Nussbaumer | # Now start everything again
|
341 | 66d1f035 | René Nussbaumer | AssertCommand(["gnt-cluster", "epo", "--on", "-f", "--all"]) |
342 | 66d1f035 | René Nussbaumer | |
343 | 66d1f035 | René Nussbaumer | # All instances should have been started now
|
344 | aecba21e | Michael Hanselmann | result_output = GetCommandOutput(master.primary, |
345 | 58ea8d17 | Michael Hanselmann | "gnt-instance list --no-headers -o status")
|
346 | 66d1f035 | René Nussbaumer | AssertEqual(compat.all(status == "running"
|
347 | 66d1f035 | René Nussbaumer | for status in result_output.splitlines()), True) |
348 | 66d1f035 | René Nussbaumer | |
349 | 66d1f035 | René Nussbaumer | |
350 | 69df9d2b | Iustin Pop | def TestClusterVerify(): |
351 | 69df9d2b | Iustin Pop | """gnt-cluster verify"""
|
352 | c2a0947d | Iustin Pop | AssertCommand(_CLUSTER_VERIFY) |
353 | c6953b6e | Iustin Pop | AssertCommand(["gnt-cluster", "verify-disks"]) |
354 | cec9845c | Michael Hanselmann | |
355 | 1377433b | Michael Hanselmann | |
356 | 7af293d7 | Thomas Thrainer | def TestClusterVerifyDisksBrokenDRBD(instance, inst_nodes): |
357 | 7af293d7 | Thomas Thrainer | """gnt-cluster verify-disks with broken DRBD"""
|
358 | e4889779 | Thomas Thrainer | qa_daemon.TestPauseWatcher() |
359 | 7af293d7 | Thomas Thrainer | |
360 | e4889779 | Thomas Thrainer | try:
|
361 | e4889779 | Thomas Thrainer | info = qa_instance.GetInstanceInfo(instance.name) |
362 | e4889779 | Thomas Thrainer | snode = inst_nodes[1]
|
363 | e4889779 | Thomas Thrainer | for idx, minor in enumerate(info["drbd-minors"][snode.primary]): |
364 | e4889779 | Thomas Thrainer | if idx % 2 == 0: |
365 | e4889779 | Thomas Thrainer | break_drbd_cmd = \ |
366 | e4889779 | Thomas Thrainer | "(drbdsetup %d down >/dev/null 2>&1;" \
|
367 | e4889779 | Thomas Thrainer | " drbdsetup down resource%d >/dev/null 2>&1) || /bin/true" % \
|
368 | e4889779 | Thomas Thrainer | (minor, minor) |
369 | e4889779 | Thomas Thrainer | else:
|
370 | e4889779 | Thomas Thrainer | break_drbd_cmd = \ |
371 | e4889779 | Thomas Thrainer | "(drbdsetup %d detach >/dev/null 2>&1;" \
|
372 | e4889779 | Thomas Thrainer | " drbdsetup detach %d >/dev/null 2>&1) || /bin/true" % \
|
373 | e4889779 | Thomas Thrainer | (minor, minor) |
374 | e4889779 | Thomas Thrainer | AssertCommand(break_drbd_cmd, node=snode) |
375 | e4889779 | Thomas Thrainer | |
376 | e4889779 | Thomas Thrainer | verify_output = GetCommandOutput(qa_config.GetMasterNode().primary, |
377 | e4889779 | Thomas Thrainer | "gnt-cluster verify-disks")
|
378 | e4889779 | Thomas Thrainer | activation_msg = "Activating disks for instance '%s'" % instance.name
|
379 | e4889779 | Thomas Thrainer | if activation_msg not in verify_output: |
380 | e4889779 | Thomas Thrainer | raise qa_error.Error("gnt-cluster verify-disks did not activate broken" |
381 | e4889779 | Thomas Thrainer | " DRBD disks:\n%s" % verify_output)
|
382 | e4889779 | Thomas Thrainer | |
383 | e4889779 | Thomas Thrainer | verify_output = GetCommandOutput(qa_config.GetMasterNode().primary, |
384 | e4889779 | Thomas Thrainer | "gnt-cluster verify-disks")
|
385 | e4889779 | Thomas Thrainer | if activation_msg in verify_output: |
386 | e4889779 | Thomas Thrainer | raise qa_error.Error("gnt-cluster verify-disks wants to activate broken" |
387 | e4889779 | Thomas Thrainer | " DRBD disks on second attempt:\n%s" % verify_output)
|
388 | e4889779 | Thomas Thrainer | |
389 | e4889779 | Thomas Thrainer | AssertCommand(_CLUSTER_VERIFY) |
390 | e4889779 | Thomas Thrainer | finally:
|
391 | e4889779 | Thomas Thrainer | qa_daemon.TestResumeWatcher() |
392 | 7af293d7 | Thomas Thrainer | |
393 | 7af293d7 | Thomas Thrainer | |
394 | 1377433b | Michael Hanselmann | def TestJobqueue(): |
395 | 1377433b | Michael Hanselmann | """gnt-debug test-jobqueue"""
|
396 | 2f4b4f78 | Iustin Pop | AssertCommand(["gnt-debug", "test-jobqueue"]) |
397 | 1377433b | Michael Hanselmann | |
398 | 1377433b | Michael Hanselmann | |
399 | 5a85b99e | Michael Hanselmann | def TestDelay(node): |
400 | 5a85b99e | Michael Hanselmann | """gnt-debug delay"""
|
401 | 5a85b99e | Michael Hanselmann | AssertCommand(["gnt-debug", "delay", "1"]) |
402 | 5a85b99e | Michael Hanselmann | AssertCommand(["gnt-debug", "delay", "--no-master", "1"]) |
403 | 5a85b99e | Michael Hanselmann | AssertCommand(["gnt-debug", "delay", "--no-master", |
404 | aecba21e | Michael Hanselmann | "-n", node.primary, "1"]) |
405 | 5a85b99e | Michael Hanselmann | |
406 | 5a85b99e | Michael Hanselmann | |
407 | 452913ed | Iustin Pop | def TestClusterReservedLvs(): |
408 | 452913ed | Iustin Pop | """gnt-cluster reserved lvs"""
|
409 | 23610ff8 | Bernardo Dal Seno | vgname = qa_config.get("vg-name", constants.DEFAULT_VG)
|
410 | 23610ff8 | Bernardo Dal Seno | lvname = _QA_LV_PREFIX + "test"
|
411 | 23610ff8 | Bernardo Dal Seno | lvfullname = "/".join([vgname, lvname])
|
412 | 2f4b4f78 | Iustin Pop | for fail, cmd in [ |
413 | c2a0947d | Iustin Pop | (False, _CLUSTER_VERIFY),
|
414 | 2f4b4f78 | Iustin Pop | (False, ["gnt-cluster", "modify", "--reserved-lvs", ""]), |
415 | 23610ff8 | Bernardo Dal Seno | (False, ["lvcreate", "-L1G", "-n", lvname, vgname]), |
416 | 21bf2e2e | Andrea Spadaccini | (True, _CLUSTER_VERIFY),
|
417 | 84d7e26b | Dmitry Chernyak | (False, ["gnt-cluster", "modify", "--reserved-lvs", |
418 | 23610ff8 | Bernardo Dal Seno | "%s,.*/other-test" % lvfullname]),
|
419 | c2a0947d | Iustin Pop | (False, _CLUSTER_VERIFY),
|
420 | 23610ff8 | Bernardo Dal Seno | (False, ["gnt-cluster", "modify", "--reserved-lvs", |
421 | 23610ff8 | Bernardo Dal Seno | ".*/%s.*" % _QA_LV_PREFIX]),
|
422 | c2a0947d | Iustin Pop | (False, _CLUSTER_VERIFY),
|
423 | 2f4b4f78 | Iustin Pop | (False, ["gnt-cluster", "modify", "--reserved-lvs", ""]), |
424 | 21bf2e2e | Andrea Spadaccini | (True, _CLUSTER_VERIFY),
|
425 | 23610ff8 | Bernardo Dal Seno | (False, ["lvremove", "-f", lvfullname]), |
426 | c2a0947d | Iustin Pop | (False, _CLUSTER_VERIFY),
|
427 | 452913ed | Iustin Pop | ]: |
428 | 2f4b4f78 | Iustin Pop | AssertCommand(cmd, fail=fail) |
429 | 452913ed | Iustin Pop | |
430 | cec9845c | Michael Hanselmann | |
431 | 1e7acc3b | Iustin Pop | def TestClusterModifyEmpty(): |
432 | 1e7acc3b | Iustin Pop | """gnt-cluster modify"""
|
433 | 1e7acc3b | Iustin Pop | AssertCommand(["gnt-cluster", "modify"], fail=True) |
434 | 1e7acc3b | Iustin Pop | |
435 | 1e7acc3b | Iustin Pop | |
436 | 92cb4940 | Andrea Spadaccini | def TestClusterModifyDisk(): |
437 | 92cb4940 | Andrea Spadaccini | """gnt-cluster modify -D"""
|
438 | 92cb4940 | Andrea Spadaccini | for param in _FAIL_PARAMS: |
439 | 92cb4940 | Andrea Spadaccini | AssertCommand(["gnt-cluster", "modify", "-D", param], fail=True) |
440 | 92cb4940 | Andrea Spadaccini | |
441 | 92cb4940 | Andrea Spadaccini | |
442 | 2dae8d64 | Helga Velroyen | def TestClusterModifyDiskTemplates(): |
443 | 2dae8d64 | Helga Velroyen | """gnt-cluster modify --enabled-disk-templates=..."""
|
444 | 462f0faa | Helga Velroyen | enabled_disk_templates = qa_config.GetEnabledDiskTemplates() |
445 | 2dae8d64 | Helga Velroyen | default_disk_template = qa_config.GetDefaultDiskTemplate() |
446 | 462f0faa | Helga Velroyen | |
447 | 462f0faa | Helga Velroyen | _TestClusterModifyDiskTemplatesArguments(default_disk_template, |
448 | 462f0faa | Helga Velroyen | enabled_disk_templates) |
449 | 912737ba | Helga Velroyen | _TestClusterModifyDiskTemplatesVgName(enabled_disk_templates) |
450 | 462f0faa | Helga Velroyen | |
451 | 462f0faa | Helga Velroyen | _RestoreEnabledDiskTemplates() |
452 | 462f0faa | Helga Velroyen | nodes = qa_config.AcquireManyNodes(2)
|
453 | 462f0faa | Helga Velroyen | |
454 | 462f0faa | Helga Velroyen | instance_template = enabled_disk_templates[0]
|
455 | 462f0faa | Helga Velroyen | instance = qa_instance.CreateInstanceByDiskTemplate(nodes, instance_template) |
456 | 462f0faa | Helga Velroyen | |
457 | 462f0faa | Helga Velroyen | _TestClusterModifyUnusedDiskTemplate(instance_template) |
458 | 462f0faa | Helga Velroyen | _TestClusterModifyUsedDiskTemplate(instance_template, |
459 | 462f0faa | Helga Velroyen | enabled_disk_templates) |
460 | 462f0faa | Helga Velroyen | |
461 | 462f0faa | Helga Velroyen | qa_instance.TestInstanceRemove(instance) |
462 | 462f0faa | Helga Velroyen | _RestoreEnabledDiskTemplates() |
463 | 462f0faa | Helga Velroyen | |
464 | 462f0faa | Helga Velroyen | |
465 | 462f0faa | Helga Velroyen | def _RestoreEnabledDiskTemplates(): |
466 | 462f0faa | Helga Velroyen | """Sets the list of enabled disk templates back to the list of enabled disk
|
467 | 462f0faa | Helga Velroyen | templates from the QA configuration. This can be used to make sure that
|
468 | 462f0faa | Helga Velroyen | the tests that modify the list of disk templates do not interfere with
|
469 | 462f0faa | Helga Velroyen | other tests.
|
470 | 462f0faa | Helga Velroyen |
|
471 | 462f0faa | Helga Velroyen | """
|
472 | d101b7be | Thomas Thrainer | cmd = ["gnt-cluster", "modify", "--enabled-disk-templates=%s" % |
473 | d101b7be | Thomas Thrainer | ",".join(qa_config.GetEnabledDiskTemplates())]
|
474 | d101b7be | Thomas Thrainer | |
475 | d101b7be | Thomas Thrainer | if utils.IsLvmEnabled(qa_config.GetEnabledDiskTemplates()):
|
476 | d101b7be | Thomas Thrainer | vgname = qa_config.get("vg-name", constants.DEFAULT_VG)
|
477 | d101b7be | Thomas Thrainer | cmd.append("--vg-name=%s" % vgname)
|
478 | d101b7be | Thomas Thrainer | |
479 | d101b7be | Thomas Thrainer | AssertCommand(cmd, fail=False)
|
480 | 462f0faa | Helga Velroyen | |
481 | 462f0faa | Helga Velroyen | |
482 | 462f0faa | Helga Velroyen | def _TestClusterModifyDiskTemplatesArguments(default_disk_template, |
483 | 462f0faa | Helga Velroyen | enabled_disk_templates): |
484 | 462f0faa | Helga Velroyen | """Tests argument handling of 'gnt-cluster modify' with respect to
|
485 | 462f0faa | Helga Velroyen | the parameter '--enabled-disk-templates'. This test is independent
|
486 | 462f0faa | Helga Velroyen | of instances.
|
487 | 462f0faa | Helga Velroyen |
|
488 | 462f0faa | Helga Velroyen | """
|
489 | 912737ba | Helga Velroyen | _RestoreEnabledDiskTemplates() |
490 | 462f0faa | Helga Velroyen | |
491 | 2dae8d64 | Helga Velroyen | # bogus templates
|
492 | dacd8ba4 | Helga Velroyen | AssertCommand(["gnt-cluster", "modify", |
493 | 2dae8d64 | Helga Velroyen | "--enabled-disk-templates=pinkbunny"],
|
494 | dacd8ba4 | Helga Velroyen | fail=True)
|
495 | 462f0faa | Helga Velroyen | |
496 | dacd8ba4 | Helga Velroyen | # duplicate entries do no harm
|
497 | dacd8ba4 | Helga Velroyen | AssertCommand( |
498 | dacd8ba4 | Helga Velroyen | ["gnt-cluster", "modify", |
499 | 2dae8d64 | Helga Velroyen | "--enabled-disk-templates=%s,%s" %
|
500 | 2dae8d64 | Helga Velroyen | (default_disk_template, default_disk_template)], |
501 | dacd8ba4 | Helga Velroyen | fail=False)
|
502 | 462f0faa | Helga Velroyen | |
503 | 912737ba | Helga Velroyen | if constants.DT_DRBD8 in enabled_disk_templates: |
504 | 0c2cfb97 | Thomas Thrainer | # interaction with --drbd-usermode-helper option
|
505 | 0c2cfb97 | Thomas Thrainer | drbd_usermode_helper = qa_config.get("drbd-usermode-helper", None) |
506 | 0c2cfb97 | Thomas Thrainer | if not drbd_usermode_helper: |
507 | 0c2cfb97 | Thomas Thrainer | drbd_usermode_helper = "/bin/true"
|
508 | 0c2cfb97 | Thomas Thrainer | # specifying a helper when drbd gets disabled is ok. Note that drbd still
|
509 | 0c2cfb97 | Thomas Thrainer | # has to be installed on the nodes in this case
|
510 | 0c2cfb97 | Thomas Thrainer | AssertCommand(["gnt-cluster", "modify", |
511 | 0c2cfb97 | Thomas Thrainer | "--drbd-usermode-helper=%s" % drbd_usermode_helper,
|
512 | 0c2cfb97 | Thomas Thrainer | "--enabled-disk-templates=%s" % constants.DT_DISKLESS],
|
513 | 0c2cfb97 | Thomas Thrainer | fail=False)
|
514 | 0c2cfb97 | Thomas Thrainer | # specifying a helper when drbd is re-enabled
|
515 | 912737ba | Helga Velroyen | AssertCommand(["gnt-cluster", "modify", |
516 | 912737ba | Helga Velroyen | "--drbd-usermode-helper=%s" % drbd_usermode_helper,
|
517 | 912737ba | Helga Velroyen | "--enabled-disk-templates=%s" %
|
518 | 912737ba | Helga Velroyen | ",".join(enabled_disk_templates)],
|
519 | 912737ba | Helga Velroyen | fail=False)
|
520 | 912737ba | Helga Velroyen | |
521 | 912737ba | Helga Velroyen | |
522 | 912737ba | Helga Velroyen | def _TestClusterModifyDiskTemplatesVgName(enabled_disk_templates): |
523 | 912737ba | Helga Velroyen | """Tests argument handling of 'gnt-cluster modify' with respect to
|
524 | 912737ba | Helga Velroyen | the parameter '--enabled-disk-templates' and '--vg-name'. This test is
|
525 | 912737ba | Helga Velroyen | independent of instances.
|
526 | 912737ba | Helga Velroyen |
|
527 | 912737ba | Helga Velroyen | """
|
528 | 912737ba | Helga Velroyen | if not utils.IsLvmEnabled(enabled_disk_templates): |
529 | 912737ba | Helga Velroyen | # These tests only make sense if lvm is enabled for QA
|
530 | 912737ba | Helga Velroyen | return
|
531 | 912737ba | Helga Velroyen | |
532 | 912737ba | Helga Velroyen | # determine an LVM and a non-LVM disk template for the tests
|
533 | 912737ba | Helga Velroyen | non_lvm_templates = list(set(enabled_disk_templates) |
534 | 912737ba | Helga Velroyen | - set(utils.GetLvmDiskTemplates()))
|
535 | 912737ba | Helga Velroyen | lvm_template = list(set(enabled_disk_templates) |
536 | 912737ba | Helga Velroyen | .intersection(set(utils.GetLvmDiskTemplates())))[0] |
537 | 912737ba | Helga Velroyen | non_lvm_template = None
|
538 | 912737ba | Helga Velroyen | if non_lvm_templates:
|
539 | 912737ba | Helga Velroyen | non_lvm_template = non_lvm_templates[0]
|
540 | 912737ba | Helga Velroyen | else:
|
541 | 912737ba | Helga Velroyen | # If no non-lvm disk template is available for QA, choose 'diskless' and
|
542 | 912737ba | Helga Velroyen | # hope for the best.
|
543 | 912737ba | Helga Velroyen | non_lvm_template = constants.ST_DISKLESS |
544 | 912737ba | Helga Velroyen | |
545 | 912737ba | Helga Velroyen | vgname = qa_config.get("vg-name", constants.DEFAULT_VG)
|
546 | 912737ba | Helga Velroyen | |
547 | 912737ba | Helga Velroyen | # Clean start: unset volume group name, disable lvm storage
|
548 | 912737ba | Helga Velroyen | AssertCommand( |
549 | 912737ba | Helga Velroyen | ["gnt-cluster", "modify", |
550 | 912737ba | Helga Velroyen | "--enabled-disk-templates=%s" % non_lvm_template,
|
551 | 912737ba | Helga Velroyen | "--vg-name="],
|
552 | 912737ba | Helga Velroyen | fail=False)
|
553 | 912737ba | Helga Velroyen | |
554 | 912737ba | Helga Velroyen | # Try to enable lvm, when no volume group is given
|
555 | 912737ba | Helga Velroyen | AssertCommand( |
556 | 912737ba | Helga Velroyen | ["gnt-cluster", "modify", |
557 | 912737ba | Helga Velroyen | "--enabled-disk-templates=%s" % lvm_template],
|
558 | 912737ba | Helga Velroyen | fail=True)
|
559 | 912737ba | Helga Velroyen | |
560 | 912737ba | Helga Velroyen | # Set volume group, with lvm still disabled: just a warning
|
561 | 912737ba | Helga Velroyen | AssertCommand(["gnt-cluster", "modify", "--vg-name=%s" % vgname], fail=False) |
562 | 912737ba | Helga Velroyen | |
563 | 912737ba | Helga Velroyen | # Try unsetting vg name and enabling lvm at the same time
|
564 | 912737ba | Helga Velroyen | AssertCommand( |
565 | 912737ba | Helga Velroyen | ["gnt-cluster", "modify", |
566 | 912737ba | Helga Velroyen | "--enabled-disk-templates=%s" % lvm_template,
|
567 | 912737ba | Helga Velroyen | "--vg-name="],
|
568 | 912737ba | Helga Velroyen | fail=True)
|
569 | 912737ba | Helga Velroyen | |
570 | 912737ba | Helga Velroyen | # Enable lvm with vg name present
|
571 | 912737ba | Helga Velroyen | AssertCommand( |
572 | 912737ba | Helga Velroyen | ["gnt-cluster", "modify", |
573 | 912737ba | Helga Velroyen | "--enabled-disk-templates=%s" % lvm_template],
|
574 | 912737ba | Helga Velroyen | fail=False)
|
575 | 912737ba | Helga Velroyen | |
576 | 912737ba | Helga Velroyen | # Try unsetting vg name with lvm still enabled
|
577 | 912737ba | Helga Velroyen | AssertCommand(["gnt-cluster", "modify", "--vg-name="], fail=True) |
578 | 912737ba | Helga Velroyen | |
579 | 912737ba | Helga Velroyen | # Disable lvm with vg name still set
|
580 | 912737ba | Helga Velroyen | AssertCommand( |
581 | 912737ba | Helga Velroyen | ["gnt-cluster", "modify", "--enabled-disk-templates=%s" % non_lvm_template], |
582 | 912737ba | Helga Velroyen | fail=False)
|
583 | 912737ba | Helga Velroyen | |
584 | 912737ba | Helga Velroyen | # Try unsetting vg name with lvm disabled
|
585 | 912737ba | Helga Velroyen | AssertCommand(["gnt-cluster", "modify", "--vg-name="], fail=False) |
586 | 912737ba | Helga Velroyen | |
587 | 912737ba | Helga Velroyen | # Set vg name and enable lvm at the same time
|
588 | 912737ba | Helga Velroyen | AssertCommand( |
589 | 912737ba | Helga Velroyen | ["gnt-cluster", "modify", |
590 | 912737ba | Helga Velroyen | "--enabled-disk-templates=%s" % lvm_template,
|
591 | 912737ba | Helga Velroyen | "--vg-name=%s" % vgname],
|
592 | 912737ba | Helga Velroyen | fail=False)
|
593 | 912737ba | Helga Velroyen | |
594 | 912737ba | Helga Velroyen | # Unset vg name and disable lvm at the same time
|
595 | 912737ba | Helga Velroyen | AssertCommand( |
596 | 912737ba | Helga Velroyen | ["gnt-cluster", "modify", |
597 | 912737ba | Helga Velroyen | "--enabled-disk-templates=%s" % non_lvm_template,
|
598 | 912737ba | Helga Velroyen | "--vg-name="],
|
599 | 912737ba | Helga Velroyen | fail=False)
|
600 | 912737ba | Helga Velroyen | |
601 | 912737ba | Helga Velroyen | _RestoreEnabledDiskTemplates() |
602 | 912737ba | Helga Velroyen | |
603 | 462f0faa | Helga Velroyen | |
604 | 462f0faa | Helga Velroyen | def _TestClusterModifyUsedDiskTemplate(instance_template, |
605 | 462f0faa | Helga Velroyen | enabled_disk_templates): |
606 | 462f0faa | Helga Velroyen | """Tests that disk templates that are currently in use by instances cannot
|
607 | 462f0faa | Helga Velroyen | be disabled on the cluster.
|
608 | 462f0faa | Helga Velroyen |
|
609 | 462f0faa | Helga Velroyen | """
|
610 | 462f0faa | Helga Velroyen | # If the list of enabled disk templates contains only one template
|
611 | 462f0faa | Helga Velroyen | # we need to add some other templates, because the list of enabled disk
|
612 | 462f0faa | Helga Velroyen | # templates can only be set to a non-empty list.
|
613 | 462f0faa | Helga Velroyen | new_disk_templates = list(set(enabled_disk_templates) |
614 | 462f0faa | Helga Velroyen | - set([instance_template]))
|
615 | 462f0faa | Helga Velroyen | if not new_disk_templates: |
616 | d101b7be | Thomas Thrainer | new_disk_templates = list(set([constants.DT_DISKLESS, constants.DT_BLOCK]) |
617 | 462f0faa | Helga Velroyen | - set([instance_template]))
|
618 | 462f0faa | Helga Velroyen | AssertCommand( |
619 | 462f0faa | Helga Velroyen | ["gnt-cluster", "modify", |
620 | 462f0faa | Helga Velroyen | "--enabled-disk-templates=%s" %
|
621 | 462f0faa | Helga Velroyen | ",".join(new_disk_templates)],
|
622 | 462f0faa | Helga Velroyen | fail=True)
|
623 | 462f0faa | Helga Velroyen | |
624 | 462f0faa | Helga Velroyen | |
625 | 462f0faa | Helga Velroyen | def _TestClusterModifyUnusedDiskTemplate(instance_template): |
626 | 462f0faa | Helga Velroyen | """Tests that unused disk templates can be disabled safely."""
|
627 | 462f0faa | Helga Velroyen | all_disk_templates = constants.DISK_TEMPLATES |
628 | d101b7be | Thomas Thrainer | if not utils.IsLvmEnabled(qa_config.GetEnabledDiskTemplates()): |
629 | d101b7be | Thomas Thrainer | all_disk_templates = list(set(all_disk_templates) - |
630 | d101b7be | Thomas Thrainer | set(utils.GetLvmDiskTemplates()))
|
631 | d101b7be | Thomas Thrainer | |
632 | 462f0faa | Helga Velroyen | AssertCommand( |
633 | 462f0faa | Helga Velroyen | ["gnt-cluster", "modify", |
634 | 462f0faa | Helga Velroyen | "--enabled-disk-templates=%s" %
|
635 | 462f0faa | Helga Velroyen | ",".join(all_disk_templates)],
|
636 | 462f0faa | Helga Velroyen | fail=False)
|
637 | 462f0faa | Helga Velroyen | new_disk_templates = [instance_template] |
638 | 462f0faa | Helga Velroyen | AssertCommand( |
639 | 462f0faa | Helga Velroyen | ["gnt-cluster", "modify", |
640 | 462f0faa | Helga Velroyen | "--enabled-disk-templates=%s" %
|
641 | 462f0faa | Helga Velroyen | ",".join(new_disk_templates)],
|
642 | 462f0faa | Helga Velroyen | fail=False)
|
643 | dacd8ba4 | Helga Velroyen | |
644 | dacd8ba4 | Helga Velroyen | |
645 | 9738ca94 | Iustin Pop | def TestClusterModifyBe(): |
646 | 9738ca94 | Iustin Pop | """gnt-cluster modify -B"""
|
647 | 2f4b4f78 | Iustin Pop | for fail, cmd in [ |
648 | 8ccbbe4b | Guido Trotter | # max/min mem
|
649 | 8ccbbe4b | Guido Trotter | (False, ["gnt-cluster", "modify", "-B", "maxmem=256"]), |
650 | 8ccbbe4b | Guido Trotter | (False, ["sh", "-c", "gnt-cluster info|grep '^ *maxmem: 256$'"]), |
651 | 8ccbbe4b | Guido Trotter | (False, ["gnt-cluster", "modify", "-B", "minmem=256"]), |
652 | 8ccbbe4b | Guido Trotter | (False, ["sh", "-c", "gnt-cluster info|grep '^ *minmem: 256$'"]), |
653 | 8ccbbe4b | Guido Trotter | (True, ["gnt-cluster", "modify", "-B", "maxmem=a"]), |
654 | 8ccbbe4b | Guido Trotter | (False, ["sh", "-c", "gnt-cluster info|grep '^ *maxmem: 256$'"]), |
655 | 8ccbbe4b | Guido Trotter | (True, ["gnt-cluster", "modify", "-B", "minmem=a"]), |
656 | 8ccbbe4b | Guido Trotter | (False, ["sh", "-c", "gnt-cluster info|grep '^ *minmem: 256$'"]), |
657 | 8ccbbe4b | Guido Trotter | (False, ["gnt-cluster", "modify", "-B", "maxmem=128,minmem=128"]), |
658 | 8ccbbe4b | Guido Trotter | (False, ["sh", "-c", "gnt-cluster info|grep '^ *maxmem: 128$'"]), |
659 | 8ccbbe4b | Guido Trotter | (False, ["sh", "-c", "gnt-cluster info|grep '^ *minmem: 128$'"]), |
660 | 9738ca94 | Iustin Pop | # vcpus
|
661 | 2f4b4f78 | Iustin Pop | (False, ["gnt-cluster", "modify", "-B", "vcpus=4"]), |
662 | 2f4b4f78 | Iustin Pop | (False, ["sh", "-c", "gnt-cluster info|grep '^ *vcpus: 4$'"]), |
663 | 21bf2e2e | Andrea Spadaccini | (True, ["gnt-cluster", "modify", "-B", "vcpus=a"]), |
664 | 2f4b4f78 | Iustin Pop | (False, ["gnt-cluster", "modify", "-B", "vcpus=1"]), |
665 | 2f4b4f78 | Iustin Pop | (False, ["sh", "-c", "gnt-cluster info|grep '^ *vcpus: 1$'"]), |
666 | 9738ca94 | Iustin Pop | # auto_balance
|
667 | 2f4b4f78 | Iustin Pop | (False, ["gnt-cluster", "modify", "-B", "auto_balance=False"]), |
668 | 2f4b4f78 | Iustin Pop | (False, ["sh", "-c", "gnt-cluster info|grep '^ *auto_balance: False$'"]), |
669 | 21bf2e2e | Andrea Spadaccini | (True, ["gnt-cluster", "modify", "-B", "auto_balance=1"]), |
670 | 2f4b4f78 | Iustin Pop | (False, ["gnt-cluster", "modify", "-B", "auto_balance=True"]), |
671 | 2f4b4f78 | Iustin Pop | (False, ["sh", "-c", "gnt-cluster info|grep '^ *auto_balance: True$'"]), |
672 | 9738ca94 | Iustin Pop | ]: |
673 | 2f4b4f78 | Iustin Pop | AssertCommand(cmd, fail=fail) |
674 | 9738ca94 | Iustin Pop | |
675 | 5abecc1c | Iustin Pop | # redo the original-requested BE parameters, if any
|
676 | 5abecc1c | Iustin Pop | bep = qa_config.get("backend-parameters", "") |
677 | 5abecc1c | Iustin Pop | if bep:
|
678 | 5abecc1c | Iustin Pop | AssertCommand(["gnt-cluster", "modify", "-B", bep]) |
679 | 9738ca94 | Iustin Pop | |
680 | 21bf2e2e | Andrea Spadaccini | |
681 | b3f3aa3d | Bernardo Dal Seno | def _GetClusterIPolicy(): |
682 | b3f3aa3d | Bernardo Dal Seno | """Return the run-time values of the cluster-level instance policy.
|
683 | b3f3aa3d | Bernardo Dal Seno |
|
684 | b3f3aa3d | Bernardo Dal Seno | @rtype: tuple
|
685 | b3f3aa3d | Bernardo Dal Seno | @return: (policy, specs), where:
|
686 | b3f3aa3d | Bernardo Dal Seno | - policy is a dictionary of the policy values, instance specs excluded
|
687 | 7c8ae421 | Bernardo Dal Seno | - specs is a dictionary containing only the specs, using the internal
|
688 | 7c8ae421 | Bernardo Dal Seno | format (see L{constants.IPOLICY_DEFAULTS} for an example)
|
689 | b3f3aa3d | Bernardo Dal Seno |
|
690 | b3f3aa3d | Bernardo Dal Seno | """
|
691 | 0e79564a | Bernardo Dal Seno | info = qa_utils.GetObjectInfo(["gnt-cluster", "info"]) |
692 | 0e79564a | Bernardo Dal Seno | policy = info["Instance policy - limits for instances"]
|
693 | 63e08b25 | Bernardo Dal Seno | (ret_policy, ret_specs) = qa_utils.ParseIPolicy(policy) |
694 | 0e79564a | Bernardo Dal Seno | |
695 | b3f3aa3d | Bernardo Dal Seno | # Sanity checks
|
696 | 7c8ae421 | Bernardo Dal Seno | assert "minmax" in ret_specs and "std" in ret_specs |
697 | 7c8ae421 | Bernardo Dal Seno | assert len(ret_specs["minmax"]) > 0 |
698 | 0e79564a | Bernardo Dal Seno | assert len(ret_policy) > 0 |
699 | 0e79564a | Bernardo Dal Seno | return (ret_policy, ret_specs)
|
700 | b3f3aa3d | Bernardo Dal Seno | |
701 | b3f3aa3d | Bernardo Dal Seno | |
702 | b3f3aa3d | Bernardo Dal Seno | def TestClusterModifyIPolicy(): |
703 | b3f3aa3d | Bernardo Dal Seno | """gnt-cluster modify --ipolicy-*"""
|
704 | b3f3aa3d | Bernardo Dal Seno | basecmd = ["gnt-cluster", "modify"] |
705 | b3f3aa3d | Bernardo Dal Seno | (old_policy, old_specs) = _GetClusterIPolicy() |
706 | b3f3aa3d | Bernardo Dal Seno | for par in ["vcpu-ratio", "spindle-ratio"]: |
707 | b3f3aa3d | Bernardo Dal Seno | curr_val = float(old_policy[par])
|
708 | b3f3aa3d | Bernardo Dal Seno | test_values = [ |
709 | b3f3aa3d | Bernardo Dal Seno | (True, 1.0), |
710 | b3f3aa3d | Bernardo Dal Seno | (True, 1.5), |
711 | b3f3aa3d | Bernardo Dal Seno | (True, 2), |
712 | b3f3aa3d | Bernardo Dal Seno | (False, "a"), |
713 | b3f3aa3d | Bernardo Dal Seno | # Restore the old value
|
714 | b3f3aa3d | Bernardo Dal Seno | (True, curr_val),
|
715 | b3f3aa3d | Bernardo Dal Seno | ] |
716 | b3f3aa3d | Bernardo Dal Seno | for (good, val) in test_values: |
717 | b3f3aa3d | Bernardo Dal Seno | cmd = basecmd + ["--ipolicy-%s=%s" % (par, val)]
|
718 | b3f3aa3d | Bernardo Dal Seno | AssertCommand(cmd, fail=not good)
|
719 | b3f3aa3d | Bernardo Dal Seno | if good:
|
720 | b3f3aa3d | Bernardo Dal Seno | curr_val = val |
721 | b3f3aa3d | Bernardo Dal Seno | # Check the affected parameter
|
722 | b3f3aa3d | Bernardo Dal Seno | (eff_policy, eff_specs) = _GetClusterIPolicy() |
723 | b3f3aa3d | Bernardo Dal Seno | AssertEqual(float(eff_policy[par]), curr_val)
|
724 | b3f3aa3d | Bernardo Dal Seno | # Check everything else
|
725 | b3f3aa3d | Bernardo Dal Seno | AssertEqual(eff_specs, old_specs) |
726 | b3f3aa3d | Bernardo Dal Seno | for p in eff_policy.keys(): |
727 | b3f3aa3d | Bernardo Dal Seno | if p == par:
|
728 | b3f3aa3d | Bernardo Dal Seno | continue
|
729 | b3f3aa3d | Bernardo Dal Seno | AssertEqual(eff_policy[p], old_policy[p]) |
730 | b3f3aa3d | Bernardo Dal Seno | |
731 | b3f3aa3d | Bernardo Dal Seno | # Disk templates are treated slightly differently
|
732 | b3f3aa3d | Bernardo Dal Seno | par = "disk-templates"
|
733 | 9db0b351 | Bernardo Dal Seno | disp_str = "allowed disk templates"
|
734 | b3f3aa3d | Bernardo Dal Seno | curr_val = old_policy[disp_str] |
735 | b3f3aa3d | Bernardo Dal Seno | test_values = [ |
736 | b3f3aa3d | Bernardo Dal Seno | (True, constants.DT_PLAIN),
|
737 | b3f3aa3d | Bernardo Dal Seno | (True, "%s,%s" % (constants.DT_PLAIN, constants.DT_DRBD8)), |
738 | b3f3aa3d | Bernardo Dal Seno | (False, "thisisnotadisktemplate"), |
739 | b3f3aa3d | Bernardo Dal Seno | (False, ""), |
740 | b3f3aa3d | Bernardo Dal Seno | # Restore the old value
|
741 | b3f3aa3d | Bernardo Dal Seno | (True, curr_val.replace(" ", "")), |
742 | b3f3aa3d | Bernardo Dal Seno | ] |
743 | b3f3aa3d | Bernardo Dal Seno | for (good, val) in test_values: |
744 | b3f3aa3d | Bernardo Dal Seno | cmd = basecmd + ["--ipolicy-%s=%s" % (par, val)]
|
745 | b3f3aa3d | Bernardo Dal Seno | AssertCommand(cmd, fail=not good)
|
746 | b3f3aa3d | Bernardo Dal Seno | if good:
|
747 | b3f3aa3d | Bernardo Dal Seno | curr_val = val |
748 | b3f3aa3d | Bernardo Dal Seno | # Check the affected parameter
|
749 | b3f3aa3d | Bernardo Dal Seno | (eff_policy, eff_specs) = _GetClusterIPolicy() |
750 | b3f3aa3d | Bernardo Dal Seno | AssertEqual(eff_policy[disp_str].replace(" ", ""), curr_val) |
751 | b3f3aa3d | Bernardo Dal Seno | # Check everything else
|
752 | b3f3aa3d | Bernardo Dal Seno | AssertEqual(eff_specs, old_specs) |
753 | b3f3aa3d | Bernardo Dal Seno | for p in eff_policy.keys(): |
754 | b3f3aa3d | Bernardo Dal Seno | if p == disp_str:
|
755 | b3f3aa3d | Bernardo Dal Seno | continue
|
756 | b3f3aa3d | Bernardo Dal Seno | AssertEqual(eff_policy[p], old_policy[p]) |
757 | b3f3aa3d | Bernardo Dal Seno | |
758 | b3f3aa3d | Bernardo Dal Seno | |
759 | ec996117 | Bernardo Dal Seno | def TestClusterSetISpecs(new_specs=None, diff_specs=None, fail=False, |
760 | ec996117 | Bernardo Dal Seno | old_values=None):
|
761 | b3f3aa3d | Bernardo Dal Seno | """Change instance specs.
|
762 | b3f3aa3d | Bernardo Dal Seno |
|
763 | ec996117 | Bernardo Dal Seno | At most one of new_specs or diff_specs can be specified.
|
764 | ec996117 | Bernardo Dal Seno |
|
765 | ec996117 | Bernardo Dal Seno | @type new_specs: dict
|
766 | ec996117 | Bernardo Dal Seno | @param new_specs: new complete specs, in the same format returned by
|
767 | ec996117 | Bernardo Dal Seno | L{_GetClusterIPolicy}
|
768 | ec996117 | Bernardo Dal Seno | @type diff_specs: dict
|
769 | 7c8ae421 | Bernardo Dal Seno | @param diff_specs: partial specs, it can be an incomplete specifications, but
|
770 | 7c8ae421 | Bernardo Dal Seno | if min/max specs are specified, their number must match the number of the
|
771 | 7c8ae421 | Bernardo Dal Seno | existing specs
|
772 | b3f3aa3d | Bernardo Dal Seno | @type fail: bool
|
773 | b3f3aa3d | Bernardo Dal Seno | @param fail: if the change is expected to fail
|
774 | b3f3aa3d | Bernardo Dal Seno | @type old_values: tuple
|
775 | b3f3aa3d | Bernardo Dal Seno | @param old_values: (old_policy, old_specs), as returned by
|
776 | ec996117 | Bernardo Dal Seno | L{_GetClusterIPolicy}
|
777 | b3f3aa3d | Bernardo Dal Seno | @return: same as L{_GetClusterIPolicy}
|
778 | b3f3aa3d | Bernardo Dal Seno |
|
779 | b3f3aa3d | Bernardo Dal Seno | """
|
780 | 63e08b25 | Bernardo Dal Seno | build_cmd = lambda opts: ["gnt-cluster", "modify"] + opts |
781 | ec996117 | Bernardo Dal Seno | return qa_utils.TestSetISpecs(
|
782 | ec996117 | Bernardo Dal Seno | new_specs=new_specs, diff_specs=diff_specs, |
783 | ec996117 | Bernardo Dal Seno | get_policy_fn=_GetClusterIPolicy, build_cmd_fn=build_cmd, |
784 | ec996117 | Bernardo Dal Seno | fail=fail, old_values=old_values) |
785 | b3f3aa3d | Bernardo Dal Seno | |
786 | b3f3aa3d | Bernardo Dal Seno | |
787 | b3f3aa3d | Bernardo Dal Seno | def TestClusterModifyISpecs(): |
788 | b3f3aa3d | Bernardo Dal Seno | """gnt-cluster modify --specs-*"""
|
789 | cb178a1e | Bernardo Dal Seno | params = ["memory-size", "disk-size", "disk-count", "cpu-count", "nic-count"] |
790 | b3f3aa3d | Bernardo Dal Seno | (cur_policy, cur_specs) = _GetClusterIPolicy() |
791 | 7c8ae421 | Bernardo Dal Seno | # This test assumes that there is only one min/max bound
|
792 | 7c8ae421 | Bernardo Dal Seno | assert len(cur_specs[constants.ISPECS_MINMAX]) == 1 |
793 | b3f3aa3d | Bernardo Dal Seno | for par in params: |
794 | b3f3aa3d | Bernardo Dal Seno | test_values = [ |
795 | b3f3aa3d | Bernardo Dal Seno | (True, 0, 4, 12), |
796 | b3f3aa3d | Bernardo Dal Seno | (True, 4, 4, 12), |
797 | b3f3aa3d | Bernardo Dal Seno | (True, 4, 12, 12), |
798 | b3f3aa3d | Bernardo Dal Seno | (True, 4, 4, 4), |
799 | b3f3aa3d | Bernardo Dal Seno | (False, 4, 0, 12), |
800 | b3f3aa3d | Bernardo Dal Seno | (False, 4, 16, 12), |
801 | b3f3aa3d | Bernardo Dal Seno | (False, 4, 4, 0), |
802 | b3f3aa3d | Bernardo Dal Seno | (False, 12, 4, 4), |
803 | b3f3aa3d | Bernardo Dal Seno | (False, 12, 4, 0), |
804 | b3f3aa3d | Bernardo Dal Seno | (False, "a", 4, 12), |
805 | b3f3aa3d | Bernardo Dal Seno | (False, 0, "a", 12), |
806 | b3f3aa3d | Bernardo Dal Seno | (False, 0, 4, "a"), |
807 | b3f3aa3d | Bernardo Dal Seno | # This is to restore the old values
|
808 | b3f3aa3d | Bernardo Dal Seno | (True,
|
809 | 7c8ae421 | Bernardo Dal Seno | cur_specs[constants.ISPECS_MINMAX][0][constants.ISPECS_MIN][par],
|
810 | 7c8ae421 | Bernardo Dal Seno | cur_specs[constants.ISPECS_STD][par], |
811 | 7c8ae421 | Bernardo Dal Seno | cur_specs[constants.ISPECS_MINMAX][0][constants.ISPECS_MAX][par])
|
812 | b3f3aa3d | Bernardo Dal Seno | ] |
813 | b3f3aa3d | Bernardo Dal Seno | for (good, mn, st, mx) in test_values: |
814 | ec996117 | Bernardo Dal Seno | new_vals = { |
815 | 7c8ae421 | Bernardo Dal Seno | constants.ISPECS_MINMAX: [{ |
816 | 7c8ae421 | Bernardo Dal Seno | constants.ISPECS_MIN: {par: mn}, |
817 | 7c8ae421 | Bernardo Dal Seno | constants.ISPECS_MAX: {par: mx} |
818 | 7c8ae421 | Bernardo Dal Seno | }], |
819 | 7c8ae421 | Bernardo Dal Seno | constants.ISPECS_STD: {par: st} |
820 | ec996117 | Bernardo Dal Seno | } |
821 | b3f3aa3d | Bernardo Dal Seno | cur_state = (cur_policy, cur_specs) |
822 | b3f3aa3d | Bernardo Dal Seno | # We update cur_specs, as we've copied the values to restore already
|
823 | ec996117 | Bernardo Dal Seno | (cur_policy, cur_specs) = TestClusterSetISpecs( |
824 | ec996117 | Bernardo Dal Seno | diff_specs=new_vals, fail=not good, old_values=cur_state)
|
825 | b3f3aa3d | Bernardo Dal Seno | |
826 | b5a93c73 | Bernardo Dal Seno | # Get the ipolicy command
|
827 | b5a93c73 | Bernardo Dal Seno | mnode = qa_config.GetMasterNode() |
828 | b5a93c73 | Bernardo Dal Seno | initcmd = GetCommandOutput(mnode.primary, "gnt-cluster show-ispecs-cmd")
|
829 | b5a93c73 | Bernardo Dal Seno | modcmd = ["gnt-cluster", "modify"] |
830 | b5a93c73 | Bernardo Dal Seno | opts = initcmd.split() |
831 | b5a93c73 | Bernardo Dal Seno | assert opts[0:2] == ["gnt-cluster", "init"] |
832 | b5a93c73 | Bernardo Dal Seno | for k in range(2, len(opts) - 1): |
833 | b5a93c73 | Bernardo Dal Seno | if opts[k].startswith("--ipolicy-"): |
834 | b5a93c73 | Bernardo Dal Seno | assert k + 2 <= len(opts) |
835 | b5a93c73 | Bernardo Dal Seno | modcmd.extend(opts[k:k + 2])
|
836 | b5a93c73 | Bernardo Dal Seno | # Re-apply the ipolicy (this should be a no-op)
|
837 | b5a93c73 | Bernardo Dal Seno | AssertCommand(modcmd) |
838 | b5a93c73 | Bernardo Dal Seno | new_initcmd = GetCommandOutput(mnode.primary, "gnt-cluster show-ispecs-cmd")
|
839 | b5a93c73 | Bernardo Dal Seno | AssertEqual(initcmd, new_initcmd) |
840 | b3f3aa3d | Bernardo Dal Seno | |
841 | b3f3aa3d | Bernardo Dal Seno | |
842 | cec9845c | Michael Hanselmann | def TestClusterInfo(): |
843 | cec9845c | Michael Hanselmann | """gnt-cluster info"""
|
844 | 2f4b4f78 | Iustin Pop | AssertCommand(["gnt-cluster", "info"]) |
845 | 283f9d4c | Michael Hanselmann | |
846 | 283f9d4c | Michael Hanselmann | |
847 | 3e8b5a9c | Iustin Pop | def TestClusterRedistConf(): |
848 | 3e8b5a9c | Iustin Pop | """gnt-cluster redist-conf"""
|
849 | 3e8b5a9c | Iustin Pop | AssertCommand(["gnt-cluster", "redist-conf"]) |
850 | 3e8b5a9c | Iustin Pop | |
851 | 3e8b5a9c | Iustin Pop | |
852 | 283f9d4c | Michael Hanselmann | def TestClusterGetmaster(): |
853 | 283f9d4c | Michael Hanselmann | """gnt-cluster getmaster"""
|
854 | 2f4b4f78 | Iustin Pop | AssertCommand(["gnt-cluster", "getmaster"]) |
855 | 283f9d4c | Michael Hanselmann | |
856 | 283f9d4c | Michael Hanselmann | |
857 | 283f9d4c | Michael Hanselmann | def TestClusterVersion(): |
858 | 283f9d4c | Michael Hanselmann | """gnt-cluster version"""
|
859 | 2f4b4f78 | Iustin Pop | AssertCommand(["gnt-cluster", "version"]) |
860 | cec9845c | Michael Hanselmann | |
861 | cec9845c | Michael Hanselmann | |
862 | 6d4a1656 | Michael Hanselmann | def TestClusterRenewCrypto(): |
863 | 6d4a1656 | Michael Hanselmann | """gnt-cluster renew-crypto"""
|
864 | 6d4a1656 | Michael Hanselmann | master = qa_config.GetMasterNode() |
865 | 6d4a1656 | Michael Hanselmann | |
866 | 6d4a1656 | Michael Hanselmann | # Conflicting options
|
867 | 6d4a1656 | Michael Hanselmann | cmd = ["gnt-cluster", "renew-crypto", "--force", |
868 | 3db3eb2a | Michael Hanselmann | "--new-cluster-certificate", "--new-confd-hmac-key"] |
869 | 3db3eb2a | Michael Hanselmann | conflicting = [ |
870 | 3db3eb2a | Michael Hanselmann | ["--new-rapi-certificate", "--rapi-certificate=/dev/null"], |
871 | 3db3eb2a | Michael Hanselmann | ["--new-cluster-domain-secret", "--cluster-domain-secret=/dev/null"], |
872 | 3db3eb2a | Michael Hanselmann | ] |
873 | 3db3eb2a | Michael Hanselmann | for i in conflicting: |
874 | 21bf2e2e | Andrea Spadaccini | AssertCommand(cmd + i, fail=True)
|
875 | 6d4a1656 | Michael Hanselmann | |
876 | 6d4a1656 | Michael Hanselmann | # Invalid RAPI certificate
|
877 | 6d4a1656 | Michael Hanselmann | cmd = ["gnt-cluster", "renew-crypto", "--force", |
878 | 6d4a1656 | Michael Hanselmann | "--rapi-certificate=/dev/null"]
|
879 | 2f4b4f78 | Iustin Pop | AssertCommand(cmd, fail=True)
|
880 | 6d4a1656 | Michael Hanselmann | |
881 | aecba21e | Michael Hanselmann | rapi_cert_backup = qa_utils.BackupFile(master.primary, |
882 | 304d9f02 | Michael Hanselmann | pathutils.RAPI_CERT_FILE) |
883 | 502f5236 | Michael Hanselmann | try:
|
884 | 502f5236 | Michael Hanselmann | # Custom RAPI certificate
|
885 | 502f5236 | Michael Hanselmann | fh = tempfile.NamedTemporaryFile() |
886 | 6d4a1656 | Michael Hanselmann | |
887 | 502f5236 | Michael Hanselmann | # Ensure certificate doesn't cause "gnt-cluster verify" to complain
|
888 | 502f5236 | Michael Hanselmann | validity = constants.SSL_CERT_EXPIRATION_WARN * 3
|
889 | 6d4a1656 | Michael Hanselmann | |
890 | 5e26633b | Michael Hanselmann | utils.GenerateSelfSignedSslCert(fh.name, validity=validity) |
891 | 6d4a1656 | Michael Hanselmann | |
892 | aecba21e | Michael Hanselmann | tmpcert = qa_utils.UploadFile(master.primary, fh.name) |
893 | 502f5236 | Michael Hanselmann | try:
|
894 | 2f4b4f78 | Iustin Pop | AssertCommand(["gnt-cluster", "renew-crypto", "--force", |
895 | 2f4b4f78 | Iustin Pop | "--rapi-certificate=%s" % tmpcert])
|
896 | 502f5236 | Michael Hanselmann | finally:
|
897 | 2f4b4f78 | Iustin Pop | AssertCommand(["rm", "-f", tmpcert]) |
898 | 502f5236 | Michael Hanselmann | |
899 | 5e26633b | Michael Hanselmann | # Custom cluster domain secret
|
900 | 5e26633b | Michael Hanselmann | cds_fh = tempfile.NamedTemporaryFile() |
901 | 5e26633b | Michael Hanselmann | cds_fh.write(utils.GenerateSecret()) |
902 | 5e26633b | Michael Hanselmann | cds_fh.write("\n")
|
903 | 5e26633b | Michael Hanselmann | cds_fh.flush() |
904 | 5e26633b | Michael Hanselmann | |
905 | aecba21e | Michael Hanselmann | tmpcds = qa_utils.UploadFile(master.primary, cds_fh.name) |
906 | 5e26633b | Michael Hanselmann | try:
|
907 | 2f4b4f78 | Iustin Pop | AssertCommand(["gnt-cluster", "renew-crypto", "--force", |
908 | 2f4b4f78 | Iustin Pop | "--cluster-domain-secret=%s" % tmpcds])
|
909 | 5e26633b | Michael Hanselmann | finally:
|
910 | 2f4b4f78 | Iustin Pop | AssertCommand(["rm", "-f", tmpcds]) |
911 | 5e26633b | Michael Hanselmann | |
912 | 502f5236 | Michael Hanselmann | # Normal case
|
913 | 2f4b4f78 | Iustin Pop | AssertCommand(["gnt-cluster", "renew-crypto", "--force", |
914 | 2f4b4f78 | Iustin Pop | "--new-cluster-certificate", "--new-confd-hmac-key", |
915 | 2f4b4f78 | Iustin Pop | "--new-rapi-certificate", "--new-cluster-domain-secret"]) |
916 | 3db3eb2a | Michael Hanselmann | |
917 | 502f5236 | Michael Hanselmann | # Restore RAPI certificate
|
918 | 2f4b4f78 | Iustin Pop | AssertCommand(["gnt-cluster", "renew-crypto", "--force", |
919 | 2f4b4f78 | Iustin Pop | "--rapi-certificate=%s" % rapi_cert_backup])
|
920 | 3db3eb2a | Michael Hanselmann | finally:
|
921 | 2f4b4f78 | Iustin Pop | AssertCommand(["rm", "-f", rapi_cert_backup]) |
922 | 3db3eb2a | Michael Hanselmann | |
923 | 6d4a1656 | Michael Hanselmann | |
924 | cec9845c | Michael Hanselmann | def TestClusterBurnin(): |
925 | cec9845c | Michael Hanselmann | """Burnin"""
|
926 | cec9845c | Michael Hanselmann | master = qa_config.GetMasterNode() |
927 | cec9845c | Michael Hanselmann | |
928 | d0c8c01d | Iustin Pop | options = qa_config.get("options", {})
|
929 | 68c8c3df | Michael Hanselmann | disk_template = options.get("burnin-disk-template", constants.DT_DRBD8)
|
930 | d0c8c01d | Iustin Pop | parallel = options.get("burnin-in-parallel", False) |
931 | d0c8c01d | Iustin Pop | check_inst = options.get("burnin-check-instances", False) |
932 | d0c8c01d | Iustin Pop | do_rename = options.get("burnin-rename", "") |
933 | d0c8c01d | Iustin Pop | do_reboot = options.get("burnin-reboot", True) |
934 | 1d103c02 | Iustin Pop | reboot_types = options.get("reboot-types", constants.REBOOT_TYPES)
|
935 | 23103544 | Michael Hanselmann | |
936 | cec9845c | Michael Hanselmann | # Get as many instances as we need
|
937 | cec9845c | Michael Hanselmann | instances = [] |
938 | cec9845c | Michael Hanselmann | try:
|
939 | 23103544 | Michael Hanselmann | try:
|
940 | d0c8c01d | Iustin Pop | num = qa_config.get("options", {}).get("burnin-instances", 1) |
941 | f1501b3f | Michael Hanselmann | for _ in range(0, num): |
942 | 23103544 | Michael Hanselmann | instances.append(qa_config.AcquireInstance()) |
943 | 23103544 | Michael Hanselmann | except qa_error.OutOfInstancesError:
|
944 | 23103544 | Michael Hanselmann | print "Not enough instances, continuing anyway." |
945 | cec9845c | Michael Hanselmann | |
946 | 23103544 | Michael Hanselmann | if len(instances) < 1: |
947 | 23103544 | Michael Hanselmann | raise qa_error.Error("Burnin needs at least one instance") |
948 | cec9845c | Michael Hanselmann | |
949 | aecba21e | Michael Hanselmann | script = qa_utils.UploadFile(master.primary, "../tools/burnin")
|
950 | cec9845c | Michael Hanselmann | try:
|
951 | 090128b6 | Christos Stavrakakis | disks = qa_config.GetDiskOptions() |
952 | 23103544 | Michael Hanselmann | # Run burnin
|
953 | cec9845c | Michael Hanselmann | cmd = [script, |
954 | d0c8c01d | Iustin Pop | "--os=%s" % qa_config.get("os"), |
955 | f356202a | Guido Trotter | "--minmem-size=%s" % qa_config.get(constants.BE_MINMEM),
|
956 | f356202a | Guido Trotter | "--maxmem-size=%s" % qa_config.get(constants.BE_MAXMEM),
|
957 | 090128b6 | Christos Stavrakakis | "--disk-size=%s" % ",".join([d.get("size") for d in disks]), |
958 | 090128b6 | Christos Stavrakakis | "--disk-growth=%s" % ",".join([d.get("growth") for d in disks]), |
959 | d0c8c01d | Iustin Pop | "--disk-template=%s" % disk_template]
|
960 | 0b0a150a | Iustin Pop | if parallel:
|
961 | d0c8c01d | Iustin Pop | cmd.append("--parallel")
|
962 | d0c8c01d | Iustin Pop | cmd.append("--early-release")
|
963 | 0b0a150a | Iustin Pop | if check_inst:
|
964 | d0c8c01d | Iustin Pop | cmd.append("--http-check")
|
965 | 4dc76b24 | Iustin Pop | if do_rename:
|
966 | d0c8c01d | Iustin Pop | cmd.append("--rename=%s" % do_rename)
|
967 | 58598264 | Iustin Pop | if not do_reboot: |
968 | d0c8c01d | Iustin Pop | cmd.append("--no-reboot")
|
969 | 1d103c02 | Iustin Pop | else:
|
970 | d0c8c01d | Iustin Pop | cmd.append("--reboot-types=%s" % ",".join(reboot_types)) |
971 | b5f33afa | Michael Hanselmann | cmd += [inst.name for inst in instances] |
972 | 2f4b4f78 | Iustin Pop | AssertCommand(cmd) |
973 | cec9845c | Michael Hanselmann | finally:
|
974 | 2f4b4f78 | Iustin Pop | AssertCommand(["rm", "-f", script]) |
975 | 2f4b4f78 | Iustin Pop | |
976 | cec9845c | Michael Hanselmann | finally:
|
977 | cec9845c | Michael Hanselmann | for inst in instances: |
978 | 6f88e076 | Michael Hanselmann | inst.Release() |
979 | cec9845c | Michael Hanselmann | |
980 | cec9845c | Michael Hanselmann | |
981 | cec9845c | Michael Hanselmann | def TestClusterMasterFailover(): |
982 | c28502b1 | Iustin Pop | """gnt-cluster master-failover"""
|
983 | cec9845c | Michael Hanselmann | master = qa_config.GetMasterNode() |
984 | cec9845c | Michael Hanselmann | failovermaster = qa_config.AcquireNode(exclude=master) |
985 | cec9845c | Michael Hanselmann | |
986 | 2f4b4f78 | Iustin Pop | cmd = ["gnt-cluster", "master-failover"] |
987 | 2f4b4f78 | Iustin Pop | try:
|
988 | 2f4b4f78 | Iustin Pop | AssertCommand(cmd, node=failovermaster) |
989 | ff699aa9 | Michael Hanselmann | # Back to original master node
|
990 | 2f4b4f78 | Iustin Pop | AssertCommand(cmd, node=master) |
991 | cec9845c | Michael Hanselmann | finally:
|
992 | 565cb4bf | Michael Hanselmann | failovermaster.Release() |
993 | cec9845c | Michael Hanselmann | |
994 | cec9845c | Michael Hanselmann | |
995 | 2df92990 | Michael Hanselmann | def _NodeQueueDrainFile(node): |
996 | 2df92990 | Michael Hanselmann | """Returns path to queue drain file for a node.
|
997 | 2df92990 | Michael Hanselmann |
|
998 | 2df92990 | Michael Hanselmann | """
|
999 | 2df92990 | Michael Hanselmann | return qa_utils.MakeNodePath(node, pathutils.JOB_QUEUE_DRAIN_FILE)
|
1000 | 2df92990 | Michael Hanselmann | |
1001 | 2df92990 | Michael Hanselmann | |
1002 | 2df92990 | Michael Hanselmann | def _AssertDrainFile(node, **kwargs): |
1003 | 2df92990 | Michael Hanselmann | """Checks for the queue drain file.
|
1004 | 2df92990 | Michael Hanselmann |
|
1005 | 2df92990 | Michael Hanselmann | """
|
1006 | 2df92990 | Michael Hanselmann | AssertCommand(["test", "-f", _NodeQueueDrainFile(node)], node=node, **kwargs) |
1007 | 2df92990 | Michael Hanselmann | |
1008 | 2df92990 | Michael Hanselmann | |
1009 | ff699aa9 | Michael Hanselmann | def TestClusterMasterFailoverWithDrainedQueue(): |
1010 | ff699aa9 | Michael Hanselmann | """gnt-cluster master-failover with drained queue"""
|
1011 | ff699aa9 | Michael Hanselmann | master = qa_config.GetMasterNode() |
1012 | ff699aa9 | Michael Hanselmann | failovermaster = qa_config.AcquireNode(exclude=master) |
1013 | ff699aa9 | Michael Hanselmann | |
1014 | ff699aa9 | Michael Hanselmann | # Ensure queue is not drained
|
1015 | ff699aa9 | Michael Hanselmann | for node in [master, failovermaster]: |
1016 | 2df92990 | Michael Hanselmann | _AssertDrainFile(node, fail=True)
|
1017 | ff699aa9 | Michael Hanselmann | |
1018 | ff699aa9 | Michael Hanselmann | # Drain queue on failover master
|
1019 | 2df92990 | Michael Hanselmann | AssertCommand(["touch", _NodeQueueDrainFile(failovermaster)],
|
1020 | 2df92990 | Michael Hanselmann | node=failovermaster) |
1021 | ff699aa9 | Michael Hanselmann | |
1022 | ff699aa9 | Michael Hanselmann | cmd = ["gnt-cluster", "master-failover"] |
1023 | ff699aa9 | Michael Hanselmann | try:
|
1024 | 2df92990 | Michael Hanselmann | _AssertDrainFile(failovermaster) |
1025 | ff699aa9 | Michael Hanselmann | AssertCommand(cmd, node=failovermaster) |
1026 | 2df92990 | Michael Hanselmann | _AssertDrainFile(master, fail=True)
|
1027 | 2df92990 | Michael Hanselmann | _AssertDrainFile(failovermaster, fail=True)
|
1028 | ff699aa9 | Michael Hanselmann | |
1029 | ff699aa9 | Michael Hanselmann | # Back to original master node
|
1030 | ff699aa9 | Michael Hanselmann | AssertCommand(cmd, node=master) |
1031 | ff699aa9 | Michael Hanselmann | finally:
|
1032 | 565cb4bf | Michael Hanselmann | failovermaster.Release() |
1033 | ff699aa9 | Michael Hanselmann | |
1034 | 2df92990 | Michael Hanselmann | # Ensure queue is not drained
|
1035 | 2df92990 | Michael Hanselmann | for node in [master, failovermaster]: |
1036 | 2df92990 | Michael Hanselmann | _AssertDrainFile(node, fail=True)
|
1037 | ff699aa9 | Michael Hanselmann | |
1038 | ff699aa9 | Michael Hanselmann | |
1039 | cec9845c | Michael Hanselmann | def TestClusterCopyfile(): |
1040 | cec9845c | Michael Hanselmann | """gnt-cluster copyfile"""
|
1041 | cec9845c | Michael Hanselmann | master = qa_config.GetMasterNode() |
1042 | cec9845c | Michael Hanselmann | |
1043 | 24818e8f | Michael Hanselmann | uniqueid = utils.NewUUID() |
1044 | 830da270 | Michael Hanselmann | |
1045 | cec9845c | Michael Hanselmann | # Create temporary file
|
1046 | cec9845c | Michael Hanselmann | f = tempfile.NamedTemporaryFile() |
1047 | 830da270 | Michael Hanselmann | f.write(uniqueid) |
1048 | cec9845c | Michael Hanselmann | f.flush() |
1049 | cec9845c | Michael Hanselmann | f.seek(0)
|
1050 | cec9845c | Michael Hanselmann | |
1051 | cec9845c | Michael Hanselmann | # Upload file to master node
|
1052 | aecba21e | Michael Hanselmann | testname = qa_utils.UploadFile(master.primary, f.name) |
1053 | cec9845c | Michael Hanselmann | try:
|
1054 | cec9845c | Michael Hanselmann | # Copy file to all nodes
|
1055 | 2f4b4f78 | Iustin Pop | AssertCommand(["gnt-cluster", "copyfile", testname]) |
1056 | 830da270 | Michael Hanselmann | _CheckFileOnAllNodes(testname, uniqueid) |
1057 | cec9845c | Michael Hanselmann | finally:
|
1058 | 830da270 | Michael Hanselmann | _RemoveFileFromAllNodes(testname) |
1059 | 830da270 | Michael Hanselmann | |
1060 | 830da270 | Michael Hanselmann | |
1061 | 830da270 | Michael Hanselmann | def TestClusterCommand(): |
1062 | 830da270 | Michael Hanselmann | """gnt-cluster command"""
|
1063 | 24818e8f | Michael Hanselmann | uniqueid = utils.NewUUID() |
1064 | 24818e8f | Michael Hanselmann | rfile = "/tmp/gnt%s" % utils.NewUUID()
|
1065 | d0c8c01d | Iustin Pop | rcmd = utils.ShellQuoteArgs(["echo", "-n", uniqueid]) |
1066 | d0c8c01d | Iustin Pop | cmd = utils.ShellQuoteArgs(["gnt-cluster", "command", |
1067 | 830da270 | Michael Hanselmann | "%s >%s" % (rcmd, rfile)])
|
1068 | 830da270 | Michael Hanselmann | |
1069 | 830da270 | Michael Hanselmann | try:
|
1070 | 2f4b4f78 | Iustin Pop | AssertCommand(cmd) |
1071 | 830da270 | Michael Hanselmann | _CheckFileOnAllNodes(rfile, uniqueid) |
1072 | 830da270 | Michael Hanselmann | finally:
|
1073 | 830da270 | Michael Hanselmann | _RemoveFileFromAllNodes(rfile) |
1074 | cec9845c | Michael Hanselmann | |
1075 | cec9845c | Michael Hanselmann | |
1076 | cec9845c | Michael Hanselmann | def TestClusterDestroy(): |
1077 | cec9845c | Michael Hanselmann | """gnt-cluster destroy"""
|
1078 | 2f4b4f78 | Iustin Pop | AssertCommand(["gnt-cluster", "destroy", "--yes-do-it"]) |
1079 | 65a884ef | Iustin Pop | |
1080 | 65a884ef | Iustin Pop | |
1081 | 65a884ef | Iustin Pop | def TestClusterRepairDiskSizes(): |
1082 | 65a884ef | Iustin Pop | """gnt-cluster repair-disk-sizes"""
|
1083 | 65a884ef | Iustin Pop | AssertCommand(["gnt-cluster", "repair-disk-sizes"]) |
1084 | 50ef6a41 | Bernardo Dal Seno | |
1085 | 50ef6a41 | Bernardo Dal Seno | |
1086 | 50ef6a41 | Bernardo Dal Seno | def TestSetExclStorCluster(newvalue): |
1087 | 50ef6a41 | Bernardo Dal Seno | """Set the exclusive_storage node parameter at the cluster level.
|
1088 | 50ef6a41 | Bernardo Dal Seno |
|
1089 | 50ef6a41 | Bernardo Dal Seno | @type newvalue: bool
|
1090 | 50ef6a41 | Bernardo Dal Seno | @param newvalue: New value of exclusive_storage
|
1091 | 50ef6a41 | Bernardo Dal Seno | @rtype: bool
|
1092 | 50ef6a41 | Bernardo Dal Seno | @return: The old value of exclusive_storage
|
1093 | 50ef6a41 | Bernardo Dal Seno |
|
1094 | 50ef6a41 | Bernardo Dal Seno | """
|
1095 | 0e79564a | Bernardo Dal Seno | es_path = ["Default node parameters", "exclusive_storage"] |
1096 | 0e79564a | Bernardo Dal Seno | oldvalue = _GetClusterField(es_path) |
1097 | 50ef6a41 | Bernardo Dal Seno | AssertCommand(["gnt-cluster", "modify", "--node-parameters", |
1098 | 50ef6a41 | Bernardo Dal Seno | "exclusive_storage=%s" % newvalue])
|
1099 | 0e79564a | Bernardo Dal Seno | effvalue = _GetClusterField(es_path) |
1100 | 50ef6a41 | Bernardo Dal Seno | if effvalue != newvalue:
|
1101 | 50ef6a41 | Bernardo Dal Seno | raise qa_error.Error("exclusive_storage has the wrong value: %s instead" |
1102 | 50ef6a41 | Bernardo Dal Seno | " of %s" % (effvalue, newvalue))
|
1103 | 6a0f22e1 | Bernardo Dal Seno | qa_config.SetExclusiveStorage(newvalue) |
1104 | 50ef6a41 | Bernardo Dal Seno | return oldvalue
|
1105 | e8b919a1 | Bernardo Dal Seno | |
1106 | e8b919a1 | Bernardo Dal Seno | |
1107 | 21e2734f | Bernardo Dal Seno | def TestExclStorSharedPv(node): |
1108 | 21e2734f | Bernardo Dal Seno | """cluster-verify reports LVs that share the same PV with exclusive_storage.
|
1109 | 21e2734f | Bernardo Dal Seno |
|
1110 | 21e2734f | Bernardo Dal Seno | """
|
1111 | 21e2734f | Bernardo Dal Seno | vgname = qa_config.get("vg-name", constants.DEFAULT_VG)
|
1112 | 21e2734f | Bernardo Dal Seno | lvname1 = _QA_LV_PREFIX + "vol1"
|
1113 | 21e2734f | Bernardo Dal Seno | lvname2 = _QA_LV_PREFIX + "vol2"
|
1114 | aecba21e | Michael Hanselmann | node_name = node.primary |
1115 | 21e2734f | Bernardo Dal Seno | AssertCommand(["lvcreate", "-L1G", "-n", lvname1, vgname], node=node_name) |
1116 | 21e2734f | Bernardo Dal Seno | AssertClusterVerify(fail=True, errors=[constants.CV_ENODEORPHANLV])
|
1117 | 21e2734f | Bernardo Dal Seno | AssertCommand(["lvcreate", "-L1G", "-n", lvname2, vgname], node=node_name) |
1118 | 21e2734f | Bernardo Dal Seno | AssertClusterVerify(fail=True, errors=[constants.CV_ENODELVM,
|
1119 | 21e2734f | Bernardo Dal Seno | constants.CV_ENODEORPHANLV]) |
1120 | 21e2734f | Bernardo Dal Seno | AssertCommand(["lvremove", "-f", "/".join([vgname, lvname1])], node=node_name) |
1121 | 21e2734f | Bernardo Dal Seno | AssertCommand(["lvremove", "-f", "/".join([vgname, lvname2])], node=node_name) |
1122 | 21e2734f | Bernardo Dal Seno | AssertClusterVerify() |