1,下載
git clone git://git.openstack.org/openstack/rally
或者
git clone https://git.openstack.org/openstack/rally
2,安裝虛擬機環境
備注:必須是python2.7或者python3.4
pip install virtualenv
virtualenv rally_env
source rally_env/bin/activate
3,配置豆瓣源
[root@control01 ~]# mkdir -p ~/.pip
[root@control01 ~]# vi ~/.pip/pip.conf
[root@control01 ~]# cat ~/.pip/pip.conf
[global]
timeout=600
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com
[root@control01 ~]#
4,安裝
curl https://raw.githubusercontent.com/openstack/rally/master/install_rally.sh | bash
ERROR: Package 'more-itertools' requires a different Python: 2.7.5 not in '>=3.4'
解決辦法:
pip install more-itertools==5.0.0
安裝成功
==============================
Installation of Rally is done!
==============================
Rally is now installed in your system. Information about your Rally
installation:
* Method: system
* Database at: /var/lib/rally/database
* Configuration file at: /etc/rally
* Samples at: /usr/share/rally/samples
(rally_env) [root@control01 rally]#
5,查看版本
(rally_env) [root@control01 rally]# rally --version
Rally version: 2.0.1~dev5
6, 安裝 rally-openstack 插件
pip install rally-openstack
7,加載openstack的環境變量
(rally_env) [root@control01 rally]# source /etc/kolla/admin-openrc.sh
8,重建數據庫:
rally db recreate
9, 根據openstack的環境,創建一個deployment
(rally_env) [root@control01 rally]# rally deployment create --fromenv --name=openstack_p +--------------------------------------+----------------------------+-------------+------------------+--------+ | uuid | created_at | name | status | active | +--------------------------------------+----------------------------+-------------+------------------+--------+ | 504bcca4-7244-4420-b4a1-009aac216a11 | 2019-11-20T09:19:49.143418 | openstack_p | deploy->finished | | +--------------------------------------+----------------------------+-------------+------------------+--------+ Using deployment: 504bcca4-7244-4420-b4a1-009aac216a11 ~/.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 查看創建的deployent: (rally_env) [root@control01 rally]# rally deployment list +--------------------------------------+----------------------------+-------------+------------------+--------+ | uuid | created_at | name | status | active | +--------------------------------------+----------------------------+-------------+------------------+--------+ | 504bcca4-7244-4420-b4a1-009aac216a11 | 2019-11-20T09:19:49.143418 | openstack_p | deploy->finished | * | +--------------------------------------+----------------------------+-------------+------------------+--------+ (rally_env) [root@control01 rally]# 檢查一下deployment (rally_env) [root@control01 rally]# rally deployment check -------------------------------------------------------------------------------- Platform openstack: -------------------------------------------------------------------------------- Available services: +-------------+----------------+-----------+ | Service | Service Type | Status | +-------------+----------------+-----------+ | __unknown__ | compute_legacy | Available | | __unknown__ | placement | Available | | cinder | volume | Available | | cinder | volumev2 | Available | | cinder | volumev3 | Available | | glance | image | Available | | keystone | identity | Available | | neutron | network | Available | | nova | compute | Available | +-------------+----------------+-----------+ (rally_env) [root@control01 rally]#
10 簡單驗證
(rally_env) [root@control01 rally]# rally task start /usr/share/rally/samples/tasks/contexts/dummy-context.json
--------------------------------------------------------------------------------
Task b68be4ff-e2d8-4aac-9b5d-f013a599551e has 0 error(s)
--------------------------------------------------------------------------------
+----------------------------------------------------------------------------------------------------------------------+
| Response Times (sec) |
+-------------------+-----------+--------------+--------------+--------------+-----------+-----------+---------+-------+
| Action | Min (sec) | Median (sec) | 90%ile (sec) | 95%ile (sec) | Max (sec) | Avg (sec) | Success | Count |
+-------------------+-----------+--------------+--------------+--------------+-----------+-----------+---------+-------+
| foo | 0.1 | 0.1 | 0.1 | 0.1 | 0.1 | 0.1 | 100.0% | 4 |
| -> bar | 0.1 | 0.1 | 0.1 | 0.1 | 0.1 | 0.1 | 100.0% | 4 |
| total | 0.1 | 0.1 | 0.1 | 0.1 | 0.1 | 0.1 | 100.0% | 4 |
| -> duration | 0.1 | 0.1 | 0.1 | 0.1 | 0.1 | 0.1 | 100.0% | 4 |
| -> idle_duration | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0% | 4 |
+-------------------+-----------+--------------+--------------+--------------+-----------+-----------+---------+-------+
Load duration: 0.206922
Full duration: 0.274496
HINTS:
* To plot HTML graphics with this data, run:
rally task report b68be4ff-e2d8-4aac-9b5d-f013a599551e --out output.html
* To generate a JUnit report, run:
rally task export b68be4ff-e2d8-4aac-9b5d-f013a599551e --type junit-xml --to output.xml
* To get raw JSON output of task results, run:
rally task report b68be4ff-e2d8-4aac-9b5d-f013a599551e --json --out output.json
11 下載 rally-openstack 插件,查看相關的sample
(rally_env) [root@control01 ~]# git clone https://github.com/openstack/rally-openstack.git
Cloning into 'rally-openstack'...
remote: Enumerating objects: 88, done.
remote: Counting objects: 100% (88/88), done.
remote: Compressing objects: 100% (88/88), done.
remote: Total 34627 (delta 28), reused 60 (delta 0), pack-reused 34539
Receiving objects: 100% (34627/34627), 11.23 MiB | 255.00 KiB/s, done.
Resolving deltas: 100% (24402/24402), done.
[root@control01 tasks]# cd scenarios/
[root@control01 scenarios]# ls
authenticate ceilometer designate ec2 glance grafana ironic magnum mistral murano nova quotas requests senlin vm workload
barbican cinder dummy elasticsearch gnocchi heat keystone manila monasca neutron octavia README.rst sahara swift watcher zaqar
[root@control01 scenarios]# pwd
/root/rally-openstack/samples/tasks/scenarios
[root@control01 scenarios]# cd ec2/
[root@control01 ec2]# ls
boot.json boot.yaml list-servers.json list-servers.yaml
[root@control01 ec2]#
12 鏡像測試
---
GlanceImages.create_and_delete_image:
-
args:
image_location: "/root/rally-openstack/cirros-dianxin.vmdk"
container_format: "bare"
disk_format: "vmdk"
runner:
type: "constant"
times: 10
concurrency: 2
context:
users:
tenants: 2
users_per_tenant: 3
sla:
failure_rate:
max: 0
運行測試
(rally_env) [root@control01 glance]# rally task start create-and-delete-image.yaml
--------------------------------------------------------------------------------
Preparing input task
--------------------------------------------------------------------------------
Task is:
---
GlanceImages.create_and_delete_image:
-
args:
image_location: "/root/rally-openstack/cirros-dianxin.vmdk"
container_format: "bare"
disk_format: "vmdk"
runner:
type: "constant"
times: 10
concurrency: 2
context:
users:
tenants: 2
users_per_tenant: 3
sla:
failure_rate:
max: 0
Task syntax is correct :)
測試結果
Task 5fcf233d-b92a-4783-8298-c6f172836207 has 0 error(s)
--------------------------------------------------------------------------------
+---------------------------------------------------------------------------------------------------------------------------------+
| Response Times (sec) |
+------------------------------+-----------+--------------+--------------+--------------+-----------+-----------+---------+-------+
| Action | Min (sec) | Median (sec) | 90%ile (sec) | 95%ile (sec) | Max (sec) | Avg (sec) | Success | Count |
+------------------------------+-----------+--------------+--------------+--------------+-----------+-----------+---------+-------+
| glance_v2.create_image | 2.514 | 2.609 | 3.209 | 3.228 | 3.247 | 2.779 | 100.0% | 10 |
| -> glance_v2.get_image (x2) | 0.059 | 0.061 | 0.067 | 0.067 | 0.067 | 0.062 | 100.0% | 10 |
| -> glance_v2.upload_data | 0.255 | 0.285 | 0.32 | 0.325 | 0.33 | 0.286 | 100.0% | 10 |
| glance_v2.delete_image | 0.117 | 0.143 | 0.174 | 0.212 | 0.249 | 0.151 | 100.0% | 10 |
| total | 2.66 | 2.747 | 3.366 | 3.431 | 3.496 | 2.93 | 100.0% | 10 |
| -> duration | 2.66 | 2.747 | 3.366 | 3.431 | 3.496 | 2.93 | 100.0% | 10 |
| -> idle_duration | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0% | 10 |
+------------------------------+-----------+--------------+--------------+--------------+-----------+-----------+---------+------