Revision be468da0
b/htools/Ganeti/HTools/CLI.hs | ||
---|---|---|
134 | 134 |
, optShowInsts :: Bool -- ^ Whether to show the instance map |
135 | 135 |
, optShowNodes :: Maybe [String] -- ^ Whether to show node status |
136 | 136 |
, optShowVer :: Bool -- ^ Just show the program version |
137 |
, optStdSpec :: RSpec -- ^ Requested standard specs
|
|
137 |
, optStdSpec :: Maybe RSpec -- ^ Requested standard specs
|
|
138 | 138 |
, optTieredSpec :: Maybe RSpec -- ^ Requested specs for tiered mode |
139 | 139 |
, optReplay :: Maybe String -- ^ Unittests: RNG state |
140 | 140 |
, optVerbose :: Int -- ^ Verbosity level |
... | ... | |
173 | 173 |
, optShowInsts = False |
174 | 174 |
, optShowNodes = Nothing |
175 | 175 |
, optShowVer = False |
176 |
, optStdSpec = RSpec 1 4096 102400
|
|
176 |
, optStdSpec = Nothing
|
|
177 | 177 |
, optTieredSpec = Nothing |
178 | 178 |
, optReplay = Nothing |
179 | 179 |
, optVerbose = 1 |
... | ... | |
383 | 383 |
oStdSpec = Option "" ["standard-alloc"] |
384 | 384 |
(ReqArg (\ inp opts -> do |
385 | 385 |
tspec <- parseISpecString "standard" inp |
386 |
return $ opts { optStdSpec = tspec } ) |
|
386 |
return $ opts { optStdSpec = Just tspec } )
|
|
387 | 387 |
"STDSPEC") |
388 | 388 |
"enable standard specs allocation, given as 'disk,ram,cpu'" |
389 | 389 |
|
b/htools/Ganeti/HTools/Program/Hspace.hs | ||
---|---|---|
29 | 29 |
import Data.Char (toUpper, isAlphaNum, toLower) |
30 | 30 |
import Data.Function (on) |
31 | 31 |
import Data.List |
32 |
import Data.Maybe (fromMaybe) |
|
32 | 33 |
import Data.Ord (comparing) |
33 | 34 |
import System.Exit |
34 | 35 |
import System.IO |
... | ... | |
398 | 399 |
exitWith $ ExitFailure 1 |
399 | 400 |
|
400 | 401 |
let verbose = optVerbose opts |
401 |
ispec = optStdSpec opts |
|
402 | 402 |
disk_template = optDiskTemplate opts |
403 | 403 |
req_nodes = Instance.requiredNodes disk_template |
404 | 404 |
machine_r = optMachineReadable opts |
405 | 405 |
|
406 |
orig_cdata@(ClusterData gl fixed_nl il _ _) <- loadExternalData opts
|
|
406 |
orig_cdata@(ClusterData gl fixed_nl il _ ipol) <- loadExternalData opts
|
|
407 | 407 |
nl <- setNodeStatus opts fixed_nl |
408 | 408 |
|
409 | 409 |
let num_instances = Container.size il |
... | ... | |
431 | 431 |
|
432 | 432 |
allocnodes <- exitIfBad $ Cluster.genAllocNodes gl nl req_nodes True |
433 | 433 |
|
434 |
-- Run the tiered allocation, if enabled
|
|
434 |
-- Run the tiered allocation |
|
435 | 435 |
|
436 |
case optTieredSpec opts of |
|
437 |
Nothing -> return () |
|
438 |
Just tspec -> do |
|
439 |
(treason, trl_nl, _, spec_map) <- |
|
440 |
runAllocation cdata stop_allocation |
|
441 |
(Cluster.tieredAlloc nl il alloclimit |
|
442 |
(instFromSpec tspec disk_template) allocnodes [] []) |
|
443 |
tspec SpecTiered opts |
|
436 |
let tspec = fromMaybe (rspecFromISpec (iPolicyMaxSpec ipol)) |
|
437 |
(optTieredSpec opts) |
|
444 | 438 |
|
445 |
printTiered machine_r spec_map (optMcpu opts) nl trl_nl treason |
|
439 |
(treason, trl_nl, _, spec_map) <- |
|
440 |
runAllocation cdata stop_allocation |
|
441 |
(Cluster.tieredAlloc nl il alloclimit |
|
442 |
(instFromSpec tspec disk_template) allocnodes [] []) |
|
443 |
tspec SpecTiered opts |
|
444 |
|
|
445 |
printTiered machine_r spec_map (optMcpu opts) nl trl_nl treason |
|
446 | 446 |
|
447 | 447 |
-- Run the standard (avg-mode) allocation |
448 | 448 |
|
449 |
let ispec = fromMaybe (rspecFromISpec (iPolicyStdSpec ipol)) |
|
450 |
(optStdSpec opts) |
|
451 |
|
|
449 | 452 |
(sreason, fin_nl, allocs, _) <- |
450 | 453 |
runAllocation cdata stop_allocation |
451 | 454 |
(Cluster.iterateAlloc nl il alloclimit |
... | ... | |
454 | 457 |
|
455 | 458 |
printResults machine_r nl fin_nl num_instances allocs sreason |
456 | 459 |
|
460 |
-- Print final result |
|
461 |
|
|
457 | 462 |
printFinal machine_r |
b/man/hspace.rst | ||
---|---|---|
44 | 44 |
DESCRIPTION |
45 | 45 |
----------- |
46 | 46 |
|
47 |
|
|
48 | 47 |
hspace computes how many additional instances can be fit on a cluster, |
49 | 48 |
while maintaining N+1 status. |
50 | 49 |
|
... | ... | |
61 | 60 |
output the additional information on stderr (such that the stdout is |
62 | 61 |
still parseable). |
63 | 62 |
|
63 |
By default, the instance specifications will be read from the cluster; |
|
64 |
the options ``--standard-alloc`` and ``--tiered-alloc`` can be used to |
|
65 |
override them. |
|
66 |
|
|
64 | 67 |
The following keys are available in the machine-readable output of the |
65 | 68 |
script (all prefixed with *HTS_*): |
66 | 69 |
|
... | ... | |
132 | 135 |
Like the above but for disk. |
133 | 136 |
|
134 | 137 |
TSPEC |
135 |
If the tiered allocation mode has been enabled, this parameter holds |
|
136 |
the pairs of specifications and counts of instances that can be |
|
137 |
created in this mode. The value of the key is a space-separated list |
|
138 |
of values; each value is of the form *memory,disk,vcpu=count* where |
|
139 |
the memory, disk and vcpu are the values for the current spec, and |
|
140 |
count is how many instances of this spec can be created. A complete |
|
141 |
value for this variable could be: **4096,102400,2=225 |
|
142 |
2560,102400,2=20 512,102400,2=21**. |
|
138 |
This parameter holds the pairs of specifications and counts of |
|
139 |
instances that can be created in the *tiered allocation* mode. The |
|
140 |
value of the key is a space-separated list of values; each value is of |
|
141 |
the form *memory,disk,vcpu=count* where the memory, disk and vcpu are |
|
142 |
the values for the current spec, and count is how many instances of |
|
143 |
this spec can be created. A complete value for this variable could be: |
|
144 |
**4096,102400,2=225 2560,102400,2=20 512,102400,2=21**. |
|
143 | 145 |
|
144 | 146 |
KM_USED_CPU, KM_USED_NPU, KM_USED_MEM, KM_USED_DSK |
145 | 147 |
These represents the metrics of used resources at the start of the |
... | ... | |
189 | 191 |
that the computation failed and any values present should not be |
190 | 192 |
relied upon. |
191 | 193 |
|
192 |
If the tiered allocation mode is enabled, then many of the INI_/FIN_ |
|
193 |
metrics will be also displayed with a TRL_ prefix, and denote the |
|
194 |
cluster status at the end of the tiered allocation run. |
|
194 |
Many of the INI_/FIN_ metrics will be also displayed with a TRL_ prefix, |
|
195 |
and denote the cluster status at the end of the tiered allocation run. |
|
195 | 196 |
|
196 | 197 |
The human output format should be self-explanatory, so it is not |
197 | 198 |
described further. |
... | ... | |
274 | 275 |
about the description, see the man page **htools**(1). |
275 | 276 |
|
276 | 277 |
--standard-alloc *disk,ram,cpu* |
277 |
This option specifies the instance size for the *standard* allocation
|
|
278 |
mode, where we simply allocate instances of the same, fixed size until
|
|
279 |
the cluster runs out of space. |
|
278 |
This option overrides the instance size read from the cluster for the
|
|
279 |
*standard* allocation mode, where we simply allocate instances of the
|
|
280 |
same, fixed size until the cluster runs out of space.
|
|
280 | 281 |
|
281 | 282 |
The specification given is similar to the *--simulate* option and it |
282 | 283 |
holds: |
... | ... | |
289 | 290 |
specification of 100GB of disk space, 4GiB of memory and 2 VCPUs. |
290 | 291 |
|
291 | 292 |
--tiered-alloc *disk,ram,cpu* |
292 |
Besides the standard, fixed-size allocation, also do a tiered
|
|
293 |
allocation scheme where the algorithm starts from the given
|
|
294 |
specification and allocates until there is no more space; then it
|
|
295 |
decreases the specification and tries the allocation again. The
|
|
296 |
decrease is done on the metric that last failed during allocation. The
|
|
297 |
argument should have the same format as for ``-standard-alloc``.
|
|
293 |
This option overrides the instance size for the *tiered* allocation
|
|
294 |
mode. In this mode, the algorithm starts from the given specification
|
|
295 |
and allocates until there is no more space; then it decreases the
|
|
296 |
specification and tries the allocation again. The decrease is done on
|
|
297 |
the metric that last failed during allocation. The argument should
|
|
298 |
have the same format as for ``--standard-alloc``.
|
|
298 | 299 |
|
299 | 300 |
Also note that the normal allocation and the tiered allocation are |
300 | 301 |
independent, and both start from the initial cluster state; as such, |
301 | 302 |
the instance count for these two modes are not related one to |
302 | 303 |
another. |
303 | 304 |
|
304 |
--machines-readable[=*choice*]
|
|
305 |
--machine-readable[=*choice*] |
|
305 | 306 |
By default, the output of the program is in "human-readable" format, |
306 | 307 |
i.e. text descriptions. By passing this flag you can either enable |
307 | 308 |
(``--machine-readable`` or ``--machine-readable=yes``) or explicitly |
Also available in: Unified diff