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

Signed-off-by: Michal fojtik <mfoj...@redhat.com>
---
 server/lib/deltacloud/drivers/ec2/ec2_driver.rb | 5 +++--
 server/lib/deltacloud/models/image.rb           | 2 ++
 server/tests/drivers/ec2/images_test.rb         | 7 +++++++
 server/views/images/show.html.haml              | 4 ++++
 server/views/images/show.xml.haml               | 2 ++
 5 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb 
b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index 9c10ff8..84f90b1 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -938,7 +938,8 @@ module Deltacloud
             :owner_id => image[:aws_owner],
             :architecture => image[:aws_architecture],
             :hardware_profiles => image_profiles(image, profiles),
-            :state => image[:aws_state]
+            :state => image[:aws_state],
+            :storage_type => image[:aws_root_device_type]
           )
         end
 
@@ -1071,7 +1072,7 @@ module Deltacloud
                 #group,297467797945,test
                 owner = current[1]
                 name = current[2]
-                groups << {'group_name' => name, 'owner' => owner}
+                groups << {'group_name' => name, 'owner' => ownerec2}
               when 'address'
                 #address,ipv4,10.1.1.1,24
                 address = current[2]
diff --git a/server/lib/deltacloud/models/image.rb 
b/server/lib/deltacloud/models/image.rb
index 19a309c..5ba002b 100644
--- a/server/lib/deltacloud/models/image.rb
+++ b/server/lib/deltacloud/models/image.rb
@@ -24,6 +24,7 @@ class Image < BaseModel
   attr_accessor :state
   attr_accessor :hardware_profiles
   attr_accessor :creation_time
+  attr_accessor :storage_type
 
   def to_hash(context)
     {
@@ -33,6 +34,7 @@ class Image < BaseModel
       :owner => owner_id,
       :architecture => architecture,
       :state => state,
+      :storage_type => storage_type,
       :creation_time => creation_time,
       :hardware_profiles => hardware_profiles.map { |p|
         { :id => p.id, :href => context.hardware_profile_url(p.id), :rel => 
:hardware_profile }
diff --git a/server/tests/drivers/ec2/images_test.rb 
b/server/tests/drivers/ec2/images_test.rb
index 857ede7..cf56c9f 100644
--- a/server/tests/drivers/ec2/images_test.rb
+++ b/server/tests/drivers/ec2/images_test.rb
@@ -45,4 +45,11 @@ describe 'Ec2Driver Images' do
     @driver.image(:id => 'unknown').must_be_nil
   end
 
+  it 'must advertise the image storage_type' do
+    VCR.insert_cassette 'test_0004_must_allow_to_retrieve_single_image'
+    @driver.image(:id => 'ami-aecd60c7').wont_be_nil
+    @driver.image(:id => 'ami-aecd60c7').storage_type.wont_be_nil
+    @driver.image(:id => 'ami-aecd60c7').storage_type.must_equal 'ebs'
+  end
+
 end
diff --git a/server/views/images/show.html.haml 
b/server/views/images/show.html.haml
index f12ecb4..46d4baa 100644
--- a/server/views/images/show.html.haml
+++ b/server/views/images/show.html.haml
@@ -21,6 +21,10 @@
       %li{ :'data-role' => 'list-divider'} Creation Time
       %li
         %p{ :'data-role' => 'fieldcontain'}=@image.creation_time
+    - if @image.storage_type
+      %li{ :'data-role' => 'list-divider'} Storage Type
+      %li
+        %p{ :'data-role' => 'fieldcontain'}=@image.storage_type
     %li{ :'data-role' => 'list-divider'} Architecture
     %li
       %p{ :'data-role' => 'fieldcontain'}=@image.architecture
diff --git a/server/views/images/show.xml.haml 
b/server/views/images/show.xml.haml
index db33666..c0c66ae 100644
--- a/server/views/images/show.xml.haml
+++ b/server/views/images/show.xml.haml
@@ -13,6 +13,8 @@
     %hardware_profiles
       - @image.hardware_profiles.each do |profile|
         %hardware_profile{ :href => hardware_profile_url(profile.id), :id => 
profile.id, :rel => :hardware_profile }
+  - if @image.storage_type
+    %storage_type=@image.storage_type
   %actions
     %link{ :rel => 'create_instance', :method => :post, :href => 
"#{instances_url};image_id=#{@image.id}"}
     - if driver.respond_to? :destroy_image
-- 
1.8.1

Reply via email to