From: Daniel Molina <[email protected]> This patch fixes some minor bugs in the OpenNebula driver: * Add verbose mode to the instance_type request * Add hardware_profiles to all the images. If this parameter is not defined, the GUI will crash when trying to show an image. * Fix addresses typo
Signed-off-by: Daniel Molina <[email protected]> --- .../deltacloud/drivers/opennebula/occi_client.rb | 6 ++++-- .../drivers/opennebula/opennebula_driver.rb | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/server/lib/deltacloud/drivers/opennebula/occi_client.rb b/server/lib/deltacloud/drivers/opennebula/occi_client.rb index 574cb88..8688995 100644 --- a/server/lib/deltacloud/drivers/opennebula/occi_client.rb +++ b/server/lib/deltacloud/drivers/opennebula/occi_client.rb @@ -69,7 +69,7 @@ module OCCIClient # Retieves the available Instance types ###################################################################### def get_instance_types - get('/instance_type') + get('/instance_type?verbose=yes') end ###################################################################### @@ -277,7 +277,9 @@ module OCCIClient def get(path) url = URI.parse(@endpoint+path) - req = Net::HTTP::Get.new(url.path) + path = url.path + path << "?#{url.query}" if url.query + req = Net::HTTP::Get.new(path) do_request(url, req) end diff --git a/server/lib/deltacloud/drivers/opennebula/opennebula_driver.rb b/server/lib/deltacloud/drivers/opennebula/opennebula_driver.rb index 3b00eca..dfb679d 100644 --- a/server/lib/deltacloud/drivers/opennebula/opennebula_driver.rb +++ b/server/lib/deltacloud/drivers/opennebula/opennebula_driver.rb @@ -234,6 +234,7 @@ class OpennebulaDriver < Deltacloud::BaseDriver :owner_id=>credentials.user, :state=>"AVAILABLE", :architecture=>storage['ARCH'], + :hardware_profiles=>hardware_profiles(credentials) } ) end @@ -243,8 +244,7 @@ class OpennebulaDriver < Deltacloud::BaseDriver computehash = compute.root.elements network = [] - computehash.each('NIC/IP') {|ip| network<<InstanceAddress.new(ip)} - + computehash.each('NIC/IP') {|ip| network<<InstanceAddress.new(ip.text, :type => :ipv4)} image_id = nil if computehash['DISK/STORAGE'] image_id = computehash['DISK/STORAGE'].attributes['href'].split("/").last @@ -255,11 +255,11 @@ class OpennebulaDriver < Deltacloud::BaseDriver :owner_id=>credentials.user, :name=>computehash['NAME'].text, :image_id=>image_id, - :instance_profile=>InstanceProfile.new(computehash['INSTANCE_TYPE']||'small'), + :instance_profile=>InstanceProfile.new(computehash['INSTANCE_TYPE'].text||'small'), :realm_id=>'ONE', :state=>VM_STATES[computehash['STATE'].text], - :public_addreses=>network, - :private_addreses=>[], + :public_addresses=>network, + :private_addresses=>[], :actions=> instance_actions_for( VM_STATES[computehash['STATE'].text] ) } ) end -- 1.7.1 -- Daniel Molina Project Engineer OpenNebula - The Open Source Solution for Data Center Virtualization www.OpenNebula.org | [email protected] | @OpenNebula
