Commit Graph

57 Commits

Author SHA1 Message Date
Akihiro Motoki e4444e6979 Address RemovedInDjango40Warning (4)
In Django 3.0, django.utils.http.urlquote(), urlquote_plus(),
urlunquote(), and urlunquote_plus() are deprecated in favor of
the functions that they’re aliases for: urllib.parse.quote(),
quote_plus(), unquote(), and unquote_plus().

https: //docs.djangoproject.com/en/4.0/releases/3.0/
Change-Id: I37fcd917cbf87b4d3141cfbdd2675aa38f33f2a4
2022-02-04 16:27:18 +09:00
Brian Rosmaita b58ac2894b Drop cinder v2 API support
Cinder v2 API is deprecated since pike release. Along with the removal
of cinder v2 API support in cinderclient (change I335db5c1799e drops
v2 support), this commit drops cinder v2 support in horizon.

The next release of python-cinderclient drops v2 support,
so horizon needs to use v3 classes.

Includes a workaround in unit tests for two cinderclient.v3 classes
that are missing in the cinderclient releases prior to 8.0.0.  The
workaround can be removed once cinderclient change I335db5c1799edb2
is merged and released.

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: Iab0f097fab6696462572dc6ea53767c91e5411b1
2021-07-19 08:00:58 -04:00
YuehuiLei 87f498bee5 Drop the usage of unicode prefix from unicode strings
All strings are considered as unicode strings in python 3,
so we no longer need "u" prefix (u'...').

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I796d2fcdca066475bbf29d25cbf2aa67b2b2178b
2021-02-12 13:05:27 -06: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
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
Ivan Kolodyazhny e976461d85 Remove six usage from horizon 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: I0b567382edf4d68674a7b8d0b02333fb57293958
2020-01-15 12:36:11 +02:00
Akihiro Motoki 363802d9e9 Avoid using nova volume test data for cinder API mocking
self.volumes from nova test data is used as return values
of cinder API wrapper mock. Nova test data is based on
novaclient.v2.volumes.Volume class. This is not correct.
They should be based on cinderclient Volume class.

This commit changes to use cinder test data for
return values of openstack_dashboard.api.cinder mock.
'bootable' attribute is required, so it is added to cinder_data.

This confusion comes from the naming of self.volumes.
This commit renames self.volumes to self.nova_volumes
to avoid further confusions.

Note that api.nova.instance_volumes_list() calls get_server_volumes
from novaclient and it is correct to use self.nova_volumes.

Change-Id: I9c431dbb03f90bab84a4a6a3e3ea8fd5a5498b5b
2019-07-18 04:11:19 +09:00
wangliangyu a9d6c7886c Make update status dialog less confusing
Now, we give the init status of the volume when resetting status.
The first glance is the current status, instead of "Select an
new status", and we could do nothing with the status will confuse user.
The same with snapshot.

According to the above situation and Akihiro's suggestion:
 - Use "Select on new status" as the default label
 - List all possible values for status *including the current status*
 - Add "(current)" to the current value in the dropdown list

Change-Id: I61e642e2fd8ddd7498911272678e57b60b60a3b8
Closes-Bug: #1803475
2018-11-22 20:42:24 +09:00
Akihiro Motoki a0e4508c97 Fix confusing variable names in unit tests
mox_**** was used to store test data.
It is confusing and meaningless.
This commit fixes the usage.

Related to blueprint mock-framework-in-unit-tests

Change-Id: I35a13020962999c3f5b550208e6f0b82bf1648b6
2018-08-18 17:15:59 +09:00
Zuul 452bfbc32b Merge "django2: Replace django.core.urlresolves with django.urls" 2018-03-01 14:34:28 +00: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
Akihiro Motoki e477eafa45 django2: Replace django.core.urlresolves with django.urls
(In Django 2.0) The django.core.urlresolvers module is removed
in favor of its new location, django.urls.
It was depreacted in Django 1.10:
https://docs.djangoproject.com/en/2.0/releases/1.10/#id3

