openstack API debug OpenstackEveryProject_CLI,curl_based

來源:互聯網
上載者:User

標籤:des   style   http   color   io   os   使用   ar   for   

1,基於Openstack 每個服務元件client用戶端,eg,nova 用戶端軟體包名稱是python-novaclient,

別的都一樣,把python-novaclient (nova替換成組件名稱)

在使用組件用戶端調用API前你必須得配置admin管理rc檔案或是在調用時直接輸入--os-auth-username= 個人感覺配置rc檔案很方便,不知你是怎麼認為的.

admin (superUser admin 的Rc檔案)

Example,rc OS_AUTH_URL根據你的環境自行配置修改.

Example demo tenant

調用

....基於Openstack components 的各自CLI 調用調試OpenStack API自己根據man 來哦,Ruiy認為人貴於勤;

<二,基於curl調用Openstack components API>

1,基於租戶的使用者認證擷取API(其實這裡Ruiy又得說一句了,其實我們在調用API的過程中輸入每個使用者的token和TenantAuthenticate(TenantName/passwd))

關於租戶UserCredential和project間的關係

Ruiy認為類似於svn下的項目和許可權使用者一樣的概念;

1,基於curl調用API擷取toekn

curl -i ‘http://5.10.124.181:5000/v2.0/tokens‘ -X POST -H "Content-Type: application/json" -H "Accept: application/json"  -d ‘{"auth": {"tenantName": "demo", "passwordCredentials": {"username": "demo", "password": "321"}}}‘

2,not know tenantName or id,you can send an authentication request
with an empty tenant (基於passwordCredential擷取租戶id)

curl -i ‘http://5.10.124.181:5000/v2.0/tokens‘ -X POST -H "Content-Type: application/json" -H "Accept: application/json"  -d ‘{"auth": {"tenantName": "", "passwordCredentials": {"username": "demo", "password": "321"}}}‘

3,Use the Identity API to request a list of tenants

curl -i http://5.10.124.181:5000/v2.0/tenants -X GET -H "User-Agent: python-keystoneclient" -H "X-Auth-Token: 3be3f0b35ecf498596d79cdac92f8482"

4,Use the Identity API to request a list of endpoints

curl -i -X GET http://5.10.124.181:35357/v2.0/endpoints -H "User-Agent: python-keystoneclient" -H "X-Auth-Token: 09e5cd53f9464b549ef40270ce050141"

Ruiy在此隨便說點,關於每個OpenStack的endpointServiceCatalog的3個管理url

adminurl,internalurl,publicurl;

 

5,Use the Compute API to list servers

curl -v -H "X-Auth-Token:3da1d59d15354f299593f96ab0c1e135" http://5.10.124.181:8774/v2/f963230ce6d54dc2a4a7b42b3f9989b4/servers

基於Openstack 組件CLI調試API

組件用戶端程式安裝(使用pip(python index package)tool)

pip install [--upgrade] python-PROJECTclient (update更新repo,git repo) (upgrade,升級基於git repo安裝的軟體包的版本)
注意了升級一個軟體包的完整命令是pip install --upgrade python-PROJECTclient 當然我們這裡示範的是openstack 項目組件用戶端程式的 安裝及升級
卸載的 話
pip uninstall python-novaclient

Example,示範基於CLI命令launch an vm(VSI) instance
To launch instances, you must choose a name, an image, and a flavor for your instance(這裡執行個體化一個VSI virtual server instance稍微和one有點不同,但也僅僅是基於命令列,基於web的展開虛機執行個體)
一樣,即直接運行一個完整的鏡像即可.
1,擷取鏡像

2,擷取flavor

 nova boot --image 2a20a472-b5dc-4565-b1a3-28978091d010 --flavor 3 my_instance

顯示查看我們剛剛建立的虛機的詳細的資訊

查看rc environment variable

openstack API debug OpenstackEveryProject_CLI,curl_based

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.