.B "[backend options...]"
.B "[algorithm options...]"
.B "[request options..."]
-.B "[-p]"
+.BI "[ -p[" fields "] ]"
.B "[-v... | -q]"
.B hspace
.TP
Backend options:
-.BI "[ -m " cluster " ]"
+.BI " -m " cluster
|
-.BI "[ -L[" path "]]"
+.BI " -L[" path "]"
|
-.BI "[ -n " nodes-file " ]"
-.BI "[ -i " instances-file " ]"
+.BI " -t " data-file
+|
+.BI " --simulate " spec
.TP
Algorithm options:
.BI "[--memory " mem "]"
.BI "[--disk " disk "]"
.BI "[--req-nodes " req-nodes "]"
+.BI "[--vcpus " vcpus "]"
+.BI "[--tiered-alloc " spec "]"
.SH DESCRIPTION
The output of the program is designed to interpreted as a shell
fragment (or parsed as a \fIkey=value\fR file). Options which extend
-the output (e.g. -p, -v) will output the additional information on
+the output (e.g. \-p, \-v) will output the additional information on
stderr (such that the stdout is still parseable).
The following keys are available in the output of the script (all
.TP
.I INI_MEM_OVERHEAD, FIN_MEM_OVERHEAD
-The initial and final memory overhead - memory used for the node
+The initial and final memory overhead \(em memory used for the node
itself and unacounted memory (e.g. due to hypervisor overhead).
.TP
.TP
.I INI_MNODE_MEM_AVAIL, FIN_MNODE_MEM_AVAIL
-The initial and final maximum per-node available memory. This is not
+The initial and final maximum per\(hynode available memory. This is not
very useful as a metric but can give an impression of the status of
the nodes; as an example, this value restricts the maximum instance
size that can be still created on the cluster.
Like the above but for disk.
.TP
+.I TSPEC
+If the tiered allocation mode has been enabled, this parameter holds
+the pairs of specifications and counts of instances that can be
+created in this mode. The value of the key is a space\(hyseparated list
+of values; each value is of the form \fImemory,disk,vcpu=count\fR
+where the memory, disk and vcpu are the values for the current spec,
+and count is how many instances of this spec can be created. A
+complete value for this variable could be: \fB4096,102400,2=225
+2560,102400,2=20 512,102400,2=21\fR.
+
+.TP
+.I KM_USED_CPU, KM_USED_MEM, KM_USED_DSK
+These represents the metrics of used resources at the start of the
+computation (only for tiered allocation mode).
+
+.TP
+.I KM_POOL_CPU, KM_POOL_MEM, KM_POOL_DSK
+These represents the total resources allocated during the tiered
+allocation process. In effect, they represent how much is readily
+available for allocation.
+
+.TP
+.I KM_UNAV_CPU, KM_UNAV_MEM, KM_UNAV_DSK
+These represents the resources left over (either free as in
+unallocable or allocable on their own) after the tiered allocation has
+been completed. They represent better the actual unallocable
+resources, because some other resource has been exhausted. For
+example, the cluster might still have 100GiB disk free, but with no
+memory left for instances, we cannot allocate another instance, so in
+effect the disk space is unallocable. Note that the CPUs here
+represent instance virtual CPUs, and in case the \fI--max-cpu\fR
+option hasn't been specified this will be \-1.
+
+.TP
.I ALLOC_USAGE
The current usage represented as initial number of instances divided
per final number of instances.
that the computation failed and any values present should not be
relied upon.
+.PP
+
+If the tiered allocation mode is enabled, then many of the INI_/FIN_
+metrics will be also displayed with a TRL_ prefix, and denote the
+cluster status at the end of the tiered allocation run.
+
.SH OPTIONS
The options that can be passed to the program are as follows:
mirrored instances, while passing one means plain type instances.
.TP
+.BI "--vcpus " vcpus
+The number of VCPUs of the instances to be placed (defaults to 1).
+
+.TP
.BI "--max-cpu " cpu-ratio
-The maximum virtual-to-physical cpu ratio, as a floating point number
-between zero and one. For example, specifying \fIcpu-ratio\fR as
-\fB2.5\fR means that, for a 4-cpu machine, a maximum of 10 virtual
-cpus should be allowed to be in use for primary instances. A value of
-one doesn't make sense though, as that means no disk space can be used
-on it.
+The maximum virtual\(hyto\(hyphysical cpu ratio, as a floating point
+number between zero and one. For example, specifying \fIcpu-ratio\fR
+as \fB2.5\fR means that, for a 4\(hycpu machine, a maximum of 10
+virtual cpus should be allowed to be in use for primary instances. A
+value of one doesn't make sense though, as that means no disk space
+can be used on it.
.TP
.BI "--min-disk " disk-ratio
Prints the before and after node status, in a format designed to allow
the user to understand the node's most important parameters.
-The node list will contain these informations:
+It is possible to customise the listed information by passing a
+comma\(hyseparated list of field names to this option (the field list
+is currently undocumented), or to extend the default field list by
+prefixing the additional field list with a plus sign. By default, the
+node list will contain the following information:
.RS
.TP
.B F
-a character denoting the status of the node, with '-' meaning an
+a character denoting the status of the node, with '\-' meaning an
offline node, '*' meaning N+1 failure and blank meaning a good node
.TP
.B Name
.B vcpu
the number of virtual cpus allocated to primary instances
.TP
-.B pri
+.B pcnt
number of primary instances
.TP
-.B sec
+.B pcnt
number of secondary instances
.TP
.B p_fmem
.TP
.B r_cpu
ratio of virtual to physical cpus
+.TP
+.B lCpu
+the dynamic CPU load (if the information is available)
+.TP
+.B lMem
+the dynamic memory load (if the information is available)
+.TP
+.B lDsk
+the dynamic disk load (if the information is available)
+.TP
+.B lNet
+the dynamic net load (if the information is available)
.RE
.TP
being \fIoffline\fR, and instances won't be placed on these nodes.
Note that hspace will also mark as offline any nodes which are
-reported by RAPI as such, or that have "?" in file-based input in any
+reported by RAPI as such, or that have "?" in file\(hybased input in any
numeric fields.
.RE
.TP
-.BI "-n" nodefile ", --nodes=" nodefile
-The name of the file holding node information (if not collecting via
-RAPI), instead of the default \fInodes\fR file (but see below how to
-customize the default value via the environment).
+.BI "-t" datafile ", --text-data=" datafile
+The name of the file holding node and instance information (if not
+collecting via RAPI or LUXI). This or one of the other backends must
+be selected.
.TP
-.BI "-i" instancefile ", --instances=" instancefile
-The name of the file holding instance information (if not collecting
-via RAPI), instead of the default \fIinstances\fR file (but see below
-how to customize the default value via the environment).
+.BI "-S" filename ", --save-cluster=" filename
+If given, the state of the cluster at the end of the allocation is
+saved to a file named \fIfilename.alloc\fR, and if tiered allocation
+is enabled, the state after tiered allocation will be saved to
+\fIfilename.tiered\fR. This allows re-feeding the cluster state to
+either hspace itself (with different parameters) or for example hbal.
.TP
.BI "-m" cluster
-Collect data not from files but directly from the
+Collect data directly from the
.I cluster
given as an argument via RAPI. If the argument doesn't contain a colon
-(:), then it is converted into a fully-built URL via prepending
+(:), then it is converted into a fully\(hybuilt URL via prepending
https:// and appending the default RAPI port, otherwise it's
-considered a fully-specified URL and is used as-is.
+considered a fully\(hyspecified URL and is used as\(hyis.
.TP
.BI "-L[" path "]"
-Collect data not from files but directly from the master daemon, which
-is to be contacted via the luxi (an internal Ganeti protocol). An
-optional \fIpath\fR argument is interpreted as the path to the unix
-socket on which the master daemon listens; otherwise, the default path
-used by ganeti when installed with "--localstatedir=/var" is used.
+Collect data directly from the master daemon, which is to be contacted
+via the luxi (an internal Ganeti protocol). An optional \fIpath\fR
+argument is interpreted as the path to the unix socket on which the
+master daemon listens; otherwise, the default path used by ganeti when
+installed with \fI--localstatedir=/var\fR is used.
+
+.TP
+.BI "--simulate " description
+Instead of using actual data, build an empty cluster given a node
+description. The \fIdescription\fR parameter must be a
+comma\(hyseparated list of four elements, describing in order:
+
+.RS
+
+.RS
+.TP
+the number of nodes in the cluster
+
+.TP
+the disk size of the nodes, in mebibytes
+
+.TP
+the memory size of the nodes, in mebibytes
+
+.TP
+the cpu core count for the nodes
+
+.RE
+
+An example description would be \fB20,102400,16384,4\fR describing a
+20\(hynode cluster where each node has 100GiB of disk space, 16GiB of
+memory and 4 CPU cores. Note that all nodes must have the same specs
+currently.
+
+.RE
+
+.TP
+.BI "--tiered-alloc " spec
+Beside the standard, fixed\(hysize allocation, also do a tiered
+allocation scheme where the algorithm starts from the given
+specification and allocates until there is no more space; then it
+decreases the specification and tries the allocation again. The
+decrease is done on the matric that last failed during allocation. The
+specification given is similar to the \fI--simulate\fR option and it
+holds:
+
+.RS
+
+.RS
+
+.TP
+the disk size of the instance
+
+.TP
+the memory size of the instance
+
+.TP
+the vcpu count for the insance
+
+.RE
+
+An example description would be \fB10240,8192,2\fR describing an
+initial starting specification of 10GiB of disk space, 4GiB of memory
+and 2 VCPUs.
+
+Also note that the normal allocation and the tiered allocation are
+independent, and both start from the initial cluster state; as such,
+the instance count for these two modes are not related one to another.
+
+.RE
.TP
.B -v, --verbose
If the variables \fBHTOOLS_NODES\fR and \fBHTOOLS_INSTANCES\fR are
present in the environment, they will override the default names for
the nodes and instances files. These will have of course no effect
-when RAPI is used.
+when the RAPI or Luxi backends are used.
.SH SEE ALSO
.BR hbal "(1), " hscan "(1), " ganeti "(7), " gnt-instance "(8), "