Commit 304f9292 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add a helper function converting ispecs to rspecs



The rspec type is simpler than the ispec one; most likely it should be
deprecated later.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 8564fb47
......@@ -75,6 +75,7 @@ module Ganeti.HTools.Types
, ISpec(..)
, IPolicy(..)
, defIPolicy
, rspecFromISpec
) where
import qualified Data.Map as M
......@@ -187,6 +188,13 @@ $(THH.buildObject "IPolicy" "iPolicy"
, THH.renameField "MaxSpec" $ THH.simpleField "max" [t| ISpec |]
])
-- | Converts an ISpec type to a RSpec one.
rspecFromISpec :: ISpec -> RSpec
rspecFromISpec ispec = RSpec { rspecCpu = iSpecCpuCount ispec
, rspecMem = iSpecMemorySize ispec
, rspecDsk = iSpecDiskSize ispec
}
-- | The default instance policy.
defIPolicy :: IPolicy
defIPolicy = IPolicy { iPolicyStdSpec = defStdISpec
......
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