horizon/releasenotes/notes/bp-horizon-glance-large-image-upload-c987dc86bab38761.yaml
Timur Sufiev 93af461e40 [Django] Allow to upload the image directly to Glance service
Since large Glance images even temporarily stored on dashboard side
tend to fill up Web Server filesystem, it is desirable to route image
payload directly to Glance service (which usually streams it to
storage backend, which in turn has plenty of space).

To make it possible we need to trick Django into thinking that a file
was selected inside FileInput, while its contents are not actually
transferred to Django server. Then, once image is created client-side
code needs to know the exact url the image payload needs to be
transferred to. Both tasks are solved via using ExternalFileField /
ExternalUploadMeta classes which allow to work around the usual Django
form processing workflow with minimal changes to CreateImage form
business logic.

The client-side code relies on CORS being enabled for Glance service
(otherwise browser would forbid the PUT request to a location
different from the one form content came from). In a Devstack setup
you'll need to edit [cors] section of glance-api.conf file, setting
`allowed_origin` setting to the full hostname of the web server (say,
http://<HOST_IP>/dashboard) and restart glance-api process.

A progress bar is implemented to track the progress of a file upload,
in case a really huge image is transferred.

The new machinery could be easily switched on/off with a single
setting `HORIZON_IMAGES_UPLOAD_MODE` set to 'direct' / 'legacy'.

Related-Bug: #1467890
Closes-Bug: #1403129
Implements blueprint: horizon-glance-large-image-upload
Change-Id: I01d02f75268186b43066df6fd966aa01c08e01d7
2016-08-16 14:30:38 +03:00

17 lines
764 B
YAML

---
features:
- Create from a local file feature is added to both Angular and Django
Create Image workflows. It works either in a 'legacy' mode
which proxies an image upload through Django, or in a new
'direct' mode, which in turn implements
[`blueprint horizon-glance-large-image-upload
<https://blueprints.launchpad.net/horizon/+spec/horizon-glance-large-image-upload>`_].
To use the direct mode HORIZON_IMAGES_UPLOAD_MODE setting
should be changed to 'direct' value along with changing
glance-api.conf cors.allowed_origin parameter to the URL
from which Horizon is served.
deprecations:
- HORIZON_IMAGES_ALLOW_UPLOAD setting is deprecated and
should be gradually replaced with
HORIZON_IMAGES_UPLOAD_MODE setting.