incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Image creation from running Instance (rev 1
Date Wed, 02 Mar 2011 11:05:36 GMT

I decide to send out another patch, which fixes all issues mentioned by David.

Also when I tried to figure out how I'll report the link in instance actions for
creating images, I got into a problem how I'll report params needed to complete
this action (like instance_id).

So I came up with this solution and want to know if I'm wrong or not ;-)

So I wrote a simple helper for Sinatra called 'generate_action_params' which
will generate this block for <link> element:

<link href="http://localhost:3001/api/images" method="post" rel="create_image">
  <param name="description" type="string"/>
  <param name="name" type="string"/>
  <param name="instance_id" required="required" type="string" value="i-e90ead85"/>

Usage is simple:

- if @instance.can_create_image?
  %link{:rel => 'create_image', :method => :post, :href => create_image_url}
    - generate_action_params(:images, :create) do |param|
      = =>

Then I realized, that we have another links which take some parameters which
are required, like 'run' or 'create_instance' and there will be more in future
(like storage_snapshots and so on).

Btw. the list of parameters is generated automagically from Rabbit, but
the 'block' syntax gives you some space for customization/add extra params.

Let me know what do you think.

  -- Michal

View raw message