Commit Graph

45 Commits

Author SHA1 Message Date
Akihiro Motoki f3af02f20f openstack_dashboard: Move test files to match module structure
This commit relocates test codes in openstack_dashboard
according to blueprint relocation-test-codes.

Change-Id: I397a5a47fe9c1bf3a498c22056d924bf409c514b
2017-12-09 21:38:06 +09:00
Akihiro Motoki 9854147407 Fix broken nova console support
A patch of MKS console support replaces 'console' key into
'remote_console', but 'remote_console' key is only available
in Nova API version 2.6 or later. Horizon uses Nova API version
2.1 by default, so this change breaks the existing server console
support completely. This patch fixes it.

Change-Id: I656037511e0d80688df4b82fa8c77fe5c09402bd
Closes-Bug: #1735436
2017-12-01 00:07:31 +09:00
yong sheng gong 1f41f29f0b Add MKS console support
Co-Authored-By: jinke <jin.ke@99cloud.net>
Co-Authored-By: yong sheng gong <gong.yongsheng@99cloud.net>

Change-Id: Id8ee4a28a09eb3d7f7598c507c0a4320a97cd01c
implements: bp support-mks-console-type
2017-11-29 21:06:38 -05:00
Ivan Kolodyazhny 3a99499ba0 Get all needed instances for volumes attachments at Admin->Volumes
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
2017-07-13 20:35:21 +03:00
Ying Zuo ddfa667d02 Add instance locked status on instances table
Added a column to show the locked status on project/admin instances table.

There will be a locked or unlocked icon with help tooltip if nova 2.9 or
above is used. See openstack_dashboard/api/microversions.py

Added the locked field on project/admin instance details panel.

Change-Id: If31ae281d2782c71cd6112f3bd6228647a6130e4
Closes-bug: #1593903
2017-06-14 20:00:56 -07:00
chenaidong1 c2dc8fbe1c Use assertIsNone(...) instead of assertEqual(None, ...).
Ref£º   http://docs.openstack.org/developer/hacking/#real-world-import-order-examples

[H203] Use assertIs(Not)None to check for None (off by default) Unit test assertions
tend to give better messages for more specific assertions. As a result,
assertIsNone(...) is preferred over assertEqual(None, ...) and assertIs(None, ...),
and assertIsNotNone(...) is preferred over assertNotEqual(None, ...)
and assertIsNot(None, ...).

Change-Id: I84b3304cae4284bdbad7d093cb6fa1d3d303ee52
2017-05-04 10:25:47 +08:00
Ying Zuo a35cf2da28 Only show image name as a link when the image exists
Updated the nova api to return None when the image name
is not available, for example, when it's deleted.

Added a check for the image name before showing it as
a link.

Change-Id: I342b23dfd8352182f50c41054d2dbb3eae854839
Closes-bug:1668783
2017-03-28 15:42:07 -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
Béla Vancsics ff733ceced Use more specific asserts in tests
Instead of assertTrue and assertFalse use more specific asserts.
They are compatible with Python 2.7[1] and 3.4[2]

[1]: https://docs.python.org/2.7/library/unittest.html
[2]: https://docs.python.org/3.4/library/unittest.html

Change-Id: I9b07cc324757f35b1e8431b715412bf5d7fa8ecb
2017-02-15 11:19:43 +01:00
Radomir Dopieralski 20db9d94bf Try to use 2.40 microversion for simple-tenant-usages
Always try to request and use version 2.40 of the nova api for that
particular call, so that we can use pagination.

Change-Id: I5890776bb273f6dd20807dc0d315f4c67785fcc4
2017-01-24 13:05:17 +01:00
Radomir Dopieralski 107bd083ef Simple tenant usage pagination
Stitches back together all the pages for the os-simple-tenant-usage
call, so that the usage statistics are complete.

Implements blueprint paginate-simple-tenant-usage
Depends-on: If99db6933de012b71cf2c982075f08b3e664361e

