Revision 9db6dbce lib/bdev.py
b/lib/bdev.py | ||
---|---|---|
451 | 451 |
|
452 | 452 |
return retval |
453 | 453 |
|
454 |
def GetSyncStatus(self): |
|
455 |
"""Returns the sync status of the device. |
|
456 |
|
|
457 |
If this device is a mirroring device, this function returns the |
|
458 |
status of the mirror. |
|
459 |
|
|
460 |
Returns: |
|
461 |
(sync_percent, estimated_time, is_degraded) |
|
462 |
|
|
463 |
For logical volumes, sync_percent and estimated_time are always |
|
464 |
None (no recovery in progress, as we don't handle the mirrored LV |
|
465 |
case). |
|
466 |
|
|
467 |
For the is_degraded parameter, we check if the logical volume has |
|
468 |
the 'virtual' type, which means it's not backed by existing |
|
469 |
storage anymore (read from it return I/O error). This happens |
|
470 |
after a physical disk failure and subsequent 'vgreduce |
|
471 |
--removemissing' on the volume group. |
|
472 |
|
|
473 |
""" |
|
474 |
result = utils.RunCmd(["lvs", "--noheadings", "-olv_attr", self.dev_path]) |
|
475 |
if result.failed: |
|
476 |
logger.Error("Can't display lv: %s" % result.fail_reason) |
|
477 |
return None, None, True |
|
478 |
out = result.stdout.strip() |
|
479 |
# format: type/permissions/alloc/fixed_minor/state/open |
|
480 |
if len(out) != 6: |
|
481 |
return None, None, True |
|
482 |
is_degraded = out[0] == 'v' # virtual volume, i.e. doesn't have |
|
483 |
# backing storage |
|
484 |
return None, None, is_degraded |
|
485 |
|
|
454 | 486 |
def Open(self, force=False): |
455 | 487 |
"""Make the device ready for I/O. |
456 | 488 |
|
Also available in: Unified diff