Commit Graph

125 Commits

Author SHA1 Message Date
Andrey Kurilin 0a60aae852 Rename v1_1 to v2
Module novaclient.v1_1 is used as implementation of V1.1, V2 and V3.
Since future development(microversioning) will be done across V2,
implementation should be done in appropriate module(to prevent misleading).

Despite the fact that implementation for all versions are equal, discover
method for contrib path worked only for v1.1. This patch fixes this bug and
modifies shell tests to check all versions.

Change-Id: Ib6798f4dfe177586302141f522dc593560ce6a5b
2015-02-04 17:40:46 +02:00
James Penick a5ea58fec9 Refer to the admin password consistently
The docstrings refer to instance passwords as the admin password, root
password, or simply as "password". That makes documentation difficult to
understand. I've cleaned things up where appropriate.
 I did not change the 'root-password' command in this patch, im planning
to do that in a separate patch.

Cleaning that up to have everything
refer to the instance password as "admin password" for clarity.

Change-Id: I421edcaf18bf8536d5e43f71db6e868868154be3
2015-02-02 19:24:47 +00:00
Christian Berendt c58bc211f7 In strings/comments change Ip/ip to IP
The correct short form of "Internet Protocol" is IP.

Change-Id: Ie5412fafbb093e0948970f030e443bed360c71ea
2015-01-17 08:53:26 +01:00
Jenkins 0f7bf49388 Merge "Directly using base64 encoding for injected files" 2015-01-13 23:30:46 +00:00
Liang Chen f75ea86a2a Directly using base64 encoding for injected files
Binary files cannot be treated as utf-8 byte streams and converted
to plain. Change this back to just using base64 encoding as it was
before commit 8b264fc61d.

Change-Id: I4ef6142676022b2e2f3178e7bfa24ed985fcae2c
Closes-Bug: #1408088
2015-01-07 15:27:53 -05: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 75727c2d37 Fix E128 failures in novaclient/v1_1/
E128 continuation line under-indented for visual indent

Change-Id: I93660ef15df87993738c98f8bb1a88cc65f99870
2014-11-18 17:21:30 +02:00
Andrey Kurilin 3065afd6c0 Enable check for E129
E129 visually indented line with same indent as next logical line

Change-Id: I438bf0d9de7f61ab65e753169c9a8007e84b215a
2014-10-23 14:28:57 +00: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
Andrey Kurilin 8de2237cc4 Enable check for E126
E126 continuation line over-indented for hanging indent

Change-Id: Id64edce8278d96c1b2d4a6ca536e9fc8fbef478c
2014-10-23 17:28:25 +03: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
Andrey Kurilin dc09cf27e3 Port to use oslo.i18n
Module gettextutils from oslo-incubator was graduated to separate
library (oslo.i18n) and removed from repository, so we should use
new library.

Change-Id: I15d36ac5a2bb88b332ffa38d29488b75c55a20a9
2014-10-16 01:19:48 +03:00
Jenkins 58b539e398 Merge "Fix parameter description in create_server" 2014-09-26 07:57:22 +00:00
Ian Wienand 6bbedd1a13 Fix parameter description in create_server
Make clear the parameter name is "metadata", not "meta" -- this is
confusing at the moment as some other functions do use just "meta" as
their metadata argument.

Change-Id: I2b3ab478e5ad6e885e88bf0471502c9c971e46bd
2014-09-25 10:18:18 +10:00
Andrey Kurilin 7fc1588dfd Enable check for E121
E121 continuation line under-indented for hanging indent

Change-Id: I4cf246e3ec932ba0d2391eb8bcb793b28b005b4c
2014-09-24 22:44:09 +03:00
Rafael Rivero 98acb7fb7d Corrects typos "coearse," "proejct," and "unecrypts"
Misspelling of "coerce" found in the docstring body
of method _boot from class ServerManager. Misspellings
of "project" and "unencrypts" found in docstrings
of client.py and crypto.py.

Change-Id: I052c321f3ad5e13aa57a559e2f28ec5eec32a9b4
2014-09-18 15:24:54 -07:00
Sahid Orentino Ferdjaoui e7f880532d add new command get-serial-console
Adds v1.1 command get-serial-console

Change-Id: Id6b1e470088a72409f5609538be72c3cf2288a86
Parial-Implements: blueprint serial-ports
2014-09-10 08:37:04 +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
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
Christian Berendt 33058cbe8e Enable several checks and do not check docs/source/conf.py
* E265 block comment should start with '# '
* H302 import only modules

Do not check docs/source/conf.py. The file is imported from the
cookiecutter template.

Documented why checks are ignored and if they should be enabled
in the future.

Change-Id: I367064ecaa6d1fd9d918f7ce003303e2db660647
2014-08-05 22:18:14 +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
Jamie Lennox ecebc308b3 In Py3 decode the output of base64.decode
The return from a base64.encode in python 3 is bytes. Bytes cannot be
json.dumps() so when we base64 encode some data we need to convert it
to a string before passing it through to the request layer.

This isn't shown by unit tests because the fakeclient mocking layer
intercepts the request before it gets to the json encoding code.

Closes-Bug: #1323450
Change-Id: Ibbbb24f64c17069178e3bf0ee9998b806bc629ff
2014-05-27 11:32:06 +10:00
Jason Dunsmore adf6c351a0 Fix documentation for config_drive boot parameter
The "config_drive" boot parameter only accepts a Boolean parameter, but
the documentation says otherwise.

