When using glance v2 client, it will leave an upload
tmp file in /tmp folder, which will cause upload error
if its filesystem (in memory) is full.
Change-Id: I0a7267db894e7be4216a346752d299132df9a29a
Closes-Bug: #1689694
The api.glance.image_list_detailed() function accepts a list of
filters which it then translates into a form that is acceptable for
Glance v1 or Glance v2. These translations included support for
mapping 'is_public' to 'visibility', but did not include support for
mapping 'property-owner_id' to 'owner'.
This changes adds support for mapping 'property-owner_id' to 'owner'
for Glance v2, and mapping 'owner' to 'property-owner_id' for Glance
v1.
Before this fix, "rebuild instance" from the instances page did not
properly list project-specific images as options. After this fix,
"rebuild instance" is working as expected.
Change-Id: Ica750f8b36bdbadd02a81aed41fd250864a49a66
Closes-Bug: 1671693
attribute-level imports are not checked by hacking module now.
most noqa is used to disable warnings on attribute-level imports.
This commit drops noqa for this purpose.
After this, there are only 3 noqa under openstack_dashboard/ :)
Change-Id: I4a449802f5dbd6e44e4b8b5c378a555d47d9a99f
Even if Horizon is configured to use internal endpoints for requests
made by its server side to other OpenStack services, the client side
should not be restricted to run only in networks which have access to
the internal endpoints.
Change-Id: Ibdc663a133670e8f07530c0d7c5ed7df2d92b99b
Closes-Bug: #1639080
Since Horizon is going to be the first (or, one of the first)
OpenStack component using the new MongoDB driver, it won't be able to
retrieve traces made by other components using MongoDB driver (which
it should use because Ceilometer driver was too slow) for a
while. This means that Horizon itself is responsible for tracing the
rendering of its pages down to the layer where the flow of control
leaves Horizon domain. So, a lot of api wrappers in
openstack_dashboard.api are augmented with tracing decorator to
achieve this goal.
Co-Authored-By: Timur Sufiev <tsufiev@mirantis.com>
Implements-blueprint: openstack-profiler-at-developer-dashboard
Change-Id: Ib36692f0e9e68ed7fa0cd47919ba6581c9c8ab57
Implements wrappers necessary for Horizon to work with either Glance
v1 or v2 and removes the dependency on the Glance v1 endpoint.
Handles the differences between setting properties with v1 and v2 and
restricts some Glance functions that aren't supported in v2.
Implements blueprint: horizon-glance-v2
Co-Authored-By: Travis Tripp <travis.tripp@hp.com>
Co-Authored-By: Brad Pokorny <Brad_Pokorny@symantec.com>
Co-Authored-By: Timur Sufiev <tsufiev@mirantis.com>
Co-Authored-By: Liuqing Jing <jing.liuqing@99cloud.net>
Change-Id: Icca91c53eabf18c3109b3931ed53f70eaaaa0e56
In case 'data' image attribute is a base string (instead of in-memory
or on-disk file), api.glance sends back an image wrapper with a redirect
url and a token to its caller, so the caller could upload the file to
that url directly.
Provide a unit test for api.glance behavior when an external upload
location is used. That also requires to fix glance stub endpoint data
in keystone_data.py since it didn't reflect the reality.
Also document the new HORIZON_IMAGES_UPLOAD_MODE setting that will
govern direct images upload and the define approach to deprecating the
old HORIZON_IMAGES_ALLOW_UPLOAD setting. The old setting is deprecated
as of Newton release and planned to be removed in P. 'Removing' means
that it will no longer be used / referenced at all in code, not the
actual presence in settings.py (it is removed from settings.py in this
commit). What really matters is if the customized value of
HORIZON_IMAGES_ALLOW_UPLOAD in local_settings.py will be still
considered during the deprecation period.
Help text in Django Create Image form in case if local file upload was
enabled was wrong, fixed that.
Related-Bug: #1403129
Partially implements blueprint: horizon-glance-large-image-upload
Change-Id: I24ff55e0135514fae89c20175cf9c764e871969b
Move most of the pagination-logic to `api.glance.image_list_detailed`,
thus making code in Admin/Project->Images->get_data() less confusing
(and remove hard-coded 'asc'|'desc' values).
Also prepare to get images both from glanceclient.v1 and
glanceclient.v2 (which doesn't set `is_public` attr on images using
`visibility` attr instead).
Change-Id: Ibe6d3dd1e94a1d1fbf95382599a5f53c3559ce5a
Closes-Bug: #1534670
Closes-Bug: #1336317
This allows specifying a properties target when fetching metadata
definitions namespaces from glance, and updates the instance
metadata widget to show only "metadata" properties (as opposed to
"scheduler_hints") when creating an instance or updating the
metadata.
Closes-Bug: #1537842
Change-Id: I64dd279139eca2cbd0c0a6e808ade4cbcba8df95
Adding REST API calls for use in the new angularized
panels for Metadata definitions.
Set DISABLED = False in
openstack_dashboard/enabled/_2131_admin_metadata_defs_panel.py
Change-Id: I08c9c05a7b0870160ede7eb7645fc9daa83e2dd5
Partially-Implements: blueprint ng-metadata-defs-panel
Misspelling in the message:
"some time and is handed off to a seperate thread."
Should be "some time and is handed off to a separate thread."
Totally 1 occasion in horizon base code.
Change-Id: I7a67c050c503c6fc7211f5191ea56bc0e8f6cb98
The best practice in Python is not to use mutable object (i.e. list,
dictionary, or instances of most classes) as value of default
argument (see https://goo.gl/Kwhg0T). A hacking rule to enforce this
practice is added as well.
The patch was inspired by CR https://review.openstack.org/#/c/198465/
and took most of its code from it as well. That's why original
copyrights are kept.
Closes-Bug: #1471349
Change-Id: Ia77b1736dbc3d4e28ff2d2c3424e9cfcaefa5077
Listing metadata definitions namespaces requires glance API version
2. This adds a check that makes sure an empty array is returned if
any version less than 2 is being used.
Closes-Bug: #1516711
Partially-Implements: blueprint horizon-glance-v2
Change-Id: Ifc0a091318296da06168f9701a280eb7357632c7
This is needed to check if Image Metadata can be
updated.
Change-Id: I23f8b84f5f72a6423b0c453413faef25f2e139d2
Partially-Implements: blueprint angularize-images-table
Before an UnboundLocalError would occur in case an error would happen
during image updates, because of incorrect referencing of a variable.
Moreover the error was muted by exceptions.handle with ignore=True,
and could result in an incorrect success message.
This change removes references to unused image variable and allows
exceptions to be handled by the function, that calls image_update.
Change-Id: I35ea98a146690565582dd9beea62941f97d32474
Closes-Bug: #1464991
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
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
Adds support for resource_type, so retrieved namespaces will have
properties with proper prefixes.
Closes-Bug: 1439312
Change-Id: I4c2b450db8189c99624290a1d678fcaf509e1de6
Allow images to be created using glance's --location option
instead of always requiring --copy-from
Change-Id: I2aae47570f09a695adb032c210d7dc770f8cb746
Closes-Bug: #1433819
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
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
After image upload(successful or fails) from horizon, image
cleaned up from the /tmp
Closes-Bug: #1398766
Change-Id: I2c40e67234a8d0c8bdef9838b863ade9f5434083
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
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
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
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
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
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
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
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
Set purge_props=False to ensure we do not delete properties that
we have set on the image.
Change-Id: I4d8a9b8b20ef946e86389c59e79e874f078e1db3
Closes-Bug: #1325787
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
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
To keep Python 3.x compatibility, use six.moves.urllib.parse to
replace urlparse.
Partial-Bug: #1279611
Change-Id: Ie49589651ed80d8fc3196fb0750cbb04661c19cd
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
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
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
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>