Ask Your Question

How to transfer an image between two OpenStack platforms?

asked 2020-06-17 07:37:57 -0500

lorciv gravatar image

updated 2020-06-19 04:34:45 -0500

I have access to two distinct OpenStack platforms, which I will call A and B. I have a glance image on platform A, and I would like to transfer it to platform B. The image is the result of a snapshot of a virtual machine.

At the moment, I do the following steps:

  • (make sure the OpenStack CLI is installed on my personal computer)
  • authenticate to A
  • download the image from A to my PC (e.g. with openstack image save --file <filename> <image>)
  • authenticate to B
  • upload the image from my PC to B (e.g. with openstack image create --file <filename> <name>)

This does the work. However, since my PC sits on a slow separate network, the transfer tends to take a very long time. Also, this three-step procedure A -> PC -> B does not seem like an efficient approach in general, especially when one has no need to save a local copy of the image that is being transferred.

Is it possible transfer the image from A to B directly, thus avoiding the intermediate step? And if it is, how can I do it?

edit retag flag offensive close merge delete


You could save the image to stdout, then pipe it into a curl command (I don't think openstack image create can read from stdin).

openstack image save ... | curl -X PUT -d @- ... $image_url/v2/images/{image_id}/file

Before that, you need to create the destination catalog entry.

Bernd Bausch gravatar imageBernd Bausch ( 2020-06-17 08:40:47 -0500 )edit

It seems the glance client can upload image data from stdin (glance image-create).

And or course you can transfer it from A to B without going through the PC.

Bernd Bausch gravatar imageBernd Bausch ( 2020-06-17 08:44:44 -0500 )edit

Thank you for your answer. With the solution that you are suggesting, wouldn't the traffic still pass through my PC? I understand that thanks to the i/o redirection I do not have to buffer the data in a tempoirary file, however that would still not be a direct transfer A -> B as far as I can tell.

lorciv gravatar imagelorciv ( 2020-06-17 10:06:46 -0500 )edit

When you run the command on a server in A or B, I/O doesn't pass through the PC.

Bernd Bausch gravatar imageBernd Bausch ( 2020-06-17 17:01:10 -0500 )edit

This is certainly true if I can access both machines with SSH. However, all I have is OpenStack credentials, so I am wondering if it is possible to transfer the image using the OpenStack APIs only.

lorciv gravatar imagelorciv ( 2020-06-19 04:36:51 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2020-06-19 13:23:06 -0500

zaneb gravatar image

The only way I can think of to do this with OpenStack APIs only is to first upload the image to Swift in either A or B, then import from the Swift object into Glance in both A and B using the web-download workflow. (Note that this feature was added to Glance in the Queens release.) An obvious disadvantage to this is that the image data in Swift has to be public.

Alternatively, as Bernd suggested, you can spin up a Nova VM in one of the clouds and do the download+upload from there so that it doesn't have to traverse the network to your PC.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools



Asked: 2020-06-17 07:37:57 -0500

Seen: 201 times

Last updated: Jun 19 '20