830 Commits

Author SHA1 Message Date
Vitaliy Kolosov
3523ba90f6 Unittests added for client v1_1
Unittests test_client_set_management_url_v1_1 and
 test_client_get_reset_timings_v1_1 added.
 New methods covered:
 * client.set_management_url()
 * client.get_timings()
 * client.reset_timings()

Change-Id: I46cac01864a11fbaffc284d26f63b8e00f2631f0
2013-09-09 12:14:09 +03:00
Chuck Short
28f9773420 Python3: Use six.StringIO for io.Bytes()
The newer version of six (1.4.1) provides six.StringIO which
is a fake file object for textual data. It's an alias for StringIO.StringIO
in python2 and io.StringIO in Python3.

Use the fake object where approiate.

Change-Id: I364001933b4f2305ac27b293a9a4a3fec36c8a49
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-09-07 12:28:46 -04:00
Ken'ichi Ohmichi
bec4e51df4 Add delete method to Flavor class
In tempest, some tests use delete() method of each resource class
(Server, SecurityGroup, etc.) for cleaning up when each test finishes.
Now we are adding some tests, which create a Flavor instance, to tempest
and we need the delete() method of Flavor class.

Fixes bug #1218156

Change-Id: I210d62aa45510858346315046cf57ea7b1de7b7b
2013-09-06 08:30:47 +09:00
Xavier Queralt
6a85c954c5 New syntax to boot from a block device mapping
Add new arguments and syntax for booting from a block device mapping
that use the new os-block-device-mapping-v2-boot extension. These
allow to:

 * boot from an image, volume or snapshot (--image, --boot-volume, --snapshot)
 * attach any type of block device (--block-device).
 * attach an swap disk on boot (--swap).
 * attach an ephemeral disk on boot (--ephemeral).

blueprint: improve-block-device-handling

DocImpact

Change-Id: I1aadeafed82b3bd1febcf0d1c3e64b258d6abeda
2013-09-04 17:12:21 +02:00
fujioka yuuichi
97da33fcf5 Allow name argument to flavor-access-add
Administrator cannot use the flavor name in arguments of
"nova flavor-access-add" and "nova flavor-access-remove".

This patch fixes this problem.

Change-Id: I68b267dc071382f1978efc2088cd8e837455e8b4
Related-Bug: #1205298
2013-09-03 02:07:35 +09:00
Jenkins
d770bb3aab Merge "Add interface for listing security groups of an instance" 2013-09-01 14:06:10 +00:00
Russell Bryant
69f8de69d5 Add support for os-assisted-volume-snapshots
This patch adds support for the assisted volume snapshots API extension.
This is used by Cinder to ask Nova to perform a volume snapshot on its
behalf.  It's required when the volume is actually file backed (like
qcow2) and the hypervisor needs to be involved in the snapshot
operation.

Required for blueprint qemu-assisted-snapshots

Change-Id: I50ee9bf92c8de98528638d1724fe35e07bed729e
2013-08-31 11:19:18 -04:00
Yufang Zhang
756a4333e6 Suport instance list pagination in novaclient, Part I
Bug 1209242

nova-api has supported pagination for long. A marker and limit
option could be passed to nova-api to get a slice of instances.
It makes sense to enable this feature in novaclient, so that
horizon could use it for pagination supporting. Modification to
shell.py would be submitted in a separate patch.

Further change will also pass 'sort_key' and 'sort_dir' to
nova-api, as long as nova supports this.

This is part of blueprint support-pagination-for-instance-list

Change-Id: Ieb5f2c1eb31b9f7e95b62b51ea7dc338e3970d04
2013-08-30 14:10:46 +08:00
Jenkins
72c0a13b0a Merge "Added 'nova migration-list' command" 2013-08-29 14:26:17 +00:00
Noorul Islam K M
12d5b9578b Add interface for listing security groups of an instance
This is already available in nova but not exposed via client.

* novaclient/v1_1/servers.py:
   New interface to list security groups of an instance.

