<HTML>
<HEAD>
<TITLE>Re: [Openstack] Using glance to upload/add??</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Cool, so glance internally does some lookup of ‘X-Image-Meta-Store’ and this will over-ride the default_store?<BR>
<BR>
-Josh<BR>
<BR>
On 4/5/12 1:16 PM, "Jay Pipes" <<a href="jaypipes@gmail.com">jaypipes@gmail.com</a>> wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Heya! Answers inline. :)<BR>
<BR>
On 04/05/2012 02:38 PM, Joshua Harlow wrote:<BR>
> Hi all,<BR>
><BR>
> I was looking at the glance add command and I am trying to figure out<BR>
> how to use it to upload images to locations other than the<BR>
> “default_store = file”<BR>
><BR>
> How does one go about telling it which store should be used.<BR>
<BR>
You can pass the X-Image-Meta-Store: header to one of "swift", "s3", or<BR>
"rds". Unfortunately, this is not supported in the glance CLI tool right<BR>
now. You could add a quick hack that adds the X-Image-Meta-Store header<BR>
to the features variable. Something like this git diff shows...<BR>
<BR>
diff --git a/bin/glance b/bin/glance<BR>
index 9eb68ae..f298cce 100755<BR>
--- a/bin/glance<BR>
+++ b/bin/glance<BR>
@@ -228,6 +228,8 @@ EXAMPLES<BR>
                    'min_ram': fields.pop('min_ram', 0),<BR>
      }<BR>
<BR>
+    alternate_store = fields.pop('store', None)<BR>
+<BR>
      for format in ['disk_format', 'container_format']:<BR>
          if format in fields:<BR>
              image_meta[format] = fields.pop(format)<BR>
@@ -260,6 +262,9 @@ EXAMPLES<BR>
          # otherwise error out<BR>
          image_data = sys.stdin<BR>
<BR>
+    if alternate_store:<BR>
+        features['X-Image-Meta-Store'] = alternate_store<BR>
+<BR>
      # allow owner to be set when image is created<BR>
      if 'owner' in fields.keys():<BR>
          image_meta['owner'] = fields.pop('owner')<BR>
<BR>
and try that :)<BR>
<BR>
If it works out, feel free to contribute the patch to Glance ;)<BR>
<BR>
> It seems like there is a /location /option, but that is the fully<BR>
> specified location, and I am unsure about that since the function that<BR>
> eventually gets called in these storage objects doesn't have/receive that.<BR>
><BR>
> def add(self, image_id, image_file, image_size):<BR>
><BR>
> Is it expected that people will only add to locations that use the<BR>
> default_store?<BR>
<BR>
No, but it hasn't been something that users have clamoured for up until<BR>
now -- mostly because people standing up Glance are typically standing<BR>
it up with some default store and only storing images using that store.<BR>
But the "plumbing" is there to support this. as mentioned above.<BR>
<BR>
Best,<BR>
-jay<BR>
<BR>
> Might be nice to actually be able to specify that, and resort to the<BR>
> default_store if its not provided (thus the reason its called default).<BR>
><BR>
> Thx!<BR>
><BR>
> -Josh<BR>
><BR>
><BR>
> _______________________________________________<BR>
> Mailing list: <a href="https://launchpad.net/~openstack">https://launchpad.net/~openstack</a><BR>
> Post to     : <a href="openstack@lists.launchpad.net">openstack@lists.launchpad.net</a><BR>
> Unsubscribe : <a href="https://launchpad.net/~openstack">https://launchpad.net/~openstack</a><BR>
> More help   : <a href="https://help.launchpad.net/ListHelp">https://help.launchpad.net/ListHelp</a><BR>
<BR>
_______________________________________________<BR>
Mailing list: <a href="https://launchpad.net/~openstack">https://launchpad.net/~openstack</a><BR>
Post to     : <a href="openstack@lists.launchpad.net">openstack@lists.launchpad.net</a><BR>
Unsubscribe : <a href="https://launchpad.net/~openstack">https://launchpad.net/~openstack</a><BR>
More help   : <a href="https://help.launchpad.net/ListHelp">https://help.launchpad.net/ListHelp</a><BR>
<BR>
</SPAN></FONT></BLOCKQUOTE>
</BODY>
</HTML>