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