AttachVolumeToServer
(Difference between revisions)
Mike.robski (Talk | contribs) |
Mike.robski (Talk | contribs) |
||
Line 1: | Line 1: | ||
+ | =='''POST''' /servers/'''id'''/os-volume_attachments== | ||
This operation will attach an already existing volume to the specified [[Server]]. | This operation will attach an already existing volume to the specified [[Server]]. | ||
− | |||
− | |||
=== Parameters === | === Parameters === | ||
Line 128: | Line 127: | ||
[[Category:Hostway API]] | [[Category:Hostway API]] | ||
− | [[Category: | + | [[Category:FlexCloud Server API]] |
<!-- THIS CODE ENABLES DISQUS COMMENTS ON THE PAGE - DELETE TO DISABLE COMMENTING--> | <!-- THIS CODE ENABLES DISQUS COMMENTS ON THE PAGE - DELETE TO DISABLE COMMENTING--> |
Revision as of 17:06, 14 December 2012
Contents |
POST /servers/id/os-volume_attachments
This operation will attach an already existing volume to the specified Server.
Parameters
- id
- The unique identifier of the server.
Request
JSON
{ "volumeAttachment" : { "volumeId" : "{volume_id}", "device": "{device_path}" } }
- volumeId- string
- The unique identifier of the volume.
- device- string
- The device path specified.
Response Codes
- Success
- HTTP/1.1 200 OK
- Failure
- HTTP/1.1 401 Unauthorized : This server could not verify that you are authorized to access the document you requested. Either you supplied incorrect credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
- HTTP/1.1 404 Not Found
- HTTP/1.1 409 Conflict
Examples
Successfully attach a volume to specified server
- POST http(s)://{api_server}/servers/test_server_0013/os-volume_attachments
Request Headers:
Content-Type:application/json Charset=UTF-8 Authorization:Base64-encoded username & password string
Request Body:
{ "volumeAttachment" : { "volumeId" : "hbs2012May08_61EfdIZ3Y", "device": "/dev/test" } }
Response Code:
HTTP/1.1 200 OK
Failure while trying to attach a volume that is already attached to the server
- POST http(s)://{api_server}/servers/test_server_0013/os-volume_attachments
Request Headers:
Content-Type:application/json Charset=UTF-8 Authorization:Base64-encoded username & password string
Request Body:
{
"volumeAttachment" : {
"volumeId" : "hbs2012May08_61EfdIZ3Y",
"device": "/dev/test"
}
}
Response Code:
HTTP/1.1 409 Conflict
Response Body:
{ "conflict": { "message": "VolumeAlreadyAttached", "code": 409, "details": "hbs is already attached" } }
Failure while trying to attach a volume that does not exist
- POST http(s)://{api_server}/servers/test_server_0013/os-volume_attachments
Request Headers:
Content-Type:application/json Charset=UTF-8 Authorization:Base64-encoded username & password string
Request Body:
{
"volumeAttachment" : {
"volumeId" : "fake_volume_id",
"device": "/dev/test"
}
}
Response Code:
HTTP/1.1 404 Not Found
Response Body:
{ "notFound": { "message": "VolumeNotFound", "code": 404, "details": "hostway block store not found"} } }
Unauthorized access
- POST http(s)://{api_server}/servers/test_server_0013/os-volume_attachments
Request Headers:
Content-Type:application/json
Charset=UTF-8
Authorization:Base64-encoded fake_authentication_string
Response Code:
HTTP/1.1 401 Unauthorized
Response Body:
401 Unauthorized This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.