Module: Ropenstack::Compute::Version2::Extensions::Volumes
- Defined in:
- lib/ropenstack/compute/v2/extensions/volumes.rb
Instance Method Summary collapse
-
#attach_volume(id, volume) ⇒ Object
Attach a cinder volume to a server, by passing the server id and the volume id.
-
#detach_volume(id, attachment) ⇒ Object
Remove a cinder volume from a server, by passing the server id and the attachment id.
Instance Method Details
#attach_volume(id, volume) ⇒ Object
Attach a cinder volume to a server, by passing the server id and the volume id.
7 8 9 10 |
# File 'lib/ropenstack/compute/v2/extensions/volumes.rb', line 7 def attach_volume(id, volume) data = { 'volumeAttachment' => { 'volumeId' => volume, 'device' => "/dev/vdb" } } return post_request(address("/servers/" + id + "/os-volume_attachments"), data, @token) end |
#detach_volume(id, attachment) ⇒ Object
Remove a cinder volume from a server, by passing the server id and the attachment id.
16 17 18 |
# File 'lib/ropenstack/compute/v2/extensions/volumes.rb', line 16 def detach_volume(id, ) return delete_request(address("/servers/"+id+"/os-volume_attachments/"+volume), @token) end |