Statistics
| Branch: | Tag: | Revision:

root / doc / walkthrough.rst @ 513c5e25

History | View | Annotate | Download (42.6 kB)

1 c71a1a3d Iustin Pop
Ganeti walk-through
2 c71a1a3d Iustin Pop
===================
3 c71a1a3d Iustin Pop
4 c71a1a3d Iustin Pop
Documents Ganeti version |version|
5 c71a1a3d Iustin Pop
6 c71a1a3d Iustin Pop
.. contents::
7 c71a1a3d Iustin Pop
8 832f8c6a Iustin Pop
.. highlight:: shell-example
9 c71a1a3d Iustin Pop
10 c71a1a3d Iustin Pop
Introduction
11 c71a1a3d Iustin Pop
------------
12 c71a1a3d Iustin Pop
13 c71a1a3d Iustin Pop
This document serves as a more example-oriented guide to Ganeti; while
14 c71a1a3d Iustin Pop
the administration guide shows a conceptual approach, here you will find
15 c71a1a3d Iustin Pop
a step-by-step example to managing instances and the cluster.
16 c71a1a3d Iustin Pop
17 c71a1a3d Iustin Pop
Our simulated, example cluster will have three machines, named
18 c71a1a3d Iustin Pop
``node1``, ``node2``, ``node3``. Note that in real life machines will
19 986efb78 Michele Tartara
usually have FQDNs but here we use short names for brevity. We will use
20 986efb78 Michele Tartara
a secondary network for replication data, ``192.0.2.0/24``, with nodes
21 c71a1a3d Iustin Pop
having the last octet the same as their index. The cluster name will be
22 c71a1a3d Iustin Pop
``example-cluster``. All nodes have the same simulated hardware
23 c71a1a3d Iustin Pop
configuration, two disks of 750GB, 32GB of memory and 4 CPUs.
24 c71a1a3d Iustin Pop
25 c71a1a3d Iustin Pop
On this cluster, we will create up to seven instances, named
26 c71a1a3d Iustin Pop
``instance1`` to ``instance7``.
27 c71a1a3d Iustin Pop
28 c71a1a3d Iustin Pop
29 c71a1a3d Iustin Pop
Cluster creation
30 c71a1a3d Iustin Pop
----------------
31 c71a1a3d Iustin Pop
32 c71a1a3d Iustin Pop
Follow the :doc:`install` document and prepare the nodes. Then it's time
33 c71a1a3d Iustin Pop
to initialise the cluster::
34 c71a1a3d Iustin Pop
35 832f8c6a Iustin Pop
  $ gnt-cluster init -s %192.0.2.1% --enabled-hypervisors=xen-pvm %example-cluster%
36 832f8c6a Iustin Pop
  $
37 c71a1a3d Iustin Pop
38 c71a1a3d Iustin Pop
The creation was fine. Let's check that one node we have is functioning
39 c71a1a3d Iustin Pop
correctly::
40 c71a1a3d Iustin Pop
41 832f8c6a Iustin Pop
  $ gnt-node list
42 c71a1a3d Iustin Pop
  Node  DTotal DFree MTotal MNode MFree Pinst Sinst
43 c71a1a3d Iustin Pop
  node1   1.3T  1.3T  32.0G  1.0G 30.5G     0     0
44 832f8c6a Iustin Pop
  $ gnt-cluster verify
45 c71a1a3d Iustin Pop
  Mon Oct 26 02:08:51 2009 * Verifying global settings
46 c71a1a3d Iustin Pop
  Mon Oct 26 02:08:51 2009 * Gathering data (1 nodes)
47 c71a1a3d Iustin Pop
  Mon Oct 26 02:08:52 2009 * Verifying node status
48 c71a1a3d Iustin Pop
  Mon Oct 26 02:08:52 2009 * Verifying instance status
49 c71a1a3d Iustin Pop
  Mon Oct 26 02:08:52 2009 * Verifying orphan volumes
50 c71a1a3d Iustin Pop
  Mon Oct 26 02:08:52 2009 * Verifying remaining instances
51 c71a1a3d Iustin Pop
  Mon Oct 26 02:08:52 2009 * Verifying N+1 Memory redundancy
52 c71a1a3d Iustin Pop
  Mon Oct 26 02:08:52 2009 * Other Notes
53 c71a1a3d Iustin Pop
  Mon Oct 26 02:08:52 2009 * Hooks Results
54 832f8c6a Iustin Pop
  $
55 c71a1a3d Iustin Pop
56 c71a1a3d Iustin Pop
Since this proceeded correctly, let's add the other two nodes::
57 c71a1a3d Iustin Pop
58 832f8c6a Iustin Pop
  $ gnt-node add -s %192.0.2.2% %node2%
59 c71a1a3d Iustin Pop
  -- WARNING --
60 c71a1a3d Iustin Pop
  Performing this operation is going to replace the ssh daemon keypair
61 c71a1a3d Iustin Pop
  on the target machine (node2) with the ones of the current one
62 c71a1a3d Iustin Pop
  and grant full intra-cluster ssh root access to/from it
63 c71a1a3d Iustin Pop
64 832f8c6a Iustin Pop
  Unable to verify hostkey of host xen-devi-5.fra.corp.google.com:
65 832f8c6a Iustin Pop
  f7:…. Do you want to accept it?
66 832f8c6a Iustin Pop
  y/[n]/?: %y%
67 832f8c6a Iustin Pop
  Mon Oct 26 02:11:53 2009  Authentication to node2 via public key failed, trying password
68 832f8c6a Iustin Pop
  root password:
69 c71a1a3d Iustin Pop
  Mon Oct 26 02:11:54 2009  - INFO: Node will be a master candidate
70 832f8c6a Iustin Pop
  $ gnt-node add -s %192.0.2.3% %node3%
71 c71a1a3d Iustin Pop
  -- WARNING --
72 c71a1a3d Iustin Pop
  Performing this operation is going to replace the ssh daemon keypair
73 832f8c6a Iustin Pop
  on the target machine (node3) with the ones of the current one
74 c71a1a3d Iustin Pop
  and grant full intra-cluster ssh root access to/from it
75 c71a1a3d Iustin Pop
76 832f8c6a Iustin Pop
77 832f8c6a Iustin Pop
  Mon Oct 26 02:12:43 2009  - INFO: Node will be a master candidate
78 c71a1a3d Iustin Pop
79 c71a1a3d Iustin Pop
Checking the cluster status again::
80 c71a1a3d Iustin Pop
81 832f8c6a Iustin Pop
  $ gnt-node list
82 c71a1a3d Iustin Pop
  Node  DTotal DFree MTotal MNode MFree Pinst Sinst
83 c71a1a3d Iustin Pop
  node1   1.3T  1.3T  32.0G  1.0G 30.5G     0     0
84 c71a1a3d Iustin Pop
  node2   1.3T  1.3T  32.0G  1.0G 30.5G     0     0
85 c71a1a3d Iustin Pop
  node3   1.3T  1.3T  32.0G  1.0G 30.5G     0     0
86 832f8c6a Iustin Pop
  $ gnt-cluster verify
87 c71a1a3d Iustin Pop
  Mon Oct 26 02:15:14 2009 * Verifying global settings
88 c71a1a3d Iustin Pop
  Mon Oct 26 02:15:14 2009 * Gathering data (3 nodes)
89 c71a1a3d Iustin Pop
  Mon Oct 26 02:15:16 2009 * Verifying node status
90 c71a1a3d Iustin Pop
  Mon Oct 26 02:15:16 2009 * Verifying instance status
91 c71a1a3d Iustin Pop
  Mon Oct 26 02:15:16 2009 * Verifying orphan volumes
92 c71a1a3d Iustin Pop
  Mon Oct 26 02:15:16 2009 * Verifying remaining instances
93 c71a1a3d Iustin Pop
  Mon Oct 26 02:15:16 2009 * Verifying N+1 Memory redundancy
94 c71a1a3d Iustin Pop
  Mon Oct 26 02:15:16 2009 * Other Notes
95 c71a1a3d Iustin Pop
  Mon Oct 26 02:15:16 2009 * Hooks Results
96 832f8c6a Iustin Pop
  $
97 c71a1a3d Iustin Pop
98 c71a1a3d Iustin Pop
And let's check that we have a valid OS::
99 c71a1a3d Iustin Pop
100 832f8c6a Iustin Pop
  $ gnt-os list
101 c71a1a3d Iustin Pop
  Name
102 c71a1a3d Iustin Pop
  debootstrap
103 c71a1a3d Iustin Pop
  node1#
104 c71a1a3d Iustin Pop
105 1cdc9dbb Bernardo Dal Seno
Running a burn-in
106 1cdc9dbb Bernardo Dal Seno
-----------------
107 c71a1a3d Iustin Pop
108 c71a1a3d Iustin Pop
Now that the cluster is created, it is time to check that the hardware
109 c71a1a3d Iustin Pop
works correctly, that the hypervisor can actually create instances,
110 c71a1a3d Iustin Pop
etc. This is done via the debootstrap tool as described in the admin
111 c71a1a3d Iustin Pop
guide. Similar output lines are replaced with ``…`` in the below log::
112 c71a1a3d Iustin Pop
113 832f8c6a Iustin Pop
  $ /usr/lib/ganeti/tools/burnin -o debootstrap -p instance{1..5}
114 c71a1a3d Iustin Pop
  - Testing global parameters
115 c71a1a3d Iustin Pop
  - Creating instances
116 c71a1a3d Iustin Pop
    * instance instance1
117 c71a1a3d Iustin Pop
      on node1, node2
118 c71a1a3d Iustin Pop
    * instance instance2
119 c71a1a3d Iustin Pop
      on node2, node3
120 c71a1a3d Iustin Pop
121 c71a1a3d Iustin Pop
    * instance instance5
122 c71a1a3d Iustin Pop
      on node2, node3
123 c71a1a3d Iustin Pop
    * Submitted job ID(s) 157, 158, 159, 160, 161
124 c71a1a3d Iustin Pop
      waiting for job 157 for instance1
125 c71a1a3d Iustin Pop
126 c71a1a3d Iustin Pop
      waiting for job 161 for instance5
127 c71a1a3d Iustin Pop
  - Replacing disks on the same nodes
128 c71a1a3d Iustin Pop
    * instance instance1
129 c71a1a3d Iustin Pop
      run replace_on_secondary
130 c71a1a3d Iustin Pop
      run replace_on_primary
131 c71a1a3d Iustin Pop
132 c71a1a3d Iustin Pop
    * instance instance5
133 c71a1a3d Iustin Pop
      run replace_on_secondary
134 c71a1a3d Iustin Pop
      run replace_on_primary
135 c71a1a3d Iustin Pop
    * Submitted job ID(s) 162, 163, 164, 165, 166
136 c71a1a3d Iustin Pop
      waiting for job 162 for instance1
137 c71a1a3d Iustin Pop
138 c71a1a3d Iustin Pop
  - Changing the secondary node
