Skip to content
Browse files

fixed add volume and added destroy volume to the vm-api

  • Loading branch information...
1 parent 6294c8b commit ea3547506912c3d1a345007950ba07b277e84cd2 @abenari committed Apr 8, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/client/vm_api.rb
View
6 lib/client/vm_api.rb
@@ -43,10 +43,14 @@ def vm_volumes vm_id
end
def add_volume(vm_id, opts={})
- storage_domain_id = opts[:storage_domain] || storagedomains.first.id
+ storage_domain_id = opts[:storage_domain] || storagedomains(:role => 'data').first.id
http_post("/vms/%s/disks" % vm_id, OVIRT::Volume.to_xml(storage_domain_id, opts))
end
+ def destroy_volume(vm_id, vol_id)
+ http_delete("/vms/%s/disks/%s" % [vm_id, vol_id])
+ end
+
def vm_action(id, action, opts={})
xml_response = http_post("/vms/%s/%s" % [id, action],'<action/>', opts)
return (xml_response/'action/status').first.text.strip.upcase=="COMPLETE"

0 comments on commit ea35475

Please sign in to comment.
Something went wrong with that request. Please try again.