Commit Graph

1283 Commits

Author SHA1 Message Date
Zuul
491de164b6 Merge "Fix create/update_port with python3" 2020-11-25 15:58:23 +00:00
Akihiro Motoki
a20a275ef5 Fix AttributeError in the project instance detail view
The previous code does not handle a case where admin-specific attributes
do not exist. This leads to AttributeError in the project instance detail
page as these attributes are not included in the response from nova API.

Change-Id: I4c2942960259782d47c6777394dec6888959e26c
Closes-Bug: #1905024
2020-11-20 20:57:28 +09:00
Akihiro Motoki
f3927ffb3d Fix create/update_port with python3
unescape_port_kwargs() in api/neutron.py changes a key of dict
during the iteration and it is not allowed in python3.

Change-Id: Ifc1b9a0191aacd32e8c8ecc082b6313f04003f63
Closes-Bug: #1900851
2020-11-18 20:10:46 +09:00
Akihiro Motoki
672c43c43e Drop OPENSTACK_NOVA_EXTENSIONS_BLACKLIST finally
Part of the removal of OPENSTACK_NOVA_EXTENSIONS_BLACKLIST (3/3)

Clean up nova extensions related code in the API layer.

Change-Id: I9730095365342cac1023f4112bae4b3a28cdeaf7
2020-10-27 20:02:05 +09:00
Akihiro Motoki
e5d09edc20 Use python3-style super()
In python3, super() does not always require a class and self reference.
In other words, super() is enough for most cases.
This is much simpler and it is time to switch it to the newer style.

pylint provides a check for this.
Let's enable 'super-with-arguments' check.

NOTE: _prepare_mappings() method of FormRegion in
openstack_dashboard/test/integration_tests/regions/forms.py is refactored.
super() (without explicit class and self referece) does not work when
a subclass method calls a same method in a parent class multiple times.
It looks better to prepare a separate method to provide a common logic.

Change-Id: Id9512a14be9f20dbd5ebd63d446570c7b7c825ff
2020-10-15 14:37:20 +09:00
Akihiro Motoki
74df97f57c pylint: Fix unnecessary-comprehension warning
'unnecessary-comprehension' warning is emitted when
unnecessary use of a comprehension is found.

classes attribute in Action can be a tuple,
so we need list() to ensure it is a list before adding 'disabled'.
I think it is time to introduce a method in Action class or somewhere
but it should be handled separately.

Change-Id: I16a98d56b6d0bd0af234b00735c6ed576620df7e
2020-09-27 12:44:16 +09:00
Akihiro Motoki
692778f8cf pylint: Address no-else-return warning
This pylint check 'no-else-return' might be debatable.
but as far as I checked it works in most cases.

Change-Id: Ie8574d4a529454c6e050fa62a7a17ea097d00240
2020-09-27 12:44:16 +09:00
Ivan Kolodyazhny
d403b31d70 Show all os-extended-server-attributes
Patch I0cfe9090e8263f983fa5f42f42616a26407be47a adds hypervisor hostname
to the instance details view. This patch adds the rest of instance
attributes allowed by 'os_compute_api:os-extended-server-attributes'
policy.

Change-Id: Id39ee14e3054422a96248f8cdd0a5bf07c27f2fc
Closes-Bug: #1874273
2020-09-24 18:48:15 +09:00
Zuul
79e505520f Merge "Add cinder-user-facing messages" 2020-09-10 18:04:09 +00:00
manchandavishal
79ff0d45c4 Add cinder-user-facing messages
This patch adds a tab for cinder user messages for volumes and
snapshots. Cinder user messages shows error details for cinder
resources like if we are unable to create a volume due to some
failure in cinder it will shows us the reason of failure.

Implements blueprint cinder-user-facing-messages

Change-Id: I6f1539ffebdf2dfd0a470009e9171e868c2a9ad3
2020-09-10 10:22:49 +00:00
Tobias Urdin
87f1de7f69 Support extending in-use volumes
This support was introduced in Cinder microversion 3.42
which has been around for a while.

Change-Id: Ie7051cb2095023ef6f0d273488a40d520752c6b5
2020-09-08 09:17:15 +00:00
Ivan Kolodyazhny
51468ae21a Cleanup references to Cinder API v1
Cinder API v1 was removed from Horizon in Rocky release.