* novaclient/v1_1/shell.py:
   New sub command list-secgroup.

* novaclient/tests/v1_1/fakes.py,
  novaclient/tests/v1_1/test_servers.py,
  novaclient/tests/v1_1/test_shell.py:
   Add corresponding tests.

Implements: blueprint servers-list-secgroup

Change-Id: I505bcffdbb15b84bfd73cae5ef5a8fb9c69bd7b9
2013-08-29 09:40:35 +05:30
Chuck Short
c450b39828 python3: Fix imports for py2/py3
Python3 reorganized the standard library and moved several functions
to different modules. Six provides a consistent interface
to them through the fake six.moves module.

However, the urlparse, urllib2, etc modules have been combined
into one module which Six does not support so we do it via
py3kcompat.

Modules such as StringIO and CStringIO have been removed
completely so we use the io module.

Change-Id: I53adac11b634de2c710fc39def36bcec96366710
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-08-27 14:50:34 -04:00
Jenkins
27700f9b36 Merge "Allow name argument to flavor-access-add" 2013-08-23 01:33:06 +00:00
Jenkins
6d73abaf8a Merge "Add support for swap_volume" 2013-08-22 05:21:33 +00:00
Mahesh Panchaksharaiah
3c2a817efc Added 'nova migration-list' command
This command lets Admin's list migrations by applying filters

Implements: blueprint list-resizes-through-admin-api
Change-Id: I587c62dab537186cfc8b387fbc46cdb56fb9976c
2013-08-20 16:38:57 -05:00
Yuuichi Fujioka
476e50f4d7 Allow name argument to flavor-access-add
Administrator cannot use the flavor name in arguments of
"nova flavor-access-add" and "nova flavor-access-remove"
in following conditions.

1. The flavor is non-public.
2. The falvor doesn't belong administrator's tenant.

This patch fixes this problem.

Change-Id: Ic5e3222d0ff62667e003a61e6a94e85833da5d11
Fixes: bug #1205298
2013-08-15 03:06:51 +09:00
Jenkins
01635a2add Merge "FakeClient: fix the arguments of a string format." 2013-08-12 22:16:47 +00:00
Jenkins
9114cbfb8e Merge "Do not restrict flavor to only ID and integers" 2013-08-08 01:46:00 +00:00
Chmouel Boudjnah
f7d3948b23 Do not restrict flavor to only ID and integers
- Flavors with strings and not just ID/UUID strings are valid.
- Closes-Bug: 1209060

Change-Id: Idee389fce40f8982b263e1a4349a8565140b6584
2013-08-07 19:02:00 +02:00
Avishay Traeger
930a10abf9 Add support for swap_volume
Add client support for swap_volume, which allows swapping a volume
currently attached to an instance with a different volume which is not
attached. The contents of the old volume will be copied onto the new
volume. This was added in nova commit
8f51b120b430c7c21399256f37e1d8f75d030484.

Change-Id: I98323d594617c1c435e403d9f3ddc4ff4fa74da6
2013-08-05 12:30:33 +03:00
Cyril Roelandt
1f85f57faf FakeClient: fix the arguments of a string format.
Fix the number of arguments in the string format in
FakeClient.assert_called_anytime().

Change-Id: I9d415d6d216a6e301254ba21b63109182d71e8bd
2013-08-02 15:34:37 +00:00
Brian Elliott
0d454089c9 Support programmatic use of disk config extension
Allow servers to be created, resized, and rebuilt with the disk_config
option:

http://api.openstack.org/api-ref.html#ext-os-disk-config

There is a separate extension that exists for disk config already, but
it only works via the novaclient CLI interface, not via programmatic use
of python-novaclient as a library.

assert changes in tests/v1_1/fakes allow for other data in rebuild
and resize requests.

Change-Id: I8051ffb8747cf5c67b0199d22fbbe80306b01499
2013-08-01 13:54:56 -05:00
Jenkins
4ab2b60850 Merge "Fixing host-action on V2" 2013-07-31 05:32:45 +00:00
Sumanth Nagadavalli
7fdb52ac74 Fixing host-action on V2
Changed host-actions to GET from POST for reboot, startup
and shutdown, as per nova-api reference documentation.

