5405 Commits

Author SHA1 Message Date
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
Zuul
9e383e439b Merge "Set up the initial displayed values in all boot-sources" 2020-03-09 15:53:08 +00:00
Zuul
c0a7a43d3f Merge "Add pagination to Source table in Launch Instance wizard" 2020-03-08 21:24:39 +00:00
Zuul
3f80be3a3b Merge "Add pagination to Server Groups table in Launch Instance wizard" 2020-02-19 14:07:24 +00:00
Ivan Kolodyazhny
3e7bc83c4b Allow to set default instance boot source
This introduces a new config option `DEFAULT_BOOT_SOURCE` to allow
operators to configure a default instance boot source.

Change-Id: Ia9b0d1d24ae69958b6606b9a645bd54f70b3aacc
Implements: blueprint default-instance-boot-source
2020-02-18 11:46:39 +02:00
Tatiana Ovchinnikova
5c54ab5d46 Add pagination to Source table in Launch Instance wizard
The most elegant way to add pagination is to refactor the table using
<hz-dynamic-table> which already contains pagination instead of wiring
it to the existing table framework.
This solution adds the pagination and makes the code more readable.

Partial-Bug: #1859423

Change-Id: I08b7b94cf214a6b086565c2dd429e460e4e5c3de
2020-02-05 11:40:17 +01:00
Tatiana Ovchinnikova
057abb210b Add pagination to Server Groups table in Launch Instance wizard
The most elegant way to add pagination is to refactor the table using
<hz-dynamic-table> which already contains pagination instead of wiring
it to the existing table framework.
This solution adds the pagination and makes the code more readable.

Partial-Bug: #1859423

Change-Id: Ifc56d2440cb461ca320b6ea4653fd7921cd1ca5f
2020-01-31 15:45:26 +01:00
Stephen Finucane
2b3ab46440 Remove errant references to mox
There is still a single user of mox but all other references to this can
be removed. Do just that.

Change-Id: I611573a41c47e99e41a54bf53cea55322a493de1
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-01-30 10:35:50 +00:00
Zuul
19de1f16ba Merge "Add pagination to Security Groups table in Launch Instance wizard" 2020-01-22 17:28:50 +00:00
Zuul
64fc992f2a Merge "Remove flavor disk size ckeck when create instance from volume" 2020-01-20 21:58:03 +00:00
Zuul
c340145ded Merge "Allow to evacuate without specifying a target host" 2020-01-18 06:21:33 +00:00
Rikimaru Honjo
f9e0f8a976 Allow to evacuate without specifying a target host
When the evacuate is run without specifying a target host, horizon
sets an empty string for target host. But the evacuate api doesn't
allow an empty string. As a result, nova returns "HTTP 400 Bad
request".

So this patch sets None as the target host when it isn't specified.

Change-Id: Ia865a6c02e206fa49efc3095e8d3488f5638d0e3
Closes-Bug: 1793694
2020-01-17 08:47:00 +00:00
Tatiana Ovchinnikova
a62751ca4f Add pagination to Security Groups table in Launch Instance wizard
The most elegant way to add pagination is to refactor the table using
<hz-dynamic-table> which already contains pagination instead of wiring
it to the existing table framework.
This solution adds the pagination and makes the code more readable.

Partial-Bug: #1859423

Change-Id: Iaff9e1f3c834a2bdb5823249de632ce472811a7d
2020-01-16 08:58:22 +00: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
Zuul
f4dbae90f8 Merge "Change Rebuild Instance Form select widget to normal style" 2020-01-07 02:52:34 +00:00
Zuul
1b0c07b947 Merge "Fixes a series of bugs related to Floating IPs." 2020-01-06 16:14:47 +00:00
白子玉
6d149b0e81 Change Rebuild Instance Form select widget to normal style
Replace select widget from ThemableSelectWidget to SelectWidget.
When there are too many images, ThemableSelectWidget will be too long and
makes choosing an image hard. But normal style select can provide a scroll
bar there.

Change-Id: I843c5011d3caf9946210b7ee236e76318a646173
Closes-Bug: #1794000
2020-01-06 13:29:43 +00:00
Zuul
b7da38d005 Merge "Fix use of ngettext in registry getName" 2020-01-06 12:34:13 +00:00
白子玉
5d7e3eac0f Remove flavor disk size ckeck when create instance from volume
No longer check flavor disk size larger or equal than image's mix disk when
you create instance from volume, because it's already checked when creating
volume.

