286 Commits

Author SHA1 Message Date
Jenkins
39ae4c2870 Merge "hypervisor command can't use cell format id to show hypervisor" 2015-07-27 11:03:59 +00:00
Andrey Kurilin
936cf572df Implements 'microversions' api type - Part 2
New decorator "novaclient.api_versions.wraps" replaces original method with
substitution. This substitution searches for methods which desire specified
api version.

Also, this patch updates novaclient shell to discover versioned methods and
arguments.

Related to bp api-microversion-support
Co-Authored-By: Alex Xu <hejie.xu@intel.com>
Change-Id: I1939c19664e58e2def684380d64c465dc1cfc132
2015-07-25 15:57:17 +08:00
Jenkins
169b8a08ce Merge "Improve hypervisor-show print list" 2015-07-24 22:38:18 +00:00
James Penick
3bf6f8fe99 rename root-password to set-password
all references to `root password` have been changed to `admin password`
but the `root-password` command remained. This changes it to
`set-password` which is less ambiguous and consistent with existing
commands `clear-password` and `get-password`

Change-Id: I8683e4ecd4d9294989eb3d8d27d1fb75c16b261b
2015-07-22 19:32:55 +00:00
Chung Chih, Hung
c3a0c035dc hypervisor command can't use cell format id to show hypervisor
This bug was occurred in cell mode.

In cell mode, compute node's id was not identified by integer type. It
was formatted with "path!to!cell@ID".
Therefore we can't using the id of hypervisor-list output.

For example,
> nova hypervisor-list
+----------------+--------------------------+-------+---------+
| ID | Hypervisor hostname | State | Status |
+----------------+--------------------------+-------+---------+
| region!child@1 | vagrant-ubuntu-trusty-64 | up | enabled |
+----------------+--------------------------+-------+---------+

Change-Id: Iba0cc1993f67351b11d034f372d7a5b98dc017f0
Closes-Bug: 1475973
2015-07-20 04:55:32 +00:00
Andrey Kurilin
ea0b3bd608 Implements 'microversions' api type - Part 1
Compute API version will be transmitted to API side via
X-OpenStack-Nova-API-Version header, if minor part of version is presented.

New module "novaclient.api_versions" was added as storage for all api versions
related functions, classes, variables and etc.

`novaclient.api_versions.APIVersion` class is similar to
`nova.api.openstack.api_version_request.APIVersionRequest`. The main
difference relates to compare methods(method `cmp` is missed from Py3) and
processing "latest" version.

Related to bp api-microversion-support

Change-Id: I0e6574ddaec11fdd053a49adb6b9de9056d0fbac
2015-07-16 16:06:28 +03:00
OpenStack Proposal Bot
d64e288de7 Updated from global requirements
Issue found with mock 1.1.3:

Because of the test inheritance test_keypair_import is getting called
3 times. It appears that the mock for open builtins is getting torn
down after it's first use, and not correctly built again on subsequent calls.

In the gate, this is a race, because we have 3 tests and 8 workers,
and this will only fail if 2 or more of the tests happen to be
allocated to the same worker. This can be reproduced locally with:

  tox -e py27 -- --concurrency=1

Converting this to the context manager usage of mock appears to
resolve the issue.

Co-Authored-By: Sean Dague <sean@dague.net>

Related-Bug: https://github.com/testing-cabal/mock/issues/280

Change-Id: I9a87375d2eb6c7cf7b9124b2095a5a4bcc8e7bf3
2015-07-14 18:52:14 +03:00
rsritesh
a061470a8e Improve hypervisor-show print list
Current hypervisor-show <hostname> command does not properly list
when there is a long list of cpu info feature. The long list of
cpu info feature has comma-separated values.
Because of this user is not able to read the print out properly.

print_dict() has been changed to show a list with comma-separated
values properly.

