81 Commits

Author SHA1 Message Date
Frode Nordahl
4590f5fbde Create image directly in 'copy_from' and 'location' case
The Glance API will return immediately with a response. We need this
response to give a errror message back to the user in case of invalid
URL.

Any download operation will be executed in the background by the
Glance API server and there is no need for executing this step in a
separate thread.

Keep current logic for updating image with posted data in a background thread
One can argue that this too is uneccessary, but I can see that it may save
time for large images or when bandwidth between Horizon and Glance is limited.

Change-Id: I2ec9f714f9cfd6ca2271750133d6fcac29b94f35
Partial-Bug: 1438975
2015-06-10 22:06:09 +02:00
lincai
810ad30607 I/O error uploading image
Fixed two errors when upload an image from a file.
One is the file name doesn't exist error.
Another is file got closed in a new thread since Django 1.7.

Change-Id: Ia64c385d89e0d938b14182f2744251f76b892eac
Closes-Bug: #1451429
2015-06-02 13:35:36 +00:00
Szymon Wroblewski
9579280bf5 [Launch Instance Fix] Glance rest API fix
Adds support for resource_type, so retrieved namespaces will have
properties with proper prefixes.

Closes-Bug: 1439312
Change-Id: I4c2b450db8189c99624290a1d678fcaf509e1de6
2015-04-02 17:37:26 +02:00
Doug Fish
8bad0afcfb Add --location option to image create
Allow images to be created using glance's --location option
instead of always requiring --copy-from

Change-Id: I2aae47570f09a695adb032c210d7dc770f8cb746
Closes-Bug: #1433819
2015-03-30 10:08:22 -05:00
Yash Bathia
68291ecd97 Fixing typo in Glance API
Fixing typo in the comment of Glance API

Change-Id: I06f6520c46a83bd6e26cb066a21d950a848e3fb7
Closes-Bug: #1433729
2015-03-18 11:37:49 -07:00
Travis Tripp
1126054cf3 Glance Rest API for Angular Front End
This is the glance direct / non-abstracted rest API
for the angular front end.

This initial patch will only implement the APIs needed to
support the launch instance work.

This was refactored out of change: 141273
All v1 / v2 work is being done separately in change: 150084

Based on the work done for Keystone here:
https://review.openstack.org/#/c/150636

Partially Implements: blueprint launch-instance-redesign
Co-Authored-By: Richard Jones <r1chardj0n3s@gmail.com>
Change-Id: I28735e242d610235695b1070a15f739e0d50b696
2015-02-18 15:30:38 -07:00
Jenkins
182dd6fcd1 Merge "Clean '/tmp' after image upload from horizon" 2015-01-21 18:24:15 +00:00
Travis Tripp
7e5f4d1594 Base Glance Metadata Definitions Admin UI
Provide a base admin UI for viewing, importing, and associating the
metadata definitions that can be used with various resource types
such as flavors, images, and host aggregates.

In Juno, Glance provided a metadata definitions catalog[1][2] where
users can register the available metadata definitions that can be used
on different types of resources (images, artifacts, volumes, flavors,
aggregates, etc). This includes key / value pairs such as
properties, extra specs, etc. Horizon landed several patches that
read these properties. You can view the functionality in the
"update metadata" action on Flavors, Images, and Host Aggregates.

This specific patch is to bring in the Admin UI for the basic coarse
grained actions on the definitions in the catalog. This includes creating
(importing) a namespace, viewing the overview details about
it, deleting the namespace, and associating the namespace for use with
specific resource types.

Future blueprints will be registered for:
 - CRUD on individual metadata definitions within the namespace
For example, editing the default value of an individual property.

[1] Approved Glance Juno Spec:
https://github.com/openstack/glance-specs/blob/master/specs/juno/metadata-schema-catalog.rst

[2] Glance PTL Juno Feature Overview:
https://www.youtube.com/watch?v=3ptriiw1wK8&t=14m27s

