Make config validation in common way

Registered by Sergey Skripnick

Each engine and provider can have property CONFIG_SCHEMA. Validation can be done in base constructor by calling validate method. Validate method can be overrided if needed.

 class EngineFactory(object):
  def __init__(self, task, config):
   self.validate(config)
   self.task = task
   self.config = config

 def validate(config):
   jsonschema.validate(self.CONFIG_SCHEMA, config)
   if somethingwrong:
    raise exceptions.ConfigValidationError()

 class SomeEngine(EngineFactory):
  CONFIG_SCHEMA = {'some': 'schema'}
  def __init__(self, task, config):
   super (SomeEngine, self).__init__()
   do_own_init()

 class SomeEngineWithComplexValidation(EngineFactory):
  def validate(config):
   do_complex_validation()

The same for Provider

Also rally.exceptions.ConfigValidationError exception should be added.

Blueprint information

Status:
Complete
Approver:
Boris Pavlovic
Priority:
Medium
Drafter:
Sergey Skripnick
Direction:
Approved
Assignee:
Sergey Skripnick
Definition:
Approved
Series goal:
None
Implementation:
Implemented
Milestone target:
None
Started by
Sergey Skripnick
Completed by
Boris Pavlovic

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/common-config-validation,n,z

Addressed by: https://review.openstack.org/57222
    Add common config validation to EngineFactory

Addressed by: https://review.openstack.org/57226
    Add CONFIG_SCHEMA to devstack engine

Addressed by: https://review.openstack.org/57239
    Add CONFIG_SCHEMA to DummyEngine

Addressed by: https://review.openstack.org/60030
    Add common config validation to ProviderFactory

Addressed by: https://review.openstack.org/60275
    Add CONFIG_SCHEMA to openstack provider

Addressed by: https://review.openstack.org/61836
    Add CONFIG_SCHEMA to dummy provider

Addressed by: https://review.openstack.org/62338
    Add CONFIG_SCHEMA to virsh provider

(?)

Work Items

Work items:
[eyerediskin] common validation in deploy engines: DONE
[miarmak] common validation in providers: DONE

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.