compute monitors should be loaded via stevedore

Bug #1468012 reported by Jay Pipes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Wishlist
Jay Pipes

Bug Description

The monitor plugins in /nova/compute/monitors/ are currently loaded via a nova.loadables.BaseLoader subclass called ResourceMonitorHandler. We should be able to get rid of the nova.loadables Python module and just use the stevedore library, which is purpose-built for extension loading and managing like this.

This would have the side benefit of us being able to deprecate the following CONF options:

compute_monitors_opts = [
    cfg.MultiStrOpt('compute_available_monitors',
                    default=['nova.compute.monitors.all_monitors'],
                    help='Monitor classes available to the compute which may '
                         'be specified more than once.'),
    cfg.ListOpt('compute_monitors',
                default=[],
                help='A list of monitors that can be used for getting '
                     'compute metrics.'),
    ]

Since stevedore's ExtensionManager loads extensions via standard Python setuptools entry_points.

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

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

commit c41db608fe3cd75c5925bb7693261ac8379737f0
Author: Jay Pipes <email address hidden>
Date: Wed Jun 24 17:26:28 2015 -0400

    Rework monitor plugin interface and API

    In order to prepare for the stevedore-ization of the compute monitor
    plugins, and to clean up the overly complex monitor API, this patch
    breaks out the base monitor plugin into a much simpler class that has
    the following methods:

    - get_metric_names(), which remains unchanged in its
      purpose from the original ResourceMonitorBase class
    - get_metric(name), which returns a (value, timestamp) tuple for
      a supplied metric name
    - add_metrics_to_list() which is a non-overrideable method on the
      base plugin class that adds a set of metrics to a
      nova.objects.MonitorMetricList object supplied as the parameter

    There is a base class called nova.compute.monitors.base.CPUMonitorBase
    that simply returns the appropriate CPU monitor metric name constants
    for the get_metric_names() method.

    The directory structure of the monitor plugins and the module naming for
    the lone in-tree is changed to better represent what the directories and
    files contain. The lone in-tree plugin is a monitor that inherits from
    nova.compute.monitors.base.CPUMonitorBase and uses the call to the
    hypervisor's get_host_cpu_stats() to grab CPU-centric metrics on a
    periodic basis.

    Change-Id: I3f2e8eca6ce43b07b3c8b430b8576be4f0d3f909
    Partial-bug: 1468012

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

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

commit 973f31212ad0719a5c1a20540c38563b37bc8873
Author: Jay Pipes <email address hidden>
Date: Fri Jun 26 14:33:03 2015 -0400

    Use stevedore for loading monitor extensions

    The compute monitor plugins were being loaded using the nova.loadables
    module. This patch uses the stevedore library to load monitor
    extensions. We keep the same semantics as the previous loading
    mechanism: we use the CONF.compute_monitors configuration option to
    winnow the set of all monitor plugins, and we ensure that no two
    monitors that return the same set of metrics will be loaded.

    However, this patch deprecates the CONF.compute_available_monitors
    configuration option, since stevedore and setuptools entry points now
    allow a set of plugins to be specified without any further configuration
    options.

    Change-Id: I97bf8bcd43faf9f3fe40983497c2360233d5f599
    Fixes-bug: 1468012
    DocImpact: deprecates the CONF.compute_available_monitors option.

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