1 Ganeti Node OOB Management Framework
2 ====================================
7 Extend Ganeti with Out of Band Cluster Node Management Capabilities.
12 Ganeti currently has no support for Out of Band management of the nodes in a
13 cluster. It relies on the OS running on the nodes and has therefore limited
14 possibilities when the OS is not responding. The command ``gnt-node powercycle``
15 can be issued to attempt a reboot of a node that crashed but there are no means
16 to power a node off and power it back on. Supporting this is very handy in the
19 * **Emergency Power Off**: During emergencies, time is critical and manual
20 tasks just add latency which can be avoided through automation. If a server
21 room overheats, halting the OS on the nodes is not enough. The nodes need
22 to be powered off cleanly to prevent damage to equipment.
23 * **Repairs**: In most cases, repairing a node means that the node has to be
25 * **Crashes**: Software bugs may crash a node. Having an OS independent way to
26 power-cycle a node helps to recover the node without human intervention.
31 Ganeti will be extended with OOB capabilities through adding a new **Cluster
32 Parameter** (``--oob-program``), a new **Node Property** (``--oob-program``), a
33 new **Node State (powered)** and support in ``gnt-node`` for invoking an
34 **External Helper Command** which executes the actual OOB command (``gnt-node
35 <command> nodename ...``). The supported commands are: ``power on``,
36 ``power off``, ``power cycle``, ``power status`` and ``health``.
39 The new **Node State (powered)** is a **State of Record
40 (SoR)**, not a **State of World (SoW)**. The maximum execution time of the
41 **External Helper Command** will be limited to 60s to prevent the cluster from
42 getting locked for an undefined amount of time.
47 New ``gnt-cluster`` Parameter
48 +++++++++++++++++++++++++++++
50 | Program: ``gnt-cluster``
51 | Command: ``modify|init``
52 | Parameters: ``--oob-program``
53 | Options: ``--oob-program``: executable OOB program (absolute path)
55 New ``gnt-node`` Property
56 +++++++++++++++++++++++++
58 | Program: ``gnt-node``
59 | Command: ``modify|add``
60 | Parameters: ``--oob-program``
61 | Options: ``--oob-program``: executable OOB program (absolute path)
64 If ``--oob-program`` is set to ``!`` then the node has no OOB capabilities.
65 Otherwise, we will inherit the node group respectively the cluster wide
66 value. I.e. the nodes have to opt out from OOB capabilities.
68 Addition to ``gnt-cluster verify``
69 ++++++++++++++++++++++++++++++++++
71 | Program: ``gnt-cluster``
77 1. existence and execution flag of OOB program on all Master Candidates if
78 the cluster parameter ``--oob-program`` is set or at least one node has
79 the property ``--oob-program`` set. The OOB helper is just invoked on the
81 2. check if node state powered matches actual power state of the machine for
82 those nodes where ``--oob-program`` is set
87 Ganeti supports the following two boolean states related to the nodes:
90 The cluster still communicates with drained nodes but excludes them from
94 if offline, the cluster does not communicate with offline nodes; useful for
95 nodes that are not reachable in order to avoid delays
97 And will extend this list with the following boolean state:
100 if not powered, the cluster does not communicate with not powered nodes if
101 the node property ``--oob-program`` is not set, the state powered is not
104 Additionally modify the meaning of the offline state as follows:
107 if offline, the cluster does not communicate with offline nodes (**with the
108 exception of OOB commands for nodes where** ``--oob-program`` **is set**);
109 useful for nodes that are not reachable in order to avoid delays
111 The corresponding command extensions are:
113 | Program: ``gnt-node``
115 | Parameter: [ ``nodename`` ... ]
118 Additional Output (SoR, ommited if node property ``--oob-program`` is not set):
119 powered: ``[True|False]``
121 | Program: ``gnt-node``
122 | Command: ``modify``
123 | Parameter: nodename
124 | Option: [ ``--powered=yes|no`` ]
125 | Reasoning: sometimes you will need to sync the SoR with the SoW manually
126 | Caveat: ``--powered`` can only be modified if ``--oob-program`` is set for
127 | the node in question
129 New ``gnt-node`` commands: ``power [on|off|cycle|status]``
130 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
132 | Program: ``gnt-node``
133 | Command: ``power [on|off|cycle|status]``
134 | Parameters: [ ``nodename`` ... ]
138 * If no nodenames are passed to ``power [on|off|cycle]``, the user will be
139 prompted with ``"Do you really want to power [on|off|cycle] the following
140 nodes: <display list of OOB capable nodes in the cluster)? (y/n)"``
141 * For ``power-status``, nodename is optional, if omitted, we list the
142 power-status of all OOB capable nodes in the cluster (SoW)
143 * User should be warned and needs to confirm with yes if s/he tries to
144 ``power [off|cycle]`` a node with running instances.
149 +------------------------------+-----------------------------------------------+
150 | Exception | Error Message |
151 +==============================+===============================================+
152 | OOB program return code != 0 | OOB program execution failed ($ERROR_MSG) |
153 +------------------------------+-----------------------------------------------+
154 | OOB program execution time | OOB program execution timeout exceeded, OOB |
155 | exceeds 60s | program execution aborted |
156 +------------------------------+-----------------------------------------------+
161 +----------------+-----------------+----------------+--------------------------+
162 | State before | Command | State after | Comment |
163 | execution | | execution | |
164 +================+=================+================+==========================+
165 | powered: False | ``power off`` | powered: False | FYI: IPMI will complain |
166 | | | | if you try to power off |
167 | | | | a machine that is already|
168 | | | | powered off |
169 +----------------+-----------------+----------------+--------------------------+
170 | powered: False | ``power cycle`` | powered: False | FYI: IPMI will complain |
171 | | | | if you try to cycle a |
172 | | | | machine that is already |
173 | | | | powered off |
174 +----------------+-----------------+----------------+--------------------------+
175 | powered: False | ``power on`` | powered: True | |
176 +----------------+-----------------+----------------+--------------------------+
177 | powered: True | ``power off`` | powered: False | |
178 +----------------+-----------------+----------------+--------------------------+
179 | powered: True | ``power cycle`` | powered: True | |
180 +----------------+-----------------+----------------+--------------------------+
181 | powered: True | ``power on`` | powered: True | FYI: IPMI will complain |
182 | | | | if you try to power on |
183 | | | | a machine that is already|
185 +----------------+-----------------+----------------+--------------------------+
189 * If the command fails, the Node State remains unchanged.
190 * We will not prevent the user from trying to power off a node that is
191 already powered off since the powered state represents the **SoR** only and
192 not the **SoW**. This can however create problems when the cluster
193 administrator wants to bring the **SoR** in sync with the **SoW** without
194 actually having to mess with the node(s). For this case, we allow direct
195 modification of the powered state through the gnt-node modify
196 ``--powered=[yes|no]`` command as long as the node has OOB capabilities
197 (i.e. ``--oob-program`` is set).
198 * All node power state changes will be logged
200 Node Power Status Listing (SoW)
201 +++++++++++++++++++++++++++++++
203 | Program: ``gnt-node``
204 | Command: ``power-status``
205 | Parameters: [ ``nodename`` ... ]
207 Example output (represents **SoW**)::
209 gnt-node oob power-status
212 node2.example.com off
214 node4.example.com unknown
218 * We use ``unknown`` in case the Helper Program could not determine the power
220 * If no nodenames are provided, we will list the power state of all nodes
221 which are not opted out from OOB management.
222 * Only nodes which are not opted out from OOB management will be listed.
223 Invoking the command on a node that does not meet this condition will
224 result in an error message "Node X does not support OOB commands".
226 Node Power Status Listing (SoR)
227 +++++++++++++++++++++++++++++++
229 | Program: ``gnt-node``
231 | Parameter: [ ``nodename`` ... ]
234 Example output (represents **SoR**)::
236 gnt-node info node1.example.com
237 Node name: node1.example.com
238 primary ip: 192.168.1.1
239 secondary ip: 192.168.2.1
240 master candidate: True
244 primary for instances:
248 secondary for instances:
255 Only nodes which are not opted out from OOB management will
256 report the powered state.
258 New ``gnt-node`` oob subcommand: ``health``
259 +++++++++++++++++++++++++++++++++++++++++++
261 | Program: ``gnt-node``
262 | Command: ``health``
263 | Parameters: [ ``nodename`` ... ]
265 | Example: ``/usr/bin/oob health node5.example.com``
269 * If no nodename(s) are provided, we will report the health of all nodes in
270 the cluster which have ``--oob-program`` set.
271 * Only nodes which are not opted out from OOB management will report their
272 health. Invoking the command on a node that does not meet this condition
273 will result in an error message "Node does not support OOB commands".
275 For error handling see `Error Handling`_
277 OOB Program (Helper Program) Parameters, Return Codes and Data Format
278 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
280 | Program: executable OOB program (absolute path)
281 | Parameters: command nodename
282 | Command: [power-{on|off|cycle|status}|health]
284 | Example: ``/usr/bin/oob power-on node1.example.com``
285 | Caveat: maximum runtime is limited to 60s
290 +---------------+--------------------------+
291 | Return code | Meaning |
292 +===============+==========================+
293 | 0 | Command succeeded |
294 +---------------+--------------------------+
295 | 1 | Command failed |
296 +---------------+--------------------------+
297 | others | Unsupported/undefined |
298 +---------------+--------------------------+
300 Error messages are passed from the helper program to Ganeti through StdErr
301 (return code == 1). On StdOut, the helper program will send data back to
302 Ganeti (return code == 0). The format of the data is JSON.
304 +------------------+-------------------------------+
305 | Command | Expected output |
306 +==================+===============================+
307 | ``power-on`` | None |
308 +------------------+-------------------------------+
309 | ``power-off`` | None |
310 +------------------+-------------------------------+
311 | ``power-cycle`` | None |
312 +------------------+-------------------------------+
313 | ``power-status`` | ``{ "powered": true|false }`` |
314 +------------------+-------------------------------+
317 | | [[item, status], |
318 | | [item, status], |
320 +------------------+-------------------------------+
325 For the health output, the fields are:
327 +--------+--------------------------------------------------------------------+
329 +========+====================================================================+
330 | item | String identifier of the item we are querying the health of, |
334 | | * PS Redundancy |
336 +--------+--------------------------------------------------------------------+
337 | status | String; Can take one of the following four values: |
343 +--------+--------------------------------------------------------------------+
347 * The item output list is defined by the Helper Program. It is up to the
348 author of the Helper Program to decide which items should be monitored and
349 what each corresponding return status is.
350 * Ganeti will currently not take any actions based on the item status. It
351 will however create log entries for items with status WARNING or CRITICAL
352 for each run of the ``gnt-node oob health nodename`` command. Automatic
353 actions (regular monitoring of the item status) is considered a new service
354 and will be treated in a separate design document.
359 The ``gnt-node power-[on|off]`` (power state changes) commands will create log
360 entries following current Ganeti logging practices. In addition, health items
361 with status WARNING or CRITICAL will be logged for each run of ``gnt-node