Revision bab4f56a

b/qa/ganeti-qa.py
437 437
  # FIXME: inter-cluster-instance-move crashes on file based instances :/
438 438
  # See Issue 414.
439 439
  if (qa_config.TestEnabled([qa_rapi.Enabled, "inter-cluster-instance-move"])
440
      and instance.disk_template != constants.DT_FILE):
440
      and (instance.disk_template not in
441
           [constants.DT_FILE, constants.DT_SHARED_FILE])):
441 442
    newinst = qa_config.AcquireInstance()
442 443
    try:
443 444
      tnode = qa_config.AcquireNode(exclude=inodes)
......
804 805
    if qa_rapi.Enabled():
805 806
      RunTest(qa_rapi.TestNode, pnode)
806 807

  
807
      if qa_config.TestEnabled("instance-add-plain-disk"):
808
      if (qa_config.TestEnabled("instance-add-plain-disk")
809
          and qa_config.IsTemplateSupported(constants.DT_PLAIN)):
808 810
        for use_client in [True, False]:
809 811
          rapi_instance = RunTest(qa_rapi.TestRapiInstanceAdd, pnode,
810 812
                                  use_client)
b/qa/qa_cluster.py
407 407

  
408 408
def TestClusterReservedLvs():
409 409
  """gnt-cluster reserved lvs"""
410
  # if no lvm-based templates are supported, skip the test
411
  if not qa_config.IsStorageTypeSupported(constants.ST_LVM_VG):
412
    return
410 413
  vgname = qa_config.get("vg-name", constants.DEFAULT_VG)
411 414
  lvname = _QA_LV_PREFIX + "test"
412 415
  lvfullname = "/".join([vgname, lvname])
b/qa/qa_config.py
435 435
    return enabled and (not self.GetExclusiveStorage() or
436 436
                        templ in constants.DTS_EXCL_STORAGE)
437 437

  
438
  def IsStorageTypeSupported(self, storage_type):
439
    """Is the given storage type supported by the current configuration?
440

  
441
    This is determined by looking if at least one of the disk templates
442
    which is associated with the storage type is enabled in the configuration.
443

  
444
    """
445
    enabled_disk_templates = self.GetEnabledDiskTemplates()
446
    if storage_type == constants.ST_LVM_PV:
447
      disk_templates = utils.GetDiskTemplatesOfStorageType(constants.ST_LVM_VG)
448
    else:
449
      disk_templates = utils.GetDiskTemplatesOfStorageType(storage_type)
450
    return bool(set(enabled_disk_templates).intersection(set(disk_templates)))
451

  
438 452
  def AreSpindlesSupported(self):
439 453
    """Are spindles supported by the current configuration?
440 454

  
......
673 687
  return GetConfig().IsTemplateSupported(templ)
674 688

  
675 689

  
690
def IsStorageTypeSupported(storage_type):
691
  """Wrapper for L{_QaConfig.IsTemplateSupported}.
692

  
693
  """
694
  return GetConfig().IsStorageTypeSupported(storage_type)
695

  
696

  
676 697
def AreSpindlesSupported():
677 698
  """Wrapper for L{_QaConfig.AreSpindlesSupported}.
678 699

  
b/qa/qa_group.py
225 225

  
226 226
def TestGroupModify():
227 227
  """gnt-group modify"""
228
  # This tests assumes LVM to be enabled, thus it should skip if
229
  # this is not the case
230
  if not qa_config.IsStorageTypeSupported(constants.ST_LVM_VG):
231
    return
228 232
  (group1, ) = qa_utils.GetNonexistentGroups(1)
229 233

  
230 234
  AssertCommand(["gnt-group", "add", group1])
b/qa/qa_rapi.py
246 246
  """Testing resource queries via remote API.
247 247

  
248 248
  """
249
  # FIXME: the tests are failing if no LVM is enabled, investigate
250
  # if it is a bug in the QA or in the code
251
  if not qa_config.IsStorageTypeSupported(constants.ST_LVM_VG):
252
    return
253

  
249 254
  master_name = qa_utils.ResolveNodeName(qa_config.GetMasterNode())
250 255
  rnd = random.Random(7818)
251 256

  
......
323 328
      ("/2/query/%s?fields=%s" % (what, namefield),
324 329
       compat.partial(_Check, [namefield]), "PUT", {}),
325 330

  
326
      # Fields in body
331
      ("/2/query/%s" % what, compat.partial(_Check, [namefield] * 4), "PUT", {
332
         "fields": [namefield] * 4,
333
         }),
334

  
327 335
      ("/2/query/%s" % what, compat.partial(_Check, all_fields), "PUT", {
328 336
         "fields": all_fields,
329 337
         }),
330 338

  
331 339
      ("/2/query/%s" % what, compat.partial(_Check, [namefield] * 4), "PUT", {
332
         "fields": [namefield] * 4,
333
         }),
334
      ])
340
         "fields": [namefield] * 4
341
         })])
335 342

  
336 343
    def _CheckFilter():
337 344
      _DoTests([
......
562 569

  
563 570
def TestRapiInstanceAdd(node, use_client):
564 571
  """Test adding a new instance via RAPI"""
572
  if not qa_config.IsTemplateSupported(constants.DT_PLAIN):
573
    return
565 574
  instance = qa_config.AcquireInstance()
566 575
  instance.SetDiskTemplate(constants.DT_PLAIN)
567 576
  try:
......
614 623
@InstanceCheck(None, INST_DOWN, FIRST_ARG)
615 624
def TestRapiInstanceRemove(instance, use_client):
616 625
  """Test removing instance via RAPI"""
626
  # FIXME: this does not work if LVM is not enabled. Find out if this is a bug
627
  # in RAPI or in the test
628
  if not qa_config.IsStorageTypeSupported(constants.ST_LVM_VG):
629
    return
630

  
617 631
  if use_client:
618 632
    job_id = _rapi_client.DeleteInstance(instance.name)
619 633
  else:
b/tools/move-instance
569 569
    logging.info("Retrieving instance information from source cluster")
570 570
    instinfo = self._GetInstanceInfo(src_client, mrt.PollJob,
571 571
                                     mrt.move.src_instance_name)
572
    if instinfo["disk_template"] == constants.DT_FILE:
572
    if (instinfo["disk_template"] in
573
        [constants.DT_FILE, constants.DT_SHARED_FILE]):
573 574
      raise Error("Inter-cluster move of file-based instances is not"
574 575
                  " supported.")
575 576

  

Also available in: Unified diff