Cloud Computing 7 min read

How to Extend OpenStack Nova with Stevedore Plugins: A Practical Guide

This article explains how OpenStack Nova's plugin mechanism works, introduces the stevedore library, and provides step‑by‑step instructions for declaring, implementing, loading, and testing custom API extensions using Python packaging tools.

360 Zhihui Cloud Developer
360 Zhihui Cloud Developer
360 Zhihui Cloud Developer
How to Extend OpenStack Nova with Stevedore Plugins: A Practical Guide

Background

OpenStack Nova API offers a plugin mechanism via API Plugins, enabling vendors to extend functionality without modifying the core code.

Why Use a Plugin Mechanism

Plugins separate core and extension code, improve abstraction, elasticity, and maintainability, and allow enabling or disabling features as needed. Similar mechanisms exist in Nagios, Zabbix, and Nginx. OpenStack implements this using the stevedore library.

stevedore Plugin

stevedore originated from the Ceilometer plugin framework, later adopted by Nova and Neutron. It reuses pkg_resources from python‑setuptools , providing a lightweight solution for most OpenStack plugin needs.

Using stevedore in OpenStack

The process consists of four steps: declaring entry points in setup.cfg , defining the plugin in nova/api/openstack/compute , implementing a subclass of V21APIExtensionBase , and loading the plugin via stevedore.

Since the Liberty release, plugins are placed under nova/api/openstack/compute . All plugins inherit from V21APIExtensionBase . An example subclass scheduler_hosts.py is shown below.

Plugins are loaded when the API controller initializes, reading api‑paste.ini and creating LoadedExtensionInfo objects that collect extensions.

The namespace nova.api.v21.extensions is defined in setup.cfg ; stevedore loads modules listed in entry_points.txt under that namespace.

Packaging with pbr

pbr (Python Build Reasonableness) simplifies setuptools usage, providing metadata via setup.cfg , automatic dependency installation from requirements.txt , Sphinx documentation generation, auto‑generated AUTHORS and ChangeLog files, file list creation, and version management via Git tags.

Metadata in setup.cfg .

Dependencies in requirements.txt .

Documentation with Sphinx.

Automatic AUTHORS and ChangeLog.

Automatic file list generation.

Versioning from Git tags.

Validating the Plugin / Extension API

Testing can be done with curl or an HTTP client. The extended novaclient adds command‑line support for new APIs.

Steps to add the scheduler_hosts plugin:

Create the module file under novaclient/v2 .

Import the module in v2/client.py .

Implement the command method in v2/shell.py .

Run the command to verify the extension works:

nova scheduler-host-list --image 426bb355-d07d-4ff8-80e6-d9ae30dcada2 --flavor bb282545-5f4e-4827-9aaa-cbc6aef72a9d --max_count 1
Cloud ComputingBackend DevelopmentPluginOpenStackNovastevedore
360 Zhihui Cloud Developer
Written by

360 Zhihui Cloud Developer

360 Zhihui Cloud is an enterprise open service platform that aims to "aggregate data value and empower an intelligent future," leveraging 360's extensive product and technology resources to deliver platform services to customers.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.