Federico Simoncelli has uploaded a new change for review.

Change subject: misc: remove recoveryCallback from watchCmd
......................................................................

misc: remove recoveryCallback from watchCmd

Change-Id: I9ebbcdb10882ac031712d107485560883c4720a9
Signed-off-by: Federico Simoncelli <[email protected]>
---
M lib/vdsm/utils.py
M tests/miscTests.py
M vdsm/storage/blockVolume.py
M vdsm/storage/misc.py
M vdsm/storage/volume.py
5 files changed, 10 insertions(+), 29 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/72/26872/1

diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index cd178da..59b021d 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -714,17 +714,14 @@
     return [l[:-1] if l.endswith('\n') else l for l in lines]
 
 
-def watchCmd(command, stop, cwd=None, data=None, recoveryCallback=None,
-             nice=None, ioclass=None, execCmdLogger=logging.root,
-             deathSignal=signal.SIGKILL):
+def watchCmd(command, stop, cwd=None, data=None, nice=None, ioclass=None,
+             execCmdLogger=logging.root, deathSignal=signal.SIGKILL):
     """
     Executes an external command, optionally via sudo with stop abilities.
     """
     proc = execCmd(command, cwd=cwd, data=data, sync=False,
                    nice=nice, ioclass=ioclass, execCmdLogger=execCmdLogger,
                    deathSignal=deathSignal)
-    if recoveryCallback:
-        recoveryCallback(proc)
 
     if not proc.wait(cond=stop):
         proc.kill()
diff --git a/tests/miscTests.py b/tests/miscTests.py
index ca00ec7..713a9aa 100644
--- a/tests/miscTests.py
+++ b/tests/miscTests.py
@@ -51,11 +51,8 @@
 SUDO_GROUP = "root"
 
 
-def watchCmd(cmd, stop, cwd=None, data=None, recoveryCallback=None):
-    ret, out, err = utils.watchCmd(cmd, stop, cwd=cwd, data=data,
-                                   recoveryCallback=recoveryCallback)
-
-    return ret, out, err
+def watchCmd(cmd, stop, cwd=None, data=None):
+    return utils.watchCmd(cmd, stop, cwd=cwd, data=data)
 
 
 class EventTests(TestCaseBase):
diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index b8e59ec..04b3cc3 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -208,8 +208,7 @@
                          force=True)
             try:
                 misc.ddWatchCopy(
-                    "/dev/zero", vol_path, vars.task.aborting, int(size),
-                    recoveryCallback=volume.baseAsyncTasksRollback)
+                    "/dev/zero", vol_path, vars.task.aborting, int(size))
             except utils.ActionStopped:
                 raise
             except Exception:
diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
index 0e11c65..0ba4f1f 100644
--- a/vdsm/storage/misc.py
+++ b/vdsm/storage/misc.py
@@ -331,7 +331,7 @@
     return "".join(random.sample(string.letters, strLen))
 
 
-def ddWatchCopy(src, dst, stop, size, offset=0, recoveryCallback=None):
+def ddWatchCopy(src, dst, stop, size, offset=0):
     """
     Copy src to dst using dd command with stop abilities
     """
@@ -370,7 +370,6 @@
                                      deathSignal=signal.SIGKILL)
         else:
             (rc, out, err) = watchCmd(cmd, stop=stop,
-                                      recoveryCallback=recoveryCallback,
                                       nice=utils.NICENESS.HIGH,
                                       ioclass=utils.IOCLASS.IDLE)
 
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index 4969f1c..60b58fa 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -158,6 +158,9 @@
     def __str__(self):
         return str(self.volUUID)
 
+    # Even if it's not in use anymore we cannot remove this method because
+    # we might have persisted recovery on storage calling it.
+    # TODO: remove this in the next version.
     @classmethod
     def killProcRollback(cls, taskObj, pid, ctime):
         """
@@ -985,14 +988,6 @@
         pass
 
 
-def baseAsyncTasksRollback(proc):
-    name = "Kill-" + str(proc.pid)
-    vars.task.pushRecovery(
-        task.Recovery(name, "volume", "Volume", "killProcRollback",
-                      [str(proc.pid),
-                       str(misc.getProcCtime(proc.pid))]))
-
-
 def qemuRebase(src, srcFormat, backingFile,
                backingFormat, unsafe, stop, rollback):
     """
@@ -1012,11 +1007,7 @@
         cmd += ["-u"]
     cmd += [src]
 
-    recoveryCallback = None
-    if rollback:
-        recoveryCallback = baseAsyncTasksRollback
     (rc, out, err) = misc.watchCmd(cmd, stop=stop, cwd=cwd,
-                                   recoveryCallback=recoveryCallback,
                                    ioclass=utils.IOCLASS.IDLE,
                                    nice=utils.NICENESS.HIGH)
 
@@ -1037,14 +1028,12 @@
             dstvolType == PREALLOCATED_VOL):
         (rc, out, err) = misc.ddWatchCopy(
             src=src, dst=dst,
-            stop=stop, size=size,
-            recoveryCallback=baseAsyncTasksRollback)
+            stop=stop, size=size)
     else:
         cmd = [constants.EXT_QEMUIMG, "convert",
                "-t", "none", "-f", src_fmt, src,
                "-O", dst_fmt, dst]
         (rc, out, err) = misc.watchCmd(cmd, stop=stop,
-                                       recoveryCallback=baseAsyncTasksRollback,
                                        ioclass=utils.IOCLASS.IDLE,
                                        nice=utils.NICENESS.HIGH)
 


-- 
To view, visit http://gerrit.ovirt.org/26872
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9ebbcdb10882ac031712d107485560883c4720a9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to