Statistics
| Branch: | Tag: | Revision:

root / docs / upgrade / upgrade-0.15.rst @ 6f65ba13

History | View | Annotate | Download (20.1 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 <redirect_uri>
232

    
233
The redirect_uri should be the ``PITHOS_BASE_URL`` plus the ``/ui/view``
234
suffix, for example::
235

    
236
    https://node2.example.com/pithos/ui/view
237

    
238
You can see the registered clients by running::
239

    
240
    astakos-host$ snf-manage oauth2-client-list -o id,name,redirect_urls,is_trusted
241

    
242
Finally, you will have to add the registered `client_id` and `client_secret` to
243
the ``PITHOS_OAUTH2_CLIENT_CREDENTIALS`` setting in
244
``/etc/synnefo/20-snf-pithos-app-settings.conf``.
245

    
246

    
247
2.5 Upgrade vncauthproxy and configure snf-cyclades-app
248
-------------------------------------------------------
249

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

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

    
259
To manage the authentication file, you can use the ``vncauthproxy-passwd`` tool,
260
to easily add, update and delete users.
261

    
262
To add a user:
263

    
264
.. code-block:: console
265

    
266
    # vncauthproxy-passwd /var/lib/vncauthproxy/users synnefo
267

    
268
You will be prompted for a password.
269

    
270
You should also configure the new ``CYCLADES_VNCAUTHPROXY_OPTS`` setting in
271
``snf-cyclades-app``, to provide the user and password configured for
272
``synnefo`` in the vncauthproxy authentication file and enable SSL support if
273
snf-vncauthproxy is configured to run with SSL enabled for the control socket.
274

    
275
.. warning:: The vncauthproxy daemon requires a restart for the changes in the
276
 authentication file to take effect.
277

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

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

    
291
Check the `documentation
292
<http://www.synnefo.org/docs/snf-vncauthproxy/latest/index.html>`_ of
293
snf-vncauthproxy for more information on upgrading to version 1.5.
294

    
295
2.6 Stats configuration
296
-----------------------
297

    
298
snf-cyclades-gtools comes with a collectd plugin to collect CPU and network
299
stats for Ganeti VMs and an example collectd configuration. snf-stats-app is a
300
Django (snf-webproject) app that serves the VM stats graphs by reading the VM
301
stats (from RRD files).
302

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

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

    
314
If you were using a previous version of snf-stats-app, you should also make
315
sure to set the ``STATS_BASE_URL`` setting in ``20-snf-stats-app-settings.conf``
316
to match your deployment and change the graph URL settings in
317
``20-snf-cyclades-app-api.conf`` accordingly.
318

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

    
327
2.7 Shibboleth configuration updates
328
------------------------------------
329

    
330
.. note::
331

    
332
  Skip this step unless you have ``shibboleth`` enabled in Astakos
333
  ``IM_MODULES`` setting.
334

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

    
345
If ``EPPN`` matches the service provider needs and you want to continue using
346
it as the unique identifier, you need to ensure that the ``REMOTE_USER``
347
attribute is set to ``eppn`` in the ``mod_shib2`` config file located at
348
``/etc/shibboleth/shibboleth2.xml`` 
349

    
350
.. code-block:: xml
351

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

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

    
358
.. code-block:: xml
359

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

    
363
and restart the ``shibd`` service:
364

    
365
.. code-block:: console
366

    
367
  $ service shibd restart
368

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

    
379
.. warning::
380
  
381
  IdPs should keep releasing the ``EPPN`` attribute in order for the migration
382
  to work.
383

    
384

    
385
3. Create floating IP pools
386
===========================
387

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

    
393
Floating IPs are created from networks that are marked as Floating IP pools.
394
Creation of floating IP pools is done with the `snf-manage network-create`
395
command using the `--floating-ip-pool` option.
396

    
397
Existing networks can be converted to floating IPs using `network-modify`
398
command:
399

    
400
.. code-block:: console
401

    
402
  snf-manage network-modify --floating-ip-pool=True <network_ID>
403

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

    
410
.. code-block:: console
411

    
412
 cyclades.host$ /usr/lib/synnefo/tools/update_to_floating_ips
413

    
414
or just for one network:
415

    
416
.. code-block:: console
417

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

    
420

    
421
4. Register services and resources
422
==================================
423

    
424
4.1 Re-register service and resource definitions
425
------------------------------------------------
426

    
427
You will need to register again all Synnefo components, updating the
428
service and resource definitions. On the Astakos node, run::
429

    
430
    astakos-host$ snf-component-register
431

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

    
436
.. note::
437

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

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

    
449
4.2 Tweek resource settings
450
---------------------------
451

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

    
459
    astakos-host$ snf-manage resource-modify cyclades.floating_ip --default-quota 2
460

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

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

    
467
.. note::
468

    
469
   You can inspect base quota with ``snf-manage quota-list``, before applying
470
   any changes, for example::
471

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

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

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

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

    
488
4.3 Update the Quotaholder
489
--------------------------
490

    
491
To update quota for all new or modified Cyclades resources, bring up Astakos::
492

    
493
    astakos-host$ service gunicorn start
494

    
495
and run on the Cyclades node::
496

    
497
   cyclades-host$ snf-manage reconcile-resources-cyclades --fix --force
498

    
499

    
500
5. Bring all services up
501
========================
502

    
503
After the upgrade is finished, we bring up all services:
504

    
505
.. code-block:: console
506

    
507
    astakos.host  # service gunicorn start
508
    cyclades.host # service gunicorn start
509
    pithos.host   # service gunicorn start
510

    
511
    cyclades.host # service snf-dispatcher start