286 Commits

Author SHA1 Message Date
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
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
Jenkins
527df930be Merge "Encode unicode filter arguments for server list" 2015-09-19 03:24:39 +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
4d5cfdead0 Merge "Fix nova bash-completion needs authentication" 2015-09-17 20:50:44 +00: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
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
Jenkins
382af52544 Merge "Add unit tests for different help commands" 2015-09-11 11:30:29 +00:00
Jenkins
31d4e026b4 Merge "[BugFix] Change parameters for legacy bdm" 2015-09-10 23:58:15 +00:00
Daniel Wallace
b547a3da50 make sure os_password is set for auth_plugins
os_password is not set anywhere for auth_plugins.  It is only set for
keystone sessions.  This makes sure that it gets set before being passed
to Client.

Closes-Bug: #1493977
Change-Id: I94421fd6fa58be391dfe8a9a14479bb4c17c5231
2015-09-10 16:50:28 -05:00
Jenkins
5f8754f64d Merge "Fix bugs with rackspace" 2015-09-10 18:10:54 +00:00
Andrey Kurilin
5153dcda80 [BugFix] Change parameters for legacy bdm
`_parse_block_device_mapping` method was design to support both
bdm v1 and v2. The implementation is based on the fact that API side
ignores unknown/incorrect parameters, so `_parse_block_device_mapping` compose
equal parameter for bdm v1 and bdm v2. Since Nova V2.1 contains schema checks,
such implementation stoped working.
Despite the fact that novaclient.v2.servers contains separate logic for bdm v2,
we can make `_parse_block_device_mapping` works only with legacy bdm and
in future patches make it works for both bdm v1 and bdm v2.

Change-Id: I37c00ac77b1a3b500221d779533532e9f43e5277
Closes-Bug: #1491737
2015-09-10 20:44:49 +03:00
Jenkins
6ecc81b89b Merge "Option to specify max servers for live evacuate" 2015-09-10 16:21:06 +00:00
Daniel Wallace
b2221c8a70 Fix bugs with rackspace
not all apis have the versions available

Rackspace api does not open up for querying versions.  This causes it to
still break when using the rackspace-auth-plugin

add tests for api_version Unauthorized

make sure that the list can still run even if the api_version check is
unauthorized.

Closes-Bug: #1493974
Closes-Bug: #1491579
Change-Id: I038b84bad5b747a0688aef989f1337aee835b945
2015-09-09 14:47:20 -05:00
melanie witt
d0b44893ac Add unit tests for different help commands
Related-Bug: #1491677

Change-Id: I7e6b74e60dafa0e869a5b3355793cda1cf08c389
2015-09-08 20:11:17 +00:00
Jenkins
9e15b3d7c0 Merge "[Bug-Fix] Update requests body for quota-update" 2015-09-04 17:33:13 +00:00
Andrey Kurilin
6fc3a943e6 [Bug-Fix] Update requests body for quota-update
Update quotas API call doesn't accept parameter "tenant-id".

Change-Id: I1cbc6088c5deeb32e4e98ef1ced5f83ce71fe3ab
Closes-Bug: #1492242
2015-09-04 17:49:27 +03:00
Sean Dague
e4b0d46c4b workaround for RAX repose configuration
The RAX Repose environment is blocking access to the API version
information by local policy, returning a 401 before we even get to
Nova itself. While this in clearly incorrect behavior, it is behavior
in the field, and we should not break all our users on that cloud.

This catches the 401 and translates that so that it's the equivalent
of only supporting v2.0. We will be taking these API calls to defcore,
and intend to remove this work around once that is done.

Change-Id: I2072095c24b41efcfd58d6f25205bcc94f1174da
Related-Bug: #1491579
2015-09-03 14:13:33 -04:00
Sean Dague
c915757ed5 Don't assume oscomputeversions is correctly deployed
The paste pipeline that's "above" the /v2/ and /v2.1/ urls is the
oscomputeversions dispatcher, which should provide 300 redirects to
versions in question. Previously the code that was trying to discover
information about the current version did so via a GET of something
that looked like /v2. On an upstream compatible OpenStack this
actually triggers a 300 and redirect to /v2/ for the real answer.

On deployed public clouds, oscomputeversions is sometimes not deployed
at all, or front end blocking by the load balancer does
weirdness. Sometimes with a 401, sometimes a hang.

This fixes the way that first request is made that should avoid the
300 redirect entirely. The code probably should have done this
originally, but it was tested with upstream configuration that worked
fine in this case.

This fix is tested against HP Cloud (the only pub cloud I have creds
with). Before this fix "nova list" hangs trying to get the supported
versions, after the fix it works as expected.

Change-Id: I1692380fe8d340e5c044f46dd0b103c7550d2c7d
Closes-Bug: #1491579
2015-09-03 13:19:28 -04:00
Matt Riedemann
eaf1e56b21 Update path to subunit2html in post_test_hook
Per:

http://lists.openstack.org/pipermail/openstack-dev/2015-August/072982.html

The location of subunit2html changed on the images in the gate
so update the path used in the post_test_hook.