139 c71a1a3d Iustin Pop
    * instance instance1
140 c71a1a3d Iustin Pop
      run replace_new_secondary node3
141 c71a1a3d Iustin Pop
    * instance instance2
142 c71a1a3d Iustin Pop
      run replace_new_secondary node1
143 c71a1a3d Iustin Pop
144 c71a1a3d Iustin Pop
    * instance instance5
145 c71a1a3d Iustin Pop
      run replace_new_secondary node1
146 c71a1a3d Iustin Pop
    * Submitted job ID(s) 167, 168, 169, 170, 171
147 c71a1a3d Iustin Pop
      waiting for job 167 for instance1
148 c71a1a3d Iustin Pop
149 c71a1a3d Iustin Pop
  - Growing disks
150 c71a1a3d Iustin Pop
    * instance instance1
151 c71a1a3d Iustin Pop
      increase disk/0 by 128 MB
152 c71a1a3d Iustin Pop
153 c71a1a3d Iustin Pop
    * instance instance5
154 c71a1a3d Iustin Pop
      increase disk/0 by 128 MB
155 c71a1a3d Iustin Pop
    * Submitted job ID(s) 173, 174, 175, 176, 177
156 c71a1a3d Iustin Pop
      waiting for job 173 for instance1
157 c71a1a3d Iustin Pop
158 c71a1a3d Iustin Pop
  - Failing over instances
159 c71a1a3d Iustin Pop
    * instance instance1
160 c71a1a3d Iustin Pop
161 c71a1a3d Iustin Pop
    * instance instance5
162 c71a1a3d Iustin Pop
    * Submitted job ID(s) 179, 180, 181, 182, 183
163 c71a1a3d Iustin Pop
      waiting for job 179 for instance1
164 c71a1a3d Iustin Pop
165 c71a1a3d Iustin Pop
  - Migrating instances
166 c71a1a3d Iustin Pop
    * instance instance1
167 c71a1a3d Iustin Pop
      migration and migration cleanup
168 c71a1a3d Iustin Pop
169 c71a1a3d Iustin Pop
    * instance instance5
170 c71a1a3d Iustin Pop
      migration and migration cleanup
171 c71a1a3d Iustin Pop
    * Submitted job ID(s) 184, 185, 186, 187, 188
172 c71a1a3d Iustin Pop
      waiting for job 184 for instance1
173 c71a1a3d Iustin Pop
174 c71a1a3d Iustin Pop
  - Exporting and re-importing instances
175 c71a1a3d Iustin Pop
    * instance instance1
176 c71a1a3d Iustin Pop
      export to node node3
177 c71a1a3d Iustin Pop
      remove instance
178 c71a1a3d Iustin Pop
      import from node3 to node1, node2
179 c71a1a3d Iustin Pop
      remove export
180 c71a1a3d Iustin Pop
181 c71a1a3d Iustin Pop
    * instance instance5
182 c71a1a3d Iustin Pop
      export to node node1
183 c71a1a3d Iustin Pop
      remove instance
184 c71a1a3d Iustin Pop
      import from node1 to node2, node3
185 c71a1a3d Iustin Pop
      remove export
186 c71a1a3d Iustin Pop
    * Submitted job ID(s) 196, 197, 198, 199, 200
187 c71a1a3d Iustin Pop
      waiting for job 196 for instance1
188 c71a1a3d Iustin Pop
189 c71a1a3d Iustin Pop
  - Reinstalling instances
190 c71a1a3d Iustin Pop
    * instance instance1
191 c71a1a3d Iustin Pop
      reinstall without passing the OS
192 c71a1a3d Iustin Pop
      reinstall specifying the OS
193 c71a1a3d Iustin Pop
194 c71a1a3d Iustin Pop
    * instance instance5
195 c71a1a3d Iustin Pop
      reinstall without passing the OS
196 c71a1a3d Iustin Pop
      reinstall specifying the OS
197 c71a1a3d Iustin Pop
    * Submitted job ID(s) 203, 204, 205, 206, 207
198 c71a1a3d Iustin Pop
      waiting for job 203 for instance1
199 c71a1a3d Iustin Pop
200 c71a1a3d Iustin Pop
  - Rebooting instances
201 c71a1a3d Iustin Pop
    * instance instance1
202 c71a1a3d Iustin Pop
      reboot with type 'hard'
203 c71a1a3d Iustin Pop
      reboot with type 'soft'
204 c71a1a3d Iustin Pop
      reboot with type 'full'
205 c71a1a3d Iustin Pop
206 c71a1a3d Iustin Pop
    * instance instance5
207 c71a1a3d Iustin Pop
      reboot with type 'hard'
208 c71a1a3d Iustin Pop
      reboot with type 'soft'
209 c71a1a3d Iustin Pop
      reboot with type 'full'
210 c71a1a3d Iustin Pop
    * Submitted job ID(s) 208, 209, 210, 211, 212
211 c71a1a3d Iustin Pop
      waiting for job 208 for instance1
212 c71a1a3d Iustin Pop
213 c71a1a3d Iustin Pop
  - Adding and removing disks
214 c71a1a3d Iustin Pop
    * instance instance1
215 c71a1a3d Iustin Pop
      adding a disk
216 c71a1a3d Iustin Pop
      removing last disk
217 c71a1a3d Iustin Pop
218 c71a1a3d Iustin Pop
    * instance instance5
219 c71a1a3d Iustin Pop
      adding a disk
220 c71a1a3d Iustin Pop
      removing last disk
221 c71a1a3d Iustin Pop
    * Submitted job ID(s) 213, 214, 215, 216, 217
222 c71a1a3d Iustin Pop
      waiting for job 213 for instance1
223 c71a1a3d Iustin Pop
224 c71a1a3d Iustin Pop
  - Adding and removing NICs
225 c71a1a3d Iustin Pop
    * instance instance1
226 c71a1a3d Iustin Pop
      adding a NIC
227 c71a1a3d Iustin Pop
      removing last NIC
228 c71a1a3d Iustin Pop
229 c71a1a3d Iustin Pop
    * instance instance5
230 c71a1a3d Iustin Pop
      adding a NIC
231 c71a1a3d Iustin Pop
      removing last NIC
232 c71a1a3d Iustin Pop
    * Submitted job ID(s) 218, 219, 220, 221, 222
233 c71a1a3d Iustin Pop
      waiting for job 218 for instance1
234 c71a1a3d Iustin Pop
235 c71a1a3d Iustin Pop
  - Activating/deactivating disks
236 c71a1a3d Iustin Pop
    * instance instance1
237 c71a1a3d Iustin Pop
      activate disks when online
238 c71a1a3d Iustin Pop
      activate disks when offline
239 c71a1a3d Iustin Pop
      deactivate disks (when offline)
240 c71a1a3d Iustin Pop
241 c71a1a3d Iustin Pop
    * instance instance5
242 c71a1a3d Iustin Pop
      activate disks when online
243 c71a1a3d Iustin Pop
      activate disks when offline
244 c71a1a3d Iustin Pop
      deactivate disks (when offline)
245 c71a1a3d Iustin Pop
    * Submitted job ID(s) 223, 224, 225, 226, 227
246 c71a1a3d Iustin Pop
      waiting for job 223 for instance1
247 c71a1a3d Iustin Pop
248 c71a1a3d Iustin Pop
  - Stopping and starting instances
249 c71a1a3d Iustin Pop
    * instance instance1
250 c71a1a3d Iustin Pop
251 c71a1a3d Iustin Pop
    * instance instance5
252 c71a1a3d Iustin Pop
    * Submitted job ID(s) 230, 231, 232, 233, 234
253 c71a1a3d Iustin Pop
      waiting for job 230 for instance1
254 c71a1a3d Iustin Pop
255 c71a1a3d Iustin Pop
  - Removing instances
256 c71a1a3d Iustin Pop
    * instance instance1
257 c71a1a3d Iustin Pop
258 c71a1a3d Iustin Pop
    * instance instance5
259 c71a1a3d Iustin Pop
    * Submitted job ID(s) 235, 236, 237, 238, 239
260 c71a1a3d Iustin Pop
      waiting for job 235 for instance1
261 c71a1a3d Iustin Pop
262 832f8c6a Iustin Pop
  $
263 c71a1a3d Iustin Pop
264 1cdc9dbb Bernardo Dal Seno
You can see in the above what operations the burn-in does. Ideally, the
265 1cdc9dbb Bernardo Dal Seno
burn-in log would proceed successfully through all the steps and end
266 c71a1a3d Iustin Pop
cleanly, without throwing errors.
267 c71a1a3d Iustin Pop
268 c71a1a3d Iustin Pop
Instance operations
269 c71a1a3d Iustin Pop
-------------------
270 c71a1a3d Iustin Pop
271 c71a1a3d Iustin Pop
Creation
272 c71a1a3d Iustin Pop
++++++++
273 c71a1a3d Iustin Pop
274 c71a1a3d Iustin Pop
At this point, Ganeti and the hardware seems to be functioning
275 c71a1a3d Iustin Pop
correctly, so we'll follow up with creating the instances manually::
276 c71a1a3d Iustin Pop
277 651c1c3e Helga Velroyen
  $ gnt-instance add -t drbd -o debootstrap -s %256m% %instance3%
278 c71a1a3d Iustin Pop
  Mon Oct 26 04:06:52 2009  - INFO: Selected nodes for instance instance1 via iallocator hail: node2, node3
279 c71a1a3d Iustin Pop
  Mon Oct 26 04:06:53 2009 * creating instance disks...
280 c71a1a3d Iustin Pop
  Mon Oct 26 04:06:57 2009 adding instance instance1 to cluster config
281 c71a1a3d Iustin Pop
  Mon Oct 26 04:06:57 2009  - INFO: Waiting for instance instance1 to sync disks.
282 832f8c6a Iustin Pop
  Mon Oct 26 04:06:57 2009  - INFO: - device disk/0: 20.00\% done, 4 estimated seconds remaining
283 c71a1a3d Iustin Pop
  Mon Oct 26 04:07:01 2009  - INFO: Instance instance1's disks are in sync.
284 c71a1a3d Iustin Pop
  Mon Oct 26 04:07:01 2009 creating os for instance instance1 on node node2
285 c71a1a3d Iustin Pop
  Mon Oct 26 04:07:01 2009 * running the instance OS create scripts...
286 c71a1a3d Iustin Pop
  Mon Oct 26 04:07:14 2009 * starting instance...
287 832f8c6a Iustin Pop
  $ gnt-instance add -t drbd -o debootstrap -s %256m% -n %node1%:%node2% %instance2%
288 c71a1a3d Iustin Pop
  Mon Oct 26 04:11:37 2009 * creating instance disks...
289 c71a1a3d Iustin Pop
  Mon Oct 26 04:11:40 2009 adding instance instance2 to cluster config
290 c71a1a3d Iustin Pop
  Mon Oct 26 04:11:41 2009  - INFO: Waiting for instance instance2 to sync disks.
