Statistics
| Branch: | Tag: | Revision:

root / docs / upgrade / upgrade-0.15.rst @ 812e72c9

History | View | Annotate | Download (19.9 kB)

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

    
4

    
5
Prerequisites
6
==============
7

    
8
Before upgrading to v0.15 there are three steps that must be performed, relative
9
to the Cyclades networking service.
10

    
11
Add unique names to all NICs of all Ganeti instances
12
----------------------------------------------------
13

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

    
21
.. code-block:: console
22

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

    
25
.. note:: If you are not upgrading from v0.14.10, you can find the migration
26
 script :ref:`here <add_names>`.
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
addresses 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 of all Ganeti backends is identical
37
and appropriate to support all public networks of Cyclades.
38

    
39
Update Ganeti allocation policy
40
-------------------------------
41

    
42
Minimum number of NICs
43
``````````````````````
44
Before v0.15, all Cyclades VMs were forced to be connected to the public
45
network. Synnefo v0.15 supports more flexible configurations and dynamic
46
addition/removal of public IPv4 addresses, which can result in a VMs with no
47
NICs at all. However, Ganeti's default allocation policy will not allow
48
instances without NICs. You will have to override Ganeti's default allocation
49
policy to set the minimum number of NICs to zero. To do this, first get the
50
current allocation policy:
51

    
52
.. code-block:: console
53

    
54
 $ gnt-cluster show-ispecs-cmd
55
 gnt-cluster init --ipolicy-std-specs cpu-count=1,disk-count=1,disk-size=1024,memory-size=128,nic-count=1,spindle-use=1
56
   --ipolicy-bounds-specs min:cpu-count=1,disk-count=1,disk-size=1024,memory-size=128,nic-count=1,spindle-use=1/max:cpu-count=8,disk-count=16,disk-size=1048576,memory-size=32768,nic-count=8,spindle-use=12
57
   ganeti1.example.synnefo.org
58

    
59
And replace `min:nic-count=1` with `min:nic-count=0`. Also, set
60
`max:nic-count=32` to avoid reaching the default limit of 8.
61

    
62

    
63
.. code-block:: console
64

    
65
 gnt-cluster modify --ipolicy-bounds-specs min:cpu-count=1,disk-count=1,disk-size=1024,memory-size=128,nic-count=0,spindle-use=1/max:cpu-count=8,disk-count=16,disk-size=1048576,memory-size=32768,nic-count=32,spindle-use=12
66

    
67
Enabled and allowed disk templates
68
``````````````````````````````````
69
In v0.15, the ``ARCHIPELAGO_BACKENDS`` setting, that was used to separate
70
backends that were using Archipelago from the ones that were using all other
71
disk templates, has been removed. Instead, allocation of instances to Ganeti
72
backends is based on which disk templates are enabled and allowed in each
73
Ganeti backend (see section in :ref:`admin guide <alloc_disk_templates>`). You
74
can see the enabled/allowed disk templates by inspecting the corresponding
75
fields in the `gnt-cluster info` output. For example, to have a backend holding
76
only instances with archipelago disk templates, you can set the
77
`--ipolicy-disk-templates` to include only the `ext` disk template.
78

    
79
.. code-block:: console
80

    
81
 gnt-cluster modify --ipolicy-disk-templates=ext
82

    
83

    
84
Upgrade Steps
85
=============
86

    
87
The upgrade to v0.15 consists in the following steps:
88

    
89
1. Bring down services and backup databases.
90

    
91
2. Upgrade packages, migrate the databases and configure settings.
92

    
93
3. Create floating IP pools
94

    
95
4. Re-register services and resources.
96

    
97
5. Bring up all services.
98

    
99
.. warning::
100

    
101
    It is strongly suggested that you keep separate database backups
102
    for each service after the completion of each step.
103

    
104
1. Bring web services down, backup databases
105
============================================
106

    
107
1. All web services must be brought down so that the database maintains a
108
   predictable and consistent state during the migration process::
109

    
110
    $ service gunicorn stop
111
    $ service snf-dispatcher stop
112
    $ service snf-ganeti-eventd stop
113

    
114
2. Backup databases for recovery to a pre-migration state.
115

    
116
3. Keep the database servers running during the migration process.
117

    
118

    
119
2. Upgrade Synnefo and configure settings
120
=========================================
121

    
122
2.1 Install the new versions of packages
123
----------------------------------------
124

    
125
::
126

    
127
    astakos.host$ apt-get install \
128
                            python-objpool \
129
                            snf-common \
130
                            python-astakosclient \
131
                            snf-django-lib \
132
                            snf-webproject \
133
                            snf-branding \
134
                            snf-astakos-app
135

    
136
    cyclades.host$ apt-get install \
137
                            python-objpool \
138
                            snf-common \
