blob: f56b475b3db79f12b474bca4de8c84020db6c907 [file] [log] [blame]
Matthew Treinish1f7b33d2013-10-21 18:07:02 +00001#!/usr/bin/env python
Matthew Treinish1f7b33d2013-10-21 18:07:02 +00002
3# Copyright 2013 IBM Corp.
4#
5# Licensed under the Apache License, Version 2.0 (the "License"); you may
6# not use this file except in compliance with the License. You may obtain
7# a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14# License for the specific language governing permissions and limitations
15# under the License.
16
17import sys
18
19from tempest import clients
20from tempest import config
21
22
Sean Dague86bd8422013-12-20 09:56:44 -050023CONF = config.CONF
Matthew Treinish1f7b33d2013-10-21 18:07:02 +000024
25#Dicts matching extension names to config options
26NOVA_EXTENSIONS = {
27 'disk_config': 'DiskConfig',
28 'change_password': 'ServerPassword',
29 'flavor_extra': 'FlavorExtraSpecs'
30}
31
32
Matthew Treinish99afd072013-10-22 18:03:06 +000033def verify_glance_api_versions(os):
34 # Check glance api versions
35 __, versions = os.image_client.get_versions()
36 if CONF.image_feature_enabled.api_v1 != ('v1.1' in versions or 'v1.0' in
37 versions):
Sean Dague6b447882013-12-02 11:09:58 -050038 print('Config option image api_v1 should be change to: %s' % (
39 not CONF.image_feature_enabled.api_v1))
Matthew Treinish99afd072013-10-22 18:03:06 +000040 if CONF.image_feature_enabled.api_v2 != ('v2.0' in versions):
Sean Dague6b447882013-12-02 11:09:58 -050041 print('Config option image api_v2 should be change to: %s' % (
42 not CONF.image_feature_enabled.api_v2))
Matthew Treinish99afd072013-10-22 18:03:06 +000043
44
Matthew Treinish1f7b33d2013-10-21 18:07:02 +000045def verify_extensions(os):
46 results = {}
47 extensions_client = os.extensions_client
48 __, resp = extensions_client.list_extensions()
49 resp = resp['extensions']
50 extensions = map(lambda x: x['name'], resp)
51 results['nova_features'] = {}
52 for extension in NOVA_EXTENSIONS.keys():
53 if NOVA_EXTENSIONS[extension] in extensions:
54 results['nova_features'][extension] = True
55 else:
56 results['nova_features'][extension] = False
57 return results
58
59
60def display_results(results):
61 for option in NOVA_EXTENSIONS.keys():
62 config_value = getattr(CONF.compute_feature_enabled, option)
63 if config_value != results['nova_features'][option]:
Sean Dague6b447882013-12-02 11:09:58 -050064 print("Config option: %s should be changed to: %s" % (
65 option, not config_value))
Matthew Treinish1f7b33d2013-10-21 18:07:02 +000066
67
68def main(argv):
69 os = clients.ComputeAdminManager(interface='json')
70 results = verify_extensions(os)
Matthew Treinish99afd072013-10-22 18:03:06 +000071 verify_glance_api_versions(os)
Matthew Treinish1f7b33d2013-10-21 18:07:02 +000072 display_results(results)
73
74
75if __name__ == "__main__":
76 main(sys.argv)