Exception message muted in quantum/db/l3_db.py

Bug #1075089 reported by Zhongyue Luo
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Robert Pothier

Bug Description

The message in the BadRequest exception raised in line 557 is being muted in the logfile by line 575 since the BadRequest is catched and writes its own log message.

A InvalidExternalNetwork exception should be defined and it should be catched in the try-catch statement.

        try:
            with context.session.begin(subtransactions=True):
                # This external port is never exposed to the tenant.
                # it is used purely for internal system and admin use when
                # managing floating IPs.
                external_port = self.create_port(context.elevated(), {
                    'port':
                    {'tenant_id': '', # tenant intentionally not set
                     'network_id': f_net_id,
                     'mac_address': attributes.ATTR_NOT_SPECIFIED,
                     'fixed_ips': attributes.ATTR_NOT_SPECIFIED,
                     'admin_state_up': True,
                     'device_id': fip_id,
                     'device_owner': DEVICE_OWNER_FLOATINGIP,
                     'name': ''}})
                # Ensure IP addresses are allocated on external port
                if not external_port['fixed_ips']:
                    msg = "Unable to find any IP address on external network"
                    raise q_exc.BadRequest(resource='floatingip', msg=msg) <----- raised

                floating_fixed_ip = external_port['fixed_ips'][0]
                floating_ip_address = floating_fixed_ip['ip_address']
                floatingip_db = FloatingIP(
                    id=fip_id,
                    tenant_id=tenant_id,
                    floating_network_id=fip['floating_network_id'],
                    floating_ip_address=floating_ip_address,
                    floating_port_id=external_port['id'])
                fip['tenant_id'] = tenant_id
                # Update association with internal port
                # and define external IP address
                self._update_fip_assoc(context, fip,
                                       floatingip_db, external_port)
                context.session.add(floatingip_db)
        # TODO(salvatore-orlando): Avoid broad catch
        # Maybe by introducing base class for L3 exceptions
        except q_exc.BadRequest: <----------------------------------------------- caught
            LOG.exception("Unable to create Floating ip due to a "
                          "malformed request")
            raise
        except Exception:
            LOG.exception("Floating IP association failed")
            raise

Tags: l3-ipam-dhcp
Zhongyue Luo (zyluo)
description: updated
Revision history for this message
yong sheng gong (gongysh) wrote :

can u paste the related lines out here?

Gary Kotton (garyk)
Changed in quantum:
status: New → Incomplete
Zhongyue Luo (zyluo)
description: updated
description: updated
Changed in quantum:
status: Incomplete → New
dan wendlandt (danwent)
Changed in quantum:
status: New → Confirmed
importance: Undecided → Low
Changed in quantum:
assignee: nobody → Abishek Subramanian (absubram)
Changed in quantum:
assignee: Abishek Subramanian (absubram) → Robert Pothier (rpothier)
tags: added: l3-ipam-dhcp
Changed in quantum:
status: Confirmed → In Progress
Zhongyue Luo (zyluo)
Changed in quantum:
status: In Progress → New
status: New → Confirmed
Revision history for this message
Zhongyue Luo (zyluo) wrote :
Changed in quantum:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to quantum (master)

Reviewed: https://review.openstack.org/23921
Committed: http://github.com/openstack/quantum/commit/d735ccaf2c99c66ed050cd7cfa44c3e73bc7d8ab
Submitter: Jenkins
Branch: master

commit d735ccaf2c99c66ed050cd7cfa44c3e73bc7d8ab
Author: Robert Pothier <email address hidden>
Date: Thu Mar 7 16:43:54 2013 -0500

    Add InvalidExternalNetwork exception to display correct error

    Fixes bug 1075089

    The message in the BadRequest exception raised in file
    quantum/tests/unit/test_l3_plugin.py is
    being muted in the logfile since the BadRequest is
    catched and writes its own log message.

    Change-Id: Ia0140620205a80dd4b3637b2d41562adb7992b5c

Changed in quantum:
status: In Progress → Fix Committed
Changed in quantum:
milestone: none → havana-2
Thierry Carrez (ttx)
Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: havana-2 → 2013.2
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.