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

def lib::bdev::DRBDev::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 will be returned as True, since the DRBD7
devices have not been converted.

Reimplemented from lib::bdev::BlockDev.

Definition at line 1487 of file bdev.py.

01487                          :
    """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 will be returned as True, since the DRBD7
    devices have not been converted.

    """
    if self.minor is None and not self.Attach():
      raise errors.BlockDeviceError("Can't attach to device in GetSyncStatus")
    proc_info = self._MassageProcData(self._GetProcData())
    if self.minor not in proc_info:
      raise errors.BlockDeviceError("Can't find myself in /proc (minor %d)" %
                                    self.minor)
    line = proc_info[self.minor]
    match = re.match("^.*sync'ed: *([0-9.]+)%.*"
                     " finish: ([0-9]+):([0-9]+):([0-9]+) .*$", line)
    if match:
      sync_percent = float(match.group(1))
      hours = int(match.group(2))
      minutes = int(match.group(3))
      seconds = int(match.group(4))
      est_time = hours * 3600 + minutes * 60 + seconds
    else:
      sync_percent = None
      est_time = None
    match = re.match("^ *[0-9]+: cs:([^ ]+).*$", line)
    if not match:
      raise errors.BlockDeviceError("Can't find my data in /proc (minor %d)" %
                                    self.minor)
    client_state = match.group(1)
    is_degraded = client_state != "Connected"
    return sync_percent, est_time, is_degraded, False

  def GetStatus(self):


Generated by  Doxygen 1.6.0   Back to index