blob: 881a7b399e1922c9e87ea69e40b0eceb5f113972 [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
34def verify_extensions(os):
35 results = {}
36 extensions_client = os.extensions_client
37 __, resp = extensions_client.list_extensions()
38 resp = resp['extensions']
39 extensions = map(lambda x: x['name'], resp)
40 results['nova_features'] = {}
41 for extension in NOVA_EXTENSIONS.keys():
42 if NOVA_EXTENSIONS[extension] in extensions:
43 results['nova_features'][extension] = True
44 else:
45 results['nova_features'][extension] = False
46 return results
47
48
49def display_results(results):
50 for option in NOVA_EXTENSIONS.keys():
51 config_value = getattr(CONF.compute_feature_enabled, option)
52 if config_value != results['nova_features'][option]:
53 print "Config option: %s should be changed to: %s" % (
54 option, not config_value)
55
56
57def main(argv):
58 os = clients.ComputeAdminManager(interface='json')
59 results = verify_extensions(os)
60 display_results(results)
61
62
63if __name__ == "__main__":
64 main(sys.argv)