deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Molina <dmamol...@gmail.com>
Subject Re: [PATCH] Fix minor bugs in OpenNebula driver
Date Wed, 29 Feb 2012 11:08:13 GMT
Hi Michal

On 29 February 2012 11:37, Michal Fojtik <mfojtik@redhat.com> wrote:
> Hi Daniel,
>
> Applying: This patch fixes some minor bugs in the OpenNebula driver:
> fatal: corrupt patch at line 53
> Patch failed at 0001 This patch fixes some minor bugs in the OpenNebula driver:
>
> Seems like the patch is somehow corrupted. I was not able to find any reason
> inside patch. Can you please check if it apply to master?

I can apply it without any problem:

-------8<----------------
dmolina:[~/deltacloud](master) $ git pull --rebase
Already up-to-date.
dmolina:[~/deltacloud](master) $ git am
/tmp/0001-Fix-minor-bugs-in-OpenNebula-driver.patch
Applying: Fix minor bugs in OpenNebula driver
dmolina:[~/deltacloud](master) $ git log
commit 384cd59218422eb5c07a1ac545ed2d7ae62fc42d
Author: Daniel Molina <dmolina@opennebula.org>
Date:   Tue Feb 28 17:34:49 2012 +0100

    Fix minor bugs in OpenNebula driver

commit a1f81d29dfd0e09be45f4e281f68cdcc1f945a4a
Author: marios <marios@redhat.com>
Date:   Tue Feb 28 17:53:24 2012 +0200

    Minor edit to handle case of no backtrace in ValidationFailure
-------8<----------------

I attach the patch again:

$ cat /tmp/0001-Fix-minor-bugs-in-OpenNebula-driver.patch
>From c1e86bbaf5a7429edf4a211b022a2d9d69551ce8 Mon Sep 17 00:00:00 2001
From: Daniel Molina <dmolina@opennebula.org>
Date: Tue, 28 Feb 2012 17:34:49 +0100
Subject: [PATCH] Fix minor bugs in OpenNebula driver

---
 .../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

>
> Thanks!,
>  Michal
>
> Michal Fojtik
> http://deltacloud.org
> mfojtik@redhat.com
>
>
>
> On Feb 28, 2012, at 5:57 PM, Daniel Molina wrote:
>
>> From: Daniel Molina <dmolina@opennebula.org>
>>
>> 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 <dmolina@opennebula.org>
>> ---
>> .../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 | dmolina@opennebula.org | @OpenNebula
>



-- 
Saludos,
Dani.

Mime
View raw message