Change-Id: I8c1206807f707ef47dd92e3cb663970804e3ec8e
2017-01-24 11:01:31 +01:00
Cady_Chen 51fe944449 Replace six.iteritems(iter) with iter.items()
As mentioned in [1], we should avoid using six.iteritems(iter) to
achieve iterators. We can use iter.items() instead, as it will
return iterators in PY3 as well.

[1] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html

Change-Id: Ieadd5fa69b3f6058c0641a5b96ef3e8e1e3f6cc2
2016-12-14 11:13:20 +08:00
Luong Anh Tuan ac404c4bcf Fix order of arguments in assertEqual
Some tests used incorrect order assertEqual(observed, expected).

The correct order expected by testtools is
assertEqual(expected, observed).

Change-Id: I83b7009f9b32f4abc88c23cafbe293b65dc25fb4
Partial-Bug: #1259292
2016-08-16 12:02:45 +07:00
Yves-Gwenael Bourhis 56fce18378 Stop memoizing on request arguments in nova api
The request parameter is a django.http.HttpRequest instance object
which contains metadata about the request. This object is a new instance of
django.http.HttpRequest in every view, so memoizing with it memoizes during the
rendering of a single view only, thus preventing multiple api calls only
during the rendering of one view.

Some nova api memoized methods should memoize more persistantly with objects
which do not change after the rendering of each view, like the list of
extensions suported.

However, it is still a good idea to limit memoization of some api calls during
the rendering of a single view, if the query is subject to give different
results (i.e., the flavor_list can change when an administrator adds a flavor
so we need to retreive new data for each view in case a flavor gets added by a
cloud admin).

Implements blueprint: improve-horizon-caching
Co-Authored-By: Daniel Castellanos <luis.daniel.castellanos@intel.com>
Change-Id: I9f87df72cbf149e7b2d1763d7976cb845b1e98f9
2016-06-10 13:22:14 -05:00
Brad Pokorny bc2826efd9 Choose a server group when booting a VM
Allow users to choose a server group when booting a VM.  Adds
a dropdown list to select a server group to the Launch Instance
workflow.

Change-Id: I0b0d5ec79841da3da569bd22c533fdbf76002c96
Partially-Implements: blueprint nova-server-groups
2016-05-03 15:56:23 -07:00
Luis Daniel Castellanos 46d3457bd9 No unit test coverage for code related to Flavors
When runing the "./run_tests.sh -c" command,
and after looking at the reports, not all the code is covered
by the unit tests.
The code related to Flavors in the openstack_dashboard/api/nova.py
(get flavor list, create flavor, delete flavor, etc) is not covered.

Change-Id: Idf32b22cde2925b830d85ba9c675fa0e88a2eb0e
Closes-Bug:#1558758
2016-03-23 20:24:27 +00:00
Jenkins d4c4efbcce Merge "Tolerate unconfigured glance service when loading image name" 2016-01-22 03:49:49 +00:00
Justin Pomeroy 79971c627b Add action for editing instance metadata
This adds the Update Metadata action to the instances table to allow
managing the metadata on an instance. This is very similar to the
Update Metadata actions for images, flavors, etc.

Implements: blueprint edit-server-metadata
Change-Id: Ia09a05f5cd93898ec9d64ac7af1e6baf07e71757
2016-01-04 08:46:28 -06:00
Justin Pomeroy 427c2c8018 Tolerate unconfigured glance service when loading image name
When loading the instances page, the glance service is used as a
fallback to obtain the image name for each instance. This patch adds
tolerance for an unconfigured glance service endpoint for the current
region so that the page will still load.

Change-Id: Ia512269ae4b069db85a1f13530856b9c7beafee3
Closes-Bug: #1361298
2015-09-03 11:49:46 -05:00
Victor Stinner 674a45ffe0 Replace mox with mox3
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
2015-07-13 15:02:10 +02:00
Radomir Dopieralski 8697a93d18 Use novaclient v2 instead v1_1
Because v1_1 is deprecated.