291 832f8c6a Iustin Pop
  Mon Oct 26 04:11:41 2009  - INFO: - device disk/0: 35.40\% done, 1 estimated seconds remaining
292 832f8c6a Iustin Pop
  Mon Oct 26 04:11:42 2009  - INFO: - device disk/0: 58.50\% done, 1 estimated seconds remaining
293 832f8c6a Iustin Pop
  Mon Oct 26 04:11:43 2009  - INFO: - device disk/0: 86.20\% done, 0 estimated seconds remaining
294 832f8c6a Iustin Pop
  Mon Oct 26 04:11:44 2009  - INFO: - device disk/0: 92.40\% done, 0 estimated seconds remaining
295 832f8c6a Iustin Pop
  Mon Oct 26 04:11:44 2009  - INFO: - device disk/0: 97.00\% done, 0 estimated seconds remaining
296 c71a1a3d Iustin Pop
  Mon Oct 26 04:11:44 2009  - INFO: Instance instance2's disks are in sync.
297 c71a1a3d Iustin Pop
  Mon Oct 26 04:11:44 2009 creating os for instance instance2 on node node1
298 c71a1a3d Iustin Pop
  Mon Oct 26 04:11:44 2009 * running the instance OS create scripts...
299 c71a1a3d Iustin Pop
  Mon Oct 26 04:11:57 2009 * starting instance...
300 832f8c6a Iustin Pop
  $
301 c71a1a3d Iustin Pop
302 c71a1a3d Iustin Pop
The above shows one instance created via an iallocator script, and one
303 c71a1a3d Iustin Pop
being created with manual node assignment. The other three instances
304 c71a1a3d Iustin Pop
were also created and now it's time to check them::
305 c71a1a3d Iustin Pop
306 832f8c6a Iustin Pop
  $ gnt-instance list
307 c71a1a3d Iustin Pop
  Instance  Hypervisor OS          Primary_node Status  Memory
308 c71a1a3d Iustin Pop
  instance1 xen-pvm    debootstrap node2        running   128M
309 c71a1a3d Iustin Pop
  instance2 xen-pvm    debootstrap node1        running   128M
310 c71a1a3d Iustin Pop
  instance3 xen-pvm    debootstrap node1        running   128M
311 c71a1a3d Iustin Pop
  instance4 xen-pvm    debootstrap node3        running   128M
312 c71a1a3d Iustin Pop
  instance5 xen-pvm    debootstrap node2        running   128M
313 c71a1a3d Iustin Pop
314 c71a1a3d Iustin Pop
Accessing instances
315 c71a1a3d Iustin Pop
+++++++++++++++++++
316 c71a1a3d Iustin Pop
317 c71a1a3d Iustin Pop
Accessing an instance's console is easy::
318 c71a1a3d Iustin Pop
319 832f8c6a Iustin Pop
  $ gnt-instance console %instance2%
320 c71a1a3d Iustin Pop
  [    0.000000] Bootdata ok (command line is root=/dev/sda1 ro)
321 c71a1a3d Iustin Pop
  [    0.000000] Linux version 2.6…
322 c71a1a3d Iustin Pop
  [    0.000000] BIOS-provided physical RAM map:
323 c71a1a3d Iustin Pop
  [    0.000000]  Xen: 0000000000000000 - 0000000008800000 (usable)
324 c71a1a3d Iustin Pop
  [13138176.018071] Built 1 zonelists.  Total pages: 34816
325 c71a1a3d Iustin Pop
  [13138176.018074] Kernel command line: root=/dev/sda1 ro
326 c71a1a3d Iustin Pop
  [13138176.018694] Initializing CPU#0
327 c71a1a3d Iustin Pop
328 c71a1a3d Iustin Pop
  Checking file systems...fsck 1.41.3 (12-Oct-2008)
329 c71a1a3d Iustin Pop
  done.
330 c71a1a3d Iustin Pop
  Setting kernel variables (/etc/sysctl.conf)...done.
331 c71a1a3d Iustin Pop
  Mounting local filesystems...done.
332 c71a1a3d Iustin Pop
  Activating swapfile swap...done.
333 c71a1a3d Iustin Pop
  Setting up networking....
334 c71a1a3d Iustin Pop
  Configuring network interfaces...done.
335 c71a1a3d Iustin Pop
  Setting console screen modes and fonts.
336 c71a1a3d Iustin Pop
  INIT: Entering runlevel: 2
337 c71a1a3d Iustin Pop
  Starting enhanced syslogd: rsyslogd.
338 c71a1a3d Iustin Pop
  Starting periodic command scheduler: crond.
339 c71a1a3d Iustin Pop
340 c71a1a3d Iustin Pop
  Debian GNU/Linux 5.0 instance2 tty1
341 c71a1a3d Iustin Pop
342 c71a1a3d Iustin Pop
  instance2 login:
343 c71a1a3d Iustin Pop
344 c71a1a3d Iustin Pop
At this moment you can login to the instance and, after configuring the
345 c71a1a3d Iustin Pop
network (and doing this on all instances), we can check their
346 c71a1a3d Iustin Pop
connectivity::
347 c71a1a3d Iustin Pop
348 832f8c6a Iustin Pop
  $ fping %instance{1..5}%
349 c71a1a3d Iustin Pop
  instance1 is alive
350 c71a1a3d Iustin Pop
  instance2 is alive
351 c71a1a3d Iustin Pop
  instance3 is alive
352 c71a1a3d Iustin Pop
  instance4 is alive
353 c71a1a3d Iustin Pop
  instance5 is alive
354 832f8c6a Iustin Pop
  $
355 c71a1a3d Iustin Pop
356 c71a1a3d Iustin Pop
Removal
357 c71a1a3d Iustin Pop
+++++++
358 c71a1a3d Iustin Pop
359 c71a1a3d Iustin Pop
Removing unwanted instances is also easy::
360 c71a1a3d Iustin Pop
361 832f8c6a Iustin Pop
  $ gnt-instance remove %instance5%
362 c71a1a3d Iustin Pop
  This will remove the volumes of the instance instance5 (including
363 c71a1a3d Iustin Pop
  mirrors), thus removing all the data of the instance. Continue?
364 832f8c6a Iustin Pop
  y/[n]/?: %y%
365 832f8c6a Iustin Pop
  $
366 c71a1a3d Iustin Pop
367 c71a1a3d Iustin Pop
368 c71a1a3d Iustin Pop
Recovering from hardware failures
369 c71a1a3d Iustin Pop
---------------------------------
370 c71a1a3d Iustin Pop
371 c71a1a3d Iustin Pop
Recovering from node failure
372 c71a1a3d Iustin Pop
++++++++++++++++++++++++++++
373 c71a1a3d Iustin Pop
374 c71a1a3d Iustin Pop
We are now left with four instances. Assume that at this point, node3,
375 c71a1a3d Iustin Pop
which has one primary and one secondary instance, crashes::
376 c71a1a3d Iustin Pop
377 832f8c6a Iustin Pop
  $ gnt-node info %node3%
378 c71a1a3d Iustin Pop
  Node name: node3
379 926feaf1 Manuel Franceschini
    primary ip: 198.51.100.1
380 926feaf1 Manuel Franceschini
    secondary ip: 192.0.2.3
381 c71a1a3d Iustin Pop
    master candidate: True
382 c71a1a3d Iustin Pop
    drained: False
383 c71a1a3d Iustin Pop
    offline: False
384 c71a1a3d Iustin Pop
    primary for instances:
385 c71a1a3d Iustin Pop
      - instance4
386 c71a1a3d Iustin Pop
    secondary for instances:
387 c71a1a3d Iustin Pop
      - instance1
388 832f8c6a Iustin Pop
  $ fping %node3%
389 c71a1a3d Iustin Pop
  node3 is unreachable
390 c71a1a3d Iustin Pop
391 c71a1a3d Iustin Pop
At this point, the primary instance of that node (instance4) is down,
392 c71a1a3d Iustin Pop
but the secondary instance (instance1) is not affected except it has
393 c71a1a3d Iustin Pop
lost disk redundancy::
394 c71a1a3d Iustin Pop
395 832f8c6a Iustin Pop
  $ fping %instance{1,4}%
396 c71a1a3d Iustin Pop
  instance1 is alive
397 c71a1a3d Iustin Pop
  instance4 is unreachable
398 832f8c6a Iustin Pop
  $
399 c71a1a3d Iustin Pop
400 c71a1a3d Iustin Pop
If we try to check the status of instance4 via the instance info
401 c71a1a3d Iustin Pop
command, it fails because it tries to contact node3 which is down::
402 c71a1a3d Iustin Pop
403 832f8c6a Iustin Pop
  $ gnt-instance info %instance4%
404 c71a1a3d Iustin Pop
  Failure: command execution error:
405 c71a1a3d Iustin Pop
  Error checking node node3: Connection failed (113: No route to host)
406 832f8c6a Iustin Pop
  $
407 c71a1a3d Iustin Pop
408 c71a1a3d Iustin Pop
So we need to mark node3 as being *offline*, and thus Ganeti won't talk
409 c71a1a3d Iustin Pop
to it anymore::
410 c71a1a3d Iustin Pop
411 832f8c6a Iustin Pop
  $ gnt-node modify -O yes -f %node3%
412 c71a1a3d Iustin Pop
  Mon Oct 26 04:34:12 2009  - WARNING: Not enough master candidates (desired 10, new value will be 2)
413 c71a1a3d Iustin Pop
  Mon Oct 26 04:34:15 2009  - WARNING: Communication failure to node node3: Connection failed (113: No route to host)
414 c71a1a3d Iustin Pop
  Modified node node3
415 c71a1a3d Iustin Pop
   - offline -> True
416 c71a1a3d Iustin Pop
   - master_candidate -> auto-demotion due to offline
417 832f8c6a Iustin Pop
  $
418 c71a1a3d Iustin Pop
419 c71a1a3d Iustin Pop
And now we can failover the instance::
420 c71a1a3d Iustin Pop
421 651c1c3e Helga Velroyen
  $ gnt-instance failover %instance4%
422 c71a1a3d Iustin Pop
  Failover will happen to image instance4. This requires a shutdown of
423 c71a1a3d Iustin Pop
  the instance. Continue?
424 832f8c6a Iustin Pop
  y/[n]/?: %y%
425 c71a1a3d Iustin Pop
  Mon Oct 26 04:35:34 2009 * checking disk consistency between source and target
426 c71a1a3d Iustin Pop
  Failure: command execution error:
427 c71a1a3d Iustin Pop
  Disk disk/0 is degraded on target node, aborting failover.
428 832f8c6a Iustin Pop
  $ gnt-instance failover --ignore-consistency %instance4%
429 c71a1a3d Iustin Pop
  Failover will happen to image instance4. This requires a shutdown of
430 c71a1a3d Iustin Pop
  the instance. Continue?
431 c71a1a3d Iustin Pop
  y/[n]/?: y
