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
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
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
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
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
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
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
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
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
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
(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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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>
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
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
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
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
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
API calls can take a long time, no need to preload all the tabs before
they are needed.
Change-Id: I51eb0ca2cf288a75a7c43d7c010affebf33b8912
Closes-Bug: 1357186
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
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
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
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
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
This patch replaces some method imports with module imports and
makes H302 test enabled.
Fixes bug 1188531
Change-Id: Ibfbddeaa19cbbb244da58ffd5c918c41f03a0c65
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