Change-Id: I863b75960b2e427fd9384a336727132ca3c130c6
Fixes: bug #1206425
2013-07-30 15:09:09 +05:30
liyingjun
8b5dcee15e Add user quota client API support
Implements blueprint user-quota-related-client-api

    This patch adds user arguments to the following subcommands:
        * quota-show
        * quota-update
        * quota-delete

Change-Id: I6556de366a758f7550e9b26357f231666caae419
2013-07-30 10:59:25 +08:00
Christian Berendt
5fe9408d2e make findall in novaclient/base.py more efficient
Use /resources instead of /resources/detail to resolve
the resource ID by the name and load the details of the
resource in a separate step. This reduces the overhead
to resolve the resource ID and results in a better runtime
performance.

This patch does not solve the issue that the name resolving
takes place on the client side. For solving this issue new
Nova API methods are necessary.

fixes bug #1202179

Change-Id: Ib753b1d090cb74b2d137c68f6899dad4ae2ec1ca
2013-07-29 10:52:22 +02:00
Jenkins
2a45c7570f Merge "Enable force_delete and restore instance via novaclient." 2013-07-27 14:57:30 +00:00
Jenkins
d5687acff6 Merge "Add name argument to hypervisor commands" 2013-07-26 09:28:55 +00:00
Jenkins
3bc9cee729 Merge "Add name argument to aggregate commands" 2013-07-26 09:28:08 +00:00
Jenkins
2a19ba3031 Merge "make v2_auth and plugin_auth explictly return their results" 2013-07-23 21:40:16 +00:00
Jenkins
58d436ed88 Merge "Skip setting volume_size if not given" 2013-07-23 01:01:32 +00:00
Yufang Zhang
cc2c0a8e6f Enable force_delete and restore instance via novaclient.
Bug 1195670

Nova supports force_delete or restore instance in the API level,
thus it makes sense to support this feature in novaclient.

Change-Id: I7cc3d2d2a7ab8dfe043176a3ea97c10deae683c9
2013-07-22 21:24:49 +08:00
Ken'ichi Ohmichi
4025b7e5e3 Add name argument to aggregate commands
Fixes #Bug 1202901

This patch adds name arguments to the following subcommands:
 * aggregate-update
 * aggregate-delete
 * aggregate-set-metadata
 * aggregate-add-host
 * aggregate-remove-host
 * aggregate-details

Change-Id: I93f44a12b6d5a91b448f6f8d238311d58bf40c01
2013-07-22 10:04:09 +09:00
Ken'ichi Ohmichi
de250bf170 Add name argument to hypervisor commands
Fixes #Bug 1202920

This patch adds name arguments to the following subcommands:
 * hypervisor-show
 * hypervisor-uptime

Change-Id: I9adfb699775d2d8f8ca45a7a28621e634bc03055
2013-07-22 09:44:53 +09:00
Jenkins
32f38fe19e Merge "Allow tenant ID for authentication" 2013-07-18 21:51:19 +00:00
Dirk Mueller
af7ca70e3e Fix and enable gating on H402
End one-line docstrings with punctuation.
Change them to command style where necessary.

Change-Id: I8ff689c3a2f20d489286f80112c6dc95c97f2f31
2013-07-17 15:44:05 +02:00
Jenkins
0c775cbd78 Merge "Add AgregatesManager.get()" 2013-07-16 21:05:33 +00:00
Jenkins
ca56219a71 Merge "Remove uncessary code related to nova start/stop" 2013-07-16 21:05:30 +00:00
Jenkins
74506b83fe Merge "CLI for disable service reason" 2013-07-15 17:50:40 +00:00
Dean Troyer
c360c3e8da Add AgregatesManager.get()
utils.find_resource() uses manager.get() as part of converting Resource
names to IDs.  AggregatesManager had get_details() instead of get().

