Revision c352b0a9 htools/Ganeti/HTools/Instance.hs
b/htools/Ganeti/HTools/Instance.hs | ||
---|---|---|
7 | 7 |
|
8 | 8 |
{- |
9 | 9 |
|
10 |
Copyright (C) 2009, 2010 Google Inc. |
|
10 |
Copyright (C) 2009, 2010, 2011 Google Inc.
|
|
11 | 11 |
|
12 | 12 |
This program is free software; you can redistribute it and/or modify |
13 | 13 |
it under the terms of the GNU General Public License as published by |
... | ... | |
49 | 49 |
-- * Type declarations |
50 | 50 |
|
51 | 51 |
-- | The instance type |
52 |
data Instance = Instance { name :: String -- ^ The instance name |
|
53 |
, alias :: String -- ^ The shortened name |
|
54 |
, mem :: Int -- ^ Memory of the instance |
|
55 |
, dsk :: Int -- ^ Disk size of instance |
|
56 |
, vcpus :: Int -- ^ Number of VCPUs |
|
57 |
, running :: Bool -- ^ Is the instance running? |
|
58 |
, runSt :: String -- ^ Original (text) run status |
|
59 |
, pNode :: T.Ndx -- ^ Original primary node |
|
60 |
, sNode :: T.Ndx -- ^ Original secondary node |
|
61 |
, idx :: T.Idx -- ^ Internal index |
|
62 |
, util :: T.DynUtil -- ^ Dynamic resource usage |
|
63 |
, movable :: Bool -- ^ Can the instance be moved? |
|
64 |
, tags :: [String] -- ^ List of instance tags |
|
65 |
} deriving (Show, Read) |
|
52 |
data Instance = Instance |
|
53 |
{ name :: String -- ^ The instance name |
|
54 |
, alias :: String -- ^ The shortened name |
|
55 |
, mem :: Int -- ^ Memory of the instance |
|
56 |
, dsk :: Int -- ^ Disk size of instance |
|
57 |
, vcpus :: Int -- ^ Number of VCPUs |
|
58 |
, running :: Bool -- ^ Is the instance running? |
|
59 |
, runSt :: String -- ^ Original (text) run status |
|
60 |
, pNode :: T.Ndx -- ^ Original primary node |
|
61 |
, sNode :: T.Ndx -- ^ Original secondary node |
|
62 |
, idx :: T.Idx -- ^ Internal index |
|
63 |
, util :: T.DynUtil -- ^ Dynamic resource usage |
|
64 |
, movable :: Bool -- ^ Can the instance be moved? |
|
65 |
, auto_balance :: Bool -- ^ Is the instance auto-balanced? |
|
66 |
, tags :: [String] -- ^ List of instance tags |
|
67 |
} deriving (Show, Read) |
|
66 | 68 |
|
67 | 69 |
instance T.Element Instance where |
68 | 70 |
nameOf = name |
... | ... | |
88 | 90 |
-- Some parameters are not initialized by function, and must be set |
89 | 91 |
-- later (via 'setIdx' for example). |
90 | 92 |
create :: String -> Int -> Int -> Int -> String |
91 |
-> [String] -> T.Ndx -> T.Ndx -> Instance |
|
92 |
create name_init mem_init dsk_init vcpus_init run_init tags_init pn sn = |
|
93 |
-> [String] -> Bool -> T.Ndx -> T.Ndx -> Instance |
|
94 |
create name_init mem_init dsk_init vcpus_init run_init tags_init |
|
95 |
auto_balance_init pn sn = |
|
93 | 96 |
Instance { name = name_init |
94 | 97 |
, alias = name_init |
95 | 98 |
, mem = mem_init |
... | ... | |
103 | 106 |
, util = T.baseUtil |
104 | 107 |
, tags = tags_init |
105 | 108 |
, movable = True |
109 |
, auto_balance = auto_balance_init |
|
106 | 110 |
} |
107 | 111 |
|
108 | 112 |
-- | Changes the index. |
Also available in: Unified diff