incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject svn commit: r962066 - /incubator/deltacloud/trunk/drivers/ec2/lib/ec2_driver.rb
Date Thu, 08 Jul 2010 23:20:35 GMT
Author: lutter
Date: Thu Jul  8 23:20:34 2010
New Revision: 962066

URL: http://svn.apache.org/viewvc?rev=962066&view=rev
Log:
Wrap auth around snapshot and volume stuff.

Modified:
    incubator/deltacloud/trunk/drivers/ec2/lib/ec2_driver.rb

Modified: incubator/deltacloud/trunk/drivers/ec2/lib/ec2_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/drivers/ec2/lib/ec2_driver.rb?rev=962066&r1=962065&r2=962066&view=diff
==============================================================================
--- incubator/deltacloud/trunk/drivers/ec2/lib/ec2_driver.rb (original)
+++ incubator/deltacloud/trunk/drivers/ec2/lib/ec2_driver.rb Thu Jul  8 23:20:34 2010
@@ -136,13 +136,15 @@ class Ec2Driver < DeltaCloud::BaseDriver
   def storage_volumes(credentials, opts=nil)
     ec2 = new_client( credentials ) 
     volumes = []
-    if (opts)
-      ec2.describe_volumes(opts[:id]).each do |ec2_volume|
-        volumes << convert_volume( ec2_volume )
-      end
-    else
-      ec2.describe_volumes().each do |ec2_volume|
-        volumes << convert_volume( ec2_volume )
+    safely do
+      if (opts)
+        ec2.describe_volumes(opts[:id]).each do |ec2_volume|
+          volumes << convert_volume( ec2_volume )
+        end
+      else
+        ec2.describe_volumes().each do |ec2_volume|
+          volumes << convert_volume( ec2_volume )
+        end
       end
     end
     volumes
@@ -155,13 +157,15 @@ class Ec2Driver < DeltaCloud::BaseDriver
   def storage_snapshots(credentials, opts=nil)
     ec2 = new_client( credentials ) 
     snapshots = []
-    if (opts)
-      ec2.describe_snapshots(opts[:id]).each do |ec2_snapshot|
-        snapshots << convert_snapshot( ec2_snapshot )
-      end
-    else
-      ec2.describe_snapshots(opts).each do |ec2_snapshot|
-        snapshots << convert_snapshot( ec2_snapshot )
+    safely do
+      if (opts)
+        ec2.describe_snapshots(opts[:id]).each do |ec2_snapshot|
+          snapshots << convert_snapshot( ec2_snapshot )
+        end
+      else
+        ec2.describe_snapshots(opts).each do |ec2_snapshot|
+          snapshots << convert_snapshot( ec2_snapshot )
+        end
       end
     end
     snapshots
@@ -213,12 +217,12 @@ class Ec2Driver < DeltaCloud::BaseDriver
   end
 
   def convert_snapshot(ec2_snapshot)
-    { 
+    StorageSnapshot.new( { 
       :id=>ec2_snapshot[:aws_id],
       :state=>ec2_snapshot[:aws_status].upcase,
-      :volume_id=>ec2_snapshot[:aws_volume_id],
+      :storage_volume_id=>ec2_snapshot[:aws_volume_id],
       :created=>ec2_snapshot[:aws_started_at],
-    }
+    } )
   end
 
   def safely(&block) 



Mime
View raw message