139 Commits

Author SHA1 Message Date
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
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
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
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
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
Jesper Schmitz Mouridsen
9fa1cddf09 Enable volume snapshot backups
Make it possible to use horizon for backing
up snapshots.

 * Add snapshot column to backups table
 * Add snapshot information to backup detail
 * Fix wrong template path in create_backup.html
 * Add ChoiceField with snapshots belonging
   to the volume in create backup form
 * Add create backup option in snapshots table
 * Adjust tests and test data

When backing up from snapshots table the snapshot
ChoiceField is preset with the choosen snapshot
as the only option.
Implements: blueprint volume-snapshot-backups

Change-Id: I4b7707d95756501e0622460e3ddc4e3f7624f02e
2019-07-25 19:15:01 +00:00
Zuul
acc36f4958 Merge "Define default settings explicitly (openstack_dashboard 1/5)" 2019-05-29 17:38:13 +00:00
Akihiro Motoki
431fd6c16b Drop cinder consistency group support
Cinder consistency group has been replaced by the generic group feature.
Horizon support of the generic group (in the project dashboard) is
available since Rocky release and it covers all existing support
for consistency group in horizon.

The consistency group support is horizon was marked as deprecated
in Stein release [1].

This commit drops the consistency group support.

[1] https://review.openstack.org/#/c/626846/

Change-Id: I11187d2b03b7e0033a6c6ba3f8be25b8b5e4dd74
2019-05-03 18:16:23 +00:00
Akihiro Motoki
9c19b07a26 Define default settings explicitly (openstack_dashboard 1/5)
Currently horizon defines default values of settings in the logic
using getattr(settings, <setting name>, <default value>) and
it is not easy to handle the default values of available settings.

This commit starts the effort to define default settings explicitly.
This is a preparation for ini-based-configurations.

It covers settings in openstack_dashboard/api.

Part of blueprint ini-based-configuration
Change-Id: Id4c3287f0a572fd14ea93b54bcab8fabda39e583
2019-04-24 02:32:47 +09:00
Zuul
85aac1b32c Merge "Add Project Information column in group-snapshot table" 2019-03-06 17:51:29 +00:00
Zuul
8f335a42f6 Merge "Add volume group-specs-list support for admin panel" 2019-03-06 12:19:08 +00:00
manchandavishal
7cb4be82b5 Add Project Information column in group-snapshot table
This patch add 'Project' column in group-snapshot table to the
admin panel.Now user would be able to list all group-snapshot
created by admin or demo user.

Depends-On: https://review.openstack.org/#/c/639314/
Change-Id: I6d77ef7135b15cfa978677c858382a0914d92c5d
2019-03-05 12:19:45 +00:00
manchandavishal
4b523122b0 Add volume group-specs-list support for admin panel
This commit allow admin to list/show cinder volume group-spec
using horizon dashboard and user can perform the following
table action :
1. group-spec-create
2. group-spec-edit
3. group-spec-delete

Partially-Implements blueprint cinder-generic-volume-groups

Change-Id: I7a24e21bbf86595bc7e1251d29caed7f7ff5dec8
2019-03-01 01:50:32 +09:00
Zuul
439206053c Merge "Add Project ID information in detail page" 2019-02-15 16:07:19 +00:00
Zuul
bd9d855acd Merge "pylint: fix cyclic-import" 2019-02-15 14:38:58 +00:00
manchandavishal
99b89a430e Add Project ID information in detail page
This patch add 'Project ID' information in instances,Subnet,
Volumes and Volumes Snapshots detail pages.

Change-Id: I48da491d5283ab607d298b454d32a349e97be0d1
Closes-Bug: #1815029
2019-02-15 05:37:28 +00:00
Zuul
a8df389822 Merge "Add Project Information column in table" 2019-02-14 07:08:51 +00:00
Zuul
54c5a6de8c Merge "api.cinder: refactor microversioning logic" 2019-02-12 21:50:29 +00:00
Zuul
8bbc18703d Merge "Use correct cinder API version for tenant_absolute_limits" 2019-02-12 21:47:21 +00:00
manchandavishal
c871c65704 Add Project Information column in table
This patch add 'Project' column in volume-group table to the
admin volume group panel.Now user would be able to list that
group is created by admin or demo user.

Change-Id: I5e4837a1a03b50bd6121aa0ab019829fd4a79dbb
2019-02-12 09:19:56 +00:00
Akihiro Motoki
949802264e pylint: fix cyclic-import
openstack_dashboard/api nova.py and cinder.py are imported
by each other. To avoid cyclic imports, some imports are placed
inside functions now, but it would be nice if we can move them
to a separate module and nova.py/cinder.py can import it.

This commit tries to achieve this by moving some stuffs in nova.py
into a separate module named _nova.py.
The module name starts with an underscore to clarify
it is intended to use only in openstack_dashboard.api.

Change-Id: If91cf4f30d2ddab471757129c2a74b26b6d38b1e
2019-02-09 21:08:48 +09:00
manchandavishal
5764aa588c Add volume group-type list/show support for admin panel
This commit allow admin to list/show cinder volume group-type
using horizon dashboard and user can perform the following
table action :
1. group-type-create
2. group-type-delete
3. group-type-update

TODO:
1.group-type-specs support

Partially-Implements blueprint cinder-generic-volume-groups

Change-Id: Iea18913765cda146a0fcae7abe64c999a29cccfe
2019-02-06 18:44:35 +00:00
Akihiro Motoki
ac7ac272b3 pylint: fix several coding convention violations
openstack_dashboard/context_processors.py:94:15: C0122: Comparison should be link['url'] != 'horizon:project:api_access:openrcv2' (misplaced-comparison-constant)
openstack_dashboard/settings.py:467:4: C0412: Imports from package horizon are not grouped (ungrouped-imports)
openstack_dashboard/enabled/_1370_project_vg_snapshots.py:9:0: C0301: Line too long (86/80) (line-too-long)
openstack_dashboard/enabled/_1360_project_volume_groups.py:9:0: C0301: Line too long (85/80) (line-too-long)
openstack_dashboard/usage/base.py:62:8: W0106: Expression "[instance_list.extend(u.server_usages) for u in self.usage_list]" is assigned to nothing (expression-not-assigned)
openstack_dashboard/dashboards/project/images/utils.py:43:12: W0106: Expression "[public_images.append(image) for image in images]" is assigned to nothing (expression-not-assigned)
openstack_dashboard/dashboards/project/images/utils.py:75:12: W0106: Expression "[community_images.append(image) for image in images]" is assigned to nothing (expression-not-assigned)
openstack_dashboard/api/glance.py:47:4: C0412: Imports from package glanceclient are not grouped (ungrouped-imports)
openstack_dashboard/api/cinder.py:60:4: C0412: Imports from package cinderclient are not grouped (ungrouped-imports)
openstack_auth/user.py:358:4: E0211: Method has no argument (no-method-argument)
openstack_auth/user.py:362:4: E0211: Method has no argument (no-method-argument)
openstack_dashboard/api/keystone.py:75:4: C0412: Imports from package keystoneclient are not grouped (ungrouped-imports)
horizon/loaders.py:43:16: W0706: The except handler raises immediately (try-except-raise)
horizon/themes.py:174:8: W0706: The except handler raises immediately (try-except-raise)

Change-Id: I40cf3ffbc4519657e11180d2e2fe7401387c5556
2019-01-17 00:05:27 +09:00
Akihiro Motoki
000da0f8fc api.cinder: refactor microversioning logic
There are sevral similar logics to handle microversioning
in Cinder API wrapper. This commit refactors them and
introduces _cinderclient_with_features() function.

The parent commit to fix bug 1810309 does not introduce
this logic to make it easy to backport the fix.

Change-Id: I378e58c7a80e2d00481a582eb3fa449f51c3612a
Related-Bug: #1810309
2019-01-15 08:32:34 +09:00
Akihiro Motoki
32bfbbf100 Use correct cinder API version for tenant_absolute_limits
To verify resource usages when updating project quotas,
project_id query parameter needs to be supported in
tenant_absolute_limits in the cinder API.

This is supported in 3.39 or later in the cinder API.
API vesions shipped with released versions (pike, queens and
rocky) are selected as verified versions.

Change-Id: If5fc190988cf173387da2b66be23db9134310692
Closes-Bug: #1810309
2019-01-15 08:32:34 +09:00
Akihiro Motoki
6e1348d05f pylint: fix several warnings
openstack_dashboard/theme_settings.py:63:8: W1201: Specify string format arguments as logging function parameters (logging-not-lazy)
openstack_dashboard/settings.py:412:24: W0122: Use of exec (exec-used)
openstack_dashboard/dashboards/identity/domains/workflows.py:476:44: W0640: Cell variable group_id defined in loop (cell-var-from-loop)
openstack_dashboard/dashboards/identity/projects/workflows.py:906:49: W0640: Cell variable group_id defined in loop (cell-var-from-loop)
openstack_dashboard/dashboards/admin/networks/views.py:42:0: W0404: Reimport 'views' (imported line 28) (reimported)
openstack_dashboard/api/swift.py:204:0: W0102: Dangerous default value {} as argument (dangerous-default-value)
openstack_dashboard/api/swift.py:214:0: W0102: Dangerous default value {} as argument (dangerous-default-value)
openstack_dashboard/api/cinder.py:248:30: W0631: Using possibly undefined loop variable 'cinder_url' (undefined-loop-variable)
openstack_auth/backend.py:123:28: W0631: Using possibly undefined loop variable 'plugin' (undefined-loop-variable)
openstack_auth/backend.py:129:39: W0631: Using possibly undefined loop variable 'plugin' (undefined-loop-variable)
openstack_auth/backend.py:131:39: W0631: Using possibly undefined loop variable 'plugin' (undefined-loop-variable)
openstack_auth/views.py:39:0: W0611: Unused Login imported from openstack_auth.forms (unused-import)
horizon/exceptions.py:348:8: W0125: Using a conditional statement with a constant value (using-constant-test)
horizon/tables/base.py:353:12: W0715: Exception arguments suggest string formatting might be intended (raising-format-tuple)

Change-Id: Icf4f22abda77c9dbf98c780de876b7836c31d669
2019-01-15 00:22:27 +09:00
Wangliangyu
9faf1cd109 Fix bug about snapshot pagination
Now, one page content will be changed after Clicking
"Next page" or "Prev page" to go back.

As we know, the order of the list could not be changed
at will, for one at the beginning or the end is a marker.
The marker is very importent for pagination.
So, this commit remove the sort of snapshots and reverse
the sort of the previous page ones.

Change-Id: I8d3d0cf4a1e6526bed3055b18741b1cf5d6166ff
Closes-Bug: #1804391
2018-11-23 17:12:46 +08:00
Radomir Dopieralski
3acb28270a Replace @memoized_with_* with @memoized
Since @memoized now uses weakref to delete old cache entries, and no
longer keeps the object passed as parameters alive indefinitely, we
no longer need to treat the Request objects specially. In fact, if
we stop doing it, it should improve memory use, because now all
request-specific caches will be removed as soon as the request
object dies.

I also removed the memoized_with_argconv function, and replaced it
with an explicit function for converting teh parameters in the one
place where it was used.

Change-Id: I710b96a170e429c6ffdf22ad3e552ee6e1c6b7e3
2018-09-25 11:44:06 +02:00
Akihiro Motoki
b6d52b0db9 Support volume group when creating a volume
Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info>
blueprint cinder-generic-volume-groups
Change-Id: I53eb10c5d7efabcab82aae83e0c71a190a0784e2
2018-07-03 10:25:36 +00:00
Akihiro Motoki
ef4d8d69c9 Show generic group info in volume and volume snapshot pages
blueprint cinder-generic-volume-groups
Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info>
Change-Id: I96515087a3e3a5328cceaff4e0e9a811601c7ba0
2018-07-03 13:24:24 +03:00
Akihiro Motoki
32d463a298 Generic volume group support
This commit adds cinder generic group support.
Consistency group support are not shown if the generic group
support is available.

