Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions libcloud/common/ovh.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,23 @@
"SYD1": {"id": "SYD1", "name": "Sydney 1", "country": "AU"},
"VIN1": {"id": "VIN1", "name": "Vint Hill, Virginia 1", "country": "US"},
"WAW1": {"id": "WAW1", "name": "Warsaw 1", "country": "PL"},
"BHS": {"id": "BHS", "name": "Beauharnois, Quebec", "country": "CA"},
"CA-EAST-TOR": {"id": "CA-EAST-TOR", "name": "Toronto, Canada", "country": "CA"},
"DE": {"id": "DE", "name": "Germany", "country": "DE"},
"DE1": {"id": "DE1", "name": "Germany 1", "country": "DE"},
"EU-SOUTH-MIL": {"id": "EU-SOUTH-MIL", "name": "Milan, Italy", "country": "IT"},
"EU-WEST-PAR": {"id": "EU-WEST-PAR", "name": "Paris, France", "country": "FR"},
"GRA": {"id": "GRA", "name": "Gravelines", "country": "FR"},
"GRA9": {"id": "GRA9", "name": "Gravelines 9", "country": "FR"},
"GRA11": {"id": "GRA11", "name": "Gravelines 11", "country": "FR"},
"RBX": {"id": "RBX", "name": "Roubaix", "country": "FR"},
"RBX-A": {"id": "RBX-A", "name": "Roubaix A", "country": "FR"},
"RBX-ARCHIVE": {"id": "RBX-ARCHIVE", "name": "Roubaix Archive", "country": "FR"},
"SBG": {"id": "SBG", "name": "Strasbourg", "country": "FR"},
"SBG5": {"id": "SBG5", "name": "Strasbourg 5", "country": "FR"},
"UK": {"id": "UK", "name": "United Kingdom", "country": "UK"},
"UK1": {"id": "UK1", "name": "United Kingdom 1", "country": "UK"},
Comment on lines +80 to +81
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

Using 'UK' as a country code is inconsistent with ISO 3166-1 alpha-2 standards, which uses 'GB' for the United Kingdom. However, this appears to be an existing pattern in the codebase (see line 50 with LON1). For consistency with existing entries, this may be acceptable, but consider using 'GB' for proper ISO compliance in future additions.

Suggested change
"UK": {"id": "UK", "name": "United Kingdom", "country": "UK"},
"UK1": {"id": "UK1", "name": "United Kingdom 1", "country": "UK"},
"UK": {"id": "UK", "name": "United Kingdom", "country": "GB"},
"UK1": {"id": "UK1", "name": "United Kingdom 1", "country": "GB"},

Copilot uses AI. Check for mistakes.
"WAW": {"id": "WAW", "name": "Warsaw", "country": "PL"},
}
DEFAULT_ACCESS_RULES = [
{"method": "GET", "path": "/*"},
Expand Down
5 changes: 3 additions & 2 deletions libcloud/compute/drivers/ovh.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from libcloud.compute.types import Provider, StorageVolumeState, VolumeSnapshotState
from libcloud.compute.drivers.openstack import OpenStackKeyPair, OpenStackNodeDriver


class OvhNodeDriver(NodeDriver):
"""
Libcloud driver for the Ovh API
Expand Down Expand Up @@ -537,7 +536,9 @@ def _to_volumes(self, objs):
return [self._to_volume(obj) for obj in objs]

def _to_location(self, obj):
location = self.connectionCls.LOCATIONS[obj]
location = self.connectionCls.LOCATIONS.get(obj)
if not location:
location = {"id": obj, "name": obj, "country": ""}
Comment on lines 539 to 541
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The new fallback logic for unknown locations lacks test coverage. Consider adding a test case that verifies the behavior when an unknown location is encountered, ensuring that it creates a NodeLocation with the location ID as both id and name, an empty country field, and logs an appropriate warning message.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the logic behind the location being empty?
May be raising an error will be better...


return NodeLocation(driver=self, **location)

Expand Down