Change-Id: Icc53439cecd3b5eee2340267a0447ce209d7b653
Closes-Bug: #1466435
2015-07-10 16:13:24 +02:00
Jenkins
002e23d958 Merge "Fix resolving image.id in servers.boot" 2015-06-29 17:44:52 +00:00
Andrey Pavlov
0a8fffffba Fix resolving image.id in servers.boot
Most places resolve id of input parameter as 'base.getid'
and in the beginning of _boot function it resolves image id
with such method. But in fixed place it tries to get id directly
from object. But code that uses novaclient directly(without shell)
falls in this place because it passes string with id to image parameter.

Change-Id: Ib90e4ffa3b7835f6648a62eddf7f7b87b5ab0f7e
2015-06-26 23:27:34 +03:00
Jenkins
7570a8ab46 Merge "Added marker functionality to flavours and images" 2015-06-26 19:45:16 +00:00
Pete Savage
bde241b947 Added marker functionality to flavours and images
Markers to support pagination was missing from flavours
and from images.

Change-Id: I27de83f18a4850b63020ac60e010839a13e916fb
2015-06-26 11:05:10 +01:00
Davanum Srinivas
a5f30d173f cleanup openstack-common.conf and sync updated files
Changes include:
e782594 Add last_request_id only if it is not none
18bf5ca Fix usage of NotFound exception in apiclient.base
3bc8231 deprecate apiclient package

Depends-On: Ia83ef6136da1c551ea947679dc546a0d7ad2f876
Change-Id: I0b5917c657d6adc3d34229b14833a5224c168e07
2015-06-16 20:32:08 -04:00
Artom Lifshitz
3026ea9296 Revert "Allow admin user to get all tenant's floating IPs"
This reverts commit 02328d33373479b33f4fee8112d47c1ae29e8bd4.

As per the comments on the support all-tenants in floatingips-list
spec [1], this patch reverts the --all-tenants flag from
python-novaclient since support has been reverted out of Nova more
than a year ago.

[1] https://review.openstack.org/#/c/171389/

Change-Id: I2d6566ecf59d307e3ea117b3b20dc918c758b63e
2015-06-15 15:25:37 -04:00
Jenkins
7d12815605 Merge "Pass full path to pkgutil.iter_modules()" 2015-06-14 05:50:03 +00:00
Jenkins
e492327431 Merge "Cache a new token when the existing token expires" 2015-06-11 22:35:30 +00:00
Matt Thompson
84aec86319 Pass full path to pkgutil.iter_modules()
On my production system, when using client version 3, an exception is
raised with an incomplete message as the installed novaclient is
failing to find the bundled client versions.  This commit creates a new
_get_available_client_versions() method and moves the client version
searching from get_client_class() into it.

We also update __get_available_client_versions() to pass
pkgutil.iter_modules the full path to novaclient rather than
'novaclient', which is what actually resolves the issue here.

Lastly, we add a single test to ensure that
__get_available_client_versions() does not return an empty list.

Change-Id: I07ce414863e833c72e50ad8cf1824054cfb41457
Closes-Bug: #1463809
2015-06-11 09:42:02 +01:00
Jimmy McCrory
784a8b4a91 Cache a new token when the existing token expires
The client.keyring_saver attribute was not being reliably set so the
client._save_keys function was not storing any new tokens in the
keyring.

Add a unit test to ensure keyring_saver is being property set.

Closes-Bug: #1397732
Change-Id: If0df24c819d71b4df302309d049079a867a11c76
2015-06-10 23:54:28 -07:00
Masaki Matsushita
953a12e986 Adds support to set admin password from the cli
You can set admin password as
nova boot --image <image> --flavor <flavor> --admin-pass <pass> vm-name

Change-Id: I119aba428c15d736e64d990be47cc5c13bb83738
Closes-Bug: #1248517
2015-06-09 13:27:19 +09:00
Matt Riedemann
acf6d1fe65 Remove unused novaclient.tests.unit.v2.utils module
This is an old carry over from pre-testtools days and has a nose import.
Nothing is using it so remove it.