Change-Id: I6b64dcf797695d9a3eea892e6a5a4970f14cdd05
2020-08-28 15:24:13 +03:00
Zuul
fb467ad60d Merge "Stop to use the __future__ module." 2020-06-04 14:28:04 +00:00
Hervé Beraud
17d8ab6103 Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: Ic03754dcaaa4f1c0018294aa52bb05d956aa5d10
2020-06-03 10:45:18 +02:00
Gayathri Devi Kathiri
7bde77fad1 Default keystone endpoint type is hard coded
The default url should be of type "OPENSTACK_ENDPOINT_TYPE"
parameter as specified in settings.

Closes-Bug: #1873353

Change-Id: I05ce933e5bd01bf59a52e7d49facce26efa693aa
2020-06-02 07:47:08 +00:00
pedro
4c96f652ee Add pages menu to volume backups pagination
The backups pagination was with a bug that prevents users from
access older backups when the number of backups exceeds the
page size configurated in 'API_RESULT_PAGE_SIZE' properties.

The bug was occurring because the pages displays (Next, Prev) were
not displayed in the backups page, leaving the user with only
the first page to access their backups, so the backups from other
pages are unreachable.

Was fixed this bug and also was added new buttons to access
a specific, the last and the first pages. Easing the users'
navigation through the backups pages.

Change-Id: I148634152484f9718759775b81aab3703a296ef5
2020-05-28 16:21:45 +00:00
Akihiro Motoki
a0a85dd176 Fix tempest and pep8 tests
Fix tempest jobs to properly use tempest-horizon as tempest-plugin in
job configuration.

Flake8 3.8.0 fixed a few bugs so that additional issues are marked, fix
these.

Co-Authored-By: Andreas Jaeger <aj@suse.com>
Change-Id: I2aca3286ea2cc1ade567087786781952489d6efa
2020-05-12 18:49:34 +02:00
Walter Doekes
941f64915e Give keystoneauth1.ClientException only 1 argument (message)
Change-Id: I970b07e52ed7f2f4440b47800fcb3b6528dce22d
2020-04-29 17:25:01 +09:00
Ivan Kolodyazhny
ee6fa9a245 Remove Keystone v2 related code
Kyestone V2 support was removed in Train, so it's safe to do such cleanup.

* Functions which just return horizon settings are dropped and
  the settings are referred directly now.
* The service catalog in the sample test data is updated to match
  the format of the keystone API v3.
* Related to the above change of the sample service catalog,
  openstack_dashboard.test.unit.api.test_keystone.ServiceAPITests is
  updated to specify the region name explicitly because 'RegionTwo'
  endpoint is no longer the second entry of the endpoint list in the
  keystone API v3.

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: Ib60f360c96341fa5c618595f4a9bfdfe7ec5ae83
2020-04-23 11:43:12 +09:00
Simon Merrick
2735f2c08d Add support for multiple swift storage policies
+ Adds endpoint for listing available policies
+ Support to select a storage policy for new containers
+ Display container storage polcy on dashboard.

Change-Id: I588452fd5d6417859f5dd19ccedcb18f420ab646
2020-04-16 22:18:06 +12:00
Pierre Riteau
70f6f4299d Fix typo in comments
Change-Id: I7510ce7a56c1952ff98580fb9a46f56c3d71477c
2020-03-18 09:56:00 +00:00
Zuul
db7bee00e6 Merge "Catch AttributeError when deleting temp file on image upload" 2020-03-10 22:23:20 +00:00
Radomir Dopieralski
2b55e3f7a7 Catch AttributeError when deleting temp file on image upload
When the image upload finishes, we try to delete the temporary
file that was used for the upload. However, depending on how
Horizon is deployed, instead of a file it can be a BytesIO
instance, which leads to an AttributeError. This happens in
a separate thread, so Horizon itself doesn't crash, but it's
better to catch that exception.

Change-Id: Iaa66d9c87060c1e001f3f6e31f630d6092df55d3
Closes-Bug: #1866632
2020-03-09 14:09:05 +00:00
Zuul
3a17391e4a Merge "Cleanup python 2.7 handling logic" 2020-03-05 16:41:47 +00:00
Akihiro Motoki
4b31ae5063 Check volume endpoint availability in the same order
cinder microversion check (api.cinder.get_microversion) checks
volume endpoint availability in a different order as cinderclient()
does. It does not API_VERSIONS setting in horizon.
As a result, when multiple volume endpoints are configured,
get_microversion() accesses a volume endpoint with a different API
version. At the moment cinder v2 and v3 APIs returns the same info,
so it only affects when cinder v1 endpoint is configured.

This commit introduces a new function _find_cinder_url() to
retrieve a volume endpoint considering API_VERSIONS.

get_auth_params_from_request() is no longer needed and the variable
substitutions are now backed to cinderclient(). It was introduced
so that the memoized decorator worked but the memoized decorator
was improved and we no longer need it.

Change-Id: I69b1fc11caf8a78c49e98aba6c538e5f344b14f2
Closes-Bug: #1864133
2020-02-26 15:19:59 +09:00
Akihiro Motoki
ac3d139c06 Cleanup python 2.7 handling logic
We have several codes to handle the differences between py2 and py3.
py2 support has been dropped so there is no need for them now.

Change-Id: I30080f4e1a5ac04860c4341d966ee53131eb2022
2020-02-21 09:02:37 +09:00
Zuul
7c54e7db93 Merge "Remove six usage from openstack_dashboard package" 2020-01-17 10:27:49 +00:00
Ivan Kolodyazhny
d870b40583 Remove six usage from openstack_dashboard package
We don't support Python 2 anymore so we don't need this
compatibility library.

six.reraise usages are left as is until it'll be moved to some
base lib like oslo.utils to not re-implenent this method in
Horizon.

This patch also removes Python2-specific base test case methods
assertItemsEqual and assertNotRegexpMatches in flavor of new
Python 3 analogues.

Change-Id: I26a59176be9e9f213128e4945a58b9459334b626
2020-01-15 12:47:48 +02:00
zhufl
e6ce38822b Fix dupliated words issue like " by by which"
This is to fix the duplicated words issue like
"The name of key by by which".

Change-Id: I7b0897eb40c6b587521d727d4fd2f60e4058040b
2020-01-06 11:30:05 +08:00
Zuul
ee36da77f5 Merge "Fix "prev" link pagination for instances with identical timestamps" 2019-12-27 17:44:58 +00:00
KeithMnemonic
9637d73374 Fix "prev" link pagination for instances with identical timestamps
This patch resolves an issue with the "prev" link when instances
have identical "created_at" values. This can occur when creating
instance using the "min/max count" option. The reverse sort does not
work correctly as the server list returned from nova is not an exact
reverse as the forward sort. It looks like the combination of sort_keys
must be unique to ensure the forward and reverse pagination properly.
As a workaround 'uuid' (server ID) is added to 'sort_keys'.
In addition, 'display_name' is added before 'uuid' in 'sort_keys'
to list servers in the alphabetical order (which sounds natural).

Closes-Bug #1856243
Change-Id: I73234b2c69ce8ea648b4a9721abe4f5670031909
2019-12-25 20:12:03 +09:00
Zuul
3a829be260 Merge "Add support to get disk_formats from glance" 2019-12-19 15:19:56 +00:00
Dmitriy Rabotyagov
04a3535e18 Add support to get disk_formats from glance
This patch allows administrators to set disk_formats only for glance,
while horizon will retrieve list of supported formats from glance API.
IMAGE_BACKEND_SETTINGS still may be used to redefine display name
of the format or additionally limit list of availble ones.

Change-Id: Ia4ea513023895f4ad2a87f91e3d2837c7668d9ae
Closes-Bug: 1853822
2019-12-17 14:56:44 +02:00
Hemanth Nakkina
9aca7a94e2 Fix users/projects list when domain context is changed
In case of Keystone Multidomain setup, the project and users list
is empty when the domain context is changed. Horizon uses domain
scoped token for keystone api calls to get list of projects and users.
And domain scoped token cannot get information about projects and users
in other domains, the list is empty.

This patch modifies the use of domain scoped token only when domain
context is not modified.

The bug have 3 parts
1. Users are not listed on GUI in different domain
2. Projects are not listed on GUI in different domain
3. Gui hangs during creation of user/project using + option
This patch handles case 1 and 2.

