Adds the user's project id to the VIP port creation

This brings Octavia in line with what n-lbaas does for VIP port and
allows a user to attach a FIP to the VIP port generated by Octavia.

Change-Id: Ib7e6374cad49a16a733dacb2ea1ca096d8c4e6e4
This commit is contained in:
German Eichberger 2017-11-29 09:45:49 -08:00
parent 62c398c5cb
commit 0f4a5e2170
3 changed files with 14 additions and 2 deletions

View File

@ -363,7 +363,8 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
'network_id': load_balancer.vip.network_id,
'admin_state_up': False,
'device_id': 'lb-{0}'.format(load_balancer.id),
'device_owner': OCTAVIA_OWNER}}
'device_owner': OCTAVIA_OWNER,
'project_id': load_balancer.project_id}}
if fixed_ip:
port['port']['fixed_ips'] = [fixed_ip]

View File

@ -418,7 +418,8 @@ class TestAllowedAddressPairsDriver(base.TestCase):
}}
fake_lb_vip = data_models.Vip(subnet_id=t_constants.MOCK_SUBNET_ID,
network_id=t_constants.MOCK_NETWORK_ID)
fake_lb = data_models.LoadBalancer(id='1', vip=fake_lb_vip)
fake_lb = data_models.LoadBalancer(id='1', vip=fake_lb_vip,
project_id='test-project')
vip = self.driver.allocate_vip(fake_lb)
exp_create_port_call = {
'port': {
@ -427,6 +428,7 @@ class TestAllowedAddressPairsDriver(base.TestCase):
'device_id': 'lb-1',
'device_owner': allowed_address_pairs.OCTAVIA_OWNER,
'admin_state_up': False,
'project_id': 'test-project',
'fixed_ips': [{'subnet_id': t_constants.MOCK_SUBNET_ID}]
}
}

View File

@ -0,0 +1,9 @@
---
fixes:
- |
Neutron LBaaS was assigning the VIP port it created the user's project-id,
thus allowing the user to attach Floating-IPs to the VIP port. Octavia,
on the other hand, was assigning the Octavia project-id to the port, making
it impossible for the user to attach a Floating IP. This patch brings
Octavia's behavior in line with Neutron LBaaS and assigns the user's
project-id to the VIP port created by Octavia.