Return-Path: X-Original-To: apmail-deltacloud-dev-archive@www.apache.org Delivered-To: apmail-deltacloud-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8CAFFD9F6 for ; Tue, 14 May 2013 07:14:01 +0000 (UTC) Received: (qmail 24858 invoked by uid 500); 14 May 2013 07:14:01 -0000 Delivered-To: apmail-deltacloud-dev-archive@deltacloud.apache.org Received: (qmail 24735 invoked by uid 500); 14 May 2013 07:14:01 -0000 Mailing-List: contact dev-help@deltacloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltacloud.apache.org Delivered-To: mailing list dev@deltacloud.apache.org Received: (qmail 24725 invoked by uid 99); 14 May 2013 07:14:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 May 2013 07:14:01 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS,T_FRT_PROFIT2 X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mfojtik@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 May 2013 07:13:55 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4E7DYcS026443 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 14 May 2013 03:13:34 -0400 Received: from boosh.local (dhcp-29-41.brq.redhat.com [10.34.29.41]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r4E7DWNQ024806; Tue, 14 May 2013 03:13:33 -0400 Message-ID: <5191E41C.1070005@redhat.com> Date: Tue, 14 May 2013 09:13:32 +0200 From: Michal Fojtik Reply-To: mfojtik@redhat.com Organization: Red Hat Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5 MIME-Version: 1.0 To: dev@deltacloud.apache.org Subject: Re: meaning of 'root_type' attribute added to Image and HardwareProfile References: <434A0ECB689CAF49A3A2321F30F2AB8326434DD6@FALEX03.au.fjanz.com> In-Reply-To: <434A0ECB689CAF49A3A2321F30F2AB8326434DD6@FALEX03.au.fjanz.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Virus-Checked: Checked by ClamAV on apache.org On 05/14/2013 05:44 AM, Koper, Dies wrote: > Hi Michal, > > I must not have been paying attention at the time. I just noticed > transient on fgcp's image descriptions. > I'd like to confirm that that is the correct value for fgcp and ror, but > I don't quite understand what it means. > Or is this an attribute only relevant to EC2? > What would one use it for? Yes, the value is used to differentiate between 'EBS' volume and 'non-EBS' volume. The 'EBS' volume is 'persistent' and the other one is 'transient'. If the disk volume (root hard drive) stay in /api/storage_volumes for FGCP then the right value would be 'persistent'. -- Michal > > Regards, > Dies Koper > > >> -----Original Message----- >> From: mfojtik@redhat.com [mailto:mfojtik@redhat.com] >> Sent: Tuesday, 29 January 2013 8:05 AM >> To: dev@deltacloud.apache.org >> Subject: [PATCH core] API CHANGE: Added the 'root_type' attribute to > Image >> and HardwareProfile >> >> From: Michal Fojtik >> >> The new 'root_type' attribute in case of Image contains information >> about the root device type. There are two possible values: >> >> persistent - Volume or other 'persistent' storage type (EBS) >> transient - Default device that is part of the Image itself >> (instance-store) >> >> In case of HardwareProfile this attribute is presented as a fixed >> 'property' called 'root_type'. The possible values are the same as > above. >> >> The hardware profile and image root_type attributes *must* match in > order >> to create a new instance. In other case an HTTP 400 (Bad Request) will >> be >> returned to client. >> >> Signed-off-by: Michal fojtik >> --- >> server/lib/deltacloud/collections/instances.rb | 2 +- >> server/lib/deltacloud/drivers/ec2/ec2_driver.rb | 13 ++++++++++++- >> server/lib/deltacloud/models/hardware_profile.rb | 4 ++++ >> server/lib/deltacloud/models/image.rb | 6 ++++++ >> server/tests/drivers/ec2/images_test.rb | 7 +++++++ >> server/views/images/show.html.haml | 5 ++++- >> server/views/images/show.xml.haml | 1 + >> server/views/instances/new.html.haml | 2 +- >> 8 files changed, 36 insertions(+), 4 deletions(-) >> >> diff --git a/server/lib/deltacloud/collections/instances.rb >> b/server/lib/deltacloud/collections/instances.rb >> index ffdf09d..adddacf 100644 >> --- a/server/lib/deltacloud/collections/instances.rb >> +++ b/server/lib/deltacloud/collections/instances.rb >> @@ -23,7 +23,7 @@ module Deltacloud::Collections >> >> new_route_for(:instances) do >> @instance = >> Instance.new( { :id=>params[:id], :image_id=>params[:image_id] } ) >> - @image = Image.new( :id => params[:image_id] ) >> + @image = driver.image(credentials, :id => params[:image_id]) >> @hardware_profiles = >> driver.hardware_profiles(credentials, :architecture => >> @image.architecture ) >> @realms = [Realm.new(:id => params[:realm_id])] if >> params[:realm_id] >> @realms ||= driver.realms(credentials) >> diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb >> b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb >> index 9c10ff8..cd048c9 100644 >> --- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb >> +++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb >> @@ -53,6 +53,7 @@ module Deltacloud >> memory 613 >> storage 160 >> architecture ['i386','x86_64'] >> + root_type :persistent >> end >> >> define_hardware_profile('m1.small') do >> @@ -938,10 +939,15 @@ 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], >> + :root_type => >> convert_root_type(image[:aws_root_device_type]) >> ) >> end >> >> + def convert_root_type(type) >> + type == 'ebs' ? 'persistent' : 'transient' >> + end >> + >> def convert_instance(instance) >> can_create_image = 'ebs'.eql?(instance[:root_device_type]) >> and 'RUNNING'.eql?(convert_state(instance[:aws_state])) >> inst_profile_opts={} >> @@ -1146,6 +1152,11 @@ module Deltacloud >> end >> >> exceptions do >> + >> + on /root device is not supported for the instance/ do >> + status 400 >> + end >> + >> on /(AuthFailure|InvalidAccessKeyId)/ do >> status 401 >> end >> diff --git a/server/lib/deltacloud/models/hardware_profile.rb >> b/server/lib/deltacloud/models/hardware_profile.rb >> index 5b4aa4e..9d76a2e 100644 >> --- a/server/lib/deltacloud/models/hardware_profile.rb >> +++ b/server/lib/deltacloud/models/hardware_profile.rb >> @@ -46,11 +46,15 @@ module Deltacloud >> property :architecture >> property :memory >> property :storage >> + property :root_type >> >> def initialize(profile_id, &block) >> @properties = {} >> super(:id => profile_id) >> result = instance_eval(&block) if block_given? >> + unless @properties.include? :root_type >> + root_type(:transient) >> + end >> @name ||= profile_id >> result >> end >> diff --git a/server/lib/deltacloud/models/image.rb >> b/server/lib/deltacloud/models/image.rb >> index 551d861..6359661 100644 >> --- a/server/lib/deltacloud/models/image.rb >> +++ b/server/lib/deltacloud/models/image.rb >> @@ -24,6 +24,11 @@ class Image < BaseModel >> attr_accessor :state >> attr_accessor :hardware_profiles >> attr_accessor :creation_time >> + attr_accessor :root_type >> + >> + def root_type >> + @root_type || 'transient' >> + end >> >> def to_hash(context) >> { >> @@ -34,6 +39,7 @@ class Image < BaseModel >> :owner => owner_id, >> :architecture => architecture, >> :state => state, >> + :root_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..4ee622d 100644 >> --- a/server/views/images/show.html.haml >> +++ b/server/views/images/show.html.haml >> @@ -21,11 +21,14 @@ >> %li{ :'data-role' => 'list-divider'} Creation Time >> %li >> %p{ :'data-role' => 'fieldcontain'}=@image.creation_time >> + %li{ :'data-role' => 'list-divider'} Root Device Type >> + %li >> + %p{ :'data-role' => 'fieldcontain'}=@image.root_type >> %li{ :'data-role' => 'list-divider'} Architecture >> %li >> %p{ :'data-role' => 'fieldcontain'}=@image.architecture >> - if @image.hardware_profiles >> - %li{ :'data-role' => 'list-divider'} Hardware Profiles >> + %li{ :'data-role' => 'list-divider'} Compatible Hardware >> Profiles >> %li >> %div{ :'data-role' => 'controlgroup', :'data-type' => >> "horizontal" } >> - @image.hardware_profiles.each do |hwp| >> diff --git a/server/views/images/show.xml.haml >> b/server/views/images/show.xml.haml >> index db33666..ac014af 100644 >> --- a/server/views/images/show.xml.haml >> +++ b/server/views/images/show.xml.haml >> @@ -13,6 +13,7 @@ >> %hardware_profiles >> - @image.hardware_profiles.each do |profile| >> %hardware_profile{ :href => >> hardware_profile_url(profile.id), :id => profile.id, :rel >> => :hardware_profile } >> + %root_type=@image.root_type >> %actions >> %link{ :rel => 'create_instance', :method => :post, :href => >> "#{instances_url};image_id=#{@image.id}"} >> - if driver.respond_to? :destroy_image >> diff --git a/server/views/instances/new.html.haml >> b/server/views/instances/new.html.haml >> index 77881ea..f6f674e 100644 >> --- a/server/views/instances/new.html.haml >> +++ b/server/views/instances/new.html.haml >> @@ -2,7 +2,7 @@ >> =subheader "#{@image.id}" >> >> .hidden_content >> - - @hardware_profiles.each do |profile| >> + - @image.hardware_profiles.each do |profile| >> %div{ :'data-role' => :fieldcontain, :id => >> "hwp_properties_#{profile.name}", :class => 'property_block'} >> - profile.properties.reject { |prop| prop.fixed? }.each do > |prop| >> %label{ :for => "#{prop.param}_#{profile.name}", :class => >> 'ui-input-text' }=prop.name >> -- >> 1.8.1 >> > > -- Michal Fojtik Deltacloud API, CloudForms