Change-Id: Ibafe3e2eb3ee1ee5c9eb5d2a276a0edfa3e7c607
Partial-Bug: #1826114
Closes-Bug: #1830782
2019-12-13 10:06:02 +05:30
Zuul
bd5642dc73 Merge "AgularJS pages display dates using Horizon's Settings Timezone" 2019-12-09 13:24:48 +00:00
Zuul
f592481cc0 Merge "Add support for keystone access rules" 2019-11-25 09:25:56 +00:00
Zuul
21306e7cb3 Merge "Add custom SSL CA Cert support for api.cinder.get_microversion" 2019-11-19 19:25:01 +00:00
hutianhao
a464a94655 AgularJS pages display dates using Horizon's Settings Timezone
Horizon's AngularJS pages (for example Images and Keypairs)
display dates using browser's timezone now. This change makes
AngularJS pages use Horizon's Settings Timezone instead of
browser's timezone and if Timezone is not set under Settings,
AngularJS pages will display dates in 'UTC' timezone.

Closes-Bug: 1832768
Change-Id: Ibbed19600bfe6b13c43b9f09fa484cb78524b0d6
2019-11-08 11:02:30 +08:00
Colleen Murphy
4d1786c687 Add support for keystone access rules
Keystone implemented the ability to apply fine-grained access control
restrictions to application credentials[1]. This patch adds new fields
to the application credential creation form and detail view so that
horizon users can use this feature.

[1] http://specs.openstack.org/openstack/keystone-specs/specs/keystone/train/capabilities-app-creds.html

Depends-on: https://review.opendev.org/677585

Change-Id: I2d71392eb8569ffb8cb15af29eea76e120a158cc
2019-10-30 14:47:05 +09:00
Ivan Kolodyazhny
285c51f7e1 Add custom SSL CA Cert support for api.cinder.get_microversion
api.cinder.get_microversion function now supports OPENSTACK_SSL_NO_VERIFY
and OPENSTACK_SSL_CACERT config options.

This depends on commit 4a3a2c3c9a89ccff4e64d3da96de5b0af4303840 in
python-cinderclient, so the minimum version of python-cinderclient
is bumped to 5.0.0.

NOTE(amotoki): The stretegy of backporting to stable branches needs
a discussion with the requirements team as we cannot bump the
minimum version (at least the major version bump is surprising).

Change-Id: I22c6c60e10d8e9328f7f1e0c24d6c74496ec1a71
Closes-Bug: 1744670
2019-10-25 16:12:02 +09:00
Matt Riedemann
b148c92075 Remove dependency on novaclient list_extensions API
The novaclient list_extensions API binding was removed in the
16.0.0 release [1]. The ability to enable/disable extensions
in nova has been deprecated since Liberty [2] and was removed
in Newton [3].

For horizon this only matters for the OPENSTACK_NOVA_EXTENSIONS_BLACKLIST
config setting and some javascript code used to compile panels based on
enabled extensions. In order to work with novaclient 16.0.0+, this
change removes the list_extensions usage since all extensions
are enabled in nova and thus for horizon a nova extension is only
not supported if it's in the configured blacklist. To continue supporting
the javascript code which uses the getExtensions function, the extension
names are hard-coded. Note that the method meant to test that code,
_test_extension_list, was wrong but never ran because of the underscore
prefix on the method name. That is fixed here.

[1] https://review.opendev.org/686516/
[2] https://review.opendev.org/214592/
[3] https://review.opendev.org/351362/

Change-Id: Iebb1e78c718b931d632445e4de6d7a29ccb92be2
Closes-Bug: #1847959
2019-10-24 15:24:39 -04:00
Ivan Kolodyazhny
6037a58c6e Drop deprecated Glance V1 API support
Glance V1 API was deprecated in Stein release in Horizon and
deprecated in Glance since Newton release.

Change-Id: I18f6fd03dd3e07fa4f2ccfdccfdc3ca766c91c16
2019-10-08 13:18:22 +03:00
Akihiro Motoki
ec970fd6e8 Handle partial dict setting
In Train cycle, we moved the definition of default values
to openstack_dashboard/defaults.py. The current code accesses
a dict member using []. It requires operators to define a dict
setting with a full member.