Closes-Bug: #1458272

Change-Id: I01b5d35d2e2aec161bd3dbaecb4670ddf3ee8794
2015-06-02 14:14:11 -07:00
Matt Riedemann
23f13437dd Deprecate volume/volume-type/volume-snapshot CRUD CLIs/APIs
This deprecates all of the volume CLIs/APIs that go directly to the
cinder API via the volume service type.

This will emit a warning each time a deprecated CLI/API is used and also
updates the help docs for the deprecated CLIs and docstrings for APIs.

The plan is to do a release once this is merged so people start seeing
it and then we'll actually remove the deprecated CLIs/APIs in the first
python-novaclient release after the Nova server 2016.1 'M' release.

DocImpact: The volume, volume-type and volume-snapshot CRUD CLIs/APIs are
           deprecated and will be removed after the Nova 2016.1 release.
           Use python-cinderclient or openstackclient for CLIs instead.
           Use python-cinderclient or python-openstacksdk for APIs instead.

Related-Bug: #1454369

Change-Id: I4e92f924739de9b664e08117984bfb60359f2212
2015-06-02 14:14:06 -07:00
Jenkins
2fad863909 Merge "server-group-list support 'all_projects' parameter" 2015-05-30 00:43:24 +00:00
Doug Hellmann
e649cea843 Do not check requirements when loading entry points
Update the calls to pkg_resources to avoid forcing a requirements check
when the plugins are being loaded.

There are 2 versions of the entry point API in different releases of
setuptools. In one version, the require keyword argument can be passed
to load(). In the other, separate methods resolve() and require() need
to be used. This change updates the mock and fake objects to support
either, since the fakes are subclasses of the EntryPoint class in
pkg_resources.

It would be better to replace the calls to pkg_resources with stevedore,
which provides a more stable API, abstracts away this difference, and
provides an API for creating test managers directly. That change would
have required more extensive updates to the test suite, though, and
since I'm not as familiar with this code base as others will be, I will
leave those changes for someone else.

Change-Id: I2a9aeb53ccad04c7fa687f25340306b84218f9ff
Partial-bug: #1457100
2015-05-27 18:08:02 +00:00
Kevin L. Mitchell
0a327ce375 Eliminate test comprehensions
The novaclient tests are rife with examples of using a list comprehension
to perform a series of asserts, when a simple for loop would be more
appropriate and more idiomatic; part of the problem is the propensity
for people to cut and paste.  Eliminating the existing examples should
remove the temptation for developers to use this non-idiom to perform
tests.

Change-Id: I2cc8979e720740eae81692a60e30a3d95dce2a2c
2015-05-21 19:12:35 -05:00
Rui Chen
9cfecf922a server-group-list support 'all_projects' parameter
Supporting 'all_projects' in server-group-list so that
admin users can list other tenant's server groups.

Change-Id: Ie50288464ebc6585590a1a74efa8804584771ebc
Closes-Bug: #1454523
2015-05-13 16:32:42 +08:00
Jenkins
fbcfaca847 Merge "nova client now support limits subcommand" 2015-05-06 22:52:14 +00:00
Jenkins
8f2e1b57ed Merge "Make _discover_extensions public" 2015-05-06 18:34:13 +00:00
kylin7-sg
02c04c5658 Make _discover_extensions public
Heat uses `novaclient.shell.OpenStackComputeShell._discover_extensions`
function, which is private currently. It's better to change this method
to public for public use.

Change-Id: I15879d56db2ec88a9bef99b6af8924ebd4ad169b
Closes-bug: #1440779
2015-05-06 14:10:59 +08:00
rajiv.kumar
bf6fbdb8d7 nova client now support limits subcommand
Added new subcommand "limits" which displays absolute limits and
rate limits both. do_limits() functions calls get() only once and
then passes limits.rate and limits.absolute to _print_rate_limits
and _print_absolute_limits respectively; these functions then
format the output.

