[Pkg-ganeti-devel] [ganeti] 37/165: Make hail respect dedicated allocation

Apollon Oikonomopoulos apoikos at moszumanska.debian.org
Tue Aug 11 13:53:11 UTC 2015


This is an automated email from the git hooks/post-receive script.

apoikos pushed a commit to branch master
in repository ganeti.

commit 2028c77c6bb7306db8e9b8cbafd88c8db54ab182
Author: Klaus Aehlig <aehlig at google.com>
Date:   Thu Jan 22 15:06:12 2015 +0100

    Make hail respect dedicated allocation
    
    In hail, if allocation on a dedicated cluster is requested,
    follow the strategy for dedicated clusters when placing the
    new instance.
    
    As this changes the allocation preference, relax the
    already existing tests for dedicated allocation.
    
    Signed-off-by: Klaus Aehlig <aehlig at google.com>
    Reviewed-by: Petr Pudlak <pudlak at google.com>
---
 src/Ganeti/HTools/Program/Hail.hs   | 15 +++++++++++++--
 test/hs/shelltests/htools-hail.test |  2 +-
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/Ganeti/HTools/Program/Hail.hs b/src/Ganeti/HTools/Program/Hail.hs
index 6a90bb2..640f12b 100644
--- a/src/Ganeti/HTools/Program/Hail.hs
+++ b/src/Ganeti/HTools/Program/Hail.hs
@@ -44,11 +44,12 @@ import System.IO
 
 import qualified Ganeti.HTools.AlgorithmParams as Alg
 import qualified Ganeti.HTools.Cluster as Cluster
+import qualified Ganeti.HTools.Dedicated as Dedicated
 
 import Ganeti.Common
 import Ganeti.HTools.CLI
 import Ganeti.HTools.Backend.IAlloc
-import Ganeti.HTools.Loader (Request(..), ClusterData(..))
+import Ganeti.HTools.Loader (Request(..), ClusterData(..), isAllocationRequest)
 import Ganeti.HTools.ExtLoader (maybeSaveData, loadExternalData
                                , queryAllMonDDCs)
 import Ganeti.Utils
@@ -106,12 +107,22 @@ main opts args = do
   when (verbose > 2) .
        hPutStrLn stderr $ "Received cluster data: " ++ show cdata
 
+  let dedicatedAlloc = maybe False (Dedicated.isDedicated cdata)
+                       $ isAllocationRequest rq
+
+  when (verbose > 1 && dedicatedAlloc) $
+      hPutStrLn stderr "Allocation on a dedicated cluster;\
+                       \ using lost-allocations metrics."
+
   maybePrintNodes shownodes "Initial cluster"
        (Cluster.printNodes (cdNodes cdata))
 
   maybeSaveData savecluster "pre-ialloc" "before iallocator run" cdata
 
-  let (maybe_ni, resp) = runIAllocator (Alg.fromCLIOptions opts) request
+  let runAlloc = if dedicatedAlloc
+                   then Dedicated.runDedicatedAllocation
+                   else runIAllocator
+      (maybe_ni, resp) = runAlloc (Alg.fromCLIOptions opts) request
       (fin_nl, fin_il) = fromMaybe (cdNodes cdata, cdInstances cdata) maybe_ni
   putStrLn resp
 
diff --git a/test/hs/shelltests/htools-hail.test b/test/hs/shelltests/htools-hail.test
index be035c4..45e813b 100644
--- a/test/hs/shelltests/htools-hail.test
+++ b/test/hs/shelltests/htools-hail.test
@@ -64,7 +64,7 @@ cat $TESTDATA_DIR/hail-alloc-invalid-network.json | grep -v -e '"network":"uuid-
 
 # Run some of the tests above, with exclusive storage enabled
 ./test/hs/hail $T/hail-alloc-drbd.json.excl-stor
->>> /"success":true,.*,"result":\["node2","node1"\]/
+>>> /"success":true,.*,"result":\["node.","node."\]/
 >>>= 0
 
 ./test/hs/hail $T/hail-reloc-drbd.json.excl-stor

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ganeti/ganeti.git



More information about the Pkg-ganeti-devel mailing list