This commit allows to use dict-type settings with partial members.

A new function is introduced to retrieve a dict-type setting
considering default values defined in
{openstack_dashboard,horizon,openstack_auth}/defaults.py

Change-Id: I7ff0ad4bca698aef9c0eba370b0570200a14367a
Closes-Bug: #1843104
2019-09-26 14:31:17 +09:00
白子玉
ba75bafc69 Specify proper container_format for 'vhd' disk_format
When editing an image, if the disk_fomrat is 'vhd',
the container_format was wrongly set to 'bare' before.
'ovf' is the correct container_format for 'vhd' disk images.

Closes-Bug: #1539722
Change-Id: Ic6b0c66af0d5c8db2d802d6eea2b97721d92b7eb
2019-09-18 06:20:54 +00:00
Ivan Kolodyazhny
f33e5fd8ac Drop deprecated Keystone V2 API support
Keystone V2 API was deprecated in Stein release in Horizon and
removed from Keystone in Queens release.

Change-Id: I917e273d3174adf0874e516b3d635ccb8ba58a27
2019-09-12 17:15:07 +00:00
Akihiro Motoki
7c897b677c Move openstack_dashboard specific settings from horizon
Cookie-based settings related to openstack_dashboard are located
under horizon directory,, but they are not related to "horizon".
This commit moves them to "openstack_dashboard" directory.

Part of blueprint ini-based-configuration
Change-Id: Id48ececdbe819a95485e9a91dc5a1a163a5568c3
2019-09-12 15:05:56 +09:00
Stephen Finucane
4ece14b28a Handle move of ABCs to collections.abc
Resolves the following warning:

  DeprecationWarning: Using or importing the ABCs from 'collections'
  instead of from 'collections.abc' is deprecated, and in 3.8 it will
  stop working

Change-Id: Ib2214e7560cda1ef510c08859d5ee0726eb66b7b
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2019-09-10 19:21:20 +09:00
Akihiro Motoki
5fd5b4c893 Fix version handling compatible with python-semanticversion 2.8
It seems the behavior of 'partial' argument of Version class __init__
has been changed between semantic-version 2.6.0 and 2.8.1
(though I could not identify the root cause).
'partial' argument is marked as deprecated in semantic-vesion 2.7.0,
so it is a good chance not to depend on 'partial' argument in horizon.

This commit uses Version.coerce() [1] instead to convert non-semver
version into a valid semver version.
We also need to keep the original version information as it is passed
when initializing python-*client (cinderclient and keystoneclient).

In addition, the previous implementation based on semantic-version 2.6.0
returns True for "Version("3.55") == 3". It depends on the behavior
of "partial" argument of semantic_version.Version. It was not
documented and it looks tricky to depend on this behavior.
"major" and "minor" properties are now introduced and api/cinder.py
is updated accordingly. I believe this approach is clearer and stable.

Unit test coverage on dict behavior is improved.
Variable names in the unit tests are adjusted to more meaningful ones.

[1] https://python-semanticversion.readthedocs.io/en/latest/#coercing-an-arbitrary-version-string

Change-Id: If0deee9d0289ff91d58d942b9612f7736356ae18
2019-09-09 15:54:26 +09:00
Andy Botting
c238b519f3 Revert "Raise NotFound error when retrieved by not uuid"
In the early days of OpenStack, user and project ids were not
uuids, but auto-incremented integers.

Since those early days, many operators fought long battles
against the unrelenting OpenStack behemoth.

Only those heroic operators who emerged victorious from the
brutal upgrade battles can show the scars of those integer
user and project ids like badges of honour.

Closes-Bug: #1842004
Change-Id: I0c3e3465e8e7499c94d1a82b7295aeec13955e55
2019-08-30 08:59:24 +10:00
Akihiro Motoki
cdb191ec83 Fix listing security groups when no rules
When listing security groups in the dashboard and
one or more security groups had no rules it failed
because python throws a KeyError.

This commit changes the neutron API wrapper in horizon
to ensure ensure rule information in SG always exists.

Closes-Bug: #1840465
Co-Authored-By: Tobias Urdin <tobias.urdin@binero.se>
Change-Id: I6e05a7dc6b6655514ee2bff6bd327da86f13900a
2019-08-19 16:38:57 +09:00