Skip to content

Commit

Permalink
fix: use service type block-storage for volume v3
Browse files Browse the repository at this point in the history
BREAKING CHANGE
    May cause failures if the old volumev3 service type is used.
  • Loading branch information
dtantsur committed Oct 24, 2024
1 parent bff5323 commit c728f68
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions src/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,21 @@ pub struct GenericService {
major_version: VersionSelector,
}

/// Compute service.
/// Block storage service (v3).
#[derive(Copy, Clone, Debug)]
#[non_exhaustive]
pub struct ComputeService;
pub struct BlockStorageService;

service! {
#[doc = "Bare Metal service."]
BAREMETAL: BareMetalService -> "baremetal", header "x-openstack-ironic-api-version"
}

/// Compute service.
#[derive(Copy, Clone, Debug)]
#[non_exhaustive]
pub struct ComputeService;

service! {
#[doc = "Image service."]
IMAGE: ImageService -> "image"
Expand All @@ -157,11 +162,6 @@ service! {
OBJECT_STORAGE: ObjectStorageService -> "object-store", discovery false
}

service! {
#[doc = "Block Storage service (v3)."]
BLOCK_STORAGE: BlockStorageService -> "volumev3"
}

impl GenericService {
/// Create a new generic service.
pub const fn new(catalog_type: &'static str, major_version: VersionSelector) -> GenericService {
Expand All @@ -187,13 +187,30 @@ impl ServiceType for GenericService {
}
}

impl BlockStorageService {
/// Create a Compute service type.
pub const fn new() -> BlockStorageService {
BlockStorageService
}
}

impl ComputeService {
/// Create a Compute service type.
pub const fn new() -> ComputeService {
ComputeService
}
}

impl ServiceType for BlockStorageService {
fn catalog_type(&self) -> &'static str {
"block-storage"
}

fn major_version_supported(&self, version: ApiVersion) -> bool {
version.0 == 3
}
}

impl ServiceType for ComputeService {
fn catalog_type(&self) -> &'static str {
"compute"
Expand All @@ -214,5 +231,8 @@ impl VersionedService for ComputeService {
}
}

/// Block storage service (v3).
pub const BLOCK_STORAGE: BlockStorageService = BlockStorageService::new();

/// Compute service.
pub const COMPUTE: ComputeService = ComputeService::new();

0 comments on commit c728f68

Please sign in to comment.