OpenStack is a global collaboration of developers and cloud computing
technologists producing the open standard cloud computing platform for both public
and private clouds. The project aims to deliver solutions for all types of clouds by
being simple to implement, massively scalable, and feature rich. The technology
consists of a series of interrelated projects delivering various components for a
cloud infrastructure solution.
Here we shall see the required API implementations,
OPENSTACK
Compute API using RestConsole v4.0.2
Step
1:
To generate base token.
URI
Syntax : http://<IP>:5000/v2.0/tokens
Method
: POST
Content-Type:
applicaiton/json
Request
Body : {"auth":{"passwordCredentials":{"username":
"admin", "password":"openstack"},
"tenantId":""}}
Response
json :-
{
"access":
{
"token":
{
"expires":
"2013-01-10T13:17:31Z",
"id":
"9a92e97e52d9443896d130bb85714aaa"
},
"serviceCatalog":
{},
"user":
{
"username":
"admin",
"roles_links":
[],
"id":
"0425c7dbae134d7bb9f6c5774c71e509",
"roles":
[],
"name":
"admin"
}
}
}
Result
:
We have obtained one base (Eg : "9a92e97e52d9443896d130bb85714aaa")
token and these token helps to find projectID(tenantID).
Step
2:
To find tenantID(projectID) using above generated base token.
URI
Syntax : http://<IP>:5000/v2.0/tenants
Method
: GET
Content-Type:
applicaiton/json
Request
Body : {"auth":{"passwordCredentials":{"username":
"admin", "password":"openstack"},
"tenantId":""}}
Headers
Param : X-Auth-Token(header) –
9a92e97e52d9443896d130bb85714aaa(value)
Response
json :-
{
"tenants_links":
[],
"tenants":
[{
"enabled":
true,
"description":
"Default Tenant",
"name":
"practiceproject",
"id":
"22708001d9454cc9a38d195622bf1ee1"
}]
}
Result
: Now
we got tenantIDs Eg: "22708001d9454cc9a38d195622bf1ee1".
After
that we need to generate tenant specific token using above generated
tenantID with base token.
Step
3:
To find tenant specific token.
URI
Syntax : http://<IP>:5000/v2.0/tokens
Method
: POST
Content-Type:
applicaiton/json
Request
Body : {"auth":{"passwordCredentials":{"username":
"admin", "password":"openstack"},
"tenantId":"22708001d9454cc9a38d195622bf1ee1"}}
Headers
Param : X-Auth-Token(header) –
9a92e97e52d9443896d130bb85714aaa(value)
Response
json :-
{
"access":
{
"token":
{
"expires":
"2013-01-10T13:22:32Z",
"id":
"e57565d9db2144e6b3262d75d65eca72",
"tenant":
{
"description":
"Default Tenant",
"enabled":
true,
"id":
"22708001d9454cc9a38d195622bf1ee1",
"name":
"practiceproject"
}
},
"serviceCatalog":
[{
"endpoints":
[{
"adminURL":
"http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1",
"region":
"nova",
"internalURL":
"http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1",
"publicURL":
"http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1"
}],
"endpoints_links":
[],
"type":
"compute",
"name":
"nova"
},
{
"endpoints":
[{
"adminURL":
"http://172.16.0.1:9292/v1",
"region":
"nova",
"internalURL":
"http://172.16.0.1:9292/v1",
"publicURL":
"http://172.16.0.1:9292/v1"
}],
"endpoints_links":
[],
"type":
"image",
"name":
"glance"
},
{
"endpoints":
[{
"adminURL":
"http://172.16.0.1:8776/v1/22708001d9454cc9a38d195622bf1ee1",
"region":
"nova",
"internalURL":
"http://172.16.0.1:8776/v1/22708001d9454cc9a38d195622bf1ee1",
"publicURL":
"http://172.16.0.1:8776/v1/22708001d9454cc9a38d195622bf1ee1"
}],
"endpoints_links":
[],
"type":
"volume",
"name":
"volume"
},
{
"endpoints":
[{
"adminURL":
"http://172.16.0.1:8773/services/Admin",
"region":
"nova",
"internalURL":
"http://172.16.0.1:8773/services/Cloud",
"publicURL":
"http://172.16.0.1:8773/services/Cloud"
}],
"endpoints_links":
[],
"type":
"ec2",
"name":
"ec2"
},
{
"endpoints":
[{
"adminURL":
"https://172.16.0.1:443/v1",
"region":
"nova",
"internalURL":
"https://172.16.0.1:443/v1/AUTH_22708001d9454cc9a38d195622bf1ee1",
"publicURL":
"https://172.16.0.1:443/v1/AUTH_22708001d9454cc9a38d195622bf1ee1"
}],
"endpoints_links":
[],
"type":
"object-store",
"name":
"swift"
},
{
"endpoints":
[{
"adminURL":
"http://172.16.0.1:35357/v2.0",
"region":
"nova",
"internalURL":
"http://172.16.0.1:5000/v2.0",
"publicURL":
"http://172.16.0.1:5000/v2.0"
}],
"endpoints_links":
[],
"type":
"identity",
"name":
"keystone"
}],
"user":
{
"username":
"admin",
"roles_links":
[],
"id":
"0425c7dbae134d7bb9f6c5774c71e509",
"roles":
[{
"id":
"fa4e161c9cda4ef7ac722d05c91864a8",
"name":
"admin"
},
{
"id":
"e427252a86e54c79848213d4a52fbaa9",
"name":
"swiftoperator"
},
{
"id":
"6f50e339568c488ab8d22c027e0dc9b2",
"name":
"Member"
}],
"name":
"admin"
}
}
}
Result
: Finally,
we
got tenant specific token, Eg: token -
e57565d9db2144e6b3262d75d65eca72
and tenantID - 22708001d9454cc9a38d195622bf1ee1
Henceforth, We move forward with the help of tenant specific token.
To
List out all images :-
List of
all the images available in machine.
Method : GET
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
Response
json :-
{
"images": [{
"id": "e7fd53c9-08a1-4702-8544-aab7876c89ca",
"links": [{
"href":
"http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1/images/e7fd53c9-08a1-4702-8544-aab7876c89ca",
"rel": "self"
}, {
"href":
"http://172.16.0.1:8774/22708001d9454cc9a38d195622bf1ee1/images/e7fd53c9-08a1-4702-8544-aab7876c89ca",
"rel": "bookmark"
}, {
"href":
"http://10.0.2.15:9292/22708001d9454cc9a38d195622bf1ee1/images/e7fd53c9-08a1-4702-8544-aab7876c89ca",
"type": "application/vnd.openstack.image",
"rel": "alternate"
}],
"name": "images/precise-server-cloudimg-i386.img"
}, {
"id": "7d450eea-cbbe-4725-84f5-05a133160e53",
"links": [{
"href":
"http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1/images/7d450eea-cbbe-4725-84f5-05a133160e53",
"rel": "self"
}, {
"href":
"http://172.16.0.1:8774/22708001d9454cc9a38d195622bf1ee1/images/7d450eea-cbbe-4725-84f5-05a133160e53",
"rel": "bookmark"
}, {
"href":
"http://10.0.2.15:9292/22708001d9454cc9a38d195622bf1ee1/images/7d450eea-cbbe-4725-84f5-05a133160e53",
"type": "application/vnd.openstack.image",
"rel": "alternate"
}],
"name": "images/centos.5-3.x86-64.img"
}, {
"id": "90289f36-c108-405a-9f0e-e7f02c918063",
"links": [{
"href":
"http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1/images/90289f36-c108-405a-9f0e-e7f02c918063",
"rel": "self"
}, {
"href":
"http://172.16.0.1:8774/22708001d9454cc9a38d195622bf1ee1/images/90289f36-c108-405a-9f0e-e7f02c918063",
"rel": "bookmark"
}, {
"href":
"http://10.0.2.15:9292/22708001d9454cc9a38d195622bf1ee1/images/90289f36-c108-405a-9f0e-e7f02c918063",
"type": "application/vnd.openstack.image",
"rel": "alternate"
}],
"name": "images/vmlinuz-2.6.28-11-generic"
}, {
"id": "14359fcc-0762-43aa-a997-43f5a2d5c790",
"links": [{
"href":
"http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1/images/14359fcc-0762-43aa-a997-43f5a2d5c790",
"rel": "self"
}, {
"href":
"http://172.16.0.1:8774/22708001d9454cc9a38d195622bf1ee1/images/14359fcc-0762-43aa-a997-43f5a2d5c790",
"rel": "bookmark"
}, {
"href":
"http://10.0.2.15:9292/22708001d9454cc9a38d195622bf1ee1/images/14359fcc-0762-43aa-a997-43f5a2d5c790",
"type": "application/vnd.openstack.image",
"rel": "alternate"
}],
"name": "ubuntu 12.04 amd64 Kernel"
}]
}
To
List Particular Image :-
URI
Eg :
http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1/images?name=images/centos.5-3.x86-64.img
(or)
We can get through specific image ID
with details as well :
URI
Eg :
http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1/images/7d450eea-cbbe-4725-84f5-05a133160e53
Method : GET
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
List
of all flavors :-
List of
all the flavors created in machine.
URI
Eg :
http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1/flavors
Method : GET
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
Response
json :-
{
"flavors": [{
"id": "2",
"links": [{
"href":
"http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1/flavors/2",
"rel": "self"
}, {
"href":
"http://172.16.0.1:8774/22708001d9454cc9a38d195622bf1ee1/flavors/2",
"rel": "bookmark"
}],
"name": "m1.small"
}, {
"id": "3",
"links": [{
"href":
"http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1/flavors/3",
"rel": "self"
}, {
"href":
"http://172.16.0.1:8774/22708001d9454cc9a38d195622bf1ee1/flavors/3",
"rel": "bookmark"
}],
"name": "m1.medium"
}, {
"id": "4",
"links": [{
"href":
"http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1/flavors/4",
"rel": "self"
}, {
"href":
"http://172.16.0.1:8774/22708001d9454cc9a38d195622bf1ee1/flavors/4",
"rel": "bookmark"
}],
"name": "m1.large"
}, {
"id": "5",
"links": [{
"href":
"http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1/flavors/5",
"rel": "self"
}, {
"href":
"http://172.16.0.1:8774/22708001d9454cc9a38d195622bf1ee1/flavors/5",
"rel": "bookmark"
}],
"name": "m1.xlarge"
}, {
"id": "6",
"links": [{
"href":
"http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1/flavors/6",
"rel": "self"
}, {
"href":
"http://172.16.0.1:8774/22708001d9454cc9a38d195622bf1ee1/flavors/6",
"rel": "bookmark"
}],
"name": "m1.tiny"
}, {
"id": "7",
"links": [{
"href":
"http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1/flavors/7",
"rel": "self"
}, {
"href":
"http://172.16.0.1:8774/22708001d9454cc9a38d195622bf1ee1/flavors/7",
"rel": "bookmark"
}],
"name": "m1.tiny1"
}]
}
Particular
flavors ID :-
URI
Eg :
http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1/flavors/7
Method : GET
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
Launch
Instance :-
Method : POST
Request Body :
{
"server"
: {
"name"
: "hemAPItrailserver",
"imageRef"
: "e7fd53c9-08a1-4702-8544-aab7876c89ca",
"flavorRef"
: "7"
}
}
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
Response
json:-
{
"server": {
"OS-DCF:diskConfig":
"MANUAL",
"id":
"d1ecd84b-c8f6-450d-9050-81d583a2a28f",
"links": [{
"href":
"http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1/servers/d1ecd84b-c8f6-450d-9050-81d583a2a28f",
"rel": "self"
}, {
"href":
"http://172.16.0.1:8774/22708001d9454cc9a38d195622bf1ee1/servers/d1ecd84b-c8f6-450d-9050-81d583a2a28f",
"rel":
"bookmark"
}],
"adminPass":
"BzAZQih2dEg2"
}
}
Update
Instance :-
URI
Eg :
http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1/servers/
d1ecd84b-c8f6-450d-9050-81d583a2a28f
Method
: PUT
Request Body :
{
"server"
:
{
"name"
: "modifyHemTrailServer"
}
}
Content Type : application/json
X-Auth-Token : e57565d9db2144e6b3262d75d65eca72
List
of all servers :-
Method
: GET
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
Response
json :-
{
"servers": [{
"id": "93d1dc7e-bfd9-4a4e-8afe-2416c653a732",
"links": [{
"href":
"http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1/servers/93d1dc7e-bfd9-4a4e-8afe-2416c653a732",
"rel": "self"
}, {
"href":
"http://172.16.0.1:8774/22708001d9454cc9a38d195622bf1ee1/servers/93d1dc7e-bfd9-4a4e-8afe-2416c653a732",
"rel": "bookmark"
}],
"name": "trailserver"
}, {
"id": "88dd37e7-bc90-4991-84c9-610fde493e3d",
"links": [{
"href":
"http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1/servers/88dd37e7-bc90-4991-84c9-610fde493e3d",
"rel": "self"
}, {
"href":
"http://172.16.0.1:8774/22708001d9454cc9a38d195622bf1ee1/servers/88dd37e7-bc90-4991-84c9-610fde493e3d",
"rel": "bookmark"
}],
"name": "final"
}]
}
Particular
server :-
Method
: GET
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
Open
Stack Server Actions :-
************************
reboot the instance :-
*****************
Method : POST
Request body :
{
"reboot" : {
"type" : "HARD"
}
}
Content Type : application/json
X-Auth-Token : e57565d9db2144e6b3262d75d65eca72
Suspend and pause the instance :-
***************************
Method
: POST
Request body for Suspend:-
{
"suspend" : null
}
Content Type : application/json
X-Auth-Token : e57565d9db2144e6b3262d75d65eca72
Request body for resume :-
{
"resume" : null
}
Request body for Pause :-
{ "pause": null }
Request body for Unpause:-
{ "unpause": null }
Delete
Instance (Terminate) :-
Method
: DELETE
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
Create
an Image of specified server (Instance's Image Backup):-
Method :
POST
Request Body :-
{
"createImage" : {
"name" :
"newImageViaAPI"
}
}
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
Delete
an Image of specified server :-
Syntax
: http://<IP>:8774/v2/<tenantID>/images/<imageID>
URI
Eg:
http://172.16.0.1:8774/v2/22708001d9454cc9a38d195622bf1ee1/images/8bbcef8a-4583-4cb3-98c6-4cfa8991084d
Method
: DELETE
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
Block Storage service (Volumn) :-
Allows you to manage volumes and
snapshots that can be used with the Volume API (nova-volume or cinder
services)
To
Create a Volume :-
Syntax
: http://<IP>:8776/v1/<tenantID>/volumes
Method : POST
Request Body :
{ "volume": { "display_name": "vol-001", "display_description": "volume1test", "size": 2, "volume_type": "", "metadata": {}, "availability_zone": "" } }
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
Response
json :-
{
"volume": {
"status": "creating",
"display_name": "vol-001",
"attachments": [],
"availability_zone": "",
"created_at": "2013-01-23 12:03:30.807734",
"display_description": "volume1test",
"volume_type": "None",
"snapshot_id": null,
"size": 2,
"id": "5",
"metadata": {}
}
}
To
List out of all Volumes :-
Syntax
: http://<IP>:8776/v1/<tenantID>/volumes
Method : GET
Request Body :
{"auth":{"passwordCredentials":{"username": "admin", "password":"openstack"}, "tenantId":"22708001d9454cc9a38d195622bf1ee1"}}
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
Response
json :
{
"volumes": [{
"status": "in-use",
"display_name": "aaaaaaa",
"attachments": [{
"device": "/dev/vdc",
"server_id":
"ad59de63-4cb3-4152-af9e-885e6e35bf71",
"id": "2",
"volume_id": "2"
}],
"availability_zone": "nova",
"created_at": "2013-01-22 09:38:49",
"display_description": "aaaa",
"volume_type": "None",
"snapshot_id": null,
"size": 1,
"id": "2",
"metadata": {}
}, {
"status": "in-use",
"display_name": "bbbbbb",
"attachments": [{
"device": "/dev/vdd",
"server_id":
"7ba09533-81f7-4a40-bf16-44edf6d7b400",
"id": "3",
"volume_id": "3"
}],
"availability_zone": "nova",
"created_at": "2013-01-22 12:37:59",
"display_description": "test",
"volume_type": "None",
"snapshot_id": null,
"size": 2,
"id": "3",
"metadata": {}
}, {
"status": "available",
"display_name": "vol-001",
"attachments": [],
"availability_zone": "",
"created_at": "2013-01-23 12:03:30",
"display_description": "volume1test",
"volume_type": "None",
"snapshot_id": null,
"size": 2,
"id": "5",
"metadata": {}
}]
}
To
get particular volume :-
Syntax
: http://<IP>:8776/v1/<tenantID>/volumes/<volumeID>
Method : GET
Request Body :
{"auth":{"passwordCredentials":{"username": "admin", "password":"openstack"}, "tenantId":"22708001d9454cc9a38d195622bf1ee1"}}
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
Response json :-
{
"volume": {
"status":
"available",
"display_name":
"vol-001",
"attachments": [],
"availability_zone":
"",
"created_at":
"2013-01-23 12:03:30",
"display_description":
"volume1test",
"volume_type":
"None",
"snapshot_id":
null,
"size": 2,
"id": "5",
"metadata": {}
}
}
To
get Volume Types :-
Syntax
: http://<IP>:8776/v1/<tenantID>/types
Method : GET
Request Body :
{"auth":{"passwordCredentials":{"username": "admin", "password":"openstack"}, "tenantId":"22708001d9454cc9a38d195622bf1ee1"}}
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
To
create volume snapshot :-
Syntax
: http://<IP>:8776/v1/<tenantID>/snapshots
URI Eg :
http://172.16.0.1:8776/v1/22708001d9454cc9a38d195622bf1ee1/snapshots
Method : POST
Request Body :
{ "snapshot": { "display_name": "snap-001", "display_description": "Daily backup", "volume_id": "5", "force": true } }
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
Response json :
{
"snapshot": {
"status":
"creating",
"display_name":
"snap-001",
"created_at":
"2013-01-23 12:19:52.411395",
"display_description":
"Daily backup",
"volume_id": "5",
"id": "1",
"size": 2
}
}
To
List out of all snapshots :-
Syntax
: http://<IP>:8776/v1/<tenantID>/snapshots
URI Eg :
http://172.16.0.1:8776/v1/22708001d9454cc9a38d195622bf1ee1/snapshots
Method : GET
Request Body :
{"auth":{"passwordCredentials":{"username": "admin", "password":"openstack"}, "tenantId":"22708001d9454cc9a38d195622bf1ee1"}}
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
Response json:-
{
"snapshots": [{
"status":
"available",
"display_name":
"snap-001",
"created_at":
"2013-01-23 12:19:52",
"display_description":
"Daily backup",
"volume_id": "5",
"id": "1",
"size": 2
}]
}
To
delete particular snapshots :-
Syntax
: http://<IP>:8776/v1/<tenantID>/snapshots/<snapshotsID>
URI Eg :
http://172.16.0.1:8776/v1/22708001d9454cc9a38d195622bf1ee1/snapshots/1
Method : DELETE
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
Response json :- Doesnot return any
response, shows empty.
To
delete particular volume :-
Syntax
: http://<IP>:8776/v1/<tenantID>/volumes/<volumesID>
URI Eg :
http://172.16.0.1:8776/v1/22708001d9454cc9a38d195622bf1ee1/volumes/5
Method : DELETE
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
Response json :- Doesnot return any
response, shows empty.
To
create volume attachments with server :-
Syntax
:
http://<IP>:8774/v2/<tenantID>/servers/<serverID>/os-volume_attachments
URI Eg :
http://172.16.0.1:8776/v1/22708001d9454cc9a38d195622bf1ee1/servers/d1ecd84b-c8f6-450d-9050-81d583a2a28f/os-volume_attachments
Method : POST
Request Body :
{"volumeAttachment": {"volumeId":"5", "device": "dev/vdd"} }
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
To
list of all volume attached with particular servers :-
Syntax
:
http://<IP>:8774/v2/<tenantID>/servers/<serverID>/os-volume_attachments
URI Eg :
http://172.16.0.1:8776/v1/22708001d9454cc9a38d195622bf1ee1/servers/d1ecd84b-c8f6-450d-9050-81d583a2a28f/os-volume_attachments
Method : GET
Request Body :
{"auth":{"passwordCredentials":{"username": "admin", "password":"openstack"}, "tenantId":"22708001d9454cc9a38d195622bf1ee1"}}
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
Response json:-
{
"volumeAttachments":
[{
"device":
"/dev/vdd",
"serverId":
"7ba09533-81f7-4a40-bf16-44edf6d7b400",
"id": 3,
"volumeId": 3
}]
}
To
get particular volume attached with particular server :-
Syntax
:
http://<IP>:8774/v2/<tenantID>/servers/<serverID>/os-volume_attachments/<volumeID>
URI Eg :
http://172.16.0.1:8776/v1/22708001d9454cc9a38d195622bf1ee1/servers/d1ecd84b-c8f6-450d-9050-81d583a2a28f/os-volume_attachments/5
Method : GET
Request Body :
{"auth":{"passwordCredentials":{"username": "admin", "password":"openstack"}, "tenantId":"22708001d9454cc9a38d195622bf1ee1"}}
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
Response json :-
{
"volumeAttachment": {
"device":
"/dev/vdd",
"serverId":
"7ba09533-81f7-4a40-bf16-44edf6d7b400",
"id": 3,
"volumeId": 3
}
}
To
detachment from particular server :-
Syntax
:
http://<IP>:8774/v2/<tenantID>/servers/<serverID>/os-volume_attachments/<volumeID>
URI Eg :
http://172.16.0.1:8776/v1/22708001d9454cc9a38d195622bf1ee1/servers/d1ecd84b-c8f6-450d-9050-81d583a2a28f/os-volume_attachments/5
Method : DELETE
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
To
Allocate Floating IP to project(tenant):-
Syntax
: http://<IP>:8774/v2/<tenantID>/os-floating-ips
Method : POST
Request Body :
{ "pool": "nova" }
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
To
list out all of the floating Ips allocated with particular
project(tenant) :-
Syntax
: http://<IP>:8774/v2/<tenantID>/os-floating-ips
Method : GET
Request Body :
{"auth":{"passwordCredentials":{"username": "admin", "password":"openstack"}, "tenantId":"22708001d9454cc9a38d195622bf1ee1"}}
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
To
add floating IP to particular server :-
Syntax
: http://<IP>:8774/v2/<tenantID>/servers/<serverID>/action
URI
Eg :
http://172.16.0.1:8776/v1/22708001d9454cc9a38d195622bf1ee1/servers/d1ecd84b-c8f6-450d-9050-81d583a2a28f/action
Method : POST
Request Body :
{ "addFloatingIp": { "address": "10.10.10.1" } }
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
To
remove floating IP from particular server :-
Syntax
: http://<IP>:8774/v2/<tenantID>/servers/<serverID>/action
URI
Eg :
http://172.16.0.1:8776/v1/22708001d9454cc9a38d195622bf1ee1/servers/d1ecd84b-c8f6-450d-9050-81d583a2a28f/action
Method : POST
Request Body :
{ "removeFloatingIp": { "address": "10.10.10.1" } }
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
To
de-allocates the floating IP from particular project(tenant) :-
Syntax
: http://<IP>:8774/v2/<tenantID>/os-floating-ips
URI Eg :
http://172.16.0.1:8776/v1/22708001d9454cc9a38d195622bf1ee1/os-floating-ips
Method : DELETE
Content Type : application/json
X-Auth-Token :
e57565d9db2144e6b3262d75d65eca72
==========*********==========
Reference Link :-
http://api.openstack.org/api-ref.html
No comments:
Post a Comment