Statistics
| Branch: | Tag: | Revision:

root / man / hspace.rst @ d6f05205

History | View | Annotate | Download (13.8 kB)

1
HSPACE(1) Ganeti | Version @GANETI_VERSION@
2
===========================================
3

    
4
NAME
5
----
6

    
7
hspace - Cluster space analyzer for Ganeti
8

    
9
SYNOPSIS
10
--------
11

    
12
**hspace** {backend options...} [algorithm options...] [request options...]
13
[output options...] [-v... | -q]
14

    
15
**hspace** \--version
16

    
17
Backend options:
18

    
19
{ **-m** *cluster* | **-L[** *path* **] [-X]** | **-t** *data-file* |
20
**\--simulate** *spec* | **-I** *path* }
21

    
22

    
23
Algorithm options:
24

    
25
**[ \--max-cpu *cpu-ratio* ]**
26
**[ \--min-disk *disk-ratio* ]**
27
**[ -O *name...* ]**
28

    
29

    
30
Request options:
31

    
32
**[\--disk-template** *template* **]**
33

    
34
**[\--standard-alloc** *disk,ram,cpu*  **]**
35

    
36
**[\--tiered-alloc** *disk,ram,cpu* **]**
37

    
38
Output options:
39

    
40
**[\--machine-readable**[=*CHOICE*] **]**
41
**[-p**[*fields*]**]**
42

    
43

    
44
DESCRIPTION
45
-----------
46

    
47
hspace computes how many additional instances can be fit on a cluster,
48
while maintaining N+1 status.
49

    
50
The program will try to place instances, all of the same size, on the
51
cluster, until the point where we don't have any N+1 possible
52
allocation. It uses the exact same allocation algorithm as the hail
53
iallocator plugin in *allocate* mode.
54

    
55
The output of the program is designed either for human consumption (the
56
default) or, when enabled with the ``--machine-readable`` option
57
(described further below), for machine consumption. In the latter case,
58
it is intended to interpreted as a shell fragment (or parsed as a
59
*key=value* file). Options which extend the output (e.g. -p, -v) will
60
output the additional information on stderr (such that the stdout is
61
still parseable).
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

    
67
The following keys are available in the machine-readable output of the
68
script (all prefixed with *HTS_*):
69

    
70
SPEC_MEM, SPEC_DSK, SPEC_CPU, SPEC_RQN, SPEC_DISK_TEMPLATE, SPEC_SPN
71
  These represent the specifications of the instance model used for
72
  allocation (the memory, disk, cpu, requested nodes, disk template,
73
  spindles).
74

    
75
TSPEC_INI_MEM, TSPEC_INI_DSK, TSPEC_INI_CPU, ...
76
  Only defined when the tiered mode allocation is enabled, these are
77
  similar to the above specifications but show the initial starting spec
78
  for tiered allocation.
79

    
80
CLUSTER_MEM, CLUSTER_DSK, CLUSTER_CPU, CLUSTER_NODES, CLUSTER_SPN
81
  These represent the total memory, disk, CPU count, total nodes, and
82
  total spindles in the cluster.
83

    
84
INI_SCORE, FIN_SCORE
85
  These are the initial (current) and final cluster score (see the hbal
86
  man page for details about the scoring algorithm).
87

    
88
INI_INST_CNT, FIN_INST_CNT
89
  The initial and final instance count.
