You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by Johannes <jo...@gmail.com> on 2012/07/24 10:56:29 UTC

[PATCH] Opennebula driver - fix for missing instance_type

Dear Deltacloud mailing-list,

This is my first mail and patch, please don't bite.

I've been using deltacloud for a few months now to interact with Opennebula
implementations (version 3.4, but that should not matter for this patch)
and EC2 implementations. It seems that deltacloud fails to give any results
if one of the VMs running on the Opennebula cloud provider does not have
any instance_type (this can/will happen if you start VMs using the 'onevm
create' command).

This patch is trivial so I guess/hope it will not break any tests, but I am
not able to run these yet (don't know how -- sorry).
Also, not quite sure how to properly create a patch as this is my first
patch ever, I hope this is correct.

With kind regards,
Johannes Bertens

--- opennebula_driver.rb.old    2012-07-19 13:24:28.000000000 +0200
+++ opennebula_driver.rb.new    2012-07-24 10:55:57.000000000 +0200
@@ -240,12 +240,17 @@ class OpennebulaDriver < Deltacloud::Bas
     if computehash['DISK/STORAGE']
       image_id =
computehash['DISK/STORAGE'].attributes['href'].split("/").last
     end
+
+    instance_profile = nil
+    if computehash['INSTANCE_TYPE']
+      instance_profile = computehash['INSTANCE_TYPE'].text||'small'
+    end
     Instance.new( {
       :id=>computehash['ID'].text,
       :owner_id=>credentials.user,
       :name=>computehash['NAME'].text,
       :image_id=>image_id,
-
 :instance_profile=>InstanceProfile.new(computehash['INSTANCE_TYPE'].text||'small'),
+      :instance_profile=>InstanceProfile.new(instance_profile),
       :realm_id=>'ONE',
       :state=>VM_STATES[computehash['STATE'].text],
       :public_addresses=>network,

Re: [PATCH] Opennebula driver - fix for missing instance_type

Posted by David Lutterkort <lu...@redhat.com>.
Hi Johannes,

thanks so much for the patch. it seems the patch has been corrupted by
embedding it in your email (lines have been wrapped) - it looks like it
should be fine to commit it.

Can you resend it as an attachment ? For larger amounts of work, I
highly recommend reading
http://watzmann.net/blog/2011/09/git-workflow.html and getting familiar
with the tools mentioned there.

Also, if you plan on submitting more/bigger patches, we'd need you to
file a CLA (see http://www.apache.org/licenses/#clas)

David

On Tue, 2012-07-24 at 10:56 +0200, Johannes wrote:
> Dear Deltacloud mailing-list,
> 
> This is my first mail and patch, please don't bite.
> 
> I've been using deltacloud for a few months now to interact with Opennebula
> implementations (version 3.4, but that should not matter for this patch)
> and EC2 implementations. It seems that deltacloud fails to give any results
> if one of the VMs running on the Opennebula cloud provider does not have
> any instance_type (this can/will happen if you start VMs using the 'onevm
> create' command).
> 
> This patch is trivial so I guess/hope it will not break any tests, but I am
> not able to run these yet (don't know how -- sorry).
> Also, not quite sure how to properly create a patch as this is my first
> patch ever, I hope this is correct.
> 
> With kind regards,
> Johannes Bertens
> 
> --- opennebula_driver.rb.old    2012-07-19 13:24:28.000000000 +0200
> +++ opennebula_driver.rb.new    2012-07-24 10:55:57.000000000 +0200
> @@ -240,12 +240,17 @@ class OpennebulaDriver < Deltacloud::Bas
>      if computehash['DISK/STORAGE']
>        image_id =
> computehash['DISK/STORAGE'].attributes['href'].split("/").last
>      end
> +
> +    instance_profile = nil
> +    if computehash['INSTANCE_TYPE']
> +      instance_profile = computehash['INSTANCE_TYPE'].text||'small'
> +    end
>      Instance.new( {
>        :id=>computehash['ID'].text,
>        :owner_id=>credentials.user,
>        :name=>computehash['NAME'].text,
>        :image_id=>image_id,
> -
>  :instance_profile=>InstanceProfile.new(computehash['INSTANCE_TYPE'].text||'small'),
> +      :instance_profile=>InstanceProfile.new(instance_profile),
>        :realm_id=>'ONE',
>        :state=>VM_STATES[computehash['STATE'].text],
>        :public_addresses=>network,