Commit Graph

63 Commits

Author SHA1 Message Date
Zuul 0850f71df6 Merge "Allow volumes in error_restoring/error_managing to be deleted" 2022-09-19 22:59:07 +00:00
Akihiro Motoki cd7c1b5110 Address RemovedInDjango40Warning (2)
django.utils.translation.ugettext(), ugettext_lazy(), ugettext_noop(),
ungettext(), and ungettext_lazy() are deprecated in favor of the
functions that they’re aliases for: django.utils.translation.gettext(),
gettext_lazy(), gettext_noop(), ngettext(), and ngettext_lazy().

https://docs.djangoproject.com/en/4.0/releases/3.0/#id3

Change-Id: I77878f84e9d10cf6a136dada81eabf4e18676250
2022-02-04 16:22:07 +09:00
Sam Morrison 8fa8bd3727 Allow volumes in error_restoring/error_managing to be deleted
The list of statuses is based on the cinder API code [1].
In the API reference [2], 'in-use' is also mentioned,
but 'in-use' is not included as 'in-use' volumes can be
deleted only when 'force' flag is specified.

[1] ae5fd170f0/cinder/volume/api.py (L480-L481)
https://docs.openstack.org/api-ref/block-storage/v3/index.html?expanded=delete-a-volume-detail#delete-a-volume

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I4a4f3fed1c8e02245573512a1e43749b03890324
2022-02-04 14:07:15 +09:00
manchandavishal 6ac31e0ba8 Drop Django based implementation of launch instance
horizon already deprecated launch instance Django based implementation
in the wallaby cycle [1]. This patch remove code for launch instance
Django based implementation as angular based implementation is the
default one from long and all features gaps between angular and Django
implementation is closed.

It also moves SetAdvanced step code to ``resize_instance.py`` as
``workflows/create_instance.py`` file is deleted and remove server_group
option from Advanced Options of resizing instance action because
"server_group" is not required while resizing an instance as per
nova-api reference [2].

Closes-Bug: #1869222

[1] https://review.opendev.org/c/openstack/horizon/+/779125
[2] https://docs.openstack.org/api-ref/compute/?expanded=resize-server-resize-action-detail#resize-server-resize-action

Change-Id: I5e01cd81f309491f1a58ea93911030366a86e3c7
2022-01-24 16:21:18 +05:30
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
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
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
Gayathri Devi Kathiri 423734b5ec Fix "Update Metadata" tab on Horizon
"Update Metadata" button is visible by all
roles on "Volumes" and "Snaphsots".

"policy_rules" is defined in "UpdateMetadata"
class to fix it.

Change-Id: Ibbdd4e4874c7cea97c91948003a68ebf43b8c934
closes-bug: #1873007
2020-04-20 10:13:49 +00: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
Corey Bryant 6f4742457f Switch from django string_concat to format_lazy
string_concat was removed in django 2.1 when it reached the end
of it's deprecation cycle. It was removed because the same behavior
can be achieved with format_lazy.

For more details see:
https://docs.djangoproject.com/en/2.2/releases/2.1/

Change-Id: I5e1c9bdfa1d0e049e0516198abbdb76be1667216
Closes-Bug: #1836671
Partial-Bug: #1789046
2019-07-19 16:50:16 -04:00
Akihiro Motoki fcdc67b819 Define default settings explicitly (openstack_dashboard 3/5)
This commit mainly covers settings
in openstack_dashboard/dashboards/project/.

Part of blueprint ini-based-configuration
Change-Id: I22413d2fe20576a507634dc4e2d0354c7db8800a
2019-07-03 14:54:16 +09: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
pengyuesheng 3fb90e0c77 Translate awaiting-transfer status in volumes panel
Change-Id: I5a26a63dcd485e0e0c28bcd0fd35f28e3edca613
Closes-Bug: #1823130
2019-04-04 15:52:48 +08:00
Akihiro Motoki f3bd271fc9 pylint: fix bad-super-call
Change-Id: Ia81e5c8b77dbfcb48630b1736d581cdff73278ef
2019-01-15 01:11:33 +09:00
Simon Collins 2a3b04ce6c Changed the message level for deleting some resources to info
Added functionality to the handle function in the BatchAction class
in action.py and allowed the easy changing between the alert types
and made deleting images, instances, and volumes give an info alert
rather than a success message and altered the testing parameters