Change-Id: I1344da1a3925a3f3a757e340f11381b69a668bf7
Closes-Bug: #1172254
2015-05-04 04:59:05 +00:00
Ken'ichi Ohmichi
95421a3702 Don't use SessionClient for version-list API
The endpoint of version API doesn't contain "/v2/{project-id}" and it is
just "/". SessionClient is based on the endpoint "/v2/{project-id}/...",
so this patch makes a client use a raw url for version-list API.

Change-Id: I53f2afacce2dda14ac9761e824b48887f7c192f9
Closes-Bug: #1444235
2015-05-03 21:27:24 +00:00
Jenkins
2a7c2f14c2 Merge "Don't lookup service url when bypass_url is given" 2015-04-27 17:12:51 +00:00
Jenkins
95a743f164 Merge "Deprecate v1.1 and remove v3" 2015-04-27 13:23:13 +00:00
Jenkins
7a2075756e Merge "Add --all-tenants option to 'nova delete'" 2015-04-23 11:42:34 +00:00
Jenkins
3251bc430f Merge "Handle binary userdata files such as gzip" 2015-04-23 11:41:01 +00:00
Jenkins
d0263a76a3 Merge "Fix displaying of an unavailable flavor of a showing instance" 2015-04-23 03:20:00 +00:00
Jenkins
fdef4cea12 Merge "Report better error message --ephemeral poor usage" 2015-04-23 03:11:44 +00:00
Jenkins
9b6dcd13e5 Merge "Revert "nova flavor-show command is inconsistent"" 2015-04-22 21:29:08 +00:00
Andrey Kurilin
61ef35fe79 Deprecate v1.1 and remove v3
Module novaclient.v1_1 is already deprecated, so it's time to stop using it
inside novaclient.

Since support of v3 nova is undocumented feature, which uses v2
implementation, we can remove code related to it.

Also, this patch removes redundant check for compute api version != 1.0.

Change-Id: I06b349f704d5ae2c592d8d286da268870f2a69e9
2015-04-22 15:03:07 +03:00
Sean Dague
31f97a011b fix FloatingIP repr
The FloatingIP repr added in d614dbcab9cc8c5732ce28c655738218e147aad7
is incorrect, and can cause fails when you attempt to do bulk creation
activities with logging turned on.

This removes the __repr__ for FloatingIP so that it fails back to the
Resource defaults which are safe.

Partial Revert of d614dbcab9cc8c5732ce28c655738218e147aad7

Closes-Bug: #1437244

Change-Id: I8cedf418917157ce632606bef640049140134372
2015-04-22 06:56:38 -04:00
melanie witt
4f9e65c438 Don't lookup service url when bypass_url is given
Change https://review.openstack.org/#/c/164321 broke the bypass_url
option. It made the assumption that self.service_catalog won't be set
in novaclient/client.py when bypass_url is specified, which isn't
necessarily true. This change adds a check for self.bypass_url and
looks up service url only if bypass_url hasn't been specified.

Closes-Bug: #1445086

Change-Id: I72d2b3e3199aeae7fb2f2c68be259774e07a4501
2015-04-21 23:54:14 +00:00
melanie witt
098116d6a5 Revert "nova flavor-show command is inconsistent"
This reverts commit 4e79285b45ec1490c8e923f724cbaf4d42fe81c4.

The aforementioned commit broke flavor-show for mixed case flavorids.
The reason is a bit complex. On the nova api side, there is caching of
db items for flavors, keyed off the flavorid retrieved from the db,
case sensitive, unlike the db query itself. Attempts to flavor-show
a flavor with flavorid composed of letters will fail with a 400 if
the capitalization doesn't match.

For the flavor names, they work in lowercase because the find_resource
function falls back on a search by "human_id" after failing every other
attempt to find the flavor, because "human_id" is a oslo-slugified
string (all lowercase, non-word characters removed, spaces converted
to hyphens).

