Hacking checks should prevent virt drivers accessing each other's code

Bug #1261842 reported by Daniel Berrange
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Unassigned

Bug Description

There have been 2 bugs where the bare metal driver is accessing libvirt private code

https://bugs.launchpad.net/nova/+bug/1261826
https://bugs.launchpad.net/nova/+bug/1261827

This kind of mistake could be prevented using a custom pep8 hacking rule for Nova.

Arguably the same could be said of other files outside the nova/virt directory - they shouldn't access private virt driver code directly - only go via the public virt driver API

Revision history for this message
Daniel Berrange (berrange) wrote :

Patch to implement a hacking rule addition. Not submitted to Gerrit, since we'd obviously require the bare metal driver bugs to be fixed before we can enforce this.

Revision history for this message
Gary Kotton (garyk) wrote :

+1 to this

Revision history for this message
Matt Riedemann (mriedem) wrote :

Tagged with 'baremetal' since this requires the baremetal driver to be cleaned up first.

tags: added: baremetal hacking
Changed in nova:
status: New → Triaged
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/69682
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=848ea5ff01638ddc25e9462860bca45e26cdd3fa
Submitter: Jenkins
Branch: master

commit 848ea5ff01638ddc25e9462860bca45e26cdd3fa
Author: Daniel P. Berrange <email address hidden>
Date: Tue Dec 17 17:20:48 2013 +0000

    Add hacking test to block cross-virt driver code usage

    The baremetal driver has been accessing some libvirt driver
    private classes and config variables. Any code that is intended
    to be shared across virt drivers should be in a common package
    instead. Add a hacking file to enforce this for imports and
    config options so that no further problems like this are made
    in the future.

    NB, this skips verification of the baremetal driver until
    bugs 1261826 and 1261827 are fixed, or the baremetal driver is
    removed, whichever comes first.

    Change-Id: Ifbfe597795795a847830f9bd937dc459cd37d118
    Closes-Bug: #1261842

Changed in nova:
status: Triaged → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

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

Reviewed: https://review.openstack.org/71523
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=1efa961e18935122e11cee5e81fee678aad60519
Submitter: Jenkins
Branch: master

commit 1efa961e18935122e11cee5e81fee678aad60519
Author: Daniel P. Berrange <email address hidden>
Date: Thu Feb 6 13:16:21 2014 +0000

    Improve detection of imports in hacking check

    The hacking check for detecting cross-virt driver imports
    only looked for 'from foo.bar import wizz' and not for
    'import foo.bar.wizz'. Add support for the latter too and
    test it.

    Change-Id: I79d804b49e4be9827c4a5c172ffb8712c15f4071
    Closes-Bug: #1261842

Changed in nova:
milestone: none → icehouse-3
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-3 → 2014.1
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.