X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/669d7e3d1ce8f832a7ff4b11de4f2bcab9494c27..7e7f6ca279206f095cfbc1d51fdbb622446f503e:/Ganeti/HTools/Instance.hs diff --git a/Ganeti/HTools/Instance.hs b/Ganeti/HTools/Instance.hs index 0e5d965..d115742 100644 --- a/Ganeti/HTools/Instance.hs +++ b/Ganeti/HTools/Instance.hs @@ -6,21 +6,31 @@ intelligence is in the "Node" and "Cluster" modules. -} module Ganeti.HTools.Instance where -data Instance = Instance { mem :: Int -- ^ memory of the instance - , dsk :: Int -- ^ disk size of instance - , pnode :: Int -- ^ original primary node - , snode :: Int -- ^ original secondary node - , idx :: Int -- ^ internal index for book-keeping +data Instance = Instance { mem :: Int -- ^ memory of the instance + , dsk :: Int -- ^ disk size of instance + , running :: Bool -- ^ whether the instance + -- is running + , run_st :: String -- ^ original (text) run status + , pnode :: Int -- ^ original primary node + , snode :: Int -- ^ original secondary node + , idx :: Int -- ^ internal index for + -- book-keeping } deriving (Show) -create :: String -> String -> Int -> Int -> Instance -create mem_init dsk_init pn sn = Instance { - mem = read mem_init, - dsk = read dsk_init, - pnode = pn, - snode = sn, - idx = -1 - } +create :: Int -> Int -> String -> Int -> Int -> Instance +create mem_init dsk_init run_init pn sn = + Instance { + mem = mem_init, + dsk = dsk_init, + running = case run_init of + "running" -> True + "ERROR_up" -> True + _ -> False, + run_st = run_init, + pnode = pn, + snode = sn, + idx = -1 + } -- | Changes the primary node of the instance. setPri :: Instance -- ^ the original instance