deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1199710 - in /incubator/deltacloud/trunk/server/lib/deltacloud: ./ drivers/condor/ drivers/ec2/ drivers/gogrid/ drivers/mock/ drivers/mock/data/instances/ drivers/opennebula/ drivers/rackspace/ drivers/rimuhosting/ drivers/sbc/ drivers/ter...
Date Wed, 09 Nov 2011 12:35:56 GMT
Author: mfojtik
Date: Wed Nov  9 12:35:55 2011
New Revision: 1199710

URL: http://svn.apache.org/viewvc?rev=1199710&view=rev
Log:
Core: Updated all drivers to support common way to handle IP addresses using InstanceAddress

Signed-off-by: Michal fojtik <mfojtik@redhat.com>

Modified:
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/condor/condor_driver.rb
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/data/instances/inst0.yml
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/data/instances/inst1.yml
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/data/instances/inst2.yml
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/mock_driver.rb
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/opennebula/opennebula_driver.rb
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/sbc/sbc_driver.rb
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/terremark/terremark_driver.rb
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
    incubator/deltacloud/trunk/server/lib/deltacloud/models.rb

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/condor/condor_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/condor/condor_driver.rb?rev=1199710&r1=1199709&r2=1199710&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/condor/condor_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/condor/condor_driver.rb Wed Nov
 9 12:35:55 2011
@@ -105,7 +105,8 @@ module Deltacloud
                 :realm_id => 'default',
                 :instance_profile => InstanceProfile::new(instance.instance_profile.name),
                 :image_id => instance.image_id,
-                :public_addresses => [ ip_address ],
+                :public_addresses => [ InstanceAddress.new(ip_address) ],
+                :private_addresses => [],
                 :owner_id => instance.owner_id,
                 :description => instance.name,
                 :architecture => 'x86_64',

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb?rev=1199710&r1=1199709&r2=1199710&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb Wed Nov  9
12:35:55 2011
@@ -134,7 +134,7 @@ module Deltacloud
           opts ||= {}
           if opts[:id]
             safely do
-              img_arr = ec2.describe_images(opts[:id]).collect do |image|
+              img_arr = ec2.describe_images([opts[:id]]).collect do |image|
                 convert_image(image)
               end
             end
@@ -142,7 +142,7 @@ module Deltacloud
           end
           owner_id = opts[:owner_id] || default_image_owner
           safely do
-            img_arr = ec2.describe_images_by_owner(owner_id, default_image_type).collect
do |image|
+            img_arr = ec2.describe_images_by_owner([owner_id], default_image_type).collect
do |image|
               convert_image(image)
             end
           end
@@ -794,8 +794,8 @@ module Deltacloud
             :launch_time => instance[:aws_launch_time],
             :instance_profile => InstanceProfile.new(instance[:aws_instance_type], inst_profile_opts),
             :realm_id => instance[:aws_availability_zone],
-            :private_addresses => instance[:private_dns_name],
-            :public_addresses => instance[:dns_name],
+            :public_addresses => [InstanceAddress.new(instance[:dns_name], :type =>
:hostname)],
+            :private_addresses => [InstanceAddress.new(instance[:private_dns_name], :type
=> :hostname)],
             :firewalls => instance[:aws_groups],
             :create_image => can_create_image
           )

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb?rev=1199710&r1=1199709&r2=1199710&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb Wed Nov
 9 12:35:55 2011
@@ -471,7 +471,7 @@ class GogridDriver < Deltacloud::BaseDri
       :realm_id => instance['ip']['datacenter']['id'],
       :state => state,
       :actions => instance_actions_for(state),