Closes-Bug: #1446850

Change-Id: I73247b50f5a6918167c071ccc13cd676aa2c7fec
2015-04-21 22:19:06 +00:00
Andrey Kurilin
ccff3d3c94 Remove all imports from oslo namespace
oslo namespace is deprecated

Change-Id: I345eb210222d8e973b99f27821099f52883ab27d
2015-04-20 13:52:38 +03:00
Ramaraja Ramachandran
2761606fbf Report better error message --ephemeral poor usage
The eph_dict expects the format size=value.Catch valueError and return
proper error text

Change-Id: I99ef7efe7dc14aa346913009e244ad4eea0369a9
Closes-bug: #1433200
2015-04-07 14:47:04 +05:30
Feodor Tersin
a63aa515f5 Fix displaying of an unavailable flavor of a showing instance
Since then an instance was booted with a flavor, the flavor could be
deleted or become unavailable (private flavors). As a result novaclient
fails to show the instance with member role user.

This patch set adds handling of unavailable flavors to showing of
instances as it is done for unavailable images.

Closes-Bug: #1366168

Change-Id: I810dcac814b7523313112bb9151754659b85df51
2015-04-07 11:15:37 +03:00
melanie witt
19d4d35a4e Handle binary userdata files such as gzip
The current code in the servers api assumes only text files will be
provided as userdata. That is, the data is utf-8 encoded before it
is base64 encoded and sent. This breaks for binary userdata files,
(example, gzip files) as they can't be utf-8 encoded.

This change ignores specifically the exceptions that are raised
when utf-8 encoding is attempted on non-text data: AttributeError
and UnicodeDecodeError. These exceptions will be ignored to let
binary files proceed to the base64 encoding step.

Closes-Bug: #1419859

Change-Id: Ie96283f6ff892ae30485722cf7c3ec40f3f1b5df
2015-04-03 21:09:10 +00:00
melanie witt
14cada7d0d Add --all-tenants option to 'nova delete'
Currently, the all_tenants=1 search option is being passed all the
time for 'nova delete' commands in order to enable 'nova delete' by
name to work across tenants, for those that have all_tenants access
in the nova policy.json. This however breaks all 'nova delete' for
non-admins when policy has been configured to allow only admin to
list servers across all_tenants.

This patch changes 'nova delete' to take an option --all-tenants to
get the functionality to delete by name across tenants. This is
similar to how 'nova list --all-tenants' works.

Closes-Bug: #1439381

Change-Id: I204daaf5c0f4dab7c93ef0bd85ffab3529ca352a
2015-04-02 17:34:52 +00:00
Jenkins
3681c186f7 Merge "Combine test cases for checking nova limits response" 2015-04-01 22:26:41 +00:00
Rajiv Kumar
88beed19db Combine test cases for checking nova limits response
nova rate-limit returns absolute limits too, but novaclient does
not show absolute limit,a bug
(https://bugs.launchpad.net/python-novaclient/+bug/1172254) has
been filed for this one. There is no test which assert on both
absolute and rate limit. This patch assert on both the rate and
absolute limit returned

Change-Id: Ia635f32eefc46e22e3f4e45a7885f492bb967a99
Closes-Bug: #1436653
2015-04-01 08:35:39 +05:30
Jenkins
493a33a024 Merge "Fix repr of FloatingIPBulk" 2015-03-31 21:34:37 +00:00
Eugeniya Kudryashova
d614dbcab9 Fix repr of FloatingIPBulk
While creating floting ip range returned by API object doesn't contains
attribute 'address', but repr tries to get it. So change list to return
objects of FloatingIP and add repr to FloatingIP,
also changed repr of FloatingIpRange to return actual range of addresses

Closes-bug: #1437244
Change-Id: Ia9e30a3f3d82fa8dde113b40d2da372bf1e7a086
2015-03-31 20:16:14 +03:00