Permalink
Browse files

Remote still not working when ISOs are uploaded via the storage pool

  • Loading branch information...
1 parent 147a29a commit 8e360a988e136d83cc0b8fb476a23553e90d3202 @leehambley leehambley committed Apr 2, 2013
Showing with 11 additions and 25 deletions.
  1. +2 −6 app/mvmc.rb
  2. +9 −19 lib/virsh/storage_pool.rb
View
@@ -46,19 +46,15 @@ def hypervisor_url
hvuri = params[:hypervisor_url] || cookies[:hypervisor_url] || DEFAULT_HYPERVISOR_URL
$libvirt.close if $livbirt
$libvirt = Libvirt::open(hvuri)
+ Virsh::StoragePool.create_defaults
rescue Libvirt::ConnectionError
- warn "Couldn't access hypervisor at #{hvuri}"
+ warn "Couldn't access hypervisor at #{hvuri} #{$@}"
ensure
if !$libvirt or $libvirt.closed?
redirect to('/hypervisor') unless request.path_info == '/hypervisor'
return
end
end
- begin
- Virsh::StoragePool.create_defaults
- rescue
- warn "Couldn't create default storage volumes #{$!}"
- end
end
post '/hypervisor' do
View
@@ -30,24 +30,15 @@ def find_by_name(name)
find($libvirt.lookup_storage_pool_by_name(name).uuid)
end
def create_defaults
- begin
- $libvirt.lookup_storage_pool_by_name('virsh-images')
- rescue
- warn "Couldn't find pool virsh-images, will create"
- $libvirt.define_storage_pool_xml(create_pool_xml('virsh-images')).tap do |pool|
- pool.build
- pool.create
- pool.autostart = true
- end
- end
- begin
- $libvirt.lookup_storage_pool_by_name('virsh-isos')
- rescue
- warn "Couldn't find pool virsh-isos, will create"
- $libvirt.define_storage_pool_xml(create_pool_xml('virsh-isos')).tap do |pool|
- pool.build
- pool.create
- pool.autostart = true
+ %w{virsh-images virsh-isos}.each do |name|
+ begin
+ $libvirt.define_storage_pool_xml(create_pool_xml(name)).tap do |pool|
+ pool.build
+ pool.create
+ pool.autostart = true
+ end
+ rescue Libvirt::DefinitionError
+ # Nothing to do :-)
end
end
end
@@ -72,7 +63,6 @@ def create_pool_xml(name)
target.path File.join(VIRSH_POOL_DIR, name)
end
end
- warn xml.target!
xml.target!
end
end

0 comments on commit 8e360a9

Please sign in to comment.