Change-Id: I8e4fc074aafe7e880ceb7ab06d8ef565709beeeb
Closes-Bug: #1563529
2020-01-06 14:59:19 +08:00
Akihiro Motoki
a2a3e8b6c3 Drop Django 1.11 support
Django 1.11 support was dropped. Django 1.11 ends its extended support
in April 2020 which is before Ussuri release. Considering this,
horizon dropped Django 1.11 support.

Unnecessary Django version checks in the code are also dropped.

Change-Id: I2c58934f2b026745fbc97a58212b91d149db3657
2019-12-29 06:20:37 +09:00
Robin Cernin
31f7fc6bb2 Deprecate exceptions.check_message
exceptions.handle() is used in most cases consistently.
check_message() is a legacy which was introduced when exceptions
were not well classified. exceptions.handle() should cover all
common error scenarios and there is no role played by check_messages().
Let's clean up its usage and deprecate it for the future removal.

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I545b6c666d13d39cf5287ccc7c972dc746faf2fb
Closes-Bug: #1339885
2019-12-23 20:12:30 +09:00
Radomir Dopieralski
ef4055e288 Fix use of ngettext in registry getName
The setNames and getNames functions in the resource registry were
calling ngettext() on already translated strings that were marked for
translation with gettext() and not ngetttext(). That lead to some
page titles in some locales being displayed as single characters.

Closes-Bug: #1762089
Change-Id: I0ef365e0c0de6ae27a2e80bcb5257132f8c6ba29
2019-12-20 09:44:48 +00: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
Marek
161b4ae5d4 Fixes a series of bugs related to Floating IPs.
- Fixes KeyErrors when accessing 'floatingip' values in usages, which
  broken Floating IP allocation.
- The quota display in the bottom right of the Allocation dialog are
  only displayed if 'enabled_quotas' is True
- Adds security group rule tallying for the usages overview page, which
  fixes a KeyError crash for installations where Horizon 'enable_quotas'
  is set to true, but the 'quota_details' extension is not installed on
  in Neutron
- Adds a policy check to show and hide The plus/add button in
  Instances->Associate Floating IP to match the Allocate IP To Project
  button in Floating IPs
- Fixed the page title not being set for the non-modal version of the
  modal allocation dialog/form
- Added an 'allowed' functionality for network usage overview charts to
  allow for them to be dynamically disabled
- Added tests and mocks for the above
- Added tests for non-legacy quota tallying for networks
- Added test for disabled network quotas in overview

Change-Id: I47f73ff94664d315a2400feb8ce8a25f4e6beced
closes-bug: #1838522
2019-12-17 13:30:25 +09:00
Zuul
50753f4c93 Merge "Fix failing tests under python3.8" 2019-12-06 09:20:13 +00:00
Zuul
d8f8f02cdb Merge "Add image data for instance with volume" 2019-12-04 09:38:52 +00:00
Tin Lam
140c22741e Add policy_rules to flavors dashboard
This patch set adds in os_compute_api:os-flavor-manage policies in the
appropriate dashboards.

Change-Id: I3157aeaa916837b4f6258009dc643ab225e6ee17
Signed-off-by: Tin Lam <tin@irrational.io>
2019-12-02 23:45:07 +00:00
Tatiana Ovchinnikova
18020e30b6 Fix deleting port from port details page
This patch fixes "Delete port" button at the port details page:
Project -> Network -> Networks -> <network name> -> Ports -> <port name>

Change-Id: I84f4da9c84d75c458b54bd456cbc7b92b303ba81
Closes-Bug: #1854514
2019-11-29 19:55:08 +01:00
Michal Arbet
33fe0fef33 Fix failing tests under python3.8
In python3.8 cgi.escape function was removed as it is
noted here : https://docs.python.org/3/whatsnew/3.8.html

This patch is fixing security_groups tests and replacing
escape func from cgi to escape func from django.utils.html.

Change-Id: I5e47001dad730b64d4914e72df7d93ee15a1db12
Closes-Bug: #1854019
2019-11-26 12:15:40 +01:00
Zuul
f592481cc0 Merge "Add support for keystone access rules" 2019-11-25 09:25:56 +00:00
Tin Lam
e3fc37188d Add policy_rules to aggregates dashboard
This patch set adds in os_compute_api:os-aggregates policies in the
appropriate dashboards.

Change-Id: Id31388e4c7fa3093e31da0479635f5610e378da5
Signed-off-by: Tin Lam <tin@irrational.io>
2019-11-19 09:10:09 -06:00
Tatiana Ovchinnikova
5de6df19dc Add image data for instance with volume
If an instance was created with a volume from an image, there is
no image details in instance overview page.
This patch adds image info from volume image-metadata.

