The code used to list flavors when in the admin
or project side was not consistent and raised
alerts if viewing in the admin side but not in the
project side.
This patch moves their behaviour to be consistent
and refactors the code to use the same code-base.
Closes-Bug: #2042362
Change-Id: I37cc02102285b1e83ec1343b710a57fb5ac4ba15
Admin-Compute-Instances dashboard shows "-" as image name for every
instance. Despite, Project-Compute-Instances dashboard displays image
name correctly. Admin dashboard just lacks code to resolve image name
Also, reverted commit deb55b8 which functionality is not needed anymore
Closes-Bug: #1932341
Change-Id: Ieb19e66dc51165d9935424b2e9ab5cdae757b07f
Part of the removal of OPENSTACK_NOVA_EXTENSIONS_BLACKLIST (1/3)
All references of nova extensions in the python code are cleaned up.
Note that the API layer is not touched yet as it is used by the
JavaScript side.
Change-Id: I66cd0a9629253a6462aace9902ef8200b94b2a21
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
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>
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
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
Currently there is no link to previous page at paginated instances
table. This patch resolves that issue by re-using the pagination
code for flavors.
It also supports Ying Zuo's scenario:
After I set only 1 item per page and deleted the instance on the first page,
the expected behavior is showing the next instance in the table after one is
deleted.
xxxIndexView uses PagedTableMixin's _get_marker() from now instead of GET()-
ing the markers
Closes-Bug: #1274427
Co-Authored-By: Dmitry Ratushnyy <dratushn@cisco.com>
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: Id8eaae6bf1b5d6f42291291655e14b8715c08bc8
Signed-off-by: Ferenc Cserepkei <ferenc.cserepkei@ericsson.com>
This patch uses glance list filtering, which allow to query images
for the list of required ids. See [1] for details.
Patch rebased to master. Added test for proposed Glance API request
[1] https://developer.openstack.org/api-ref/image/v2/#show-images
Related-Bug: #1508554
Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info>
Co-Authored-By: Vadym Markov <markov.vadim@gmail.com>
Change-Id: Iac485c1b448011fec97ba5bfaa83851914b294d9
Recent pep8 upgrade and corresponding pycodestyle update break
horizon pep8 job due to the new rules.
This commit fixes the following new errors:
- E226 missing whitespace around arithmetic operator
- E241 multiple spaces after ','
- E731 do not assign a lambda expression, use a def
The following errors are added to the ignore list
as there are many errors:
- E402 module level import not at top of file
- W503 line break before binary operator
Change-Id: I3478b0684175d2604bbcc1d89cbfca298b97f1e1
After futurist calls were introduced, the code became difficult to
understand. For example, local variables are used something like global.
To keep the code easier to understand, the usage of local variables
should be more scoped.
This commit introduces a wrapper function for futurist.ThreadPoolExecutor
and converts inline functions into normal methods.
I believe it improves the code readability a lot.
Change-Id: Id5b7a06c50e397c8c27447322d7f64f2d65c06b6
(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
novaclient version 10 has dropped the support for novaclient.v2.hosts.
os-aggregates and migrateLive APIs expects host from os-services,
so this commit retrieves host list from os-services API.
Change-Id: I5ec007ab1f244ca8caee1eb7b5d4262ac6c32171
Closes-Bug: #1745502
Now instance panel is sending API calls to Neutron to get the addresses
info about network. It take some time until Nova network info cache is
synced when IP address operation like floating IP association is made
in Neutron. The API calls to Neutron exist from this reason.
However, it retrieves a full list of port, so it can potentially leads
to performance issues in large deployments. This commit adds a setting
flag to control whether API calls to Neutron is used or skipped in
the project instance table.
This commits drops a call of servers_update_addresses() in the admin
instance table. In the admin instance table there is no need to retrieve
IP addresses from neutron because the main purpose of the admin panel is
to see all instances and IP addresses in nova network info cache will be
synced soon.
Closes-Bug: #1722417
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: Ie16784eb6352f70ab644dc8b6ea03fc6a881d3f9
The expected error count was wrongly changed in
commit df194c8b4c.
The expected error count was changed from 1 to 2 in the commit
but one new error message was caused by a wrong test code.
api.glance.image_list_detailed should return a tuple of
(images, has_more, has_prev) but the mocked method only returns
a list of images and this causes another error.
Change-Id: Ic1083014f9572bfd20adc60e7ec3eeeac387e9d5
Nova server_list() wrapper needs to receive an explicit `all_tenants`
boolean flag in order to request instances for _all_ tenants -
otherwise while rendering Admin->Volumes table Django will request
missing instances (to get their names for volume attachments) one by
one, thus significantly increasing response time.
This patch adds check if all_tenants in search_opts and add it to
the search else uses tenant_id in the search_opts.
Co-Authored-By: Dmitry Sutyagin <dsutyagin@mirantis.com>
Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info>
Change-Id: I4761d7da15036b69619649871aef91e1799ee385
Closes-Bug: #1508568
In the live migrate form, the selections "Automatically schedule
new host." and "No other hosts available" both use an empty value,
and this input is not required, that causes I can submit the
form even there are no other hosts available.
I think the value of selection "Automatically schedule new host."
should not be empty, and this input should be required.
Change-Id: I6a88ffa23087a0d845cf8a71a6359f3f4fbddbe0
Closes-Bug: #1684604
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
In order to increase rendering speed, make
api.nova.server_list, api.network.servers_update_addresses,
api.nova.flavor_list and api.glance.image_list_detailed
parallel. For admin panel also api.keystone.tenant_list
is parallelized.
Closes-bug: #1655307
Change-Id: I83150d3963f1233edc9efbcdac299520dedbed3c
Many of the Python table views are using identical (or nearly identical)
table templates. This patch adds a common template and makes it the
default for a DataTableView, which allows us to remove many similar
templates and redundant lines of code.
Change-Id: I1e4e15e695ee1f21f4d44f141a854e30f1e567a1
Closes-Bug: 1653986
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
Implementing ADMIN_FILTER_DATA_FIRST setting will allow operators to
require admin users provide a search criteria first before loading
data into the Admin views.
Starting with Instances and Images admin views since they already have
server side filtering options.
Implements blueprint: admin-views-filter-first
Change-Id: I846690854fd443bb98692674bf9fe6733dd04263
This change adds the option of using the nova scheduler
to place a vm during live migration
Change-Id: I136de833ab1b9e38c8077ad1b3ff156b761055d5
Closes-bug: #1586527
Once upon a time, the python-*client libraries were primarily built to
use httplib2. They have subsequently shift to using requests and thus
urllib3. The horizon test helpers code was maintaining a reference to
httplib2 as it intercepted errant library calls that were not mocked.
httplib2 is not actively maintained and OpenStack is moving to remove it
as a dependency. See
http://lists.openstack.org/pipermail/openstack-dev/2016-March/089225.html
for more details.
This patch removed the httplib2 dependency. Upon removing the
dependency it exposed a missed update from httplib2 to urllib3. A
function that was intended to catch unmocked calls was only listening
for httplib2 connections. This patch updates that failsafe to work with
urllib3. Upon doing so, it pointed out many, many missing mocks and in
turn, many broken tests that appeared to work because of API call
failures. This patch adds the missing mocks and fixes the broken tests.
The new failsafe prints the stack trace when an outside connection is
attempted. Additionally, to fix the fact that a missed mock used to
allow tests to potentially pass, as documented by bug 1517704, a test
failure is now forced on tests where a missing mock is detected.
Closes-Bug: #1517704
Implements blueprint: remove-httplib2-dep
Change-Id: Iaabdf03966c14c82e0c58a3b1ab1a6755c05adcb
If using neutron, the ajax will query the last status from
nova which could be out of date, so any floating ips
added wont show up unless you refresh the whole page.
Change-Id: Iad1684d1a2fb677ee8850a98c8219794698722e3
Closes-Bug: 1505935
From django V1.9 django.utils.datastructures.SortedDict
will be removed and it is deprecated in V1.7.
The similar functionality is added in collections.OrderedDict
from python 2.7.
Horizon code also should avoid the SortedDict class and
start using the OrderedDict class.
This patch replacing the SortedDict with OrderedDict.
Change-Id: I8dfcf7c29fc49b6215451f160cf7a951bf11b5ad
Closes-Bug: #1492270
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
A network operation can fail because of different
reasons - yet in many places just one error message
is provided. Combined with too broad exception clause,
and incorrect assumptions on the reasons of failure
(e.g. Neutron service being unavailable causes all
other sorts of errors like inability to Allocate IP
or Associate it) this leads to multiple errors when just one
would suffice. The fix aims to provide sensible error
messages in case the network service is down. This includes
returning only unique messages in a single response.
Partial-Bug: #1301374
Change-Id: Id6c620ca51f7703f35c0c172e39fdf237fa42278
Co-Authored-By: Timur Sufiev <tsufiev@mirantis.com>
The live migration selector needs to offer a list
of hosts, not a list of hypervisors.
Change-Id: I73c1175a5f87b0f91e36083f05467c26feca5d51
Closes-Bug: #1335999
This patch moves the flavor details in the instance listing into
a popover to reduce the amount of displayed details in the listing.
Change-Id: Ibd8cd228bae41e0f2870a8a14b6ce21338d61a8f
Closes-Bug: #1314177
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
project/instances, admin/instances and the instance details page
all get networking information from Nova. However, with Neutron
enabled, floating IP associations are done direcly with Neutron,
meaning that Nova's DB will fall out of sync and thus the GUI
won't reflect successful floating IP associations until Nova
polls Neutron again and updates its DB. The polling can take
up to several minutes to complete for consecutive floating IP
operations.
The solution is to update instances' networking information from
Neutron immediately after the call to list Nova instances.
Closes-Bug: #1265032
Change-Id: I0382fa9a4a9fff21e7b4d05cd3b76783f826735f
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
Currently Horizon only provides support for 'nova migrate', which
involves a reboot, and is also confusing for users who do not know there
are 2 ways of migrating an instance. We should provide another option in
order to support live migration, as enabled by `nova live-migration`.
Implements blueprint live-migration-support
Change-Id: Id83ba9e19461a7217f521a09bde3109428ecbf11
This patch replaces some method imports with module imports and
makes H302 test enabled.
Fixes bug 1188531
Change-Id: Ibfbddeaa19cbbb244da58ffd5c918c41f03a0c65