Add AggregatesManager.get(), leaving .get_details() in place for backward
API compatibility.

Bug: 1200341

Change-Id: I7d238bbe43e1760e31f1a9ba783c668246f20844
2013-07-11 14:26:01 -05:00
Dirk Mueller
f50ff361e2 Skip setting volume_size if not given
When the block-device parameters skip volume_size,
don't set it. Setting to an empty volume_size
would be invalid as it has to be an integer,
and Nova API will reject the request if api validation
is implemented. (proposed e.g. at
https://review.openstack.org/#/c/34749/)

Fixes bug LP #1199539

Change-Id: I7ab518886abf8d449caf1c70563a79a990d7765e
2013-07-10 17:09:38 +02:00
Jenkins
a45c49bafc Merge "python3: Fix unicode compatibility python2/python3" 2013-07-10 04:09:58 +00:00
Xiao Hanyu
b5c91018e0 Remove uncessary code related to nova start/stop
'nova start' and 'nova stop' actually send request with 'os-start'
and 'os-stop', instead of 'start' and 'stop'.

Change-Id: I1472e1b648dae8f3b281a113adb60421a00e5a48
2013-07-09 14:31:16 +08:00
Nicolas Simonds
912288c486 make v2_auth and plugin_auth explictly return their results
In cases where the respective authentication methods return
non-NoneTypes, (e.g., HTTP 305 redirects) they would get dropped
on the floor previously.

This patch set splits the test_auth_redirect unit test into two
nearly-identical unit tests to exercise the different code paths.
Without the patch, the test_v2_auth_redirect unit test fails with
an HTTP 401 error

Change-Id: I2018bc5b73ce86d6d5383958375d5dbbde2e763c
Fixes: Bug 1197191
2013-07-08 16:49:04 -07:00
Sulochan Acharya
d095b8a335 CLI for disable service reason
Adds cli option to allow users to give reason
for service-disable. Also adds disabled reason
as a column in service list, so any disabled service
can be seen with reason.

A recent nova change that allows disable-log-reason
allows users to provide reason for disabling service.
This just adds the cli option for the method.

Blueprint record-reason-for-disabling-service

Change-Id: If263788c34279d6b4c568d5e0320448d2ff67a12
2013-07-03 13:14:36 -05:00
Phil Day
02f906bcd6 Allow tenant ID for authentication
Tenant names are not necessarily unique for a User, so the client
should also allow authentication by tenant_id

If both ID and Name are specificed then use the ID

Fixes bug 1195454

Change-Id: Ib62aabc3702db88f02259cd721f9efb31404bcb7
2013-07-03 16:05:13 +01:00
Jenkins
c865cee9a1 Merge "Bring stdout/stderr capturing in line w/ nova" 2013-07-01 06:11:18 +00:00
Jenkins
0bf5f49bcb Merge "Fixup trivial License Header mismatch." 2013-06-30 07:12:15 +00:00
Matt Thompson
c7e9b1b8dc Bring stdout/stderr capturing in line w/ nova
In .testr.conf, we reference OS_STDOUT_CAPTURE / OS_STDERR_CAPTURE
while in novaclient/tests/utils.py we reference OS_STDOUT_NOCAPTURE
and OS_STDERR_NOCAPTURE.  This change brings things more in line
with nova project by referencing OS_STDOUT_CAPTURE / OS_STDERR_CAPTURE
in both locations.

Change-Id: I22efdec84bef78e99d1d95303cadade6011d76a2
Fixes: bug #1192997
2013-06-28 10:23:46 +01:00
Dirk Mueller
0134008f9b Fixup trivial License Header mismatch.
The currently proposed Hacking check H103
compares the license boilerplate header in
source files with a known good version.
Fix up the syntactical-only mismatches with
that check.

Change-Id: Ie8861b9ded858aabb4cebbe9db656e8cccc9efed
2013-06-27 21:42:11 +02:00
Jenkins
abb57b6934 Merge "Return Customer's Quota Usage through Admin API" 2013-06-25 22:34:42 +00:00