432 c71a1a3d Iustin Pop
  Mon Oct 26 04:35:47 2009 * checking disk consistency between source and target
433 c71a1a3d Iustin Pop
  Mon Oct 26 04:35:47 2009 * shutting down instance on source node
434 c71a1a3d Iustin Pop
  Mon Oct 26 04:35:47 2009  - WARNING: Could not shutdown instance instance4 on node node3. Proceeding anyway. Please make sure node node3 is down. Error details: Node is marked offline
435 c71a1a3d Iustin Pop
  Mon Oct 26 04:35:47 2009 * deactivating the instance's disks on source node
436 c71a1a3d Iustin Pop
  Mon Oct 26 04:35:47 2009  - WARNING: Could not shutdown block device disk/0 on node node3: Node is marked offline
437 c71a1a3d Iustin Pop
  Mon Oct 26 04:35:47 2009 * activating the instance's disks on target node
438 c71a1a3d Iustin Pop
  Mon Oct 26 04:35:47 2009  - WARNING: Could not prepare block device disk/0 on node node3 (is_primary=False, pass=1): Node is marked offline
439 c71a1a3d Iustin Pop
  Mon Oct 26 04:35:48 2009 * starting the instance on the target node
440 832f8c6a Iustin Pop
  $
441 c71a1a3d Iustin Pop
442 c71a1a3d Iustin Pop
Note in our first attempt, Ganeti refused to do the failover since it
443 c71a1a3d Iustin Pop
wasn't sure what is the status of the instance's disks. We pass the
444 c71a1a3d Iustin Pop
``--ignore-consistency`` flag and then we can failover::
445 c71a1a3d Iustin Pop
446 832f8c6a Iustin Pop
  $ gnt-instance list
447 c71a1a3d Iustin Pop
  Instance  Hypervisor OS          Primary_node Status  Memory
448 c71a1a3d Iustin Pop
  instance1 xen-pvm    debootstrap node2        running   128M
449 c71a1a3d Iustin Pop
  instance2 xen-pvm    debootstrap node1        running   128M
450 c71a1a3d Iustin Pop
  instance3 xen-pvm    debootstrap node1        running   128M
451 c71a1a3d Iustin Pop
  instance4 xen-pvm    debootstrap node1        running   128M
452 832f8c6a Iustin Pop
  $
453 c71a1a3d Iustin Pop
454 c71a1a3d Iustin Pop
But at this point, both instance1 and instance4 are without disk
455 c71a1a3d Iustin Pop
redundancy::
456 c71a1a3d Iustin Pop
457 832f8c6a Iustin Pop
  $ gnt-instance info %instance1%
458 c71a1a3d Iustin Pop
  Instance name: instance1
459 c71a1a3d Iustin Pop
  UUID: 45173e82-d1fa-417c-8758-7d582ab7eef4
460 c71a1a3d Iustin Pop
  Serial number: 2
461 c71a1a3d Iustin Pop
  Creation time: 2009-10-26 04:06:57
462 c71a1a3d Iustin Pop
  Modification time: 2009-10-26 04:07:14
463 c71a1a3d Iustin Pop
  State: configured to be up, actual state is up
464 c71a1a3d Iustin Pop
    Nodes:
465 c71a1a3d Iustin Pop
      - primary: node2
466 c71a1a3d Iustin Pop
      - secondaries: node3
467 c71a1a3d Iustin Pop
    Operating system: debootstrap
468 c71a1a3d Iustin Pop
    Allocated network port: None
469 c71a1a3d Iustin Pop
    Hypervisor: xen-pvm
470 c71a1a3d Iustin Pop
      - root_path: default (/dev/sda1)
471 c71a1a3d Iustin Pop
      - kernel_args: default (ro)
472 c71a1a3d Iustin Pop
      - use_bootloader: default (False)
473 c71a1a3d Iustin Pop
      - bootloader_args: default ()
474 c71a1a3d Iustin Pop
      - bootloader_path: default ()
475 c71a1a3d Iustin Pop
      - kernel_path: default (/boot/vmlinuz-2.6-xenU)
476 c71a1a3d Iustin Pop
      - initrd_path: default ()
477 c71a1a3d Iustin Pop
    Hardware:
478 c71a1a3d Iustin Pop
      - VCPUs: 1
479 2a50e2e8 Guido Trotter
      - maxmem: 256MiB
480 2a50e2e8 Guido Trotter
      - minmem: 512MiB
481 c71a1a3d Iustin Pop
      - NICs:
482 c71a1a3d Iustin Pop
        - nic/0: MAC: aa:00:00:78:da:63, IP: None, mode: bridged, link: xen-br0
483 c71a1a3d Iustin Pop
    Disks:
484 c71a1a3d Iustin Pop
      - disk/0: drbd8, size 256M
485 c71a1a3d Iustin Pop
        access mode: rw
486 c71a1a3d Iustin Pop
        nodeA:       node2, minor=0
487 c71a1a3d Iustin Pop
        nodeB:       node3, minor=0
488 c71a1a3d Iustin Pop
        port:        11035
489 c71a1a3d Iustin Pop
        auth key:    8e950e3cec6854b0181fbc3a6058657701f2d458
490 c71a1a3d Iustin Pop
        on primary:  /dev/drbd0 (147:0) in sync, status *DEGRADED*
491 c71a1a3d Iustin Pop
        child devices:
492 c71a1a3d Iustin Pop
          - child 0: lvm, size 256M
493 c71a1a3d Iustin Pop
            logical_id: xenvg/22459cf8-117d-4bea-a1aa-791667d07800.disk0_data
494 c71a1a3d Iustin Pop
            on primary: /dev/xenvg/22459cf8-117d-4bea-a1aa-791667d07800.disk0_data (254:0)
495 c71a1a3d Iustin Pop
          - child 1: lvm, size 128M
496 c71a1a3d Iustin Pop
            logical_id: xenvg/22459cf8-117d-4bea-a1aa-791667d07800.disk0_meta
497 c71a1a3d Iustin Pop
            on primary: /dev/xenvg/22459cf8-117d-4bea-a1aa-791667d07800.disk0_meta (254:1)
498 c71a1a3d Iustin Pop
499 c71a1a3d Iustin Pop
The output is similar for instance4. In order to recover this, we need
500 c71a1a3d Iustin Pop
to run the node evacuate command which will change from the current
501 c71a1a3d Iustin Pop
secondary node to a new one (in this case, we only have two working
502 c71a1a3d Iustin Pop
nodes, so all instances will be end on nodes one and two)::
503 c71a1a3d Iustin Pop
504 832f8c6a Iustin Pop
  $ gnt-node evacuate -I hail %node3%
505 c71a1a3d Iustin Pop
  Relocate instance(s) 'instance1','instance4' from node
506 c71a1a3d Iustin Pop
   node3 using iallocator hail?
507 832f8c6a Iustin Pop
  y/[n]/?: %y%
508 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:39 2009  - INFO: Selected new secondary for instance 'instance1': node1
509 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:40 2009  - INFO: Selected new secondary for instance 'instance4': node2
510 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:40 2009 Replacing disk(s) 0 for instance1
511 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:40 2009 STEP 1/6 Check device existence
512 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:40 2009  - INFO: Checking disk/0 on node2
513 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:40 2009  - INFO: Checking volume groups
514 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:40 2009 STEP 2/6 Check peer consistency
515 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:40 2009  - INFO: Checking disk/0 consistency on node node2
516 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:40 2009 STEP 3/6 Allocate new storage
517 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:40 2009  - INFO: Adding new local storage on node1 for disk/0
518 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:41 2009 STEP 4/6 Changing drbd configuration
519 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:41 2009  - INFO: activating a new drbd on node1 for disk/0
520 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:42 2009  - INFO: Shutting down drbd for disk/0 on old node
521 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:42 2009  - WARNING: Failed to shutdown drbd for disk/0 on oldnode: Node is marked offline
522 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:42 2009       Hint: Please cleanup this device manually as soon as possible
523 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:42 2009  - INFO: Detaching primary drbds from the network (=> standalone)
524 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:42 2009  - INFO: Updating instance configuration
525 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:45 2009  - INFO: Attaching primary drbds to new secondary (standalone => connected)
526 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:46 2009 STEP 5/6 Sync devices
527 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:46 2009  - INFO: Waiting for instance instance1 to sync disks.
528 832f8c6a Iustin Pop
  Mon Oct 26 05:05:46 2009  - INFO: - device disk/0: 13.90\% done, 7 estimated seconds remaining
529 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:53 2009  - INFO: Instance instance1's disks are in sync.
530 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:53 2009 STEP 6/6 Removing old storage
531 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:53 2009  - INFO: Remove logical volumes for 0
532 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:53 2009  - WARNING: Can't remove old LV: Node is marked offline
533 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:53 2009       Hint: remove unused LVs manually
534 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:53 2009  - WARNING: Can't remove old LV: Node is marked offline
535 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:53 2009       Hint: remove unused LVs manually
536 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:53 2009 Replacing disk(s) 0 for instance4
537 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:53 2009 STEP 1/6 Check device existence
538 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:53 2009  - INFO: Checking disk/0 on node1
539 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:53 2009  - INFO: Checking volume groups
540 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:53 2009 STEP 2/6 Check peer consistency
541 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:53 2009  - INFO: Checking disk/0 consistency on node node1
542 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:54 2009 STEP 3/6 Allocate new storage
543 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:54 2009  - INFO: Adding new local storage on node2 for disk/0
544 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:54 2009 STEP 4/6 Changing drbd configuration
545 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:54 2009  - INFO: activating a new drbd on node2 for disk/0
546 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:55 2009  - INFO: Shutting down drbd for disk/0 on old node
547 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:55 2009  - WARNING: Failed to shutdown drbd for disk/0 on oldnode: Node is marked offline
548 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:55 2009       Hint: Please cleanup this device manually as soon as possible
549 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:55 2009  - INFO: Detaching primary drbds from the network (=> standalone)
550 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:55 2009  - INFO: Updating instance configuration
551 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:55 2009  - INFO: Attaching primary drbds to new secondary (standalone => connected)
552 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:56 2009 STEP 5/6 Sync devices
553 c71a1a3d Iustin Pop
  Mon Oct 26 05:05:56 2009  - INFO: Waiting for instance instance4 to sync disks.
554 832f8c6a Iustin Pop
  Mon Oct 26 05:05:56 2009  - INFO: - device disk/0: 12.40\% done, 8 estimated seconds remaining
555 c71a1a3d Iustin Pop
  Mon Oct 26 05:06:04 2009  - INFO: Instance instance4's disks are in sync.
556 c71a1a3d Iustin Pop
  Mon Oct 26 05:06:04 2009 STEP 6/6 Removing old storage
557 c71a1a3d Iustin Pop
  Mon Oct 26 05:06:04 2009  - INFO: Remove logical volumes for 0
558 c71a1a3d Iustin Pop
  Mon Oct 26 05:06:04 2009  - WARNING: Can't remove old LV: Node is marked offline
