X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/040afc3532b84536c926a1bafa4252f9364e260e..b513faa10514ee88b3166539288976eeccded381:/Ganeti/HTools/Instance.hs diff --git a/Ganeti/HTools/Instance.hs b/Ganeti/HTools/Instance.hs index 96a7afe..8aecf72 100644 --- a/Ganeti/HTools/Instance.hs +++ b/Ganeti/HTools/Instance.hs @@ -6,7 +6,8 @@ intelligence is in the "Node" and "Cluster" modules. -} module Ganeti.HTools.Instance where -data Instance = Instance { mem :: Int -- ^ memory of the instance +data Instance = Instance { name :: String -- ^ the instance name + , mem :: Int -- ^ memory of the instance , dsk :: Int -- ^ disk size of instance , running :: Bool -- ^ whether the instance -- is running @@ -20,9 +21,10 @@ data Instance = Instance { mem :: Int -- ^ memory of the instance -- | A simple name for the int, instance association list type AssocList = [(Int, Instance)] -create :: Int -> Int -> String -> Int -> Int -> Instance -create mem_init dsk_init run_init pn sn = +create :: String -> Int -> Int -> String -> Int -> Int -> Instance +create name_init mem_init dsk_init run_init pn sn = Instance { + name = name_init, mem = mem_init, dsk = dsk_init, running = case run_init of @@ -60,3 +62,7 @@ setIdx :: Instance -- ^ the original instance -> Int -- ^ new index -> Instance -- ^ the modified instance setIdx t i = t { idx = i } + +-- | Changes the name +-- This is used only during the building of the data structures. +setName t s = t {name = s}