815 Commits

Author SHA1 Message Date
Vincent Untz
7d800a9e65 Fix typo in error message
Change-Id: I9ff3babd0460c41e05f18b34c3b46032edbf1459
2015-11-17 07:19:25 +01:00
Jenkins
fd13e89c46 Merge "Functional tests for os-extended-server-attributes" 2015-11-12 17:00:09 +00:00
Jenkins
903538ee59 Merge "Refactor parsing metadata to a common function" 2015-11-11 11:00:45 +00:00
Sujitha
6a18757509 Added command for device to cinder volume mapping
Added new sub command volume-attachments which displays the list
of volumes attached to a server.

Change-Id: I1f56a6fa18c35f3df2bdd11b9cf83bd5c5d9e182
Closes-Bug: #1116593
2015-11-10 22:43:11 +00:00
Jenkins
e77d770bd9 Merge "Add v2 support for optional project_id in version discovery urls" 2015-11-09 18:08:36 +00:00
Anna Babich
e9268e9864 Functional tests for os-extended-server-attributes
The added tests check basic set of extended server attributes
and additional attributes exposed by microversion 2.3

To avoid leak resources, cleanup part has been refactored

Change-Id: I0c8f096134838b90e17720f2a28e649998a02e3b
2015-11-09 16:47:45 +02:00
Jenkins
fc2f4abf6c Merge "make project_id optional in urls for version discovery" 2015-11-05 03:40:15 +00:00
Augustina Ragwitz
5f5ec354be Add v2 support for optional project_id in version discovery urls
This is part of the work to allow Nova and Novaclient to handle endpoints both
with and without project id's. v2 version information returns a different data
structure than later versions. This patch updates the mock tests to return a
different data structure corresponding to v2 or v2.x depending on the
endpoint_type. A caller using the mock test class can set the attribute
endpoint_type to a version number, and the method get_endpoint, will return the
appropriate data structure. This is more of a workaround given the current state
of mocking Nova api calls in our unit tests.

Part of bp:service-catalog-tng

Change-Id: I61984ee592f7a5d7f1a91c9e2ff3038c0245f797
2015-11-04 18:09:14 -08:00
Matt Riedemann
f7e2129f88 Remove novaclient.v1_1 module
This reverts commit 036d42d7087a3c83a5feec0ad0a4c6af35df72c9

Once novaclient 2.34 is released we can merge this and
release as 3.0.0. The dependency is on the 2.34 release
request.

Change-Id: I1e3a8a8079b954fe60371c2d38ec23a10727c408
Depends-On: I4fc044e518a5cc5ea7b309a2824984a7035945bd
2015-10-29 14:04:45 +00:00
Jenkins
bba1d6ece4 Merge "Revert "Remove novaclient.v1_1 module"" 2015-10-29 05:04:59 +00:00
Matt Riedemann
036d42d708 Revert "Remove novaclient.v1_1 module"
This reverts commit 0cd58123be5e2c2bc2f1233a3e15fb35b2ead1a0

This is a backward incompatible change that is blocking our
ability to release 2.34 for 63c7a57, which was a revert for
another backward incompatible change (2961e82) which slipped
into 2.33.

Once we release 2.34 with the bug fixes, we'll revert this
revert and release that as novaclient 3.0.

Change-Id: If79d37df3e99004897f1bb2d8564d2f1d8aa0978
2015-10-28 21:25:02 +00:00
Matt Riedemann
63c7a576e1 Revert "Do not expose exceptions from requests library"
This reverts commit 2961e82bfa6e375ac3c17933fac532ed316ac976

This broke cinder unit tests that have a timeout test for novaclient
where they mock the requests library raising a Timeout exception. That
test expects to get a requests Timeout passed through but with the
change being reverted it was getting a RequestTimeout exception from
novaclient, which breaks the test and fails the gate runs.

We could change the cinder unit test to handle both the requests.Timeout
and the new novaclient RequestTimeout, but that's just papering over
the cinder failure, we wouldn't know what other clients are failing
in the same way because they have code working around the requests
exceptions getting passed through, so we should treat this like an API
change.

I'd be in favor of making the same change again iff the novaclient
exceptions extended the requests exception types so it would be transparent
to consumers, since novaclient.exceptions.RequestTimeout would be a
requests.Timeout via inheritance. But given the gate breakage and it being
summit week I'm inclined to revert first and think about a better long term
fix later when people are back to discuss.

Change-Id: I368728588e5997eef860a168539eb66c58f2e72a
Closes-Bug: #1510790
2015-10-28 07:27:40 -07:00
Jenkins
2276c92718 Merge "Remove novaclient.v1_1 module" 2015-10-23 16:24:33 +00:00
Jenkins
a5363ae0d6 Merge "Support the server side remote-console API changes" 2015-10-23 12:56:32 +00:00
Jenkins
5d5def785d Merge "Do not expose exceptions from requests library" 2015-10-23 12:56:11 +00:00
Jason Dunsmore
2961e82bfa Do not expose exceptions from requests library
Novaclient expects the requests library to always be able to get a
response back and doesn't handle other cases where it might raise
an exception even before the request is completed (e.g.
ConnectionError).

These exceptions should be captured and properly converted to some
native novaclient exception.

Change-Id: Iec7247b715c38c29910b30e76413cead4e951a37
Co-Authored-By: Kuo-tung Kao <jelly.k@inwinstack.com>
Closes-Bug: #1406586
2015-10-22 14:34:23 -05:00
Sean Dague
4f16fe65c4 make project_id optional in urls for version discovery
Currently there is a baked in assumption throughout the nova ecosystem
that endpoint urls will end in {project_id}.

This means that the version document for a specific major API version
is "endpoint - last_chunk_of_url". This is not a discoverable URL,
it's one that we heuristically generate.

GET /v2.1/{project_id} is a 404.

If we make Nova able to handle endpoint ids without {project_id} we
run into a problem with novaclient, which is that end_point is now
/v2.1. The heuristic gives us a version url of /. Which returns a very
different doc than /v2.1. This causes all novaclient commands to explode.

In order to support this transition we need to make both Nova and
Novaclient handle endpoints with and without {project_id}.

The proposal is thus to try the raw value of the endpoint first. If it
works, great. If it fails with a 404, fall back to the heuristics.

While this change and the nova change are technically independent, we
should land this one as soon as possible, because clients before this
change will not work with Nova deploys that get rid of project_id in
their service catalog in the future.

Part of bp:service-catalog-tng

Co-Authored-By: Augustina Ragwitz <aragwitz+lp@pobox.com>
Change-Id: Id4a2f73cbcfcf36aea750375fd92b1c2d3cd824e
2015-10-22 11:10:56 -07:00
Mark Doffman
cce7cd3277 Support the server side remote-console API changes
In microversion 2.6 the remote-console API was changed.
See http://docs.openstack.org/developer/nova/api_microversion_history.html
for details of those changes.

This adds support for the new remote-console API.

Change-Id: I67098d6ce8c71f3ac0073628fd3b0aa23cd81918
Closes-Bug: #1500688
2015-10-22 10:14:13 -05:00
He Jie Xu
28bf8ddb06 Correct usage of API_MAX_VERSION and DEFAULT_OS_COMPUTE_API_VERSION
Commit d045019f0f2d28f26730b3617f7d7b993506b6e8 use the variables
API_MAX_VERSION and DEFAULT_OS_COMPUTE_API_VERSION with wrong way.

API_MAX_VERSION means the max version of client supported. This
variable only be changed when client support the new version. And
it's must bumped sequentially.

DEFAULT_OS_COMPUTE_API_VERSION is default value of option
'--os-compute-api-version', this value decided the default behaviour
of nova client. The nova client CLI behaviour should be that client
negotiate with server side to find out most recent version betweeyn
client and server. So the value should be '2.latest'. And it won't
be changed except we decided to change the default behaviour of nova
client CLI.

