← Back to team overview

openstack team mailing list archive

Re: Using glance to upload/add??

 

Cool, so glance internally does some lookup of 'X-Image-Meta-Store' and this will over-ride the default_store?

-Josh

On 4/5/12 1:16 PM, "Jay Pipes" <jaypipes@xxxxxxxxx> wrote:

Heya! Answers inline. :)

On 04/05/2012 02:38 PM, Joshua Harlow wrote:
> Hi all,
>
> I was looking at the glance add command and I am trying to figure out
> how to use it to upload images to locations other than the
> "default_store = file"
>
> How does one go about telling it which store should be used.

You can pass the X-Image-Meta-Store: header to one of "swift", "s3", or
"rds". Unfortunately, this is not supported in the glance CLI tool right
now. You could add a quick hack that adds the X-Image-Meta-Store header
to the features variable. Something like this git diff shows...

diff --git a/bin/glance b/bin/glance
index 9eb68ae..f298cce 100755
--- a/bin/glance
+++ b/bin/glance
@@ -228,6 +228,8 @@ EXAMPLES
                    'min_ram': fields.pop('min_ram', 0),
      }

+    alternate_store = fields.pop('store', None)
+
      for format in ['disk_format', 'container_format']:
          if format in fields:
              image_meta[format] = fields.pop(format)
@@ -260,6 +262,9 @@ EXAMPLES
          # otherwise error out
          image_data = sys.stdin

+    if alternate_store:
+        features['X-Image-Meta-Store'] = alternate_store
+
      # allow owner to be set when image is created
      if 'owner' in fields.keys():
          image_meta['owner'] = fields.pop('owner')

and try that :)

If it works out, feel free to contribute the patch to Glance ;)

> It seems like there is a /location /option, but that is the fully
> specified location, and I am unsure about that since the function that
> eventually gets called in these storage objects doesn't have/receive that.
>
> def add(self, image_id, image_file, image_size):
>
> Is it expected that people will only add to locations that use the
> default_store?

No, but it hasn't been something that users have clamoured for up until
now -- mostly because people standing up Glance are typically standing
it up with some default store and only storing images using that store.
But the "plumbing" is there to support this. as mentioned above.

Best,
-jay

> Might be nice to actually be able to specify that, and resort to the
> default_store if its not provided (thus the reason its called default).
>
> Thx!
>
> -Josh
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp

_______________________________________________
Mailing list: https://launchpad.net/~openstack
Post to     : openstack@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


Follow ups

References