From 14ecae147af5ddd27a25469315be05fa08ac5c39 Mon Sep 17 00:00:00 2001 From: "Andrea Frittoli (andreaf)" Date: Fri, 17 Jun 2016 11:56:24 +0100 Subject: [PATCH] Service client modules in volume __init__ Import the volume service client classes in the __init__ of the volume module, and define __all__, so that service client classes may be accessed by importing the volume module only. Partially-implements: bp client-manager-refactor Change-Id: I7f0e070f325a9b77979d6516d18bf319bfdfa7b8 --- tempest/clients.py | 99 +++++++++----------------- tempest/services/volume/__init__.py | 19 +++++ tempest/services/volume/v1/__init__.py | 30 ++++++++ tempest/services/volume/v2/__init__.py | 30 ++++++++ tempest/services/volume/v3/__init__.py | 17 +++++ 5 files changed, 128 insertions(+), 67 deletions(-) diff --git a/tempest/clients.py b/tempest/clients.py index 9da3e27b3..1071d653f 100644 --- a/tempest/clients.py +++ b/tempest/clients.py @@ -50,43 +50,7 @@ from tempest.services.object_storage.container_client import ContainerClient from tempest.services.object_storage.object_client import ObjectClient from tempest.services.orchestration.json.orchestration_client import \ OrchestrationClient -from tempest.services.volume.v1.json.admin.hosts_client import \ - HostsClient as VolumeHostsClient -from tempest.services.volume.v1.json.admin.quotas_client import \ - QuotasClient as VolumeQuotasClient -from tempest.services.volume.v1.json.admin.services_client import \ - ServicesClient as VolumeServicesClient -from tempest.services.volume.v1.json.admin.types_client import \ - TypesClient as VolumeTypesClient -from tempest.services.volume.v1.json.availability_zone_client import \ - AvailabilityZoneClient as VolumeAvailabilityZoneClient -from tempest.services.volume.v1.json.backups_client import BackupsClient -from tempest.services.volume.v1.json.extensions_client import \ - ExtensionsClient as VolumeExtensionsClient -from tempest.services.volume.v1.json.qos_client import QosSpecsClient -from tempest.services.volume.v1.json.snapshots_client import SnapshotsClient -from tempest.services.volume.v1.json.volumes_client import VolumesClient -from tempest.services.volume.v2.json.admin.hosts_client import \ - HostsClient as VolumeHostsV2Client -from tempest.services.volume.v2.json.admin.quotas_client import \ - QuotasClient as VolumeQuotasV2Client -from tempest.services.volume.v2.json.admin.services_client import \ - ServicesClient as VolumeServicesV2Client -from tempest.services.volume.v2.json.admin.types_client import \ - TypesClient as VolumeTypesV2Client -from tempest.services.volume.v2.json.availability_zone_client import \ - AvailabilityZoneClient as VolumeAvailabilityZoneV2Client -from tempest.services.volume.v2.json.backups_client import \ - BackupsClient as BackupsV2Client -from tempest.services.volume.v2.json.extensions_client import \ - ExtensionsClient as VolumeExtensionsV2Client -from tempest.services.volume.v2.json.qos_client import \ - QosSpecsClient as QosSpecsV2Client -from tempest.services.volume.v2.json.snapshots_client import \ - SnapshotsClient as SnapshotsV2Client -from tempest.services.volume.v2.json.volumes_client import \ - VolumesClient as VolumesV2Client -from tempest.services.volume.v3.json.messages_client import MessagesClient +from tempest.services import volume CONF = config.CONF LOG = logging.getLogger(__name__) @@ -406,49 +370,50 @@ class Manager(manager.Manager): } params.update(self.default_params) - self.volume_qos_client = QosSpecsClient(self.auth_provider, - **params) - self.volume_qos_v2_client = QosSpecsV2Client( + self.volume_qos_client = volume.v1.QosSpecsClient(self.auth_provider, + **params) + self.volume_qos_v2_client = volume.v2.QosSpecsClient( self.auth_provider, **params) - self.volume_services_client = VolumeServicesClient( + self.volume_services_client = volume.v1.ServicesClient( self.auth_provider, **params) - self.volume_services_v2_client = VolumeServicesV2Client( + self.volume_services_v2_client = volume.v2.ServicesClient( self.auth_provider, **params) - self.backups_client = BackupsClient(self.auth_provider, **params) - self.backups_v2_client = BackupsV2Client(self.auth_provider, - **params) - self.snapshots_client = SnapshotsClient(self.auth_provider, - **params) - self.snapshots_v2_client = SnapshotsV2Client(self.auth_provider, - **params) - self.volumes_client = VolumesClient( + self.backups_client = volume.v1.BackupsClient(self.auth_provider, + **params) + self.backups_v2_client = volume.v2.BackupsClient(self.auth_provider, + **params) + self.snapshots_client = volume.v1.SnapshotsClient(self.auth_provider, + **params) + self.snapshots_v2_client = volume.v2.SnapshotsClient( + self.auth_provider, **params) + self.volumes_client = volume.v1.VolumesClient( self.auth_provider, default_volume_size=CONF.volume.volume_size, **params) - self.volumes_v2_client = VolumesV2Client( + self.volumes_v2_client = volume.v2.VolumesClient( self.auth_provider, default_volume_size=CONF.volume.volume_size, **params) - self.volume_messages_client = MessagesClient(self.auth_provider, - **params) - self.volume_types_client = VolumeTypesClient(self.auth_provider, - **params) - self.volume_types_v2_client = VolumeTypesV2Client( + self.volume_messages_client = volume.v3.MessagesClient( self.auth_provider, **params) - self.volume_hosts_client = VolumeHostsClient(self.auth_provider, - **params) - self.volume_hosts_v2_client = VolumeHostsV2Client( - self.auth_provider, **params) - self.volume_quotas_client = VolumeQuotasClient(self.auth_provider, - **params) - self.volume_quotas_v2_client = VolumeQuotasV2Client(self.auth_provider, + self.volume_types_client = volume.v1.TypesClient(self.auth_provider, + **params) + self.volume_types_v2_client = volume.v2.TypesClient(self.auth_provider, **params) - self.volumes_extension_client = VolumeExtensionsClient( + self.volume_hosts_client = volume.v1.HostsClient(self.auth_provider, + **params) + self.volume_hosts_v2_client = volume.v2.HostsClient(self.auth_provider, + **params) + self.volume_quotas_client = volume.v1.QuotasClient(self.auth_provider, + **params) + self.volume_quotas_v2_client = volume.v2.QuotasClient( self.auth_provider, **params) - self.volumes_v2_extension_client = VolumeExtensionsV2Client( + self.volumes_extension_client = volume.v1.ExtensionsClient( + self.auth_provider, **params) + self.volumes_v2_extension_client = volume.v2.ExtensionsClient( self.auth_provider, **params) self.volume_availability_zone_client = \ - VolumeAvailabilityZoneClient(self.auth_provider, **params) + volume.v1.AvailabilityZoneClient(self.auth_provider, **params) self.volume_v2_availability_zone_client = \ - VolumeAvailabilityZoneV2Client(self.auth_provider, **params) + volume.v2.AvailabilityZoneClient(self.auth_provider, **params) def _set_object_storage_clients(self): params = { diff --git a/tempest/services/volume/__init__.py b/tempest/services/volume/__init__.py index e69de29bb..4d29cdd43 100644 --- a/tempest/services/volume/__init__.py +++ b/tempest/services/volume/__init__.py @@ -0,0 +1,19 @@ +# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +from tempest.services.volume import v1 +from tempest.services.volume import v2 +from tempest.services.volume import v3 + +__all__ = ['v1', 'v2', 'v3'] diff --git a/tempest/services/volume/v1/__init__.py b/tempest/services/volume/v1/__init__.py index e69de29bb..6bdb8c4e2 100644 --- a/tempest/services/volume/v1/__init__.py +++ b/tempest/services/volume/v1/__init__.py @@ -0,0 +1,30 @@ +# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +from tempest.services.volume.v1.json.admin.hosts_client import HostsClient +from tempest.services.volume.v1.json.admin.quotas_client import QuotasClient +from tempest.services.volume.v1.json.admin.services_client import \ + ServicesClient +from tempest.services.volume.v1.json.admin.types_client import TypesClient +from tempest.services.volume.v1.json.availability_zone_client import \ + AvailabilityZoneClient +from tempest.services.volume.v1.json.backups_client import BackupsClient +from tempest.services.volume.v1.json.extensions_client import ExtensionsClient +from tempest.services.volume.v1.json.qos_client import QosSpecsClient +from tempest.services.volume.v1.json.snapshots_client import SnapshotsClient +from tempest.services.volume.v1.json.volumes_client import VolumesClient + +__all__ = ['HostsClient', 'QuotasClient', 'ServicesClient', 'TypesClient', + 'AvailabilityZoneClient', 'BackupsClient', 'ExtensionsClient', + 'QosSpecsClient', 'SnapshotsClient', 'VolumesClient'] diff --git a/tempest/services/volume/v2/__init__.py b/tempest/services/volume/v2/__init__.py index e69de29bb..c75b0e5c8 100644 --- a/tempest/services/volume/v2/__init__.py +++ b/tempest/services/volume/v2/__init__.py @@ -0,0 +1,30 @@ +# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +from tempest.services.volume.v2.json.admin.hosts_client import HostsClient +from tempest.services.volume.v2.json.admin.quotas_client import QuotasClient +from tempest.services.volume.v2.json.admin.services_client import \ + ServicesClient +from tempest.services.volume.v2.json.admin.types_client import TypesClient +from tempest.services.volume.v2.json.availability_zone_client import \ + AvailabilityZoneClient +from tempest.services.volume.v2.json.backups_client import BackupsClient +from tempest.services.volume.v2.json.extensions_client import ExtensionsClient +from tempest.services.volume.v2.json.qos_client import QosSpecsClient +from tempest.services.volume.v2.json.snapshots_client import SnapshotsClient +from tempest.services.volume.v2.json.volumes_client import VolumesClient + +__all__ = ['HostsClient', 'QuotasClient', 'ServicesClient', 'TypesClient', + 'AvailabilityZoneClient', 'BackupsClient', 'ExtensionsClient', + 'QosSpecsClient', 'SnapshotsClient', 'VolumesClient'] diff --git a/tempest/services/volume/v3/__init__.py b/tempest/services/volume/v3/__init__.py index e69de29bb..d50098c75 100644 --- a/tempest/services/volume/v3/__init__.py +++ b/tempest/services/volume/v3/__init__.py @@ -0,0 +1,17 @@ +# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +from tempest.services.volume.v3.json.messages_client import MessagesClient + +__all__ = ['MessagesClient']