Co-Authored-By: Travis Tripp <travis.tripp@hp.com>
Co-Authored-By: Santiago Baldassin<santiago.b.baldassin@intel.com>
Co-Authored-By: Bartosz Fic <bartosz.fic@intel.com>
Co-Authored-By: Pawel Koniszewski <pawel.koniszewski@intel.com>
Co-Authored-By: Michal Dulko <michal.dulko@intel.com>
DocImpact: Concept awareness
Change-Id: Ie34007f73af7e0941631a52f03841068e509a72c
Implements: blueprint glance-metadata-definitions-base-admin-ui
2014-12-17 16:10:53 -07:00
Vlad Okhrimenko
647c14e68b Clean '/tmp' after image upload from horizon
After image upload(successful or fails) from horizon, image
cleaned up from the /tmp

Closes-Bug: #1398766

Change-Id: I2c40e67234a8d0c8bdef9838b863ade9f5434083
2014-12-12 17:32:05 +02:00
Akihiro Motoki
47f1d49690 Do not log keystone token
Previously token values are logged as DEBUG level when a new client
object is instantiated. In other project and clients, token values
are now not logged and is output as *REDACTED* instead.
In Horizon these log lines do not have much meaning and
we can simply remove them.

Change-Id: I67617ac6424907574d79ec2a57b513a548e220d2
Closes-Bug: #1380642
2014-10-17 16:10:41 +09:00
Akihiro Motoki
26da6ed48c Fix E127 errors in remaining openstack_dashboard/
E127 continuation line over-indented for visual indent

Also fixes E127 introduces by other reviews
after other E127 fixes were merged.

Closes-Bug: #1375931
Change-Id: I0a09f1c2f74c707fc8a347f0ea5975bf2679976e
2014-10-15 13:50:07 +09:00
Akihiro Motoki
69e0d812f2 Reuse API client object in a request
Previously API client object like novaclient are created
every time methods in openstack_dashboard/api.
It leads to regeneration of API HTTP connections.
This commit caches API client object for a WSGI request
to reduce the number of HTTP connection to backends.
As WSGI request object is recreated, a cached API client
object will live in a single request to Horizon.

Change-Id: I66620b3b0a2737c7232d91006e65d0fabbd3090b
Closes-Bug: #1352144
2014-09-17 14:19:10 +09:00
Michal Dulko
2e3299dc57 Widget to expose the metadata catalog from glance
In Juno, Glance is providing a metadata definitions catalog[1][2] where
users can register the available metadata definitions that can be used
on different types of resources (images, artifacts, volumes, flavors,
aggregates, etc). This includes both simple tags and key / value pairs
(properties, specs, etc).

This widget will get the metadata definitions from Glance
and will let the user add the metadata to the resource being edited.
It provides value validation as well as description information
about the metadata.

An implementation for Images is included in this patch. Additional
patches will be made for other resource types.

This patch also removes Edit Image Custom Properties screen as new
widget provides the same functionality. To avoid regressions owner
property is added to Image Detail screen.

********************** TESTING **************************
You can test this code with Glance patches by following
the instructions at the bottom of this etherpad:
Go to: https://etherpad.openstack.org/p/j3-glance-patches
*********************************************************

[1] Approved Glance Juno Spec:
https://github.com/openstack/glance-specs/blob/master/specs/juno/metadata-schema-catalog.rst

[2] Glance PTL Juno Feature Overview:
https://www.youtube.com/watch?v=3ptriiw1wK8&t=14m27s

Implements: blueprint tagging
DocImpact

Co-Authored-By: Santiago Baldassin <santiago.b.baldassin@intel.com>
Co-Authored-By: Pawel Skowron <pawel.skowron@intel.com>
Co-Authored-By: Travis Tripp <travis.tripp@hp.com>
Co-Authored-By: Szymon Wroblewski <szymon.wroblewski@intel.com>
Co-Authored-By: Michal Dulko <michal.dulko@intel.com>
Co-Authored-By: Bartosz Fic <bartosz.fic@intel.com>
Co-Authored-By: Pawel Koniszewski <pawel.koniszewski@intel.com>
Co-Authored-By: Heather Whisenhunt <heather.whisenhunt@hp.com>

