Commit Graph

157 Commits

Author SHA1 Message Date
Joe Gordon 3561772f8b Move unit tests into unit test directory
In order to pave the way for functional testing, move existing unit
tests into a directory labeled unit. A subsequent patch will add a
directory for functional tests.

Change-Id: I0adb8b9f14451acb382c725d31f5387b4b6d82bb
2015-01-27 13:06:06 -08:00
Steven Kaufer 4b530bf9d6 novaclient sort parameters support
Adds sorting support to the 'nova list' command.

--sort <key>[:<direction>]

The --sort parameter is comma-separated and is used to specify
one or more sort keys and directions. The direction defaults to
'desc' for each sort key and the user can supply 'asc' to
override.

Partially implements: blueprint nova-pagination

Change-Id: I635e017c7f9ab61812333983bfecccd6fce8d394
2014-12-16 18:38:24 +00:00
Eugeniya Kudryashova 2126b93e68 Fix E128 failures in novaclient/tests
E128 continuation line under-indented for visual indent

Change-Id: Ie751df84ad289e025bd8ccd4e294228bed803aa5
2014-11-18 17:21:30 +02:00
David Hu 8597a0c234 Support using the Keystone V3 API from the Nova CLI
This changeset enables support for Keystone V3 authentication
on the Nova CLI. This provides consistency between using
novaclient as the Nova CLI and using it as a library
as the Keystone V3 support already exists for the libary usecase.

The bulk of the change surrounds the use of the keystoneclient
session object for authentication, retriving the service catalog,
and HTTP connection/session management.

Co-Authored-By: Morgan Fainberg <morgan.fainberg@gmail.com>
Change-Id: Iece9f41320a8770176c7eeb5acd86be4d80cc58f
2014-11-11 21:04:20 -08:00
Andrey Kurilin ae6c39397e Enable check for E127
E127 continuation line over-indented for visual indent

Change-Id: I9dfd489565ee2d1469b2048a930c3a8384dd245d
2014-10-23 14:28:50 +00:00
Jenkins cb102e0d18 Merge "Add missing parameters for server rescue" 2014-10-23 11:07:17 +00:00
M. David Bennett b6db84c9f8 Add missing parameters for server rescue
The server rescue call supports passing a password and an image,
however novaclient does not have options to support this. This commit
adds these options and updates the related unit tests to support the
change.

Change-Id: I14c878c0027f8206671ee001ba5195f94f842314
2014-10-20 14:31:25 -05:00
Amandeep 2d6047ffb4 no way to delete valid/invalid security rule
Previously deleting valid/invalid security
group rules was throwing the error of
"AttributeError". With this fix, now both
types of security group rules can be deleted.

Change-Id: I253c2742efe69ee41976c88ca2775189bc5bde0d
Closes-Bug: #1163469
2014-10-20 09:51:12 +05:30
Jenkins 1621c93cfa Merge "Live migrate each instance from one host to other hosts" 2014-09-22 15:37:39 +00:00
Phil Day 2e64986532 Add list by user to shell
Adds "--user" as a search option to the list command.

Also since seach by tenant or user also needs all_tenants=1 add
this to the seach options automatically instead of making users
remember to add it

Change-Id: Icc828080b400aecdb320b721c569992677848cc6
2014-09-18 17:40:45 +00:00
Jenkins 3e5dae84a8 Merge "secgroup-create description is not optional" 2014-09-17 22:34:24 +00:00
Jenkins a6dc7fc43e Merge "Add support for the server group quotas" 2014-09-17 17:05:08 +00:00
Jenkins 9312e25c4b Merge "Make findall support server side filtering" 2014-09-17 02:52:23 +00:00
Jenkins c5a3aefbd0 Merge "Fix order of arguments in assertEquals" 2014-09-17 01:55:30 +00:00
Chris Yeoh bd65fde64c secgroup-create description is not optional
The description field to the Nova API for secgroup
create is not optional. This enforces the supplying
of the description field in novaclient as the Nova
call will fail if it is not supplied.

