通过 Rally 进行 OpenStack Tempest 测试

Rally 是OpenStack社区推出开源测试工具,可用于对OpenStack各个组件进行性能测试。通过使用Rally组件,用户可完成OpenStack云计算平台的安装部署、功能验证、大规模负载测试(性能测试)、输出测试报告等一系列动作。
Rally 的概况和结构如下图所示:

image


Rally 主要包括三大部分:

Deploy engine:这不是一个真的部署工具,它只是一个插件形式的东西,它可以和其他部署工具(比如 DevStack,Fuel,Anvil 等)一起工作来简化和统一部署流程。

Verification:使用tempest验证已经部署的openstack云环境的功能。

Benchmark engine:性能测试

Tempest 基本介绍

Tempest 是一个旨在为云计算平台 OpenStack 提供集成功能测试的开源项目,包含了 Openstack 基本组件(nova, keystone, glance, neutron, cinder 等)的 API 测试用例与场景。它是基于 unittest2 和 nose 建立的,灵活且易于扩展及维护,使得 OpenStack 相关测试效率得到大幅度提升。

安装 Rally

安装依赖包

# yum install python-pip lsb_release gcc gmp-devel libffi-devel libxml2-devel libxslt-devel openssl-devel postgresql-devel python-devel RedHat-rpm-config

安装 rally 最简单的方法就是使用下面的安装脚本

wget -q -O- https://raw.githubusercontent.com/openstack/rally/master/install_rally.sh | bash # or using curl: curl https://raw.githubusercontent.com/openstack/rally/master/install_rally.sh | bash

如果用普通用户执行脚本,Rally 会在 ==~/rally/== 下创建一个新的虚拟环境并安装在这里,使用 sqlite作为数据库后端。如果使用 root 用户执行脚本,Rally 会安装在系统路径,更多的安装选项,可以参考。

Rally 配置

创建 openstack 环境变量文件,加入以下内容,注意修改用户名、密码、认证地址、region_name 等内容。

# vim admin-openrc unset OS_SERVICE_TOKEN export OS_USERNAME=admin export OS_PASSWORD=admin export OS_AUTH_URL=http://192.168.3.222:5000/v3 export OS_PROJECT_NAME=admin export OS_USER_DOMAIN_NAME=default export OS_PROJECT_DOMAIN_NAME=Default export OS_IDENTITY_API_VERSION=3 export OS_REGION_NAME=RegionOne

加载环境变量

# . admin-openrc

注册一个 Openstack deployment,注册成功后,将会默认使用这个 deployment,同时在主目录下会有一个新的目录出现:.rally。

# rally deployment create --fromenv --name=openstack 2017-07-31 15:44:12.509 20293 INFO rally.deployment.engines.existing [-] Save deployment 'openstack' (uuid=3403b234-76ae-4afb-9d96-49ef2d872069) with 'openstack' platform. +--------------------------------------+---------------------+-----------+------------------+--------+ | uuid | created_at | name | status | active | +--------------------------------------+---------------------+-----------+------------------+--------+ | 3403b234-76ae-4afb-9d96-49ef2d872069 | 2017-07-31T07:44:12 | openstack | deploy->finished | | +--------------------------------------+---------------------+-----------+------------------+--------+ Using deployment: 3403b234-76ae-4afb-9d96-49ef2d872069 ~/.rally/openrc was updated HINTS: * To use standard OpenStack clients, set up your env by running: source ~/.rally/openrc OpenStack clients are now configured, e.g run: openstack image list

检查一下刚注册的 deployment 是否存在。

# rally deployment list +--------------------------------------+---------------------+-----------+------------------+--------+ | uuid | created_at | name | status | active | +--------------------------------------+---------------------+-----------+------------------+--------+ | 3403b234-76ae-4afb-9d96-49ef2d872069 | 2017-07-31T07:44:12 | openstack | deploy->finished | * | +--------------------------------------+---------------------+-----------+------------------+--------+

检查 deployment 是否可行

# rally deployment check -------------------------------------------------------------------------------- Platform openstack: -------------------------------------------------------------------------------- Available services: +-------------+----------------+-----------+ | Service | Service Type | Status | +-------------+----------------+-----------+ | __unknown__ | alarming | Available | | __unknown__ | compute_legacy | Available | | __unknown__ | event | Available | | __unknown__ | placement | Available | | __unknown__ | volumev2 | Available | | __unknown__ | volumev3 | Available | | cinder | volume | Available | | glance | image | Available | | gnocchi | metric | Available | | keystone | identity | Available | | neutron | network | Available | | nova | compute | Available | +-------------+----------------+-----------+

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/879a9373c9e4a39229beb1a316b85964.html