Revision 6c3c6db9

b/lib/constants.py
199 199
SF_USED = "used"
200 200
SF_ALLOCATABLE = "allocatable"
201 201

  
202
# Storage operations
203
SO_FIX_CONSISTENCY = "fix-consistency"
204

  
202 205
# Available fields per storage type
203 206
VALID_STORAGE_FIELDS = {
204 207
  ST_FILE: frozenset([SF_NAME, SF_USED, SF_FREE]),
......
211 214
  }
212 215

  
213 216
VALID_STORAGE_OPERATIONS = {
217
  ST_LVM_VG: frozenset([SO_FIX_CONSISTENCY]),
214 218
  }
215 219

  
216 220
# Local disk status
b/lib/storage.py
374 374
    (constants.SF_SIZE, "vg_size", _ParseSize),
375 375
    ]
376 376

  
377
  def _RemoveMissing(self, name):
378
    """Runs "vgreduce --removemissing" on a volume group.
379

  
380
    @type name: string
381
    @param name: Volume group name
382

  
383
    """
384
    # Ignoring vgreduce exit code. Older versions exit with an error even tough
385
    # the VG is already consistent. This was fixed in later versions, but we
386
    # cannot depend on it.
387
    result = utils.RunCmd(["vgreduce", "--removemissing", name])
388

  
389
    # Keep output in case something went wrong
390
    vgreduce_output = result.output
391

  
392
    result = utils.RunCmd(["vgs", "--noheadings", "--nosuffix", name])
393
    if result.failed:
394
      raise errors.StorageError(("Volume group '%s' still not consistent,"
395
                                 " 'vgreduce' output: %r,"
396
                                 " 'vgs' output: %r") %
397
                                (name, vgreduce_output, result.output))
398

  
399
  def Execute(self, name, op):
400
    """Executes an operation on a virtual volume.
401

  
402
    See L{_Base.Execute}.
403

  
404
    """
405
    if op == constants.SO_FIX_CONSISTENCY:
406
      return self._RemoveMissing(name)
407

  
408
    return _LvmBase.Execute(self, name, op)
409

  
377 410

  
378 411
# Lookup table for storage types
379 412
_STORAGE_TYPES = {

Also available in: Unified diff