Public bug reported: a net include two subnet,i use this net to create a port , it alway retrun a fixed ip of one subnet
code: def _try_generate_ip(context, subnets): """Generate an IP address. The IP address will be generated from one of the subnets defined on the network. """ range_qry = context.session.query( models_v2.IPAvailabilityRange).join( models_v2.IPAllocationPool).with_lockmode('update') for subnet in subnets: range = range_qry.filter_by(subnet_id=subnet['id']).first() if not range: LOG.debug(_("All IPs from subnet %(subnet_id)s (%(cidr)s) " "allocated"), {'subnet_id': subnet['id'], 'cidr': subnet['cidr']}) continue ip_address = range['first_ip'] LOG.debug(_("Allocated IP - %(ip_address)s from %(first_ip)s " "to %(last_ip)s"), {'ip_address': ip_address, 'first_ip': range['first_ip'], 'last_ip': range['last_ip']}) if range['first_ip'] == range['last_ip']: # No more free indices on subnet => delete LOG.debug(_("No more free IP's in slice. Deleting allocation " "pool.")) context.session.delete(range) else: # increment the first free range['first_ip'] = str(netaddr.IPAddress(ip_address) + 1) return {'ip_address': ip_address, 'subnet_id': subnet['id']} raise n_exc.IpAddressGenerationFailure(net_id=subnets[0]['network_id']) multiple subnets only return a ip ** Affects: neutron Importance: Undecided Status: New -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to neutron. https://bugs.launchpad.net/bugs/1364912 Title: why i get one fixed ip when use a net which has two subnet to create a port Status in OpenStack Neutron (virtual network service): New Bug description: a net include two subnet,i use this net to create a port , it alway retrun a fixed ip of one subnet code: def _try_generate_ip(context, subnets): """Generate an IP address. The IP address will be generated from one of the subnets defined on the network. """ range_qry = context.session.query( models_v2.IPAvailabilityRange).join( models_v2.IPAllocationPool).with_lockmode('update') for subnet in subnets: range = range_qry.filter_by(subnet_id=subnet['id']).first() if not range: LOG.debug(_("All IPs from subnet %(subnet_id)s (%(cidr)s) " "allocated"), {'subnet_id': subnet['id'], 'cidr': subnet['cidr']}) continue ip_address = range['first_ip'] LOG.debug(_("Allocated IP - %(ip_address)s from %(first_ip)s " "to %(last_ip)s"), {'ip_address': ip_address, 'first_ip': range['first_ip'], 'last_ip': range['last_ip']}) if range['first_ip'] == range['last_ip']: # No more free indices on subnet => delete LOG.debug(_("No more free IP's in slice. Deleting allocation " "pool.")) context.session.delete(range) else: # increment the first free range['first_ip'] = str(netaddr.IPAddress(ip_address) + 1) return {'ip_address': ip_address, 'subnet_id': subnet['id']} raise n_exc.IpAddressGenerationFailure(net_id=subnets[0]['network_id']) multiple subnets only return a ip To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/1364912/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp