1. 程式人生 > >jmeter3.2 測試openstack-kilo cinder 的rest api

jmeter3.2 測試openstack-kilo cinder 的rest api

jemeter openstack cinder api

1.參考


http://www.aboutyun.com/thread-12002-1-1.html

http://www.cnblogs.com/biangbiang/archive/2013/02/01/2888800.html

http://blog.csdn.net/nirendao/article/details/54977717

http://www.cnblogs.com/littlebugfish/p/4027061.html

http://blog.csdn.net/lifeifei2010/article/details/8148793

http://itfish.net/article/47307.html

http://blog.csdn.net/zhaoeryi/article/details/38980523?locationNum=6&fps=1http://blog.csdn.net/zhaoeryi/article/details/38980523?locationNum=6&fps=1

http://www.cnblogs.com/TingJie/articles/5198505.html


2.cinder api 測試

1》獲取token

curl -k -X ‘POST‘ -v http://192.168.1.76:5000/v2.0/tokens -d ‘{"auth":{"passwordCredentials":{"username": "admin", "password":"password"}, "tenantId":"82849a9c50604d62ab1c229ef0f7631e"}}‘ -H ‘Content-type: application/json‘

1.首先創建線程組

2.基本上每個接口涉及到poject_id,用戶可自定義變量

線程組-添加-配置元件-用戶自定義變量

技術分享

根據自己測試需求測試某個項目,就

技術分享

3.設置http請求默認值(輸入openstack管理系統的ip地址)

技術分享

4.設置http信息頭

a》先添加:線程組-添加-配置元件-http信息頭管理器

技術分享

b》添加:Content-Type: application/json

c》通過請求獲取到token的id,將其寫入

curl -k -X ‘POST‘ -v http://192.168.1.76:5000/v2.0/tokens -d ‘{"auth":{"passwordCredentials":{"username": "admin", "password":"password"}, "tenantId":"82849a9c50604d62ab1c229ef0f7631e"}}‘ -H ‘Content-type: application/json‘

技術分享

5.開始接口請求

a>.(前提openstack裏面有vm)獲取vms,為以後attach volume to vm or deatach volume from vm

技術分享

得到某個vm的id

技術分享

b》(前提openstack裏面有image)獲取img,為以後從img 創建volume

技術分享

得到某個img的id

技術分享

c》獲得所有項目(這個只是為了記住這個接口請求與cinder可以不寫這個借口)

技術分享

d》獲取volumes

簡單獲取

技術分享

詳細獲取

技術分享

e》創建卷

技術分享

得到創建卷的id

技術分享

{

"volume": {

"size": 1,

"availability_zone": null,

"source_volid": null,

"description": null,

"multiattach ": false,

"snapshot_id": null,

"name": "testlilac",

"imageRef": null,

"volume_type": null,

"metadata": {},

"consistencygroup_id": null

}

}

e》查看某個卷詳情

技術分享

f》擴容卷,由於創建卷有一個過程,之間得等待一些時間,可以添加定時器

技術分享

技術分享

用到了參數關聯

技術分享

{

"os-extend": {

"new_size": 10

}

}

g》卷創建快照(用了參數關聯)

技術分享

h》查看snap

列出

技術分享

詳細列出

技術分享

詳細列出某個

技術分享

i》從快照創建卷

技術分享

技術分享

{

"volume": {

"size": 10,

"availability_zone": null,

"source_volid": null,

"description": null,

"multiattach ": false,

"snapshot_id": "${snapshot_id}",

"name": "v-f-snap",

"imageRef": null,

"volume_type": null,

"metadata": {},

"consistencygroup_id": null

}

}

j》從img創建卷

技術分享

技術分享

{

"volume": {

"size": 2,

"availability_zone": null,

"source_volid": null,

"description": null,

"multiattach ": false,

"snapshot_id": null,

"name": "v-f-img",

"imageRef": "${img_id}",

"volume_type": null,

"metadata": {},

"consistencygroup_id": null

}

}

k》copy volume to img

技術分享

{

"os-volume_upload_image": {

"container_format": "bare",

"force": false,

"image_name": "jicy-img",

"disk_format": "raw"

}

}

l》create volume from volume

技術分享

技術分享

{

"volume": {

"size": 10,

"availability_zone": null,

"source_volid": "${volume_id}",

"description": null,

"multiattach ": false,

"snapshot_id": null,

"name": "v-f-v",

"imageRef": null,

"volume_type": null,

"metadata": {},

"consistencygroup_id": null

}

}

m》delete volume

技術分享

n》delete snap

技術分享

本文出自 “xiaocaoer” 博客,請務必保留此出處http://11211989.blog.51cto.com/2386238/1982523

jmeter3.2 測試openstack-kilo cinder 的rest api