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

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

Returns the sync status of the device.

Returns:
 (sync_percent, estimated_time, is_degraded)

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.


We set the is_degraded parameter to True on two conditions:
network not connected or local disk missing.

We compute the ldisk parameter based on wheter we have a local
disk or not.

Reimplemented from lib::bdev::BlockDev.

Definition at line 1968 of file bdev.py.

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

    Returns:
     (sync_percent, estimated_time, is_degraded)

    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.


    We set the is_degraded parameter to True on two conditions:
    network not connected or local disk missing.

    We compute the ldisk parameter based on wheter we have a local
    disk or not.

    """
    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("^ *\d+: cs:(\w+).*ds:(\w+)/(\w+).*$", line)
    if not match:
      raise errors.BlockDeviceError("Can't find my data in /proc (minor %d)" %
                                    self.minor)
    client_state = match.group(1)
    local_disk_state = match.group(2)
    ldisk = local_disk_state != "UpToDate"
    is_degraded = client_state != "Connected"
    return sync_percent, est_time, is_degraded or ldisk, ldisk

  def GetStatus(self):


Generated by  Doxygen 1.6.0   Back to index