559 c71a1a3d Iustin Pop
  Mon Oct 26 05:06:04 2009       Hint: remove unused LVs manually
560 c71a1a3d Iustin Pop
  Mon Oct 26 05:06:04 2009  - WARNING: Can't remove old LV: Node is marked offline
561 c71a1a3d Iustin Pop
  Mon Oct 26 05:06:04 2009       Hint: remove unused LVs manually
562 832f8c6a Iustin Pop
  $
563 c71a1a3d Iustin Pop
564 c71a1a3d Iustin Pop
And now node3 is completely free of instances and can be repaired::
565 c71a1a3d Iustin Pop
566 832f8c6a Iustin Pop
  $ gnt-node list
567 c71a1a3d Iustin Pop
  Node  DTotal DFree MTotal MNode MFree Pinst Sinst
568 c71a1a3d Iustin Pop
  node1   1.3T  1.3T  32.0G  1.0G 30.2G     3     1
569 c71a1a3d Iustin Pop
  node2   1.3T  1.3T  32.0G  1.0G 30.4G     1     3
570 c71a1a3d Iustin Pop
  node3      ?     ?      ?     ?     ?     0     0
571 c71a1a3d Iustin Pop
572 c71a1a3d Iustin Pop
Re-adding a node to the cluster
573 c71a1a3d Iustin Pop
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
574 c71a1a3d Iustin Pop
575 c71a1a3d Iustin Pop
Let's say node3 has been repaired and is now ready to be
576 c71a1a3d Iustin Pop
reused. Re-adding it is simple::
577 c71a1a3d Iustin Pop
578 832f8c6a Iustin Pop
  $ gnt-node add --readd %node3%
579 926feaf1 Manuel Franceschini
  The authenticity of host 'node3 (198.51.100.1)' can't be established.
580 c71a1a3d Iustin Pop
  RSA key fingerprint is 9f:2e:5a:2e:e0:bd:00:09:e4:5c:32:f2:27:57:7a:f4.
581 c71a1a3d Iustin Pop
  Are you sure you want to continue connecting (yes/no)? yes
582 c71a1a3d Iustin Pop
  Mon Oct 26 05:27:39 2009  - INFO: Readding a node, the offline/drained flags were reset
583 c71a1a3d Iustin Pop
  Mon Oct 26 05:27:39 2009  - INFO: Node will be a master candidate
584 c71a1a3d Iustin Pop
585 1cdc9dbb Bernardo Dal Seno
And it is now working again::
586 c71a1a3d Iustin Pop
587 832f8c6a Iustin Pop
  $ gnt-node list
588 c71a1a3d Iustin Pop
  Node  DTotal DFree MTotal MNode MFree Pinst Sinst
589 c71a1a3d Iustin Pop
  node1   1.3T  1.3T  32.0G  1.0G 30.2G     3     1
590 c71a1a3d Iustin Pop
  node2   1.3T  1.3T  32.0G  1.0G 30.4G     1     3
591 c71a1a3d Iustin Pop
  node3   1.3T  1.3T  32.0G  1.0G 30.4G     0     0
592 c71a1a3d Iustin Pop
593 1cdc9dbb Bernardo Dal Seno
.. note:: If Ganeti has been built with the htools
594 1ebe6dbd Iustin Pop
   component enabled, you can shuffle the instances around to have a
595 1ebe6dbd Iustin Pop
   better use of the nodes.
596 c71a1a3d Iustin Pop
597 c71a1a3d Iustin Pop
Disk failures
598 c71a1a3d Iustin Pop
+++++++++++++
599 c71a1a3d Iustin Pop
600 c71a1a3d Iustin Pop
A disk failure is simpler than a full node failure. First, a single disk
601 c71a1a3d Iustin Pop
failure should not cause data-loss for any redundant instance; only the
602 c71a1a3d Iustin Pop
performance of some instances might be reduced due to more network
603 c71a1a3d Iustin Pop
traffic.
604 c71a1a3d Iustin Pop
605 c71a1a3d Iustin Pop
Let take the cluster status in the above listing, and check what volumes
606 c71a1a3d Iustin Pop
are in use::
607 c71a1a3d Iustin Pop
608 832f8c6a Iustin Pop
  $ gnt-node volumes -o phys,instance %node2%
609 c71a1a3d Iustin Pop
  PhysDev   Instance
610 c71a1a3d Iustin Pop
  /dev/sdb1 instance4
611 c71a1a3d Iustin Pop
  /dev/sdb1 instance4
612 c71a1a3d Iustin Pop
  /dev/sdb1 instance1
613 c71a1a3d Iustin Pop
  /dev/sdb1 instance1
614 c71a1a3d Iustin Pop
  /dev/sdb1 instance3
615 c71a1a3d Iustin Pop
  /dev/sdb1 instance3
616 c71a1a3d Iustin Pop
  /dev/sdb1 instance2
617 c71a1a3d Iustin Pop
  /dev/sdb1 instance2
618 832f8c6a Iustin Pop
  $
619 c71a1a3d Iustin Pop
620 c71a1a3d Iustin Pop
You can see that all instances on node2 have logical volumes on
621 c71a1a3d Iustin Pop
``/dev/sdb1``. Let's simulate a disk failure on that disk::
622 c71a1a3d Iustin Pop
623 832f8c6a Iustin Pop
  $ ssh node2
624 832f8c6a Iustin Pop
  # on node2
625 832f8c6a Iustin Pop
  $ echo offline > /sys/block/sdb/device/state
626 832f8c6a Iustin Pop
  $ vgs
627 c71a1a3d Iustin Pop
    /dev/sdb1: read failed after 0 of 4096 at 0: Input/output error
628 c71a1a3d Iustin Pop
    /dev/sdb1: read failed after 0 of 4096 at 750153695232: Input/output error
629 c71a1a3d Iustin Pop
    /dev/sdb1: read failed after 0 of 4096 at 0: Input/output error
630 c71a1a3d Iustin Pop
    Couldn't find device with uuid '954bJA-mNL0-7ydj-sdpW-nc2C-ZrCi-zFp91c'.
631 c71a1a3d Iustin Pop
    Couldn't find all physical volumes for volume group xenvg.
632 c71a1a3d Iustin Pop
    /dev/sdb1: read failed after 0 of 4096 at 0: Input/output error
633 c71a1a3d Iustin Pop
    /dev/sdb1: read failed after 0 of 4096 at 0: Input/output error
634 c71a1a3d Iustin Pop
    Couldn't find device with uuid '954bJA-mNL0-7ydj-sdpW-nc2C-ZrCi-zFp91c'.
635 c71a1a3d Iustin Pop
    Couldn't find all physical volumes for volume group xenvg.
636 c71a1a3d Iustin Pop
    Volume group xenvg not found
637 832f8c6a Iustin Pop
  $
638 c71a1a3d Iustin Pop
639 c71a1a3d Iustin Pop
At this point, the node is broken and if we are to examine
640 c71a1a3d Iustin Pop
instance2 we get (simplified output shown)::
641 c71a1a3d Iustin Pop
642 832f8c6a Iustin Pop
  $ gnt-instance info %instance2%
643 c71a1a3d Iustin Pop
  Instance name: instance2
644 c71a1a3d Iustin Pop
  State: configured to be up, actual state is up
645 c71a1a3d Iustin Pop
    Nodes:
646 c71a1a3d Iustin Pop
      - primary: node1
647 c71a1a3d Iustin Pop
      - secondaries: node2
648 c71a1a3d Iustin Pop
    Disks:
649 c71a1a3d Iustin Pop
      - disk/0: drbd8, size 256M
650 c71a1a3d Iustin Pop
        on primary:   /dev/drbd0 (147:0) in sync, status ok
651 c71a1a3d Iustin Pop
        on secondary: /dev/drbd1 (147:1) in sync, status *DEGRADED* *MISSING DISK*
652 c71a1a3d Iustin Pop
653 c71a1a3d Iustin Pop
This instance has a secondary only on node2. Let's verify a primary
654 c71a1a3d Iustin Pop
instance of node2::
655 c71a1a3d Iustin Pop
656 832f8c6a Iustin Pop
  $ gnt-instance info %instance1%
657 c71a1a3d Iustin Pop
  Instance name: instance1
658 c71a1a3d Iustin Pop
  State: configured to be up, actual state is up
659 c71a1a3d Iustin Pop
    Nodes:
660 c71a1a3d Iustin Pop
      - primary: node2
661 c71a1a3d Iustin Pop
      - secondaries: node1
662 c71a1a3d Iustin Pop
    Disks:
663 c71a1a3d Iustin Pop
      - disk/0: drbd8, size 256M
664 c71a1a3d Iustin Pop
        on primary:   /dev/drbd0 (147:0) in sync, status *DEGRADED* *MISSING DISK*
665 c71a1a3d Iustin Pop
        on secondary: /dev/drbd3 (147:3) in sync, status ok
666 832f8c6a Iustin Pop
  $ gnt-instance console %instance1%
667 c71a1a3d Iustin Pop
668 c71a1a3d Iustin Pop
  Debian GNU/Linux 5.0 instance1 tty1
669 c71a1a3d Iustin Pop
670 c71a1a3d Iustin Pop
  instance1 login: root
671 c71a1a3d Iustin Pop
  Last login: Tue Oct 27 01:24:09 UTC 2009 on tty1
672 c71a1a3d Iustin Pop
  instance1:~# date > test
673 c71a1a3d Iustin Pop
  instance1:~# sync
674 c71a1a3d Iustin Pop
  instance1:~# cat test
675 c71a1a3d Iustin Pop
  Tue Oct 27 01:25:20 UTC 2009
676 c71a1a3d Iustin Pop
  instance1:~# dmesg|tail
677 c71a1a3d Iustin Pop
  [5439785.235448] NET: Registered protocol family 15
678 c71a1a3d Iustin Pop
  [5439785.235489] 802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
679 c71a1a3d Iustin Pop
  [5439785.235495] All bugs added by David S. Miller <davem@redhat.com>
680 c71a1a3d Iustin Pop
  [5439785.235517] XENBUS: Device with no driver: device/console/0
681 c71a1a3d Iustin Pop
  [5439785.236576] kjournald starting.  Commit interval 5 seconds
682 c71a1a3d Iustin Pop
  [5439785.236588] EXT3-fs: mounted filesystem with ordered data mode.
683 c71a1a3d Iustin Pop
  [5439785.236625] VFS: Mounted root (ext3 filesystem) readonly.
684 c71a1a3d Iustin Pop
  [5439785.236663] Freeing unused kernel memory: 172k freed
685 c71a1a3d Iustin Pop
  [5439787.533779] EXT3 FS on sda1, internal journal
686 c71a1a3d Iustin Pop
  [5440655.065431] eth0: no IPv6 routers present
687 c71a1a3d Iustin Pop
  instance1:~#
