Revision 5949c31c

b/qa/qa-sample.json
35 35
    "diskless"
36 36
  ],
37 37

  
38
  "# Default file storage dir (used also for shared storage)": null,
39
  "default-file-storage-dir": "/srv/ganeti/file-storage",
40

  
38 41
  "# Additional arguments for initializing cluster": null,
39 42
  "cluster-init-args": [],
40 43

  
b/qa/qa_cluster.py
178 178
    "--primary-ip-version=%d" % qa_config.get("primary_ip_version", 4),
179 179
    "--enabled-hypervisors=%s" % ",".join(qa_config.GetEnabledHypervisors()),
180 180
    "--enabled-disk-templates=%s" %
181
      ",".join(qa_config.GetEnabledDiskTemplates())
181
      ",".join(qa_config.GetEnabledDiskTemplates()),
182
    "--file-storage-dir=%s" %
183
      qa_config.get("file-storage-dir", pathutils.DEFAULT_FILE_STORAGE_DIR),
182 184
    ]
183 185

  
184 186
  for spec_type in ("mem-size", "disk-size", "disk-count", "cpu-count",
b/qa/qa_config.py
372 372
      _ENABLED_DISK_TEMPLATES_KEY,
373 373
      constants.DEFAULT_ENABLED_DISK_TEMPLATES)
374 374

  
375
  def GetEnabledStorageTypes(self):
376
    """Returns the list of enabled storage types.
377

  
378
    @rtype: list
379
    @returns: the list of storage types enabled for QA
380

  
381
    """
382
    enabled_disk_templates = self.GetEnabledDiskTemplates()
383
    enabled_storage_types = list(set([constants.DISK_TEMPLATES_STORAGE_TYPE[dt]
384
                                      for dt in enabled_disk_templates]))
385
    # Storage type 'lvm-pv' cannot be activated via a disk template,
386
    # therefore we add it if 'lvm-vg' is present.
387
    if constants.ST_LVM_VG in enabled_storage_types:
388
      enabled_storage_types.append(constants.ST_LVM_PV)
389
    return enabled_storage_types
390

  
375 391
  def GetDefaultDiskTemplate(self):
376 392
    """Returns the default disk template to be used.
377 393

  
......
593 609
  return GetConfig().GetEnabledDiskTemplates(*args)
594 610

  
595 611

  
612
def GetEnabledStorageTypes(*args):
613
  """Wrapper for L{_QaConfig.GetEnabledStorageTypes}.
614

  
615
  """
616
  return GetConfig().GetEnabledStorageTypes(*args)
617

  
618

  
596 619
def GetDefaultDiskTemplate(*args):
597 620
  """Wrapper for L{_QaConfig.GetDefaultDiskTemplate}.
598 621

  
b/qa/qa_instance.py
136 136
    for node in info["nodes"]:
137 137
      AssertCommand(["lvremove", "-f"] + vols, node=node)
138 138
  elif info["storage-type"] == constants.ST_FILE:
139
    # FIXME: file storage dir not configurable in qa
140 139
    # Note that this works for both file and sharedfile, and this is intended.
141
    filestorage = pathutils.DEFAULT_FILE_STORAGE_DIR
142
    idir = os.path.join(filestorage, instance.name)
140
    storage_dir = qa_config.get("file-storage-dir",
141
                                pathutils.DEFAULT_FILE_STORAGE_DIR)
142
    idir = os.path.join(storage_dir, instance.name)
143 143
    for node in info["nodes"]:
144 144
      AssertCommand(["rm", "-rf", idir], node=node)
145 145
  elif info["storage-type"] == constants.ST_DISKLESS:
......
558 558
  current = currentnode.primary
559 559
  other = othernode.primary
560 560

  
561
  # FIXME: the qa doesn't have a customizable file storage dir parameter. As
562
  # such for now we use the default.
563
  filestorage = pathutils.DEFAULT_FILE_STORAGE_DIR
561
  filestorage = qa_config.get("file-storage-dir",
562
                              pathutils.DEFAULT_FILE_STORAGE_DIR)
564 563
  disk = os.path.join(filestorage, name)
565 564

  
566 565
  AssertCommand(["gnt-instance", "modify", "--new-primary=%s" % other, name],
......
997 996
        AssertCommand(drbd_shutdown_cmd, node=snode)
998 997
      AssertCommand(["lvremove", "-f"] + info["volumes"], node=snode)
999 998
    elif info["storage-type"] == constants.ST_FILE:
1000
      filestorage = pathutils.DEFAULT_FILE_STORAGE_DIR
999
      filestorage = qa_config.get("file-storage-dir",
1000
                                  pathutils.DEFAULT_FILE_STORAGE_DIR)
1001 1001
      disk = os.path.join(filestorage, instance.name)
1002 1002
      AssertCommand(["rm", "-rf", disk], node=snode)
1003 1003

  
b/qa/qa_node.py
113 113
def TestNodeStorage():
114 114
  """gnt-node storage"""
115 115
  master = qa_config.GetMasterNode()
116
  enabled_disk_templates = qa_config.GetEnabledDiskTemplates()
117 116

  
118 117
  # FIXME: test all storage_types in constants.VALID_STORAGE_TYPES
119 118
  # as soon as they are implemented.
120
  for storage_type in [constants.ST_FILE, constants.ST_LVM_VG,
121
                       constants.ST_LVM_PV]:
119
  enabled_storage_types = qa_config.GetEnabledStorageTypes()
120
  testable_storage_types = list(set(enabled_storage_types).intersection(
121
      set([constants.ST_FILE, constants.ST_LVM_VG, constants.ST_LVM_PV])))
122 122

  
123
    cmd = ["gnt-node", "list-storage", "--storage-type", storage_type]
123
  for storage_type in testable_storage_types:
124 124

  
125
    # Skip file storage if not enabled, otherwise QA will fail; we
126
    # just test for basic failure, but otherwise skip the rest of the
127
    # tests
128
    if storage_type == constants.ST_FILE and not \
129
        ((constants.DT_FILE in enabled_disk_templates) or
130
         (constants.DT_SHARED_FILE in enabled_disk_templates)):
131
      AssertCommand(cmd, fail=True)
132
      continue
125
    cmd = ["gnt-node", "list-storage", "--storage-type", storage_type]
133 126

  
134 127
    # Test simple list
135 128
    AssertCommand(cmd)

Also available in: Unified diff