Closes-bug: #1435201
Change-Id: I12a8c961d90bc79cc44b7c7f4e1a4bdbfa55f6a2
2015-03-23 09:45:42 +01:00
Bartosz Fic 2a7860b416 Migrate all instances from host marked for maintenance
This patch adds migrate capability to Horizon for host
already marked for maintenance.

All instances could be cold migrated.
There is an option also for running instance to allow
making live migration to them.
All running instances will be migrated as the same
migrating configuration, if the administrator wants to
migrate a specific instance in a specific configuration he
could do it from the instance dashboard.

blueprint migrate-all-instances-from-hosts-in-maintenance-mode

Change-Id: Ia1260831e79ede66a9d4320b092bebeb023796bc
Co-Authored-By: Bartosz Fic <bartosz.fic@intel.com>
2015-02-20 22:27:09 +01:00
Akihiro Motoki 26da6ed48c Fix E127 errors in remaining openstack_dashboard/
E127 continuation line over-indented for visual indent

Also fixes E127 introduces by other reviews
after other E127 fixes were merged.

Closes-Bug: #1375931
Change-Id: I0a09f1c2f74c707fc8a347f0ea5975bf2679976e
2014-10-15 13:50:07 +09:00
Akihiro Motoki d49ad74e28 Workaround for negative vals in total*Used in nova absolute_limits
Due to bug 1370867 there is a case where negative values are returned
in total*Used in absolute_limits. If it occurs, Horizon Overview page
cannot be displayed due to an error "cannot convert float infinity to
integer". This commit replaces negative values in total*Used with 0
for a workarond.

Change-Id: I606803bdff1d335cc9f92d67619ff82f356a5143
Closes-Bug: #1370869
2014-09-18 15:52:35 +09:00
ChenZheng c7d5371b47 Fix order of arguments in assertEqual
Some tests used incorrect order assertEqual(observed, expected).

The correct order expected by testtools is
assertEqual(expected, observed).

Change-Id: Iabf6e55146412b57b6a6544f312f9510f762566a
Partial-Bug: #1259292
2014-09-01 10:41:52 +08:00
Christian Berendt 6458dccb6f replace dict.iteritems() with six.iteritems(dict)
According to https://wiki.openstack.org/wiki/Python3 dict.iteritems()
should be replaced with six.iteritems(dict).

Change-Id: Ia2dcabbd071e1fcdf111ba83573785989a77aef0
2014-05-26 12:06:58 +02:00
He Yongli e790ac070e Remove extraneous vim configuration comments
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
2014-05-06 15:30:10 +08:00
Alessandro Pilotti ccfbdedb11 Adds support for Nova RDP console
Hyper-V employs RDP to access virtual machine consoles, unlike most
other hypervisors which support VNC.

In order to support this scenario, the get_rdp_console API has been
added to Nova. This commit adds the corresponding UI feature,
implemented in a way consistent with existing VNC and SPICE console
support.

Change-Id: I9722a1aef5d26184f5a6bc278e306acbdae76b7b
Blueprint: hyper-v-rdp-console
2014-03-01 01:21:47 +02:00
Tatiana Mazur 193f624e1b Remove leftovers of "# noqa"
This patch set removes leftovers of "# noqa" from imports
added to import_exceptions.

It also adds "django.test.utils.override_settings" to
import_exceptions, so a few more "# noqa" tags become
unnecessary.

Closes-Bug: #1273647

Change-Id: I39f856ac3ea371a2fcab272bbf358d0243164b6d
2014-01-28 15:51:04 +04: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
Dirk Mueller 872f44c167 assertEquals is deprecated, use assertEqual
Change-Id: Id3ebdf4862b02f2965199701a4994846bcecbb18
2013-09-16 22:55:16 +02:00
Tatiana Mazur 953d1b9793 Enable H302 check
This patch replaces some method imports with module imports and
makes H302 test enabled.

Fixes bug 1188531