Long-term we should just use what's in devstack-gate.

Change-Id: I5e50e7d7ad845aba26403df1df412c0a139a6dc7
Closes-Bug: #1491646

--------------
squashed with:
--------------

Don't pass null device when attaching a volume

The v2.1 API schema rejects null device values in an
os-volume_attachments request, so only include the device in the request
if one is specified on the command line.

Closes-Bug: #1491325

Change-Id: I4fa4019f19f9af6ff350db2fb6e524fa8570a6f3
2015-09-02 19:08:09 -07:00
Artom Lifshitz
3d9c01b2d3 Option to specify max servers for live evacuate
The current behaviour of live evacuate is to naively request that all
servers on the hypervisor be evacuated. The more VMs are migrated
simultaneously, the more bandwidth is required. Once a certain number
of migrating VMs is reached, there is not enough bandwidth to cope
with the rate at which they dirty their memory. The migrations will
thus never complete.

The correct solution to this would be a whole lot of work on the Nova
side. As a stopgap measure, this patch introduces a --max-servers
option to host-evacuate-live. With this option, the user can control
the number of VMs that are live-migrated at the same time, thus
allowing the user to avoid the dirty memory scenario described above.

Change-Id: I17bad5f3253d6657fc1e6610159fc8e3921e6ea4
2015-09-02 17:13:47 +00:00
Cedric Brandily
9b7dd38d8f Allow to reboot multiple servers
This change allows to pass multiple server names/ids to nova reboot.

Change-Id: I7ad891beafba019c262f656aa3e78686336e072b
2015-08-31 23:11:53 +02:00
Andrey Kurilin
b80ac974e3 Add mechanism to vm list to return all resources
This patch adds a loop to servers list, which makes calls to API side until
all resources will be listed.

Also, there are several functional tests are added with checks of markers
and limit.

Change-Id: Ic030a68867781cca25e723ab51986d87ecd3ab2e
2015-08-27 12:48:05 +03:00
Andrey Kurilin
d106dd485b Add "limit" option to servers list cli
This option is supported by both API and "novaclient-as-a-lib" sides, but
was missed from CLI.

Change-Id: Ie85949a7d7040f73b97b0676c5d574ede5a3034e
2015-08-25 20:25:28 +03:00
Andrey Kurilin
a708190499 Add 'marker' argument to server list cli
Nova API side supports returns limited number of resources, option "marker" is
already supported by "novaclient as a lib" and allowes to list servers
after "marker".

Change-Id: I04c42858a19b2afed37f967c14234291203e6c1e
2015-08-25 20:12:10 +03:00
Jenkins
72190ba9a2 Merge "Fix versions.list for v2.1 Nova API" 2015-08-24 23:19:10 +00:00
Feodor Tersin
b6130e2e18 Fix a fault of request logging with no credentials
If a user doesn't specify for novaclient's Client neither credentials
nor auth token, but specifies http_log_debug=True, and requests Nova
version list, novaclient fails with AttributeError exception.

The reason is that obfuscation of auth token doesn't expect None value
of the token. This patch bypass obfuscation of None token.

Closes-Bug: #1488169
Change-Id: I3712d633719bc77310ce863da33b2eec59a7ce91
2015-08-24 19:46:17 +03:00
Feodor Tersin
bf91805f35 Fix versions.list for v2.1 Nova API
novaclient transforms its management_url to get an url for a request for
server versions list. Currently this transformation does not consider
that version part of an url can be complex and contain major and minor
parts. As a result versions.list does request on a wrong url and fails
with NotFound error.

This patch adds support of version formats like 'vN.N', 'vN.NN', etc.

Partial-Bug: #1483030
Change-Id: Ie105bec37ee41c6a77ffc5f1cf680bbf88846159
2015-08-21 22:04:15 +03:00
Jenkins
a695683775 Merge "Allow display project-id for server groups" 2015-08-17 16:19:01 +00:00
Jenkins
17a37e5760 Merge "Copy cli arguments in api_versions.wraps decorator" 2015-08-17 16:18:58 +00:00
Andrey Kurilin
a570b60d67 Copy cli arguments in api_versions.wraps decorator
novaclient.api_versions.wraps decorator can be used in shell. Most of shell
function has cli arguments which are added via another decorator.
Currently, to keep this cli arguments, novaclient.api_versions.wraps
decorator should be used in the top of decorators. Something like:

    @api_versions.wraps("123.456")
    @cliutils.arg("name", help="Name of the something")
    @cliutils.arg("action", help="Some action")
    def do_something(cs, args):
        pass

This patch adds ability to put api_versions.wraps decorator everywhere:

    @api_versions.wraps("123.456")
    @cliutils.arg("name", help="Name of the something")
    @cliutils.arg("action", help="Some action")
    def do_something_1(cs, args):
        pass

    @cliutils.arg("name", help="Name of the something")
    @cliutils.arg("action", help="Some action")
    @api_versions.wraps("123.456")
    def do_something_2(cs, args):
        pass

Related to bp api-microversion-support

