792 Commits

Author SHA1 Message Date
Chris Yeoh
59cf27aa3f Adds agent support for Nova V3 API
Adds support and tests for the os-agents extension
for the Nova V3 API

Partially implements blueprint v3-api

Change-Id: I53f8a1cbab6f4dee10fb823bc51ae90baa97fa7a
2013-12-15 22:45:18 +10:30
Chris Yeoh
72b1862c97 Adds flavor access support for Nova V3 API
Adds the remaining flavors support for the Nova V3 API.

Partially implements blueprint v3-api

Change-Id: I46cdec8999f74af37a9ca4280d123907124bad39
2013-12-15 22:44:09 +10:30
Chris Yeoh
9329f435bf Adds flavor support for Nova V3 API
The first part of adding flavor support for the Nova V3 API (support
for flavor-access API calls is still to come).

Restructures v1_1 testcases so as much as possible so they can be
reused for the V3 version of the tests. If it looks too ugly an
alternative would be to just cut and paste the fakes and test
from v1_1 to v3, which is simpler to understand but comes at the
cost of duplicated code. The upside though is it would be much
easier to remove v1_1/v2 support in the future.

Partially implements blueprint v3-api

Change-Id: Ic7cb3c43db02c07d37aea2675b310aaa50639c40
2013-12-15 22:42:48 +10:30
Sushil Kumar
3ecaeb416e Enables H306 pep8 rules
Updates tox.ini to reduce ignored rules.

Updates code for H306 violation.

Change-Id: I9beea02510a1122afb55ad3df3b37f770fe05134
2013-12-12 17:43:08 +00:00
Jenkins
dc1aeac79a Merge "Adds a --show option to the image-create subcommand" 2013-12-11 18:37:51 +00:00
Jenkins
fdee7c18a6 Merge "Sets default service type for Nova V3 API" 2013-12-08 13:27:40 +00:00
Jesse Andrews
879c91d9d3 add support for server set metadata item
add set_meta_item to the servers python API as specified by the 1.1 API

Change-Id: I01c92cde18656b23b45aedd41c50d3a474d91435
2013-12-06 10:03:04 -08:00
Chris Yeoh
50685437ed Enable hacking check for Apache 2.0 license
Removes H102 (license header not found) check from flake8
ignore list.

Adds missing apache license headers.

Change-Id: I109f23c6d8b2e3efb1dac7f764bd77e0d9d335f0
2013-12-06 10:47:41 +10:30
Jenkins
5b3a94aba8 Merge "nova security-group-* should support uuid as input" 2013-12-03 15:35:26 +00:00
Chris Yeoh
fe7ac8800d Sets default service type for Nova V3 API
Set the default service type when talking to the Nova V3 API to
computev3 rather than compute. Although it is rather ugly to have
a different service type for a different version of a service,
this is necessary for the medium term because traditionally the
compute service endpoint has pointed to the V2 API rather than
the root and then version discovery done.

This change allows progression of the V3 API support in
novaclient and although devstack too currently points computev3
directly to the V3 API, the intent is to change this to point to
the root and implement version discovery during the Icehouse
development cycle.

Longer term when the V2 API support is eventually removed we can
reclaim the 'compute' service type and point it to the root.

Partially implements blueprint v3-api

Change-Id: If5d6a0d8af037cde7bf253d71aac2823b89f8066
2013-12-03 16:32:12 +10:30
Chris Buccella
a8756c4007 Adds a --show option to the image-create subcommand
Prints info about the new image when --show is used with the
image-create subcommand.

Change-Id: Id1fba67df9ff86cb1bbda3e241d1d03e01afbe2c
Closes-Bug: 1248128
2013-12-02 19:44:15 -05:00
Florent Flament
fabbc87bf2 Allows users to retrieve ciphered VM passwords
This patch allows users to retrieve VM encrypted passwords using the
`nova get-password` command without specifying the private key.

