You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2012/11/21 12:15:50 UTC

[PATCH core 1/3] VSphere: Fixed typo that cause DC to return 404 for all instances

From: Michal Fojtik <mf...@redhat.com>


Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 server/lib/deltacloud/drivers/vsphere/vsphere_client.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/lib/deltacloud/drivers/vsphere/vsphere_client.rb b/server/lib/deltacloud/drivers/vsphere/vsphere_client.rb
index 1d158f8..07a41a7 100644
--- a/server/lib/deltacloud/drivers/vsphere/vsphere_client.rb
+++ b/server/lib/deltacloud/drivers/vsphere/vsphere_client.rb
@@ -45,7 +45,7 @@ module Deltacloud::Drivers::VSphere
               end
             end
           end
-          break if [:datastore]
+          break if vm[:datastore]
         end
         vm
       end
-- 
1.8.0


[PATCH core 2/3] VSphere: Report MAC addresses together with ipv4 addresses (DTACLOUD-376)

Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>

* This patch also fix the case when instance was not created
  using Deltacloud and the template_id was not saved in extraConfig.
  In that case Deltacloud will not advertise link to original template.

Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb b/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
index 98b3468..11d2759 100644
--- a/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
+++ b/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
@@ -162,6 +162,7 @@ module Deltacloud::Drivers::Vsphere
           # instance.
           template_id = vm.config[:extraConfig].select { |k| k.key == 'template_id' }
           template_id = template_id.first.value unless template_id.empty?
+
           properties = {
             :memory => config[:memorySizeMB],
             :cpus => config[:numCpu],
@@ -177,17 +178,15 @@ module Deltacloud::Drivers::Vsphere
           # We're getting IP address from 'vmware guest tools'.
           # If guest tools are not installed, we return list of MAC addresses
           # assigned to this instance.
-          public_addresses = []
-          if vm.guest[:net].empty?
-            public_addresses = vm.macs.values.collect { |mac_address| InstanceAddress.new(mac_address, :type => :mac) }
-          else
-            public_addresses = [InstanceAddress.new(vm.guest[:net].first[:ipAddress].first)]
+          public_addresses = vm.macs.values.collect { |mac_address| InstanceAddress.new(mac_address, :type => :mac) }
+          if !vm.guest[:net].empty? and ip_address = vm.guest[:net].first[:ipAddress].first
+            public_addresses += [InstanceAddress.new(ip_address)]
           end
           Instance.new(
             :id => properties[:name],
             :name => properties[:name],
             :owner_id => credentials.user,
-            :image_id => template_id,
+            :image_id => template_id.empty? ? nil : template_id,
             :description => properties[:full_name],
             :realm_id => realm_id,
             :state => instance_state,
-- 
1.8.0


[PATCH core 3/3] RHEV-M: Keep reporting the MAC addresses when ipv4 address is ready

Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>


Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb b/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
index 71db828..37e6622 100644
--- a/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
+++ b/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
@@ -244,13 +244,13 @@ class RhevmDriver < Deltacloud::BaseDriver
       ip = confserver_ip(inst.id)
       public_addresses = [ InstanceAddress.new(ip) ]
     end
-    # If IP retrieval failed, fallback to VNC and MAC address
-    if public_addresses.empty?
-      public_addresses = inst.interfaces.map { |interface| InstanceAddress.new(interface.mac, :type => :mac) }
-    end
+
+    public_addresses += inst.interfaces.map { |interface| InstanceAddress.new(interface.mac, :type => :mac) }
+
     if inst.vnc
       public_addresses << InstanceAddress.new(inst.vnc[:address], :port => inst.vnc[:port], :type => :vnc)
     end
+
     Instance.new(
       :id => inst.id,
       :name => inst.name,
-- 
1.8.0


Re: [PATCH core 1/3] VSphere: Fixed typo that cause DC to return 404 for all instances

Posted by "marios@redhat.com" <ma...@redhat.com>.
ack series

On 21/11/12 13:15, mfojtik@redhat.com wrote:
> From: Michal Fojtik <mf...@redhat.com>
> 
> 
> Signed-off-by: Michal fojtik <mf...@redhat.com>
> ---
>  server/lib/deltacloud/drivers/vsphere/vsphere_client.rb | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/server/lib/deltacloud/drivers/vsphere/vsphere_client.rb b/server/lib/deltacloud/drivers/vsphere/vsphere_client.rb
> index 1d158f8..07a41a7 100644
> --- a/server/lib/deltacloud/drivers/vsphere/vsphere_client.rb
> +++ b/server/lib/deltacloud/drivers/vsphere/vsphere_client.rb
> @@ -45,7 +45,7 @@ module Deltacloud::Drivers::VSphere
>                end
>              end
>            end
> -          break if [:datastore]
> +          break if vm[:datastore]
>          end
>          vm
>        end
>