You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by di...@fast.au.fujitsu.com on 2013/04/07 14:15:36 UTC
[PATCH] CIMI: return cimi standard state where known. Also, return image name as name if set. https://issues.apache.org/jira/browse/DTACLOUD-538
From: Dies Koper <di...@fast.au.fujitsu.com>
---
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
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
--
1.8.0.msysgit.0
RE: [PATCH] CIMI: return cimi standard state where known. Also, return image name as name if set. https://issues.apache.org/jira/browse/DTACLOUD-538
Posted by "Koper, Dies" <di...@fast.au.fujitsu.com>.
Hi Michal,
> 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.
I've transferred the jira to you as I think it needs to be done before
the plugfest (there is a capture test scenario which may fail if other
test clients rely on the image state to follow CREATING->AVAILABLE as
per the cimi spec).
Also, there is a similar jira for volumes that you may want to resolve
at the same time:
https://issues.apache.org/jira/browse/DTACLOUD-453
> > - :name => image.id,
> > + :name => image.name || image.id,
And please include this part in your fix :)
Cheers,
Dies
Re: [PATCH] CIMI: return cimi standard state where known. Also, return
image name as name if set. https://issues.apache.org/jira/browse/DTACLOUD-538
Posted by Michal Fojtik <mf...@redhat.com>.
On 04/07/2013 02:15 PM, diesk@fast.au.fujitsu.com wrote:
NACK. Reason below.
-- Michal
> From: Dies Koper <di...@fast.au.fujitsu.com>
>
> ---
> 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 <mf...@redhat.com>
Deltacloud API, CloudForms