Change-Id: I13ea132160dca912c6c1643b1006377982b778a1
Implements: blueprint retrieve-ciphered-vm-password
2013-11-27 17:26:39 +01:00
Jenkins
dc0aacfd04 Merge "Flatten hypervisor-show dictionary for printing" 2013-11-14 07:50:57 +00:00
Jenkins
9088e29d06 Merge "Print security groups as a human readable list" 2013-11-14 07:50:56 +00:00
Haomeng, Wang
6528d9944b nova security-group-* should support uuid as input
If we installed neutron, the security-group request will be handled
by neutron, however neutron is using uuid as key for security-group,
nova uses an int value as key, for current novaclient, it only
support the security-group which key is int, so will raise exception
for uuid input.

Change-Id: Ia230d12a1b4905434024b1a5129aa91cff7e6a5b
Closes-Bug: #1247728
2013-11-13 09:46:35 +08:00
Joe Gordon
3978172012 Fix single H234 Bug to make Hacking 0.8 pass
Jenkins patch I96b53ce825ca0f940596f53058b8e3c80463ac3c introduces
hacking 0.8, this fix the one bug.

Change-Id: Ib4ee60b4de32c59cb3552091f0ce50f366fe0879
2013-11-08 15:42:17 +08:00
Russell Sim
a89159a6e3 Flatten hypervisor-show dictionary for printing
Flatten the nested dicts so that hypervisor information can be more
easily used at the command line.

Change-Id: I5dfcf9d10f917a63bde09f0b5a691784a5e8f02b
Closes-bug: #1243512
2013-10-29 09:02:13 +11:00
Sean Dague
1d2263dae3 Revert "Nova aggregate-details should be more human friendly"
This reverts commit 6374ee04a378b8a970f9e429d66eb37c969bbf7b.

Change-Id: Ib27cc6722ea7cc8cb9b133360b3ecb246a0e4a14
2013-10-28 08:12:16 -04:00
Russell Sim
b68517ce83 Print security groups as a human readable list
Convert the security group list into a list that is more suitable for
printing.

Change-Id: I411d9256145986fad7659a9377494e29a6d70ced
2013-10-28 19:59:11 +11:00
Jenkins
a1391b2ead Merge "Nova aggregate-details should be more human friendly" 2013-10-28 06:57:07 +00:00
Jenkins
962c403791 Merge "Align mocking pattern for test case" 2013-10-28 06:40:30 +00:00
Sahid Orentino Ferdjaoui
6374ee04a3 Nova aggregate-details should be more human friendly
'nova aggregate-details' shows Hosts, Availability Zone
and Metadata in the python unicode notation.

Change-Id: If0028347146439994265c60c429af05dd67912f9
Closes-Bug: #1132961
2013-10-25 17:46:19 +02:00
Jenkins
ae418392bb Merge "Revert "Add-in some re-auth logic when using os_cache"" 2013-10-15 20:24:00 +00:00
Joe Gordon
cbed4887c9 Revert "Add-in some re-auth logic when using os_cache"
This patch didn't do what it was supposed to do, make os_cache work. Instead it just adds complexity, so just remove it.

This reverts commit 8eed73ce20ff0808d350fc9af66d6ba55ebda017.

Change-Id: I7c118cbf8d8e2218e198d603f1984a9de18266c4
2013-10-10 08:14:50 +00:00
Kui Shi
b1e3753fdf Align mocking pattern for test case
Mock sys.stderr/sys.stdout with mock.patch()

In novaclient/tests/test_shell.py, ShellTest.shell(), it is another
case that should be aligned. But it may induce test error if changed.
So, let's keep it as is.

Close-Bug #1237093

Change-Id: I8908dc1593dbbbaf2813cc8fb034be32972140a0
2013-10-08 17:11:52 +08:00
Kui Shi
5f0363ad9d py33: use six.StringIO() to mock stdout/stderr
six.StringIO() is the right way to keep Python2/3 compatibiliby
while mocking stdout/stderr.

Close-Bug #1235086

Change-Id: I33d9223b2202896331d24339056d57d4ca9acdc5
2013-10-04 17:48:57 +08:00
Jenkins
9f928b29f9 Merge "py33: unify the input of request to json format" 2013-10-04 19:56:44 +00:00
Kui Shi
e5a193ac43 py33: unify the input of request to json format
In novaclient.client.HTTPClient.request, json.dumps() process the
body of "POST":
kwargs['data'] = json.dumps(kwargs['body'])

So, in test case, we should pass the same forat for mock.call().

Also, transform the "data" variable to json format.

Close-Bug #1234067

Change-Id: I3a0abaa8064b4360cb94b7b205454e26bddef8e4
2013-10-03 21:32:22 +08:00
Kui Shi
2c32e71720 py33: align the order of parameters for urlencode()
In Python 3.3, hash randomization is enabled by default. It causes the
iteration order of dicts and sets to be unpredictable and differ across
Python runs.

In the test case, the fixed expecting string will not match the test
result, it is relying on the dict order.

This change transforms the input dict to a sequence of two-element list,
with fixed order, and update the related expecitng string in test case.

Close-Bug #1234438

Change-Id: Ic7846279a9f508a856cd4ee70408d537088792f2
2013-10-03 16:30:25 +08:00
Jenkins
bec7d872a5 Merge "py33: sort dict for test_add_floating_ip_to_fixed" 2013-10-02 21:17:35 +00:00
Jenkins
af1f030ea6 Merge "py33: 'str' does not support the buffer interface" 2013-10-02 21:17:31 +00:00
Jenkins
f3bad8acee Merge "Add-in some re-auth logic when using os_cache" 2013-10-02 21:17:21 +00:00
Jenkins
d06b344dc7 Merge "Add shelve/unshelve/shelve-offload command" 2013-10-02 21:17:09 +00:00
Jenkins
350ba51aea Merge "assertEquals is deprecated, use assertEqual" 2013-10-02 20:14:10 +00:00
Jenkins
02886e2a4a Merge "py33: align the order of parameters for urlencode()" 2013-10-02 20:14:07 +00:00
Jenkins
397db8a79b Merge "py33: unknown encoding: base64 Edit" 2013-10-02 19:35:35 +00:00
Kui Shi
f7462f14a4 py33: sort dict for test_add_floating_ip_to_fixed
In Python 3, hash randomization is enabled by default. It causes the
iteration order of dicts and sets to be unpredictable and differ across
Python runs.

Sort the list and update the expecting result.

Close-Bug #1233406

Change-Id: Ib747824dad340534d484797afb87b5e92200e426
2013-10-02 07:06:30 +08:00
Kui Shi
0e3278d3a8 py33: 'str' does not support the buffer interface
Binary I/O expects and produces bytes objects. If sys.stdout is
assigned to io.BytesIO, print() output it stdout by default, then
there will be "TypeError".

For this case, mock.patch() decorator can not work well casually.
So this patch just update the six.StringIO() for stdout/stderr.

Close-Bug #1229163

Change-Id: Ieb29ad0774c9b7f2b691628d753b210640baca8d
2013-10-01 06:31:29 +08:00
Dirk Mueller
ebee5e91b7 assertEquals is deprecated, use assertEqual
Change-Id: I9b2aaed969b046e0203ffa0c7278dff206cb8cd2
2013-09-30 22:25:17 +02:00
Kui Shi
ecdd79b04a py33: align the order of parameters for urlencode()
In Python 3, hash randomization is enabled by default. It causes the
iteration order of dicts and sets to be unpredictable and differ across
Python runs.

In the test case, the fixed expecting string will not match the test
result, it is relying on the dict order.

This change transforms the input dict to a sequence of two-element list,
with fixed order, and update the related expecitng string.

Close-Bug #1231871