139
                            python-astakosclient \
140
                            snf-django-lib \
141
                            snf-webproject \
142
                            snf-branding \
143
                            snf-pithos-backend \
144
                            snf-cyclades-app
145

    
146
    pithos.host$ apt-get install \
147
                            python-objpool \
148
                            snf-common \
149
                            python-astakosclient \
150
                            snf-django-lib \
151
                            snf-webproject \
152
                            snf-branding \
153
                            snf-pithos-backend \
154
                            snf-pithos-app \
155
                            snf-pithos-webclient
156

    
157
    ganeti.node$ apt-get install \
158
                            python-objpool \
159
                            snf-common \
160
                            snf-cyclades-gtools \
161
                            snf-pithos-backend \
162
                            snf-network
163

    
164
.. note::
165

    
166
   Make sure `snf-webproject' has the same version with snf-common
167

    
168
.. note::
169

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

    
173
2.2 Sync and migrate the database
174
---------------------------------
175

    
176
.. note::
177

    
178
   If you are asked about stale content types during the migration process,
179
   answer 'no' and let the migration finish.
180

    
181
::
182

    
183
    astakos-host$ snf-manage syncdb
184
    astakos-host$ snf-manage migrate
185

    
186
    cyclades-host$ snf-manage syncdb
187
    cyclades-host$ snf-manage migrate
188

    
189
    pithos-host$ pithos-migrate upgrade head
190

    
191
2.3 Configure Astakos authentication URL
192
----------------------------------------
193

    
194
The ``ASTAKOS_BASE_URL`` setting has been replaced (both in Cyclades and Pithos
195
services) with the ``ASTAKOS_AUTH_URL`` setting.
196

    
197
For Cyclades service we have to change the ``20-snf-cyclades-app-api.conf``
198
file, remove the ``ASTAKOS_BASE_URL`` setting and replace it with
199
``ASTAKOS_AUTH_URL``. Typically it is sufficient to add ``/identity/v2.0`` at
200
the end of base URL to get the auth URL. For example, if base URL had the value
201
of 'https://accounts.example.synnefo.org/' then the ``ASTAKOS_AUTH_URL``
202
setting will have the value of
203
'https://accounts.example.synnefo.org/identity/v2.0'.
204

    
205
The same change has to be made for the Pithos service in
206
``/etc/synnefo/20-snf-pithos-app-settings.conf``.
207

    
208
2.4 Register Pithos view as an OAuth 2.0 client in Astakos
209
----------------------------------------------------------
210

    
211
Starting from Synnefo version 0.15, the Pithos view, in order to get access to
212
the data of a protected Pithos resource, has to be granted authorization for
213
the specific resource by Astakos.
214

    
215
During the authorization grant procedure, it has to authenticate itself with
216
Astakos, since the latter has to prevent serving requests by
217
unknown/unauthorized clients.
218

    
219
Each oauth 2.0 client is identified by a client identifier (client_id).
220
Moreover, the confidential clients are authenticated via a password
221
(client_secret).
222
Then, each client has to declare at least a redirect URI so that astakos will
223
be able to validate the redirect URI provided during the authorization code
224
request.
225
If a client is trusted (like a pithos view) astakos grants access on behalf
226
of the resource owner, otherwise the resource owner has to be asked.
227

    
228
To register the pithos view as an OAuth 2.0 client in astakos, use the
229
following command::
230

    
231
    astakos-host$ snf-manage oauth2-client-add pithos-view --secret=<secret> --is-trusted --url https://pithos.synnefo.live/pithos/ui/view
232

    
233
You can see the registered clients by running::
234

    
235
    astakos-host$ snf-manage oauth2-client-list -o id,name,redirect_urls,is_trusted
236

    
237
Finally, you will have to add the registered `client_id` and `client_secret` to
238
the ``PITHOS_OAUTH2_CLIENT_CREDENTIALS`` setting in
239
``/etc/synnefo/20-snf-pithos-app-settings.conf``.
240

    
241

    
242
2.5 Upgrade vncauthproxy and configure snf-cyclades-app
243
-------------------------------------------------------
244

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

    
249
In case you are upgrading from an older snf-vncauthproxy version or if it's the
250
first time you're installing snf-vncauthproxy, you will need to add a
251
vncauthproxy user (see below for more information on user management) and
252
restart the vncauthproxy daemon.
253

    
254
To manage the authentication file, you can use the ``vncauthproxy-passwd`` tool,
255
to easily add, update and delete users.
256

    
257
To add a user:
258

    
259
.. code-block:: console
260

    
261
    # vncauthproxy-passwd /var/lib/vncauthproxy/users synnefo
262

    
263
You will be prompted for a password.
264

    
265
You should also configure the new ``CYCLADES_VNCAUTHPROXY_OPTS`` setting in
266
``snf-cyclades-app``, to provide the user and password configured for
267
``synnefo`` in the vncauthproxy authentication file and enable SSL support if
268
snf-vncauthproxy is configured to run with SSL enabled for the control socket.
269

    
270
.. warning:: The vncauthproxy daemon requires a restart for the changes in the
271
 authentication file to take effect.
272

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

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

    
286
Check the `documentation
287
<http://www.synnefo.org/docs/snf-vncauthproxy/latest/index.html>`_ of
288
snf-vncauthproxy for more information on upgrading to version 1.5.
289

    
290
2.6 Stats configuration
291
-----------------------
292

    
293
snf-cyclades-gtools comes with a collectd plugin to collect CPU and network
294
stats for Ganeti VMs and an example collectd configuration. snf-stats-app is a
295
Django (snf-webproject) app that serves the VM stats graphs by reading the VM
296
stats (from RRD files).
297

    
298
To enable/deploy the VM stats collecting and snf-stats-app, see the relevant
299
documentation in the :ref:`admin guide <admin-guide-stats>`.
300

    
301
If you were using collectd to collect VM stats on Debian Squeeze and you are
302
upgrading to Wheezy, you will need to upgrade your RRD files. Follow the
303
instructions on the collectd v4-to-v5 migration `guide
304
<https://collectd.org/wiki/index.php/V4_to_v5_migration_guide>`_.
305
You will probably just need to run the `migration script
306
<https://collectd.org/wiki/index.php/V4_to_v5_migration_guide#Migration_script>`_
307
provided.
308

    
309
If you were using a previous version of snf-stats-app, you should also make
310
sure to set the ``STATS_BASE_URL`` setting in ``20-snf-stats-app-settings.conf``
311
to match your deployment and change the graph URL settings in
312
``20-snf-cyclades-app-api.conf`` accordingly.
313

    
314
v0.15 has also introduced the ``CYCLADES_STATS_SECRET_KEY`` and
315
``STATS_SECRET_KEY`` settings. ``CYCLADES_STATS_SECRET_KEY`` in
316
``20-snf-cyclades-app-api.conf`` is used by Cyclades to encrypt the instance id
317
/ hostname  in the URLs serving the VM stats. You should set it to a random
318
value/string and make sure that it's the same as the ``STATS_SECRET_KEY``
319
setting (used to decrypt the instance hostname) in
320
``20-snf-stats-settings.conf`` on your Stats host.
321

    
322
2.7 Shibboleth configuration updates
323
------------------------------------
324

    
325
.. note::
326

    
327
  Skip this step unless you have ``shibboleth`` enabled in Astakos
