Revision a08e181f qa/qa_config.py

b/qa/qa_config.py
36 36
_INSTANCE_CHECK_KEY = "instance-check"
37 37
_ENABLED_HV_KEY = "enabled-hypervisors"
38 38

  
39
#: Cluster-wide run-time value of the exclusive storage flag
40
_exclusive_storage = None
41

  
42

  
43 39
#: QA configuration (L{_QaConfig})
44 40
_config = None
45 41

  
......
51 47
    """
52 48
    self._data = data
53 49

  
50
    #: Cluster-wide run-time value of the exclusive storage flag
51
    self._exclusive_storage = None
52

  
54 53
  @classmethod
55 54
  def Load(cls, filename):
56 55
    """Loads a configuration file and produces a configuration object.
......
159 158
    """
160 159
    return self.GetEnabledHypervisors()[0]
161 160

  
161
  def SetExclusiveStorage(self, value):
162
    """Set the expected value of the C{exclusive_storage} flag for the cluster.
163

  
164
    """
165
    self._exclusive_storage = bool(value)
166

  
167
  def GetExclusiveStorage(self):
168
    """Get the expected value of the C{exclusive_storage} flag for the cluster.
169

  
170
    """
171
    value = self._exclusive_storage
172
    assert value is not None
173
    return value
174

  
175
  def IsTemplateSupported(self, templ):
176
    """Is the given disk template supported by the current configuration?
177

  
178
    """
179
    if self.GetExclusiveStorage():
180
      return templ in constants.DTS_EXCL_STORAGE
181
    else:
182
      return True
183

  
162 184

  
163 185
def Load(path):
164 186
  """Loads the passed configuration file.
......
337 359

  
338 360

  
339 361
def SetExclusiveStorage(value):
340
  """Set the expected value of the exclusive_storage flag for the cluster.
362
  """Wrapper for L{_QaConfig.SetExclusiveStorage}.
341 363

  
342 364
  """
343
  global _exclusive_storage # pylint: disable=W0603
344

  
345
  _exclusive_storage = bool(value)
365
  return GetConfig().SetExclusiveStorage(value)
346 366

  
347 367

  
348 368
def GetExclusiveStorage():
349
  """Get the expected value of the exclusive_storage flag for the cluster.
369
  """Wrapper for L{_QaConfig.GetExclusiveStorage}.
350 370

  
351 371
  """
352
  val = _exclusive_storage
353
  assert val is not None
354
  return val
372
  return GetConfig().GetExclusiveStorage()
355 373

  
356 374

  
357 375
def IsTemplateSupported(templ):
358
  """Is the given disk template supported by the current configuration?
376
  """Wrapper for L{_QaConfig.GetExclusiveStorage}.
359 377

  
360 378
  """
361
  if GetExclusiveStorage():
362
    return templ in constants.DTS_EXCL_STORAGE
363
  else:
364
    return True
379
  return GetConfig().IsTemplateSupported(templ)
365 380

  
366 381

  
367 382
def AcquireNode(exclude=None):

Also available in: Unified diff