Fix check for api_versions ctx at required_services
``required_services`` validator should not check services which are configured via ``api_versions@openstack`` context since the proper validation is done at the context itself. The inner check for ``api_versions@openstack`` in ``required_services`` checked only ``api_versions@openstack``, but ``api_versions`` string is also valid name for the context (if there is no other ``api_versions`` contexts for other platforms, but the case of name conflict is covered by another check). Also, this patch moves several imports inside validators to reduce cost of discovering plugins. Change-Id: I70af451d33ad8f11ab1ee0df0e18a93d045cf195
This commit is contained in:
parent
367b14102f
commit
de10af53dc
@ -26,6 +26,18 @@ Added
|
||||
* [scenario plugin] GnocchiMetric.create_metric
|
||||
* [scenario plugin] GnocchiMetric.create_delete_metric
|
||||
|
||||
Fixed
|
||||
~~~~~
|
||||
|
||||
* ``required_services`` validator should not check services which are
|
||||
configured via ``api_versions@openstack`` context since the proper validation
|
||||
is done at the context itself.
|
||||
The inner check for ``api_versions@openstack`` in ``required_services``
|
||||
checked only ``api_versions@openstack``, but ``api_versions`` string is also
|
||||
valid name for the context (if there is no other ``api_versions`` contexts
|
||||
for other platforms, but the case of name conflict is covered by another
|
||||
check).
|
||||
|
||||
[1.0.0] - 2018-03-28
|
||||
--------------------
|
||||
Start a fork of `rally/plugins/openstack module of original OpenStack Rally
|
||||
|
@ -18,8 +18,7 @@ import os
|
||||
import re
|
||||
import six
|
||||
|
||||
from glanceclient import exc as glance_exc
|
||||
from novaclient import exceptions as nova_exc
|
||||
|
||||
from rally.common import logging
|
||||
from rally.common import validation
|
||||
from rally.common import yamlutils as yaml
|
||||
@ -76,6 +75,8 @@ class ImageExistsValidator(validation.Validator):
|
||||
@with_roles_ctx()
|
||||
def validate(self, context, config, plugin_cls, plugin_cfg):
|
||||
|
||||
from glanceclient import exc as glance_exc
|
||||
|
||||
image_args = config.get("args", {}).get(self.param_name)
|
||||
|
||||
if not image_args and self.nullable:
|
||||
@ -202,6 +203,9 @@ class FlavorExistsValidator(validation.Validator):
|
||||
return flavor
|
||||
|
||||
def _get_validated_flavor(self, config, clients, param_name):
|
||||
|
||||
from novaclient import exceptions as nova_exc
|
||||
|
||||
flavor_value = config.get("args", {}).get(param_name)
|
||||
if not flavor_value:
|
||||
self.fail("Parameter %s is not specified." % param_name)
|
||||
@ -252,6 +256,9 @@ class ImageValidOnFlavorValidator(FlavorExistsValidator):
|
||||
self.validate_disk = validate_disk
|
||||
|
||||
def _get_validated_image(self, config, clients, param_name):
|
||||
|
||||
from glanceclient import exc as glance_exc
|
||||
|
||||
image_context = config.get("contexts", {}).get("images", {})
|
||||
image_args = config.get("args", {}).get(param_name)
|
||||
image_ctx_name = image_context.get("image_name")
|
||||
@ -414,11 +421,16 @@ class RequiredServicesValidator(validation.Validator):
|
||||
"a long time and latest novaclient doesn't support "
|
||||
"it, so we too.")
|
||||
|
||||
if "api_versions" in config.get("contexts", {}):
|
||||
api_versions = config["contexts"]["api_versions"]
|
||||
else:
|
||||
api_versions = config.get("contexts", {}).get(
|
||||
"api_versions@openstack", {})
|
||||
|
||||
for service in self.services:
|
||||
# NOTE(andreykurilin): validator should ignore services configured
|
||||
# via context(a proper validation should be in context)
|
||||
service_config = config.get("contexts", {}).get(
|
||||
"api_versions@openstack", {}).get(service, {})
|
||||
service_config = api_versions.get(service, {})
|
||||
|
||||
if (service not in available_services and
|
||||
not ("service_type" in service_config or
|
||||
|
Loading…
x
Reference in New Issue
Block a user