You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2011/02/08 11:06:07 UTC

[DTACLOUD-16] Allow listing all EC2 images

Hi,

This patch will simply allow you to list *all* Amazon images,
using ?owner_id=all parameter.
*NOTE* that this will return around 5000 images in XML and the
request takes like 50 seconds to complete. That's why I increased
HTTP timeout in Thin.

  -- Michal


Re: [DTACLOUD-16] Allow listing all EC2 images

Posted by David Lutterkort <lu...@redhat.com>.
On Wed, 2011-02-09 at 14:33 +0100, Michal Fojtik wrote:
> On 08/02/11 17:25 -0800, David Lutterkort wrote:
> >On Tue, 2011-02-08 at 11:06 +0100, mfojtik@redhat.com wrote:
> >> This patch will simply allow you to list *all* Amazon images,
> >> using ?owner_id=all parameter.
> >
> >I don't really like having this special param value - we should return
> >all images when no owner_id or other criteria are specified. That's what
> >all the other drivers do.
> 
> Yes, but we must also consider returning all images, since they are so many
> (6700). 
> But anyway, I'm OK with returning all images and I can rework this patch to
> work like that.

Yes, it's dicy, but AFAICT, it's what all the other drivers do. We need
to make sure that users are aware of this change so that they can pass
in appropriate filter params; otherwise they'll be very unhappy if they
get thousands of images all of a sudden.

> >As to the timeout, we are really suffering from a lack of streaming for
> >long-running requests; for now, bumping the timeout is the best we can
> >do.
> 
> Yes, that's right. I'll spend some time to look if there is something we
> can use for streaming to client directly.
> But I think it will be very hard to do, since we need to produce XML (which
> mean render HAML template with collection). Anyway I'll put this into
> backlog.

I agree that it's extremely hard to do, since we'd completely need to
change how we produce the response.

David



Re: [DTACLOUD-16] Allow listing all EC2 images

Posted by Michal Fojtik <mf...@redhat.com>.
On 08/02/11 17:25 -0800, David Lutterkort wrote:
>On Tue, 2011-02-08 at 11:06 +0100, mfojtik@redhat.com wrote:
>> This patch will simply allow you to list *all* Amazon images,
>> using ?owner_id=all parameter.
>
>I don't really like having this special param value - we should return
>all images when no owner_id or other criteria are specified. That's what
>all the other drivers do.

Yes, but we must also consider returning all images, since they are so many
(6700). 
But anyway, I'm OK with returning all images and I can rework this patch to
work like that.

>As to the timeout, we are really suffering from a lack of streaming for
>long-running requests; for now, bumping the timeout is the best we can
>do.

Yes, that's right. I'll spend some time to look if there is something we
can use for streaming to client directly.
But I think it will be very hard to do, since we need to produce XML (which
mean render HAML template with collection). Anyway I'll put this into
backlog.

   -- Michal

-- 
--------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org
--------------------------------------------------------

Re: [DTACLOUD-16] Allow listing all EC2 images

Posted by David Lutterkort <lu...@redhat.com>.
On Tue, 2011-02-08 at 11:06 +0100, mfojtik@redhat.com wrote:
> This patch will simply allow you to list *all* Amazon images,
> using ?owner_id=all parameter.

I don't really like having this special param value - we should return
all images when no owner_id or other criteria are specified. That's what
all the other drivers do.

As to the timeout, we are really suffering from a lack of streaming for
long-running requests; for now, bumping the timeout is the best we can
do.

David



[PATCH core 1/2] Allow to show all EC2 images using owner_id=all

Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>

---
 server/lib/deltacloud/drivers/ec2/ec2_driver.rb |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index fd3f9d9..497d9ef 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -135,10 +135,12 @@ module Deltacloud
             end
             return img_arr
           end
-          owner_id = opts[:owner_id] || "amazon"
+          owner_id = opts[:owner_id] || 'amazon'
           safely do
-            img_arr = ec2.describe_images_by_owner(owner_id, "machine").collect do |image|
-              convert_image(image)
+            if owner_id.eql?('all')
+              img_arr = ec2.describe_images_by_executable_by('all', 'machine').collect { |image| convert_image(image) }
+            else
+              img_arr = ec2.describe_images_by_owner([owner_id], 'machine').collect { |image| convert_image(image) }
             end
           end
           img_arr = filter_on( img_arr, :architecture, opts )
-- 
1.7.4


[PATCH core 2/2] Increased HTTP timeout for requests

Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>

---
 server/bin/deltacloudd |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/server/bin/deltacloudd b/server/bin/deltacloudd
index 70be6ca..6522a39 100755
--- a/server/bin/deltacloudd
+++ b/server/bin/deltacloudd
@@ -103,6 +103,7 @@ else
   argv_opts << ['--address', ENV["API_HOST"] ]
   argv_opts << ['--port', ENV["API_PORT"] ]
   argv_opts << ['--rackup', 'config.ru' ]
+  argv_opts << ['--timeout', '60' ]
   argv_opts << ['--chdir', dirname ]
   argv_opts << ['-e', options[:env] ]
   argv_opts << ['--threaded', '-D', '--stats', '/stats']
-- 
1.7.4