blueprint cinder-generic-volume-groups
Change-Id: I038eeaf2508926f18b6053db0082a8aa3f3e20c6
2018-06-09 06:39:18 +00:00
Ivan Kolodyazhny
8ce6b37e5c Remove Cinder API v1 compatibility
Since Cinder API v1 is removed in I03bf2db5bd7e2fdfb4f6032758ccaf2b348a82ba
we don't need _replace_v2_parameters function anymore.

Change-Id: I18c2787241f1dcbe4c0afc14a76630d9bfb1162a
2018-06-05 18:11:42 +03:00
Matt Riedemann
1e2dfc4bb4 Use microversion 2.60 when attaching a multiattach volume
Multiattach capable volumes can only be attached with microversion
2.60 or later, so this checks if the volume being attached is
multiattach capable and if microversion 2.60 is available, use it.

Part of blueprint multi-attach-volume

Closes-Bug: #1751564

Change-Id: If708e3edb05cff6e93cfc3dfccb91b1441dcd181
2018-04-10 16:22:06 -04:00
Vladislav Kuzmin
b407b07c84 Start using create_mocks in dashboards/admin/volumes/tests.py
Change cinder api to return None for volume_manage() and for
volume_reset_state(). In this case the tests check these
functions returns correct values.

Partially-Implements: blueprint mock-framework-in-unit-tests
Change-Id: I6694113cb3e8bfa74b1267c6336642d192fbf4ac
2018-02-27 16:40:24 +04:00
Zuul
24cc9c75fb Merge "quota: retrieve quota (limit) and usage at once" 2017-12-26 21:19:50 +00:00
Ivan Kolodyazhny
a774fa30dd Use Cinder API v3 by default
Cinder API v3 was introduced several releases ago and is backward
compatible with API v2 so it's safe to swith to use it.

Change-Id: I550e6c59bb14c17da78d7b2abcde5783b2b6825d
Closes-Bug: #1728761
2017-12-18 15:34:41 +02:00
Akihiro Motoki
df0a18e7a3 quota: retrieve quota (limit) and usage at once
Previously tenant_quota_usages() uses list API operations
to count usages. It is not efficient. This commit changes
the limit APIs from nova and cinder to retrieve usages.

blueprint make-quotas-great-again
Change-Id: I2c9a479758a1dfe134e5fabf16ab02831338718d
2017-12-13 20:27:02 +09:00
Akihiro Motoki
4c8a294aee API micro-version support for multiple features
Previously horizon micro-version support only supports one feature,
but there is a case where we need to support more than one feature
using micro-versioning. For example, "instance_description" and
"auto_allocated_network" in the server create operation both require
micro-version. This case was not supported previously.

This commit changes get_microversion() function to take a feature list
and looks up a micro-version which supports all requested features.

A known limitation is that we need to re-call get_microversion() with
different feature(s) if no micro-version which satisfies all requested
features is found and we would like to look up a micro-version which
supports a subset of the requested features. Most features are expected
in recent API versions, so I believe this would be a minor limitation.

Change-Id: I46f1c7fa1ddcf1dfac93d921cffaf3aa5ac011a7
Related-Bug: #1690433
2017-12-03 07:59:32 +09:00
Radomir Dopieralski
45665406b4 Prefer volumev3 and volumev2 endpoints over volume
Make cinderclient use volumev3 or volumev2 endpoints, before
falling back to the volume endpoint, otherwise Horizon is
trying to use the v1 API, and that doesn't work with the
"sort" parameter that we are using, resulting in an empty
volumes list.

