832 Commits

Author SHA1 Message Date
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
Sean Dague
de4e40a754 add ips to novaclient server manager
This exposes the ips Resource from the nova server manager which the
infra team believes will help them optimize some of their API load on
various clouds.

Change-Id: I00730dc809ae4e86d728e2ec76bfb38024d7634e
2015-04-21 12:40:53 -04:00
Sean Dague
420dc2884a refactor functional test base class to no inherit from tempest_lib
Test base classes inheriting outside the existing source tree to
anything higher up the stack than testtools is really an anti
pattern. It makes it *far* less clear what is going on. We really need
to own and understand our base class setup for tests.

This does that unwind, so that we only now call out to tempest_lib in
specific ways (like building clients, using decorators). The timeout
and log capture pieces are pulled inline.

At the end of this we end up with a base test that defines:

 - self.client - a Nova API client
 - self.flavor - a workable flavor for booting guests
 - self.image - a workable image for booting guests
 - self.cli_clients - tempest_lib cli clients

Change-Id: I716be51d7d1825a757934298f06b2f04d64cf0dd
2015-04-21 11:06:00 -04: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
ZhiQiang Fan
1c39f8fabf Don't record time when self.timing is False
The expected behavior is when timing is True, then we record each
request's time, then we should call reset_timings() to release memory.

However, the shell, client.{HTTPClient,SessionClient} will record each
request's time no matter what timing is set, then after long running
time in service like ceilometer-agent-compute, the memory keeps increasing.

We'd better not record request's time when timing is set to False.
Users are not responiable to call reset_timings() when they don't want
timing functionality.

Change-Id: I3e7d2fadf9a21be018781d528a1b6562228da6dd
Closes-Bug: #1433491
2015-03-21 19:27:36 +08:00
jichenjc
8679eedb83 Revert 'Remove image to local block device mapping'
https://review.openstack.org/#/c/153203/3 added check
for novaclient, removed the logic for both
--image and --block-device are added.

But actually the following valid boot command failed
due to the change here, so this patch reverted original
one and add some descriptions to avoid further removal.

nova boot test-vm --flavor m1.medium --image centos-vm-32
--nic net-id=c3f40e33-d535-4217-916b-1450b8cd3987
--block-device id=26b7b917-2794-452a-95e5-2efb2ca6e32d,bus=sata,
source=volume,bootindex=1

Change-Id: Ia29e63c72b34d3038aa591c466425e65edf5755b
Partial-Bug: #1433609
2015-03-19 22:58:17 +08:00
melanie witt
e0f5072907 Ensure the use of volume endpoint in volumes apis
Currently, several of the volumes apis depend on callers to pass
service_type='volume' as a parameter when creating a client object,
to route correctly. The problem is, it makes it impossible for
callers to work with both the compute and volume endpoints at the
same time. They can either work with compute and have volumes.* calls
return 404, or they can work with volume and have servers.* images.*
flavors.* calls return 404.

The CLI sets service_type='volume' for client objects for the
following commands via a decorator:

volume-list
volume-show
volume-create
volume-delete
volume-snapshot-list
volume-snapshot-show
volume-snapshot-create
volume-snapshot-delete
volume-type-list
volume-type-create
volume-type-delete

With this change, the service_type 'volume' is set in the api,
so the decorators on the shell commands are no longer needed.

Closes-Bug: #1431154

Change-Id: I11b48ac14fa4c64d8aae528552ec5b363be384c5
2015-03-17 01:19:11 +00:00
Jenkins
5e0e430d00 Merge "Add a test for the TCPKeepAliveAdapter" 2015-03-12 18:32:40 +00:00
Jenkins
b4fc9e0d2c Merge "nova client cinder query param changed to display_name" 2015-03-12 18:32:26 +00:00
melanie witt
8c0baaea57 Add a test for the TCPKeepAliveAdapter
Related-Bug: #1430935

Change-Id: Idfea26c8eb6448a4c6adc0f3a916515bd4655c1a
2015-03-11 21:03:25 +00:00
Jenkins
3db98546cf Merge "nova flavor-show command is inconsistent" 2015-03-11 20:14:17 +00:00
Anand Shanmugam
41ef74971e nova client cinder query param changed to display_name
nova client is not able to show the list of volumes when
querying by name.This is because cinder api accepts only
display_name as query parameter and when qeried with 'name'
parameter returns a empty list

Change-Id: Ie4ffc275d1754052d9e239d8457baf6f7fd53b83
Closes-Bug: #1430415
2015-03-11 20:48:46 +05:30
Abhishek Talwar
4e79285b45 nova flavor-show command is inconsistent
The nova flavor-show command accepts a flavor
name as its parameter. The command show inconsistency
as it works with the exact flavor name and flavor name
in all lowercase but fails for any other case pattern.

So, updated the code so that if we run the command
with flavor-name case patern it runs fine.

Closes-Bug: #1423885
Change-Id: I713bf2b5aca977df40dc745e29d4fe98a950c991
2015-03-11 09:52:44 +05:30
Joe Gordon
cf03aeb436 Add functional testing README
Outline the background and goal of the functional testing.  Want to make
sure there is consensus on how this should look. Next step is to
reorganize the functional tests to follow the plan outlined here.

Change-Id: I1d6889682f50f78b0681c99b77475adba95ef807
2015-03-09 14:41:02 -07:00
Jenkins
6c59d708ce Merge "Cleanup in asserts in python-novaclient" 2015-03-03 22:50:56 +00:00
Jenkins
9c719d17d4 Merge "Moved set of asserts from post_servers_1234_action methods." 2015-03-03 17:59:08 +00:00
Pavel Kholkin
560eeafb6d Cleanup in asserts in python-novaclient
The following replacements were done:

1) assertEqual(True, *) -> assertTrue(*)
2) assertEqual(False, *) -> assertFalse(*)
3) assertTrue(a in b) -> assertIn(a, b)
4) assertTrue(* is not None) -> assertIsNotNone(*)

TrivialFix

Change-Id: I8d8a2d7b5d3505e07728544b683b301d1a8850cf
2015-03-03 15:36:49 +03:00
Pavel Kholkin
9f4d64a1bf Cleanup in test_images and image_fakes
Unused code was removed in fixture_data/images.py
for unknown image requests that relate to
v2/images.py and test_images for them.

Change-Id: I7e31a572116b1e5cf0df9f431f8e53470d27d066
2015-03-02 19:07:46 +03:00
Sergey Nikitin
53f0c5428f Enable check for E124 rule
Fix E124 failures and enable check for E124

E124 closing bracket does not match visual indentation

Change-Id: Iec6af44362dcf613cfaccbccbe53de82aba51a6a
2015-02-27 16:30:03 +03:00
Jenkins
7a1066fb79 Merge "allow --endpoint-type internal|admin|public" 2015-02-26 01:21:18 +00:00
yatin karel
e6883d24d0 allow --endpoint-type internal|admin|public
other openstack clients like glance, cinder  use --endpoint-type
(internal|admin|public). This allows users to use the same arguments
with the nova cli.

Partial-bug: #1367389

Change-Id: Ia55cad797ac0dca7fa60f55c1f2dfba0b64d0fd3
2015-02-25 10:02:41 +00:00
Pavel Kholkin
f2a581ee28 Fixed redeclared test_names
Fixed redeclared test_names for two test functions that pass now:
 1) 'test_list_security_groups_all_tenants_on'
 2) 'test_find_by_str_name'

Small spelling corrections

TrivialFix

Change-Id: Iacb0ce5697779f9342c22a22cb2f29a8e063b459
2015-02-24 19:29:23 +03:00
Sean Dague
be41ae238d add functional test for nova volume-attach bug
This is a functional test that boots a server via the cli, creates a
volume, and tries to attach it via the cli (which causes a failure due
to completion cache code). Note: the failure actually happens *after*
the attach command is dispatched, so the volume attach will still
work, the user is presented an error though.

Many TODOs remain for future patches. The test also tries to document
what was learned about the CLI redirection to cinder API, which was
introduced when Cinder was split out, but was tribal knowledge that
was lost in the mists of time.

Related-Bug: #1423695

Change-Id: Iaf474298be135843bff0114cf211bee19762f3ad
2015-02-23 17:21:52 -05:00
Andrew Laski
ac6636a54d Revert "Overhaul bash-completion to support non-UUID based IDs"
This reverts commit 4c8cefb98a425382204df2f38f24e6b5b71520dd.

The cache completion was causing a bug where 'nova volume-attach' would
then try to query Nova for volume information using a URL that was not
valid.  This caused it to appear that the attach had failed.

Additionally the idea of making extra API queries for a bash completion
cache should be thought through more.

Conflicts:

	novaclient/client.py
	novaclient/shell.py
	novaclient/v2/client.py
	novaclient/v3/client.py

Closes-Bug: #1423695
Change-Id: I6676a11f9b5318a1cda2d03a5d4550bda549d5c2
2015-02-20 01:35:57 +00:00
Haiwei Xu
dfc752d725 Change commands name from net-* to tenant-network-*
Currently the commands of os-tenant-network API use net-*
which may confuse users sometime. This patch changes commands
to tenant-network-*, and marks net-* commands as DEPRECATED.

Closes-Bug: #1152862
Change-Id: I8c3a0be08763a6f626d7fc7cf84811ac61ccc526
2015-02-13 17:47:18 +09:00
Jenkins
b53a5e5ab1 Merge "Copy functional tests from tempest cli read only" 2015-02-12 00:39:26 +00:00
Joe Gordon
27cd393028 Copy functional tests from tempest cli read only
Copy tests in from tempest/cli/simple_read_only/compute/test_nova.py in
preparation for removing that file.

Change-Id: I5a34cf1a39d4f73f94a27cce365434bd4a0eea0b
2015-02-11 14:55:26 -08:00
Jenkins
3870216567 Merge "Add all tenants search opt to del instnce by name" 2015-02-10 17:29:27 +00:00