Change-Id: I335d4708f5ce8afe58fb88dbe9efd79e2c04fc9e
2014-09-11 19:10:41 +02:00
Radomir Dopieralski
0eca7449cc Fix Flake8 style warnings in openstack_dashboard/
Warnings H904, H307 and H405 are new or considerably changed, and will
be fixed in a separate patch.

Closes-bug: #1349820
Partial-bug: #1347472

Change-Id: I4fd28990dacf16f03a4eaa6074ef59c37f1a2c14
2014-07-30 14:13:24 +02:00
Justin Pomeroy
763b69b027 Add ability to manage image custom properties
This adds a new action on the admin images table for viewing the
image custom properties. From this new panel an admin can create,
delete, or update the custom properties. The new setting
IMAGE_RESERVED_CUSTOM_PROPERTIES can be used to specify any custom
properties that should not show up on this panel.

Change-Id: I10a6049e8cc6a06f31497e17a66d7031cd049c68
Implements: blueprint manage-image-custom-properties
2014-07-16 12:28:21 -05:00
Cindy Lu
2428d78a15 add Previous link to Admin > Images table
The Glance API supports a sort direction which we can use to paginate back

The Prev href tag contains a marker id of the first item in the table.
When clicked, a GET API call is made, passing in this marker and the sort_dir='asc'
This will return the previous page's data.  Then we have to re-sort the data because
it is ordered backwards.  We use the default sort_key='created_by' for this.

Once the patch #1252649 is restored, we can add the same behavior to Project > Images.

If we are able to get the consistency across the APIs to include the sort_dir, then we can
bring Prev to the other project tables as well.  There are some blueprints to enhance
API capabilities in this area.

Change-Id: I3e7c6a2db595838dbdff595dc8f0fdda288b6bcf
Partial-Bug: #1263142
Partial-Bug: #1282987
Partially-implements: blueprint pagination-add-prev-link
2014-06-27 18:29:02 -07:00
Nicolas Simonds
99aa842e97 Image uploads should always happen in the background
Sufficiently large image uploads into Glance from Horizon can cause
timeout errors, since the image upload needs to complete before the
view can render, and such activities can cause browser timeouts.
Since the webserver already has the file, and close-to-open semantics
should prevent cleanups from losing any data, just send it in a
background thread, the same way as if you told Horizon to fetch it
from a remote location.

Change-Id: Ia056367032e0d08edf6f36a8e9f900fddba85fdf
Closes-Bug: 1322399
2014-06-04 06:57:33 -07:00
Zhenguo Niu
af0e253d8d Do not delete properties when create image from URL
Set purge_props=False to ensure we do not delete properties that
we have set on the image.

Change-Id: I4d8a9b8b20ef946e86389c59e79e874f078e1db3
Closes-Bug: #1325787
2014-06-04 14:23:08 +08:00
He Yongli
e790ac070e Remove extraneous vim configuration comments
Remove vim setting:
comment - # vim: tabstop=4 shiftwidth=4 softtabstop=4

at the top of source code files, except for files in
openstack/common.

Change-Id: I9a5c6b17c6ef7ecec601f4503dfc7b31fc72e90a
Close-bug: #1229324
2014-05-06 15:30:10 +08:00
Mike Moore
641c7da63b Stop altering the glance API URL
Horizon should treat the glance API endpoint URL the way it treats
other API endpoint URLs.
Horizon should trust that the retrieved URL is correct, and let the
python-glanceclient use the URL.

Change-Id: Ie6230b1e4b90f686c8a7ab7368944b6c3412b284
Closes-Bug: 1188182
2014-03-14 11:13:33 -06:00
Fengqian Gao
9133f5ad63 Use six.moves.urllib.parse instead of urlparse
To keep Python 3.x compatibility, use six.moves.urllib.parse to
replace urlparse.

Partial-Bug: #1279611

Change-Id: Ie49589651ed80d8fc3196fb0750cbb04661c19cd
2014-02-24 13:45:47 +08:00
Radomir Dopieralski
028332da4a Remove #noqa from most common imports and add them to import_exceptions
We have a lot of import with #noqa that is there to ignore h302,
because it's traditional to import and use a name directly, instead
of a whole module. This hides other errors and gives people the
impression that it's actually fine to import non-modules, you just
have to slap #noqa on those lines.

