Permalink
Browse files

More improvements

  • Loading branch information...
1 parent 2727f53 commit 147a29a8707e8975245e531ba0f607afc47d5a16 @leehambley leehambley committed Mar 27, 2013
Showing with 20 additions and 2 deletions.
  1. +7 −0 app/mvmc.rb
  2. +1 −0 config/locales/en.yml
  3. +4 −0 lib/vm.rb
  4. +8 −2 views/pools/index.haml
View
@@ -22,6 +22,7 @@ class Mvmc < Sinatra::Base
set :root, File.join(File.dirname(__FILE__), '../')
set :locales, File.join(File.dirname(__FILE__), '../', 'config/locales/en.yml')
+ set :method_override, true
helpers Sinatra::Cookies
helpers Sinatra::ContentFor
@@ -81,6 +82,12 @@ def hypervisor_url
redirect to('/vms'), 303
end
+ delete '/pools/:uuid/volumes/:path' do |pool_uuid, escaped_path|
+ pool = $libvirt.lookup_storage_pool_by_uuid(pool_uuid)
+ pool.lookup_volume_by_path(CGI.unescape(escaped_path)).delete
+ redirect back
+ end
+
get '/vms' do
@vms = VM.all
@isos = isos
View
@@ -41,6 +41,7 @@ en:
path: "Path"
allocation : "Allocation"
capacity: "Capacity"
+ delete: "Delete"
vms:
table:
heading:
View
@@ -95,6 +95,10 @@ def create_xml(name, cdisos, volume_paths)
os.boot dev: :cdrom
end
+ domain.features do |features|
+ features.acpi
+ end
+
domain.devices do |devices|
devices.emulator "/usr/bin/kvm"
View
@@ -4,7 +4,7 @@
%tbody
- @pools.each do |pool|
%tr
- %th(colspan="3")
+ %th(colspan="4")
%h3= pool.name
- if pool.volumes.any?
%tr
@@ -21,6 +21,12 @@
%td
= volume.info.capacity / 1024 / 1024
MB
+ %td
+ %form{action:"/pools/#{pool.uuid}/volumes/#{CGI.escape(volume.path)}", method: "post"}
+ %input(type="hidden" name="_method" value="delete")
+ %button.btn.btn-danger(type="submit")
+ %i.icon-trash.icon-white
+ = t(:'storage.pools.index.table.volumes.delete')
- else
%tr
- %td(colspan="2")= t(:'storage.pools.index.table.volumes.no_volumes')
+ %td(colspan="4")= t(:'storage.pools.index.table.volumes.no_volumes')

0 comments on commit 147a29a

Please sign in to comment.