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
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
This introduces a new setting OPENSTACK_USE_SIMPLE_TENANT_USAGE
as a replace of SimpleTenantUsage in OPENSTACK_NOVA_EXTENSIONS_BLACKLIST.
We received feedbacks on the need to control whether SimpleTenantUsage
is used or not, so we need a new setting before retiring
OPENSTACK_NOVA_EXTENSIONS_BLACKLIST.
Change-Id: Ib786ea2ac232fcd851f4b276b9144c14c0b62a0a
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 pylint check 'no-else-return' might be debatable.
but as far as I checked it works in most cases.
Change-Id: Ie8574d4a529454c6e050fa62a7a17ea097d00240
This commit mainly covers settings in the remaining files
under openstack_dashboard.
Note that HORIZON_CONFIG, horizon and openstack_auth are not covered.
They will be covered by follow-up patches.
Part of blueprint ini-based-configuration
Change-Id: Ibd70e030445a073d9a62da9867850f4893135a89
openstack_dashboard/context_processors.py:94:15: C0122: Comparison should be link['url'] != 'horizon:project:api_access:openrcv2' (misplaced-comparison-constant)
openstack_dashboard/settings.py:467:4: C0412: Imports from package horizon are not grouped (ungrouped-imports)
openstack_dashboard/enabled/_1370_project_vg_snapshots.py:9:0: C0301: Line too long (86/80) (line-too-long)
openstack_dashboard/enabled/_1360_project_volume_groups.py:9:0: C0301: Line too long (85/80) (line-too-long)
openstack_dashboard/usage/base.py:62:8: W0106: Expression "[instance_list.extend(u.server_usages) for u in self.usage_list]" is assigned to nothing (expression-not-assigned)
openstack_dashboard/dashboards/project/images/utils.py:43:12: W0106: Expression "[public_images.append(image) for image in images]" is assigned to nothing (expression-not-assigned)
openstack_dashboard/dashboards/project/images/utils.py:75:12: W0106: Expression "[community_images.append(image) for image in images]" is assigned to nothing (expression-not-assigned)
openstack_dashboard/api/glance.py:47:4: C0412: Imports from package glanceclient are not grouped (ungrouped-imports)
openstack_dashboard/api/cinder.py:60:4: C0412: Imports from package cinderclient are not grouped (ungrouped-imports)
openstack_auth/user.py:358:4: E0211: Method has no argument (no-method-argument)
openstack_auth/user.py:362:4: E0211: Method has no argument (no-method-argument)
openstack_dashboard/api/keystone.py:75:4: C0412: Imports from package keystoneclient are not grouped (ungrouped-imports)
horizon/loaders.py:43:16: W0706: The except handler raises immediately (try-except-raise)
horizon/themes.py:174:8: W0706: The except handler raises immediately (try-except-raise)
Change-Id: I40cf3ffbc4519657e11180d2e2fe7401387c5556
Previously we have almost duplicated logic for the limit summary
and quota usages. This commit shares the logic.
blueprint make-quotas-great-again
Change-Id: Ie5d7e51c9424701fdbcbfbcb1032c0b833a69371
Previously limit information was always retrieved but it is not
used in the admin overview. This commit moves the limit related logic
into a separate class ProjectUsageView.
testing of usage.views is covered by individual panel tests,
so UTs for panels which uses UsageView rather than the new
ProjectUsageView need to be updated in this commit.
blueprint make-quotas-great-again
Change-Id: Id93b66d11e3b0c98d1fbb0454bb43984c2999d92
We no longer need to have SG and FIP API wrapper in api.network
as we only supports a single network back-end.
Completes blueprint drop-nova-network
Change-Id: I4e59d897508b497a3cd2ae2fda93b30b786610dc
When checking with nova for the absolute limits
we were not taking into account the reserved
quotas (i.e. instance in rebuilding will take
cpu and ram) so this could lead to wrongly
thinking that the user could launch more instances
that its quota allowed. It also made the overview
page display wrong quotas as it didnt took into
account those reserved resources.
Change-Id: If51470d185ddc122acbdf4cf0d0fd952f3f791a0
Closes-bug: 1561310
First, the default default date range used on Overview panel is made
configurable (setting OVERVIEW_DAYS_RANGE). Second, its default value
is set to 1 day. Changing the default behavior is aimed to improve
load time of the default page in the presence of large amounts of
data. If OVERVIEW_DAYS_RANGE setting is explicitly set to None, the
behavior remains the same - the default date range is from the
beginning of the current month until today.
Co-Authored-By: Dmitry Sutyagin <dsutyagin@mirantis.com>
Change-Id: I55a0397f69e33ba9c8fb1f27d57838efcd8648af
Closes-Bug: #1508571
Volumes tabs should be enabled when volumev2 endpoint is registered.
Currently, Horizon considers no volume service is running if there
is no V1 endpoint, which doesn't make sense as Horizon no longer
supports the cinder V1 protocol.
Co-Authored-By: itxaka <itxaka@redhat.com>
Change-Id: I35d821eedb75f73f9330ed11f921694104eed0c6
Closes-Bug: 1415712
"Delete" is being used almost everywhere in OpenStack Dashboard
except the instance panel. Using "Delete" looks more consistent.
In addition, "Delete" tells non-native English speakers that
deleted instances will be no longer usable again compared to
"Terminate".
DocImpact
Closes-Bug: #1502773
Change-Id: Idccaf3c45566f20f11d02ada64c1d3934a6f3002
This patch adds the usage start and end dates to the user's session
so they are saved while navigating between pages.
Closes-Bug: #1373651
Change-Id: I3046b5533eb96f85fb2f90e63b3ff84360ad14c4
Raising a NotImplementedError in a method of a base class
makes it impossible to use super() with it and do multiple
inheritance properly. Those methods should instead simply
return some default "empty" value, so that the methods in
the subclasses can still call them, if that's where they
fall in the MRO.
Change-Id: I581391e87dc58f0f76adea3dbf90cef173d3daef
Closes-bug: 1278825
If the config option 'enable_router' is set to False,
Floating IP features are disabled when Neutron is enabled.
It does not affect when Neutron is disabled.
It also adds unit tests for api.network.servers_update_addresses
which is affected by this change.
Completes blueprint hide-router-panel-by-config
Closes-Bug: #1292022
Change-Id: Ib63c6a0e7bb5661d4a60d10a1722fdad978b50bb
Warnings H904, H307 and H405 are new or considerably changed, and will
be fixed in a separate patch.
Closes-bug: #1349820
Partial-bug: #1347472
Change-Id: I4fd28990dacf16f03a4eaa6074ef59c37f1a2c14
Previously some Neutron API calls in get_neutron_limits are outside
try/except and if an error occurs a traceback will be displayed.
Change-Id: I191aecbf3135ddac3b20dbc7e0f22b63aa3837f9
Closes-Bug: #1252878
On the overview page, the usage data showed by default was not filtered by
the dates shown on the date selectors. This can lead the user to wrong
conclusions about resource usage.
This patch corrects the default filtering dates to match the dates showed
by default on overview (first day in the month to current date).
Change-Id: I37a240d784ca0826821c125f06922d2c1d1e8659
Closes-Bug: #1294668
Moving general CSV generation code from usage into utils so that it can be
used by other dashboards.
The file is named csvbase to avoid name collisions with csv module.
Change-Id: I3f4a573b53cb2d85fa36e84320707d74917498ad
Closes-bug: #1280475
to keep Python 3.x compatibility, use six.StringIO/BytesIO to
replace StringIO.StringIO
StringIO works for unicode
BytesIO works for bytes
Change-Id: I1d4db56dd082916879b851f2d9ac71d17c0db94f
Closes-Bug: #1280100
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
Commit d4b0ab4aa3 fixing
bug #1178694 removed volume quotas from project overview.
Cinder is not reporting Snapshot limits today, so that info
can't be added without including quotas again, defeating the
purpose of the original fix.
This fix will only add Volume Qty & Total Storage GB used (including
snapshot size, if any ).
Information is hidden if volume list is empty.
Partial-Bug: #1244875
Change-Id: Ia72e40329ecf08b57fb26cd847f02cececc53579
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>
Now all files are properly licensed per OpenStack Hacking.
Change-Id: I223d983018568357197b0d9cf5dde12c135c53c9
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
When the SimpleTenantUsage Nova extension is not enabled,
panels that include usages produce an error and
the usage table is useless.
Three panels use the SimpleTenantUsage extension:
- openstack_dashboard.dashboards.admin.overview
- openstack_dashboard.dashboards.admin.projects
- openstack_dashboard.dashboards.project.overview
This fix avoids errors and does not show the usage
table in such a case.
A context variable 'simple_tenant_usage_enabled' is now
available in templates rendered by usage.UsageView subclasses.
Unit tests now mock nova 'extension_supported' API.
Change-Id: Ib306846bf6c947572ba0e7c773125d03b3dbf68b
Closes-Bug: #1211470
Secuirty group quota information in Project overview charts,
Admin defaults panel, and Admin create/update project is
retrieved from Neutron secuirty group is enabled.
Neutron security group is enbled when Neutron is used Neutron
security group extension is supported by a backend plugin.
Also removes the logic to remove quotas of floating IP and fixed IP
when neutron is enabled in dashboards/admin/defaults/tabs.py.
quotas.get_default_quota_data() already handles it properly
and this logic is no longer required.
Closes-Bug: #1212600
Change-Id: I59f069931fad519ca4ec135b92df0040ec8fc230
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
Also ensure that the correct quota is displayed in the Floating IPs
allocation page (Security & Access panel).
Closes-Bug: #1109140
Change-Id: I30d207fbf149bfbcfefeaddf91af49082b7b1f53
Display the correct limits and usage when Neutron is in use and the
quotas extension is enabled. If Neutron is enabled but the quotas
extensions is not supported, assume the floating IPs quota is
unlimited (a floating IP quota is expected to exist in other places,
e.g. Security and Access panel)
Because quotas may not be configured or enabled even if the extension
is available, add an 'enable_quotas' setting.
Partial-Bug: #1109140
Change-Id: Id6345f4700f0ff45be8ce8acb69cca0d4e05e14a
This patch replaces some method imports with module imports and
makes H302 test enabled.
Fixes bug 1188531
Change-Id: Ibfbddeaa19cbbb244da58ffd5c918c41f03a0c65
Fixes all occurrences of this. We have a custom exception handler
in Horizon anyway that only catches ClientException in most of these
cases, but this commit lets us gate on the other cases.
Change-Id: Iea3dc13817f3e5b775b2024424bf3a906da5584b
Closes-Bug: #1211657
Allows the user to pick a range of time
to query services usage data.
Fallback mode: the user will have to input
dates by hand if JavaScript is disabled.
Change-Id: I4cf4d4fd56fd450743b9d624dc066d6ed74df881
Fixes: bug #1102448
Added a csv writer using the 'csv' library to format
properly exported data - escaping, encoding etc.
Added a HttpResponse-based class to handle csv generation
Added translation for the CSV columns and template.
Fix bug #1158383
Renamed few occurencies of 'tenant' to 'project'.
Also added a new 'project' in nova_data.py, which required
some refactoring of few tests, that didn't consider the current project
for project-based calls.
Note: I've added a StreamingHttpResponse example,
which is introduced in Django 1.5+ and being advised in the ticket.
However, my opinion is that at the moment we don't need this - it is
too complicated for the current usage.
Change-Id: I18bd70a23b7b8389c7c0f96dbf8794fea5e1e75b
This patch also re-organizes imports to import one per line.
Change-Id: Ia958e3a30a48d4308d08d51df243c1272425c316
Fixes: bug 1188529
Fixes: bug 1188537
Added a csv writer using the 'csv' library to format
properly exported data - escaping, encoding etc.
Added a HttpResponse-based class to handle csv generation
Added translation for the CSV columns and template.
Improved consistency for exported data - now passing project name
instead of project id for csv export. Also added both project name/id
in the header of a project usage export.
Fix bug #1158383
Renamed few occurencies of 'tenant' to project.
Also added a new 'project' in nova_data.py, which required
some refactoring of few tests, that didn't consider the current project
for project-based calls.
Note: I've added a StreamingHttpResponse example,
which is introduced in Django 1.5+ and being advised in the ticket.
However, my opinion is that at the moment we don't need this - it is
too complicated for the current usage.
Change-Id: Ic00626b273921fa5c6c89704b3a9e08b252aaeb0
We should use ugettext_lazy to let users in different languages
get correct translation.Though in views or similar places
we can use ugettext with no problems, we should make code
style consistent.
This also fix the issues that the django proxy objects appear on the
launching instance page instead of translated strings. Now the
translated quota strings are handled correctly.
Fixes: bug #1178722
Change-Id: I76f0d31e6546d70e5ece7e86a06f7eefd04861d2
In the current code both api.<method> and api.<category>.<method> are used.
Using api.<method> directly makes it difficult to identify which module
defined a method and forces developers to use unique method names among
projects. This commit removes api.<method> style method calls.
Change-Id: Iaefa1061f99b7865e02541df87c112a6b2868ec0
Now that there are multiple projects with quota data (cinder, quantum)
we need to accommodate that data being aggregated in a centralized
fashion. This commit takes care of that for nova + cinder, and paves
the way for quantum later.
Fixes bug 1070022.
Change-Id: Ifc68c2dc681b2a7b4e7787e0b1a7dca1a970fc36
Moves everything OpenStack-specific (dashboards, apis, etc.)
into the openstack_dashboard project, achieving a much
cleaner separation between the project-specific code and
the generic Horizon framework code.
Change-Id: I7235b41d449b26c980668fc3eb4360b24508717b