Change-Id: Iba9bfa136245bd2899c427ac0c231a30c00bd7f3
Closes-Bug: #1508244
2015-10-21 11:07:32 +08:00
Jenkins
095d72f652 Merge "Rely on devstack for clouds.yaml" 2015-10-20 23:52:59 +00:00
Jenkins
73de0478e4 Merge "Increase timeout when testing admin timeout" 2015-10-20 21:55:44 +00:00
Monty Taylor
727f1044bf Rely on devstack for clouds.yaml
Rather than copying it ourselves, just consume the one that
devstack is putting there for us.

Change-Id: Ifb9f8a55e0eb342db55a3518c375ea79679ff076
2015-10-21 05:20:34 +09:00
Kevin_Zheng
09bb834b05 Refactor parsing metadata to a common function
Currently the metadata is parsed using
dict(v.split('=', 1) for v in metadata)
and was used in several places, it could
be better if we refactor it to a common
function. It will make it more readable
and easier to use in the future.

Change-Id: Ib0fcaacdbef65cdcb85ecc0c304f4933bef2627c
Closes-Bug: #1503939
2015-10-20 11:27:20 +00:00
melanie witt
a820c45543 Use v2.0 in clouds.yaml auth_url for functional test job
Commit 050a0d5b304a013e23cd5909abf6e11b7dda5f18 changed the defaults
in devstack to use the keystone v3 api. This broke the novaclient
functional test job because novaclient doesn't yet support v3
and relies on having "v2.0" in the auth_url.

This appends or replaces the version in the clouds.yaml auth_url
to v2.0 to enable the functional test job to work until v3 support
is added to novaclient.

Closes-Bug: #1506103

Change-Id: I75c5efd039b71c8855acf21c5516ccbeeaaeadb3
2015-10-16 22:47:37 +00:00
liyingjun
986ed2ae0b Add sort_dir/key to flavor list
'marker' and 'limit' are already added to flavor list, but 'sort_key'
and 'sort_dir' which are useful for pagination are missing.

Closes-bug: #1505939
Change-Id: Id78595f15fbb289133092a32238238e3c4a9d0a0
2015-10-15 08:33:38 +08:00
liyingjun
49e76e670b Add pagination params for flavor list
Mission 'marker' and 'limit' params for `nova flavor-list` shell
command. It would be nice to have this when there are many flavors.

Change-Id: I4579b63bc6c711f1b5eaf07b54d393ebcbfd8277
Closes-bug: #1505874
2015-10-14 10:38:13 +08:00
Thomas Bechtold
afaa8a2d1e Increase timeout when testing admin timeout
When running functional tests in a slow virtual environment,
the given timeout of 10 seconds to list thr available instances
is not enough. Increase the timeout to not run into
a "timed out (HTTP 408)".

Change-Id: Ie2345e6858bcc97095863d5d388bacf9c29b7682
2015-10-13 19:12:58 +02:00
Jenkins
03f1f67ccd Merge "Revert "Allow display project-id for server groups"" 2015-10-05 20:56:52 +00:00
Matt Riedemann
469d06837c Revert "Allow display project-id for server groups"
This reverts commit 01c2e60eb3f3718884dd77cb05b4cde76052fb9d

The server side change isn't in yet, there is a spec
proposed:

I167141676ef4f597a1c022c1fd5dc96fd55d02ad

So this should have never landed in the client.  And when
it does it should be using microversions, like we have for
the v2.4 support added in:

5fdb861ad4835513c0cb78251cce85ac73f51dd4

