From 0f4a5e21709c77c926cbbf7929217fa951b48ad7 Mon Sep 17 00:00:00 2001 From: German Eichberger Date: Wed, 29 Nov 2017 09:45:49 -0800 Subject: [PATCH] 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 --- octavia/network/drivers/neutron/allowed_address_pairs.py | 3 ++- .../drivers/neutron/test_allowed_address_pairs.py | 4 +++- .../notes/vip-port-project-id-bbb26b657b08365e.yaml | 9 +++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/vip-port-project-id-bbb26b657b08365e.yaml diff --git a/octavia/network/drivers/neutron/allowed_address_pairs.py b/octavia/network/drivers/neutron/allowed_address_pairs.py index fb312bafbc..66042c5b1d 100644 --- a/octavia/network/drivers/neutron/allowed_address_pairs.py +++ b/octavia/network/drivers/neutron/allowed_address_pairs.py @@ -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] diff --git a/octavia/tests/unit/network/drivers/neutron/test_allowed_address_pairs.py b/octavia/tests/unit/network/drivers/neutron/test_allowed_address_pairs.py index 0e29f5758c..ba93dbc2b3 100644 --- a/octavia/tests/unit/network/drivers/neutron/test_allowed_address_pairs.py +++ b/octavia/tests/unit/network/drivers/neutron/test_allowed_address_pairs.py @@ -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}] } } diff --git a/releasenotes/notes/vip-port-project-id-bbb26b657b08365e.yaml b/releasenotes/notes/vip-port-project-id-bbb26b657b08365e.yaml new file mode 100644 index 0000000000..1b2711d7a6 --- /dev/null +++ b/releasenotes/notes/vip-port-project-id-bbb26b657b08365e.yaml @@ -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.