Commit Graph

83 Commits

Author SHA1 Message Date
Radomir Dopieralski ccef197e03 Don't pass the auth_key for volume transfer in the URL
Instead we pass it as data in the POST request.

Closes-Bug: #2048493

Change-Id: I9085eb146b8f013909f6369b731c076aba3216ab
2024-03-26 10:52:33 +01:00
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 82dfce9f65 Add Unit Test for cinder-user-facing messages
This patch is a follow-up patch of
64db185c79
which adds unit tests for the change.

Add message_level to cinder message test data.
Add third cinder message to make tests more robust.

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I6be88fbacf998a2ba36fea5a776cd4215cdaba0f
2020-09-25 10:51:46 +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 14e779bbac Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: I2de669d8e89b8daeb7ee5405ffab35af6307c40b
2020-03-26 19:45:37 +02: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
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
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
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
Ivan Kolodyazhny 8051a2ca67 Wrong list of attached vms are shown in manage volume attachments
When user tries to attach a volume(multi-attach-volume) to
multiple instances "Manage Attachments" table shows wrong data.
This patch fix the issue.

Closes-Bug: #1700034

Part of blueprint multi-attach-volume

Co-Authored-By: Vishal Manchanda <manchandavishal143@gmail.com>
Change-Id: Ic84e3089c2c15e13dbdf89a38f867e3ddfed86d5
2019-09-25 16:21:15 +00: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
Zuul 0531d01bd2 Merge "Remove volume_backup_list_paged from the volume tests file" 2019-06-18 12:26:30 +00:00
Zuul 6863104fba Merge "Fixes creating nondefault type volumes from volume" 2019-06-14 16:02:13 +00:00
BubaVV c60a82dfaa Fixes creating nondefault type volumes from volume
Horizon ignores volume type of source volume and tries to set default
type to newly created volume. Proposed patch makes Horizon inherit
volume type from the source

Closes-bug: #1830759
Closes-bug: #1599225
Change-Id: Ice18259a59d1b7e347ffab89ca931985d49e6895
2019-06-13 12:01:43 +03:00
pengyuesheng a4acc21dac Remove volume_backup_list_paged from the volume tests file
Volume_backup_list_paged is not used in tests.py, so delete it

Change-Id: I674dc6997da9dab9ce2ffbef728ef8939185a651
2019-06-13 14:46:42 +08:00
pengyuesheng 98c434c199 Disabled accept transfer when number of volumes equal quota of volumes
Change-Id: I3d26b88617a6c4fb177cc9655bab89d23ce72914
Closes-Bug: #1826510
2019-05-13 17:09:07 +08:00
manchandavishal f83324a52c Add Group and Group Snapshot colunm
This patch add "Group" column in Volume table and
"Group Snapshot" column in Volume snapshot table under
admin panel.

Change-Id: Ifa18c70be7d73b302e75ab451b1cd572d970b5c6
2019-03-18 08:22:59 +00:00
wangliangyu 3ac9037677 Table checkbox display problem when updating row
Multi-process:
  If there only one table action, DeleteAction.
  Assume the first time retrieving an empty table in one
  process, the checkbox is hidden.
  In the other process, creating a item, like a instance.
  Now, the checkbox is shown in second process.
  Then updating the item state in first process, the checkbox
  will be hidden. In second process, the checkbox will be shown.

  For above case, we need set the checkbox visibility every time
  when updating single row by ajax.

Change-Id: Ib230ad775070ee089c8f82e7df3ec30c1cda7aa0
Closes-Bug: #1799151
2019-02-09 16:52:44 +09:00
Mateusz Kowalski 9810711e75 Make API calls in Volumes view parallel
In order to increase rendering speed, make
api.cinder.volume_list_paged, api.nova.server_list
and api.cinder.volume_snapshot_list parallel.
For admin panel also api.keystone.tenant_list is
parallelized.

Closes-bug: #1660025
Partial-implements: blueprint fetch-resources-in-parallel

Change-Id: Ic789ff98a59ba792d77103e7778883562e7977d2
2018-11-15 14:50:01 +02: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
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 df780f21d7 quota: Merge tenant_limit_usages into tenant_quota_usages
The response of tenant_quota_usages is now baesd on the limit API,
so tenant_limit_usages and tenant_quota_usages provide same information.
This commit changes all consumers of tenant_limit_usages to use
tenant_quota_usages and updates the corresponding templates.

blueprint make-quotas-great-again
Change-Id: I620e2946f2aca31bac134c247ceaf971498f9eeb
2018-05-02 01:19:25 +09:00
Zuul cd06fe813e Merge "Drop Django <= 1.10 support" 2018-03-09 17:40:17 +00:00
Zuul 46ba0a8b04 Merge "Fix python 3 related test failures" 2018-03-09 17:36:31 +00:00
Akihiro Motoki a72963bdbd Drop Django <= 1.10 support
After Django 2.0 support, we no longer supports Django 1.10 or older
(Actually Django 1.10 seems to work though).
The current django.VERSION branches are all related to Django 1.10
or older, so we can drop all conditions.

py35dj20 job is now voting.

blueprint django2-support
Change-Id: Iefc0ab1c62c82f2842ec7761a9b981da9351cbd2
2018-03-03 07:33:23 +09:00
Akihiro Motoki 4dd60373dc Fix python 3 related test failures
In Python 3.5 with Django 2.0 env, some tests fail.
This commit fixes them.

