码迷,mamicode.com
首页 > Windows程序 > 详细

openstack API debug OpenstackEveryProject_CLI,curl_based

时间:2014-09-15 15:36:49      阅读:457      评论:0      收藏:0      [点我收藏+]

标签: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根据你的环境自行配置修改.

bubuko.com,布布扣

Example demo tenant

bubuko.com,布布扣

调用

bubuko.com,布布扣

bubuko.com,布布扣

....基于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"}}}‘

bubuko.com,布布扣

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"}}}‘

bubuko.com,布布扣

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"

bubuko.com,布布扣

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;

bubuko.com,布布扣

 

5,Use the Compute API to list servers

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

bubuko.com,布布扣

基于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,获取镜像

bubuko.com,布布扣

2,获取flavor

bubuko.com,布布扣

bubuko.com,布布扣

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

bubuko.com,布布扣

显示查看我们刚刚创建的虚机的详细的信息

bubuko.com,布布扣

查看rc environment variable

bubuko.com,布布扣

openstack API debug OpenstackEveryProject_CLI,curl_based

标签:des   style   http   color   io   os   使用   ar   for   

原文地址:http://www.cnblogs.com/ruiy/p/cliApi.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!