Change-Id: Id03988d89000c4bc976090c68a41ee320b9d43f7
Closes-bug: #1700977
2017-06-30 16:06:55 +02:00
Jenkins
af2899e720 Merge "Fix H405 (multi line docstring) warnings (openstack_dashboard)" 2017-06-13 09:18:03 +00:00
Akihiro Motoki
b9d0243c33 Fix H405 (multi line docstring) warnings (openstack_dashboard)
H405: multi line docstring summary not separated with an empty line

Closes-Bug: #1696996

Change-Id: Id895695663b19522d9cdc22f8b012e49680d708b
2017-06-09 16:05:31 +00:00
Radomir Dopieralski
938ee35d94 Show volume's messages in details view
Cinder can now show asynchronous error messages that are related to a
volume. However, this requires microversions support.

This patch cleans up the version and endpoint selection logic too. For
compatibility with setups that don't follow good practices, it also
checks for a "volume" endpoint.

Change-Id: Ifdb7537b5208683bb0a81da9ac504d58beaedc89
Closes-Bug: 1352516
2017-06-08 12:51:13 +02:00
Gary Smith
eb49097519 Enable backups on in-use volumes
In addition to "available" volumes, those that are "in-use" can now be
backed up.  Backing up "in-use" volumes requires setting the "force"
parameter in the cinder backup call.

Closes-Bug: 1686671
Change-Id: I8a11216be49313f710ce5874499f8d2efba91e73
2017-05-11 16:00:33 -07:00
Jenkins
98ac7666a0 Merge "Support editing volume type access" 2017-05-05 20:23:59 +00:00
Akihiro Motoki
baa4ca8dce hacking: noqa cleanup in openstack_dashboard
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
2017-03-17 19:38:47 +00:00
liyingjun
87dbc2f9ff Support editing volume type access
Cinder v2 support add or remove volume type access for the given
project since Kilo [1]. This patch add this feature to horizon.
At least cinderclient 1.2.0 is required to support volume type
access extension.

[1]:
https://specs.openstack.org/openstack/cinder-specs/specs/kilo/private-volume-types.html

Implements blueprint: volume-type-access

Change-Id: I323d47ab2aed13305b609e27f8f959f40988537d
2017-03-14 12:58:31 +08:00
Eric Peterson
90a9af2e0b Autogenerate container name correctly for vol backup
The volume backup code is passing '' as a default container name,
which will cause cinder/swift to fail.   If no container name is provided,
the default value of None will enable the auto creation of a container correctly.

Change-Id: I7813153c65652ce6e1a5ac03204a8738eefdc64e
Closes-Bug: #1658137
2017-01-23 10:39:52 -07:00
Paul Karikh
97945b5f6a Wrap api calls with tracing decorators
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
2016-12-01 19:31:10 +00:00
Bartosz Fic
7f46e5dc23 Enable volumes metadata update
Cinder currently expose an api to let the users update the volumes
metadata so horizon should expose this functionality.

The metadata is filtered to remove image metadata attributes. There is
work in progress (in Cinder) that will expose the ability to
write-through image metadata to underlying images where appropriate.
Allowing setting of image properties in this UI would be confusing.

Change-Id: If721ac1c908df7651d630f6e7d36f2cc4d69f5da
Implements: blueprint ability-to-add-metadata-to-cinder-volumes-and-snapshots
Co-Authored-By: Santiago Baldassin <santiago.b.baldassin@intel.com>
Co-Authored-By: Pawel Skowron <pawel.skowron@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>
Co-Authored-By: David Lyle <david.lyle@intel.com>
Co-Authored-By: Paul Karikh <pkarikh@mirantis.com>
2016-09-28 18:17:14 +03:00
Luis Daniel Castellanos
14f7b015ea Fix for cinder api memoize issue
cinder api (api/cinder.py) cinderclient returns an
UnashableKeyWarning for client api_version param.

This patch fixes the bug by removing the api_version param from the
memoized with request function.

Change-Id: I11f3ca8642fb746bd725f059f089f9b3900c6f66
Closes-Bug: #1606020
2016-07-25 10:57:30 -05:00