Change-Id: If3196093036c72f0f86cdca98a016b9f4fff0923
2015-10-05 18:12:23 +00:00
Jenkins
b7e647427d Merge "Test that microversions are not skipped" 2015-10-05 16:21:16 +00:00
Jenkins
8971193286 Merge "Add --metadata as optional input when do nova image-create" 2015-10-05 15:18:20 +00:00
Andrew Laski
4bd50d5e41 Test that microversions are not skipped
When raising API_MAX_VERSION to support a new Nova API microversion
there should be support added to some method to account for the change.
A test has been added to catch if support has not been added.  In the
event that no methods need to change there is an exclusion mechanism in
the test so the version and a note can be added there.

Change-Id: Iebc1be2557e1b6eec327b703568805578e564172
2015-10-02 16:11:20 -04:00
Matt Riedemann
d045019f0f Set DEFAULT_OS_COMPUTE_API_VERSION to 2.5
The client currently implements support for microversions 2.2, 2.4 and
2.11.

According the nova API microversion history:

http://docs.openstack.org/developer/nova/api_microversion_history.html

2.3 just returns extra attributes in the response so it's not a problem
for the client. We should expose those at some point but it's not a
breaking change.

2.5 is a server-side only change since the client allows filtering
servers by IPv6 address but the server wasn't honoring that until 2.5.
There are no client side changes for that microversion.

2.6 is the first backwards incompatible microversion since it replaces
the old specific console APIs (RDP/serial/SPICE/VNC) with a new generic
remote-consoles API. The client must be updated to handle this since
requesting any microversion >=2.6 for consoles will fail right now. This
is exposed on the CLI right now because the CLI defaults to the 2.latest
microversion.

So even though the client actually supports the 2.11 microversion, we
shouldn't default to higher than 2.5 because we have gaps in handling
2.6->2.10.

This change fixes the default for the CLI by setting
DEFAULT_OS_COMPUTE_API_VERSION=2.5.

Partial-Bug: #1500688

Change-Id: I52074f9a3e7faa6a7a51c3fa9766100acf25dee2
2015-10-01 14:18:05 -07:00
melanie witt
abd0630bad Always send volume_id when booting with legacy bdm
Commit 5153dcda807c554769081626c10c43d16adea671 removed bdm v2-only
request parameters to pass nova api v2.1 schema validation, but also
removed the ability to boot with legacy bdm specifying volume_id only.

This adds volume_id back to the request for legacy bdm when
no other parameters are specified.

Closes-Bug: #1501435

Change-Id: Ie8c56c28492793990ef7ed6dc54768cef9e28a98
2015-10-01 10:55:47 +00:00
Kevin_Zheng
3866bfb297 Add --metadata as optional input when do nova image-create
Currently, when using nova image-create, we are not able to
input metadata for the snapshot, and it is always set to be
None.

This patch add --metadata as an optional input when calling
nova image-create.

Change-Id: Ic72dc3652a77cfad099e144423302042a47f6e1e
Closes-bug: #1500727
2015-09-30 09:22:07 +08:00
Andrey Kurilin
0cd58123be Remove novaclient.v1_1 module
A long time ago in a galaxy far far away...this module was deprecated
(see 0a60aae852d2688861d0b4ba097a1a00529f0611 for more details) and
it's time to remove it(one full release of deprecation (Liberty) is 
ended).

Also, let's stop testing compute-api-version=1.1 .

Change-Id: I2ce177d8074921a54b4e3d1bfe3b794a80df9358
2015-09-29 11:50:59 +00:00
Andrey Kurilin
0455932c3a Split functional tests for legacy(V2.1) and microversions
It would be nice to ensure that fundamental use-cases of novaclient work
for both legacy(V2.1) and for microversions(latest or specified microversion).

Change-Id: Icae73dd221c9787fd08facc8642c5b564e82393a
2015-09-21 12:07:18 +03:00
Andrey Kurilin
2793331d01 Specify api_version for functional tests
Most of functional tests are written for V2.0/V2.1 API version, but
launched on "latest" compute api version('--os-compute-api-version'
flag is not ovveriden + default value of it is "latest").

