Virt driver impls don't match ComputeDriver base class API

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

Bug Description

There are a number of problems where the virt driver impls do not match the API defined by the base ComputeDriver class.
For example

 - Libvirt: Adds 'SOFT' as default value for 'reboot' method but no other class does
 - XenAPI: set_admin_passwd takes 2 parameters but base class defines it with 3 parameters in a different order
 - VMWare: update_host_status method which doesn't exist in base class & is never called in entire codebase
 - All: names of parameters are not the same as names of parameters in the base class
 - ...more...

These inconsistencies are functional bugs in the worst, or misleading to maintainers in the best case. It should be possible to write a test using the python 'inspect' module which guarantees that the sub-class APis actually match what they claim to implement from the base class.

Changed in nova:
assignee: nobody → Daniel Berrange (berrange)
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/101876

Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to nova (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/101877

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Related fix proposed to branch: master
Review: https://review.openstack.org/101878

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Related fix proposed to branch: master
Review: https://review.openstack.org/101879

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Related fix proposed to branch: master
Review: https://review.openstack.org/101880

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Related fix proposed to branch: master
Review: https://review.openstack.org/101881

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/101882

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Mark McLoughlin (markmc)
Changed in nova:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/101876
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=9e630fb8e412755a9768cadc524f1fecec951052
Submitter: Jenkins
Branch: master

commit 9e630fb8e412755a9768cadc524f1fecec951052
Author: Daniel P. Berrange <email address hidden>
Date: Fri Jun 20 12:13:34 2014 +0100

    libvirt: remove unused 'get_disks' method

    The 'get_disks' method was a virt driver public API used by
    the old compute monitor class. This class was deleted in

      commit 07646e85841a4f7c81e80254ac63715bece2aadd
      Author: Brian Waldon <email address hidden>
      Date: Tue Aug 2 10:09:58 2011 -0400

          removing compute monitor

    Leaving no in-tree user of the 'get_disks' method. This
    method is not declared in the ComputeDriver base class
    nor implemented by any virt driver besides libvirt, so
    can be safely deleted.

    Partial-bug: #1333219
    Change-Id: I4d3f53499d088a82e471ab68feef1ae50d3f8bdc

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

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

commit bb808a1909b6021fcc539b215463ed35b9542ca3
Author: Daniel P. Berrange <email address hidden>
Date: Fri Jun 20 12:36:38 2014 +0100

    libvirt: add '_' prefix to all get_guest_*_config methods

    The get_guest_*_config methods are all internal helpers so should
    have a '_' prefix to indicate they are not part of public virt
    driver API.

    Related-bug: #1333219
    Change-Id: I76108c4992144cc7c3273bfd753aa76f7a821a56

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/101878
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=1684ecfa971c41973dbad9355ecd624d29597fb4
Submitter: Jenkins
Branch: master

commit 1684ecfa971c41973dbad9355ecd624d29597fb4
Author: Daniel P. Berrange <email address hidden>
Date: Fri Jun 20 12:36:38 2014 +0100

    libvirt: add '_' prefix to some get_host_* methods

    The get_host_uuid, get_host_capabilities and get_host_cpu_for_guest
    methods are all internal helpers so should have a '_' prefix to
    indicate they are not part of public virt driver API.

    Related-bug: #1333219
    Change-Id: Ice22f52ef1f4ec0b950b5fdf303499ea5c2ba7be

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

commit c9312a415ce380ad955754375bb4d4e6099b7677
Author: Daniel P. Berrange <email address hidden>
Date: Fri Jun 20 13:29:06 2014 +0100

    libvirt: add '_' prefix to host state information methods

    The methods used by the HostState class are all internal
    helpers so should have a '_' prefix to indicate they are
    not part of public virt driver API.

    Related-bug: #1333219
    Change-Id: Ia9b2e966071d5a842193421394aa0850beb3fdba

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

commit be97af9a3081587845cbd3d5aff48ef6078e4a74
Author: Daniel P. Berrange <email address hidden>
Date: Fri Jun 20 14:38:21 2014 +0100

    libvirt: add '_' prefix to remaining internal methods

    Various methods are internal helpers so should have a '_'
    prefix to indicate they are not part of public virt
    driver API.

    Related-bug: #1333219
    Change-Id: I2996ccd188cc34a924f01d86a18c747465b7383f

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/101881
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=07eb0e25e40e0523909ef532fbd6a68ef049cf92
Submitter: Jenkins
Branch: master

commit 07eb0e25e40e0523909ef532fbd6a68ef049cf92
Author: Daniel P. Berrange <email address hidden>
Date: Fri Jun 20 15:05:16 2014 +0100

    libvirt: remove volume_driver_method API

    Replace the 'volume_driver_method' API with _connect_volume
    and _disconnect_volume methods to remove the pointless
    introspection based calling technique. This adds a '_' to
    the names to show that they are internal methods only.

    Related-bug: #1333219
    Change-Id: Ife3fb60dd8aef8adf6bbdd2465971e156430fa0d

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

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

commit e3bbbdd455431b55f689a4d03f0ef45c5aaa2946
Author: Daniel P. Berrange <email address hidden>
Date: Fri Jun 20 16:39:01 2014 +0100

    libvirt: remove hack from ensure_filtering_rules_for_instance

    The ensure_filtering_rules_for_instance method had a hack
    where the test suite caller could pass in a module to
    replace the greenthread.sleep call. This is utterly crazy
    when mock can trivially replace the greenthread.sleep call
    directly.

    Partial-bug: #1333219
    Change-Id: I449290aa366f5c85cc63a15d0b1704339be4d73a

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

commit e1e3518da1de721a70c48b5dea3e91bb9d49cd57
Author: Daniel P. Berrange <email address hidden>
Date: Mon Jun 23 11:58:23 2014 +0100

    vmwareapi: remove unused update_host_status method

    The VMWare driver declares a method 'update_host_status'
    which has no callers anywhere in the codebase.

    This is left over code that was missed in the cleanup from

      commit 2cb47fbabf09ced76178e8453d508c66f86a7a3a
      Author: Arata Notsu <email address hidden>
      Date: Thu Oct 18 22:40:01 2012 +0900

        Remove ComputeDriver.update_host_status()

    Partial-bug: #1333219
    Change-Id: Ie0de9b6d427246cb3c3adb818d483b61dfb08d82

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/101884
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=2bed16c89356554a193a111d268a9587709ed2f7
Submitter: Jenkins
Branch: master

commit 2bed16c89356554a193a111d268a9587709ed2f7
Author: Daniel P. Berrange <email address hidden>
Date: Fri Jun 20 14:44:38 2014 +0100

    virt: add get_instance_disk_info to virt driver API

    The compute manager has been calling get_instance_disk_info on
    virt driver implementations during block migration, despite
    this method not being declared in the virt driver API. It was
    implemented in libvirt and stubbed in xenapi, with different
    API signatures in both.

    Declare & document it as part of the virt driver API, and
    split the libvirt impl into two parts to hide the libvirt
    specific notion of XML config.

    Partial-bug: #1333219
    Change-Id: I38c811f91cce99772ff988a278c32483a219949d

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/101885
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=87b07316b853ef094846d4ba218c9fed7c37c809
Submitter: Jenkins
Branch: master

commit 87b07316b853ef094846d4ba218c9fed7c37c809
Author: Daniel P. Berrange <email address hidden>
Date: Fri Jun 20 16:33:53 2014 +0100

    virt: use context & instance as param names in migrate APIs

    The vast majority of methods in the ComputeDriver use
    'context' and 'instance' as parameter names. The only
    exceptions are the migration related methods which use
    'ctx' and 'instance_ref'. Change the latter to be
    consistently named with the rest of the file

    Partial-bug: #1333219
    Change-Id: I0457e3e70ee58a9cbfc69f8cfe675de0504cc781

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

commit af2d9578a9b067f598314ab3b341f60ac0afb0dc
Author: Daniel P. Berrange <email address hidden>
Date: Mon Jun 23 11:44:05 2014 +0100

    virt: fix signature of set_admin_password method

    The compute manager passes (instance, new_pass) to the
    set_admin_password method, and the XenAPI driver impl
    expects this pair of parameters. The ComputeManager
    class, however, declares that it takes (instance, context,
    new_pass=None). It makes no sense to default the new
    password to None, when the only caller always passes
    it, and the context parameter is never passed by the
    caller either.

    Partial-bug: #1333219
    Change-Id: If656da4ef54a0425b9f50ef03af044b803b1afae

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/101887
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=13c8adc6c11ff0ac2422e7ee027e9b9a705273a4
Submitter: Jenkins
Branch: master

commit 13c8adc6c11ff0ac2422e7ee027e9b9a705273a4
Author: Daniel P. Berrange <email address hidden>
Date: Fri Jun 20 12:05:56 2014 +0100

    virt: add test helper for checking public driver API method names

    The virt driver impls of ComputeDriver should only expose public
    methods which are already defined by the ComputeDriver base class.
    Any other methods should be prefixed with an '_' to indicate that
    they are internal helperrs.

    Provide a test helper method which the virt driver tests will
    call to validate their implementation is in compliance with
    the base class signature.

    Partial-bug: #1333219
    Change-Id: Ibc2369a5f90e09857da29810ac0707614b041d54

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

commit fc1709f8232b9e310975865835ea647a133b7ea7
Author: Daniel P. Berrange <email address hidden>
Date: Fri Jun 20 16:33:53 2014 +0100

    libvirt: make method signatures match parent class

    Fix any inconsistencies in method signatures between the
    libvirt driver impl and the ComputeDriver parent class.
    Add a test case to prevent future regressions.

    Partial-bug: #1333219
    Change-Id: I221433273bd73bb84ed62c8579d45471ac65e1ef

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

commit d513ee71a9453e01629a9b65a4b5ec1142362689
Author: Daniel P. Berrange <email address hidden>
Date: Fri Jun 20 16:33:53 2014 +0100

    xenapi: make method signatures match parent class

    Fix any inconsistencies in method signatures between the
    xenapi driver impl and the ComputeDriver parent class.
    Add a test case to prevent future regressions.

    Partial-bug: #1333219
    Change-Id: Ie0be083c684d557c068f8e69a4f0fc38567a1864

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

commit b23182f83cb0d9bf638636008e886b8d637a6dc3
Author: Daniel P. Berrange <email address hidden>
Date: Fri Jun 20 16:33:53 2014 +0100

    hyperv: make method signatures match parent class

    Fix any inconsistencies in method signatures between the
    hyperv driver impl and the ComputeDriver parent class.
    Add a test case to prevent future regressions

    Partial-bug: #1333219
    Change-Id: Ie94042b0ea1ec4f752736e245b7af24400d117db

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

commit d0225509bdb7882324726312f4a4a9f63375203e
Author: Daniel P. Berrange <email address hidden>
Date: Fri Jun 20 16:33:53 2014 +0100

    vmwareapi: make method signatures match parent class

    Fix any inconsistencies in method signatures between the
    vmwareapi driver impl and the ComputeDriver parent class.
    Add a test case to prevent future regressions

    Closes-bug: #1333219
    Change-Id: Ic361a922a1aefa5b5a3470c0547e694d073d2d58

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