On 04/07/2013 02:15 PM, [email protected] wrote:

NACK. Reason below.

  -- Michal

From: Dies Koper <[email protected]>

---
  server/lib/cimi/service/machine_image.rb | 13 +++++++++++--
  1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/server/lib/cimi/service/machine_image.rb 
b/server/lib/cimi/service/machine_image.rb
index 17d9220..2232ddd 100644
--- a/server/lib/cimi/service/machine_image.rb
+++ b/server/lib/cimi/service/machine_image.rb
@@ -27,11 +27,20 @@ class CIMI::Service::MachineImage < CIMI::Service::Base
    end

    def self.from_image(image, context)
+    # convert to equivalent cimi states for known mappings
+    state = case image.state
+      when 'ACTIVE' then 'AVAILABLE' # openstack
+      when 'PENDING' then 'CREATING' # ec2, fgcp
+      when 'PREPARING' then 'CREATING' # rackspace
+      when 'SAVING' then 'CREATING' # openstack
+      when 'FAILED' then 'ERROR' # ec2, rackspace
+      else image.state || 'UNKNOWN'
+    end

I think we should unify these states across all providers in drivers, not here, I will be OK with these states for image:

'ACTIVE'
'PENDING'
'ERROR'
'UNKNOWN'

I can help you with this. Once we do this in drivers, then we don't need to do this.

 -- Michal

      self.new(context, :values => {
        :id => context.machine_image_url(image.id),
-      :name => image.id,
+      :name => image.name || image.id,
        :description => image.description,
-      :state => image.state || 'UNKNOWN',
+      :state => state,
        :type => "IMAGE",
        :created => image.creation_time.nil? ?
        Time.now.xmlschema : Time.parse(image.creation_time.to_s).xmlschema



--

Michal Fojtik <[email protected]>
Deltacloud API, CloudForms

Reply via email to