688 c71a1a3d Iustin Pop
689 c71a1a3d Iustin Pop
As you can see, the instance is running fine and doesn't see any disk
690 c71a1a3d Iustin Pop
issues. It is now time to fix node2 and re-establish redundancy for the
691 c71a1a3d Iustin Pop
involved instances.
692 c71a1a3d Iustin Pop
693 c71a1a3d Iustin Pop
.. note:: For Ganeti 2.0 we need to fix manually the volume group on
694 c71a1a3d Iustin Pop
   node2 by running ``vgreduce --removemissing xenvg``
695 c71a1a3d Iustin Pop
696 c71a1a3d Iustin Pop
::
697 c71a1a3d Iustin Pop
698 832f8c6a Iustin Pop
  $ gnt-node repair-storage %node2% lvm-vg %xenvg%
699 c71a1a3d Iustin Pop
  Mon Oct 26 18:14:03 2009 Repairing storage unit 'xenvg' on node2 ...
700 832f8c6a Iustin Pop
  $ ssh %node2% vgs
701 832f8c6a Iustin Pop
  VG    #PV #LV #SN Attr   VSize   VFree
702 832f8c6a Iustin Pop
  xenvg   1   8   0 wz--n- 673.84G 673.84G
703 832f8c6a Iustin Pop
  $
704 c71a1a3d Iustin Pop
705 c71a1a3d Iustin Pop
This has removed the 'bad' disk from the volume group, which is now left
706 c71a1a3d Iustin Pop
with only one PV. We can now replace the disks for the involved
707 c71a1a3d Iustin Pop
instances::
708 c71a1a3d Iustin Pop
709 832f8c6a Iustin Pop
  $ for i in %instance{1..4}%; do gnt-instance replace-disks -a $i; done
710 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:38 2009 Replacing disk(s) 0 for instance1
711 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:38 2009 STEP 1/6 Check device existence
712 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:38 2009  - INFO: Checking disk/0 on node1
713 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:38 2009  - INFO: Checking disk/0 on node2
714 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:38 2009  - INFO: Checking volume groups
715 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:38 2009 STEP 2/6 Check peer consistency
716 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:38 2009  - INFO: Checking disk/0 consistency on node node1
717 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:39 2009 STEP 3/6 Allocate new storage
718 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:39 2009  - INFO: Adding storage on node2 for disk/0
719 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:39 2009 STEP 4/6 Changing drbd configuration
720 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:39 2009  - INFO: Detaching disk/0 drbd from local storage
721 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:40 2009  - INFO: Renaming the old LVs on the target node
722 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:40 2009  - INFO: Renaming the new LVs on the target node
723 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:40 2009  - INFO: Adding new mirror component on node2
724 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:41 2009 STEP 5/6 Sync devices
725 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:41 2009  - INFO: Waiting for instance instance1 to sync disks.
726 832f8c6a Iustin Pop
  Mon Oct 26 18:15:41 2009  - INFO: - device disk/0: 12.40\% done, 9 estimated seconds remaining
727 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:50 2009  - INFO: Instance instance1's disks are in sync.
728 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:50 2009 STEP 6/6 Removing old storage
729 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:50 2009  - INFO: Remove logical volumes for disk/0
730 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:52 2009 Replacing disk(s) 0 for instance2
731 c71a1a3d Iustin Pop
  Mon Oct 26 18:15:52 2009 STEP 1/6 Check device existence
732 c71a1a3d Iustin Pop
733 c71a1a3d Iustin Pop
  Mon Oct 26 18:16:01 2009 STEP 6/6 Removing old storage
734 c71a1a3d Iustin Pop
  Mon Oct 26 18:16:01 2009  - INFO: Remove logical volumes for disk/0
735 c71a1a3d Iustin Pop
  Mon Oct 26 18:16:02 2009 Replacing disk(s) 0 for instance3
736 c71a1a3d Iustin Pop
  Mon Oct 26 18:16:02 2009 STEP 1/6 Check device existence
737 c71a1a3d Iustin Pop
738 c71a1a3d Iustin Pop
  Mon Oct 26 18:16:09 2009 STEP 6/6 Removing old storage
739 c71a1a3d Iustin Pop
  Mon Oct 26 18:16:09 2009  - INFO: Remove logical volumes for disk/0
740 c71a1a3d Iustin Pop
  Mon Oct 26 18:16:10 2009 Replacing disk(s) 0 for instance4
741 c71a1a3d Iustin Pop
  Mon Oct 26 18:16:10 2009 STEP 1/6 Check device existence
742 c71a1a3d Iustin Pop
743 c71a1a3d Iustin Pop
  Mon Oct 26 18:16:18 2009 STEP 6/6 Removing old storage
744 c71a1a3d Iustin Pop
  Mon Oct 26 18:16:18 2009  - INFO: Remove logical volumes for disk/0
745 832f8c6a Iustin Pop
  $
746 c71a1a3d Iustin Pop
747 c71a1a3d Iustin Pop
As this point, all instances should be healthy again.
748 c71a1a3d Iustin Pop
749 c71a1a3d Iustin Pop
.. note:: Ganeti 2.0 doesn't have the ``-a`` option to replace-disks, so
750 c71a1a3d Iustin Pop
   for it you have to run the loop twice, once over primary instances
751 c71a1a3d Iustin Pop
   with argument ``-p`` and once secondary instances with argument
752 c71a1a3d Iustin Pop
   ``-s``, but otherwise the operations are similar::
753 c71a1a3d Iustin Pop
754 832f8c6a Iustin Pop
     $ gnt-instance replace-disks -p instance1
755 c71a1a3d Iustin Pop
756 832f8c6a Iustin Pop
     $ for i in %instance{2..4}%; do gnt-instance replace-disks -s $i; done
757 c71a1a3d Iustin Pop
758 c71a1a3d Iustin Pop
Common cluster problems
759 c71a1a3d Iustin Pop
-----------------------
760 c71a1a3d Iustin Pop
761 c71a1a3d Iustin Pop
There are a number of small issues that might appear on a cluster that
762 c71a1a3d Iustin Pop
can be solved easily as long as the issue is properly identified. For
763 c71a1a3d Iustin Pop
this exercise we will consider the case of node3, which was broken
764 c71a1a3d Iustin Pop
previously and re-added to the cluster without reinstallation. Running
765 c71a1a3d Iustin Pop
cluster verify on the cluster reports::
766 c71a1a3d Iustin Pop
767 832f8c6a Iustin Pop
  $ gnt-cluster verify
768 c71a1a3d Iustin Pop
  Mon Oct 26 18:30:08 2009 * Verifying global settings
769 c71a1a3d Iustin Pop
  Mon Oct 26 18:30:08 2009 * Gathering data (3 nodes)
770 c71a1a3d Iustin Pop
  Mon Oct 26 18:30:10 2009 * Verifying node status
771 c71a1a3d Iustin Pop
  Mon Oct 26 18:30:10 2009   - ERROR: node node3: unallocated drbd minor 0 is in use
772 c71a1a3d Iustin Pop
  Mon Oct 26 18:30:10 2009   - ERROR: node node3: unallocated drbd minor 1 is in use
773 c71a1a3d Iustin Pop
  Mon Oct 26 18:30:10 2009 * Verifying instance status
774 c71a1a3d Iustin Pop
  Mon Oct 26 18:30:10 2009   - ERROR: instance instance4: instance should not run on node node3
775 c71a1a3d Iustin Pop
  Mon Oct 26 18:30:10 2009 * Verifying orphan volumes
776 c71a1a3d Iustin Pop
  Mon Oct 26 18:30:10 2009   - ERROR: node node3: volume 22459cf8-117d-4bea-a1aa-791667d07800.disk0_data is unknown
777 c71a1a3d Iustin Pop
  Mon Oct 26 18:30:10 2009   - ERROR: node node3: volume 1aaf4716-e57f-4101-a8d6-03af5da9dc50.disk0_data is unknown
778 c71a1a3d Iustin Pop
  Mon Oct 26 18:30:10 2009   - ERROR: node node3: volume 1aaf4716-e57f-4101-a8d6-03af5da9dc50.disk0_meta is unknown
779 c71a1a3d Iustin Pop
  Mon Oct 26 18:30:10 2009   - ERROR: node node3: volume 22459cf8-117d-4bea-a1aa-791667d07800.disk0_meta is unknown
780 c71a1a3d Iustin Pop
  Mon Oct 26 18:30:10 2009 * Verifying remaining instances
781 c71a1a3d Iustin Pop
  Mon Oct 26 18:30:10 2009 * Verifying N+1 Memory redundancy
782 c71a1a3d Iustin Pop
  Mon Oct 26 18:30:10 2009 * Other Notes
783 c71a1a3d Iustin Pop
  Mon Oct 26 18:30:10 2009 * Hooks Results
784 832f8c6a Iustin Pop
  $
785 c71a1a3d Iustin Pop
786 c71a1a3d Iustin Pop
Instance status
787 c71a1a3d Iustin Pop
+++++++++++++++
788 c71a1a3d Iustin Pop
789 c71a1a3d Iustin Pop
As you can see, *instance4* has a copy running on node3, because we
790 c71a1a3d Iustin Pop
forced the failover when node3 failed. This case is dangerous as the
791 240c769f Andrea Spadaccini
instance will have the same IP and MAC address, wreaking havoc on the
792 c71a1a3d Iustin Pop
network environment and anyone who tries to use it.
793 c71a1a3d Iustin Pop
794 c71a1a3d Iustin Pop
Ganeti doesn't directly handle this case. It is recommended to logon to
795 c71a1a3d Iustin Pop
node3 and run::
796 c71a1a3d Iustin Pop
797 832f8c6a Iustin Pop
  $ xm destroy %instance4%
798 c71a1a3d Iustin Pop
799 c71a1a3d Iustin Pop
Unallocated DRBD minors
800 c71a1a3d Iustin Pop
+++++++++++++++++++++++
801 c71a1a3d Iustin Pop
802 c71a1a3d Iustin Pop
There are still unallocated DRBD minors on node3. Again, these are not
803 c71a1a3d Iustin Pop
handled by Ganeti directly and need to be cleaned up via DRBD commands::
804 c71a1a3d Iustin Pop
805 832f8c6a Iustin Pop
  $ ssh %node3%
806 832f8c6a Iustin Pop
  # on node 3
807 832f8c6a Iustin Pop
  $ drbdsetup /dev/drbd%0% down
808 832f8c6a Iustin Pop
  $ drbdsetup /dev/drbd%1% down
809 832f8c6a Iustin Pop
  $
810 c71a1a3d Iustin Pop
811 c71a1a3d Iustin Pop
Orphan volumes
812 c71a1a3d Iustin Pop
++++++++++++++
813 c71a1a3d Iustin Pop
814 c71a1a3d Iustin Pop
At this point, the only remaining problem should be the so-called
815 c71a1a3d Iustin Pop
*orphan* volumes. This can happen also in the case of an aborted
816 c71a1a3d Iustin Pop
disk-replace, or similar situation where Ganeti was not able to recover
817 c71a1a3d Iustin Pop
automatically. Here you need to remove them manually via LVM commands::
818 c71a1a3d Iustin Pop
819 832f8c6a Iustin Pop
  $ ssh %node3%
