Revision 6bc39970
b/Ganeti/HTools/Cluster.hs | ||
---|---|---|
51 | 51 |
, doNextBalance |
52 | 52 |
, tryBalance |
53 | 53 |
, compCV |
54 |
, compDetailedCV |
|
54 | 55 |
, printStats |
55 | 56 |
, iMoveToJob |
56 | 57 |
-- * IAllocator functions |
... | ... | |
102 | 103 |
|
103 | 104 |
-- | The complete state for the balancing solution |
104 | 105 |
data Table = Table Node.List Instance.List Score [Placement] |
105 |
deriving (Show) |
|
106 |
deriving (Show, Read)
|
|
106 | 107 |
|
107 | 108 |
data CStats = CStats { csFmem :: Int -- ^ Cluster free mem |
108 | 109 |
, csFdsk :: Int -- ^ Cluster free disk |
... | ... | |
126 | 127 |
, csScore :: Score -- ^ The cluster score |
127 | 128 |
, csNinst :: Int -- ^ The total number of instances |
128 | 129 |
} |
129 |
deriving (Show) |
|
130 |
deriving (Show, Read)
|
|
130 | 131 |
|
131 | 132 |
-- | Currently used, possibly to allocate, unallocable |
132 | 133 |
type AllocStats = (RSpec, RSpec, RSpec) |
b/Ganeti/HTools/Group.hs | ||
---|---|---|
44 | 44 |
, uuid :: T.GroupID -- ^ The UUID of the group |
45 | 45 |
, idx :: T.Gdx -- ^ Internal index for book-keeping |
46 | 46 |
, allocPolicy :: T.AllocPolicy -- ^ The allocation policy for this group |
47 |
} deriving (Show, Eq) |
|
47 |
} deriving (Show, Read, Eq)
|
|
48 | 48 |
|
49 | 49 |
-- Note: we use the name as the alias, and the UUID as the official |
50 | 50 |
-- name |
b/Ganeti/HTools/Instance.hs | ||
---|---|---|
7 | 7 |
|
8 | 8 |
{- |
9 | 9 |
|
10 |
Copyright (C) 2009 Google Inc. |
|
10 |
Copyright (C) 2009, 2010 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 |
... | ... | |
62 | 62 |
, util :: T.DynUtil -- ^ Dynamic resource usage |
63 | 63 |
, movable :: Bool -- ^ Can the instance be moved? |
64 | 64 |
, tags :: [String] -- ^ List of instance tags |
65 |
} deriving (Show) |
|
65 |
} deriving (Show, Read)
|
|
66 | 66 |
|
67 | 67 |
instance T.Element Instance where |
68 | 68 |
nameOf = name |
b/Ganeti/HTools/Loader.hs | ||
---|---|---|
70 | 70 |
| Relocate Idx Int [Ndx] -- ^ Move an instance to a new |
71 | 71 |
-- secondary node |
72 | 72 |
| Evacuate [Ndx] -- ^ Evacuate nodes |
73 |
deriving (Show) |
|
73 |
deriving (Show, Read)
|
|
74 | 74 |
|
75 | 75 |
-- | A complete request, as received from Ganeti. |
76 | 76 |
data Request = Request RqType ClusterData |
77 |
deriving (Show) |
|
77 |
deriving (Show, Read)
|
|
78 | 78 |
|
79 | 79 |
-- | The cluster state. |
80 | 80 |
data ClusterData = ClusterData |
... | ... | |
82 | 82 |
, cdNodes :: Node.List -- ^ The node list |
83 | 83 |
, cdInstances :: Instance.List -- ^ The instance list |
84 | 84 |
, cdTags :: [String] -- ^ The cluster tags |
85 |
} deriving (Show) |
|
85 |
} deriving (Show, Read)
|
|
86 | 86 |
|
87 | 87 |
-- | An empty cluster. |
88 | 88 |
emptyCluster :: ClusterData |
b/Ganeti/HTools/Node.hs | ||
---|---|---|
122 | 122 |
, utilLoad :: T.DynUtil -- ^ Sum of instance utilisation |
123 | 123 |
, pTags :: TagMap -- ^ Map of primary instance tags and their count |
124 | 124 |
, group :: T.Gdx -- ^ The node's group (index) |
125 |
} deriving (Show, Eq) |
|
125 |
} deriving (Show, Read, Eq)
|
|
126 | 126 |
|
127 | 127 |
instance T.Element Node where |
128 | 128 |
nameOf = name |
b/Ganeti/HTools/Types.hs | ||
---|---|---|
98 | 98 |
-- last-resort, after the preferred groups |
99 | 99 |
| AllocUnallocable -- ^ This group must not be used for new |
100 | 100 |
-- allocations |
101 |
deriving (Show, Eq, Ord) |
|
101 |
deriving (Show, Read, Eq, Ord)
|
|
102 | 102 |
|
103 | 103 |
-- | Convert a string to an alloc policy |
104 | 104 |
apolFromString :: (Monad m) => String -> m AllocPolicy |
... | ... | |
127 | 127 |
{ rspecCpu :: Int -- ^ Requested VCPUs |
128 | 128 |
, rspecMem :: Int -- ^ Requested memory |
129 | 129 |
, rspecDsk :: Int -- ^ Requested disk |
130 |
} deriving (Show, Eq) |
|
130 |
} deriving (Show, Read, Eq)
|
|
131 | 131 |
|
132 | 132 |
-- | The dynamic resource specs of a machine (i.e. load or load |
133 | 133 |
-- capacity, as opposed to size). |
... | ... | |
136 | 136 |
, memWeight :: Weight -- ^ Standardised memory load |
137 | 137 |
, dskWeight :: Weight -- ^ Standardised disk I\/O usage |
138 | 138 |
, netWeight :: Weight -- ^ Standardised network usage |
139 |
} deriving (Show, Eq) |
|
139 |
} deriving (Show, Read, Eq)
|
|
140 | 140 |
|
141 | 141 |
-- | Initial empty utilisation |
142 | 142 |
zeroUtil :: DynUtil |
... | ... | |
166 | 166 |
| ReplaceSecondary Ndx -- ^ Replace secondary (r:ns) |
167 | 167 |
| ReplaceAndFailover Ndx -- ^ Replace secondary, failover (r:np, f) |
168 | 168 |
| FailoverAndReplace Ndx -- ^ Failover, replace secondary (f, r:ns) |
169 |
deriving (Show) |
|
169 |
deriving (Show, Read)
|
|
170 | 170 |
|
171 | 171 |
-- | Formatted solution output for one move (involved nodes and |
172 | 172 |
-- commands |
... | ... | |
217 | 217 |
data Result a |
218 | 218 |
= Bad String |
219 | 219 |
| Ok a |
220 |
deriving (Show) |
|
220 |
deriving (Show, Read)
|
|
221 | 221 |
|
222 | 222 |
instance Monad Result where |
223 | 223 |
(>>=) (Bad x) _ = Bad x |
... | ... | |
240 | 240 |
| FailCPU -- ^ Failed due to not enough CPU capacity |
241 | 241 |
| FailN1 -- ^ Failed due to not passing N1 checks |
242 | 242 |
| FailTags -- ^ Failed due to tag exclusion |
243 |
deriving (Eq, Enum, Bounded, Show) |
|
243 |
deriving (Eq, Enum, Bounded, Show, Read)
|
|
244 | 244 |
|
245 | 245 |
-- | List with failure statistics |
246 | 246 |
type FailStats = [(FailMode, Int)] |
... | ... | |
248 | 248 |
-- | Either-like data-type customized for our failure modes |
249 | 249 |
data OpResult a = OpFail FailMode -- ^ Failed operation |
250 | 250 |
| OpGood a -- ^ Success operation |
251 |
deriving (Show) |
|
251 |
deriving (Show, Read)
|
|
252 | 252 |
|
253 | 253 |
instance Monad OpResult where |
254 | 254 |
(OpGood x) >>= fn = fn x |
b/Ganeti/Jobs.hs | ||
---|---|---|
4 | 4 |
|
5 | 5 |
{- |
6 | 6 |
|
7 |
Copyright (C) 2009 Google Inc. |
|
7 |
Copyright (C) 2009, 2010 Google Inc.
|
|
8 | 8 |
|
9 | 9 |
This program is free software; you can redistribute it and/or modify |
10 | 10 |
it under the terms of the GNU General Public License as published by |
... | ... | |
38 | 38 |
| OP_STATUS_CANCELED |
39 | 39 |
| OP_STATUS_SUCCESS |
40 | 40 |
| OP_STATUS_ERROR |
41 |
deriving (Eq, Enum, Bounded, Show) |
|
41 |
deriving (Eq, Enum, Bounded, Show, Read)
|
|
42 | 42 |
|
43 | 43 |
instance JSON OpStatus where |
44 | 44 |
showJSON os = showJSON w |
... | ... | |
70 | 70 |
| JOB_STATUS_CANCELING |
71 | 71 |
| JOB_STATUS_CANCELED |
72 | 72 |
| JOB_STATUS_ERROR |
73 |
deriving (Eq, Enum, Ord, Bounded, Show) |
|
73 |
deriving (Eq, Enum, Ord, Bounded, Show, Read)
|
|
74 | 74 |
|
75 | 75 |
instance JSON JobStatus where |
76 | 76 |
showJSON js = showJSON w |
b/Ganeti/Luxi.hs | ||
---|---|---|
76 | 76 |
| CancelJob Int |
77 | 77 |
| SetDrainFlag Bool |
78 | 78 |
| SetWatcherPause Double |
79 |
deriving (Show) |
|
79 |
deriving (Show, Read)
|
|
80 | 80 |
|
81 | 81 |
-- | The serialisation of LuxiOps into strings in messages. |
82 | 82 |
strOfOp :: LuxiOp -> String |
b/Ganeti/OpCodes.hs | ||
---|---|---|
4 | 4 |
|
5 | 5 |
{- |
6 | 6 |
|
7 |
Copyright (C) 2009 Google Inc. |
|
7 |
Copyright (C) 2009, 2010 Google Inc.
|
|
8 | 8 |
|
9 | 9 |
This program is free software; you can redistribute it and/or modify |
10 | 10 |
it under the terms of the GNU General Public License as published by |
... | ... | |
40 | 40 |
| ReplaceOnSecondary |
41 | 41 |
| ReplaceNewSecondary |
42 | 42 |
| ReplaceAuto |
43 |
deriving (Show, Eq) |
|
43 |
deriving (Show, Read, Eq)
|
|
44 | 44 |
|
45 | 45 |
instance JSON ReplaceDisksMode where |
46 | 46 |
showJSON m = case m of |
... | ... | |
60 | 60 |
[Int] (Maybe String) |
61 | 61 |
| OpFailoverInstance String Bool |
62 | 62 |
| OpMigrateInstance String Bool Bool |
63 |
deriving (Show, Eq) |
|
63 |
deriving (Show, Read, Eq)
|
|
64 | 64 |
|
65 | 65 |
|
66 | 66 |
opID :: OpCode -> String |
Also available in: Unified diff