328
  ``IM_MODULES`` setting.
329

    
330
As of v0.15 Astakos uses the ``REMOTE_USER`` header provided by Apache's
331
``mod_shib2`` service in order to resolve the unique identifier which is used
332
to associate a shibboleth account to a local Astakos user. Prior to this
333
version, Astakos adhered to the presence of the ``MOD_SHIB_EPPN`` header which
334
although safe enough on most of the ``SP`` deployment scenarios, it may cause
335
issues in certain cases, such as global wide IdP support or inability of
336
supported IdPs to release the ``eduPersonPrincipalName`` attribute. The
337
``REMOTE_USER`` header can be set by administrators to match any of the
338
available shibboleth attributes.
339

    
340
If ``EPPN`` matches the service provider needs and you want to continue using
341
it as the unique identifier, you need to ensure that the ``REMOTE_USER``
342
attribute is set to ``eppn`` in the ``mod_shib2`` config file located at
343
``/etc/shibboleth/shibboleth2.xml`` 
344

    
345
.. code-block:: xml
346

    
347
    <!-- The ApplicationDefaults element is where most of Shibboleth's SAML bits are defined. -->
348
    <ApplicationDefaults entityID="https://sp.example.org/shibboleth" REMOTE_USER="eppn">
349

    
350
Otherwise, if ``EPPN`` doesn't suit the requirements for your ``SP``
351
deployment, change the ``REMOTE_USER`` attribute as required e.g.:
352

    
353
.. code-block:: xml
354

    
355
    <!-- The ApplicationDefaults element is where most of Shibboleth's SAML bits are defined. -->
356
    <ApplicationDefaults entityID="https://sp.example.org/shibboleth" REMOTE_USER="persistent-nameid persistent-id targeted-id">
357

    
358
and restart the ``shibd`` service:
359

    
360
.. code-block:: console
361

    
362
  $ service shibd restart