Change-Id: Ibfbddeaa19cbbb244da58ffd5c918c41f03a0c65
2013-08-22 17:39:09 +04:00
Julie Pichon 96cd1c00ae Clean-up code issues related to reboot
- Don't import nova client directly in a panel, client details should
   only live in openstack_dashboard/api
 - "allowed()" now checks if instances is None, which can happen with
   BatchActions
 - Remove unused reboot() method from Server
 - Fix import order for 'logging' module

Fixes: bug #1213853

Change-Id: I56f810c6d451d68cb8326a0fa4f89462f74e9bf7
2013-08-19 18:35:35 +01:00
Tihomir Trifonov 0c0153a037 Improvements in csv export for usage data
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
2013-06-21 14:00:37 +03:00
Matthias Runge cea720e793 Sort imports alphabetically
This patch also re-organizes imports to import one per line.

Change-Id: Ia958e3a30a48d4308d08d51df243c1272425c316
Fixes: bug 1188529
Fixes: bug 1188537
2013-06-14 12:05:55 +02:00
Kieran Spear ef26414b8d Revert "Improvements in csv export for usage data"
This reverts commit a4e583cffb

Fixes bug 1183441, bug 1183230, bug 1183310.
2013-05-23 16:50:57 +00:00
Tihomir Trifonov a4e583cffb Improvements in csv export for usage data
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
2013-05-22 11:09:49 +03:00
David Lyle 81247fda00 Adding pagination to the instance views
Modifying the api.nova.server_list() method to optionally handle
pagination.  The method will also work without pagination to
support the many other place than the instance views that continue
to call the method.

Fixes: bug #1046915

Change-Id: I8195f1f2d8922e1722743d7a2d627a8645e8b3bd
2013-04-11 21:24:01 -06:00
Julie Pichon 0d331a6134 Add support for both soft and hard reboot options
Fixes bug #1088859. Thanks to Yufang Zhang for the initial patch.

Change-Id: Ic91feb6859586c2df1b6758f72f3981039914095
2013-02-19 13:06:33 +00:00
Akihiro MOTOKI dbfcc97e89 Quantum Floating IP support
blueprint quantum-floating-ip

This commit allows OpenStack dashboard users to use Quantum floating
IP feature directly using Quantum API rather than Nova Proxy.
By this users can associates a floating IP per virtual NIC.

blueprint nova-net-quantum-abstraction

This commit defines an abstract class in api/network.py.
This class provides common interfaces related to network features
duplicated in Nova and Quantum. A concrete class to handle operations
should be defined in api/nova.py or api/quantum.py.

Change-Id: I780356a9f41e72e32ce1877d390ac7f99e96899c
2013-01-30 20:38:35 +09:00
Daniel P. Berrange 59b7e6011b Add support for SPICE consoles
While in theory both VNC and SPICE can be enabled at the same
time, this is not expected to be common. Thus, rather than
adding a 'SPICE console' tab, this renames the existing
'VNC console' tab to simply be 'Console'. This tab is setup
to prefer exposing a VNC console, but if that is not enabled,
then expose the SPICE console. The reason for this order is
that the noVNC widget has had much more testing than the
current spice-html5 widget. Thus if both VNC & SPICE are
enabled, VNC is likely a more reliable choice at this point
in time.

Blueprint: libvirt-spice
Change-Id: If3d3769fe8e29c5930ac8b42d841c92182c4be72
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-24 10:14:55 +00:00
Akihiro MOTOKI 12faaa5c30 Ensure to use api.<category>.<method>
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
2013-01-22 20:37:12 +09:00
Julie Pichon 6f3a9804eb Absolute limits of -1 should be treated as unlimited
-1 were interpreted literally, causing quota-related calculations to
show as overquota instead of unlimited

Fixes bug #1098480

Change-Id: I52377c690c5169f63624959711fce7566d59f9af
2013-01-16 16:38:09 +00:00
Gabriel Hurley cdcd8e3df6 Enable quota data from multiple sources.
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
2012-10-24 12:53:42 -07:00
Gabriel Hurley cb8e7c1f8f Splits OpenStack Dashboard bits from framework app code.
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
2012-10-11 11:47:50 -07:00