Change-Id: I7cbf5aefbd006d8b5425cd8592bacb5d8435b3c9
Closes-Bug: #1314395
2014-04-29 15:41:02 -05:00
Jenkins b3c57729c5 Merge "Support IPv6 when booting instances" 2014-04-09 08:46:55 +00:00
ZhiQiang Fan 6fbddcb4b6 Avoid AttributeError in servers.Server.__repr__
servers.Server represents various object now, and some of them may
don't have attribute 'name', for example, the interface_list() result
object. It will cause AttributeError when we try to format string with
such object, so I add a check for the 'name' attribute in __repr__
method, it will use 'unknown-name' instead when 'name' is not found.

Change-Id: If4757d5d73721774543d58a4cc875710a6013f34
Closes-Bug: #1280453
2014-03-25 10:54:10 +08:00
shihanzhang 91c138c51f Support IPv6 when booting instances
When nova uses neutron, IPv6 addresses may be allocated.  This ensures
those addresses are supported.the patch to modify nova is
https://review.openstack.org/#/c/74252/

Change-Id: I2468d3bcaca9122e5d3f9c98044d57f623630dc3
Closes-bug: #1267685
2014-03-18 18:01:29 +08:00
Eric Guo d44e598692 Remove usage of module py3kcompat
Module py3kcompat was removed from oslo-incubator. We need remove its
usage in client side firstly. This make us move smoothly when sync
oslo-incubator code.

Change-Id: I8b07c32c9852e747579a23685f3c8a07ac13ec01
Partial-Bug: #1280033
2014-02-25 09:17:54 +08:00
Alessandro Pilotti 55249f777c Adds support for the get_rdp_console API
Hyper-V employs RDP to access virtual machine consoles, unlike most
other hypervisors which support VNC.

In order to support this scenario, the get_rdp_console API has been
added to Nova. This commit adds the corresponding client side feature,
implemented in a way consistent with existing VNC and SPICE console
support.

Nova Gerrit commit: https://review.openstack.org/#/c/43502/

Change-Id: I86b814797d234f1eb49a7fa67ed27a9bcda034ae
Implements: blueprint hyper-v-rdp-console
2014-02-08 20:15:37 +00:00
Chris Yeoh c8ad315763 Adds ability to boot a server via the Nova V3 API
Creates an images client when attached to the the servers
client. This is necessary because the Nova V3 API no longer
proxies image queries to glance but when preparing a request to
boot a server it is necessary to retreive information about
images so we need to talk to both Nova and Glance in the same
command.

This is a bit ugly, but not much more than the already existing
ugliness of using the client class designed to talk to
Nova to talk to Glance and Cinder. The long term clean solution
is probably to a unified client that is designed to talk to
multiple openstack services.

Differences between the V2 and V3 API are described here:
https://wiki.openstack.org/wiki/NovaAPIv2tov3

Partially implements blueprint v3-api

Change-Id: Ib43682f38cd7a3e0f910b75e96685591246e7f67
2014-01-28 23:29:16 +10:30
Jenkins 4ab3686b32 Merge "add support for server set metadata item" 2014-01-19 00:56:41 +00:00
Roman Podoliaka 13cf07da40 Expose the rebuild preserve-ephemeral extension
This new extension permits preserving the ephemeral partition if the
Nova hypervisor supports that. This is primarily useful when Cinder is
not available to provide preservation of state while replacing the
image in use. One common situation for that is Nova Baremetal.

DocImpact
Blueprint: baremetal-preserve-ephemeral
Partial-Bug: #1174154
Co-Authored-By: Robert Collins <rbtcollins@hp.com>
Change-Id: Ib1511653904d4f95ab03fb471669175127004582
2013-12-17 14:46:38 +13:00
huangtianhua beaf57cfa7 Fix docstring on novaclient
Something like this:

1. Modify "`Image` to add metadata to" to ""`Image` to delete metadata" on
delete_meta()
2. Modify "The security group to delete" to "The security group to update"
on update()
3. Remove the "password" from the description on update()

Change-Id: I0120d84cc263d4eb58b692a5eb6f20ca0ef8264d
Closes-Bug: #1258461
2013-12-09 14:32:24 +08: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
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
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
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
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
Jenkins d770bb3aab Merge "Add interface for listing security groups of an instance" 2013-09-01 14:06:10 +00: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
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 545806cd15 Merge "Clean up inaccurate docstrings of server list() method" 2013-08-12 18:14:21 +00:00
Yufang Zhang 0331a01cfc Clean up inaccurate docstrings of server list() method
Clean up the inaccurate docstrings of server list() method and
refactor them to standerd format.

Change-Id: I4c17aba7ce5eb430ddd10305135e11e3ce5dc446
2013-08-10 23:10:29 +08:00
Jenkins 10f500de83 Merge "Fix typo and grammar in docstring only" 2013-08-09 19:18:41 +00:00
Noorul Islam K M aee0a29733 Fix typo and grammar in docstring only
Change-Id: I1e34ada679c56b996c6aa4652b43d1652f3c375f
2013-08-07 04:52:11 +05:30
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 95e7d70266 Merge "Merge v1_1's base module into main base module" 2013-07-30 17:55:26 +00:00
Xavier Queralt 0d061f0aeb Merge v1_1's base module into main base module
This class was forked from novaclient.base when adding v1.1 support and
and because v1.0 is no longer supported it can be merged again.

blueprint: improve-block-device-handling

Change-Id: I3113eff522a9dc280f48053001afa9e1a0cad3e3
2013-07-26 16:39:46 +02: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