blueprint django2-support
Change-Id: I46ab5c325491274b8eaffbf848e5d80f83c2fd26
2018-02-17 01:36:48 +09:00
Akihiro Motoki 17b7e91472 Show volume snapshots in admin volume detail page
To show volume snapshots from different projects,
we need to specify all_tenants=True to the list operation.

Also fixes an issue that the actions in the snapshots table
in the admin volume detail page refer to the project dashboard.

Change-Id: I8dc50625e0e84fd2ce81d731bd54cbd0e08b100d
Closes-Bug: #1733186
2017-12-11 17:38:25 +09:00
Ivan Kolodyazhny 14a350d013 Switch Cinder-related tests to mock
This patch changes mox to mock for the following test module:
* openstack_dashboard/dashboards/admin/volumes/tests.py

Change-Id: Id487feb397207b3544c9398a446077e3f6a39b1a
Partially-Implements: blueprint mock-framework-in-unit-tests
2017-10-23 15:43:41 +00:00
Julie Gravel 74cfb5d9af Fix Status dropdown initial value
The value of Status dropdown on Admin > Volume > Volumes > Update Volume
Status and Admin > Volume > Snapshots > Update Status forms were initially
set with the raw data instead of the localized version of the value. This
fix changes the initial value to the localized version and also updates
localized statuses to use values from
project.volumes.tables.VolumesTableBase.STATUS_DISPLAY_CHOICES.

