Matthew Treinish | 1f7b33d | 2013-10-21 18:07:02 +0000 | [diff] [blame^] | 1 | #!/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 | |
| 18 | import sys |
| 19 | |
| 20 | from tempest import clients |
| 21 | from tempest import config |
| 22 | |
| 23 | |
| 24 | CONF = config.TempestConfig() |
| 25 | |
| 26 | #Dicts matching extension names to config options |
| 27 | NOVA_EXTENSIONS = { |
| 28 | 'disk_config': 'DiskConfig', |
| 29 | 'change_password': 'ServerPassword', |
| 30 | 'flavor_extra': 'FlavorExtraSpecs' |
| 31 | } |
| 32 | |
| 33 | |
| 34 | def 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 | |
| 49 | def 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 | |
| 57 | def main(argv): |
| 58 | os = clients.ComputeAdminManager(interface='json') |
| 59 | results = verify_extensions(os) |
| 60 | display_results(results) |
| 61 | |
| 62 | |
| 63 | if __name__ == "__main__": |
| 64 | main(sys.argv) |