Commit a10a476a authored by Iustin Pop's avatar Iustin Pop
Browse files

htools: add an utility function for disk templates



In the future we'll use this instead of requiring the number of nodes
from the user.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent c4bb977b
......@@ -41,6 +41,7 @@ module Ganeti.HTools.Instance
, specOf
, shrinkByType
, runningStates
, requiredNodes
) where
import qualified Ganeti.HTools.Types as T
......@@ -183,3 +184,8 @@ shrinkByType _ f = T.Bad $ "Unhandled failure mode " ++ show f
specOf :: Instance -> T.RSpec
specOf Instance { mem = m, dsk = d, vcpus = c } =
T.RSpec { T.rspecCpu = c, T.rspecMem = m, T.rspecDsk = d }
-- | Computed the number of nodes for a given disk template
requiredNodes :: T.DiskTemplate -> Int
requiredNodes T.DTDrbd8 = 2
requiredNodes _ = 1
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