~ubuntu-cloud-archive/ubuntu/precise/nova/trunk

« back to all changes in this revision

Viewing changes to nova/network/quantum/nova_ipam_lib.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandelman
  • Date: 2012-06-22 12:39:57 UTC
  • mfrom: (1.1.57)
  • Revision ID: package-import@ubuntu.com-20120622123957-hbzwg84nt9rqwg8r
Tags: 2012.2~f2~20120621.14517-0ubuntu1
[ Chuck Short ]
* New upstream version.

[ Adam Gandelman ]
* debian/rules: Temporarily disable test suite while blocking
  tests are investigated. 
* debian/patches/kombu_tests_timeout.patch: Dropped.

Show diffs side-by-side

added added

removed removed

Lines of Context:
228
228
        # - otherwise, _disassociate_stale_fixed_ips is called periodically
229
229
        #   to disassociate all fixed ips that are unallocated
230
230
        #   but still associated with an instance-id.
 
231
 
 
232
        read_deleted_context = admin_context.elevated(read_deleted='yes')
231
233
        for fixed_ip in fixed_ips:
232
234
            db.fixed_ip_update(admin_context, fixed_ip['address'],
233
235
                               {'allocated': False,
234
236
                                'virtual_interface_id': None})
 
237
            fixed_id = fixed_ip['id']
 
238
            floating_ips = self.net_manager.db.floating_ip_get_by_fixed_ip_id(
 
239
                                admin_context,
 
240
                                fixed_id)
 
241
            # disassociate floating ips related to fixed_ip
 
242
            for floating_ip in floating_ips:
 
243
                address = floating_ip['address']
 
244
                manager.FloatingIP.disassociate_floating_ip(
 
245
                    self.net_manager,
 
246
                    read_deleted_context,
 
247
                    address,
 
248
                    affect_auto_assigned=True)
 
249
                # deallocate if auto_assigned
 
250
                if floating_ip['auto_assigned']:
 
251
                    manager.FloatingIP.deallocate_floating_ip(
 
252
                        read_deleted_context,
 
253
                        address,
 
254
                        affect_auto_assigned=True)
 
255
 
235
256
        if len(fixed_ips) == 0:
236
257
            LOG.error(_('No fixed IPs to deallocate for vif %s'),
237
258
                      vif_ref['id'])