Revision 0136e854

b/docs/upgrade/upgrade-0.15.rst
46 46

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

  
49
3. Register services and resources.
49
3. Create floating IP pools
50 50

  
51
4. Bring up all services.
51
4. Register services and resources.
52

  
53
5. Bring up all services.
52 54

  
53 55
.. warning::
54 56

  
......
158 160
For Pithos service we have to change the ``20-snf-pithos-app-settings.conf``
159 161
file in the same way as above.
160 162

  
161
3. Register services and resources
163

  
164
3. Create floating IP pools
165
===========================
166

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

  
172
Floating IPs are created from networks that are marked as Floating IP pools.
173
Creation of floating IP pools is done with the `snf-manage network-create`
174
command using the `--floating-ip-pool` option.
175

  
176
Existing networks can be converted to floating IPs using `network-modify`
177
command:
178

  
179
.. code-block:: console
180

  
181
  snf-manage network-modify --floating-ip-pool=True <network_ID>
182

  
183
Already allocated public IPv4 addresses are not automatically converted to
184
floating IPs. Existing VMs can keep their IPv4 addresses which will be
185
automatically be released when these VMs will be destroyed. In order to
186
convert existing public IPs to floating IPs run the following command:
187

  
188
.. code-block:: console
189

  
190
 cyclades.host$ /usr/lib/synnefo/tools/update_to_floating_ips
191

  
192
or for just one network:
193

  
194
.. code-block:: console
195

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

  
198
4. Register services and resources
162 199
==================================
163 200

  
164
3.1 Re-register service and resource definitions
201
4.1 Re-register service and resource definitions
165 202
------------------------------------------------
166 203

  
167 204
You will need to register again all Synnefo components, updating the
......
186 223
introduced. We now also control the usage of floating IPs through resource
187 224
``cyclades.floating_ip``.
188 225

  
189
3.2 Tweek resource settings
226
4.2 Tweek resource settings
190 227
---------------------------
191 228

  
192 229
New resources (``cyclades.total_cpu``, ``cyclades.total_ram``, and
......
222 259

  
223 260
    astakos-host$ snf-manage resource-modify <resource> --api-visible=True (or --ui-visible=True)
224 261

  
225
3.3 Update the Quotaholder
262
4.3 Update the Quotaholder
226 263
--------------------------
227 264

  
228 265
To update quota for all new or modified Cyclades resources, bring up Astakos::
......
233 270

  
234 271
   cyclades-host$ snf-manage reconcile-resources-cyclades --fix --force
235 272

  
236
4. Bring all services up
273

  
274
5. Bring all services up
237 275
========================
238 276

  
239 277
After the upgrade is finished, we bring up all services:
b/snf-cyclades-app/synnefo/tools/update_to_floating_ips
1
#!/usr/bin/env python
2
"""Tool to convert public IPv4 addresses to floatign IPs, which may be needed
3
for update to Synnefo v0.15.
4

  
5
"""
6

  
7
import sys
8
import logging
9
from optparse import OptionParser, TitledHelpFormatter
10

  
11
# Configure Django env
12
from synnefo import settings
13
from django.core.management import setup_environ
14
setup_environ(settings)
15

  
16
from synnefo.management.common import get_network
17
from synnefo.db.models import IPAddress
18
from django.db import transaction
19

  
20
logger = logging.getLogger("update_floating_ips")
21
handler = logging.StreamHandler()
22

  
23
formatter = logging.Formatter("[%(levelname)s] %(message)s")
24
handler.setFormatter(formatter)
25
logger.setLevel(logging.INFO)
26
logger.addHandler(handler)
27
logger.propagate = False
28

  
29
DESCRIPTION = """Tool to convert public IPv4 addresses to floating IPs."""
30

  
31

  
32
@transaction.commit_on_success
33
def main():
34
    parser = OptionParser(description=DESCRIPTION,
35
                          formatter=TitledHelpFormatter())
36
    parser.add_option("--network-id", dest="network_id", default=None,
37
                      help="Update addresses only of this network."),
38
    parser.add_option("--dry-run", dest="dry_run", default=False,
39
                      action="store_true",
40
                      help="Dry-run mode.")
41
    parser.add_option("-d", "--debug", dest="debug", default=False,
42
                      action="store_true",
43
                      help="Display debug information.")
44
    options, args = parser.parse_args()
45

  
46
    if options.debug:
47
        logger.setLevel(logging.DEBUG)
48

  
49
    public_ips = IPAddress.objects.filter(network__public=True,
50
                                          floating_ip=False)
51
    if options.network_id is not None:
52
        network = get_network(options.network_id)
53
        logger.debug("Converting IPs only of network %s" % network.id)
54
        public_ips = public_ips.filter(network=network)
55

  
56
    logger.info("Converting %d public IPv4 addresses to floating IPs.",
57
                public_ips.count())
58

  
59
    if not public_ips:
60
        logger.info("No public IPs to convert.")
61
        return
62

  
63
    if options.debug:
64
        addresses = public_ips.values_list("address", flat=True)
65
        logger.debug("Converting the following public IPs:\n%s",
66
                     "\n".join(addresses))
67

  
68
    if not options.dry_run:
69
        public_ips.update(floating_ip=True)
70

  
71
    logger.info("Successfully updated public addresses to floating IPs.")
72
    return
73

  
74

  
75
if __name__ == "__main__":
76
    main()
77
    sys.exit(0)

Also available in: Unified diff