Revision dacd8ba4
b/qa/ganeti-qa.py | ||
---|---|---|
177 | 177 |
("cluster-modify", qa_cluster.TestClusterModifyISpecs), |
178 | 178 |
("cluster-modify", qa_cluster.TestClusterModifyBe), |
179 | 179 |
("cluster-modify", qa_cluster.TestClusterModifyDisk), |
180 |
("cluster-modify", qa_cluster.TestClusterModifyStorageTypes), |
|
180 | 181 |
("cluster-rename", qa_cluster.TestClusterRename), |
181 | 182 |
("cluster-info", qa_cluster.TestClusterVersion), |
182 | 183 |
("cluster-info", qa_cluster.TestClusterInfo), |
b/qa/qa-sample.json | ||
---|---|---|
27 | 27 |
"vg-name": "xenvg", |
28 | 28 |
"# Cluster-level value of the exclusive-storage flag": null, |
29 | 29 |
"exclusive-storage": null, |
30 |
"enabled-storage-types": "lvm-vg", |
|
30 | 31 |
|
31 | 32 |
"# Additional arguments for initializing cluster": null, |
32 | 33 |
"cluster-init-args": [], |
b/qa/qa_cluster.py | ||
---|---|---|
190 | 190 |
"gnt-cluster", "init", |
191 | 191 |
"--primary-ip-version=%d" % qa_config.get("primary_ip_version", 4), |
192 | 192 |
"--enabled-hypervisors=%s" % ",".join(qa_config.GetEnabledHypervisors()), |
193 |
"--enabled-storage-types=%s" % |
|
194 |
",".join(qa_config.GetEnabledStorageTypes()) |
|
193 | 195 |
] |
194 | 196 |
|
195 | 197 |
for spec_type in ("mem-size", "disk-size", "disk-count", "cpu-count", |
... | ... | |
402 | 404 |
AssertCommand(["gnt-cluster", "modify", "-D", param], fail=True) |
403 | 405 |
|
404 | 406 |
|
407 |
def TestClusterModifyStorageTypes(): |
|
408 |
"""gnt-cluster modify --enabled-storage-types=...""" |
|
409 |
default_storage_type = qa_config.GetDefaultStorageType() |
|
410 |
AssertCommand( |
|
411 |
["gnt-cluster", "modify", |
|
412 |
"--enabled-storage-types=%s" % default_storage_type], |
|
413 |
fail=False) |
|
414 |
AssertCommand(["gnt-cluster", "info"]) |
|
415 |
AssertCommand( |
|
416 |
["gnt-cluster", "modify", |
|
417 |
"--enabled-storage-types=%s" % |
|
418 |
",".join(qa_config.GetEnabledStorageTypes())], |
|
419 |
fail=False) |
|
420 |
AssertCommand(["gnt-cluster", "info"]) |
|
421 |
# bogus types |
|
422 |
AssertCommand(["gnt-cluster", "modify", |
|
423 |
"--enabled-storage-types=pinkbunny"], |
|
424 |
fail=True) |
|
425 |
# duplicate entries do no harm |
|
426 |
AssertCommand( |
|
427 |
["gnt-cluster", "modify", |
|
428 |
"--enabled-storage-types=%s,%s" % |
|
429 |
(default_storage_type, default_storage_type)], |
|
430 |
fail=False) |
|
431 |
AssertCommand(["gnt-cluster", "info"]) |
|
432 |
|
|
433 |
|
|
405 | 434 |
def TestClusterModifyBe(): |
406 | 435 |
"""gnt-cluster modify -B""" |
407 | 436 |
for fail, cmd in [ |
b/qa/qa_config.py | ||
---|---|---|
38 | 38 |
_ENABLED_HV_KEY = "enabled-hypervisors" |
39 | 39 |
_VCLUSTER_MASTER_KEY = "vcluster-master" |
40 | 40 |
_VCLUSTER_BASEDIR_KEY = "vcluster-basedir" |
41 |
_ENABLED_STORAGE_TYPES_KEY = "enabled-storage-types" |
|
41 | 42 |
|
42 | 43 |
#: QA configuration (L{_QaConfig}) |
43 | 44 |
_config = None |
... | ... | |
349 | 350 |
@rtype: list |
350 | 351 |
|
351 | 352 |
""" |
353 |
return self._GetStringListParameter( |
|
354 |
_ENABLED_HV_KEY, |
|
355 |
[constants.DEFAULT_ENABLED_HYPERVISOR]) |
|
356 |
|
|
357 |
def GetDefaultHypervisor(self): |
|
358 |
"""Returns the default hypervisor to be used. |
|
359 |
|
|
360 |
""" |
|
361 |
return self.GetEnabledHypervisors()[0] |
|
362 |
|
|
363 |
def GetEnabledStorageTypes(self): |
|
364 |
"""Returns the list of enabled storage types. |
|
365 |
|
|
366 |
@rtype: list |
|
367 |
|
|
368 |
""" |
|
369 |
return self._GetStringListParameter( |
|
370 |
_ENABLED_STORAGE_TYPES_KEY, |
|
371 |
list(constants.DEFAULT_ENABLED_STORAGE_TYPES)) |
|
372 |
|
|
373 |
def GetDefaultStorageType(self): |
|
374 |
"""Returns the default storage type to be used. |
|
375 |
|
|
376 |
""" |
|
377 |
return self.GetEnabledStorageTypes()[0] |
|
378 |
|
|
379 |
def _GetStringListParameter(self, key, default_values): |
|
380 |
"""Retrieves a parameter's value that is supposed to be a list of strings. |
|
381 |
|
|
382 |
@rtype: list |
|
383 |
|
|
384 |
""" |
|
352 | 385 |
try: |
353 |
value = self._data[_ENABLED_HV_KEY]
|
|
386 |
value = self._data[key]
|
|
354 | 387 |
except KeyError: |
355 |
return [constants.DEFAULT_ENABLED_HYPERVISOR]
|
|
388 |
return default_values
|
|
356 | 389 |
else: |
357 | 390 |
if value is None: |
358 | 391 |
return [] |
359 | 392 |
elif isinstance(value, basestring): |
360 |
# The configuration key ("enabled-hypervisors") implies there can be |
|
361 |
# multiple values. Multiple hypervisors are comma-separated on the |
|
362 |
# command line option to "gnt-cluster init", so we need to handle them |
|
363 |
# equally here. |
|
364 | 393 |
return value.split(",") |
365 | 394 |
else: |
366 | 395 |
return value |
367 | 396 |
|
368 |
def GetDefaultHypervisor(self): |
|
369 |
"""Returns the default hypervisor to be used. |
|
370 |
|
|
371 |
""" |
|
372 |
return self.GetEnabledHypervisors()[0] |
|
373 |
|
|
374 | 397 |
def SetExclusiveStorage(self, value): |
375 | 398 |
"""Set the expected value of the C{exclusive_storage} flag for the cluster. |
376 | 399 |
|
... | ... | |
528 | 551 |
return GetConfig().GetDefaultHypervisor(*args) |
529 | 552 |
|
530 | 553 |
|
554 |
def GetEnabledStorageTypes(*args): |
|
555 |
"""Wrapper for L{_QaConfig.GetEnabledStorageTypes}. |
|
556 |
|
|
557 |
""" |
|
558 |
return GetConfig().GetEnabledStorageTypes(*args) |
|
559 |
|
|
560 |
|
|
561 |
def GetDefaultStorageType(*args): |
|
562 |
"""Wrapper for L{_QaConfig.GetDefaultStorageType}. |
|
563 |
|
|
564 |
""" |
|
565 |
return GetConfig().GetDefaultStorageType(*args) |
|
566 |
|
|
567 |
|
|
531 | 568 |
def GetMasterNode(): |
532 | 569 |
"""Wrapper for L{_QaConfig.GetMasterNode}. |
533 | 570 |
|
Also available in: Unified diff