Revision 04daec5d
b/INSTALL | ||
---|---|---|
2 | 2 |
============= |
3 | 3 |
|
4 | 4 |
Please note that a more detailed installation procedure is described in the |
5 |
docs/install.html file. A glossary of terms exists in the docs/admin.html file. |
|
5 |
doc/install.html file. A glossary of terms can be found in the doc/admin.html |
|
6 |
file. |
|
6 | 7 |
|
7 | 8 |
|
8 | 9 |
Software Requirements |
b/Makefile.am | ||
---|---|---|
1 | 1 |
# standard automake rules |
2 | 2 |
|
3 |
SUBDIRS = man lib scripts daemons docs testing tools |
|
4 |
EXTRA_DIST = docs/examples/ganeti.initd docs/examples/ganeti.cron |
|
3 |
SUBDIRS = man lib scripts daemons doc testing tools |
|
5 | 4 |
|
6 | 5 |
# custom rules |
7 | 6 |
depgraph: depgraph.png |
b/README | ||
---|---|---|
1 | 1 |
Ganeti 1.2 |
2 | 2 |
========== |
3 | 3 |
|
4 |
For installation instructions, read the INSTALL and the docs/install.pdf
|
|
4 |
For installation instructions, read the INSTALL and the doc/install.pdf |
|
5 | 5 |
files. |
6 | 6 |
|
7 | 7 |
For a brief introduction, read the ganeti(7) manpage and the other pages |
b/configure.ac | ||
---|---|---|
19 | 19 |
AC_MSG_WARN([docbook2man not found.]) |
20 | 20 |
fi |
21 | 21 |
|
22 |
AC_CONFIG_FILES([Makefile man/Makefile docs/Makefile
|
|
22 |
AC_CONFIG_FILES([Makefile man/Makefile doc/Makefile
|
|
23 | 23 |
testing/Makefile tools/Makefile |
24 |
lib/Makefile scripts/Makefile daemons/Makefile]) |
|
24 |
lib/Makefile scripts/Makefile daemons/Makefile |
|
25 |
doc/examples/Makefile]) |
|
25 | 26 |
|
26 | 27 |
AC_OUTPUT |
b/doc/Makefile.am | ||
---|---|---|
1 |
docdir = $(datadir)/doc/$(PACKAGE) |
|
2 |
|
|
3 |
SUBDIRS = examples |
|
4 |
dist_doc_DATA = hooks.html hooks.pdf install.html install.pdf admin.html \ |
|
5 |
admin.pdf |
|
6 |
EXTRA_DIST = hooks.sgml install.sgml admin.sgml |
|
7 |
|
|
8 |
%.html: %.sgml |
|
9 |
docbook2html --nochunks $< |
|
10 |
|
|
11 |
%.pdf: %.sgml |
|
12 |
docbook2pdf $< |
b/doc/admin.sgml | ||
---|---|---|
1 |
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.2//EN" [ |
|
2 |
]> |
|
3 |
<article class="specification"> |
|
4 |
<articleinfo> |
|
5 |
<title>Ganeti administrator's guide</title> |
|
6 |
</articleinfo> |
|
7 |
<para>Documents Ganeti version 1.2</para> |
|
8 |
<sect1> |
|
9 |
<title>Introduction</title> |
|
10 |
|
|
11 |
<para>Ganeti is a virtualization cluster management software. You are |
|
12 |
expected to be a system administrator familiar with your Linux distribution |
|
13 |
and the Xen virtualization environment before using it. |
|
14 |
</para> |
|
15 |
|
|
16 |
<para>The various components of Ganeti all have man pages and interactive |
|
17 |
help. This manual though will help you getting familiar with the system by |
|
18 |
explaining the most common operations, grouped by related use. |
|
19 |
</para> |
|
20 |
|
|
21 |
<para>After a terminology glossary and a section on the prerequisites |
|
22 |
needed to use this manual, the rest of this document is divided in three |
|
23 |
main sections, which group different features of Ganeti: |
|
24 |
<itemizedlist> |
|
25 |
<listitem> |
|
26 |
<simpara>Instance Management</simpara> |
|
27 |
</listitem> |
|
28 |
<listitem> |
|
29 |
<simpara>High Availability Features</simpara> |
|
30 |
</listitem> |
|
31 |
<listitem> |
|
32 |
<simpara>Debugging Features</simpara> |
|
33 |
</listitem> |
|
34 |
</itemizedlist> |
|
35 |
</para> |
|
36 |
|
|
37 |
<sect2> |
|
38 |
|
|
39 |
<title>Ganeti terminology</title> |
|
40 |
|
|
41 |
<para>This section provides a small introduction to Ganeti terminology, |
|
42 |
which might be useful to read the rest of the document. |
|
43 |
|
|
44 |
<glosslist> |
|
45 |
<glossentry> |
|
46 |
<glossterm>Cluster</glossterm> |
|
47 |
<glossdef> |
|
48 |
<simpara> |
|
49 |
A set of machines (nodes) that cooperate to offer a |
|
50 |
coherent highly available virtualization service. |
|
51 |
</simpara> |
|
52 |
</glossdef> |
|
53 |
</glossentry> |
|
54 |
<glossentry> |
|
55 |
<glossterm>Node</glossterm> |
|
56 |
<glossdef> |
|
57 |
<simpara> |
|
58 |
A physical machine which is member of a cluster. |
|
59 |
Nodes are the basic cluster infrastructure, and are |
|
60 |
not fault tolerant. |
|
61 |
</simpara> |
|
62 |
</glossdef> |
|
63 |
</glossentry> |
|
64 |
<glossentry> |
|
65 |
<glossterm>Master node</glossterm> |
|
66 |
<glossdef> |
|
67 |
<simpara> |
|
68 |
The node which controls the Cluster, from which all |
|
69 |
Ganeti commands must be given. |
|
70 |
</simpara> |
|
71 |
</glossdef> |
|
72 |
</glossentry> |
|
73 |
<glossentry> |
|
74 |
<glossterm>Instance</glossterm> |
|
75 |
<glossdef> |
|
76 |
<simpara> |
|
77 |
A virtual machine which runs on a cluster. It can be a |
|
78 |
fault tolerant highly available entity. |
|
79 |
</simpara> |
|
80 |
</glossdef> |
|
81 |
</glossentry> |
|
82 |
<glossentry> |
|
83 |
<glossterm>Pool</glossterm> |
|
84 |
<glossdef> |
|
85 |
<simpara> |
|
86 |
A pool is a set of clusters sharing the same network. |
|
87 |
</simpara> |
|
88 |
</glossdef> |
|
89 |
</glossentry> |
|
90 |
<glossentry> |
|
91 |
<glossterm>Meta-Cluster</glossterm> |
|
92 |
<glossdef> |
|
93 |
<simpara> |
|
94 |
Anything that concerns more than one cluster. |
|
95 |
</simpara> |
|
96 |
</glossdef> |
|
97 |
</glossentry> |
|
98 |
</glosslist> |
|
99 |
|
|
100 |
</para> |
|
101 |
</sect2> |
|
102 |
|
|
103 |
<sect2> |
|
104 |
<title>Prerequisites</title> |
|
105 |
|
|
106 |
<para> |
|
107 |
You need to have your Ganeti cluster installed and configured |
|
108 |
before you try any of the commands in this document. Please |
|
109 |
follow the <emphasis>Ganeti installation tutorial</emphasis> |
|
110 |
for instructions on how to do that. |
|
111 |
</para> |
|
112 |
</sect2> |
|
113 |
|
|
114 |
</sect1> |
|
115 |
|
|
116 |
<sect1> |
|
117 |
<title>Managing Instances</title> |
|
118 |
|
|
119 |
<sect2> |
|
120 |
<title>Adding/Removing an instance</title> |
|
121 |
|
|
122 |
<para> |
|
123 |
Adding a new virtual instance to your Ganeti cluster is really |
|
124 |
easy. The command is: |
|
125 |
|
|
126 |
<synopsis>gnt-instance add -n <replaceable>TARGET_NODE</replaceable> -o <replaceable>OS_TYPE</replaceable> -t <replaceable>DISK_TEMPLATE</replaceable> <replaceable>INSTANCE_NAME</replaceable></synopsis> |
|
127 |
|
|
128 |
The instance name must be resolvable (e.g. exist in DNS) and |
|
129 |
of course map to an address in the same subnet as the cluster |
|
130 |
itself. Options you can give to this command include: |
|
131 |
|
|
132 |
<itemizedlist> |
|
133 |
<listitem> |
|
134 |
<simpara>The disk size (<option>-s</option>)</simpara> |
|
135 |
</listitem> |
|
136 |
<listitem> |
|
137 |
<simpara>The swap size (<option>--swap-size</option>)</simpara> |
|
138 |
</listitem> |
|
139 |
<listitem> |
|
140 |
<simpara>The memory size (<option>-m</option>)</simpara> |
|
141 |
</listitem> |
|
142 |
<listitem> |
|
143 |
<simpara>The number of virtual CPUs (<option>-p</option>)</simpara> |
|
144 |
</listitem> |
|
145 |
<listitem> |
|
146 |
<simpara>The instance ip address (<option>-i</option>) (use |
|
147 |
the value <literal>auto</literal> to make Ganeti record the |
|
148 |
address from dns)</simpara> |
|
149 |
</listitem> |
|
150 |
<listitem> |
|
151 |
<simpara>The bridge to connect the instance to |
|
152 |
(<option>-b</option>), if you don't want to use the default |
|
153 |
one</simpara> |
|
154 |
</listitem> |
|
155 |
</itemizedlist> |
|
156 |
</para> |
|
157 |
|
|
158 |
<para>There are four types of disk template you can choose from:</para> |
|
159 |
|
|
160 |
<variablelist> |
|
161 |
<varlistentry> |
|
162 |
<term>diskless</term> |
|
163 |
<listitem><para>The instance has no disks. Only used for special |
|
164 |
purpouse operating systems or for testing.</para></listitem> |
|
165 |
</varlistentry> |
|
166 |
|
|
167 |
<varlistentry> |
|
168 |
<term>plain</term> |
|
169 |
<listitem><para>The instance will use LVM devices as backend for its |
|
170 |
disks. No redundancy is provided.</para></listitem> |
|
171 |
</varlistentry> |
|
172 |
|
|
173 |
<varlistentry> |
|
174 |
<term>local_raid1</term> |
|
175 |
<listitem><para>A local mirror is set between LVM devices to back the |
|
176 |
instance. This provides some redundancy for the instance's |
|
177 |
data.</para></listitem> |
|
178 |
</varlistentry> |
|
179 |
|
|
180 |
<varlistentry> |
|
181 |
<term>remote_raid1</term> |
|
182 |
<listitem> |
|
183 |
<simpara><emphasis role="strong">Note:</emphasis> This is |
|
184 |
only valid for multi-node clusters.</simpara> |
|
185 |
<simpara> |
|
186 |
A mirror is set between the local node and a remote |
|
187 |
one, which must be specified with the --secondary-node |
|
188 |
option. Use this option to obtain a highly available |
|
189 |
instance that can be failed over to a remote node |
|
190 |
should the primary one fail. |
|
191 |
</simpara> |
|
192 |
</listitem> |
|
193 |
</varlistentry> |
|
194 |
|
|
195 |
</variablelist> |
|
196 |
|
|
197 |
<para> |
|
198 |
For example if you want to create an highly available instance |
|
199 |
use the remote_raid1 disk template: |
|
200 |
<synopsis>gnt-instance add -n <replaceable>TARGET_NODE</replaceable> -o <replaceable>OS_TYPE</replaceable> -t remote_raid1 \ |
|
201 |
--secondary-node=<replaceable>SECONDARY_NODE</replaceable> <replaceable>INSTANCE_NAME</replaceable></synopsis> |
|
202 |
|
|
203 |
<para> |
|
204 |
To know which operating systems your cluster supports you can use: |
|
205 |
|
|
206 |
<synopsis>gnt-os list</synopsis> |
|
207 |
|
|
208 |
</para> |
|
209 |
|
|
210 |
<para> |
|
211 |
Removing an instance is even easier than creating one. This |
|
212 |
operation is non-reversible and destroys all the contents of |
|
213 |
your instance. Use with care: |
|
214 |
|
|
215 |
<synopsis>gnt-instance remove <replaceable>INSTANCE_NAME</replaceable></synopsis> |
|
216 |
|
|
217 |
</para> |
|
218 |
</sect2> |
|
219 |
|
|
220 |
<sect2> |
|
221 |
<title>Starting/Stopping an instance</title> |
|
222 |
|
|
223 |
<para> |
|
224 |
Instances are automatically started at instance creation |
|
225 |
time. To manually start one which is currently stopped you can |
|
226 |
run: |
|
227 |
|
|
228 |
<synopsis>gnt-instance startup <replaceable>INSTANCE_NAME</replaceable></synopsis> |
|
229 |
|
|
230 |
While the command to stop one is: |
|
231 |
|
|
232 |
<synopsis>gnt-instance shutdown <replaceable>INSTANCE_NAME</replaceable></synopsis> |
|
233 |
|
|
234 |
The command to see all the instances configured and their |
|
235 |
status is: |
|
236 |
|
|
237 |
<synopsis>gnt-instance list</synopsis> |
|
238 |
|
|
239 |
</para> |
|
240 |
|
|
241 |
<para> |
|
242 |
Do not use the xen commands to stop instances. If you run for |
|
243 |
example xm shutdown or xm destroy on an instance Ganeti will |
|
244 |
automatically restart it (via the |
|
245 |
<citerefentry><refentrytitle>ganeti-watcher</refentrytitle> |
|
246 |
<manvolnum>8</manvolnum></citerefentry>) |
|
247 |
</para> |
|
248 |
|
|
249 |
</sect2> |
|
250 |
|
|
251 |
<sect2> |
|
252 |
<title>Exporting/Importing an instance</title> |
|
253 |
|
|
254 |
<para> |
|
255 |
You can create a snapshot of an instance disk and Ganeti |
|
256 |
configuration, which then you can backup, or import into |
|
257 |
another cluster. The way to export an instance is: |
|
258 |
|
|
259 |
<synopsis>gnt-backup export -n <replaceable>TARGET_NODE</replaceable> <replaceable>INSTANCE_NAME</replaceable></synopsis> |
|
260 |
|
|
261 |
The target node can be any node in the cluster with enough |
|
262 |
space under <filename class="directory">/srv/ganeti</filename> |
|
263 |
to hold the instance image. Use the |
|
264 |
<option>--noshutdown</option> option to snapshot an instance |
|
265 |
without rebooting it. Any previous snapshot of the same |
|
266 |
instance existing cluster-wide under <filename |
|
267 |
class="directory">/srv/ganeti</filename> will be removed by |
|
268 |
this operation: if you want to keep them move them out of the |
|
269 |
Ganeti exports directory. |
|
270 |
</para> |
|
271 |
|
|
272 |
<para> |
|
273 |
Importing an instance is similar to creating a new one. The |
|
274 |
command is: |
|
275 |
|
|
276 |
<synopsis>gnt-backup import -n <replaceable>TARGET_NODE</replaceable> -t <replaceable>DISK_TEMPLATE</replaceable> --src-node=<replaceable>NODE</replaceable> --src-dir=DIR INSTANCE_NAME</synopsis> |
|
277 |
|
|
278 |
Most of the options available for the command |
|
279 |
<emphasis>gnt-instance add</emphasis> are supported here too. |
|
280 |
|
|
281 |
</para> |
|
282 |
</sect2> |
|
283 |
|
|
284 |
</sect1> |
|
285 |
|
|
286 |
|
|
287 |
<sect1> |
|
288 |
<title>High availability features</title> |
|
289 |
|
|
290 |
<note> |
|
291 |
<simpara>This section only applies to multi-node clusters.</simpara> |
|
292 |
</note> |
|
293 |
|
|
294 |
<sect2> |
|
295 |
<title>Failing over an instance</title> |
|
296 |
|
|
297 |
<para> |
|
298 |
If an instance is built in highly available mode you can at |
|
299 |
any time fail it over to its secondary node, even if the |
|
300 |
primary has somehow failed and it's not up anymore. Doing it |
|
301 |
is really easy, on the master node you can just run: |
|
302 |
|
|
303 |
<synopsis>gnt-instance failover <replaceable>INSTANCE_NAME</replaceable></synopsis> |
|
304 |
|
|
305 |
That's it. After the command completes the secondary node is |
|
306 |
now the primary, and vice versa. |
|
307 |
</para> |
|
308 |
</sect2> |
|
309 |
|
|
310 |
<sect2> |
|
311 |
<title>Replacing an instance disks</title> |
|
312 |
|
|
313 |
<para> |
|
314 |
So what if instead the secondary node for an instance has |
|
315 |
failed, or you plan to remove a node from your cluster, and |
|
316 |
you failed over all its instances, but it's still secondary |
|
317 |
for some? The solution here is to replace the instance disks, |
|
318 |
changing the secondary node: |
|
319 |
|
|
320 |
<synopsis>gnt-instance replace-disks -n <replaceable>NEW_SECONDARY</replaceable> <replaceable>INSTANCE_NAME</replaceable></synopsis> |
|
321 |
|
|
322 |
This process is a bit longer, but involves no instance |
|
323 |
downtime, and at the end of it the instance has changed its |
|
324 |
secondary node, to which it can if necessary be failed over. |
|
325 |
</para> |
|
326 |
</sect2> |
|
327 |
<sect2> |
|
328 |
<title>Failing over the master node</title> |
|
329 |
|
|
330 |
<para> |
|
331 |
This is all good as long as the Ganeti Master Node is |
|
332 |
up. Should it go down, or should you wish to decommission it, |
|
333 |
just run on any other node the command: |
|
334 |
|
|
335 |
<synopsis>gnt-cluster masterfailover</synopsis> |
|
336 |
|
|
337 |
and the node you ran it on is now the new master. |
|
338 |
</para> |
|
339 |
</sect2> |
|
340 |
<sect2> |
|
341 |
<title>Adding/Removing nodes</title> |
|
342 |
|
|
343 |
<para> |
|
344 |
And of course, now that you know how to move instances around, |
|
345 |
it's easy to free up a node, and then you can remove it from |
|
346 |
the cluster: |
|
347 |
|
|
348 |
<synopsis> |
|
349 |
gnt-node remove <replaceable>NODE_NAME</replaceable> |
|
350 |
</synopsis> |
|
351 |
|
|
352 |
and maybe add a new one: |
|
353 |
|
|
354 |
<synopsis> |
|
355 |
gnt-node add <optional><option>--secondary-ip=<replaceable>ADDRESS</replaceable></option></optional> <replaceable>NODE_NAME</replaceable> |
|
356 |
|
|
357 |
</synopsis> |
|
358 |
</para> |
|
359 |
</sect2> |
|
360 |
</sect1> |
|
361 |
|
|
362 |
<sect1> |
|
363 |
<title>Debugging Features</title> |
|
364 |
|
|
365 |
<para> |
|
366 |
At some point you might need to do some debugging operations on |
|
367 |
your cluster or on your instances. This section will help you |
|
368 |
with the most used debugging functionalities. |
|
369 |
</para> |
|
370 |
|
|
371 |
<sect2> |
|
372 |
<title>Accessing an instance's disks</title> |
|
373 |
|
|
374 |
<para> |
|
375 |
From an instance's primary node you have access to its |
|
376 |
disks. Never ever mount the underlying logical volume manually |
|
377 |
on a fault tolerant instance, or you risk breaking |
|
378 |
replication. The correct way to access them is to run the |
|
379 |
command: |
|
380 |
|
|
381 |
<synopsis> gnt-instance activate-disks <replaceable>INSTANCE_NAME</replaceable></synopsis> |
|
382 |
|
|
383 |
And then access the device that gets created. After you've |
|
384 |
finished you can deactivate them with the deactivate-disks |
|
385 |
command, which works in the same way. |
|
386 |
</para> |
|
387 |
</sect2> |
|
388 |
|
|
389 |
<sect2> |
|
390 |
<title>Accessing an instance's console</title> |
|
391 |
|
|
392 |
<para> |
|
393 |
The command to access a running instance's console is: |
|
394 |
|
|
395 |
<synopsis>gnt-instance console <replaceable>INSTANCE_NAME</replaceable></synopsis> |
|
396 |
|
|
397 |
Use the console normally and then type |
|
398 |
<userinput>^]</userinput> when done, to exit. |
|
399 |
</para> |
|
400 |
</sect2> |
|
401 |
|
|
402 |
<sect2> |
|
403 |
<title>Instance Operating System Debugging</title> |
|
404 |
|
|
405 |
<para> |
|
406 |
Should you have any problems with operating systems support |
|
407 |
the command to ran to see a complete status for all your nodes |
|
408 |
is: |
|
409 |
|
|
410 |
<synopsis>gnt-os diagnose</synopsis> |
|
411 |
|
|
412 |
</para> |
|
413 |
|
|
414 |
</sect2> |
|
415 |
|
|
416 |
<sect2> |
|
417 |
<title>Cluster-wide debugging</title> |
|
418 |
|
|
419 |
<para> |
|
420 |
The gnt-cluster command offers several options to run tests or |
|
421 |
execute cluster-wide operations. For example: |
|
422 |
|
|
423 |
<screen> |
|
424 |
gnt-cluster command |
|
425 |
gnt-cluster copyfile |
|
426 |
gnt-cluster verify |
|
427 |
gnt-cluster getmaster |
|
428 |
gnt-cluster version |
|
429 |
</screen> |
|
430 |
|
|
431 |
See the man page <citerefentry> |
|
432 |
<refentrytitle>gnt-cluster</refentrytitle> |
|
433 |
<manvolnum>8</manvolnum> </citerefentry> to know more about |
|
434 |
their usage. |
|
435 |
</para> |
|
436 |
</sect2> |
|
437 |
|
|
438 |
</sect1> |
|
439 |
|
|
440 |
</article> |
b/doc/examples/ganeti.cron | ||
---|---|---|
1 |
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin |
|
2 |
# restart failed instances |
|
3 |
*/5 * * * * root /usr/local/sbin/ganeti-watcher |
b/doc/examples/ganeti.initd | ||
---|---|---|
1 |
#! /bin/sh |
|
2 |
# ganeti node daemon starter script |
|
3 |
# based on skeleton from Debian GNU/Linux |
|
4 |
|
|
5 |
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin |
|
6 |
NODED=/usr/local/sbin/ganeti-noded |
|
7 |
MASTER=/usr/local/sbin/ganeti-master |
|
8 |
NAME=ganeti-noded |
|
9 |
SCRIPTNAME=/etc/init.d/ganeti |
|
10 |
DESC="Ganeti cluster" |
|
11 |
|
|
12 |
test -f $NODED || exit 0 |
|
13 |
|
|
14 |
. /lib/lsb/init-functions |
|
15 |
|
|
16 |
check_config() { |
|
17 |
for fname in /var/lib/ganeti/ssconf_node_pass /var/lib/ganeti/server.pem; do |
|
18 |
if ! [ -f "$fname" ]; then |
|
19 |
log_end_msg 0 |
|
20 |
log_warning_msg "Config $fname not there, will not run." |
|
21 |
exit 0 |
|
22 |
fi |
|
23 |
done |
|
24 |
} |
|
25 |
|
|
26 |
master_action() { |
|
27 |
log_action_begin_msg "ganeti-master"; $MASTER "$1" |
|
28 |
RC=$? |
|
29 |
case $RC in |
|
30 |
0) |
|
31 |
log_action_end_msg 0 |
|
32 |
;; |
|
33 |
11) |
|
34 |
log_action_end_msg 0 "not master" |
|
35 |
;; |
|
36 |
*) |
|
37 |
log_action_end_msg 1 "exit code $RC" |
|
38 |
;; |
|
39 |
esac |
|
40 |
} |
|
41 |
|
|
42 |
case "$1" in |
|
43 |
start) |
|
44 |
log_daemon_msg "Starting $DESC" "$NAME" |
|
45 |
check_config |
|
46 |
if start-stop-daemon --start --quiet --exec $NODED; then |
|
47 |
log_end_msg 0 |
|
48 |
else |
|
49 |
log_end_msg 1 |
|
50 |
fi |
|
51 |
master_action start |
|
52 |
;; |
|
53 |
stop) |
|
54 |
log_daemon_msg "Stopping $DESC" "$NAME" |
|
55 |
if start-stop-daemon --stop --quiet --name $NAME; then |
|
56 |
log_end_msg 0 |
|
57 |
else |
|
58 |
log_end_msg 1 |
|
59 |
fi |
|
60 |
master_action stop |
|
61 |
;; |
|
62 |
restart|force-reload) |
|
63 |
log_daemon_msg "Reloading $DESC" |
|
64 |
start-stop-daemon --stop --quiet --oknodo --retry 30 --name $NAME |
|
65 |
check_config |
|
66 |
start-stop-daemon --start --quiet --exec $NODED |
|
67 |
log_end_msg $? |
|
68 |
|
|
69 |
$MASTER stop |
|
70 |
master_action start |
|
71 |
;; |
|
72 |
*) |
|
73 |
log_success_msg "Usage: $SCRIPTNAME {start|stop|force-reload|restart}" |
|
74 |
exit 1 |
|
75 |
;; |
|
76 |
esac |
|
77 |
|
|
78 |
exit 0 |
|
79 |
|
|
80 |
# vim: set sw=4 sts=4 et foldmethod=marker : |
b/doc/hooks.sgml | ||
---|---|---|
1 |
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.2//EN" [ |
|
2 |
]> |
|
3 |
<article class="specification"> |
|
4 |
<articleinfo> |
|
5 |
<title>Ganeti customisation using hooks</title> |
|
6 |
</articleinfo> |
|
7 |
<para>Documents ganeti version 1.2</para> |
|
8 |
<section> |
|
9 |
<title>Introduction</title> |
|
10 |
|
|
11 |
<para> |
|
12 |
In order to allow customisation of operations, ganeti will run |
|
13 |
scripts under <filename |
|
14 |
class="directory">/etc/ganeti/hooks</filename> based on certain |
|
15 |
rules. |
|
16 |
</para> |
|
17 |
|
|
18 |
<para>This is similar to the <filename |
|
19 |
class="directory">/etc/network/</filename> structure present in |
|
20 |
Debian for network interface handling.</para> |
|
21 |
|
|
22 |
</section> |
|
23 |
|
|
24 |
|
|
25 |
<section> |
|
26 |
<title>Organisation</title> |
|
27 |
|
|
28 |
<para>For every operation, two sets of scripts are run: |
|
29 |
|
|
30 |
<itemizedlist> |
|
31 |
<listitem> |
|
32 |
<simpara>pre phase (for authorization/checking)</simpara> |
|
33 |
</listitem> |
|
34 |
<listitem> |
|
35 |
<simpara>post phase (for logging)</simpara> |
|
36 |
</listitem> |
|
37 |
</itemizedlist> |
|
38 |
</para> |
|
39 |
|
|
40 |
<para>Also, for each operation, the scripts are run on one or |
|
41 |
more nodes, depending on the operation type.</para> |
|
42 |
|
|
43 |
<para>Note that, even though we call them scripts, we are |
|
44 |
actually talking about any executable.</para> |
|
45 |
|
|
46 |
<section> |
|
47 |
<title><emphasis>pre</emphasis> scripts</title> |
|
48 |
|
|
49 |
<para>The <emphasis>pre</emphasis> scripts have a definite |
|
50 |
target: to check that the operation is allowed given the |
|
51 |
site-specific constraints. You could have, for example, a rule |
|
52 |
that says every new instance is required to exists in a |
|
53 |
database; to implement this, you could write a script that |
|
54 |
checks the new instance parameters against your |
|
55 |
database.</para> |
|
56 |
|
|
57 |
<para>The objective of these scripts should be their return |
|
58 |
code (zero or non-zero for success and failure). However, if |
|
59 |
they modify the environment in any way, they should be |
|
60 |
idempotent, as failed executions could be restarted and thus |
|
61 |
the script(s) run again with exactly the same |
|
62 |
parameters.</para> |
|
63 |
|
|
64 |
</section> |
|
65 |
|
|
66 |
<section> |
|
67 |
<title><emphasis>post</emphasis> scripts</title> |
|
68 |
|
|
69 |
<para>These scripts should do whatever you need as a reaction |
|
70 |
to the completion of an operation. Their return code is not |
|
71 |
checked (but logged), and they should not depend on the fact |
|
72 |
that the <emphasis>pre</emphasis> scripts have been |
|
73 |
run.</para> |
|
74 |
|
|
75 |
</section> |
|
76 |
|
|
77 |
<section> |
|
78 |
<title>Naming</title> |
|
79 |
|
|
80 |
<para>The allowed names for the scripts consist of (similar to |
|
81 |
<citerefentry> <refentrytitle>run-parts</refentrytitle> |
|
82 |
<manvolnum>8</manvolnum> </citerefentry>) upper and lower |
|
83 |
case, digits, underscores and hyphens. In other words, the |
|
84 |
regexp |
|
85 |
<computeroutput>^[a-zA-Z0-9_-]+$</computeroutput>. Also, |
|
86 |
non-executable scripts will be ignored. |
|
87 |
</para> |
|
88 |
</section> |
|
89 |
|
|
90 |
<section> |
|
91 |
<title>Order of execution</title> |
|
92 |
|
|
93 |
<para>On a single node, the scripts in a directory are run in |
|
94 |
lexicographic order (more exactly, the python string |
|
95 |
comparison order). It is advisable to implement the usual |
|
96 |
<emphasis>NN-name</emphasis> convention where |
|
97 |
<emphasis>NN</emphasis> is a two digit number.</para> |
|
98 |
|
|
99 |
<para>For an operation whose hooks are run on multiple nodes, |
|
100 |
there is no specific ordering of nodes with regard to hooks |
|
101 |
execution; you should assume that the scripts are run in |
|
102 |
parallel on the target nodes (keeping on each node the above |
|
103 |
specified ordering). If you need any kind of inter-node |
|
104 |
synchronisation, you have to implement it yourself in the |
|
105 |
scripts.</para> |
|
106 |
|
|
107 |
</section> |
|
108 |
|
|
109 |
<section> |
|
110 |
<title>Execution environment</title> |
|
111 |
|
|
112 |
<para>The scripts will be run as follows: |
|
113 |
<itemizedlist> |
|
114 |
<listitem> |
|
115 |
<simpara>no command line arguments</simpara> |
|
116 |
</listitem> |
|
117 |
<listitem> |
|
118 |
<simpara>no controlling <acronym>tty</acronym></simpara> |
|
119 |
</listitem> |
|
120 |
<listitem> |
|
121 |
<simpara><varname>stdin</varname> is |
|
122 |
actually <filename>/dev/null</filename></simpara> |
|
123 |
</listitem> |
|
124 |
<listitem> |
|
125 |
<simpara><varname>stdout</varname> and |
|
126 |
<varname>stderr</varname> are directed to |
|
127 |
files</simpara> |
|
128 |
</listitem> |
|
129 |
<listitem> |
|
130 |
<simpara>the <varname>PATH</varname> is reset to |
|
131 |
<literal>/sbin:/bin:/usr/sbin:/usr/bin</literal></simpara> |
|
132 |
</listitem> |
|
133 |
<listitem> |
|
134 |
<simpara>the environment is cleared, and only |
|
135 |
ganeti-specific variables will be left</simpara> |
|
136 |
</listitem> |
|
137 |
</itemizedlist> |
|
138 |
|
|
139 |
</para> |
|
140 |
|
|
141 |
<para>All informations about the cluster is passed using |
|
142 |
environment variables. Different operations will have sligthly |
|
143 |
different environments, but most of the variables are |
|
144 |
common.</para> |
|
145 |
|
|
146 |
</section> |
|
147 |
|
|
148 |
|
|
149 |
<section> |
|
150 |
<title>Operation list</title> |
|
151 |
<table> |
|
152 |
<title>Operation list</title> |
|
153 |
<tgroup cols="7"> |
|
154 |
<colspec> |
|
155 |
<colspec> |
|
156 |
<colspec> |
|
157 |
<colspec> |
|
158 |
<colspec> |
|
159 |
<colspec colname="prehooks"> |
|
160 |
<colspec colname="posthooks"> |
|
161 |
<spanspec namest="prehooks" nameend="posthooks" |
|
162 |
spanname="bothhooks"> |
|
163 |
<thead> |
|
164 |
<row> |
|
165 |
<entry>Operation ID</entry> |
|
166 |
<entry>Directory prefix</entry> |
|
167 |
<entry>Description</entry> |
|
168 |
<entry>Command</entry> |
|
169 |
<entry>Supported env. variables</entry> |
|
170 |
<entry><emphasis>pre</emphasis> hooks</entry> |
|
171 |
<entry><emphasis>post</emphasis> hooks</entry> |
|
172 |
</row> |
|
173 |
</thead> |
|
174 |
<tbody> |
|
175 |
<row> |
|
176 |
<entry>OP_INIT_CLUSTER</entry> |
|
177 |
<entry><filename class="directory">cluster-init</filename></entry> |
|
178 |
<entry>Initialises the cluster</entry> |
|
179 |
<entry><computeroutput>gnt-cluster init</computeroutput></entry> |
|
180 |
<entry><constant>CLUSTER</constant>, <constant>MASTER</constant></entry> |
|
181 |
<entry spanname="bothhooks">master node, cluster name</entry> |
|
182 |
</row> |
|
183 |
<row> |
|
184 |
<entry>OP_MASTER_FAILOVER</entry> |
|
185 |
<entry><filename class="directory">master-failover</filename></entry> |
|
186 |
<entry>Changes the master</entry> |
|
187 |
<entry><computeroutput>gnt-cluster master-failover</computeroutput></entry> |
|
188 |
<entry><constant>OLD_MASTER</constant>, <constant>NEW_MASTER</constant></entry> |
|
189 |
<entry>the new master</entry> |
|
190 |
<entry>all nodes</entry> |
|
191 |
</row> |
|
192 |
<row> |
|
193 |
<entry>OP_ADD_NODE</entry> |
|
194 |
<entry><filename class="directory">node-add</filename></entry> |
|
195 |
<entry>Adds a new node to the cluster</entry> |
|
196 |
<entry><computeroutput>gnt-node add</computeroutput></entry> |
|
197 |
<entry><constant>NODE_NAME</constant>, <constant>NODE_PIP</constant>, <constant>NODE_SIP</constant></entry> |
|
198 |
<entry>all existing nodes</entry> |
|
199 |
<entry>all existing nodes plus the new node</entry> |
|
200 |
</row> |
|
201 |
<row> |
|
202 |
<entry>OP_REMOVE_NODE</entry> |
|
203 |
<entry><filename class="directory">node-remove</filename></entry> |
|
204 |
<entry>Removes a node from the cluster</entry> |
|
205 |
<entry><computeroutput>gnt-node remove</computeroutput></entry> |
|
206 |
<entry><constant>NODE_NAME</constant></entry> |
|
207 |
<entry spanname="bothhooks">all existing nodes except the removed node</entry> |
|
208 |
</row> |
|
209 |
<row> |
|
210 |
<entry>OP_INSTANCE_ADD</entry> |
|
211 |
<entry><filename class="directory">instance-add</filename></entry> |
|
212 |
<entry>Creates a new instance</entry> |
|
213 |
<entry><computeroutput>gnt-instance add</computeroutput></entry> |
|
214 |
<entry><constant>INSTANCE_NAME</constant>, <constant>INSTANCE_PRIMARY</constant>, <constant>INSTANCE_SECONDARIES</constant>, <constant>DISK_TEMPLATE</constant>, <constant>MEM_SIZE</constant>, <constant>DISK_SIZE</constant>, <constant>SWAP_SIZE</constant>, <constant>VCPUS</constant>, <constant>INSTANCE_IP</constant>, <constant>INSTANCE_ADD_MODE</constant>, <constant>SRC_NODE</constant>, <constant>SRC_PATH</constant>, <constant>SRC_IMAGE</constant></entry> |
|
215 |
<entry spanname="bothhooks" morerows="4">master node, primary and |
|
216 |
secondary nodes</entry> |
|
217 |
</row> |
|
218 |
<row> |
|
219 |
<entry>OP_BACKUP_EXPORT</entry> |
|
220 |
<entry><filename class="directory">instance-export</filename></entry> |
|
221 |
<entry>Export the instance</entry> |
|
222 |
<entry><computeroutput>gnt-backup export</computeroutput></entry> |
|
223 |
<entry><constant>INSTANCE_NAME</constant>, <constant>EXPORT_NODE</constant>, <constant>EXPORT_DO_SHUTDOWN</constant></entry> |
|
224 |
</row> |
|
225 |
<row> |
|
226 |
<entry>OP_INSTANCE_START</entry> |
|
227 |
<entry><filename class="directory">instance-start</filename></entry> |
|
228 |
<entry>Starts an instance</entry> |
|
229 |
<entry><computeroutput>gnt-instance start</computeroutput></entry> |
|
230 |
<entry><constant>INSTANCE_NAME</constant>, <constant>INSTANCE_PRIMARY</constant>, <constant>INSTANCE_SECONDARIES</constant>, <constant>FORCE</constant></entry> |
|
231 |
</row> |
|
232 |
<row> |
|
233 |
<entry>OP_INSTANCE_SHUTDOWN</entry> |
|
234 |
<entry><filename class="directory">instance-shutdown</filename></entry> |
|
235 |
<entry>Stops an instance</entry> |
|
236 |
<entry><computeroutput>gnt-instance shutdown</computeroutput></entry> |
|
237 |
<entry><constant>INSTANCE_NAME</constant>, <constant>INSTANCE_PRIMARY</constant>, <constant>INSTANCE_SECONDARIES</constant></entry> |
|
238 |
</row> |
|
239 |
<row> |
|
240 |
<entry>OP_INSTANCE_MODIFY</entry> |
|
241 |
<entry><filename class="directory">instance-modify</filename></entry> |
|
242 |
<entry>Modifies the instance parameters.</entry> |
|
243 |
<entry><computeroutput>gnt-instance modify</computeroutput></entry> |
|
244 |
<entry><constant>INSTANCE_NAME</constant>, <constant>MEM_SIZE</constant>, <constant>VCPUS</constant>, <constant>INSTANCE_IP</constant></entry> |
|
245 |
</row> |
|
246 |
<row> |
|
247 |
<entry>OP_INSTANCE_FAILOVER</entry> |
|
248 |
<entry><filename class="directory">instance-failover</filename></entry> |
|
249 |
<entry>Failover an instance</entry> |
|
250 |
<entry><computeroutput>gnt-instance start</computeroutput></entry> |
|
251 |
<entry><constant>INSTANCE_NAME</constant>, <constant>INSTANCE_PRIMARY</constant>, <constant>INSTANCE_SECONDARIES</constant>, <constant>IGNORE_CONSISTENCY</constant></entry> |
|
252 |
</row> |
|
253 |
<row> |
|
254 |
<entry>OP_INSTANCE_REMOVE</entry> |
|
255 |
<entry><filename class="directory">instance-remove</filename></entry> |
|
256 |
<entry>Remove an instance</entry> |
|
257 |
<entry><computeroutput>gnt-instance remove</computeroutput></entry> |
|
258 |
<entry><constant>INSTANCE_NAME</constant>, <constant>INSTANCE_PRIMARY</constant>, <constant>INSTANCE_SECONDARIES</constant></entry> |
|
259 |
</row> |
|
260 |
<row> |
|
261 |
<entry>OP_INSTANCE_ADD_MDDRBD</entry> |
|
262 |
<entry><filename class="directory">mirror-add</filename></entry> |
|
263 |
<entry>Adds a mirror component</entry> |
|
264 |
<entry><computeroutput>gnt-instance add-mirror</computeroutput></entry> |
|
265 |
<entry><constant>INSTANCE_NAME</constant>, <constant>NEW_SECONDARY</constant>, <constant>DISK_NAME</constant></entry> |
|
266 |
</row> |
|
267 |
<row> |
|
268 |
<entry>OP_INSTANCE_REMOVE_MDDRBD</entry> |
|
269 |
<entry><filename class="directory">mirror-remove</filename></entry> |
|
270 |
<entry>Removes a mirror component</entry> |
|
271 |
<entry><computeroutput>gnt-instance remove-mirror</computeroutput></entry> |
|
272 |
<entry><constant>INSTANCE_NAME</constant>, <constant>OLD_SECONDARY</constant>, <constant>DISK_NAME</constant>, <constant>DISK_ID</constant></entry> |
|
273 |
</row> |
|
274 |
<row> |
|
275 |
<entry>OP_INSTANCE_REPLACE_DISKS</entry> |
|
276 |
<entry><filename class="directory">mirror-replace</filename></entry> |
|
277 |
<entry>Replace all mirror components</entry> |
|
278 |
<entry><computeroutput>gnt-instance replace-disks</computeroutput></entry> |
|
279 |
<entry><constant>INSTANCE_NAME</constant>, <constant>OLD_SECONDARY</constant>, <constant>NEW_SECONDARY</constant></entry> |
|
280 |
|
|
281 |
</row> |
|
282 |
</tbody> |
|
283 |
</tgroup> |
|
284 |
</table> |
|
285 |
</section> |
|
286 |
|
|
287 |
<section> |
|
288 |
<title>Environment variables</title> |
|
289 |
|
|
290 |
<para>Note that all variables listed here are actually prefixed |
|
291 |
with <constant>GANETI_</constant> in order to provide a |
|
292 |
different namespace.</para> |
|
293 |
|
|
294 |
<section> |
|
295 |
<title>Common variables</title> |
|
296 |
|
|
297 |
<para>This is the list of environment variables supported by |
|
298 |
all operations:</para> |
|
299 |
|
|
300 |
<variablelist> |
|
301 |
<varlistentry> |
|
302 |
<term>HOOKS_VERSION</term> |
|
303 |
<listitem> |
|
304 |
<para>Documents the hooks interface version. In case this |
|
305 |
doesnt match what the script expects, it should not |
|
306 |
run. The documents conforms to the version |
|
307 |
<literal>1</literal>.</para> |
|
308 |
</listitem> |
|
309 |
</varlistentry> |
|
310 |
<varlistentry> |
|
311 |
<term>HOOKS_PHASE</term> |
|
312 |
<listitem> |
|
313 |
<para>one of <constant>PRE</constant> or |
|
314 |
<constant>POST</constant> denoting which phase are we |
|
315 |
in.</para> |
|
316 |
</listitem> |
|
317 |
</varlistentry> |
|
318 |
<varlistentry> |
|
319 |
<term>CLUSTER</term> |
|
320 |
<listitem> |
|
321 |
<para>the cluster name</para> |
|
322 |
</listitem> |
|
323 |
</varlistentry> |
|
324 |
<varlistentry> |
|
325 |
<term>MASTER</term> |
|
326 |
<listitem> |
|
327 |
<para>the master node</para> |
|
328 |
</listitem> |
|
329 |
</varlistentry> |
|
330 |
<varlistentry> |
|
331 |
<term>OP_ID</term> |
|
332 |
<listitem> |
|
333 |
<para>one of the <constant>OP_*</constant> values from |
|
334 |
the table of operations</para> |
|
335 |
</listitem> |
|
336 |
</varlistentry> |
|
337 |
<varlistentry> |
|
338 |
<term>OBJECT_TYPE</term> |
|
339 |
<listitem> |
|
340 |
<para>one of <simplelist type="inline"> |
|
341 |
<member><constant>INSTANCE</constant></member> |
|
342 |
<member><constant>NODE</constant></member> |
|
343 |
<member><constant>CLUSTER</constant></member> |
|
344 |
</simplelist>, showing the target of the operation. |
|
345 |
</para> |
|
346 |
</listitem> |
|
347 |
</varlistentry> |
|
348 |
<!-- commented out since it causes problems in our rpc |
|
349 |
multi-node optimised calls |
|
350 |
<varlistentry> |
|
351 |
<term>HOST_NAME</term> |
|
352 |
<listitem> |
|
353 |
<para>The name of the node the hook is run on as known by |
|
354 |
the cluster.</para> |
|
355 |
</listitem> |
|
356 |
</varlistentry> |
|
357 |
<varlistentry> |
|
358 |
<term>HOST_TYPE</term> |
|
359 |
<listitem> |
|
360 |
<para>one of <simplelist type="inline"> |
|
361 |
<member><constant>MASTER</constant></member> |
|
362 |
<member><constant>NODE</constant></member> |
|
363 |
</simplelist>, showing the role of this node in the cluster. |
|
364 |
</para> |
|
365 |
</listitem> |
|
366 |
</varlistentry> |
|
367 |
--> |
|
368 |
</variablelist> |
|
369 |
</section> |
|
370 |
|
|
371 |
<section> |
|
372 |
<title>Specialised variables</title> |
|
373 |
|
|
374 |
<para>This is the list of variables which are specific to one |
|
375 |
or more operations.</para> |
|
376 |
<variablelist> |
|
377 |
<varlistentry> |
|
378 |
<term>INSTANCE_NAME</term> |
|
379 |
<listitem> |
|
380 |
<para>The name of the instance which is the target of |
|
381 |
the operation.</para> |
|
382 |
</listitem> |
|
383 |
</varlistentry> |
|
384 |
<varlistentry> |
|
385 |
<term>INSTANCE_DISK_TYPE</term> |
|
386 |
<listitem> |
|
387 |
<para>The disk type for the instance.</para> |
|
388 |
</listitem> |
|
389 |
</varlistentry> |
|
390 |
<varlistentry> |
|
391 |
<term>INSTANCE_DISK_SIZE</term> |
|
392 |
<listitem> |
|
393 |
<para>The (OS) disk size for the instance.</para> |
|
394 |
</listitem> |
|
395 |
</varlistentry> |
|
396 |
<varlistentry> |
|
397 |
<term>INSTANCE_OS</term> |
|
398 |
<listitem> |
|
399 |
<para>The name of the instance OS.</para> |
|
400 |
</listitem> |
|
401 |
</varlistentry> |
|
402 |
<varlistentry> |
|
403 |
<term>INSTANCE_PRIMARY</term> |
|
404 |
<listitem> |
|
405 |
<para>The name of the node which is the primary for the |
|
406 |
instance.</para> |
|
407 |
</listitem> |
|
408 |
</varlistentry> |
|
409 |
<varlistentry> |
|
410 |
<term>INSTANCE_SECONDARIES</term> |
|
411 |
<listitem> |
|
412 |
<para>Space-separated list of secondary nodes for the |
|
413 |
instance.</para> |
|
414 |
</listitem> |
|
415 |
</varlistentry> |
|
416 |
<varlistentry> |
|
417 |
<term>NODE_NAME</term> |
|
418 |
<listitem> |
|
419 |
<para>The target node of this operation (not the node on |
|
420 |
which the hook runs).</para> |
|
421 |
</listitem> |
|
422 |
</varlistentry> |
|
423 |
<varlistentry> |
|
424 |
<term>NODE_PIP</term> |
|
425 |
<listitem> |
|
426 |
<para>The primary IP of the target node (the one over |
|
427 |
which inter-node communication is done).</para> |
|
428 |
</listitem> |
|
429 |
</varlistentry> |
|
430 |
<varlistentry> |
|
431 |
<term>NODE_SIP</term> |
|
432 |
<listitem> |
|
433 |
<para>The secondary IP of the target node (the one over |
|
434 |
which drbd replication is done). This can be equal to |
|
435 |
the primary ip, in case the cluster is not |
|
436 |
dual-homed.</para> |
|
437 |
</listitem> |
|
438 |
</varlistentry> |
|
439 |
<varlistentry> |
|
440 |
<term>OLD_MASTER</term> |
|
441 |
<term>NEW_MASTER</term> |
|
442 |
<listitem> |
|
443 |
<para>The old, respectively the new master for the |
|
444 |
master failover operation.</para> |
|
445 |
</listitem> |
|
446 |
</varlistentry> |
|
447 |
<varlistentry> |
|
448 |
<term>FORCE</term> |
|
449 |
<listitem> |
|
450 |
<para>This is provided by some operations when the user |
|
451 |
gave this flag.</para> |
|
452 |
</listitem> |
|
453 |
</varlistentry> |
|
454 |
<varlistentry> |
|
455 |
<term>IGNORE_CONSISTENCY</term> |
|
456 |
<listitem> |
|
457 |
<para>The user has specified this flag. It is used when |
|
458 |
failing over instances in case the primary node is |
|
459 |
down.</para> |
|
460 |
</listitem> |
|
461 |
</varlistentry> |
|
462 |
<varlistentry> |
|
463 |
<term>MEM_SIZE, DISK_SIZE, SWAP_SIZE, VCPUS</term> |
|
464 |
<listitem> |
|
465 |
<para>The memory, disk, swap size and the number of |
|
466 |
processor selected for the instance (in |
|
467 |
<command>gnt-instance add</command> or |
|
468 |
<command>gnt-instance modify</command>).</para> |
|
469 |
</listitem> |
|
470 |
</varlistentry> |
|
471 |
<varlistentry> |
|
472 |
<term>INSTANCE_IP</term> |
|
473 |
<listitem> |
|
474 |
<para>If defined, the instance IP in the |
|
475 |
<command>gnt-instance add</command> and |
|
476 |
<command>gnt-instance set</command> commands. If not |
|
477 |
defined, it means that no IP has been defined.</para> |
|
478 |
</listitem> |
|
479 |
</varlistentry> |
|
480 |
<varlistentry> |
|
481 |
<term>DISK_TEMPLATE</term> |
|
482 |
<listitem> |
|
483 |
<para>The disk template type when creating the instance.</para> |
|
484 |
</listitem> |
|
485 |
</varlistentry> |
|
486 |
<varlistentry> |
|
487 |
<term>INSTANCE_ADD_MODE</term> |
|
488 |
<listitem> |
|
489 |
<para>The mode of the create: either |
|
490 |
<constant>create</constant> for create from scratch or |
|
491 |
<constant>import</constant> for restoring from an |
|
492 |
exported image.</para> |
|
493 |
</listitem> |
|
494 |
</varlistentry> |
|
495 |
<varlistentry> |
|
496 |
<term>SRC_NODE, SRC_PATH, SRC_IMAGE</term> |
|
497 |
<listitem> |
|
498 |
<para>In case the instance has been added by import, |
|
499 |
these variables are defined and point to the source |
|
500 |
node, source path (the directory containing the image |
|
501 |
and the config file) and the source disk image |
|
502 |
file.</para> |
|
503 |
</listitem> |
|
504 |
</varlistentry> |
|
505 |
<varlistentry> |
|
506 |
<term>DISK_NAME</term> |
|
507 |
<listitem> |
|
508 |
<para>The disk name (either <filename>sda</filename> or |
|
509 |
<filename>sdb</filename>) in mirror operations |
|
510 |
(add/remove mirror).</para> |
|
511 |
</listitem> |
|
512 |
</varlistentry> |
|
513 |
<varlistentry> |
|
514 |
<term>DISK_ID</term> |
|
515 |
<listitem> |
|
516 |
<para>The disk id for mirror remove operations. You can |
|
517 |
look this up using <command>gnt-instance |
|
518 |
info</command>.</para> |
|
519 |
</listitem> |
|
520 |
</varlistentry> |
|
521 |
<varlistentry> |
|
522 |
<term>NEW_SECONDARY</term> |
|
523 |
<listitem> |
|
524 |
<para>The name of the node on which the new mirror |
|
525 |
componet is being added. This can be the name of the |
|
526 |
current secondary, if the new mirror is on the same |
|
527 |
secondary.</para> |
|
528 |
</listitem> |
|
529 |
</varlistentry> |
|
530 |
<varlistentry> |
|
531 |
<term>OLD_SECONDARY</term> |
|
532 |
<listitem> |
|
533 |
<para>The name of the old secondary. This is used in |
|
534 |
both <command>replace-disks</command> and |
|
535 |
<command>remove-mirror</command>. Note that this can be |
|
536 |
equal to the new secondary (only |
|
537 |
<command>replace-disks</command> has both variables) if |
|
538 |
the secondary node hasn't actually changed).</para> |
|
539 |
</listitem> |
|
540 |
</varlistentry> |
|
541 |
<varlistentry> |
|
542 |
<term>EXPORT_NODE</term> |
|
543 |
<listitem> |
|
544 |
<para>The node on which the exported image of the |
|
545 |
instance was done.</para> |
|
546 |
</listitem> |
|
547 |
</varlistentry> |
|
548 |
<varlistentry> |
|
549 |
<term>EXPORT_DO_SHUTDOWN</term> |
|
550 |
<listitem> |
|
551 |
<para>This variable tells if the instance has been |
|
552 |
shutdown or not while doing the export. In the "was |
|
553 |
shutdown" case, it's likely that the filesystem is |
|
554 |
consistent, whereas in the "did not shutdown" case, the |
|
555 |
filesystem would need a check (journal replay or full |
|
556 |
fsck) in order to guarantee consistency.</para> |
|
557 |
</listitem> |
|
558 |
</varlistentry> |
|
559 |
</variablelist> |
|
560 |
|
|
561 |
</section> |
|
562 |
|
|
563 |
</section> |
|
564 |
|
|
565 |
</section> |
|
566 |
</article> |
b/doc/install.sgml | ||
---|---|---|
1 |
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.2//EN" [ |
|
2 |
]> |
|
3 |
<article class="specification"> |
|
4 |
<articleinfo> |
|
5 |
<title>Ganeti installation tutorial</title> |
|
6 |
</articleinfo> |
|
7 |
<para>Documents Ganeti version 1.2</para> |
|
8 |
|
|
9 |
<sect1> |
|
10 |
<title>Introduction</title> |
|
11 |
|
|
12 |
<para> |
|
13 |
Ganeti is a cluster virtualization management system based on |
|
14 |
Xen. This document explains how to bootstrap a Ganeti node (Xen |
|
15 |
<literal>dom0</literal>), create a running cluster and install |
|
16 |
virtual instance (Xen <literal>domU</literal>). You need to |
|
17 |
repeat most of the steps in this document for every node you |
|
18 |
want to install, but of course we recommend creating some |
|
19 |
semi-automatic procedure if you plan to deploy Ganeti on a |
|
20 |
medium/large scale. |
|
21 |
</para> |
|
22 |
|
|
23 |
<para> |
|
24 |
A basic Ganeti terminology glossary is provided in the |
|
25 |
introductory section of the <emphasis>Ganeti administrator's |
|
26 |
guide</emphasis>. Please refer to that document if you are |
|
27 |
uncertain about the terms we are using. |
|
28 |
</para> |
|
29 |
|
|
30 |
<para> |
|
31 |
Ganeti has been developed for Linux and is |
|
32 |
distribution-agnostic. This documentation will use Debian Etch |
|
33 |
as an example system but the examples can easily be translated |
|
34 |
to any other distribution. You are expected to be familiar with |
|
35 |
your distribution, its package management system, and Xen before |
|
36 |
trying to use Ganeti. |
|
37 |
</para> |
|
38 |
|
|
39 |
<para>This document is divided into two main sections: |
|
40 |
|
|
41 |
<itemizedlist> |
|
42 |
<listitem> |
|
43 |
<simpara>Installation of the base system and base |
|
44 |
components</simpara> |
|
45 |
</listitem> |
|
46 |
<listitem> |
|
47 |
<simpara>Configuration of the environment for |
|
48 |
Ganeti</simpara> |
|
49 |
</listitem> |
|
50 |
</itemizedlist> |
|
51 |
|
|
52 |
Each of these is divided into sub-sections. While a full Ganeti |
|
53 |
system will need all of the steps specified, some are not strictly |
|
54 |
required for every environment. Which ones they are, and why, is |
|
55 |
specified in the corresponding sections. |
|
56 |
</para> |
|
57 |
|
|
58 |
</sect1> |
|
59 |
|
|
60 |
<sect1> |
|
61 |
<title>Installing the base system and base components</title> |
|
62 |
|
|
63 |
<sect2> |
|
64 |
<title>Hardware requirements</title> |
|
65 |
|
|
66 |
<para> |
|
67 |
Any system supported by your Linux distribution is fine. |
|
68 |
64-bit systems are better as they can support more memory. |
|
69 |
</para> |
|
70 |
|
|
71 |
<para> |
|
72 |
Any disk drive recognized by Linux |
|
73 |
(<literal>IDE</literal>/<literal>SCSI</literal>/<literal>SATA</literal>/etc.) |
|
74 |
is supported in Ganeti. Note that no shared storage |
|
75 |
(e.g. <literal>SAN</literal>) is needed to get high-availability features. It is |
|
76 |
highly recommended to use more than one disk drive to improve |
|
77 |
speed. But Ganeti also works with one disk per machine. |
|
78 |
</para> |
|
79 |
|
|
80 |
<sect2> |
|
81 |
<title>Installing the base system</title> |
|
82 |
|
|
83 |
<para> |
|
84 |
<emphasis role="strong">Mandatory</emphasis> on all nodes. |
|
85 |
</para> |
|
86 |
|
|
87 |
<para> |
|
88 |
It is advised to start with a clean, minimal install of the |
|
89 |
operating system. The only requirement you need to be aware of |
|
90 |
at this stage is to partition leaving enough space for a big |
|
91 |
(<emphasis role="strong">minimum |
|
92 |
<constant>20GiB</constant></emphasis>) LVM volume group which |
|
93 |
will then host your instance filesystems. The volume group |
|
94 |
name Ganeti 1.2 uses (by default) is |
|
95 |
<emphasis>xenvg</emphasis>. |
|
96 |
</para> |
|
97 |
|
|
98 |
<para> |
|
99 |
While you can use an existing system, please note that the |
|
100 |
Ganeti installation is intrusive in terms of changes to the |
|
101 |
system configuration, and it's best to use a newly-installed |
|
102 |
system without important data on it. |
|
103 |
</para> |
|
104 |
|
|
105 |
<para> |
|
106 |
Also, for best results, it's advised that the nodes have as |
|
107 |
much as possible the same hardware and software |
|
108 |
configuration. This will make administration much easier. |
|
109 |
</para> |
|
110 |
|
|
111 |
<sect3> |
|
112 |
<title>Hostname issues</title> |
|
113 |
<para> |
|
114 |
Note that Ganeti requires the hostnames of the systems |
|
115 |
(i.e. what the <computeroutput>hostname</computeroutput> |
|
116 |
command outputs to be a fully-qualified name, not a short |
|
117 |
name. In other words, you should use |
|
118 |
<literal>node1.example.com</literal> as a hostname and not |
|
119 |
just <literal>node1</literal>. |
|
120 |
</para> |
|
121 |
|
|
122 |
<formalpara> |
|
123 |
<title>Debian</title> |
|
124 |
<para> |
|
125 |
Note that Debian Etch configures the hostname differently |
|
126 |
than you need it for Ganeti. For example, this is what |
|
127 |
Etch puts in <filename>/etc/hosts</filename> in certain |
|
128 |
situations: |
|
129 |
<screen> |
|
130 |
127.0.0.1 localhost |
|
131 |
127.0.1.1 node1.example.com node1 |
|
132 |
</screen> |
|
133 |
|
|
134 |
but for Ganeti you need to have: |
|
135 |
<screen> |
|
136 |
127.0.0.1 localhost |
|
137 |
192.168.1.1 node1.example.com node1 |
|
138 |
</screen> |
|
139 |
replacing <literal>192.168.1.1</literal> with your node's |
|
140 |
address. Also, the file <filename>/etc/hostname</filename> |
|
141 |
which configures the hostname of the system should contain |
|
142 |
<literal>node1.example.com</literal> and not just |
|
143 |
<literal>node1</literal> (you need to run the command |
|
144 |
<computeroutput>/etc/init.d/hostname.sh |
|
145 |
start</computeroutput> after changing the file). |
|
146 |
</para> |
|
147 |
</formalpara> |
|
148 |
</sect3> |
|
149 |
|
|
150 |
</sect2> |
|
151 |
|
|
152 |
<sect2> |
|
153 |
<title>Installing Xen</title> |
|
154 |
|
|
155 |
<para> |
|
156 |
<emphasis role="strong">Mandatory</emphasis> on all nodes. |
|
157 |
</para> |
|
158 |
|
|
159 |
<para> |
|
160 |
While Ganeti is developed with the ability to modularly run on |
|
161 |
different virtualization environments in mind the only one |
|
162 |
currently useable on a live system is <ulink |
|
163 |
url="http://xen.xensource.com/">Xen</ulink>. Supported |
|
164 |
versions are: <simplelist type="inline"> |
|
165 |
<member><literal>3.0.3</literal></member> |
|
166 |
<member><literal>3.0.4</literal></member> |
|
167 |
<member><literal>3.1</literal></member> </simplelist>. |
|
168 |
</para> |
|
169 |
|
|
170 |
<para> |
|
171 |
Please follow your distribution's recommended way to install |
|
172 |
and set up Xen, or install Xen from the upstream source, if |
|
173 |
you wish, following their manual. |
|
174 |
</para> |
|
175 |
|
|
176 |
<para> |
|
177 |
After installing Xen you need to reboot into your Xen-ified |
|
178 |
dom0 system. On some distributions this might involve |
|
179 |
configuring GRUB appropriately, whereas others will configure |
|
180 |
it automatically when you install Xen from a package. |
|
181 |
</para> |
|
182 |
|
|
183 |
<formalpara><title>Debian</title> |
|
184 |
<para> |
|
185 |
Under Debian Etch or Sarge+backports you can install the |
|
186 |
relevant <literal>xen-linux-system</literal> package, which |
|
187 |
will pull in both the hypervisor and the relevant |
|
188 |
kernel. Also, if you are installing a 32-bit Etch, you should |
|
189 |
install the <computeroutput>libc6-xen</computeroutput> package |
|
190 |
(run <computeroutput>apt-get install |
|
191 |
libc6-xen</computeroutput>). |
|
192 |
</para> |
|
193 |
</formalpara> |
|
194 |
|
|
195 |
<sect3> |
|
196 |
<title>Xen settings</title> |
|
197 |
|
|
198 |
<para> |
|
199 |
It's recommended that dom0 is restricted to a low amount of |
|
200 |
memory (<constant>512MiB</constant> is reasonable) and that |
|
201 |
memory ballooning is disabled in the file |
|
202 |
<filename>/etc/xen/xend-config.sxp</filename> by setting the |
|
203 |
value <literal>dom0-min-mem</literal> to |
|
204 |
<constant>0</constant>, like this: |
|
205 |
<computeroutput>(dom0-min-mem 0)</computeroutput> |
|
206 |
</para> |
|
207 |
|
|
208 |
<para> |
|
209 |
For optimum performance when running both CPU and I/O |
|
210 |
intensive instances, it's also recommended that the dom0 is |
|
211 |
restricted to one CPU only, for example by booting with the |
|
212 |
kernel parameter <literal>nosmp</literal>. |
|
213 |
</para> |
|
214 |
|
|
215 |
<formalpara> |
|
216 |
<title>Debian</title> |
|
217 |
<para> |
|
218 |
Besides the ballooning change which you need to set in |
|
219 |
<filename>/etc/xen/xend-config.sxp</filename>, you need to |
|
220 |
set the memory and nosmp parameters in the file |
|
221 |
<filename>/boot/grub/menu.lst</filename>. You need to |
|
222 |
modify the variable <literal>xenhopt</literal> to add |
|
223 |
<userinput>dom0_mem=512M</userinput> like this: |
|
224 |
<screen> |
|
225 |
## Xen hypervisor options to use with the default Xen boot option |
|
226 |
# xenhopt=dom0_mem=512M |
|
227 |
</screen> |
|
228 |
and the <literal>xenkopt</literal> needs to include the |
|
229 |
<userinput>nosmp</userinput> option like this: |
|
230 |
<screen> |
|
231 |
## Xen Linux kernel options to use with the default Xen boot option |
|
232 |
# xenkopt=nosmp |
|
233 |
</screen> |
|
234 |
|
|
235 |
Any existing parameters can be left in place: it's ok to |
|
236 |
have <computeroutput>xenkopt=console=tty0 |
|
237 |
nosmp</computeroutput>, for example. After modifying the |
|
238 |
files, you need to run: |
|
239 |
<screen> |
|
240 |
/sbin/update-grub |
|
241 |
</screen> |
|
242 |
</para> |
|
243 |
</formalpara> |
|
244 |
|
|
245 |
</sect3> |
|
246 |
|
|
247 |
<sect3> |
|
248 |
<title>Selecting the instance kernel</title> |
|
249 |
|
|
250 |
<para> |
|
251 |
After you have installed Xen, you need to tell Ganeti |
|
252 |
exactly what kernel to use for the instances it will |
|
253 |
create. This is done by creating a |
|
254 |
<emphasis>symlink</emphasis> from your actual kernel to |
|
255 |
<filename>/boot/vmlinuz-2.6-xenU</filename>, and one from |
|
256 |
your initrd to |
|
257 |
<filename>/boot/initrd-2.6-xenU</filename>. Note that if you |
|
258 |
don't use an initrd for the <literal>domU</literal> kernel, |
|
259 |
you don't need to create the initrd symlink. |
|
260 |
</para> |
|
261 |
|
|
262 |
<formalpara> |
|
263 |
<title>Debian</title> |
|
264 |
<para> |
|
265 |
After installation of the |
|
266 |
<literal>xen-linux-system</literal> package, you need to |
|
267 |
run (replace the exact version number with the one you |
|
268 |
have): |
|
269 |
<screen> |
|
270 |
cd /boot |
|
271 |
ln -s vmlinuz-2.6.18-5-xen-686 vmlinuz-2.6-xenU |
|
272 |
ln -s initrd.img-2.6.18-5-xen-686 initrd-2.6-xenU |
|
273 |
</screen> |
|
274 |
</para> |
|
275 |
</formalpara> |
|
276 |
</sect3> |
|
277 |
|
|
278 |
</sect2> |
|
279 |
|
|
280 |
<sect2> |
|
281 |
<title>Installing DRBD</title> |
|
282 |
|
|
283 |
<para> |
|
284 |
Recommended on all nodes: <ulink |
|
285 |
url="http://www.drbd.org/">DRBD</ulink> is required if you |
|
286 |
want to use the high availability (HA) features of Ganeti, but |
|
287 |
optional if you don't require HA or only run Ganeti on |
|
288 |
single-node clusters. You can upgrade a non-HA cluster to an |
|
289 |
HA one later, but you might need to export and re-import all |
|
290 |
your instances to take advantage of the new features. |
|
291 |
</para> |
|
292 |
|
|
293 |
<para> |
|
294 |
Supported DRBD version: the <literal>0.7</literal> |
|
295 |
series. It's recommended to have at least version |
|
296 |
<literal>0.7.24</literal> if you use <command>udev</command> |
|
297 |
since older versions have a bug related to device discovery |
|
298 |
which can be triggered in cases of hard drive failure. |
|
299 |
</para> |
Also available in: Unified diff