820 832f8c6a Iustin Pop
  # on node3
821 832f8c6a Iustin Pop
  $ lvremove %xenvg%
822 832f8c6a Iustin Pop
  Do you really want to remove active logical volume "22459cf8-117d-4bea-a1aa-791667d07800.disk0_data"? [y/n]: %y%
823 c71a1a3d Iustin Pop
    Logical volume "22459cf8-117d-4bea-a1aa-791667d07800.disk0_data" successfully removed
824 832f8c6a Iustin Pop
  Do you really want to remove active logical volume "22459cf8-117d-4bea-a1aa-791667d07800.disk0_meta"? [y/n]: %y%
825 c71a1a3d Iustin Pop
    Logical volume "22459cf8-117d-4bea-a1aa-791667d07800.disk0_meta" successfully removed
826 832f8c6a Iustin Pop
  Do you really want to remove active logical volume "1aaf4716-e57f-4101-a8d6-03af5da9dc50.disk0_data"? [y/n]: %y%
827 c71a1a3d Iustin Pop
    Logical volume "1aaf4716-e57f-4101-a8d6-03af5da9dc50.disk0_data" successfully removed
828 832f8c6a Iustin Pop
  Do you really want to remove active logical volume "1aaf4716-e57f-4101-a8d6-03af5da9dc50.disk0_meta"? [y/n]: %y%
829 c71a1a3d Iustin Pop
    Logical volume "1aaf4716-e57f-4101-a8d6-03af5da9dc50.disk0_meta" successfully removed
830 c71a1a3d Iustin Pop
  node3#
831 c71a1a3d Iustin Pop
832 c71a1a3d Iustin Pop
At this point cluster verify shouldn't complain anymore::
833 c71a1a3d Iustin Pop
834 832f8c6a Iustin Pop
  $ gnt-cluster verify
835 c71a1a3d Iustin Pop
  Mon Oct 26 18:37:51 2009 * Verifying global settings
836 c71a1a3d Iustin Pop
  Mon Oct 26 18:37:51 2009 * Gathering data (3 nodes)
837 c71a1a3d Iustin Pop
  Mon Oct 26 18:37:53 2009 * Verifying node status
838 c71a1a3d Iustin Pop
  Mon Oct 26 18:37:53 2009 * Verifying instance status
839 c71a1a3d Iustin Pop
  Mon Oct 26 18:37:53 2009 * Verifying orphan volumes
840 c71a1a3d Iustin Pop
  Mon Oct 26 18:37:53 2009 * Verifying remaining instances
841 c71a1a3d Iustin Pop
  Mon Oct 26 18:37:53 2009 * Verifying N+1 Memory redundancy
842 c71a1a3d Iustin Pop
  Mon Oct 26 18:37:53 2009 * Other Notes
843 c71a1a3d Iustin Pop
  Mon Oct 26 18:37:53 2009 * Hooks Results
844 832f8c6a Iustin Pop
  $
845 c71a1a3d Iustin Pop
846 c71a1a3d Iustin Pop
N+1 errors
847 c71a1a3d Iustin Pop
++++++++++
848 c71a1a3d Iustin Pop
849 c71a1a3d Iustin Pop
Since redundant instances in Ganeti have a primary/secondary model, it
850 c71a1a3d Iustin Pop
is needed to leave aside on each node enough memory so that if one of
851 c71a1a3d Iustin Pop
its peer node fails, all the secondary instances that have that node as
852 c71a1a3d Iustin Pop
primary can be relocated. More specifically, if instance2 has node1 as
853 c71a1a3d Iustin Pop
primary and node2 as secondary (and node1 and node2 do not have any
854 c71a1a3d Iustin Pop
other instances in this layout), then it means that node2 must have
855 c71a1a3d Iustin Pop
enough free memory so that if node1 fails, we can failover instance2
856 c71a1a3d Iustin Pop
without any other operations (for reducing the downtime window). Let's
857 c71a1a3d Iustin Pop
increase the memory of the current instances to 4G, and add three new
858 c71a1a3d Iustin Pop
instances, two on node2:node3 with 8GB of RAM and one on node1:node2,
859 c71a1a3d Iustin Pop
with 12GB of RAM (numbers chosen so that we run out of memory)::
860 c71a1a3d Iustin Pop
861 832f8c6a Iustin Pop
  $ gnt-instance modify -B memory=%4G% %instance1%
862 c71a1a3d Iustin Pop
  Modified instance instance1
863 2a50e2e8 Guido Trotter
   - be/maxmem -> 4096
864 2a50e2e8 Guido Trotter
   - be/minmem -> 4096
865 c71a1a3d Iustin Pop
  Please don't forget that these parameters take effect only at the next start of the instance.
866 832f8c6a Iustin Pop
  $ gnt-instance modify …
867 c71a1a3d Iustin Pop
868 832f8c6a Iustin Pop
  $ gnt-instance add -t drbd -n %node2%:%node3% -s %512m% -B memory=%8G% -o %debootstrap% %instance5%
869 c71a1a3d Iustin Pop
870 832f8c6a Iustin Pop
  $ gnt-instance add -t drbd -n %node2%:%node3% -s %512m% -B memory=%8G% -o %debootstrap% %instance6%
871 c71a1a3d Iustin Pop
872 832f8c6a Iustin Pop
  $ gnt-instance add -t drbd -n %node1%:%node2% -s %512m% -B memory=%8G% -o %debootstrap% %instance7%
873 832f8c6a Iustin Pop
  $ gnt-instance reboot --all
874 c71a1a3d Iustin Pop
  The reboot will operate on 7 instances.
875 c71a1a3d Iustin Pop
  Do you want to continue?
876 c71a1a3d Iustin Pop
  Affected instances:
877 c71a1a3d Iustin Pop
    instance1
878 c71a1a3d Iustin Pop
    instance2
879 c71a1a3d Iustin Pop
    instance3
880 c71a1a3d Iustin Pop
    instance4
881 c71a1a3d Iustin Pop
    instance5
882 c71a1a3d Iustin Pop
    instance6
883 c71a1a3d Iustin Pop
    instance7
884 832f8c6a Iustin Pop
  y/[n]/?: %y%
885 c71a1a3d Iustin Pop
  Submitted jobs 677, 678, 679, 680, 681, 682, 683
886 c71a1a3d Iustin Pop
  Waiting for job 677 for instance1...
887 c71a1a3d Iustin Pop
  Waiting for job 678 for instance2...
888 c71a1a3d Iustin Pop
  Waiting for job 679 for instance3...
889 c71a1a3d Iustin Pop
  Waiting for job 680 for instance4...
890 c71a1a3d Iustin Pop
  Waiting for job 681 for instance5...
891 c71a1a3d Iustin Pop
  Waiting for job 682 for instance6...
892 c71a1a3d Iustin Pop
  Waiting for job 683 for instance7...
893 832f8c6a Iustin Pop
  $
894 c71a1a3d Iustin Pop
895 832f8c6a Iustin Pop
We rebooted the instances for the memory changes to have effect. Now the
896 c71a1a3d Iustin Pop
cluster looks like::
897 c71a1a3d Iustin Pop
898 832f8c6a Iustin Pop
  $ gnt-node list
899 c71a1a3d Iustin Pop
  Node  DTotal DFree MTotal MNode MFree Pinst Sinst
900 c71a1a3d Iustin Pop
  node1   1.3T  1.3T  32.0G  1.0G  6.5G     4     1
901 c71a1a3d Iustin Pop
  node2   1.3T  1.3T  32.0G  1.0G 10.5G     3     4
902 c71a1a3d Iustin Pop
  node3   1.3T  1.3T  32.0G  1.0G 30.5G     0     2
903 832f8c6a Iustin Pop
  $ gnt-cluster verify
904 c71a1a3d Iustin Pop
  Mon Oct 26 18:59:36 2009 * Verifying global settings
905 c71a1a3d Iustin Pop
  Mon Oct 26 18:59:36 2009 * Gathering data (3 nodes)
906 c71a1a3d Iustin Pop
  Mon Oct 26 18:59:37 2009 * Verifying node status
907 c71a1a3d Iustin Pop
  Mon Oct 26 18:59:37 2009 * Verifying instance status
908 c71a1a3d Iustin Pop
  Mon Oct 26 18:59:37 2009 * Verifying orphan volumes
909 c71a1a3d Iustin Pop
  Mon Oct 26 18:59:37 2009 * Verifying remaining instances
910 c71a1a3d Iustin Pop
  Mon Oct 26 18:59:37 2009 * Verifying N+1 Memory redundancy
911 861a296e Miguel Di Ciurcio Filho
  Mon Oct 26 18:59:37 2009   - ERROR: node node2: not enough memory to accommodate instance failovers should node node1 fail
912 c71a1a3d Iustin Pop
  Mon Oct 26 18:59:37 2009 * Other Notes
913 c71a1a3d Iustin Pop
  Mon Oct 26 18:59:37 2009 * Hooks Results
914 832f8c6a Iustin Pop
  $
915 c71a1a3d Iustin Pop
916 c71a1a3d Iustin Pop
The cluster verify error above shows that if node1 fails, node2 will not
917 c71a1a3d Iustin Pop
have enough memory to failover all primary instances on node1 to it. To
918 c71a1a3d Iustin Pop
solve this, you have a number of options:
919 c71a1a3d Iustin Pop
920 c71a1a3d Iustin Pop
- try to manually move instances around (but this can become complicated
921 c71a1a3d Iustin Pop
  for any non-trivial cluster)
922 2a50e2e8 Guido Trotter
- try to reduce the minimum memory of some instances on the source node
923 2a50e2e8 Guido Trotter
  of the N+1 failure (in the example above ``node1``): this will allow
924 2a50e2e8 Guido Trotter
  it to start and be failed over/migrated with less than its maximum
925 2a50e2e8 Guido Trotter
  memory
926 2a50e2e8 Guido Trotter
- try to reduce the runtime/maximum memory of some instances on the
927 2a50e2e8 Guido Trotter
  destination node of the N+1 failure (in the example above ``node2``)
928 2a50e2e8 Guido Trotter
  to create additional available node memory (check the :doc:`admin`
929 2a50e2e8 Guido Trotter
  guide for what Ganeti will and won't automatically do in regards to
930 2a50e2e8 Guido Trotter
  instance runtime memory modification)
931 1ebe6dbd Iustin Pop
- if Ganeti has been built with the htools package enabled, you can run
932 1ebe6dbd Iustin Pop
  the ``hbal`` tool which will try to compute an automated cluster
933 1ebe6dbd Iustin Pop
  solution that complies with the N+1 rule
