Octavia fails to create a loadbalancer when just getting the VIP port

Bug #1709922 reported by Antoni Segura Puimedon
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
octavia
Fix Released
Critical
Michael Johnson

Bug Description

Octavia v2 API states that:

"There are three ways to specify a Virtual IP (VIP) network for the load balancer: provide a vip_port_id, supply a vip_subnet_id, or provide a vip_network_id. Providing a neutron port ID for the vip_port_id tells octavia to use this port for the VIP. Some port settings may be changed or removed as required by octavia, but the IP address will be retained. Specifying a neutron subnet ID will tell octavia to create a neutron port on this subnet and allocate an IP address from the subnet if the vip_address was not specified. If vip_address was specified, octavia will attempt to allocate the vip_address from the subnet for the VIP address. Finally, when a vip_network_ip is specified octavia will select a subnet from the network, preferring IPv4 over IPv6 subnets."

Above you can see that specifying only the vip port should be sufficient. However, octavia raises an exception when that happens

Steps to reproduce:
1. Create a net and subnet:
$ buggy_net=$(openstack network create buggy -f value -c id)
$ openstack subnet create --network "$buggy_net" --no-dhcp --gateway 10.0.255.254 --ip-version 4 --allocation-pool start=10.0.64.0,end=10.0.255.253 --subnet-range 10.0.0.0/16 subbuggy
2. Create a port for the VIP
$ vip_port=$(openstack port create --network "$buggy_net" --fixed-ip ip-address=10.0.0.1 k8s_service_vip -f value -c id)
3. Create the load balancer
$ openstack loadbalancer create --vip-port-id "$vip_port" --name all_pool_test_lb

Expected result:

The loadbalancer ends up with 10.0.0.1 as its vip

Actual result:

The loadbalancer fails to create and the following ends up in the journal:

Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server Traceback (most recent call last):
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 160, in _process_incoming
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server res = self.dispatcher.dispatch(message)
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 213, in dispatch
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server return self._do_dispatch(endpoint, method, ctxt, args)
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 183, in _do_dispatch
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server result = func(ctxt, **new_args)
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server File "/opt/stack/octavia/octavia/controller/queue/endpoint.py", line 44, in create_load_balancer
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server self.worker.create_load_balancer(load_balancer_id)
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server File "/opt/stack/octavia/octavia/controller/worker/controller_worker.py", line 283, in create_load_balancer
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server create_lb_tf.run()
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/taskflow/engines/action_engine/engine.py", line 247, in run
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server for _state in self.run_iter(timeout=timeout):
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/taskflow/engines/action_engine/engine.py", line 340, in run_iter
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server failure.Failure.reraise_if_any(er_failures)
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/taskflow/types/failure.py", line 336, in reraise_if_any
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server failures[0].reraise()
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/taskflow/types/failure.py", line 343, in reraise
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server six.reraise(*self._exc_info)
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/taskflow/engines/action_engine/executor.py", line 53, in _execute_task
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server result = task.execute(**arguments)
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server File "/opt/stack/octavia/octavia/controller/worker/tasks/network_tasks.py", line 324, in execute
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server return self.network_driver.allocate_vip(loadbalancer)
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server File "/opt/stack/octavia/octavia/network/drivers/neutron/allowed_address_pairs.py", line 335, in allocate_vip
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server return self._port_to_vip(port, load_balancer)
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server File "/opt/stack/octavia/octavia/network/drivers/neutron/base.py", line 75, in _port_to_vip
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server return data_models.Vip(ip_address=fixed_ip.ip_address,
Aug 10 14:39:39 ost-controller.novalocal octavia-worker[18967]: 2017-08-10 14:39:39.244 19604 ERROR oslo_messaging.rpc.server AttributeError: 'NoneType' object has no attribute 'ip_address'

Revision history for this message
Antoni Segura Puimedon (celebdor) wrote :

The problem as far as I can see, is that in https://github.com/openstack/octavia/blob/master/octavia/network/drivers/neutron/base.py#L71-L80

It assumes that the LB object has a subnet_id specified. This obviously will not be the case when one can choose to create the LB with just the port, just the net or just the subnet. Thus, when there's no break it should gather the subnet id for the VIP data model in another way

Changed in octavia:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Michael Johnson (johnsom)
importance: High → Critical
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to octavia (master)

Fix proposed to branch: master
Review: https://review.openstack.org/492649

Changed in octavia:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to octavia (master)

Reviewed: https://review.openstack.org/492649
Committed: https://git.openstack.org/cgit/openstack/octavia/commit/?id=7c986df83d3eb09d210778c4f30b20eeb23a4edf
Submitter: Jenkins
Branch: master

commit 7c986df83d3eb09d210778c4f30b20eeb23a4edf
Author: Michael Johnson <email address hidden>
Date: Thu Aug 10 11:49:10 2017 -0700

    Fix LB creation with VIP port

    Octavia v2 API was failing to create the load balancer when the user
    specified a VIP port ID.
    This also improves the user experience when specifying a VIP address.
    It also removes the un-used nova_network directory.

    Change-Id: I8b533094df1e5425f824fff0454335709ce05447
    Closes-Bug: #1709922

Changed in octavia:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/octavia 1.0.0.0rc1

This issue was fixed in the openstack/octavia 1.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.