363

    
364
**Note** that every time you alter the ``REMOTE_USER`` attribute, all existing
365
shibboleth enabled Astakos users will be invalidated and no longer be able to
366
login to their existing account using shibboleth. Specifically, for the case of
367
switching from *eppn* to another attribute, Astakos is able to prevent
368
invalidation and automatically migrate existing *eppn* accounts. In order to do
369
that, set the ``ASTAKOS_SHIBBOLETH_MIGRATE_EPPN`` setting to ``True`` in
370
``20-snf-astakos-app-settings.conf`` configuration file. Now every time an
371
existing *eppn* user logs in using shibboleth, Astakos will update the
372
associated *eppn* identifier to the contents of the ``REMOTE_USER`` header.
373

    
374
.. warning::
375
  
376
  IdPs should keep releasing the ``EPPN`` attribute in order for the migration
377
  to work.
378

    
379

    
380
3. Create floating IP pools
381
===========================
382

    
383
Synnefo v0.15 introduces floating IPs, which are public IPv4 addresses that can
384
be dynamically added/removed to/from VMs and are quotable via the
385
``cyclades.floating_ip`` resource. Connecting a VM to a public network is only
386
allowed if the user has first allocated a floating IP from this network.
387

    
388
Floating IPs are created from networks that are marked as Floating IP pools.
389
Creation of floating IP pools is done with the `snf-manage network-create`
390
command using the `--floating-ip-pool` option.
391

    
392
Existing networks can be converted to floating IPs using `network-modify`
393
command:
394

    
395
.. code-block:: console
396

    
397
  snf-manage network-modify --floating-ip-pool=True <network_ID>
398

    
399
Already allocated public IPv4 addresses are not automatically converted to
400
floating IPs. Existing VMs can keep their IPv4 addresses which will be
401
automatically released when these VMs get destroyed. If the admin wants to
402
convert existing public IPs to floating IPs, he/she can do so by running the
403
following provided tool:
404

    
405
.. code-block:: console
406

    
407
 cyclades.host$ /usr/lib/synnefo/tools/update_to_floating_ips
408

    
409
or just for one network:
410

    
411
.. code-block:: console
412

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

    
415

    
416
4. Register services and resources
417
==================================
418

    
419
4.1 Re-register service and resource definitions
420
------------------------------------------------
421

    
422
You will need to register again all Synnefo components, updating the
423
service and resource definitions. On the Astakos node, run::
424

    
425
    astakos-host$ snf-component-register
426

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

    
431
.. note::
432

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

    
437
The meaning of resources ``cyclades.cpu`` and ``cyclades.ram`` has changed in
438
v0.15: they now denote the number of CPUs/RAM of *active* VMs (VMs that are not
439
shutdown) rather than all VMs as happened until now. To represent total CPUs
440
and total RAM, as previously, two new resources ``cyclades.total_cpu`` and
441
``cyclades.total_ram`` are introduced. We now also control the usage of
442
floating IPs through the resource ``cyclades.floating_ip``.
443

    
444
4.2 Tweek resource settings
445
---------------------------
446

    
447
The new resources (``cyclades.total_cpu``, ``cyclades.total_ram``, and
448
``cyclades.floating_ip``) are registered with infinite default base quota
449
(meaning that they are not restricted at all). You will probably need to
450
restrict them, especially ``cyclades.floating_ip``. In order to change the
451
default limit of a resource for all *future* users, for instance restricting
452
floating IPs to 2, run::
453

    
454
    astakos-host$ snf-manage resource-modify cyclades.floating_ip --default-quota 2
455

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

    
460
    astakos-host$ snf-manage user-modify --all --base-quota cyclades.floating_ip 2 --exclude userid1,userid2
461

    
462
.. note::
463

    
464
   You can inspect base quota with ``snf-manage quota-list``, before applying
465
   any changes, for example::
466

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

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

    
473
Furthermore in v0.15, it is possible to control whether a resource is visible
474
to the users via the API or the Web UI. The default value for these options is
475
denoted inside the default resource definitions. Note that the system always
476
checks and enforces resource quota, regardless of their visibility. By default,
477
the new resources ``cyclades.total_cpu``, ``cyclades.total_ram`` and
478
``astakos.pending_app`` are not visible neither via the API nor via the Web UI.
479
You can change this behavior with::
480

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

    
483
4.3 Update the Quotaholder
484
--------------------------
485

    
486
To update quota for all new or modified Cyclades resources, bring up Astakos::
487

    
488
    astakos-host$ service gunicorn start
489

    
490
and run on the Cyclades node::
491

    
492
   cyclades-host$ snf-manage reconcile-resources-cyclades --fix --force
493

    
494

    
495
5. Bring all services up
496
========================
497

    
498
After the upgrade is finished, we bring up all services:
499

    
500
.. code-block:: console
501

    
502
    astakos.host  # service gunicorn start
503
    cyclades.host # service gunicorn start
504
    pithos.host   # service gunicorn start
505

    
506
    cyclades.host # service snf-dispatcher start