Commit a3fffcc6 authored by René Nussbaumer's avatar René Nussbaumer
Browse files

Make it possible to pause/resume sync of mirrored dev

Signed-off-by: default avatarRené Nussbaumer <>
Reviewed-by: default avatarIustin Pop <>
parent 18009c1e
......@@ -230,6 +230,20 @@ class BlockDev(object):
result = result and child.SetSyncSpeed(speed)
return result
def PauseResumeSync(self, pause):
"""Pause/Resume the sync of the mirror.
In case this is not a mirroring device, this is no-op.
@param pause: Wheater to pause or resume
result = True
if self._children:
for child in self._children:
result = result and child.PauseResumeSync(pause)
return result
def GetSyncStatus(self):
"""Returns the sync status of the device.
......@@ -1488,6 +1502,30 @@ class DRBD8(BaseDRBD):
children_result = super(DRBD8, self).SetSyncSpeed(kbytes)
return self._SetMinorSyncSpeed(self.minor, kbytes) and children_result
def PauseResumeSync(self, pause):
"""Pauses or resumes the sync of a DRBD device.
@param pause: Wether to pause or resume
@return: the success of the operation
if self.minor is None:"Not attached during PauseSync")
return False
children_result = super(DRBD8, self).PauseResumeSync(pause)
if pause:
cmd = "pause-sync"
cmd = "resume-sync"
result = utils.RunCmd(["drbdsetup", self.dev_path, cmd])
if result.failed:
logging.error("Can't %s: %s - %s", cmd,
result.fail_reason, result.output)
return not result.failed and children_result
def GetProcStatus(self):
"""Return device data from /proc.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment