On Fri, Aug 07, 2015 at 06:20:36PM +0200, 'Klaus Aehlig' via ganeti-devel wrote:
However, short-cut them and return the empty list
directly, as we do not need to do any change to the
serial file.
Note that allocating 0 jobs has legitimate use cases,
like gnt-node migrate on an empty node. Doing so
without complaining in line with the behaviour of
earlier Ganeti versions.
Signed-off-by: Klaus Aehlig <[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 ecdd7b0..dad9e54 100644
--- a/src/Ganeti/JQueue.hs
+++ b/src/Ganeti/JQueue.hs
@@ -503,7 +503,10 @@ readSerialFromDisk = do
allocateJobIds :: [Node] -> Lock -> Int -> IO (Result [JobId])
allocateJobIds mastercandidates lock n =
if n <= 0
- then return . Bad $ "Can only allocate positive number of job ids"
+ then if n ==0
Just nitpicking, to keep consistent style I'd suggest `n == 0`
No need to resend.
+ then return $ Ok []
+ else return . Bad
+ $ "Can only allocate non-negative number of job ids"
else withLock lock $ do
rjobid <- readSerialFromDisk
case rjobid of
--
2.5.0.rc2.392.g76e840b
LGTM, thanks