Change-Id: I93251d6d12cf89a331b5c051bf4fe10a6e470f51
Closes-Bug: #1291681
2019-01-03 18:45:08 +13:00
Akihiro Motoki e5d6f54e99 Make generic group check work with admin table
Previously allowed() methods in DeleteVolume and DeleteVolumeSnapshot
actions assume that the cinder generic group is always available.
The current admin volume and volume snapshot tables do not load
generic group information, so these allowed() methods failed and
as a result these delete actions are not shown.
This commit checks if a volume belongs to a generic group in more
robust way. This change makes the project volume table work with
deployments without the generic group as well.

Change-Id: Idd887434153966d9188acaf08346fa6a0f0e6719
Closes-Bug: #1787065
2018-08-15 01:52:10 +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
Zuul 26277a3715 Merge "Add reserved status key word to horizon" 2018-06-04 07:45:38 +00:00
jmoffitt b9a1c445d9 Update attach_volume and detach_volume policy rules
The prior commit for this was functional but not quite
correct. The policy rules currently in Horizon for
attach and detach of volumes don't exist in Nova and
are missing from the local copy of nova_policy.json and
from Nova generated policy files. The fix to use the
create instance copy of the rule only worked for attach
and not detach ( https://review.openstack.org/#/c/570071/ )

This commit updates detach as well, and should be correct
going forward based on the Nova policy rules at:
https://git.openstack.org/cgit/openstack/nova/tree/nova/policies/volumes_attachments.py

Change-Id: I07fccd6f12149cd88a049c46aa113dfd2b60bbaa
Closes-bug: 1772759
2018-05-23 15:19:28 -07:00
jmoffitt 8e3903902d Fix mismatched attach_volume rule
The attach_volume rule on the Compute Instances and Volume pages
does not match the rule in the nova_policy.json file, or what is
generated from an oslo policy generation on Nova. Update the rule
to match what is used in the default policy file, and what Nova
uses in its unit tests.

While looking at this, discovered that the detach_volume has a
similar problem, with no rule that matches at all. It may make sense
to have detach volume use similar permissions to attach

Change-Id: I40c709c7bb0c8538b56624dbfff1faea2eba9ee6
Closes-bug: 1772759
2018-05-22 15:49:54 -07:00
Larry GUO 4776428cb6 Add reserved status key word to horizon
Horizon don't have related change which align with the
change in https://review.openstack.org/#/c/330285.
With this fix, horizon can work as expected

Change-Id: I5940c662a0bec2beaf4863e07f7244311ba51212
Closes-Bug: #1770326
Signed-off-by: GUO Larry <guo1017138@163.com>
2018-05-17 13:00:56 +00:00
Akihiro Motoki 11eb4e9d3e Fix W503 warnings
W503 line break before binary operator

Looking at the code base, it sounds okay to follow this check.

Change-Id: Id511e0104dc6de5b204021661d4a8776ca6d3658
2018-04-11 18:13:47 +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
Zuul 36f3e93a1a Merge "Fix wrong link to VM in admin volume table" 2017-12-04 05:31:58 +00:00
Akihiro Motoki 4693a18975 Fix wrong link to VM in admin volume table
Change-Id: I1f224fa544f80f749e692b321b4d4f46ea1ab940
Closes-Bug: #1567317
2017-11-19 12:52:21 +00:00
Trung Trinh f22fe2dce3 Display attachment's server_id when name is no longer available
This scenario occurs when the associated VM instance with the volume is not found
by whatever underlying reasons.

Change-Id: I15831e2377fe504c667babe5ea00ac09808d296f
Closes-Bug: #1402915
2017-09-05 15:43:48 +02: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
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
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 24a4905f5e Merge "Update Horizon to use latest nova policy rules for validation" 2017-04-05 20:34:46 +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
Yaguang Tang c61ae4f083 Update Horizon to use latest nova policy rules for validation
As Nova's API is unified to os_compute_api, the API policies are also
updated to use this format, Horizon needs to use Nova  policy enforce
rules in the codebase. This patch also update nova_policy.json using
oslo-config-generator for Nova policy file.

Co-Authored-By: Rob Cresswell <robert.cresswell@outlook.com>
Implements: blueprint update-nova-enforce-policies

Change-Id: Id7d01a39930c88592301a5035f0befe5293a78fa
2017-03-13 13:43:02 +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
Zhenguo Niu 15c4d8330d Volume status must be available to extend
Change-Id: I3e149249db0a44be6531dc409176c698819be317
Closes-Bug: #1277570
2014-02-10 14:36:31 +08:00
Zhenguo Niu 3c68470cfc Add volume extend functionality support
Cinder now has the ablity to extend a volume, This functionality
should be exposed through Horizon.

Change-Id: Iff26453fd0a83af97fad4adabbcd53f646a15e51
Implements: blueprint volume-extend
2014-01-17 21:02:06 +08:00
Zhenguo Niu dcd166e1c8 Add update method of volume name and description
Change-Id: I19596f1b83b061a47a8784962e6f74f1f43048cf
Closes-Bug: #1264411
2014-01-13 14:39:21 +08:00
David Lyle 985bd7390d adding policy checks for cinder
Adding cinder policy rules file for policy checks. Implementing
rule checks as well. Some cinder API calls actually hit nova, so
adding those calls as well.

Also a couple of improvements to the Horizon policy engine. First,
now providing the token scope project_id and user_id as targets by
default, unless otherwise specified.  Most service policy rules
check on or both of these.  Second, checking to see if rule exists,
before attempting enforcement.  If the rule does not exist, using
the default rule for that service.  This now matches what the
service policy engines do.

Implements: blueprint block-rbac

Change-Id: Ifef08b8975280f4e621ba8eebec9d405e1e870a2
2014-01-10 15:07:15 -07: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
Zhenguo Niu 04494e8678 Allowing snapshoting attached volume
The cinder api allows calling snapshot on attached volumes,
we should enable it on horizon.

Change-Id: I33d7bbca0bf993ace7c243867aa5f57438a57a5d
Fixes: bug #1202929
2014-01-06 11:15:25 +08:00
Akihiro MOTOKI 0ef5c4701f Allow translators to control word order of BatchAction message
Currently BatchAction message is generated by concatenating
'action' and 'data_type'. In most cases 'action' is a verb
and 'data_type' is an object. However in some action such as
TerminateInstance 'action' is a combination of verb and
object (e.g., "Scheduled termination of").  It is hard that
translators find translated strings which covers both cases.

This commit allows classes inheriting BatchAction to specify
a full action name containing '%(data_type)s' substitution
in action_present/ action_past so that translators can
control the order of phrases completely.

* _conjugate() in actions.py is renamed to _get_action_name()
  because this method no longer always conjugate words.
* Changes action_past strings which are not a form of verb + obj
  to strings with "%(data_type)s"

Closes-Bug: #1253678
Change-Id: I3cf1dc74e22745eb3a9bd2edc3ec68ed389495b5
2013-12-10 23:00:10 +09:00
Paul Belanger da8c69afa6 Gate on H4xx docstrings for pep8
In an effort to help horizon more friendly to OpenStack hacking
guidelines, we now gate on H40* violations.

Change-Id: Id07294543660368d2f7f5ac363710176ab23b874
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
2013-11-23 12:51:07 -05:00
Rob Raymond 3e75fd4703 Fix bug so that escaped html is not shown in volume detach dialog
Fixes bug #1252881

Change-Id: I8fc4ee78440c2682ad9185dcb88fa9d52ff969db
2013-11-21 12:56:54 -07:00
Rob Raymond b8ff4804e1 Fix bug by escaping strings from Nova before displaying them
Fixes bug #1247675

Change-Id: I3637faafec1e1fba081533ee020f4ee218fea101
2013-11-04 12:12:51 -07:00
Jason Derrett 00f8b11d95 Add Availability Zone to Volume screens
User should be able to choose an AZ (or make unspecified) when creating a volume
AZ should be visible in Volumes table
AZ list should come from Cinder

Change-Id: I23314dedc3eb65454df32102b0a96174f8030d81
Closes-Bug: #1230288
2013-10-10 22:10:35 -05:00
lawrancejing d33f294ba9 Remove unused LOG
In some files, we import logging and define
LOG, but we never used it later, so i remove
those unused LOG and make horizon code clean.

Fixed: bug #1231761

Change-Id: I1ebf0098c647e7522f5f1a93cfece7a52bdc05c1
2013-09-28 23:57:13 -07:00