Fake libvirtError incompatibile with real libvirtError

Bug #1305186 reported by Rick Harris
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Rick Harris
Icehouse
Fix Released
Undecided
Unassigned
neutron
Invalid
Undecided
Unassigned

Bug Description

PROBLEM

The existing `fakelibvirt.libvirtError` is actually not compatible with the real `libvirt.libvirtError` class in that it accepts different kwargs in the `__init__`.

This is a problem because test code may use either class depending on whether `libvirt-python` happens to be installed on the box.

For example, if `libvirt-python` is installed on the box and you try to use `libvirtError` class from a test with the `error_code` kwarg, you'll get this exception: http://paste.openstack.org/show/75432/

This code would work on a machine that doesn't have `libvirt-python` installed b/c `fakelibvirt.libvirtError` was used.

POSSIBLE SOLUTION

Copy over the real `libvirt.libvirtError` class so that it matches exactly.

Create a `make_libvirtError` convenience function so we can still create `libvirtErrors` using the nice `error_code` kwarg in the constructor (b/c 99% of the time that's what we want).

Changed in neutron:
assignee: nobody → Rick Harris (rconradharris)
status: New → In Progress
Revision history for this message
Matt Riedemann (mriedem) wrote :

I think you meant to report this against nova, not neutron.

tags: added: libvirt testing
Changed in nova:
status: New → In Progress
assignee: nobody → Rick Harris (rconradharris)
Changed in neutron:
assignee: Rick Harris (rconradharris) → nobody
Revision history for this message
Matt Riedemann (mriedem) wrote :
Revision history for this message
Rick Harris (rconradharris) wrote :

Ha, you're right; omnibar must have autocompleted to Neutron before Nova, and I didn't notice. Sorry about that! :-)

Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/86396
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=78156a7650237bd4875fbbf9cad8db87348f333f
Submitter: Jenkins
Branch: master

commit 78156a7650237bd4875fbbf9cad8db87348f333f
Author: Rick Harris <email address hidden>
Date: Wed Apr 9 11:56:06 2014 -0500

    libvirt: Make `fakelibvirt.libvirtError` match

    When test code uses `libvirtError`, it may refer to
    `libvirt.libvirtError` or `fakelibvirt.libvirtError` depending on
    whether `libvirt-python` is installed.

    The existing code had incompatible `__init__` singatures between the
    two, meaning that a test could pass locally but fail when run on
    Jenkins.

    The solution is to make `fakelibvirt.libvirtError` match libvirt 1.2.3
    exactly.

    A convenience function, `make_libvirtError`, is introduced so that
    exceptions can still be created in one shot.

    Change-Id: I5aaecc57504c4aea3c049610ef188978c25cfdc4
    Closes-Bug: 1305186

Changed in nova:
status: In Progress → Fix Committed
Changed in neutron:
status: In Progress → Won't Fix
status: Won't Fix → Invalid
Thierry Carrez (ttx)
Changed in nova:
milestone: none → juno-1
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/icehouse)

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/124918

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/icehouse)

Reviewed: https://review.openstack.org/124918
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=df9ead9af4fbcc3f4b4220c29666fd0addd2b263
Submitter: Jenkins
Branch: stable/icehouse

commit df9ead9af4fbcc3f4b4220c29666fd0addd2b263
Author: Rick Harris <email address hidden>
Date: Wed Apr 9 11:56:06 2014 -0500

    libvirt: Make `fakelibvirt.libvirtError` match

    When test code uses `libvirtError`, it may refer to
    `libvirt.libvirtError` or `fakelibvirt.libvirtError` depending on
    whether `libvirt-python` is installed.

    The existing code had incompatible `__init__` singatures between the
    two, meaning that a test could pass locally but fail when run on
    Jenkins.

    The solution is to make `fakelibvirt.libvirtError` match libvirt 1.2.3
    exactly.

    A convenience function, `make_libvirtError`, is introduced so that
    exceptions can still be created in one shot.

    Change-Id: I5aaecc57504c4aea3c049610ef188978c25cfdc4
    Closes-Bug: 1305186
    (cherry picked from commit 78156a7650237bd4875fbbf9cad8db87348f333f)

tags: added: in-stable-icehouse
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-1 → 2014.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.