Change-Id: I1da69eb4a65ab13f77d610b870bada994de876f2
Closes-Bug: 1833267
2019-11-13 16:53:24 +01:00
Colleen Murphy
4d1786c687 Add support for keystone access rules
Keystone implemented the ability to apply fine-grained access control
restrictions to application credentials[1]. This patch adds new fields
to the application credential creation form and detail view so that
horizon users can use this feature.

[1] http://specs.openstack.org/openstack/keystone-specs/specs/keystone/train/capabilities-app-creds.html

Depends-on: https://review.opendev.org/677585

Change-Id: I2d71392eb8569ffb8cb15af29eea76e120a158cc
2019-10-30 14:47:05 +09:00
Pedro Martins
c7e5b64978 Set up the initial displayed values in all boot-sources
Problem description
===================

In the launch instance workflow while creating a virtual machine,  when
I select the Source tab, most of the time the default boot-source is
`Image` and everything works just fine. However, some times, the default
boot-source comes as Volume, due to some race condition (tested and
reproduced in Chrome 77). In this case, the Available items table is
empty, even if there are bootable volumes to be attached to the VM. This
problem happens because the initial state of boot-sources is setting
only the `displayedAvailable` of the Image source (that is the "default
source"), instead of setting all the initial `displayedAvailable`
elements.

Proposal
========

The proposal is basically to set up the `displayedAvailable` in
all boot-sources.

Closes-Bug: #1848334

Change-Id: I1c9399bf3f6c859206c093452c2e637892aa9722
2019-10-29 17:41:29 -03:00
Zuul
8baf384250 Merge "Add the unit test for domains" 2019-10-25 07:46:24 +00:00
Adam Harwell
70629916fe Use quoting for CSV Writing
An attacker could create an instance with a malicious name beginning
with an equals sign (=) or at sign (‘@’).
These are both recognized in Excel as metacharacters for a formula. The
attacker can create an instance name that includes a payload that will
execute code such as:
=cmd|' /C calc'!A0
This payload opens the calculator program when the resulting CSV is
opened on a Windows machine with Microsoft Excel. An attacker could
easily substitute this payload with another that runs any arbitrary
shell commands.

Quote the CSV output so this is no longer a possibility.

Closes-Bug: #1842749
Change-Id: I937fa2a14bb483d87f057b3e8be219ecdc9363eb
2019-10-11 19:52:08 +00: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
Zuul
ab429363ba Merge "Handle partial dict setting" 2019-09-26 19:46:39 +00:00
Zuul
f48025e0a0 Merge "Wrong list of attached vms are shown in manage volume attachments" 2019-09-26 11:21:29 +00: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
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
Shilpa Devharakar
87b57dfe71 Add Allowed Address Pair/Delete buttons are only visible to admin
Initially In Queens, when logging into Horizon in context
of a _member_ in any project, the "Add Allowed Address Pair"
and "Delete" buttons in "Network" -> "Networks" ->
<select a network> -> "Ports" -> <select a port> ->
"Allowed Address Pairs" are not visible.

When accessing the same panel in context of a project where the user
has the admin role, the "Add" and "Delete" button is visible and
functional.

This patch fixes the above issue by updating the policy_target.

Change-Id: Ia7db6c2881c72580a156eb97b11bb51f295cfbce
Closes-Bug: #1794421
2019-09-25 18:37:58 +05:30
pengyuesheng
a27c55c7cf Add the unit test for domains
Change-Id: I4f64bfa9d019544a2ae41b2be7fc23ab12c843bf
2019-09-20 14:20:16 +08:00
Zuul
1208919617 Merge "Drop deprecated Keystone V2 API support" 2019-09-12 19:26:59 +00:00
Zuul
8b7a28677c Merge "Downloadable Kubernetes configuration file" 2019-09-12 17:54:02 +00:00
Ivan Kolodyazhny
f33e5fd8ac Drop deprecated Keystone V2 API support
Keystone V2 API was deprecated in Stein release in Horizon and
removed from Keystone in Queens release.

Change-Id: I917e273d3174adf0874e516b3d635ccb8ba58a27
2019-09-12 17:15:07 +00:00
Claudio Pisa
f381f4dd3c Downloadable Kubernetes configuration file
Kubernetes can use OpenStack application credentials for authentication.
Generate a kubeconfig file and make it available to download along with the
openrc and clouds.yaml files.

blueprint kubernetes-config-gen

Change-Id: I298370e7abf4f0d480bd5199060f24bab6d6daaa
2019-09-12 14:03:04 +03: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
Zuul
7830a74fe8 Merge "trivial: Remove 'cache_control' decorator" 2019-09-11 04:46:52 +00:00