v3 version does not need to be updated as it was never
changed.

Change-Id: I6fc823990190b935a8e1214efc8c3ac3a0941abf
Closes-Bug: 1367121
2014-09-16 11:25:18 +09:30
Ala Rezmerita a400b58d03 Live migrate each instance from one host to other hosts
Using the existing server live_migrate api, this new feature,
adds the ability for admins to live-migrate all running instances
from one host to other hosts. The patch implements the feature
for Nova API V2 and API V3.

Co-Authored-By: Cédric Soulas <cedric.soulas@cloudwatt.com>

Change-Id: Ie8dd1b66fb8eaefa6ff38752b1e4f46bab145820
Implements: blueprint host-servers-live-migrate
2014-09-15 06:36:07 +00:00
Cyril Roelandt 730fa4d0b2 Add support for the server group quotas
Implements: blueprint server-group-quotas
Change-Id: I440d460d227f4447c2b960b6343b8fe1f6cbd3fb
2014-09-12 18:25:24 +00:00
Jenkins 4dbf1323cc Merge "Enhance network-list to allow --fields" 2014-09-10 12:09:06 +00:00
Joe Gordon 07260236ab Make findall support server side filtering
Instead of listing all servers and doing clientside filtering, use the servers
filtering on name.the server's list already supports filtering
so just pass a search_opts dictionary into list().

This should speed up nova commands when a user has large numbers of servers.

Change-Id: I6deea8523754ff213f43bd059fb00f34fc0e1a12
Closes-Bug: #1202179
2014-09-08 18:10:25 -07:00
Jenkins 7377b42482 Merge "Use oslo.utils" 2014-09-08 17:39:25 +00:00
Jenkins 146fe804a8 Merge "Adding cornercases for set_metadata" 2014-08-28 11:11:49 +00:00
Andrey Kurilin 392148c7ef Use oslo.utils
Modules `strutils`, `timeutils` and `network_utils` from common code are
graduated in `oslo.utils`, so we can:
 1. remove `novaclient.openstack.common.network_utils` and use
    `oslo.utils.netutils` instead.
 2. use `oslo.utils.encodeutils` and `oslo.utils.strutils` instead of
    `novaclient.openstack.common.strutils`.
 3. use `oslo.utils.timeutils` instead of
    `novaclient.openstack.common.timeutils`.

Additional information:
 - modules `importutils`, `strutils` and `timeutils` from
   `novaclient.openstack.common` cannot be removed, because:
   - importutils is used by apiclient and jsonutils;
   - strutils is used by apiclient, cliutils and jsonutils;
   - timeutils is used by jsonutils
 - additional check for `safe_encode` in Py3 is required, since
   If91a866d864a22d28a352152beff4c7406a27b7b was merged.

Change-Id: Ib8d79d9c85af4916e87a76a1a67a13488ddaa111
2014-08-28 12:17:22 +03:00
Jenkins e0ed6a1e76 Merge "Adding Nova Client support for auto find host APIv2" 2014-08-21 23:24:49 +00:00
Jenkins cd4428885b Merge "Allow selecting the network for doing the ssh with" 2014-08-21 16:08:41 +00:00
Rafi Khardalian cc4f3dfc9c Enhance network-list to allow --fields
Add the ability to specify --fields, using any valid vields, when
doing a network-list. This code was shamelessly borrowed from
do_list(). This will allow crafting network-list queries which
mirror the functionality of 'nova-manage network list', which this
query was intended to replace.

Change-Id: I7ec7066350cdb979a64d20d14362b12e3ec76496
2014-08-20 18:47:47 -07:00
Juan Manuel Olle fe95fe48fc Adding Nova Client support for auto find host APIv2
Adding nova client functionality to use the auto find
destination host for evacuate.
This change makes the target host optional
on evacuate command.

Partial Implements: blueprint find-host-and-evacuate-instance

