diff --git a/htools/Ganeti/HTools/IAlloc.hs b/htools/Ganeti/HTools/IAlloc.hs index d426aeffa14cf322a99bef23dcf947b0a68f3649..d881921ce906e16683b1548c4b74b30304f0272b 100644 --- a/htools/Ganeti/HTools/IAlloc.hs +++ b/htools/Ganeti/HTools/IAlloc.hs @@ -70,7 +70,7 @@ parseBaseInstance n a = do vcpus <- extract "vcpus" tags <- extract "tags" dt <- extract "disk_template" - return (n, Instance.create n mem disk vcpus Running tags True 0 0 dt) + return (n, Instance.create n mem disk vcpus Running tags True 0 0 dt 1) -- | Parses an instance as found in the cluster instance list. parseInstance :: NameAssoc -- ^ The node name-to-index association list diff --git a/htools/Ganeti/HTools/Instance.hs b/htools/Ganeti/HTools/Instance.hs index 8de3c8bceac13ae6777a894c6b15f548af2da268..269f3209c8d617c443d62cf100d44052594e5bf7 100644 --- a/htools/Ganeti/HTools/Instance.hs +++ b/htools/Ganeti/HTools/Instance.hs @@ -79,6 +79,7 @@ data Instance = Instance , autoBalance :: Bool -- ^ Is the instance auto-balanced? , tags :: [String] -- ^ List of instance tags , diskTemplate :: T.DiskTemplate -- ^ The disk template of the instance + , spindleUsage :: Int -- ^ The numbers of used spindles } deriving (Show, Read, Eq) instance T.Element Instance where @@ -157,9 +158,10 @@ type List = Container.Container Instance -- Some parameters are not initialized by function, and must be set -- later (via 'setIdx' for example). create :: String -> Int -> Int -> Int -> T.InstanceStatus - -> [String] -> Bool -> T.Ndx -> T.Ndx -> T.DiskTemplate -> Instance + -> [String] -> Bool -> T.Ndx -> T.Ndx -> T.DiskTemplate -> Int + -> Instance create name_init mem_init dsk_init vcpus_init run_init tags_init - auto_balance_init pn sn dt = + auto_balance_init pn sn dt su = Instance { name = name_init , alias = name_init , mem = mem_init @@ -174,6 +176,7 @@ create name_init mem_init dsk_init vcpus_init run_init tags_init , movable = supportsMoves dt , autoBalance = auto_balance_init , diskTemplate = dt + , spindleUsage = su } -- | Changes the index. diff --git a/htools/Ganeti/HTools/Luxi.hs b/htools/Ganeti/HTools/Luxi.hs index 77d561472845ce6b4cbbdbe148e6081914ab5816..c484223cc346c18479a9900ef9dce39fa6262d20 100644 --- a/htools/Ganeti/HTools/Luxi.hs +++ b/htools/Ganeti/HTools/Luxi.hs @@ -163,7 +163,7 @@ parseInstance ktn [ name, disk, mem, vcpus xauto_balance <- convert "auto_balance" auto_balance xdt <- convert "disk_template" disk_template let inst = Instance.create xname xmem xdisk xvcpus - xrunning xtags xauto_balance xpnode snode xdt + xrunning xtags xauto_balance xpnode snode xdt 1 return (xname, inst) parseInstance _ v = fail ("Invalid instance query result: " ++ show v) diff --git a/htools/Ganeti/HTools/Program/Hspace.hs b/htools/Ganeti/HTools/Program/Hspace.hs index 9dcd3c8afe1274a75464e8c4f41c89423d2d6410..61c4eea5e2b8020f8674a96baa323cc60a6bbba8 100644 --- a/htools/Ganeti/HTools/Program/Hspace.hs +++ b/htools/Ganeti/HTools/Program/Hspace.hs @@ -389,7 +389,7 @@ runAllocation cdata stop_allocation actual_result spec dt mode opts = do instFromSpec :: RSpec -> DiskTemplate -> Instance.Instance instFromSpec spx disk_template = Instance.create "new" (rspecMem spx) (rspecDsk spx) - (rspecCpu spx) Running [] True (-1) (-1) disk_template + (rspecCpu spx) Running [] True (-1) (-1) disk_template 1 -- | Main function. main :: Options -> [String] -> IO () diff --git a/htools/Ganeti/HTools/QC.hs b/htools/Ganeti/HTools/QC.hs index fb9d7e30e5b83be47bc838b4f761b01a850cf472..e4cd394d02f05b7d7a301015e68c26fac7b186b9 100644 --- a/htools/Ganeti/HTools/QC.hs +++ b/htools/Ganeti/HTools/QC.hs @@ -175,7 +175,7 @@ setInstanceSmallerThanNode node inst = -- | Create an instance given its spec. createInstance mem dsk vcpus = Instance.create "inst-unnamed" mem dsk vcpus Types.Running [] True (-1) (-1) - Types.DTDrbd8 + Types.DTDrbd8 1 -- | Create a small cluster by repeating a node spec. makeSmallCluster :: Node.Node -> Int -> Node.List @@ -313,7 +313,7 @@ genInstanceSmallerThan lim_mem lim_dsk lim_cpu = do sn <- arbitrary vcpus <- choose (0, lim_cpu) return $ Instance.create name mem dsk vcpus run_st [] True pn sn - Types.DTDrbd8 + Types.DTDrbd8 1 -- | Generates an instance smaller than a node. genInstanceSmallerThanNode :: Node.Node -> Gen Instance.Instance diff --git a/htools/Ganeti/HTools/Rapi.hs b/htools/Ganeti/HTools/Rapi.hs index e9f82a310147f957edef007ba1e547cd73f8fb5f..bae15661d1e52b28eefd8022d8b32c6d6c75408e 100644 --- a/htools/Ganeti/HTools/Rapi.hs +++ b/htools/Ganeti/HTools/Rapi.hs @@ -124,7 +124,7 @@ parseInstance ktn a = do auto_balance <- extract "auto_balance" beparams dt <- extract "disk_template" a let inst = Instance.create name mem disk vcpus running tags - auto_balance pnode snode dt + auto_balance pnode snode dt 1 return (name, inst) -- | Construct a node from a JSON object. diff --git a/htools/Ganeti/HTools/Text.hs b/htools/Ganeti/HTools/Text.hs index 4c861fabe050c03c1589e17ee0f6b52ab8e0fb3a..fc943e996eb9bf60a5ae6bda5b856703c5fcb3f4 100644 --- a/htools/Ganeti/HTools/Text.hs +++ b/htools/Ganeti/HTools/Text.hs @@ -226,7 +226,7 @@ loadInst ktn [ name, mem, dsk, vcpus, status, auto_bal, pnode, snode " has same primary and secondary node - " ++ pnode let vtags = commaSplit tags newinst = Instance.create name vmem vdsk vvcpus vstatus vtags - auto_balance pidx sidx disk_template + auto_balance pidx sidx disk_template 1 return (name, newinst) loadInst _ s = fail $ "Invalid/incomplete instance data: '" ++ show s ++ "'"