Revision fa84c8a4 qa/qa_instance.py

b/qa/qa_instance.py
63 63
  return params
64 64

  
65 65

  
66
def _DiskTest(node, disk_template):
66
def _DiskTest(node, disk_template, fail=False):
67 67
  instance = qa_config.AcquireInstance()
68 68
  try:
69 69
    cmd = (["gnt-instance", "add",
......
73 73
           _GetGenericAddParameters(instance))
74 74
    cmd.append(instance["name"])
75 75

  
76
    AssertCommand(cmd)
76
    AssertCommand(cmd, fail=fail)
77 77

  
78
    _CheckSsconfInstanceList(instance["name"])
79
    qa_config.SetInstanceTemplate(instance, disk_template)
78
    if not fail:
79
      _CheckSsconfInstanceList(instance["name"])
80
      qa_config.SetInstanceTemplate(instance, disk_template)
80 81

  
81
    return instance
82
      return instance
82 83
  except:
83 84
    qa_config.ReleaseInstance(instance)
84 85
    raise
85 86

  
87
  # Handle the case where creation is expected to fail
88
  assert fail
89
  qa_config.ReleaseInstance(instance)
90
  return None
91

  
86 92

  
87 93
def _GetInstanceInfo(instance):
88 94
  """Return information about the actual state of an instance.
......
257 263
  return templ == constants.DT_DRBD8
258 264

  
259 265

  
260
@InstanceCheck(None, INST_UP, RETURN_VALUE)
261
def TestInstanceAddWithPlainDisk(nodes):
266
def TestInstanceAddWithPlainDisk(nodes, fail=False):
262 267
  """gnt-instance add -t plain"""
263 268
  assert len(nodes) == 1
264
  return _DiskTest(nodes[0]["primary"], "plain")
269
  instance = _DiskTest(nodes[0]["primary"], constants.DT_PLAIN, fail=fail)
270
  if not fail:
271
    qa_utils.RunInstanceCheck(instance, True)
272
  return instance
265 273

  
266 274

  
267 275
@InstanceCheck(None, INST_UP, RETURN_VALUE)

Also available in: Unified diff