Change-Id: Ia998cdb6978fc024dd0d3c9bd161fbdebe68638a
2013-09-30 16:22:40 +08:00
Ken'ichi Ohmichi
ffb83222e5 Add shelve/unshelve/shelve-offload command
The "shelve" API, which powers off and snapshots a vm instance, has been
implemented by Nova-server side.
In addition, thare are two relational API "unshelve" and "shelveOffload".
This patch adds three commands for using these APIs.

Fixes bug #1231827

Change-Id: Ic2ad1bb537efb40a3155e9f3c7b63e09e82be7f1
2013-09-30 08:39:44 +09:00
Morgan Fainberg
8eed73ce20 Add-in some re-auth logic when using os_cache
When using os_cache for the auth_token, if username and password
are available when a token fails to validate/authenticate, attempt
a reauth behind the scenes.

The helper object for stashing the auth_token doesn't handle flushing
the cache.  This is valid behavior because the result would be the
same as if a bad username/password were issued (401 Unauthorized).

Fixes-bug: 1214658
Change-Id: I107fc999610bb7638cefcb5d195aeafdcd663ca6
2013-09-26 10:06:54 -07:00
Nicolas Simonds
9ff60119ed if we have a valid auth token, use it instead of generating a new one
If authenticating with a valid token (i.e., token auth, not
username/password auth), novaclient would instruct keystone to issue
a new token with an identical expiry to the one used, and pivot
onto it.  This makes it appear as though Nova is leaking Keystone
tokens.

Since there's zero benefit to issuing a new token that is ostensibly
identical to the perfectly good token used to authenticate, make
novaclient keep using the token it already has after successful
validation, and not issue a new one.

This patch set adds a new pair of tests to the
AuthenticateAgainstKeystoneTests class, which parrot the current
authentication pass/fail tests, but exercise the new code paths

Also adds a fix by Joe Gordon to make os_cache work correctly.

Change-Id: Ic4f0e6d506d8d81f0b1d46138e7e19d3b3392e1d
Fixes: Bug 1197201
Related-Bug: 1214658
2013-09-25 17:06:18 -07:00
Kui Shi
8b264fc61d py33: unknown encoding: base64 Edit
Python 3 doesn't support str.encode('base64'), we should use the
module "base64" instead.

Close-Bug #1229161

Change-Id: I1432952558f8c5c3cff39761306e91916d80207f
2013-09-25 06:24:14 +08:00
Alex Gaynor
991ab62ef1 Fixed several test failures on Python3
- Corrected places where `dict.keys()` was being treated as a list
- Corrected usage of `urllib.urlencode()`

Change-Id: I0a24b2f64fab6c905e20073ff7ebaa3c5ffe7c90
2013-09-23 17:55:24 -07:00
Jenkins
4a68e2f42c Merge "Corrected several usage of keys() for Python 3" 2013-09-24 00:24:21 +00:00
Jenkins
e1dcf8f982 Merge "py33: dict.keys() is not a list in python3" 2013-09-24 00:24:20 +00:00
Kui Shi
ac79703213 py33: dict.keys() is not a list in python3
Cast the dict.keys() to list when comparing its value with list.

Closes-Bug: #1228993

Change-Id: I59d13258935de3e9286845f857eaa602a5b690fb
2013-09-23 00:16:33 +08:00
Alex Gaynor
35e03a92e2 Corrected several usage of keys() for Python 3
Under Python2 dict.keys() returns a list, under Python 3 it returns an
iterator. Some places assumed that if they called keys() then it was
safe to modify the dict in a loop. Corrected this by calling list().

Change-Id: I7638263f288dd20590bd751d09194a919b921545
2013-09-22 09:04:20 -07:00
Kui Shi
f1c3b79c2b py33: 'dict_keys' object does not support indexing
In python 3, dict.keys() is a class of 'dict_keys', it does not
support indexing.

Cast the dict to list to get the "first" value of dict, which is
compatible with python 2&3.

Closes-Bug: #1229005

Change-Id: I561b7ada9e5ad936659a657b3161a9b93a15a788
2013-09-22 23:55:46 +08:00