Co-Authored-By: Leandro Costantino <leandro.i.costantino@intel.com>
Change-Id: I4e6b52df9c55b223c8693058d73125962cff4d16
2014-08-19 15:38:31 +00:00
Zhengguang 3955440ef2 Fix the return code of the command "delete"
Currently, the command delete return a zero if it failed for any
of servers, the return code should be a nonzero.

Change-Id: If7009fdeb5a60fe2e357bcc447313cbdb7b2ff39
Closes-Bug: #1339647
2014-08-07 02:27:23 -04:00
liaonanhai 9561e620e2 Fix order of arguments in assertEquals
Part 10

Related to: bug #1277104

Change-Id: I582cfcf88def00c6c885ab78f26f2b4fa30c4457
2014-08-04 10:24:47 +08:00
Jenkins 43754f519a Merge "Filter endpoints by region whenever possible" 2014-07-30 17:02:04 +00:00
Jaroslav Henner ff4af92b6d Allow selecting the network for doing the ssh with
Previously, nova ssh was searching for network types: public and
private, which seems to be incorrect (fixed and floating seems to be
correct), causing that this command has probably never worked.

This commit fixes the above and adds an option for selecting the network
to use, which is helpful when there are more networks for the VM.

Change-Id: I01ea6cee725c0feaacab60975c3792b0ac1305e9
Closes-Bug: #1227694
Closes-Bug: #1343991
2014-07-29 13:20:52 +02:00
Jenkins 547af1c481 Merge "Add support for new fields in network create" 2014-07-25 20:20:30 +00:00
Jenkins 8f53274ac6 Merge "Fix booting from volume when using api v3" 2014-07-25 12:57:02 +00:00
Jenkins 8d979cfa4b Merge "Description is mandatory parameter when creating Security Group" 2014-07-25 12:55:28 +00:00
Vishvananda Ishaya c59a0c8748 Add support for new fields in network create
Also adds missing network-delete shell command. Additionally changes
the type of vlan and vlan_start to int to match the api samples.

Partially-implements blueprint better-support-for-multiple-networks

Change-Id: I233614431db4737284cceaf8e6b947f50dd84602
2014-07-15 15:01:44 -07:00
Sanjay Kumar Singh 0ff4afc8e9 Description is mandatory parameter when creating Security Group
As per the bug, description should not be a mandatory parameter
as it creates inconsistency with other opestack items which has
description as an optional parameter.

So in the fix, the description argument has been made optional.
The old command was:
nova secgroup-create <name> <description>
Now new command will be:
nova secgroup-create <name> [<description>]

Patch updated based on the comments received

Updated commit message for gerrit autolink

Closes-Bug: #1332133
Change-Id: I2ded915be4a57f3c46e6cf5d1bf00e8c917cd0b9
2014-07-15 09:58:43 +05:30
Russell Bryant d678dd2955 Revert "Reuse exceptions from Oslo"
This reverts commit 3bde9c3f42.

This change is a part of a series that is not backwards compatible.
It broke applications using the client library.

Change-Id: Id01a0a0feb601539d3855f445ebaf6a3cc000610
Partial-Bug: #1340596
2014-07-14 09:43:44 -04:00
Jenkins 711326a834 Merge "Fix the wrong dest of 'vlan' option and add new 'vlan_start' option" 2014-07-11 01:30:14 +00:00
ozg 3b8f009700 Adding multiple server support to nova reset-state
Adding support specifying multiple servers to nova reset-state in
a single invocation.

Change-Id: I7add0c26b0e59b31751de7a60ebdde3f568b3354
Closes-Bug: #1314217
2014-07-10 10:16:57 -04:00
Yaguang Tang 94beacd7e9 Fix the wrong dest of 'vlan' option and add new 'vlan_start' option
Allow to specify vlan tag when create nova network, the dest of vlan
option should be 'vlan' instead of 'vlan_start'.
Provide new option 'vlan_start' when create nova network.

Change-Id: Idfaf58d4eee4d9bbf6bba5e0b6c9dbf82236694d
Closes-bug: #1329599
2014-07-04 13:35:57 +08:00
Laurens Van Houtven 6ee0b28e64 Filter endpoints by region whenever possible
Previously, the endpoints command just returned the first endpoint. This
was not very useful; people expected to see the endpoints in the region
they specified. This patch does the following:

