Skip to content

Add OVH VPS compute driver support#2127

Open
ciekawy wants to merge 4 commits into
apache:trunkfrom
ciekawy:feature/ovh-vps-support
Open

Add OVH VPS compute driver support#2127
ciekawy wants to merge 4 commits into
apache:trunkfrom
ciekawy:feature/ovh-vps-support

Conversation

@ciekawy

@ciekawy ciekawy commented Mar 19, 2026

Copy link
Copy Markdown

Description

Add OVH VPS (Virtual Private Server) management support to the existing OVH compute driver.

OVH VPS is a separate product line from OVH Public Cloud instances. It uses the proprietary /vps/ REST API instead of the /cloud/project/ OpenStack-based endpoints. Currently, no existing infrastructure tool (Terraform, Ansible, Libcloud) provides VPS management — only the raw OVH Python SDK can do it.

This PR extends OvhNodeDriver with 7 ex_-prefixed extension methods (following Libcloud convention for provider-specific functionality):

Method API Endpoint Purpose
ex_list_vps() GET /vps List all VPS names on the account
ex_get_vps(name) GET /vps/{name} Get VPS details as a Node object
ex_reboot_vps(name) POST /vps/{name}/reboot Reboot a VPS
ex_start_vps(name) POST /vps/{name}/start Start a stopped VPS
ex_stop_vps(name) POST /vps/{name}/stop Stop a running VPS
ex_rebuild_vps(name, image_id, ssh_key) POST /vps/{name}/rebuild Reinstall OS
ex_list_vps_images(name) GET /vps/{name}/images/available List available OS images

Additionally includes _to_vps_node() and _to_vps_images() internal converters and a VPS_STATE_MAP for mapping VPS-specific states to NodeState.

Changes

  • libcloud/compute/drivers/ovh.py — 7 new public methods + 2 internal converters + state map (~150 lines)
  • libcloud/test/compute/test_ovh.py — 10 new test cases for all VPS methods
  • libcloud/test/compute/fixtures/ovh/vps_*.json — 7 JSON mock fixtures
  • docs/compute/drivers/ovh.rst — VPS usage documentation with code examples

Design Decisions

  • Reuses existing auth infrastructure: OVH HMAC-SHA1 signing via OvhConnection works as-is for /vps/ endpoints
  • ex_ prefix convention: VPS methods are provider-specific extensions, not standard Libcloud compute interface
  • VPS name as ID: OVH VPS uses the service name (e.g., vps-12345678.vps.ovh.net) as the primary identifier, which becomes the Node.id
  • No ex_project_id required: VPS endpoints don't need a cloud project ID, but the constructor still requires one for Public Cloud compatibility

Test Plan

  • All 10 new VPS test cases pass
  • All 27 existing OVH tests still pass (37 total)
  • Mock HTTP fixtures cover all 7 API endpoints
  • State mapping tests verify VPS state → NodeState conversion

OVH VPS is a separate product line from Public Cloud that uses the
proprietary /vps/ API. This adds 7 extension methods to OvhNodeDriver:
ex_list_vps, ex_get_vps, ex_reboot_vps, ex_start_vps, ex_stop_vps,
ex_rebuild_vps, and ex_list_vps_images. Includes unit tests with mock
fixtures and updated documentation.
@codecov-commenter

codecov-commenter commented Apr 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.27273% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.36%. Comparing base (b743157) to head (52dd924).

Files with missing lines Patch % Lines
libcloud/compute/drivers/ovh.py 93.48% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk    #2127      +/-   ##
==========================================
+ Coverage   83.34%   83.36%   +0.02%     
==========================================
  Files         351      351              
  Lines       81202    81312     +110     
  Branches     8721     8725       +4     
==========================================
+ Hits        67674    67781     +107     
- Misses      10737    10739       +2     
- Partials     2791     2792       +1     
Files with missing lines Coverage Δ
libcloud/test/compute/test_ovh.py 98.02% <100.00%> (+0.67%) ⬆️
libcloud/compute/drivers/ovh.py 85.55% <93.48%> (+1.74%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds OVH VPS (Virtual Private Server) management support to the existing OVH compute driver by introducing provider-specific ex_* methods which target OVH’s /vps/ REST API (distinct from the Public Cloud /cloud/project/ endpoints).

Changes:

  • Extend OvhNodeDriver with VPS operations (ex_list_vps, ex_get_vps, start/stop/reboot, rebuild, and image listing) plus internal conversion helpers and a VPS→NodeState mapping.
  • Add unit tests and mock HTTP handlers/fixtures covering the new VPS endpoints.
  • Document VPS usage in the OVH driver documentation.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
libcloud/compute/drivers/ovh.py Adds VPS extension methods, state mapping, and object conversion helpers.
libcloud/test/compute/test_ovh.py Adds mock handlers and test cases validating the new VPS APIs and state mapping.
libcloud/test/compute/fixtures/ovh/vps_get.json Fixture for GET /vps (VPS name list).
libcloud/test/compute/fixtures/ovh/vps_get_detail.json Fixture for GET /vps/{name} (VPS detail payload).
libcloud/test/compute/fixtures/ovh/vps_reboot_post.json Fixture for POST /vps/{name}/reboot response.
libcloud/test/compute/fixtures/ovh/vps_start_post.json Fixture for POST /vps/{name}/start response.
libcloud/test/compute/fixtures/ovh/vps_stop_post.json Fixture for POST /vps/{name}/stop response.
libcloud/test/compute/fixtures/ovh/vps_rebuild_post.json Fixture for POST /vps/{name}/rebuild response.
libcloud/test/compute/fixtures/ovh/vps_images_available_get.json Fixture for GET /vps/{name}/images/available response.
docs/compute/drivers/ovh.rst Documents VPS support and provides example usage for the new methods.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants