This work is licensed under a Creative Commons Attribution 3.0 Unported
License.
http://creativecommons.org/licenses/by/3.0/legalcode
添加一个配置文件验证工具¶
https://blueprints.launchpad.net/tempest/+spec/config-verification
添加一个新的 tempest 工具,它将查询服务的 API 以检查配置选项是否设置正确。
问题描述¶
tempest 配置文件包含大量选项,并且数量还在不断增加。此外,有些选项并不容易完全设置。例如,api 扩展选项要么全部启用,要么是所有已启用扩展的列表。大多数服务都支持发现我们配置文件中使用的几乎所有选项。
提议的变更¶
编写一个工具,它将使用现有的配置文件并验证所有设置是否与服务报告的已启用内容相匹配。它将首先读取配置文件,然后使用 tempest 客户端查询服务,以检查 api 版本、目录类型和扩展是否与服务报告的内容相匹配。它还将具有一个标志,用于使用服务报告的值覆盖配置文件。
这个新工具将添加到 tempest 树的根目录中的 tools/ 目录中,以及 tempest 中的其他辅助工具。
新工具的使用说明如下所示
usage: verify_tempest_config.py [-h] [-u] [-n]
optional arguments:
-h, --help show this help message and exit
-u, --update Update the config file with results from api queries. This
assumes whatever is set in the config file is incorrect. In
the case of endpoint checks where it could either be the
incorrect catalog type or the service available option the
service available option is assumed to be incorrect and is
thus changed. A copy of the original config file will be
created with .orig appended to the filename.
-n, --nocopy Don't create a copy of original config file when running
with the update option.
为了测试该工具的功能,将添加单元测试来验证验证功能和配置文件更新是否按预期工作。
替代方案¶
另一种选择是创建一个直接生成配置文件的工具,但是这存在先有鸡先有蛋的问题。如果您想使用功能发现自动配置 tempest,您需要有权与服务通信的身份验证,而身份验证是配置文件的一部分。因此,与其拥有生成器和现有配置之间的混合体,不如拥有一个验证现有配置文件的工具,这将消除任何混淆。此外,提供一个选项来使用自动发现结果覆盖它,本质上将是一个配置文件生成器。
实现¶
负责人¶
Matthew Treinish <mtreinish@kortar.org>
里程碑¶
- 完成目标里程碑
Juno-1
工作项¶
添加基本的验证脚本
添加配置文件更新功能
添加配置验证功能的单元测试
添加配置文件更新功能的单元测试