- If there's only one endpoint, use that.
- If there's a specific one for your region, use that.
- If there isn't, warn, and show the other ones.

Closes-Bug: #1256009
Change-Id: I70b82bdffb9b2e3da415a3bb941bcff287e39789
2014-06-27 16:25:00 +02:00
liyingjun 32d13a6ec7 Add missing parameters for server rebuild
Currently, nova rebuild only support reset: password, image,
preserve-ephemeral. While nova api support other parameters
like: name, metadata, personality. This patch adds these missing
parameters for server rebuild.

Change-Id: I4edd8146bbbb0b2e0c9e01907af5dab96f090029
Closes-bug: 1268435
2014-06-27 02:29:07 +08:00
liyingjun 58cdcabf1c Fix booting from volume when using api v3
The current code in novaclient/base.py, class BootingManagerWithFind
do not take in account the differences required to boot an instance from
a volume in API v3. V3 expects UUID as volume id and also the source type
to be set.

Change-Id: Id8cfb2d7811aead27cb26cf7ff615c7a9ed05d54
Close-bug: 1325303
2014-06-26 05:56:09 +08:00
Jenkins 614f9ebf2b Merge "'policy' should be required in server_group_create" 2014-06-25 05:06:47 +00:00
Jenkins 37f02bde12 Merge "Look for all accessible flavors by default, not just public ones" 2014-06-24 11:07:11 +00:00
Jenkins 1a7f84cb46 Merge ""nova boot" should not log an error if subsidiary commands fail" 2014-06-24 06:33:10 +00:00
Jenkins c63dd3c6b8 Merge "Add some security group tests for the V1_1 API" 2014-06-20 22:33:49 +00:00
Abhishek Chanda a20284ebe8 Add some security group tests for the V1_1 API
This patch adds a test for NoUniqueMatch exception
to the v1_1 API

Change-Id: Ic9947eaed34be100c529f021432f0c388a7c3ddb
Closes-Bug: #1250501
2014-06-20 11:22:42 -07:00
Matt Riedemann 3441007062 Allow updating fixed_ips quotas in quota-class-update (v2 shell only)
The quota-class-update command wasn't allowing updating quotas for
fixed_ips which is a supported key for the os-quota-class-sets API.

This change adds the support to update qoutas for fixed_ips and updates
the existing test to be more robust in (a) the quota keys it's testing
and (b) the request body it's asserting.

This is a v2-only change since the os-quota-class-sets API was removed
from the nova v3 API in Icehouse.

Closes-Bug: #1330571

Change-Id: Ifcca6d00551619b993b96f05134980a4ca2f2acf
2014-06-19 06:09:24 -07:00
Daniel P. Berrange d17253b29a Look for all accessible flavors by default, not just public ones
The Nova server will restrict unprivileged user accounts to just
public images, while allowing administrator accounts access to
all. The Nova client shouldn't force the flavor name lookup to
be restricted to just public images, since that breaks the ability
to the flavor name when booting an instance

Fixes bug #1327212

Change-Id: I949aec52660242249b8cba51d77bfdc1acaf31d2
2014-06-19 12:35:43 +01:00
Jyotsna b78c0d4f46 "nova boot" should not log an error if subsidiary commands fail
Fix:
Intially the cli was raising "CommadError" in case the requested
flavor or image were not present.
This error category was not approrpiate as it signifies an error
in the command syntax. When the requested resource (flavour/image)
does not exist, a ResourceNotFound error should be raised. So,
added a new error category "ResourceNotFound" to cater for this
scenario and updated the code to raise this new error.
"nova show <instance_name>" command has also been updated to raise
"ResourceNotFound" error when the requested vm for which details
have to be displayed does not exist.

Closes-Bug: #1258488
Change-Id: If64a087944586ef5792efe3baa62e455b9bbaa07
2014-06-17 14:48:11 +05:30