blueprint django2-support
Change-Id: Ib5ba46d501956ebc7d4f69f17ee86f44319418d2
2018-03-03 07:33:23 +09:00
Zuul 452bfbc32b Merge "django2: Replace django.core.urlresolves with django.urls" 2018-03-01 14:34:28 +00:00
Akihiro Motoki 61ea0b6a76 Make create_mocks compatible with create_stubs
create_mocks was introduced to mock multiple methods easily,
but its arguments are not compatible with create_stubs for mox.
This requires us to make many many small changes when converting
mox tests into mock. It would be nice if create_mocks is compatible
with create_stubs.

Part of blueprint mock-framework-in-unit-tests
Change-Id: I3d98448b1b9c517c194d692d6b3b53dc00e46223
2018-02-20 08:58:29 +09: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
Ivan Kolodyazhny dc732488b3 Implement create_mocks decorator to make mocks easier
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Part of blueprint mock-framework-in-unit-tests
Change-Id: I4b9cf6e8ca7f3eb6988bc83f740b45337946e058
2018-01-09 02:44:47 +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
Daniel Park 8aca02a732 Render 'Volume Transfer' as modal instead of page
Change-Id: Iaa26bacb6ef369145345615821cbe4c3dc24f83f
Closes-bug: #1631193
2017-12-03 06:56:10 +09:00
Zuul 9d6e0ef332 Merge "Display correct volume size in error message" 2017-11-22 08:53:56 +00:00
Ivan Kolodyazhny 1a6b16b785 Switch Cinder-related tests to mock
This patch changes mox to mock for the following test module:
* openstack_dashboard/dashboards/project/volumes/tests.py

The next patch in this series will finish migration to mock in this
moudle with tests refactoring making code cleaner and more supportable.

Change-Id: Icb40ee4d844f34f37839c0e74de29a47c3d3f228
Partially-Implements: blueprint mock-framework-in-unit-tests
2017-10-23 15:43:48 +00:00
Chiew Yee Xin 476b0a4e5a Display correct volume size in error message
The error message displayed when extending a volume should include
the original size of the volume, to tell the user the exact
maximum size the volume can be extended to.

Change-Id: I0ab1ceddc1e9b842ebe7296eda1ca3caea0d7ea6
Closes-Bug: #1673759
2017-07-28 08:39:38 +09:00
Lucas Palm a436b12acc Add the Snapshots tab on the Volume Details page
Currently, there is no way to filter and see the snapshots for
just a single Volume.  As the combined list of volume snapshots
increases, so does the difficulty in viewing and using them.  It
would be beneficial to have these snapshots isolated from each other
based on the volume they were created from.

This change adds a "Snapshots" tab to the Volume Details page that
shows a table of snapshots associated with only that specific Volume.
This will not only make it easier to just view the snapshots for a
particular Volume, but will also make it much more approachable to
manage and delete them as well.

Change-Id: I0a80ef2c8171c81f73e3abf5ab461dae3a3a9afe
Closes-Bug: #1323644
2017-07-27 13:30:34 +00:00
Mykhailo Dovgal d132c2eb11 Get rid of redundant cinder api calls
During executing tenant_limit_usages quotas function we get
information about cinder volumes/snapshots/gigabites usage
that we've already had after tenant_absolute_limits call.
Getting this information we make more api calls that slow down
our application.

This patch fixes this issue.

Closes-Bug: #1703584
Change-Id: Ia6d2dbb8f18ce93f71668d6ebd2689b851586ca9
2017-07-14 16:29:06 +03:00
Jenkins 83c77d152b Merge "Use flake8-import-order plugin" 2017-07-03 20:14:35 +00:00
Akihiro Motoki e6b78f92f2 Use flake8-import-order plugin
In reviews we usually check import grouping but it is boring.
By using flake8-import-order plugin, we can avoid this.
This flake8 plugin is already used in tempest.
It enforces loose checking so it sounds good to use.

Note that flake8-import-order version is pinned to avoid unexpected
breakage of pep8 job.

Change-Id: I8ccd05eb70350a2441cc2a4d1eafc09ee690b83b
2017-07-03 08:02:23 +00:00
Akihiro Motoki 0c836454b2 Switch render() arguments to the new way
Previously template.render() takes Context or RequestContext object
but after Django 1.8 the method takes a dict and request as separate
arguments. The old way will be dropped in Django 1.10.
This commit update the usage based on the Django 1.8 release notes [1].

commit 95d78a140f addresses this
deprecations but it turns out all similar places are not switched.
I searched the code base more carefully and found more.
I hope this clean up all of them.

After this change, extra_context which was passed to (Request)Context
previously is no longer available in HttpResponse object.
Volume unit test is tightly coupled with the context information
and checks rendered actions using the context. Thus the corresponding
tests no longer work. Since we can use only HttpResponse.content
(which is a rendered HTML), the new tests just check various strings
like ID, link and label of a specific action.
This is tricky, but this is now the only thing we can do.

[1] https://docs.djangoproject.com/en/1.8/ref/templates/upgrading/#get-template-and-select-template

Change-Id: I350c22dc3d7db7b93ca4b823dac1e3d88beef1a7
2017-06-21 19:32:03 +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
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 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
Zhenguo Niu 3d25f1d595 Move volume snapshots table to volumes panel
Now that instance snapshots are just images, the images & snapshots
page only has images and volume snapshots. This is an odd combination.
I think we should now move volume snapshots to the volumes panel,
since a volume snapshot is tied to a volume.

Closes-Bug: #1190843
Change-Id: I3e12cec8b859a30db9f131e9889a92277e064086
2014-02-18 10:24:18 +08:00
Jenkins 080e868096 Merge "Add create volume from volume" 2014-02-06 13:21:21 +00:00