Closes-Bug: #1626343
Change-Id: I1ac58e2eb7b4a8d4894280285a824d280fafd531
2017-05-15 12:37:03 -07: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
Richard Jones e0b6936178 Refactor Volumes from tabbed panel to stand-alone
This edit unfortunately contains more changes than the others
because it effectively merges a bunch of files under
admin/volumes/*.py

Change-Id: I52f3444a92fc83982a95760673419b4b4d746ad3
Implements: blueprint reorganise-volumes
2017-03-09 18:43:05 +00:00
Richard Jones a22bba4af9 Move Volume Types out of tabbed panel
Change-Id: Ie8ddc78a6638e02b673582b081a67f05ec0a2a0a
Implements: blueprint reorganise-volumes
2017-03-09 14:30:56 +11:00
Richard Jones e89c377599 Move Admin Volume Snapshots out of tabbed panel
Change-Id: I8c569a0d0fa5e990524012cacee50f9a249aa5e1
Implements: blueprint reorganise-volumes
2017-03-09 13:47:31 +11:00
Richard Jones 46ad19dbf0 Refactor Project Volumes stand-alone panel
Note that there was state leaking from one of the existing
tests that was relied upon in other tests and moving that test
in the run order caused the others to fail. All related tests
have been altered to not leak state.

Change-Id: I972bc5650fa77044de8a027f570cf2cb41febef8
Implements: blueprint reorganise-volumes
2017-03-06 15:50:09 +11:00
Richard Jones 97589ec0fb Move Volume snapshots out of tabbed panel
In doing this I found that the permission check on the
project Volume Snapshots table was incorrectly defined,
resulting in always-denied. Removing a level of nesting
in the permission structure fixed it.

Change-Id: I1bc5bd4820700d29861ec1dcd6c87a41b5230266
Implements: blueprint reorganise-volumes
2017-02-28 14:05:26 +11:00
Lingxian Kong c33b0840cb Only get detailed info for Nova servers when necessary
Horizon will get all servers from Nova in different several places,
but sometimes it only need ID and name instead of all the related
information of servers. novaclient already support 'detailed=False'
param for servers query.

Horizon page loading performance can also be improved with this patch.

Closes-Bug: #1661423
Change-Id: Ic4cc95cb4eaed0461a22ab1045fa83ba5a5e9ce4
2017-02-03 12:03:22 +13:00
Luis Daniel Castellanos e15b61f58a Update admin filter first setting to a dict
Previously the ADMIN_FILTER_DATA_FIRST setting was a True/False
setting that was taking over all the admin views leaving
operators without the opportunity to set this setting to views
individually.

This patch changes the setting to a dict where it can be specified
which panels/views will implement this setting individually.

Implements blueprint: admin-views-filter-first

Change-Id: I50deab878f68c1cc519aa9b47feaa2c58bb8eacc
2016-09-14 15:52:20 -05:00
Luis Daniel Castellanos 9d7b751f5f Implement admin_filter_first setting in Admin>Volumes
Implemented the ADMIN_FILTER_DATA_FIRST setting in
Admin>Volumes View (volumes Tab)

Implements blueprint: admin-views-filter-first
Depends-On: I007af8d4aef33656752796250f4177ddf01dd78b

Change-Id: I539c2ae4b420892085227bef5277896c0f1227c0
2016-09-02 10:16:54 -05:00
David Lyle 5d6003971f Fix tests broken by novaclient 4.0.0 release
The release of python-novaclient 4.0.0 removed both volume_types
and volume_snapshots from the v2 namespace. Both of these data types
are supplied by cinder, but the Horizon test data was still populating
them in nova test data and the tests were using the nova values.

This patch removes the missing namespace references and replaces
the mocked test data with those mocked for cinder.

Additionally, the change exposed a rather broken test in the QoS
for volume_types test suite. This test has been fixed and improved
to exercise more branches.

This fix will unblock the gate for Horizon.

Closes-Bug: #1572246
Change-Id: I9604cd4046a5ab1486373d0572ddf504d4691196
2016-04-19 14:38:44 -06:00
Rob Cresswell fd92d8ec59 Fix remaining Django 1.9 test failures
This patch gets Horizon to a passing state in the Django 1.9 tests

Co-Authored-By: Itxaka <iserrano@redhat.com>
Co-Authored-By: Timur Sufiev <tsufiev@mirantis.com>
Change-Id: Icbc1a3c039de658faa9fba4a2cdd5027345fe94d
Partially-Implements: blueprint drop-dj17
2016-04-09 11:13:16 +00:00
Jenkins a44085d914 Merge "Do not make unnecessary calls to Nova from FIPs and Volumes tabs" 2016-03-16 13:15:01 +00:00
Timur Sufiev ed076e6234 Do not make unnecessary calls to Nova from FIPs and Volumes tabs
If none of the floating IPs listed within Horizon are attached to an
instance, do not request a list of Nova instances (because we have no
use for it). Apply the same behavior for Volumes tab (both Admin and
Project). This patch both saves us from making unnecessary and
potentially expensive call to Nova and lays the ground for a more
selective request of instance details from Nova. The latter will be
possible once Nova supports filtering instance details by >1
instance_id. For reference see
https://blueprints.launchpad.net/nova/+spec/get-multi-servers-filter

Change-Id: Ie7563b9e03b286b4cf51507463213162af3383b1
Partial-Bug: #1442310
2016-03-16 10:12:55 +00:00
Matthias Runge 0492c7189d properly mock cinderclient calls in tests
Change-Id: I905920ebe191ad42f1b2b8bbb2db4be1ec4fdc86
Closes-Bug: #1538215
2016-02-24 13:06:09 +01:00
Timur Sufiev f90b374ad7 Add pagination to volume snapshots and backups pages
Do it for both Project (both Snapshots and Backups tabs) and Admin
(only Snapshots tab) dashboards.

To test: set 'Items Per Page' in the UI Settings page to a low number.

Change-Id: I9b16cf31c726055da0afad347e033f3918af3049
Closes-Bug: #1499664
2016-01-30 15:15:31 +03:00
Mingyan Bao 091d351553 Add pagination support to the volume page
Cinder v2 supports pagination.
Added to the volumes table for both admin and project.
Also fix the Cinder REST API to handle pagination (like Glance
REST API).

To test: set 'Items Per Page' in the UI Settings page to a low number.

Co-Authored-By: Cindy Lu <clu@us.ibm.com>
Co-Authored-By: Timur Sufiev <tsufiev@mirantis.com>

Change-Id: Ib1772d6e6214dc96a09ce32fb4d9f9fb79d161f0
Closes-Bug: #1316793
2016-01-22 15:18:47 +03:00
Victor Stinner 674a45ffe0 Replace mox with mox3
mox doesn't work on Python 3, whereas mox3 works on Python 2 and Python
3. Cinder, Nova and many other projects already replaced mox with mox3.
mox3 is now maintained by OpenStack.

Partial-Implements: blueprint porting-python3
Change-Id: I10e6a9754ebd58a2640d73ec8966527c3aa1fe9a
2015-07-13 15:02:10 +02:00
Zhenguo Niu 0ef2542d3a Split admin volumes tests to it's own test file
Currently volumes tests is in admin/volumes/tests.py, it
should have it's own test file like snapshots and volume_types.

Change-Id: Ic39397bff25626893b5a2c218837d2b3525f7526
Closes-Bug: #1459904
2015-05-29 11:14:37 +08:00
Gary W. Smith dca7117fdf Permit using latest python-cinderclient
Fix a number of unit tests so that they will work with the latest
cinderclient, which will be released by the end of Kilo.

The problem was that several horizon unit tests made calls into
python-cinderclient that should have been stubbed out (but were not).
These calls silently did nothing in the released python-cinderclient due
to a "feature" where certain GET functions would return an empty list
when the auth url was an empty string, instead of returning an auth
failure.  Recent changes in the python-cinderclient authorization
functions closed this hole, which then revealed problems in the horizon
unit tests:
1) several tests were lacking stubs to cinder calls, and
2) the auth url in test of cinderclient v2 was empty due to a missing
   dictionary entry in test_data/keystone_data.py

Change-Id: I33967a924f4e47009fdc1613248afd1bd377f34f
Closes-Bug: 1423425
Co-Authored-By: Richard Hagarty <richard.hagarty@hp.com>
2015-03-03 15:45:52 -08:00
Rich Hagarty 455ee822b4 New admin volume panel to manage/unmanage volumes.
Manage will take an existing volume created outside of Openstack and
make it available. Unmanage will remove the visibility of a volume
within Openstack, but will not delete the actual volume.

Change-Id: I6df46f0944015833d1fb94611f9bf520ca8bca8b
Implements: blueprint add-manage-unmanage-volume
2015-02-03 17:28:51 -08:00
Brianna Poulos 9f73f80e21 Add volume type encryption delete
This patch adds support to horizon for volume type encryption
delete.  The contents of this patch were originally a part of
a combined volume type encryption update and delete patch,
(https://review.openstack.org/#/c/72024/) but the delete
portion has been moved to this patch since the pieces do not
depend on each other.

The modifications are made to the Admin Volume Type table, and
add the Delete Encryption action to the action column. Unit
tests are also included.

Change-Id: Ide9109ca22a04b9121bc78eeea26be9ef2adbf97
Implements: blueprint integration-with-cinder-volume-encryption
2014-12-12 18:00:12 -05:00
Brianna Poulos 7493869576 Add volume type encryption to horizon
This patch adds support to horizon for the volume type encryption
changes made in cinder (https://review.openstack.org/#/c/30974/) and
in python-cinderclient (https://review.openstack.org/#/c/39984/).

The modifications are made to the Volume Type table, and add the
Create Encryption action to the action column.  Also, an Encryption
column is added, which includes a link to a summary of the encryption
information for the volume type.

Change-Id: I7f8e6396f8a1819ec6cb07f47ef6ba65832130c8
Implements: blueprint integration-with-cinder-volume-encryption
2014-12-01 16:09:33 +00:00
Akihiro Motoki 393642fd02 Fix E128 errors in openstack_dashboard/dashboards/admin/
E128 continuation line under-indented for visual indent

Partial-Bug: #1375929
Change-Id: I7a258d624f35b602da07c9b8604fb26c63287824
2014-10-15 13:50:07 +09:00
Akihiro Motoki 7b47906118 Fix E127 errors in openstack_dashboard/dashboards/admin/
E127 continuation line over-indented for visual indent

Partial-Bug: #1375931
Change-Id: I0c3a95633e267294fc3b5576be2fc3c374b4b5d8
2014-10-02 19:46:52 +09:00
Rich Hagarty f56ddcc116 Enable QOS Specs to be associated with volume type
New option for volume types which allows a QOS Spec
to be associated/disassociated with the volume type

Completes: blueprint cinder-qos-specs

Change-Id: I232cb7bc8756c3985997413f92e0c195bfa1ca7b
2014-09-12 08:19:15 -07:00
Rich Hagarty cae34cf1a2 Volume Types tab with QOS Specs
This feature adds a new "Volume Types" tab to the Admin-Volumes panel, and
places QOS Specs on the panel. Future check-ins will add further
QOS Spec functionality, such as adding and deleting, etc.

Partially Implements: blueprint cinder-qos-specs
Closes-Bug: 1284506
Change-Id: I497f3bd00bb13356f5d0734f465cbf6feb02f781
2014-09-02 22:58:07 -07:00
Sam Betts 94a22d0f33 Stop preloading Admin Volumes tabs
API calls can take a long time, no need to preload all the tabs before
they are needed.

Change-Id: I51eb0ca2cf288a75a7c43d7c010affebf33b8912
Closes-Bug: 1357186
2014-08-18 12:53:43 +01:00
Julie Gravel 334789312b Add Volume Snapshots table to Admin Volumes
This is part 2 of the work for the BP. The Volume Snapshots table
resides inside the new "Volume Snapshots" tab which is the second tab
within the Admin Volumes panel. There are two table actions: "Delete
Volume Snapshot" and "Update Volume Snapshot Status". The Update
Volume Snapshot Status action implements a cinder command that was
only available through CLI as per stated in the BP.

Change-Id: Ife2da2c142467e47a7ac5bfcb8a477ff578b4d39
Partial-Implements: blueprint cinder-reset-snapshot-state
Closes-Bug: #1332077
2014-08-11 20:31:22 -07:00
Gary W. Smith 9fd1c6cfaa Enable updating the status of a volume
Expose the functionality of the 'cinder reset-state' command in the UI.
As is the case with the 'cinder reset-state' command, this change
permits an operator to select any valid status, regardless of the
current status of the volume.

Implements: blueprint cinder-reset-volume-state
Change-Id: I45180e989fb535bfd1c5bc9123bf70e4b2e24f1b
2014-08-08 17:31:45 -07:00
Julie Gravel 2ecd040941 Change Admin Volumes to a tabgroup
Currently there is no Snapshots area in Admin Volumes. In order to
enable the reset snapshot state feature, We need a new tab for Snapshots
in the same manner as what's in Project Volumes. This submit is part 1
of the work, which is to refactor the Volumes panel and make it a
tabgroup. This is so that we can add another tab for Snapshots later on
(in part 2).

Note that these are only structural changes. There are no content
changes.

Partial-Implements: blueprint cinder-reset-snapshot-state
Change-Id: Ibadc4151e698dc6ea99009f6a63fc89c6d001946
2014-07-28 23:00:31 -07: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
Julie Pichon 77dcd64341 Basic support for Cinder v2
Change-Id: I6540720866c9005cf9537fe5b3a241f769529b3a
Implements blueprint: cinder-v2-horizon
Closes-Bug: #1226944
2014-03-03 15:42:23 +00: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
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
David Lyle 73e62610cf Fixing scoping of instances in admin volume view
Existing code was only getting instances scoped to the user's
current token.  When calling from the admin volumes view, this
needs to get all instances to correlate volume attachments.

Changed get_volumes to pass all_tenants=True to be consistent,
cinder ignores the value anyway and only looks for the all_tenants
key.

Fixes: bug #1193002

Change-Id: I5ed2a63997126911d6657619b062acd2947d06e1
2013-06-20 16:12:31 -06:00