Change-Id: I8d599b712b17dcfc0be940a61c537d2dfe1b715b
2015-08-11 14:40:05 +03:00
Kevin_Zheng
01c2e60eb3 Allow display project-id for server groups
Currently, the display of server groups doesn't contain informations
about project-id. It is very difficult for admin to tell which
group belongs to which project when using command:
"nova server-group-list --all-projects".

This patch adds project-id to the display.

Change-Id: I010bf02f696396c404bc7a51ce93252c8c7f68a6
Partial-bug:#1481210
2015-08-11 03:24:56 +00:00
Carlos Goncalves
39739158b0 Support forcing service down
Extending Nova CLI to support forcing service to be set/unset as down,
as specified in blueprint mark-host-down.

Depends-On: I612582ba7b70bb6d167aa68bdfc47faa3b7b85ed
Depends-On: I39f1a84c100726f87a4dc464dd9922d66efdb53f
Implements: blueprint support-force-down-service
Change-Id: I2b80ac32a95fe80363b4ad95d8d89fff097935a3
2015-08-07 17:47:59 +01:00
Jenkins
46289cafef Merge "Adds support for x509 certificates as keypairs" 2015-08-07 13:33:38 +00:00
Jenkins
e89e5fe1bb Merge "Set "latest" as default compute api version" 2015-08-07 13:33:31 +00:00
Jenkins
59abce6462 Merge "Add version discover and check in CLI" 2015-08-07 13:33:19 +00:00
Claudiu Belu
4a812d953b Adds support for x509 certificates as keypairs
Adds new parameter --key-type for novaclient for creating x509
certificates as keypairs. If no --key-type is specified, a ssh
keypair is created, for backwards compatibility.
Adds 'Type' column for keypair-list, displaying the keypair type.

This commit will have to merge after:
https://review.openstack.org/#/c/140313

Depends-On: I215662f2f92a01921a866c3218031787a9eaf915

Implements: blueprint keypair-x509-certificates

Co-Authored-By: Andrey Kurilin <andr.kurilin@gmail.com>
Co-Authored-By: Alex Xu <hejie.xu@intel.com>
Change-Id: I12bb13e24b660ffb6da0e5be275acbba7453d011
2015-08-05 19:55:48 +00:00
Andrey Kurilin
02889515a5 Set "latest" as default compute api version
It would be nice to use "latest" version of api by default.

Related to bp api-microversion-support

Change-Id: Ife981c87d32011f01fcbdf871071a9d8273ebb92
2015-08-04 16:15:05 +08:00
Andrey Kurilin
9ed9ab68f7 Add version discover and check in CLI
This patch adds version discovery when user request with latest version.
The latest version means the most recently version between server and
client.

Related to bp api-microversion-support
Co-Authored-By: Alex Xu <hejie.xu@intel.com>
Change-Id: I0b7a95e77371aef6e349bf54b5dd6ce6c6d2732c
2015-08-04 16:15:01 +08:00
Jenkins
623cfd5c19 Merge "Add 'deleted' status check in _poll_for_status" 2015-08-03 01:53:10 +00:00
Ian Cordasco
c69c38c58f Use keystoneclient's TCPKeepAliveAdapter
When novaclient isn't using a session from keystoneclient, it needs to
set reasonable TCP Keep-Alive values otherwise the operating system
defaults may cause the client to hang for hours before a connection will
time out. Using keystoneclient's adpater (which sets good defaults) will
allow us to not have to maintain this adapter here and to benefit from
their defaults.

Closes-bug: 1477275
Related-bug: 1323862
Depends-On: Ibd53ae2d4d2455db0ebc9951e5c764befc57850f
Change-Id: I1924bd96eb1a4bac5d57a5cc5d5461acb3f7f5ac
2015-07-28 20:20:29 -05:00
Jenkins
9efeb79660 Merge "Add "get_current" method to VersionManager" 2015-07-28 17:56:08 +00:00
wangxiyuan
ba79073d7b Add 'deleted' status check in _poll_for_status
When use command '--poll' to show progress, if the object's staus change
into 'deleted' for some reason, it will lead a endless loop.Becasue there
is no check about 'deleted' status.

For example, when use 'image-create --poll' to create a vm's snapshoot,
if glance's quota is small than the snapshoot, the image will be deleted.

Change-Id: I028e3064b3371f87873d74494c39255775a2c818
Closes-bug:#1470047
2015-07-28 11:05:04 +08:00
Jenkins
40a4070f28 Merge "Implements 'microversions' api type - Part 2" 2015-07-27 23:13:36 +00:00
Andrey Kurilin
eddb4d61c2 Add "get_current" method to VersionManager
get_current returns the current endpoint's API version info.

Related to bp api-microversion-support
Co-Authored-By: Alex Xu <hejie.xu@intel.com>
Change-Id: I36e84680c578a88d5c274f8ca24ecd18d1f3a179
2015-07-27 19:55:37 +08:00
Jenkins
6e192c8087 Merge "rename root-password to set-password" 2015-07-27 11:39:37 +00:00