-      :public_addresses => [ instance['ip']['ip'] ],
+      :public_addresses => [ InstanceAddress.new(instance['ip']['ip']) ],
       :private_addresses => [],
       :username => instance['username'],
       :password => instance['password'],

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/data/instances/inst0.yml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/data/instances/inst0.yml?rev=1199710&r1=1199709&r2=1199710&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/data/instances/inst0.yml
(original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/data/instances/inst0.yml
Wed Nov  9 12:35:55 2011
@@ -8,9 +8,13 @@
 - :stop
 :owner_id: mockuser
 :public_addresses:
-- img1.inst0.public.com
+- !ruby/object:InstanceAddress
+  address: img1.inst0.public.com
+  address_type: :hostname
 :private_addresses:
-- img1.inst0.private.com
+- !ruby/object:InstanceAddress
+  address: img1.inst0.private.com
+  address_type: :hostname
 :create_image: true
 :image_id: img1
 :name: Mock Instance With Profile Change

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/data/instances/inst1.yml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/data/instances/inst1.yml?rev=1199710&r1=1199709&r2=1199710&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/data/instances/inst1.yml
(original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/data/instances/inst1.yml
Wed Nov  9 12:35:55 2011
@@ -4,9 +4,13 @@
 :realm_id: us
 :owner_id: mockuser
 :public_addresses:
-- img3.inst1.public.com
+- !ruby/object:InstanceAddress
+  address: img1.inst1.public.com
+  address_type: :hostname
 :private_addresses:
-- img3.inst1.private.com
+- !ruby/object:InstanceAddress
+  address: img1.inst1.private.com
+  address_type: :hostname
 :create_image: true
 :image_id: img3
 :name: MockUserInstance

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/data/instances/inst2.yml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/data/instances/inst2.yml?rev=1199710&r1=1199709&r2=1199710&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/data/instances/inst2.yml
(original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/data/instances/inst2.yml
Wed Nov  9 12:35:55 2011
@@ -4,9 +4,13 @@
 :realm_id: us
 :owner_id: anotheruser
 :public_addresses:
-- img1.inst2.public.com
+- !ruby/object:InstanceAddress
+  address: img1.inst2.public.com
+  address_type: :hostname
 :private_addresses:
-- img1.inst2.private.com
+- !ruby/object:InstanceAddress
+  address: img1.inst2.private.com
+  address_type: :hostname
 :create_image: true
 :image_id: img1
 :name: AnotherInstance

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/mock_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/mock_driver.rb?rev=1199710&r1=1199709&r2=1199710&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/mock_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/mock/mock_driver.rb Wed Nov 
9 12:35:55 2011
@@ -195,8 +195,8 @@ module Deltacloud::Drivers::Mock
         :keyname => opts[:keyname],
         :image_id=>image_id,
         :owner_id=>credentials.user,
-        :public_addresses=>["#{image_id}.#{next_id}.public.com"],
-        :private_addresses=>["#{image_id}.#{next_id}.private.com"],
+        :public_addresses=>[ InstanceAddress.new("#{image_id}.#{next_id}.public.com",
:type => :hostname) ],
+        :private_addresses=>[ InstanceAddress.new("#{image_id}.#{next_id}.private.com",
:type => :hostname) ],
         :instance_profile => InstanceProfile.new(hwp.name, opts),
         :realm_id=>realm_id,
         :create_image=>true,

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/opennebula/opennebula_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/opennebula/opennebula_driver.rb?rev=1199710&r1=1199709&r2=1199710&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/opennebula/opennebula_driver.rb
(original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/opennebula/opennebula_driver.rb
Wed Nov  9 12:35:55 2011
@@ -190,7 +190,7 @@ class OpennebulaDriver < Deltacloud::Bas
 
 	networks = []
 	(computehash['NETWORK'].each do |n|
-		networks << n.attributes['ip']
+		networks << InstanceAddress.new(n.attributes['ip'])
 	end) unless computehash['NETWORK'].nil?
 
 	Instance.new( {

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb?rev=1199710&r1=1199709&r2=1199710&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
(original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
Wed Nov  9 12:35:55 2011
@@ -394,8 +394,8 @@ class RackspaceDriver < Deltacloud::Base
       :architecture => 'x86_64',
       :image_id => server.imageId.to_s,
       :instance_profile => InstanceProfile::new(server.flavorId.to_s),
-      :public_addresses => server.addresses[:public],
-      :private_addresses => server.addresses[:private],
+      :public_addresses => server.addresses[:public].collect { |ip| InstanceAddress.new(ip)
},
+      :private_addresses => server.addresses[:private].collect { |ip| InstanceAddress.new(ip)
},
       :username => 'root',
       :password => password ? password : nil
     )
@@ -415,8 +415,8 @@ class RackspaceDriver < Deltacloud::Base
       :architecture => 'x86_64',
       :image_id => server[:imageId].to_s,
       :instance_profile => InstanceProfile::new(server[:flavorId].to_s),
-      :public_addresses => server[:addresses][:public],
-      :private_addresses => server[:addresses][:private]
+      :public_addresses => server[:addresses][:public].collect { |ip| InstanceAddress.new(ip)
},
+      :private_addresses => server[:addresses][:private].collect { |ip| InstanceAddress.new(ip)
},
     )
     inst.create_image = 'RUNNING'.eql?(inst.state)
     inst.actions = instance_actions_for(inst.state)

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb?rev=1199710&r1=1199709&r2=1199710&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb
(original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb
Wed Nov  9 12:35:55 2011
@@ -131,7 +131,7 @@ class RimuHostingDriver < Deltacloud::Ba
             :owner_id => "root",
             :instance_profile => InstanceProfile.new("none"),
             :actions => instance_actions_for("RUNNING"),
-            :public_addresses => inst["allocated_ips"]["primary_ip"],
+            :public_addresses => [ InstanceAddress.new(inst["allocated_ips"]["primary_ip"]
),
             :launch_time => inst["billing_info"]["order_date"]["iso_format"]
     })
   end

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/sbc/sbc_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/sbc/sbc_driver.rb?rev=1199710&r1=1199709&r2=1199710&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/sbc/sbc_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/sbc/sbc_driver.rb Wed Nov  9
12:35:55 2011
@@ -206,7 +206,7 @@ class SBCDriver < Deltacloud::BaseDriver
       :realm_id => instance["location"],
       :state => state,
       :actions => instance_actions_for(state),
-      :public_addresses => [instance["primaryIP"]["ip"]],
+      :public_addresses => [ InstanceAddress.new(instance["primaryIP"]["ip"]) ],
       :private_addresses => [],
       :instance_profile => InstanceProfile.new(instance["instanceType"].gsub('/', '-')),
       :launch_time => instance["launchTime"],

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/terremark/terremark_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/terremark/terremark_driver.rb?rev=1199710&r1=1199709&r2=1199710&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/terremark/terremark_driver.rb
(original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/terremark/terremark_driver.rb
Wed Nov  9 12:35:55 2011
@@ -262,8 +262,8 @@ end
                     :realm_id => "US-Miami",
                     :state => current_state,
                     :actions => instance_actions_for(current_state),
-                    :public_addresses => vapp_public_ip,
-                    :private_addresses => vapp_private_ip,
+                    :public_addresses => [ InstanceAddress.new(vapp_public_ip) ],
+                    :private_addresses => [ InstanceAddress.new(vapp_private_ip) ],
                     :instance_profile => profile
                     } )
   end

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb?rev=1199710&r1=1199709&r2=1199710&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb Wed
Nov  9 12:35:55 2011
@@ -174,7 +174,12 @@ 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.
-          instance_address = vm.guest[:net].empty? ? vm.macs.values.first : vm.guest[:net].first[:ipAddress].first
+          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)
+          end
           Instance.new(
             :id => properties[:name],
             :name => properties[:name],
@@ -183,7 +188,7 @@ module Deltacloud::Drivers::VSphere
             :description => properties[:full_name],
             :realm_id => realm_id,
             :state => instance_state,
-            :public_addresses => instance_address,
+            :public_addresses => public_addresses,
             :private_addresses => [],
             :instance_profile => instance_profile,
             :actions => instance_actions_for( instance_state ),

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/models.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/models.rb?rev=1199710&r1=1199709&r2=1199710&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/models.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/models.rb Wed Nov  9 12:35:55 2011
@@ -20,6 +20,7 @@ require 'deltacloud/models/image'
 require 'deltacloud/models/instance'
 require 'deltacloud/models/key'
 require 'deltacloud/models/address'
+require 'deltacloud/models/instance_address'
 require 'deltacloud/models/instance_profile'
 require 'deltacloud/models/storage_snapshot'
 require 'deltacloud/models/storage_volume'



Mime
View raw message