Bug 1730201

Summary: Octavia cascade delete fails in horizon
Product: Red Hat OpenStack Reporter: Phuong <pnguyen>
Component: openstack-octavia-uiAssignee: Assaf Muller <amuller>
Status: CLOSED DUPLICATE QA Contact: Bruna Bonguardo <bbonguar>
Severity: low Docs Contact:
Priority: low    
Version: 13.0 (Queens)CC: cgoncalves, ihrachys, lpeer, majopela, scohen
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-07-16 07:24:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Phuong 2019-07-16 07:20:52 UTC
Description of problem:

When a user is attempting to delete an Octavia load balancer from horizon, they receive the following error message:
"Error: Unable to delete Load Balancer:". It's a 500 error from octavia_dashboard: "delete_load_balancer() got an unexpected keyword argument 'cascade'"

This issue occurs because the openstacksdk version bundled in the horizon container is an older version, which does not support the cascade parameter for the Proxy.delete_load_balancer() method. 

Method in octavia_dashboard calling the proxy class for octavia for cascade delete in file /usr/lib/python2.7/site-packages/octavia_dashboard/api/rest/lbaasv2.py
   @rest_utils.ajax()
    def delete(self, request, loadbalancer_id):
        """Delete a specific load balancer.
        http://localhost/api/lbaas/loadbalancers/cc758c90-3d98-4ea1-af44-aab405c9c915
        """
        conn = _get_sdk_connection(request)
        conn.load_balancer.delete_load_balancer(loadbalancer_id,
                                                ignore_missing=True,
                                                cascade=True)

Target method performing actual delete in file /usr/lib/python2.7/site-packages/openstack/load_balancer/v2/_proxy.py
   def delete_load_balancer(self, load_balancer, ignore_missing=True):
        """Delete a load balancer
        :param load_balancer: The load_balancer can be either the name or a
            :class:`~openstack.load_balancer.v2.load_balancer.LoadBalancer`
            instance
        :param bool ignore_missing: When set to ``False``
            :class:`~openstack.exceptions.ResourceNotFound` will be raised when
            the load balancer does not exist.
            When set to ``True``, no exception will be set when attempting to
            delete a nonexistent load balancer.
        :returns: ``None``
        """
        return self._delete(_lb.LoadBalancer, load_balancer,
                            ignore_missing=ignore_missing)

Upstream has fixed this issue since version 0.13 (lines 58-76), which is to add the cascade parameter to that delete_load_balancer() method:
https://github.com/openstack/openstacksdk/blob/0.13.0/openstack/load_balancer/v2/_proxy.py

This bug was introduced as a result of the fix for this BZ:
https://bugzilla.redhat.com/show_bug.cgi?id=1623540
                                    
Please port fix from upstream 0.13 of openstacksdk or update openstacksdk version to use at least 0.13.

Version-Release number of selected component (if applicable):
Red Hat OpenStack Platform release 13.0.6 (Queens)
openstack-octavia-ui-1.0.1-4.el7ost.noarch
python2-openstacksdk-0.11.3-2.el7ost.noarch

The affected overcloud containers are:
https://registry.redhat.io/rhosp13/openstack-horizon:13.0-71.1557945103

How reproducible:
100%

Steps to Reproduce:
1. Create an Octavia load balancer with listener, pool and members from either the openstack CLI or horizon
2. Delete an Octavia load balancer from horizon, selecting the option to enable cascade delete
                                    
Actual results:
"Error: Unable to delete Load Balancer:". It's a 500 error from octavia_dashboard: "delete_load_balancer() got an unexpected keyword argument 'cascade'"

Expected results:
Load balancer successfully deleted from horizon

Additional info:
The Octavia REST api appears to have the cascade option implemented. The issue is with the old openstacksdk version installed in the container. The error does not occur when using the python2-octaviaclient CLI.

Comment 1 Carlos Goncalves 2019-07-16 07:24:25 UTC
Thank you for the detailed report. This is a duplicate of BZ #1719576.

*** This bug has been marked as a duplicate of bug 1719576 ***