注意點:在測試nova,在配置文件裏面若是不指定網絡id,那麼默認是外網的網絡(該網絡是共享的),若是想要指定網絡,那麼該網絡必須是共享的狀態,不然將會報錯:沒法發現網絡。若是測試多於50臺的虛擬機須要修改默認值,由於默認值是有限制的可用以下命令查看:html
[root@rally nova]# nova absolute-limits +-------------------------+---------+ | Name | Value | +-------------------------+---------+ | maxServerMeta | 128 | | maxPersonality | 100 | | maxImageMeta | 128 | | maxPersonalitySize | 10240 | | maxTotalRAMSize | 5120000 | | maxSecurityGroupRules | 20 | | maxTotalKeypairs | 100 | | totalRAMUsed | 58960 | | maxSecurityGroups | 10 | | totalFloatingIpsUsed | 0 | | totalInstancesUsed | 24 | | totalSecurityGroupsUsed | 1 | | maxTotalFloatingIps | 10 | | maxTotalInstances | 200 | | totalCoresUsed | 51 | | maxTotalCores | 500 | +-------------------------+---------+
修改默認值能夠在界面,管理員->默認值,進行修改;其次能夠在運行nova-api服務的節點上修改配置文件nova.confios
安裝rally:c++
[root@rally nova]#git clone https://github.com/openstack/rally.git
[root@rally rally]# /usr/bin/easy_install pip (安裝pip,有就不須要裝了)
[root@rally rally]# mkdir /root/.pip
[root@rally rally]# vim /root/.pip/pip.conf (設置pip源,加快安裝速度)
[global]
index-url=http://pypi.douban.com/simple
[root@rally nova]#pip install -U virtualenv 安裝虛擬環境(可裝可不裝,通常爲了系統的乾淨仍是裝個虛擬環境)
[root@rally nova]#virtualenv .venv
[root@rally nova]#. .venv/bin/activate
[root@rally nova]#yum install gcc-c++ (安裝編譯工具)
[root@rally nova]#cd rally
[root@rally rally]#./install_rally.sh
....
======================================================================
Information about your Rally installation:
* Method: system
* Database at: /var/lib/rally/database
* Configuration file at: /etc/rally
======================================================================git
安裝完成,數據庫的配置這裏暫時沒作。github
建立一個隨便命名的.json格式文件:數據庫
這是keystone版本爲v2
[root@rally rally]# cat existing.json { "type": "ExistingCloud", "auth_url": 'http://172.16.105.189:35357/v2.0/', "admin":{ "username": admin, "password": admin, "tenant_name": admin } }
keystone版本爲v3時用如下模板參考https://github.com/openstack/rally/blob/master/samples/deployments/existing-keystone-v3.json
[root@rally rally]# cat existing.json
{
"type": "ExistingCloud",
"auth_url": 'http://ip:5000/v3/',
"region_name": "RegionOne",
"endpoint_type": "public",
"admin":{
"username": "admin",
"password": "xxx",
"project_name": "admin",
"project_domain_name": "default",
"user_domain_name": "default"
}
}json
[root@rally rally]# rally deployment create --file=existing.json --name=existing
+--------------------------------------+----------------------------+----------+------------------+--------+
| uuid | created_at | name | status | active |
+--------------------------------------+----------------------------+----------+------------------+--------+
| 15ef811a-6460-407c-b391-c0f435f1ae54 | 2015-03-05 10:09:36.468176 | existing | deploy->finished | |
+--------------------------------------+----------------------------+----------+------------------+--------+
Using deployment: 15ef811a-6460-407c-b391-c0f435f1ae54vim
[root@rally rally]# rally deployment check
keystone endpoints are valid and following services are available:
+------------+-----------+-----------+
| services | type | status |
+------------+-----------+-----------+
| ceilometer | metering | Available |
| cinder | volume | Available |
| cinderv2 | volumev2 | Available |
| glance | image | Available |
| keystone | identity | Available |
| neutron | network | Available |
| nova | compute | Available |
| nova_ec2 | ec2 | Available |
| novav3 | computev3 | Available |
+------------+-----------+-----------+api
如此即可繼續往下進行OpenStack基準測試了。
舉個測試啓動虛擬機的例子:boot.json文件內容以下:網絡
doc/samples/tasks/scenarios/nova/boot.json
[root@rally nova]# cat boot.json { "NovaServers.boot_server": [ { "args": { "flavor": { "name": "m1.large" }, "image": { "name": "Windows_Server_2008R2_SP1_Standard_64bit" }, "nics":[{"net-id": "c7048568-c966-4d57-a927-90dd8830fb96"}],(默認是沒有這行的) }, "runner": { "type": "constant", "times": 100, (測試次數100) "concurrency": 2 (併發數) }, "context": { "users": { "tenants": 3, "users_per_tenant": 2 } } } ] }
[root@rally nova]# . /root/rally/.venv/bin/activate
[root@rally nova]# rally -v task start boot.json(/root/rally/doc/samples/tasks/scenarios/nova這是當前的目錄)
以上的圖是測試結果。
當經過rally deployment check檢查OpenStack的service狀態時,出現__unknown__,這是因爲keystone 的service catalog沒有返回service name而且rally沒法經過type識別service,但此時能夠利用rally plugin show api_version,來指定相應的api版本,舉個例子:
# In this example we will launch NovaKeypair.create_and_list_keypairs # scenario on 2.2 api version. { "NovaKeypair.create_and_list_keypairs": [ { "args": { "key_type": "x509" }, "runner": { "type": "constant", "times": 10, "concurrency": 2 }, "context": { "users": { "tenants": 3, "users_per_tenant": 2 }, "api_versions": { "nova": { "version": 2.2 } } } } ] }
相關連接:http://rally.readthedocs.org/en/latest/
https://rally.readthedocs.org/en/latest/tutorial/step_0_installation.html
https://rally.readthedocs.org/en/latest/tutorial/step_1_setting_up_env_and_running_benchmark_from_samples.html