# FIXME: inter-cluster-instance-move crashes on file based instances :/
# See Issue 414.
if (qa_config.TestEnabled([qa_rapi.Enabled, "inter-cluster-instance-move"])
- and instance.disk_template != constants.DT_FILE):
+ and (instance.disk_template not in
+ [constants.DT_FILE, constants.DT_SHARED_FILE])):
newinst = qa_config.AcquireInstance()
try:
tnode = qa_config.AcquireNode(exclude=inodes)
if qa_rapi.Enabled():
RunTest(qa_rapi.TestNode, pnode)
- if qa_config.TestEnabled("instance-add-plain-disk"):
+ if (qa_config.TestEnabled("instance-add-plain-disk")
+ and qa_config.IsTemplateSupported(constants.DT_PLAIN)):
for use_client in [True, False]:
rapi_instance = RunTest(qa_rapi.TestRapiInstanceAdd, pnode,
use_client)
def TestClusterReservedLvs():
"""gnt-cluster reserved lvs"""
+ # if no lvm-based templates are supported, skip the test
+ if not qa_config.IsStorageTypeSupported(constants.ST_LVM_VG):
+ return
vgname = qa_config.get("vg-name", constants.DEFAULT_VG)
lvname = _QA_LV_PREFIX + "test"
lvfullname = "/".join([vgname, lvname])
return enabled and (not self.GetExclusiveStorage() or
templ in constants.DTS_EXCL_STORAGE)
+ def IsStorageTypeSupported(self, storage_type):
+ """Is the given storage type supported by the current configuration?
+
+ This is determined by looking if at least one of the disk templates
+ which is associated with the storage type is enabled in the configuration.
+
+ """
+ enabled_disk_templates = self.GetEnabledDiskTemplates()
+ if storage_type == constants.ST_LVM_PV:
+ disk_templates = utils.GetDiskTemplatesOfStorageType(constants.ST_LVM_VG)
+ else:
+ disk_templates = utils.GetDiskTemplatesOfStorageType(storage_type)
+ return bool(set(enabled_disk_templates).intersection(set(disk_templates)))
+
def AreSpindlesSupported(self):
"""Are spindles supported by the current configuration?
return GetConfig().IsTemplateSupported(templ)
+def IsStorageTypeSupported(storage_type):
+ """Wrapper for L{_QaConfig.IsTemplateSupported}.
+
+ """
+ return GetConfig().IsStorageTypeSupported(storage_type)
+
+
def AreSpindlesSupported():
"""Wrapper for L{_QaConfig.AreSpindlesSupported}.
def TestGroupModify():
"""gnt-group modify"""
+ # This tests assumes LVM to be enabled, thus it should skip if
+ # this is not the case
+ if not qa_config.IsStorageTypeSupported(constants.ST_LVM_VG):
+ return
(group1, ) = qa_utils.GetNonexistentGroups(1)
AssertCommand(["gnt-group", "add", group1])
"""Testing resource queries via remote API.
"""
+ # FIXME: the tests are failing if no LVM is enabled, investigate
+ # if it is a bug in the QA or in the code
+ if not qa_config.IsStorageTypeSupported(constants.ST_LVM_VG):
+ return
+
master_name = qa_utils.ResolveNodeName(qa_config.GetMasterNode())
rnd = random.Random(7818)
("/2/query/%s?fields=%s" % (what, namefield),
compat.partial(_Check, [namefield]), "PUT", {}),
- # Fields in body
+ ("/2/query/%s" % what, compat.partial(_Check, [namefield] * 4), "PUT", {
+ "fields": [namefield] * 4,
+ }),
+
("/2/query/%s" % what, compat.partial(_Check, all_fields), "PUT", {
"fields": all_fields,
}),
("/2/query/%s" % what, compat.partial(_Check, [namefield] * 4), "PUT", {
- "fields": [namefield] * 4,
- }),
- ])
+ "fields": [namefield] * 4
+ })])
def _CheckFilter():
_DoTests([
def TestRapiInstanceAdd(node, use_client):
"""Test adding a new instance via RAPI"""
+ if not qa_config.IsTemplateSupported(constants.DT_PLAIN):
+ return
instance = qa_config.AcquireInstance()
instance.SetDiskTemplate(constants.DT_PLAIN)
try:
@InstanceCheck(None, INST_DOWN, FIRST_ARG)
def TestRapiInstanceRemove(instance, use_client):
"""Test removing instance via RAPI"""
+ # FIXME: this does not work if LVM is not enabled. Find out if this is a bug
+ # in RAPI or in the test
+ if not qa_config.IsStorageTypeSupported(constants.ST_LVM_VG):
+ return
+
if use_client:
job_id = _rapi_client.DeleteInstance(instance.name)
else:
logging.info("Retrieving instance information from source cluster")
instinfo = self._GetInstanceInfo(src_client, mrt.PollJob,
mrt.move.src_instance_name)
- if instinfo["disk_template"] == constants.DT_FILE:
+ if (instinfo["disk_template"] in
+ [constants.DT_FILE, constants.DT_SHARED_FILE]):
raise Error("Inter-cluster move of file-based instances is not"
" supported.")