I went through the code and identified about a dozen names that are
most commonly imported this way. I remove the #noqa tag from them,
and added them to the list in import_exceptions.

I also removed a few unused imports that were revealed in the process.

Change-Id: I27afb8e2b1d4759ec974ded9464d8f010312ee78
2014-01-07 12:26:35 +01:00
Leandro I. Costantino
af5635a61c Cannot view detailed image with empty name.
After creating an image with empty name (only space characters in the name),
and attempting to view it, the view crashes.
Glance is not returning the name X-Meta-Header on the response if the
name is not set or empty.

Change-Id: I0c55e302d22552e932bdd32e10d00a103d252429
Closes-Bug: 1261367
2013-12-17 08:43:14 -05:00
David Lyle
e7a8a20d60 Centralizing page size code, reading cookie
Centralizing duplicate code around the default page size.
Additionally, we now read the 'horizon_pagesize' cookie set for
the user in the settings panel to reuse the value across sessions.

Closes-bug: #1251456

Change-Id: I78b6c978926f53a598f89745c517b8083270e5ba
2013-12-11 16:50:59 -07:00
Paul Belanger
da8c69afa6 Gate on H4xx docstrings for pep8
In an effort to help horizon more friendly to OpenStack hacking
guidelines, we now gate on H40* violations.

Change-Id: Id07294543660368d2f7f5ac363710176ab23b874
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
2013-11-23 12:51:07 -05:00
Jasper Capel
12ab09a994 Custom CA certificate for verifying SSL connections
The various OpenStack client libaries support specifying a SSL
certificate that should be used to verify the SSL-connection, but
this option was not exposed in the horizon options. This patch
implements that. Note that although some clients do implement a
cacert-parameter, they do not necessarily actually verify the
certificate (Swift).

Change-Id: I9dfbd48a0d96103421da7d884e839d591a90cab1
Implements: blueprint ssl-cacert
2013-09-03 11:24:41 +02:00
Nicolas Simonds
4b70efafb4 Use the horizon_pagesize value in the session cookie
This makes the API calls that are claiming to do pagination work
the same as Nova, which has had it the longest.  Namely, there's a
user setting to control how many rows get returned.  Make them heed
it.

Fixes Bug: 1217608
Change-Id: I19b4d7c77d595b898abb81462f6343bbc1b93eb6
2013-08-29 10:17:34 -07:00
Tatiana Mazur
953d1b9793 Enable H302 check
This patch replaces some method imports with module imports and
makes H302 test enabled.

Fixes bug 1188531

Change-Id: Ibfbddeaa19cbbb244da58ffd5c918c41f03a0c65
2013-08-22 17:39:09 +04:00
Jiri Tomasek
8a0b4c7e47 Mix snapshots and images tables together
Don't filter snapshots from images data, display image_type column in images table,
don't translate image string in get_image_type method, don't show LaunchImage button when
image is in different state than active, remove snapshots table from the UI, update tests

Fixes: bug #1140760

Change-Id: Ie6cc5bc98fa97de00b55540fe9f60e90d20acab3
2013-06-07 15:27:05 +02:00
Kieran Spear
c822a9f16e Fix images/snapshots table pagination
For project images, disable pagination entirely as it's not compatible
with client-side filtering (at least without moving to asynch table
loading). This can be revisited when we move to glance v2, which
apparently supports filtering by owner.

For snapshots and admin images, fix pagination by making sure the
iterator returned by glanceclient isn't exhausted completely when
returning a page of images. Do this by slicing just the number of
images we require (+ 1 to check if there will be another page after
this one).

Fixes bug #1083034.

Change-Id: I692f57dec6dca16cf8909f5b234aadb002702fc8
2013-02-20 11:03:33 +11:00
Gabriel Hurley
cb8e7c1f8f Splits OpenStack Dashboard bits from framework app code.
Moves everything OpenStack-specific (dashboards, apis, etc.)
into the openstack_dashboard project, achieving a much
cleaner separation between the project-specific code and
the generic Horizon framework code.

Change-Id: I7235b41d449b26c980668fc3eb4360b24508717b
2012-10-11 11:47:50 -07:00