~ubuntu-branches/ubuntu/saucy/nova/saucy-proposed

« 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
  • Date: 2012-05-24 13:12:53 UTC
  • mfrom: (1.1.55)
  • Revision ID: package-import@ubuntu.com-20120524131253-ommql08fg1en06ut
Tags: 2012.2~f1-0ubuntu1
* New upstream release.
* Prepare for quantal:
  - Dropped debian/patches/upstream/0006-Use-project_id-in-ec2.cloud._format_image.patch
  - Dropped debian/patches/upstream/0005-Populate-image-properties-with-project_id-again.patch
  - Dropped debian/patches/upstream/0004-Fixed-bug-962840-added-a-test-case.patch
  - Dropped debian/patches/upstream/0003-Allow-unprivileged-RADOS-users-to-access-rbd-volumes.patch
  - Dropped debian/patches/upstream/0002-Stop-libvirt-test-from-deleting-instances-dir.patch
  - Dropped debian/patches/upstream/0001-fix-bug-where-nova-ignores-glance-host-in-imageref.patch 
  - Dropped debian/patches/0001-fix-useexisting-deprecation-warnings.patch
* debian/control: Add python-keystone as a dependency. (LP: #907197)
* debian/patches/kombu_tests_timeout.patch: Refreshed.
* debian/nova.conf, debian/nova-common.postinst: Convert to new ini
  file configuration
* debian/patches/nova-manage_flagfile_location.patch: Refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
        """
48
48
        self.net_manager = net_manager
49
49
 
 
50
        # NOTE(s0mik) : If DHCP is not in use, we need to timeout IPs
 
51
        # periodically.  See comment in deallocate_ips_by_vif for more
 
52
        self.net_manager.timeout_fixed_ips = not self.net_manager.DHCP
 
53
 
50
54
    def create_subnet(self, context, label, tenant_id,
51
55
                      quantum_net_id, priority, cidr=None,
52
56
                      gateway=None, gateway_v6=None, cidr_v6=None,
213
217
        admin_context = context.elevated()
214
218
        fixed_ips = db.fixed_ips_by_virtual_interface(admin_context,
215
219
                                                         vif_ref['id'])
 
220
        # NOTE(s0mik): Sets fixed-ip to deallocated, but leaves the entry
 
221
        # associated with the instance-id.  This prevents us from handing it
 
222
        # out again immediately, as allocating it to a new instance before
 
223
        # a DHCP lease has timed-out is bad.  Instead, the fixed-ip will
 
224
        # be disassociated with the instance-id by a call to one of two
 
225
        # methods inherited from FlatManager:
 
226
        # - if DHCP is in use, a lease expiring in dnsmasq triggers
 
227
        #   a call to release_fixed_ip in the network manager.
 
228
        # - otherwise, _disassociate_stale_fixed_ips is called periodically
 
229
        #   to disassociate all fixed ips that are unallocated
 
230
        #   but still associated with an instance-id.
216
231
        for fixed_ip in fixed_ips:
217
232
            db.fixed_ip_update(admin_context, fixed_ip['address'],
218
233
                               {'allocated': False,
219
234
                                'virtual_interface_id': None})
220
235
        if len(fixed_ips) == 0:
221
 
            LOG.error(_('No fixed IPs to deallocate for vif %s') %
 
236
            LOG.error(_('No fixed IPs to deallocate for vif %s'),
222
237
                      vif_ref['id'])
223
238
 
224
239
    def get_allocated_ips(self, context, subnet_id, project_id):