90

    
91
INI_MEM_FREE, FIN_MEM_FREE
92
  The initial and final total free memory in the cluster (but this
93
  doesn't necessarily mean available for use).
94

    
95
INI_MEM_AVAIL, FIN_MEM_AVAIL
96
  The initial and final total available memory for allocation in the
97
  cluster. If allocating redundant instances, new instances could
98
  increase the reserved memory so it doesn't necessarily mean the
99
  entirety of this memory can be used for new instance allocations.
100

    
101
INI_MEM_RESVD, FIN_MEM_RESVD
102
  The initial and final reserved memory (for redundancy/N+1 purposes).
103

    
104
INI_MEM_INST, FIN_MEM_INST
105
  The initial and final memory used for instances (actual runtime used
106
  RAM).
107

    
108
INI_MEM_OVERHEAD, FIN_MEM_OVERHEAD
109
  The initial and final memory overhead, i.e. memory used for the node
110
  itself and unaccounted memory (e.g. due to hypervisor overhead).
111

    
112
INI_MEM_EFF, HTS_INI_MEM_EFF
113
  The initial and final memory efficiency, represented as instance
114
  memory divided by total memory.
115

    
116
INI_DSK_FREE, INI_DSK_AVAIL, INI_DSK_RESVD, INI_DSK_INST, INI_DSK_EFF
117
  Initial disk stats, similar to the memory ones.
118

    
119
FIN_DSK_FREE, FIN_DSK_AVAIL, FIN_DSK_RESVD, FIN_DSK_INST, FIN_DSK_EFF
120
  Final disk stats, similar to the memory ones.
121

    
122
INI_SPN_FREE, ..., FIN_SPN_FREE, ..
123
  Initial and final spindles stats, similar to memory ones.
124

    
125
INI_CPU_INST, FIN_CPU_INST
126
  Initial and final number of virtual CPUs used by instances.
127

    
128
INI_CPU_EFF, FIN_CPU_EFF
129
  The initial and final CPU efficiency, represented as the count of
130
  virtual instance CPUs divided by the total physical CPU count.
131

    
132
INI_MNODE_MEM_AVAIL, FIN_MNODE_MEM_AVAIL
133
  The initial and final maximum per-node available memory. This is not
134
  very useful as a metric but can give an impression of the status of
135
  the nodes; as an example, this value restricts the maximum instance
136
  size that can be still created on the cluster.
137

    
138
INI_MNODE_DSK_AVAIL, FIN_MNODE_DSK_AVAIL
139
  Like the above but for disk.
140

    
141
TSPEC
142
  This parameter holds the pairs of specifications and counts of
143
  instances that can be created in the *tiered allocation* mode. The
144
  value of the key is a space-separated list of values; each value is of
145
  the form *memory,disk,vcpu,spindles=count* where the memory, disk and vcpu are
146
  the values for the current spec, and count is how many instances of
147
  this spec can be created. A complete value for this variable could be:
148
  **4096,102400,2,1=225 2560,102400,2,1=20 512,102400,2,1=21**.
149

    
150
KM_USED_CPU, KM_USED_NPU, KM_USED_MEM, KM_USED_DSK
151
  These represents the metrics of used resources at the start of the
152
  computation (only for tiered allocation mode). The NPU value is
153
  "normalized" CPU count, i.e. the number of virtual CPUs divided by
154
  the maximum ratio of the virtual to physical CPUs.
155

    
156
KM_POOL_CPU, KM_POOL_NPU, KM_POOL_MEM, KM_POOL_DSK
157
  These represents the total resources allocated during the tiered
158
  allocation process. In effect, they represent how much is readily
159
  available for allocation.
160

    
161
KM_UNAV_CPU, KM_POOL_NPU, KM_UNAV_MEM, KM_UNAV_DSK
162
  These represents the resources left over (either free as in
163
  unallocable or allocable on their own) after the tiered allocation
164
  has been completed. They represent better the actual unallocable
165
  resources, because some other resource has been exhausted. For
166
  example, the cluster might still have 100GiB disk free, but with no
167
  memory left for instances, we cannot allocate another instance, so
168
  in effect the disk space is unallocable. Note that the CPUs here
169
  represent instance virtual CPUs, and in case the *\--max-cpu* option
170
  hasn't been specified this will be -1.
171

    
172
ALLOC_USAGE
173
  The current usage represented as initial number of instances divided
174
  per final number of instances.
175

    
176
ALLOC_COUNT
177
  The number of instances allocated (delta between FIN_INST_CNT and
178
  INI_INST_CNT).
179

    
180
ALLOC_FAIL*_CNT
181
  For the last attemp at allocations (which would have increased
182
  FIN_INST_CNT with one, if it had succeeded), this is the count of
183
  the failure reasons per failure type; currently defined are FAILMEM,
184
  FAILDISK and FAILCPU which represent errors due to not enough
185
  memory, disk and CPUs, and FAILN1 which represents a non N+1
186
  compliant cluster on which we can't allocate instances at all.
187

    
188
ALLOC_FAIL_REASON
189
  The reason for most of the failures, being one of the above FAIL*
190
  strings.
191

    
192
OK
193
  A marker representing the successful end of the computation, and
194
  having value "1". If this key is not present in the output it means
195
  that the computation failed and any values present should not be
196
  relied upon.
197

    
198
Many of the ``INI_``/``FIN_`` metrics will be also displayed with a
199
``TRL_`` prefix, and denote the cluster status at the end of the tiered
200
allocation run.
201

    
202
The human output format should be self-explanatory, so it is not
203
described further.
204

    
205
OPTIONS
206
-------
207

    
208
The options that can be passed to the program are as follows:
209

    
210
\--disk-template *template*
211
  Overrides the disk template for the instance read from the cluster;
212
  one of the Ganeti disk templates (e.g. plain, drbd, so on) should be
213
  passed in.
214

    
215
\--spindle-use *spindles*
216
  Override the spindle use for the instance read from the cluster. The
217
  value can be 0 (for example for instances that use very low I/O), but not
218
  negative. For shared storage the value is ignored.
219

    
220
\--max-cpu=*cpu-ratio*
221
  The maximum virtual to physical cpu ratio, as a floating point number
222
  greater than or equal to one. For example, specifying *cpu-ratio* as
223
  **2.5** means that, for a 4-cpu machine, a maximum of 10 virtual cpus
224
  should be allowed to be in use for primary instances. A value of
225
  exactly one means there will be no over-subscription of CPU (except
226
  for the CPU time used by the node itself), and values below one do not
227
  make sense, as that means other resources (e.g. disk) won't be fully
228
  utilised due to CPU restrictions.
229

    
230
\--min-disk=*disk-ratio*
231
  The minimum amount of free disk space remaining, as a floating point
232
  number. For example, specifying *disk-ratio* as **0.25** means that
233
  at least one quarter of disk space should be left free on nodes.
234

    
235
-l *rounds*, \--max-length=*rounds*
236
  Restrict the number of instance allocations to this length. This is
237
  not very useful in practice, but can be used for testing hspace
238
  itself, or to limit the runtime for very big clusters.
239

    
240
-p, \--print-nodes
241
  Prints the before and after node status, in a format designed to allow
242
  the user to understand the node's most important parameters. See the
243
  man page **htools**\(1) for more details about this option.
244

    
245
-O *name*
246
  This option (which can be given multiple times) will mark nodes as
247
  being *offline*. This means a couple of things:
248

    
249
  - instances won't be placed on these nodes, not even temporarily;
250
    e.g. the *replace primary* move is not available if the secondary
251
    node is offline, since this move requires a failover.
252
  - these nodes will not be included in the score calculation (except
253
    for the percentage of instances on offline nodes)
254

    
255
  Note that the algorithm will also mark as offline any nodes which
256
  are reported by RAPI as such, or that have "?" in file-based input
257
  in any numeric fields.
258

    
259
-S *filename*, \--save-cluster=*filename*
260
  If given, the state of the cluster at the end of the allocation is
261
  saved to a file named *filename.alloc*, and if tiered allocation is
262
  enabled, the state after tiered allocation will be saved to
263
  *filename.tiered*. This allows re-feeding the cluster state to
264
  either hspace itself (with different parameters) or for example
265
  hbal, via the ``-t`` option.
266

    
267
-t *datafile*, \--text-data=*datafile*
268
  Backend specification: the name of the file holding node and instance
269
  information (if not collecting via RAPI or LUXI). This or one of the
270
  other backends must be selected. The option is described in the man
271
  page **htools**\(1).
272

    
273
-m *cluster*
274
  Backend specification: collect data directly from the *cluster* given
275
  as an argument via RAPI. The option is described in the man page
276
  **htools**\(1).
277

    
278
-L [*path*]
279
  Backend specification: collect data directly from the master daemon,
280
  which is to be contacted via LUXI (an internal Ganeti protocol). The
281
  option is described in the man page **htools**\(1).
282

    
283
\--simulate *description*
284
  Backend specification: similar to the **-t** option, this allows
285
  overriding the cluster data with a simulated cluster. For details
286
  about the description, see the man page **htools**\(1).
287

    
288
\--standard-alloc *disk,ram,cpu*
289
  This option overrides the instance size read from the cluster for the
290
  *standard* allocation mode, where we simply allocate instances of the
291
  same, fixed size until the cluster runs out of space.
292

    
293
  The specification given is similar to the *\--simulate* option and it
294
  holds:
295

    
296
  - the disk size of the instance (units can be used)
297
  - the memory size of the instance (units can be used)
298
  - the vcpu count for the insance
299

    
300
  An example description would be *100G,4g,2* describing an instance
301
  specification of 100GB of disk space, 4GiB of memory and 2 VCPUs.
302

    
303
\--tiered-alloc *disk,ram,cpu*
304
  This option overrides the instance size for the *tiered* allocation
305
  mode. In this mode, the algorithm starts from the given specification
306
  and allocates until there is no more space; then it decreases the
307
  specification and tries the allocation again. The decrease is done on
308
  the metric that last failed during allocation. The argument should
309
  have the same format as for ``--standard-alloc``.
310

    
311
  Also note that the normal allocation and the tiered allocation are
312
  independent, and both start from the initial cluster state; as such,
313
  the instance count for these two modes are not related one to
314
  another.
315

    
316
\--machine-readable[=*choice*]
317
  By default, the output of the program is in "human-readable" format,
318
  i.e. text descriptions. By passing this flag you can either enable
319
  (``--machine-readable`` or ``--machine-readable=yes``) or explicitly
320
  disable (``--machine-readable=no``) the machine readable format
321
  described above.
322

    
323
-v, \--verbose
324
  Increase the output verbosity. Each usage of this option will
325
  increase the verbosity (currently more than 2 doesn't make sense)
326
  from the default of one.
327

    
328
-q, \--quiet
329
  Decrease the output verbosity. Each usage of this option will
330
  decrease the verbosity (less than zero doesn't make sense) from the
331
  default of one.
332

    
333
-V, \--version
334
  Just show the program version and exit.
335

    
336
UNITS
337
~~~~~
338

    
339
By default, all unit-accepting options use mebibytes. Using the
340
lower-case letters of *m*, *g* and *t* (or their longer equivalents of
341
*mib*, *gib*, *tib*, for which case doesn't matter) explicit binary
342
units can be selected. Units in the SI system can be selected using the
343
upper-case letters of *M*, *G* and *T* (or their longer equivalents of
344
*MB*, *GB*, *TB*, for which case doesn't matter).
345

    
346
More details about the difference between the SI and binary systems can
347
be read in the **units**\(7) man page.
348

    
349
EXIT STATUS
350
-----------
351

    
352
The exist status of the command will be zero, unless for some reason
353
the algorithm fatally failed (e.g. wrong node or instance data).
354

    
355
BUGS
356
----
357

    
358
The algorithm is highly dependent on the number of nodes; its runtime
359
grows exponentially with this number, and as such is impractical for
360
really big clusters.
361

    
362
The algorithm doesn't rebalance the cluster or try to get the optimal
363
fit; it just allocates in the best place for the current step, without
364
taking into consideration the impact on future placements.
365

    
366
.. vim: set textwidth=72 :
367
.. Local Variables:
368
.. mode: rst
369
.. fill-column: 72
370
.. End: