Logo Search packages:      
Sourcecode: ganeti version File versions  Download package

def lib::bdev::MDRaid1::GetSyncStatus (   self  ) 

Returns the sync status of the device.

Returns:
 (sync_percent, estimated_time, is_degraded, ldisk)

If sync_percent is None, it means all is ok
If estimated_time is None, it means we can't esimate
the time needed, otherwise it's the time left in seconds.

The ldisk parameter is always true for MD devices.

Reimplemented from lib::bdev::BlockDev.

Definition at line 906 of file bdev.py.

00906                          :
    """Returns the sync status of the device.

    Returns:
     (sync_percent, estimated_time, is_degraded, ldisk)

    If sync_percent is None, it means all is ok
    If estimated_time is None, it means we can't esimate
    the time needed, otherwise it's the time left in seconds.

    The ldisk parameter is always true for MD devices.

    """
    if self.minor is None and not self.Attach():
      raise errors.BlockDeviceError("Can't attach to device in GetSyncStatus")
    dev_info = self._GetDevInfo(self.minor)
    is_clean = ("state" in dev_info and
                len(dev_info["state"]) == 1 and
                dev_info["state"][0] in ("clean", "active"))
    sys_path = "/sys/block/md%s/md/" % self.minor
    f = file(sys_path + "sync_action")
    sync_status = f.readline().strip()
    f.close()
    if sync_status == "idle":
      return None, None, not is_clean, False
    f = file(sys_path + "sync_completed")
    sync_completed = f.readline().strip().split(" / ")
    f.close()
    if len(sync_completed) != 2:
      return 0, None, not is_clean, False
    sync_done, sync_total = [float(i) for i in sync_completed]
    sync_percent = 100.0*sync_done/sync_total
    f = file(sys_path + "sync_speed")
    sync_speed_k = int(f.readline().strip())
    if sync_speed_k == 0:
      time_est = None
    else:
      time_est = (sync_total - sync_done) / 2 / sync_speed_k
    return sync_percent, time_est, not is_clean, False

  def Open(self, force=False):


Generated by  Doxygen 1.6.0   Back to index