Revision cc2a70b1

b/qa/qa_instance.py
166 166
    }
167 167

  
168 168

  
169
def _DestroyInstanceVolumes(instance):
170
  """Remove all the LVM volumes of an instance.
169
def _DestroyInstanceDisks(instance):
170
  """Remove all the backend disks of an instance.
171 171

  
172 172
  This is used to simulate HW errors (dead nodes, broken disks...); the
173 173
  configuration of the instance is not affected.
......
176 176

  
177 177
  """
178 178
  info = _GetInstanceInfo(instance.name)
179
  vols = info["volumes"]
180
  for node in info["nodes"]:
181
    AssertCommand(["lvremove", "-f"] + vols, node=node)
179
  # FIXME: destruction/removal should be part of the disk class
180
  if info["storage-type"] == constants.ST_LVM_VG:
181
    vols = info["volumes"]
182
    for node in info["nodes"]:
183
      AssertCommand(["lvremove", "-f"] + vols, node=node)
184
  elif info["storage-type"] == constants.ST_FILE:
185
    # FIXME: file storage dir not configurable in qa
186
    # Note that this works for both file and sharedfile, and this is intended.
187
    filestorage = pathutils.DEFAULT_FILE_STORAGE_DIR
188
    idir = os.path.join(filestorage, instance.name)
189
    for node in info["nodes"]:
190
      AssertCommand(["rm", "-rf"] + idir, node=node)
191
  elif info["storage-type"] == constants.ST_DISKLESS:
192
    pass
182 193

  
183 194

  
184 195
def _GetInstanceField(instance, field):
......
786 797

  
787 798
  """
788 799
  if destroy:
789
    _DestroyInstanceVolumes(instance)
800
    _DestroyInstanceDisks(instance)
790 801
  AssertCommand((["gnt-instance", "recreate-disks"] + cmdargs +
791 802
                 [instance.name]), fail)
792 803
  if not fail and check:

Also available in: Unified diff