cxwpf200 发表于 2018-6-1 09:36:00

openstack测试工具使用一

  rally 为openstack社区的性能测试工具,为大家所熟知。tempest为集成功能测试,和rally结合发挥各长。如果要了解rally和tempest的原理和框架,大家到官网看,写的很详细。这里只是记录下,本人的部署和使用的过程。如果能帮到大家,那就更开心了~~~
     准备服务器:
               hostname   A.local.test.net   10.10.0.2
                                B.local.test.net   10.10.0.3
  

  openstack环境准备
  

  这里主要有rdo做的all in one,部署在A.local.test.net
           1.环境准备
$ sudo yum install -y https://rdoproject.org/repos/rdo-release.rpm
$ sudo yum install -y centos-release-openstack-mitaka
$ sudo yum update -y  

           2.安装packstack

  

$ sudo yum install -y openstack-packstack            3.运行packstack

$ packstack --allinone  

   4.验证一下,openstack环境运行正常否,登陆url,创建虚机。能正常创建虚机,ok,那开始下一步吧
  

  

  rally部署和使用
  

        部署在B.local.test.net
  

         1.部署
  

$ wget -q -O- https://raw.githubusercontent.com/openstack/rally/master/install_rally.sh | bash  

         2.数据库初始化
$ rally-manage db recreate  

     3.注册openstack环境
               在rally 源码里找 existing.json(samples/deployments/existing.json)
           修改文件,写入我们已经部署好的openstack环境的keystone地址,user 和password
     
{
    "type": "ExistingCloud",
    "auth_url": "http://A.local.test.net:5000/v2.0/",
    "region_name": "RegionOne",
    "endpoint_type": "public",
    "admin": {
      "username": "admin",
      "password": "password",
      "tenant_name": "admin"
    },
}        
$ rally deployment create --file=existing.json --name=test-rally         4.deployment check 的命令可以让您验证当前的测试环境是否健康以及是否可以开始进行基准测试
  

  
$ rally deployment check            5.基准测试
              rally/samples/tasks/scenarios 目录下有很多的基准测试用例。支持yaml 和json格式
              测试一下创建删除虚机测试用例
  
$ rally task start samples/tasks/scenarios/nova/boot-and-delete.yaml  
    vim boot-and-delete.yaml
{% set flavor_name = flavor_name or "m1.tiny" %}   # flavor 默认值为m1.tiny
{% set image_name = image_name or "cirros" %}      # image 默认值为cirros
---
NovaServers.boot_and_delete_server:
    -
      args:
      flavor:
            name: "`flavor_name`"#flavor做变量
      image:
            name: "`image_name`"   # image 做变量
      force_delete: false
      runner:
      type: "constant"
      times: 10                  # 共操作10次
      concurrency: 2             # 并发2次
      context:
      users:
          tenants: 1               # 创建1个tenant
          users_per_tenant: 1      # 每个tenant只创建一个user  

              测试完成会提示:
        
HINTS:
* To plot HTML graphics with this data, run:
    rally task plot2html 6fd9a19f-5cf8-4f76-ab72-2e34bb1d4996 --out output.html
* To get raw JSON output of task results, run:
    rally task results 6fd9a19f-5cf8-4f76-ab72-2e34bb1d4996
Using task: 6fd9a19f-5cf8-4f76-ab72-2e34bb1d4996               6.查看report
                  生成htmlreport
  

$ rally task plot2html 6fd9a19f-5cf8-4f76-ab72-2e34bb1d4996 --out output.html                    在浏览器打开,看到详细的性能测试报告,如下:
     


  
页: [1]
查看完整版本: openstack测试工具使用一