openstack API 开发 - 关于获取token

1, 获取token

curl -d '{"auth": {"tenantName": "admin", "passwordCredentials": {"username": "admin", "password": "admin"}}}' -H "Content-type: application/json" http://127.0.0.1:35357/v2.0/tokens | python -m json.tool


2,根据token,发送API请求

curl -v -d '{"migrate2": {"force_hosts":"hostname"}}' -i http://127.0.0.1:8774/v2/{project_id}/servers/{vm_uuid}/action -X POST -H "X-Auth-Project-Id: {project_id}" -H "Accept: application/json" -H "X-Auth-Token: {token_id}" -H "Content-Type: application/json"



3,实例

curl -v -d '{"ioControl": {"instance_name":"instance-0000000d","limit_size":"50MB"}}' -i http://127.0.0.1:8774/v2/842748637c7c419a9af9e787350aca6b/servers/59d83dc5-3cfe-4488-b62e-1d338445457a/action -X POST -H "X-Auth-Project-Id: 842748637c7c419a9af9e787350aca6b" -H "Accept: application/json" -H "X-Auth-Token: f406297155a24bffb9a52aa9da5b3e89" -H "Content-Type: application/json"

你可能感兴趣的:(openstack,token,curl)