934 c71a1a3d Iustin Pop
935 c71a1a3d Iustin Pop
Network issues
936 c71a1a3d Iustin Pop
++++++++++++++
937 c71a1a3d Iustin Pop
938 c71a1a3d Iustin Pop
In case a node has problems with the network (usually the secondary
939 c71a1a3d Iustin Pop
network, as problems with the primary network will render the node
940 c71a1a3d Iustin Pop
unusable for ganeti commands), it will show up in cluster verify as::
941 c71a1a3d Iustin Pop
942 832f8c6a Iustin Pop
  $ gnt-cluster verify
943 c71a1a3d Iustin Pop
  Mon Oct 26 19:07:19 2009 * Verifying global settings
944 c71a1a3d Iustin Pop
  Mon Oct 26 19:07:19 2009 * Gathering data (3 nodes)
945 c71a1a3d Iustin Pop
  Mon Oct 26 19:07:23 2009 * Verifying node status
946 c71a1a3d Iustin Pop
  Mon Oct 26 19:07:23 2009   - ERROR: node node1: tcp communication with node 'node3': failure using the secondary interface(s)
947 c71a1a3d Iustin Pop
  Mon Oct 26 19:07:23 2009   - ERROR: node node2: tcp communication with node 'node3': failure using the secondary interface(s)
948 c71a1a3d Iustin Pop
  Mon Oct 26 19:07:23 2009   - ERROR: node node3: tcp communication with node 'node1': failure using the secondary interface(s)
949 c71a1a3d Iustin Pop
  Mon Oct 26 19:07:23 2009   - ERROR: node node3: tcp communication with node 'node2': failure using the secondary interface(s)
950 c71a1a3d Iustin Pop
  Mon Oct 26 19:07:23 2009   - ERROR: node node3: tcp communication with node 'node3': failure using the secondary interface(s)
951 c71a1a3d Iustin Pop
  Mon Oct 26 19:07:23 2009 * Verifying instance status
952 c71a1a3d Iustin Pop
  Mon Oct 26 19:07:23 2009 * Verifying orphan volumes
953 c71a1a3d Iustin Pop
  Mon Oct 26 19:07:23 2009 * Verifying remaining instances
954 c71a1a3d Iustin Pop
  Mon Oct 26 19:07:23 2009 * Verifying N+1 Memory redundancy
955 c71a1a3d Iustin Pop
  Mon Oct 26 19:07:23 2009 * Other Notes
956 c71a1a3d Iustin Pop
  Mon Oct 26 19:07:23 2009 * Hooks Results
957 832f8c6a Iustin Pop
  $
958 c71a1a3d Iustin Pop
959 c71a1a3d Iustin Pop
This shows that both node1 and node2 have problems contacting node3 over
960 c71a1a3d Iustin Pop
the secondary network, and node3 has problems contacting them. From this
961 c71a1a3d Iustin Pop
output is can be deduced that since node1 and node2 can communicate
962 c71a1a3d Iustin Pop
between themselves, node3 is the one having problems, and you need to
963 c71a1a3d Iustin Pop
investigate its network settings/connection.
964 c71a1a3d Iustin Pop
965 c71a1a3d Iustin Pop
Migration problems
966 c71a1a3d Iustin Pop
++++++++++++++++++
967 c71a1a3d Iustin Pop
968 c71a1a3d Iustin Pop
Since live migration can sometimes fail and leave the instance in an
969 c71a1a3d Iustin Pop
inconsistent state, Ganeti provides a ``--cleanup`` argument to the
970 c71a1a3d Iustin Pop
migrate command that does:
971 c71a1a3d Iustin Pop
972 c71a1a3d Iustin Pop
- check on which node the instance is actually running (has the
973 c71a1a3d Iustin Pop
  command failed before or after the actual migration?)
974 c71a1a3d Iustin Pop
- reconfigure the DRBD disks accordingly
975 c71a1a3d Iustin Pop
976 c71a1a3d Iustin Pop
It is always safe to run this command as long as the instance has good
977 c71a1a3d Iustin Pop
data on its primary node (i.e. not showing as degraded). If so, you can
978 c71a1a3d Iustin Pop
simply run::
979 c71a1a3d Iustin Pop
980 832f8c6a Iustin Pop
  $ gnt-instance migrate --cleanup %instance1%
981 c71a1a3d Iustin Pop
  Instance instance1 will be recovered from a failed migration. Note
982 c71a1a3d Iustin Pop
  that the migration procedure (including cleanup) is **experimental**
983 c71a1a3d Iustin Pop
  in this version. This might impact the instance if anything goes
984 c71a1a3d Iustin Pop
  wrong. Continue?
985 832f8c6a Iustin Pop
  y/[n]/?: %y%
986 c71a1a3d Iustin Pop
  Mon Oct 26 19:13:49 2009 Migrating instance instance1
987 c71a1a3d Iustin Pop
  Mon Oct 26 19:13:49 2009 * checking where the instance actually runs (if this hangs, the hypervisor might be in a bad state)
988 c71a1a3d Iustin Pop
  Mon Oct 26 19:13:49 2009 * instance confirmed to be running on its primary node (node2)
989 c71a1a3d Iustin Pop
  Mon Oct 26 19:13:49 2009 * switching node node1 to secondary mode
990 c71a1a3d Iustin Pop
  Mon Oct 26 19:13:50 2009 * wait until resync is done
991 c71a1a3d Iustin Pop
  Mon Oct 26 19:13:50 2009 * changing into standalone mode
992 c71a1a3d Iustin Pop
  Mon Oct 26 19:13:50 2009 * changing disks into single-master mode
993 c71a1a3d Iustin Pop
  Mon Oct 26 19:13:50 2009 * wait until resync is done
994 c71a1a3d Iustin Pop
  Mon Oct 26 19:13:51 2009 * done
995 832f8c6a Iustin Pop
  $
996 c71a1a3d Iustin Pop
997 c71a1a3d Iustin Pop
In use disks at instance shutdown
998 c71a1a3d Iustin Pop
+++++++++++++++++++++++++++++++++
999 c71a1a3d Iustin Pop
1000 c71a1a3d Iustin Pop
If you see something like the following when trying to shutdown or
1001 c71a1a3d Iustin Pop
deactivate disks for an instance::
1002 c71a1a3d Iustin Pop
1003 832f8c6a Iustin Pop
  $ gnt-instance shutdown %instance1%
1004 c71a1a3d Iustin Pop
  Mon Oct 26 19:16:23 2009  - WARNING: Could not shutdown block device disk/0 on node node2: drbd0: can't shutdown drbd device: /dev/drbd0: State change failed: (-12) Device is held open by someone\n
1005 c71a1a3d Iustin Pop
1006 c71a1a3d Iustin Pop
It most likely means something is holding open the underlying DRBD
1007 c71a1a3d Iustin Pop
device. This can be bad if the instance is not running, as it might mean
1008 c71a1a3d Iustin Pop
that there was concurrent access from both the node and the instance to
1009 c71a1a3d Iustin Pop
the disks, but not always (e.g. you could only have had the partitions
1010 c71a1a3d Iustin Pop
activated via ``kpartx``).
1011 c71a1a3d Iustin Pop
1012 c71a1a3d Iustin Pop
To troubleshoot this issue you need to follow standard Linux practices,
1013 c71a1a3d Iustin Pop
and pay attention to the hypervisor being used:
1014 c71a1a3d Iustin Pop
1015 c71a1a3d Iustin Pop
- check if (in the above example) ``/dev/drbd0`` on node2 is being
1016 c71a1a3d Iustin Pop
  mounted somewhere (``cat /proc/mounts``)
1017 c71a1a3d Iustin Pop
- check if the device is not being used by device mapper itself:
1018 c71a1a3d Iustin Pop
  ``dmsetup ls`` and look for entries of the form ``drbd0pX``, and if so
1019 c71a1a3d Iustin Pop
  remove them with either ``kpartx -d`` or ``dmsetup remove``
1020 c71a1a3d Iustin Pop
1021 c71a1a3d Iustin Pop
For Xen, check if it's not using the disks itself::
1022 c71a1a3d Iustin Pop
1023 832f8c6a Iustin Pop
  $ xenstore-ls /local/domain/%0%/backend/vbd|grep -e "domain =" -e physical-device
1024 c71a1a3d Iustin Pop
  domain = "instance2"
1025 c71a1a3d Iustin Pop
  physical-device = "93:0"
1026 c71a1a3d Iustin Pop
  domain = "instance3"
1027 c71a1a3d Iustin Pop
  physical-device = "93:1"
1028 c71a1a3d Iustin Pop
  domain = "instance4"
1029 c71a1a3d Iustin Pop
  physical-device = "93:2"
1030 832f8c6a Iustin Pop
  $
1031 c71a1a3d Iustin Pop
1032 c71a1a3d Iustin Pop
You can see in the above output that the node exports three disks, to
1033 c71a1a3d Iustin Pop
three instances. The ``physical-device`` key is in major:minor format in
1034 832f8c6a Iustin Pop
hexadecimal, and ``0x93`` represents DRBD's major number. Thus we can
1035 832f8c6a Iustin Pop
see from the above that instance2 has /dev/drbd0, instance3 /dev/drbd1,
1036 832f8c6a Iustin Pop
and instance4 /dev/drbd2.
1037 c71a1a3d Iustin Pop
1038 e986f20c Michael Hanselmann
LUXI version mismatch
1039 e986f20c Michael Hanselmann
+++++++++++++++++++++
1040 e986f20c Michael Hanselmann
1041 e986f20c Michael Hanselmann
LUXI is the protocol used for communication between clients and the
1042 e986f20c Michael Hanselmann
master daemon. Starting in Ganeti 2.3, the peers exchange their version
1043 e986f20c Michael Hanselmann
in each message. When they don't match, an error is raised::
1044 e986f20c Michael Hanselmann
1045 832f8c6a Iustin Pop
  $ gnt-node modify -O yes %node3%
1046 e986f20c Michael Hanselmann
  Unhandled Ganeti error: LUXI version mismatch, server 2020000, request 2030000
1047 e986f20c Michael Hanselmann
1048 e986f20c Michael Hanselmann
Usually this means that server and client are from different Ganeti
1049 e986f20c Michael Hanselmann
versions or import their libraries from different, consistent paths
1050 e986f20c Michael Hanselmann
(e.g. an older version installed in another place). You can print the
1051 e986f20c Michael Hanselmann
import path for Ganeti's modules using the following command (note that
1052 e986f20c Michael Hanselmann
depending on your setup you might have to use an explicit version in the
1053 e986f20c Michael Hanselmann
Python command, e.g. ``python2.6``)::
1054 e986f20c Michael Hanselmann
1055 e986f20c Michael Hanselmann
  python -c 'import ganeti; print ganeti.__file__'
1056 e986f20c Michael Hanselmann
1057 c71a1a3d Iustin Pop
.. vim: set textwidth=72 :
1058 c71a1a3d Iustin Pop
.. Local Variables:
1059 c71a1a3d Iustin Pop
.. mode: rst
1060 c71a1a3d Iustin Pop
.. fill-column: 72
1061 c71a1a3d Iustin Pop
.. End: