Statistics
| Branch: | Tag: | Revision:

root / docs / upgrade / upgrade-0.15.rst @ 5547485e

History | View | Annotate | Download (14.4 kB)

1
Upgrade to Synnefo v0.15
2
^^^^^^^^^^^^^^^^^^^^^^^^
3

    
4
Prerequisites
5
==============
6

    
7
Before upgrading to v0.15 there are two steps that must be performed, relative
8
with Cyclades networking service.
9

    
10
Add unique name to the NICs of all Ganeti instances
11
---------------------------------------------------
12

    
13
Since Ganeti 2.8, it is supported to give a name to NICs of Ganeti instances
14
and refer to them with their name, and not only by their index. Synnefo v0.15
15
assigns a unique name to each NIC and refers to them by their unique name.
16
Before upgrading to v0.15, Synnefo must assign names to all existing NICs.
17
This can easily be performed with a helper script that is shipped with Synnefo
18
v0.14.10:
19

    
20
.. code-block:: console
21

    
22
 cyclades.host$ /usr/lib/synnefo/tools/add_unique_name_to_nics
23

    
24
.. note:: If you are not upgrading from v0.14.10, you can find the migration
25
 script here XXX.
26

    
27

    
28
Extend public networks to all Ganeti backends
29
---------------------------------------------
30

    
31
Before v0.15, each public network of Cyclades existed in one of the Ganeti
32
backends. In order to support dynamic addition and removal of public IPv4
33
address across VMs, each public network must exist in all Ganeti backends.
34

    
35
If you are using more than one Ganeti backends, before upgrading to v0.15 you
36
must ensure that the network configuration to all Ganeti backends is identical
37
and appropriate to support all public networks of Cyclades.
38

    
39

    
40
Upgrade Steps
41
=============
42

    
43
The upgrade to v0.15 consists in the following steps:
44

    
45
1. Bring down services and backup databases.
46

    
47
2. Upgrade packages, migrate the databases and configure settings.
48

    
49
3. Create floating IP pools
50

    
51
4. Register services and resources.
52

    
53
5. Bring up all services.
54

    
55
.. warning::
56

    
57
    It is strongly suggested that you keep separate database backups
58
    for each service after the completion of each step.
59

    
60
1. Bring web services down, backup databases
61
============================================
62

    
63
1. All web services must be brought down so that the database maintains a
64
   predictable and consistent state during the migration process::
65

    
66
    $ service gunicorn stop
67
    $ service snf-dispatcher stop
68
    $ service snf-ganeti-eventd stop
69

    
70
2. Backup databases for recovery to a pre-migration state.
71

    
72
3. Keep the database servers running during the migration process.
73

    
74

    
75
2. Upgrade Synnefo and configure settings
76
=========================================
77

    
78
2.1 Install the new versions of packages
79
----------------------------------------
80

    
81
::
82

    
83
    astakos.host$ apt-get install \
84
                            python-objpool \
85
                            snf-common \
86
                            python-astakosclient \
87
                            snf-django-lib \
88
                            snf-webproject \
89
                            snf-branding \
90
                            snf-astakos-app
91

    
92
    cyclades.host$ apt-get install \
93
                            python-objpool \
94
                            snf-common \
95
                            python-astakosclient \
96
                            snf-django-lib \
97
                            snf-webproject \
98
                            snf-branding \
99
                            snf-pithos-backend \
100
                            snf-cyclades-app
101

    
102
    pithos.host$ apt-get install \
103
                            python-objpool \
104
                            snf-common \
105
                            python-astakosclient \
106
                            snf-django-lib \
107
                            snf-webproject \
108
                            snf-branding \
109
                            snf-pithos-backend \
110
                            snf-pithos-app \
111
                            snf-pithos-webclient
112

    
113
    ganeti.node$ apt-get install \
114
                            python-objpool \
115
                            snf-common \
116
                            snf-cyclades-gtools \
117
                            snf-pithos-backend
118

    
119
.. note::
120

    
121
   Make sure `snf-webproject' has the same version with snf-common
122

    
123
.. note::
124

    
125
    Installing the packages will cause services to start. Make sure you bring
126
    them down again (at least ``gunicorn``, ``snf-dispatcher``)
127

    
128
2.2 Sync and migrate the database
129
---------------------------------
130

    
131
.. note::
132

    
133
   If you are asked about stale content types during the migration process,
134
   answer 'no' and let the migration finish.
135

    
136
::
137

    
138
    astakos-host$ snf-manage syncdb
139
    astakos-host$ snf-manage migrate
140

    
141
    cyclades-host$ snf-manage syncdb
142
    cyclades-host$ snf-manage migrate
143

    
144
    pithos-host$ pithos-migrate upgrade head
145

    
146
.. _pithos_view_registration:
147

    
148
2.3 Register pithos view as an oauth 2.0 client in astakos
149
----------------------------------------------------------
150

    
151
Starting from synnefo version 0.15, the pithos view, in order to get access to
152
the data of a protect pithos resource, has to be granted authorization for the
153
specific resource by astakos.
154

    
155
During the authorization grant procedure, it has to authenticate itself with
156
astakos since the later has to prevent serving requests by unknown/unauthorized
157
clients.
158

    
159
To register the pithos view as an OAuth 2.0 client in astakos, use the
160
following command::
161

    
162
    snf-manage oauth2-client-add pithos-view --secret=<secret> --is-trusted --url https://pithos.synnefo.live/pithos/ui/view
163

    
164
2.4 Update configuration files
165
------------------------------
166

    
167
The ``ASTAKOS_BASE_URL`` setting has been replaced (both in Cyclades and
168
Pithos services) with the ``ASTAKOS_AUTH_URL`` setting.
169

    
170
For Cyclades service we have to change the ``20-snf-cyclades-app-api.conf``
171
file, remove the ``ASTAKOS_BASE_URL`` setting and replace it with
172
``ASTAKOS_AUTH_URL``. Typically it is sufficient to add ``/identity/v2.0``
173
at the end of base url to get the auth url. For example if base url had the
174
value of 'https://accounts.example.synnefo.org/' then the ``ASTAKOS_AUTH_URL``
175
setting will have the value of
176
'https://accounts.example.synnefo.org/identity/v2.0'.
177

    
178
For Pithos service we have to change the ``20-snf-pithos-app-settings.conf``
179
file in the same way as above.
180

    
181
2.4 Upgrade vncauthproxy and configure snf-cyclades-app
182
-------------------------------------------------------
183

    
184
Synnefo v0.15 adds support for snf-vncauthproxy >= 1.5 and drops support for
185
older versions. You will have to upgrade snf-vncauthproxy to v1.5 and
186
configure the authentication (users) file (``/var/lib/vncauthproxy/users``).
187

    
188
In case you're upgrading from an older snf-vncauthproxy version or if it's the
189
first time you're installing snf-vncauthproxy, you will need to add a
190
vncauthproxy user (see below for more information on user management) and
191
restart vncauthproxy daemon.
192

    
193
To manage the authentication file, you can use the vncauthproxy-passwd tool,
194
to easily add, update and delete users.
195

    
196
To add a user:
197

    
198
.. code-block:: console
199

    
200
    # vncauthproxy-passwd /var/lib/vncauthproxy/users synnefo
201

    
202
You will be prompted for a password.
203

    
204
You should also configure the new ``CYCLADES_VNCAUTHPROXY_OPTS`` setting in
205
``snf-cyclades-app``, to provide the user and password configured for
206
``Synnefo`` in the vncauthproxy authentication file and enable SSL support if
207
snf-vncauthproxy is configured to run with SSL enabled for the control socket.
208

    
209
.. warning:: The vncauthproxy daemon requires a restart for the changes in the
210
 authentication file to take effect.
211

    
212
.. warning:: If you fail to provide snf-vncauthproxy with a valid
213
 authentication file, or in case the configuration of vncauthproxy and the
214
 vncauthproxy snf-cyclades-app settings don't match (ie not having SSL enabled
215
 on both), VNC console access will not be functional.
216

    
217
Finally, snf-vncauthproxy-1.5 adds a dedicated user and group to be used by the
218
vncauthproxy daemon. The Debian default file has changed accordingly (``CHUID``
219
option in ``/etc/default/vncauthproxy``). The Debian default file now also
220
includes a ``DAEMON_OPTS`` variable which is used to pass any necessary / extra
221
options to the vncauthproxy daemon. In case you're ugprading from an older
222
version of vncauthproxy, you should make sure to 'merge' the new default file
223
with the older one.
224

    
225
Check the `documentation
226
<http://www.synnefo.org/docs/snf-vncauthproxy/latest/index.html>`_ of
227
snf-vncauthproxy for more information on upgrading to version 1.5.
228

    
229
2.5 Stats configuration
230
-----------------------
231

    
232
snf-cyclades-gtools comes with a collectd plugin to collect CPU and network
233
stats for Ganeti VMs and an example collectd configuration. snf-stats-app is a
234
Django (snf-webproject) app that serves the VM stats graphsmm by reading the VM
235
stats (from RRD files) and serves graphs.
236

    
237
To enable / deploy VM stats collecting and snf-stats-app see the relevant
238
documentation in the :ref:`admin guide <admin-guide-stats>`.
239

    
240
If you were using collectd to collect VM stats on Debian squeeze and you are
241
upgrading to Wheezy, you will need to upgrade your RRD files. Follow the
242
instructions on the collectd v4-to-v5 migration `guide
243
<https://collectd.org/wiki/index.php/V4_to_v5_migration_guide>`_.
244
You will proabably just need to run the `migration script
245
<https://collectd.org/wiki/index.php/V4_to_v5_migration_guide#Migration_script>`_
246
provided.
247

    
248
If you were using a previous version of snf-stats-app, you should also make
249
sure to set the ``STATS_BASE_URL`` setting in ``20-snf-stats-app-settings.conf``
250
to match your deployment and change the graph URL settings in
251
``20-snf-cyclades-app-api.conf`` accordingly.
252

    
253
v0.15 has also introduced the ``CYCLADES_STATS_SECRET_KEY`` and
254
``STATS_SECRET_KEY`` settings. ``CYCLADES_STATS_SECRET_KEY`` in
255
``20-snf-cyclades-app-api.conf`` is used by Cyclades to encrypt the instance id
256
/ hostname  in the URLs serving the VM stats. You should set it to a random
257
value / string and make sure that it's the same as the ``STATS_SECRET_KEY``
258
setting (used to decrypt the instance hostname) in
259
``20-snf-stats-settings.conf`` on your Stats host.
260

    
261
In addition to this, we have to change the ``PITHOS_OAUTH2_CLIENT_CREDENTIALS``
262
setting in the ``20-snf-pithos-app-settings.conf`` file to set the credentials
263
issued for the pithos view in `the previous step`__.
264

    
265
__ pithos_view_registration_
266

    
267
3. Create floating IP pools
268
===========================
269

    
270
Synnefo v0.15 introduces floating IPs, which are public IPv4 addresses that can
271
dynamically be added/removed to/from VMs and are quotable via the
272
'cyclades.floating_ip' resource. Connecting a VM to a public network is only
273
allowed if the user has firstly created a floating IP from this network.
274

    
275
Floating IPs are created from networks that are marked as Floating IP pools.
276
Creation of floating IP pools is done with the `snf-manage network-create`
277
command using the `--floating-ip-pool` option.
278

    
279
Existing networks can be converted to floating IPs using `network-modify`
280
command:
281

    
282
.. code-block:: console
283

    
284
  snf-manage network-modify --floating-ip-pool=True <network_ID>
285

    
286
Already allocated public IPv4 addresses are not automatically converted to
287
floating IPs. Existing VMs can keep their IPv4 addresses which will be
288
automatically be released when these VMs will be destroyed. In order to
289
convert existing public IPs to floating IPs run the following command:
290

    
291
.. code-block:: console
292

    
293
 cyclades.host$ /usr/lib/synnefo/tools/update_to_floating_ips
294

    
295
or for just one network:
296

    
297
.. code-block:: console
298

    
299
 cyclades.host$ /usr/lib/synnefo/tools/update_to_floating_ips --network-id=<network_ID>
300

    
301
4. Register services and resources
302
==================================
303

    
304
4.1 Re-register service and resource definitions
305
------------------------------------------------
306

    
307
You will need to register again all Synnefo components, updating the
308
service and resource definitions. On the astakos node, run::
309

    
310
    astakos-host$ snf-component-register
311

    
312
This will detect that the Synnefo components are already registered and ask
313
to re-register. Answer positively. You need to enter the base URL and the UI
314
URL for each component, just like during the initial registration.
315

    
316
.. note::
317

    
318
   You can run ``snf-manage component-list -o name,ui_url`` to inspect the
319
   current registered UI URL. In the default installation, the base URL can
320
   be found by stripping ``/ui`` from the UI URL.
321

    
322
The meaning of resources ``cyclades.cpu`` and ``cyclades.ram`` has changed:
323
they now denote the number of CPUs and, respectively, RAM of *active* VMs
324
rather than all VMs. To represent total CPUs and total RAM, as previously,
325
new resources ``cyclades.total_cpu`` and ``cyclades.total_ram`` are
326
introduced. We now also control the usage of floating IPs through resource
327
``cyclades.floating_ip``.
328

    
329
4.2 Tweek resource settings
330
---------------------------
331

    
332
New resources (``cyclades.total_cpu``, ``cyclades.total_ram``, and
333
``cyclades.floating_ip``) are registered with infinite default base quota.
334
You will probably need to restrict them, especially
335
``cyclades.floating_ip``. In order to change the default for all *future*
336
users, for instance restricting floating IPs to 2, run::
337

    
338
    astakos-host$ snf-manage resource-modify cyclades.floating_ip --default-quota 2
339

    
340
Note that this command does not affect *existing* users any more. They can
341
still have infinite floating IPs. You can update base quota of existing
342
users in bulk, possibly excluding some users, with::
343

    
344
    astakos-host$ snf-manage user-modify --all --base-quota cyclades.floating_ip 2 --exclude uuid1,uuid2
345

    
346
.. note::
347

    
348
   You can inspect base quota with ``snf-manage quota-list`` before applying
349
   any changes, for example::
350

    
351
     # Get users with cyclades.vm base quota that differ from the default value
352
     astakos-host$ snf-manage quota-list --with-custom=True --filter-by "resource=cyclades.vm"
353

    
354
     # Get users with cyclades.vm base quota greater than 3
355
     astakos-host$ snf-manage quota-list --filter-by "resource=cyclades.vm,base_quota>3"
356

    
357
It is now possible to control whether a resource is visible for the users
358
through the API or the UI. Note that the system always checks resource
359
quota, regardless of their visibility. By default, ``cyclades.total_cpu``,
360
``cyclades.total_ram`` and ``astakos.pending_app`` are not visible. You can
361
change this behavior with::
362

    
363
    astakos-host$ snf-manage resource-modify <resource> --api-visible=True (or --ui-visible=True)
364

    
365
4.3 Update the Quotaholder
366
--------------------------
367

    
368
To update quota for all new or modified Cyclades resources, bring up Astakos::
369

    
370
    astakos-host$ service gunicorn start
371

    
372
and run on the Cyclades node::
373

    
374
   cyclades-host$ snf-manage reconcile-resources-cyclades --fix --force
375

    
376

    
377
5. Bring all services up
378
========================
379

    
380
After the upgrade is finished, we bring up all services:
381

    
382
.. code-block:: console
383

    
384
    astakos.host  # service gunicorn start
385
    cyclades.host # service gunicorn start
386
    pithos.host   # service gunicorn start
387

    
388
    cyclades.host # service snf-dispatcher start