Revision 6c3c6db9 lib/storage.py
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