When multiple job cancel operations are executed at once, there is a
chance for the contention to result in a job still in the canceling
state at timeout time. Ganeti would emit a funny message:

"Job could not be canceled, status JOB_STATUS_CANCELING"

This patch explains what is happening, making the message a bit more
user-friendly. It also makes all the related output consistently use
the American spelling of canceled.

Signed-off-by: Hrvoje Ribicic <[email protected]>
---
 src/Ganeti/JQueue.hs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/Ganeti/JQueue.hs b/src/Ganeti/JQueue.hs
index 5c24d92..fde71dc 100644
--- a/src/Ganeti/JQueue.hs
+++ b/src/Ganeti/JQueue.hs
@@ -583,10 +583,13 @@ waitForJobCancelation jid tmout = do
   jobR <- liftIO $ watchFileBy jobfile tmout finalizedR load
   case calcJobStatus <$> jobR of
     Ok s | s == JOB_STATUS_CANCELED ->
-             return (True, "Job successfully cancelled")
+             return (True, "Job successfully canceled")
          | finalizedR jobR ->
             return (False, "Job exited before it could have been canceled,\
                            \ status " ++ show s)
+         | s == JOB_STATUS_CANCELING ->
+             return (False, "Job cancelation was not completed before the\
+                            \ timeout, but the job may yet be canceled")
          | otherwise ->
              return (False, "Job could not be canceled, status "
                             ++ show s)
-- 
2.6.0.rc2.230.g3dd15c0

Reply via email to