Validate flavor specification in config

Validate that at least one of min-ram or flavor-name are present.

Change-Id: I2e42b0d6176e5a15e1ceb2a77b9d557bc0704d50
This commit is contained in:
James E. Blair 2017-03-30 08:42:59 -07:00
parent 9b7d8587a4
commit 02d137a777
1 changed files with 9 additions and 1 deletions

View File

@ -24,13 +24,21 @@ class ConfigValidator:
self.config_file = config_file
def validate(self):
pool_label = {
label_min_ram = v.Schema({v.Required('min-ram'): int}, extra=True)
label_flavor_name = v.Schema({v.Required('flavor-name'): str},
extra=True)
pool_label_main = {
v.Required('name'): str,
v.Required('diskimage'): str,
'min-ram': int,
'flavor-name': str,
}
pool_label = v.All(pool_label_main,
v.Any(label_min_ram, label_flavor_name))
pool = {
'name': str,
'networks': [str],