ZhiQiang Fan | 39f9722 | 2013-09-20 04:49:44 +0800 | [diff] [blame] | 1 | # Copyright 2012 OpenStack Foundation |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 2 | # All Rights Reserved. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 | # not use this file except in compliance with the License. You may obtain |
| 6 | # a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | # License for the specific language governing permissions and limitations |
| 14 | # under the License. |
| 15 | |
Ken'ichi Ohmichi | 4771cbc | 2015-01-19 23:45:23 +0000 | [diff] [blame] | 16 | import copy |
| 17 | |
Andrea Frittoli | 9efbe95 | 2015-01-29 12:43:09 +0000 | [diff] [blame] | 18 | from tempest.common import cred_provider |
Ken'ichi Ohmichi | 4266268 | 2015-01-05 05:00:04 +0000 | [diff] [blame] | 19 | from tempest.common import negative_rest_client |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 20 | from tempest import config |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 21 | from tempest import manager |
Matthew Treinish | f4a9b0f | 2013-07-26 16:58:26 -0400 | [diff] [blame] | 22 | from tempest.openstack.common import log as logging |
Ken'ichi Ohmichi | 884d106 | 2015-01-23 03:24:41 +0000 | [diff] [blame] | 23 | from tempest.services.baremetal.v1.json.baremetal_client import \ |
| 24 | BaremetalClientJSON |
Attila Fazekas | 1aed620 | 2013-02-11 14:47:45 +0100 | [diff] [blame] | 25 | from tempest.services import botoclients |
Yuiko Takada | 420f2eb | 2014-04-02 19:53:38 +0900 | [diff] [blame] | 26 | from tempest.services.compute.json.agents_client import \ |
| 27 | AgentsClientJSON |
Mitsuhiko Yamazaki | 74f0707 | 2013-04-02 11:52:31 +0900 | [diff] [blame] | 28 | from tempest.services.compute.json.aggregates_client import \ |
| 29 | AggregatesClientJSON |
Leo Toyoda | a527891 | 2013-04-16 15:40:12 +0900 | [diff] [blame] | 30 | from tempest.services.compute.json.availability_zone_client import \ |
| 31 | AvailabilityZoneClientJSON |
YuikoTakada | ac0879a | 2015-01-22 02:40:03 +0000 | [diff] [blame] | 32 | from tempest.services.compute.json.baremetal_nodes_client import \ |
| 33 | BaremetalNodesClientJSON |
ivan-zhu | d57f3cf | 2013-11-06 16:59:52 +0800 | [diff] [blame] | 34 | from tempest.services.compute.json.certificates_client import \ |
| 35 | CertificatesClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 36 | from tempest.services.compute.json.extensions_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 37 | ExtensionsClientJSON |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 38 | from tempest.services.compute.json.fixed_ips_client import FixedIPsClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 39 | from tempest.services.compute.json.flavors_client import FlavorsClientJSON |
| 40 | from tempest.services.compute.json.floating_ips_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 41 | FloatingIPsClientJSON |
Attila Fazekas | 8e99b99 | 2013-02-24 09:53:23 +0100 | [diff] [blame] | 42 | from tempest.services.compute.json.hosts_client import HostsClientJSON |
Tony Yang | 3d5f163 | 2013-06-06 14:17:57 +0800 | [diff] [blame] | 43 | from tempest.services.compute.json.hypervisor_client import \ |
| 44 | HypervisorClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 45 | from tempest.services.compute.json.images_client import ImagesClientJSON |
ivan-zhu | ef7a1bd | 2013-10-22 17:56:46 +0800 | [diff] [blame] | 46 | from tempest.services.compute.json.instance_usage_audit_log_client import \ |
| 47 | InstanceUsagesAuditLogClientJSON |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 48 | from tempest.services.compute.json.interfaces_client import \ |
| 49 | InterfacesClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 50 | from tempest.services.compute.json.keypairs_client import KeyPairsClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 51 | from tempest.services.compute.json.limits_client import LimitsClientJSON |
Ken'ichi Ohmichi | 2fdc182 | 2014-03-18 09:10:57 +0900 | [diff] [blame] | 52 | from tempest.services.compute.json.migrations_client import \ |
| 53 | MigrationsClientJSON |
Andrea Frittoli | e258cd7 | 2014-07-17 04:47:26 +0100 | [diff] [blame] | 54 | from tempest.services.compute.json.networks_client import NetworksClientJSON |
Matt Riedemann | 848805f | 2014-06-16 13:23:51 -0700 | [diff] [blame] | 55 | from tempest.services.compute.json.quotas_client import QuotaClassesClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 56 | from tempest.services.compute.json.quotas_client import QuotasClientJSON |
Ghanshyam | 9d9201d | 2014-04-16 19:28:09 +0900 | [diff] [blame] | 57 | from tempest.services.compute.json.security_group_default_rules_client import \ |
| 58 | SecurityGroupDefaultRulesClientJSON |
Matthew Treinish | a83a16e | 2012-12-07 13:44:02 -0500 | [diff] [blame] | 59 | from tempest.services.compute.json.security_groups_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 60 | SecurityGroupsClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 61 | from tempest.services.compute.json.servers_client import ServersClientJSON |
Leo Toyoda | 3ae31e1 | 2013-04-19 11:19:57 +0900 | [diff] [blame] | 62 | from tempest.services.compute.json.services_client import ServicesClientJSON |
Ken'ichi Ohmichi | c3dfdb2 | 2015-01-22 04:39:58 +0000 | [diff] [blame] | 63 | from tempest.services.compute.json.tenant_networks_client import \ |
| 64 | TenantNetworksClientJSON |
Leo Toyoda | d80b6a0 | 2013-05-08 12:15:13 +0900 | [diff] [blame] | 65 | from tempest.services.compute.json.tenant_usages_client import \ |
| 66 | TenantUsagesClientJSON |
Matthew Treinish | a83a16e | 2012-12-07 13:44:02 -0500 | [diff] [blame] | 67 | from tempest.services.compute.json.volumes_extensions_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 68 | VolumesExtensionsClientJSON |
Ken'ichi Ohmichi | dc5fe44 | 2015-02-13 04:00:47 +0000 | [diff] [blame] | 69 | from tempest.services.data_processing.v1_1.data_processing_client import \ |
| 70 | DataProcessingClient |
Nikhil Manchanda | dd6886f | 2014-03-03 01:58:45 -0800 | [diff] [blame] | 71 | from tempest.services.database.json.flavors_client import \ |
| 72 | DatabaseFlavorsClientJSON |
ravikumar-venkatesan | 9e81b44 | 2014-12-08 09:57:56 +0000 | [diff] [blame] | 73 | from tempest.services.database.json.limits_client import \ |
| 74 | DatabaseLimitsClientJSON |
Peter Stachowski | 320f9c7 | 2014-04-21 16:13:23 -0400 | [diff] [blame] | 75 | from tempest.services.database.json.versions_client import \ |
| 76 | DatabaseVersionsClientJSON |
Attila Fazekas | 407b6db | 2013-01-19 12:48:36 +0100 | [diff] [blame] | 77 | from tempest.services.identity.json.identity_client import IdentityClientJSON |
ghanshyam | c0edda0 | 2015-02-06 15:51:40 +0900 | [diff] [blame] | 78 | from tempest.services.identity.json.token_client import TokenClientJSON |
nayna-patel | 914b471 | 2013-07-16 08:29:05 +0000 | [diff] [blame] | 79 | from tempest.services.identity.v3.json.credentials_client import \ |
| 80 | CredentialsClientJSON |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 81 | from tempest.services.identity.v3.json.endpoints_client import \ |
| 82 | EndPointClientJSON |
rajalakshmi-ganesan | 7312bb5 | 2013-01-29 20:03:42 +0530 | [diff] [blame] | 83 | from tempest.services.identity.v3.json.identity_client import \ |
| 84 | IdentityV3ClientJSON |
harika-vakadi | 40e1011 | 2013-02-08 14:38:09 +0530 | [diff] [blame] | 85 | from tempest.services.identity.v3.json.policy_client import PolicyClientJSON |
ravikumar-venkatesan | 3052e94 | 2014-05-12 18:25:17 +0000 | [diff] [blame] | 86 | from tempest.services.identity.v3.json.region_client import RegionClientJSON |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 87 | from tempest.services.identity.v3.json.service_client import \ |
| 88 | ServiceClientJSON |
ghanshyam | c0edda0 | 2015-02-06 15:51:40 +0900 | [diff] [blame] | 89 | from tempest.services.identity.v3.json.token_client import V3TokenClientJSON |
Matthew Treinish | 6d59c99 | 2013-03-01 16:20:04 -0500 | [diff] [blame] | 90 | from tempest.services.image.v1.json.image_client import ImageClientJSON |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 91 | from tempest.services.image.v2.json.image_client import ImageClientV2JSON |
Victoria MartÃnez de la Cruz | 1173b6e | 2014-09-22 18:32:13 -0300 | [diff] [blame] | 92 | from tempest.services.messaging.json.messaging_client import \ |
| 93 | MessagingClientJSON |
raiesmh08 | 6769832 | 2013-08-20 13:09:01 +0530 | [diff] [blame] | 94 | from tempest.services.network.json.network_client import NetworkClientJSON |
dwalleck | 5d73443 | 2012-10-04 01:11:47 -0500 | [diff] [blame] | 95 | from tempest.services.object_storage.account_client import AccountClient |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 96 | from tempest.services.object_storage.container_client import ContainerClient |
| 97 | from tempest.services.object_storage.object_client import ObjectClient |
Steve Baker | c60e4e3 | 2013-05-06 15:22:41 +1200 | [diff] [blame] | 98 | from tempest.services.orchestration.json.orchestration_client import \ |
| 99 | OrchestrationClient |
Nikolay Pliashechnikov | b053aab | 2013-11-05 06:06:44 -0800 | [diff] [blame] | 100 | from tempest.services.telemetry.json.telemetry_client import \ |
| 101 | TelemetryClientJSON |
Nayna Patel | 4a5024c | 2013-11-18 07:08:23 +0000 | [diff] [blame] | 102 | from tempest.services.volume.json.admin.volume_hosts_client import \ |
| 103 | VolumeHostsClientJSON |
Sylvain Baubeau | fdd3459 | 2014-02-20 18:40:10 +0100 | [diff] [blame] | 104 | from tempest.services.volume.json.admin.volume_quotas_client import \ |
| 105 | VolumeQuotasClientJSON |
Abhijeet.Jain | 0056b07 | 2014-04-15 09:32:29 +0530 | [diff] [blame] | 106 | from tempest.services.volume.json.admin.volume_services_client import \ |
| 107 | VolumesServicesClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 108 | from tempest.services.volume.json.admin.volume_types_client import \ |
| 109 | VolumeTypesClientJSON |
Abhijeet.Jain | 6109bb8 | 2014-05-01 10:29:15 +0530 | [diff] [blame] | 110 | from tempest.services.volume.json.availability_zone_client import \ |
| 111 | VolumeAvailabilityZoneClientJSON |
Giulio Fidente | 74b08ad | 2014-01-18 04:02:51 +0100 | [diff] [blame] | 112 | from tempest.services.volume.json.backups_client import BackupsClientJSON |
Matthew Treinish | 2324e6b | 2013-10-21 20:25:17 +0000 | [diff] [blame] | 113 | from tempest.services.volume.json.extensions_client import \ |
| 114 | ExtensionsClientJSON as VolumeExtensionClientJSON |
Swapnil Kulkarni | 7dba3e6 | 2014-08-14 09:05:07 +0000 | [diff] [blame] | 115 | from tempest.services.volume.json.qos_client import QosSpecsClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 116 | from tempest.services.volume.json.snapshots_client import SnapshotsClientJSON |
| 117 | from tempest.services.volume.json.volumes_client import VolumesClientJSON |
Chandan Kumar | 65eb859 | 2014-11-12 18:32:32 +0530 | [diff] [blame] | 118 | from tempest.services.volume.v2.json.admin.volume_hosts_client import \ |
| 119 | VolumeHostsV2ClientJSON |
Chandan Kumar | dd23f63 | 2014-11-17 15:27:48 +0530 | [diff] [blame] | 120 | from tempest.services.volume.v2.json.admin.volume_quotas_client import \ |
| 121 | VolumeQuotasV2Client |
jun xie | 9f12382 | 2014-11-20 14:21:23 +0800 | [diff] [blame] | 122 | from tempest.services.volume.v2.json.admin.volume_services_client import \ |
| 123 | VolumesServicesV2ClientJSON |
Chandan Kumar | 449e4c0 | 2014-09-12 07:26:19 -0400 | [diff] [blame] | 124 | from tempest.services.volume.v2.json.admin.volume_types_client import \ |
| 125 | VolumeTypesV2ClientJSON |
Zhi Kun Liu | 5339552 | 2014-07-18 16:05:52 +0800 | [diff] [blame] | 126 | from tempest.services.volume.v2.json.availability_zone_client import \ |
| 127 | VolumeV2AvailabilityZoneClientJSON |
jun xie | ebc3da3 | 2014-11-18 14:34:56 +0800 | [diff] [blame] | 128 | from tempest.services.volume.v2.json.backups_client import BackupsClientV2JSON |
Zhi Kun Liu | 5339552 | 2014-07-18 16:05:52 +0800 | [diff] [blame] | 129 | from tempest.services.volume.v2.json.extensions_client import \ |
| 130 | ExtensionsV2ClientJSON as VolumeV2ExtensionClientJSON |
Swapnil Kulkarni | 7dba3e6 | 2014-08-14 09:05:07 +0000 | [diff] [blame] | 131 | from tempest.services.volume.v2.json.qos_client import QosSpecsV2ClientJSON |
Zhi Kun Liu | 38641c6 | 2014-07-10 20:12:48 +0800 | [diff] [blame] | 132 | from tempest.services.volume.v2.json.snapshots_client import \ |
| 133 | SnapshotsV2ClientJSON |
Zhi Kun Liu | 8cc3c84 | 2014-01-07 10:44:34 +0800 | [diff] [blame] | 134 | from tempest.services.volume.v2.json.volumes_client import VolumesV2ClientJSON |
Vincent Hou | 6b8a7b7 | 2012-08-25 01:24:33 +0800 | [diff] [blame] | 135 | |
Sean Dague | 86bd842 | 2013-12-20 09:56:44 -0500 | [diff] [blame] | 136 | CONF = config.CONF |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 137 | LOG = logging.getLogger(__name__) |
| 138 | |
Vincent Hou | 6b8a7b7 | 2012-08-25 01:24:33 +0800 | [diff] [blame] | 139 | |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 140 | class Manager(manager.Manager): |
Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 141 | |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 142 | """ |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 143 | Top level manager for OpenStack tempest clients |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 144 | """ |
| 145 | |
Ken'ichi Ohmichi | c2b11ce | 2015-01-16 07:17:29 +0000 | [diff] [blame] | 146 | default_params = { |
| 147 | 'disable_ssl_certificate_validation': |
| 148 | CONF.identity.disable_ssl_certificate_validation, |
| 149 | 'ca_certs': CONF.identity.ca_certificates_file, |
| 150 | 'trace_requests': CONF.debug.trace_requests |
| 151 | } |
| 152 | |
Ken'ichi Ohmichi | 737a603 | 2015-01-21 07:04:42 +0000 | [diff] [blame] | 153 | # NOTE: Tempest uses timeout values of compute API if project specific |
| 154 | # timeout values don't exist. |
| 155 | default_params_with_timeout_values = { |
| 156 | 'build_interval': CONF.compute.build_interval, |
| 157 | 'build_timeout': CONF.compute.build_timeout |
| 158 | } |
| 159 | default_params_with_timeout_values.update(default_params) |
| 160 | |
Andrea Frittoli | c097835 | 2015-02-06 15:57:40 +0000 | [diff] [blame] | 161 | def __init__(self, credentials=None, service=None): |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 162 | super(Manager, self).__init__(credentials=credentials) |
Brant Knudson | c7ca334 | 2013-03-28 21:08:50 -0500 | [diff] [blame] | 163 | |
Ken'ichi Ohmichi | 80ec0b9 | 2015-01-16 06:43:10 +0000 | [diff] [blame] | 164 | self._set_compute_clients() |
ravikumar-venkatesan | 9e81b44 | 2014-12-08 09:57:56 +0000 | [diff] [blame] | 165 | self._set_database_clients() |
Ken'ichi Ohmichi | 80ec0b9 | 2015-01-16 06:43:10 +0000 | [diff] [blame] | 166 | self._set_identity_clients() |
| 167 | self._set_volume_clients() |
Ken'ichi Ohmichi | c95eb85 | 2015-01-22 01:57:57 +0000 | [diff] [blame] | 168 | self._set_object_storage_clients() |
Ken'ichi Ohmichi | cd4a51e | 2014-11-13 07:25:33 +0000 | [diff] [blame] | 169 | |
Ken'ichi Ohmichi | 1f88ece | 2015-01-23 03:33:11 +0000 | [diff] [blame] | 170 | self.baremetal_client = BaremetalClientJSON( |
| 171 | self.auth_provider, |
| 172 | CONF.baremetal.catalog_type, |
| 173 | CONF.identity.region, |
| 174 | endpoint_type=CONF.baremetal.endpoint_type, |
| 175 | **self.default_params_with_timeout_values) |
Ken'ichi Ohmichi | a182e86 | 2015-01-21 01:16:37 +0000 | [diff] [blame] | 176 | self.network_client = NetworkClientJSON( |
| 177 | self.auth_provider, |
| 178 | CONF.network.catalog_type, |
| 179 | CONF.network.region or CONF.identity.region, |
| 180 | endpoint_type=CONF.network.endpoint_type, |
| 181 | build_interval=CONF.network.build_interval, |
| 182 | build_timeout=CONF.network.build_timeout, |
| 183 | **self.default_params) |
Ken'ichi Ohmichi | 2183a65 | 2015-01-22 05:00:20 +0000 | [diff] [blame] | 184 | self.messaging_client = MessagingClientJSON( |
| 185 | self.auth_provider, |
| 186 | CONF.messaging.catalog_type, |
| 187 | CONF.identity.region, |
| 188 | **self.default_params_with_timeout_values) |
Sean Dague | f3c7591 | 2014-11-24 11:45:11 -0500 | [diff] [blame] | 189 | if CONF.service_available.ceilometer: |
| 190 | self.telemetry_client = TelemetryClientJSON( |
Ken'ichi Ohmichi | d5dba1c | 2015-01-23 02:23:22 +0000 | [diff] [blame] | 191 | self.auth_provider, |
| 192 | CONF.telemetry.catalog_type, |
| 193 | CONF.identity.region, |
| 194 | endpoint_type=CONF.telemetry.endpoint_type, |
| 195 | **self.default_params_with_timeout_values) |
Sean Dague | 86bd842 | 2013-12-20 09:56:44 -0500 | [diff] [blame] | 196 | if CONF.service_available.glance: |
Masayuki Igawa | bc7e189 | 2015-03-03 11:46:48 +0900 | [diff] [blame^] | 197 | self.image_client = ImageClientJSON( |
| 198 | self.auth_provider, |
| 199 | CONF.image.catalog_type, |
| 200 | CONF.image.region or CONF.identity.region, |
| 201 | endpoint_type=CONF.image.endpoint_type, |
| 202 | build_interval=CONF.image.build_interval, |
| 203 | build_timeout=CONF.image.build_timeout, |
| 204 | **self.default_params) |
| 205 | self.image_client_v2 = ImageClientV2JSON( |
| 206 | self.auth_provider, |
| 207 | CONF.image.catalog_type, |
| 208 | CONF.image.region or CONF.identity.region, |
| 209 | endpoint_type=CONF.image.endpoint_type, |
| 210 | build_interval=CONF.image.build_interval, |
| 211 | build_timeout=CONF.image.build_timeout, |
| 212 | **self.default_params) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 213 | self.orchestration_client = OrchestrationClient( |
Ken'ichi Ohmichi | c2b11ce | 2015-01-16 07:17:29 +0000 | [diff] [blame] | 214 | self.auth_provider, |
| 215 | CONF.orchestration.catalog_type, |
| 216 | CONF.orchestration.region or CONF.identity.region, |
| 217 | endpoint_type=CONF.orchestration.endpoint_type, |
| 218 | build_interval=CONF.orchestration.build_interval, |
| 219 | build_timeout=CONF.orchestration.build_timeout, |
| 220 | **self.default_params) |
Ken'ichi Ohmichi | 4e83b5e | 2015-02-13 04:07:34 +0000 | [diff] [blame] | 221 | self.data_processing_client = DataProcessingClient( |
| 222 | self.auth_provider, |
| 223 | CONF.data_processing.catalog_type, |
| 224 | CONF.identity.region, |
| 225 | endpoint_type=CONF.data_processing.endpoint_type, |
| 226 | **self.default_params_with_timeout_values) |
Ken'ichi Ohmichi | b38eb00 | 2015-01-23 02:35:01 +0000 | [diff] [blame] | 227 | self.negative_client = negative_rest_client.NegativeRestClient( |
| 228 | self.auth_provider, service) |
Ken'ichi Ohmichi | c2b11ce | 2015-01-16 07:17:29 +0000 | [diff] [blame] | 229 | |
Ken'ichi Ohmichi | b38eb00 | 2015-01-23 02:35:01 +0000 | [diff] [blame] | 230 | # TODO(andreaf) EC2 client still do their auth, v2 only |
| 231 | ec2_client_args = (self.credentials.username, |
| 232 | self.credentials.password, |
| 233 | CONF.identity.uri, |
| 234 | self.credentials.tenant_name) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 235 | self.ec2api_client = botoclients.APIClientEC2(*ec2_client_args) |
| 236 | self.s3_client = botoclients.ObjectClientS3(*ec2_client_args) |
Jay Pipes | 5067728 | 2012-01-06 15:39:20 -0500 | [diff] [blame] | 237 | |
Ken'ichi Ohmichi | 80ec0b9 | 2015-01-16 06:43:10 +0000 | [diff] [blame] | 238 | def _set_compute_clients(self): |
Ken'ichi Ohmichi | 4771cbc | 2015-01-19 23:45:23 +0000 | [diff] [blame] | 239 | params = { |
| 240 | 'service': CONF.compute.catalog_type, |
| 241 | 'region': CONF.compute.region or CONF.identity.region, |
| 242 | 'endpoint_type': CONF.compute.endpoint_type, |
| 243 | 'build_interval': CONF.compute.build_interval, |
| 244 | 'build_timeout': CONF.compute.build_timeout |
| 245 | } |
| 246 | params.update(self.default_params) |
| 247 | |
| 248 | self.agents_client = AgentsClientJSON(self.auth_provider, **params) |
| 249 | self.networks_client = NetworksClientJSON(self.auth_provider, **params) |
| 250 | self.migrations_client = MigrationsClientJSON(self.auth_provider, |
| 251 | **params) |
Ken'ichi Ohmichi | 65225ef | 2014-11-19 01:06:25 +0000 | [diff] [blame] | 252 | self.security_group_default_rules_client = ( |
Ken'ichi Ohmichi | 4771cbc | 2015-01-19 23:45:23 +0000 | [diff] [blame] | 253 | SecurityGroupDefaultRulesClientJSON(self.auth_provider, **params)) |
| 254 | self.certificates_client = CertificatesClientJSON(self.auth_provider, |
| 255 | **params) |
| 256 | self.servers_client = ServersClientJSON(self.auth_provider, **params) |
| 257 | self.limits_client = LimitsClientJSON(self.auth_provider, **params) |
| 258 | self.images_client = ImagesClientJSON(self.auth_provider, **params) |
| 259 | self.keypairs_client = KeyPairsClientJSON(self.auth_provider, **params) |
| 260 | self.quotas_client = QuotasClientJSON(self.auth_provider, **params) |
| 261 | self.quota_classes_client = QuotaClassesClientJSON(self.auth_provider, |
| 262 | **params) |
| 263 | self.flavors_client = FlavorsClientJSON(self.auth_provider, **params) |
| 264 | self.extensions_client = ExtensionsClientJSON(self.auth_provider, |
| 265 | **params) |
| 266 | self.floating_ips_client = FloatingIPsClientJSON(self.auth_provider, |
| 267 | **params) |
Ken'ichi Ohmichi | cd4a51e | 2014-11-13 07:25:33 +0000 | [diff] [blame] | 268 | self.security_groups_client = SecurityGroupsClientJSON( |
Ken'ichi Ohmichi | 4771cbc | 2015-01-19 23:45:23 +0000 | [diff] [blame] | 269 | self.auth_provider, **params) |
| 270 | self.interfaces_client = InterfacesClientJSON(self.auth_provider, |
| 271 | **params) |
| 272 | self.fixed_ips_client = FixedIPsClientJSON(self.auth_provider, |
| 273 | **params) |
Ken'ichi Ohmichi | cd4a51e | 2014-11-13 07:25:33 +0000 | [diff] [blame] | 274 | self.availability_zone_client = AvailabilityZoneClientJSON( |
Ken'ichi Ohmichi | 4771cbc | 2015-01-19 23:45:23 +0000 | [diff] [blame] | 275 | self.auth_provider, **params) |
| 276 | self.aggregates_client = AggregatesClientJSON(self.auth_provider, |
| 277 | **params) |
| 278 | self.services_client = ServicesClientJSON(self.auth_provider, **params) |
| 279 | self.tenant_usages_client = TenantUsagesClientJSON(self.auth_provider, |
| 280 | **params) |
| 281 | self.hosts_client = HostsClientJSON(self.auth_provider, **params) |
| 282 | self.hypervisor_client = HypervisorClientJSON(self.auth_provider, |
| 283 | **params) |
Ken'ichi Ohmichi | cd4a51e | 2014-11-13 07:25:33 +0000 | [diff] [blame] | 284 | self.instance_usages_audit_log_client = \ |
Ken'ichi Ohmichi | 4771cbc | 2015-01-19 23:45:23 +0000 | [diff] [blame] | 285 | InstanceUsagesAuditLogClientJSON(self.auth_provider, **params) |
Ken'ichi Ohmichi | c3dfdb2 | 2015-01-22 04:39:58 +0000 | [diff] [blame] | 286 | self.tenant_networks_client = \ |
| 287 | TenantNetworksClientJSON(self.auth_provider, **params) |
YuikoTakada | ac0879a | 2015-01-22 02:40:03 +0000 | [diff] [blame] | 288 | self.baremetal_nodes_client = BaremetalNodesClientJSON( |
| 289 | self.auth_provider, **params) |
Ken'ichi Ohmichi | 4771cbc | 2015-01-19 23:45:23 +0000 | [diff] [blame] | 290 | |
| 291 | # NOTE: The following client needs special timeout values because |
| 292 | # the API is a proxy for the other component. |
| 293 | params_volume = copy.deepcopy(params) |
| 294 | params_volume.update({ |
| 295 | 'build_interval': CONF.volume.build_interval, |
| 296 | 'build_timeout': CONF.volume.build_timeout |
| 297 | }) |
| 298 | self.volumes_extensions_client = VolumesExtensionsClientJSON( |
| 299 | self.auth_provider, **params_volume) |
Ken'ichi Ohmichi | cd4a51e | 2014-11-13 07:25:33 +0000 | [diff] [blame] | 300 | |
ravikumar-venkatesan | 9e81b44 | 2014-12-08 09:57:56 +0000 | [diff] [blame] | 301 | def _set_database_clients(self): |
| 302 | self.database_flavors_client = DatabaseFlavorsClientJSON( |
| 303 | self.auth_provider, |
| 304 | CONF.database.catalog_type, |
| 305 | CONF.identity.region, |
| 306 | **self.default_params_with_timeout_values) |
| 307 | self.database_limits_client = DatabaseLimitsClientJSON( |
| 308 | self.auth_provider, |
| 309 | CONF.database.catalog_type, |
| 310 | CONF.identity.region, |
| 311 | **self.default_params_with_timeout_values) |
| 312 | self.database_versions_client = DatabaseVersionsClientJSON( |
| 313 | self.auth_provider, |
| 314 | CONF.database.catalog_type, |
| 315 | CONF.identity.region, |
| 316 | **self.default_params_with_timeout_values) |
| 317 | |
Ken'ichi Ohmichi | 80ec0b9 | 2015-01-16 06:43:10 +0000 | [diff] [blame] | 318 | def _set_identity_clients(self): |
ghanshyam | d26b5cd | 2015-02-09 14:48:58 +0900 | [diff] [blame] | 319 | params = { |
| 320 | 'service': CONF.identity.catalog_type, |
| 321 | 'region': CONF.identity.region, |
| 322 | 'endpoint_type': 'adminURL' |
| 323 | } |
| 324 | params.update(self.default_params_with_timeout_values) |
| 325 | |
| 326 | self.identity_client = IdentityClientJSON(self.auth_provider, |
| 327 | **params) |
| 328 | self.identity_v3_client = IdentityV3ClientJSON(self.auth_provider, |
| 329 | **params) |
| 330 | self.endpoints_client = EndPointClientJSON(self.auth_provider, |
| 331 | **params) |
| 332 | self.service_client = ServiceClientJSON(self.auth_provider, **params) |
| 333 | self.policy_client = PolicyClientJSON(self.auth_provider, **params) |
| 334 | self.region_client = RegionClientJSON(self.auth_provider, **params) |
| 335 | self.credentials_client = CredentialsClientJSON(self.auth_provider, |
| 336 | **params) |
Andrea Frittoli | 9001235 | 2015-02-25 21:58:02 +0000 | [diff] [blame] | 337 | # Token clients do not use the catalog. They only need default_params. |
| 338 | self.token_client = TokenClientJSON(CONF.identity.uri, |
| 339 | **self.default_params) |
Ken'ichi Ohmichi | 41951b0 | 2014-11-19 01:57:43 +0000 | [diff] [blame] | 340 | if CONF.identity_feature_enabled.api_v3: |
Andrea Frittoli | 9001235 | 2015-02-25 21:58:02 +0000 | [diff] [blame] | 341 | self.token_v3_client = V3TokenClientJSON(CONF.identity.uri_v3, |
| 342 | **self.default_params) |
Ken'ichi Ohmichi | 41951b0 | 2014-11-19 01:57:43 +0000 | [diff] [blame] | 343 | |
Ken'ichi Ohmichi | 80ec0b9 | 2015-01-16 06:43:10 +0000 | [diff] [blame] | 344 | def _set_volume_clients(self): |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 345 | params = { |
| 346 | 'service': CONF.volume.catalog_type, |
| 347 | 'region': CONF.volume.region or CONF.identity.region, |
| 348 | 'endpoint_type': CONF.volume.endpoint_type, |
| 349 | 'build_interval': CONF.volume.build_interval, |
| 350 | 'build_timeout': CONF.volume.build_timeout |
| 351 | } |
| 352 | params.update(self.default_params) |
| 353 | |
| 354 | self.volume_qos_client = QosSpecsClientJSON(self.auth_provider, |
| 355 | **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 356 | self.volume_qos_v2_client = QosSpecsV2ClientJSON( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 357 | self.auth_provider, **params) |
jun xie | 9f12382 | 2014-11-20 14:21:23 +0800 | [diff] [blame] | 358 | self.volume_services_v2_client = VolumesServicesV2ClientJSON( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 359 | self.auth_provider, **params) |
| 360 | self.backups_client = BackupsClientJSON(self.auth_provider, **params) |
| 361 | self.backups_v2_client = BackupsClientV2JSON(self.auth_provider, |
| 362 | **params) |
| 363 | self.snapshots_client = SnapshotsClientJSON(self.auth_provider, |
| 364 | **params) |
| 365 | self.snapshots_v2_client = SnapshotsV2ClientJSON(self.auth_provider, |
| 366 | **params) |
Ken'ichi Ohmichi | 234da80 | 2015-02-13 04:48:06 +0000 | [diff] [blame] | 367 | self.volumes_client = VolumesClientJSON( |
| 368 | self.auth_provider, default_volume_size=CONF.volume.volume_size, |
| 369 | **params) |
| 370 | self.volumes_v2_client = VolumesV2ClientJSON( |
| 371 | self.auth_provider, default_volume_size=CONF.volume.volume_size, |
| 372 | **params) |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 373 | self.volume_types_client = VolumeTypesClientJSON(self.auth_provider, |
| 374 | **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 375 | self.volume_services_client = VolumesServicesClientJSON( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 376 | self.auth_provider, **params) |
| 377 | self.volume_hosts_client = VolumeHostsClientJSON(self.auth_provider, |
| 378 | **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 379 | self.volume_hosts_v2_client = VolumeHostsV2ClientJSON( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 380 | self.auth_provider, **params) |
| 381 | self.volume_quotas_client = VolumeQuotasClientJSON(self.auth_provider, |
| 382 | **params) |
| 383 | self.volume_quotas_v2_client = VolumeQuotasV2Client(self.auth_provider, |
| 384 | **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 385 | self.volumes_extension_client = VolumeExtensionClientJSON( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 386 | self.auth_provider, **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 387 | self.volumes_v2_extension_client = VolumeV2ExtensionClientJSON( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 388 | self.auth_provider, **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 389 | self.volume_availability_zone_client = \ |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 390 | VolumeAvailabilityZoneClientJSON(self.auth_provider, **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 391 | self.volume_v2_availability_zone_client = \ |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 392 | VolumeV2AvailabilityZoneClientJSON(self.auth_provider, **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 393 | self.volume_types_v2_client = VolumeTypesV2ClientJSON( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 394 | self.auth_provider, **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 395 | |
Ken'ichi Ohmichi | c95eb85 | 2015-01-22 01:57:57 +0000 | [diff] [blame] | 396 | def _set_object_storage_clients(self): |
Ken'ichi Ohmichi | 564b2ad | 2015-01-22 02:08:59 +0000 | [diff] [blame] | 397 | params = { |
| 398 | 'service': CONF.object_storage.catalog_type, |
| 399 | 'region': CONF.object_storage.region or CONF.identity.region, |
| 400 | 'endpoint_type': CONF.object_storage.endpoint_type |
| 401 | } |
| 402 | params.update(self.default_params_with_timeout_values) |
| 403 | |
| 404 | self.account_client = AccountClient(self.auth_provider, **params) |
| 405 | self.container_client = ContainerClient(self.auth_provider, **params) |
| 406 | self.object_client = ObjectClient(self.auth_provider, **params) |
Ken'ichi Ohmichi | c95eb85 | 2015-01-22 01:57:57 +0000 | [diff] [blame] | 407 | |
Jay Pipes | 5067728 | 2012-01-06 15:39:20 -0500 | [diff] [blame] | 408 | |
Jay Pipes | ff10d55 | 2012-04-06 14:18:50 -0400 | [diff] [blame] | 409 | class AdminManager(Manager): |
| 410 | |
| 411 | """ |
Attila Fazekas | cadcb1f | 2013-01-21 23:10:53 +0100 | [diff] [blame] | 412 | Manager object that uses the admin credentials for its |
Jay Pipes | ff10d55 | 2012-04-06 14:18:50 -0400 | [diff] [blame] | 413 | managed client objects |
| 414 | """ |
| 415 | |
Andrea Frittoli | c097835 | 2015-02-06 15:57:40 +0000 | [diff] [blame] | 416 | def __init__(self, service=None): |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 417 | super(AdminManager, self).__init__( |
Andrea Frittoli | 9efbe95 | 2015-01-29 12:43:09 +0000 | [diff] [blame] | 418 | credentials=cred_provider.get_configured_credentials( |
| 419 | 'identity_admin'), |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 420 | service=service) |