This patch adds "COMPUTE_API_VERSION" parameter for base TestCase,
which sets --os-compute-api-version flag while running "nova" shell.

Change-Id: I5d711438addaba5282a15fd2b9dde1800f7d7b91
2015-09-21 12:05:46 +03:00
Jenkins
527df930be Merge "Encode unicode filter arguments for server list" 2015-09-19 03:24:39 +00:00
Jenkins
2dff4b05dd Merge "[docs] Fix length of underline" 2015-09-18 18:33:03 +00:00
Richard Jones
485201453a Encode unicode filter arguments for server list
Previously unicode arguments were not encoded so unicode
exceptions were thrown when the arguments were URL encoded.

Change-Id: I69a5ac8dcf584ad5b5604caf3c4cb16bb59d3fe3
Partial-Bug: 1472999
2015-09-18 11:45:50 +10:00
Jenkins
64c8039c1e Merge "Show reserved status for a fixed_ip if available" 2015-09-17 21:26:49 +00:00
Jenkins
4d5cfdead0 Merge "Fix nova bash-completion needs authentication" 2015-09-17 20:50:44 +00:00
Andrey Kurilin
420782cc01 [docs] Fix length of underline
Title length must match the underline

Change-Id: Ia7a2bf54a6697c63c423bacd53dfb125b9c620f6
2015-09-17 16:07:11 +03:00
Atsushi SAKAI
b1204446ef Fix nova bash-completion needs authentication
CLI-Reference generator requires
   (openstack-doc-tools/bin/doc-tools-update-cli-reference)
  that command line help and bash-completion running without authentication.

  For this purpose, remove authentication check in command and its test.
    Fix nova bash-completion works without authentication.
    Fix nova bash-completion test without setting authentication infomation.

  Define skip_auth for descriminate "nova bash-completion" and do_help.

Change-Id: Ic1a7f84b1b9cb7e8be6721c1b8096f49e9e9ab33
Closes-Bug: #1495424
2015-09-17 09:20:48 +09:00
Matt Riedemann
5fdb861ad4 Show reserved status for a fixed_ip if available
Commit 8886590f30daf736ae30a95b3e4a77cb586d4f02 adds the v2.4
microversion to nova so that we can get back the reserved value of a
fixed IP.

This change adds support to novaclient to display the reserved status
from the fixed_ip resource if it's available in the response.

Related blueprint show-reserved-status-in-os-fixed-ips-api

Change-Id: Idf3df1728ba87006d1b0f82a1c01712202670e0a
2015-09-16 14:21:37 -07:00
Jenkins
0820a9e793 Merge "Remove redundant help command test and commonize" 2015-09-16 15:53:16 +00:00
Victor Stinner
48f9c5a046 Fix unicode issue in shell.main() error handling
shell.main() uses safe_encode() to encode the exception name and
exception message. On Python 3, it displays:

   ERROR (b'Exception'): b'message'

instead of:

   ERROR (Exception): message

Don't encode exception name and message on Python 3. Use
exception_to_unicode() of oslo_utils.encodeutils to get the exception
message as Unicode. On Python 2, let print() encodes the Unicode to
the encoding of sys.stderr.

Blueprint nova-python3
Change-Id: Ib5568546d2aedb2b28c05d840b9ba34f697384ec
2015-09-15 09:53:15 +02:00
melanie witt
b4e9af99d7 Remove redundant help command test and commonize
This is a follow up patch to https://review.openstack.org/#/c/221488/
which added unit tests for 'nova -h' and 'nova --help' and commonized
some code. It was missed that a test for 'nova' without any options or
subcommands already existed as "test_help_no_options"

This patch also refactors "test_help_on_subcommand" use the common
"_test_help" function since that was also missed.

Change-Id: Iccaf91207ba35001c8f58abb550cd1c3be542b38
2015-09-15 00:20:23 +00:00
Jenkins
37d1e29a0b Merge "make sure os_password is set for auth_plugins" 2015-09-11 17:06:35 +00:00