The following message is shown currently in the reboot operation.
Request to reboot server <Server: server1> has been accepted.
The server name string is a bit odd. So fix it as follows.
Request to reboot server server1
(ff79e91e-e2a7-4e0f-b4c3-7157676d43c9) has been accepted.
Change-Id: I62df4589dc950f69fdc23eafcbb5792e897cb635
Closes-Bug: #1785495
Both standard json library and jsonutils of oslo.serialization are used.
Replace standard json library with jsonutils for consistency.
Change-Id: Id6cbb4d78817ff4993b73538935cc4cc61b64a72
I suppose that methods get_resource_manager_extra_kwargs and
add_resource_manager_extra_kwargs_hook were designed in those days when
Nova API had extensions.
Nowdays, Nova API has strict schema validation of requests, so no
additional arguments are allowed and these methods look redundant.
The fact that get_resource_manager_extra_kwargs lists of the objects
added by add_resource_manager_extra_kwargs_hook whereas
add_resource_manager_extra_kwargs_hook is not called anywhere
doesn't add chances for leaving these methods in our code.
Compatibility: both methods are designed for CLI and the CLI behaviour
will not change after removing them, so we can do a cleanup without
following standard deprecation cycle.
Change-Id: Id61457c3db8a17e2294dc579b2519873927fec48
There are some duplicated code in nova client for generating
query string.
The 'prepare_query_string' method can convert dict params to
query string(it transforms the dict to a sequence of two-element
tuples in fixed order, then the encoded string will be consistent
in Python 2&3.)
This patch use utils.prepare_query_string instead of these and
plus some notes in the 'prepare_query_string' method.
Change-Id: Idb3c5e97f8bbcd5ec5446f776c10fa8c84b54d5d
Closes-Bug: 1727968
Currently, Tags(list) and Metadata(dict) fields of instance will
firstly transformed to str using jsondump first when display. And
cannot be correctly transfomed and displayed afterwards.
This patch adds ensure_ascii=False to the transform function thus
those fields can be correctly tranformed and displayed afterwards.
Change-Id: Ib4e7a34f3b19db89280cc73053acbac8c8816f85
Closes-Bug: #1669683
1.As mentioned in [1], we should avoid using
six.iteritems to achieve iterators. We can
use dict.items instead, as it will return
iterators in PY3 as well. And dict.items/keys
will more readable. 2.In py2, the performance
about list should be negligible, see the link [2].
[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html
Change-Id: I6289f46344876d19d9a6793875f896cedc85a01c
The 'load_entry_point' method has not been used
since Ia649db257c416ca054977812ecb3f1a8044fa584.
TrivialFix
Change-Id: If477b0bb753c1a8bed2ebb440ac43f55805a0744
Used '%' instead of format() because "%" formatting operation
returns a unicode string for both unicode and non-unicode
format strings.
Encoded the exception error message in novaclient.shell.main and
novaclient.utils.do_action_on_many method to avoid
"UnicodeEncodeError" and print valid message.
NOTE:
Not used u'{0}.format(<str>) because in python 3 everything
is unicode so no need to add explicit 'u' to format string.
Closes-Bug: #1403379
Change-Id: I13f1ef2e1b41299b417cad3759a5cda241890df7
When a dict is flattened, if a value of an item is empty,
e.g. {"cpu_info": {}}, the item is not displayed.
This patch fixes _flatten method to display such an item including an
empty dict.
Change-Id: I2e4ada0de217c5c4ddea10f3f283c6d8e78083b6
Related-Bug: #1594230
This change allows novaclient to get several hypervisors
with the help of new optional parameters 'limit' and 'marker'
which were added to hipervisor-list command.
Change-Id: Ib723fb1dc1cd57b6f796bb93e0dd8ddf2da4b2a0
Current implementation of novaclient.api_versions.wraps allow to use
versioned methods for shell functions and resource managers. As resource
managers can have versioned methods, resource objects can have it too, but
it was not implemented yet. This patch fixes this omission.
Changes:
- Add api_version property to base resource class. It is mapped to
api_version property of manager class;
- Move `novaclient.utils.generate_function_name` to
`novaclient.api_versions._generate_function_name`, since this method is
specific to microversion stuff and should not used outside api_versions
module;
- Rewrite _generate_function_name to handle class(owner) name. Previously,
it was improssible to have two classes in one module with versioned
methods with equal names.
- Remove call of generate_function_name from novaclient.shell. Shell module
should not take care about function identifiers. get_substitutions accepts
object with __id__ property now.
- Mark _add_substitution as private method, since it should not be used
outside api_versions module
- Split all versioned methods of Server resource from novaclient.v2.servers
module.
Change-Id: Icfce16bfa6f919d7f8451d592f4a8e276b1f1709
There are some functions in novaclient/utils.py which have name with
prefix `_`, in Python, this means it is a private function which
should be only used in its own module. However, these functions are
used in other modules such as novaclient/v2/shell.py.
This patch removes the prefix _ for these functions.
Change-Id: I7bc8a76fd390a7dd30eecbb5c7e641b6ccfb40c0
oslo-incubator was deprecated and all modules used by novaclient were
removed from oslo-incubator master branch. This patch removes all unused
code from novaclient's repo.
Change-Id: Ie3c542d19da6ed4d25ec490faf6a86a82f48cd34
The ID (primary key) of a resource can not be retrived by the client.
There is no sense to provide the functionality to get an resource by
its ID. Especially when an instance is named by an interger, client
will try to get the instance with the ID of that interger value.
This patch will change the order in which the novaclient retrive
resources. First by UUID, then by name, finally by the ID. This will
also reduce api call overhead, since UUID is used mostly.
Change-Id: I0bfa5cb03a04625c3def5608dd4529e52d50f944
Closes-Bug: #1516924
some fields such as instance.display_name can be unicode,
nova client should not translate it to 'str'. otherwise
it will report UnicodeEncodeError.
Change-Id: I4f6011105b3b11dbbcb23f3a7c1bbcf7f20bcc8c
Closes-Bug: 1518141
This reverts commit 2961e82bfa6e375ac3c17933fac532ed316ac976
This broke cinder unit tests that have a timeout test for novaclient
where they mock the requests library raising a Timeout exception. That
test expects to get a requests Timeout passed through but with the
change being reverted it was getting a RequestTimeout exception from
novaclient, which breaks the test and fails the gate runs.
We could change the cinder unit test to handle both the requests.Timeout
and the new novaclient RequestTimeout, but that's just papering over
the cinder failure, we wouldn't know what other clients are failing
in the same way because they have code working around the requests
exceptions getting passed through, so we should treat this like an API
change.
I'd be in favor of making the same change again iff the novaclient
exceptions extended the requests exception types so it would be transparent
to consumers, since novaclient.exceptions.RequestTimeout would be a
requests.Timeout via inheritance. But given the gate breakage and it being
summit week I'm inclined to revert first and think about a better long term
fix later when people are back to discuss.
Change-Id: I368728588e5997eef860a168539eb66c58f2e72a
Closes-Bug: #1510790
Novaclient expects the requests library to always be able to get a
response back and doesn't handle other cases where it might raise
an exception even before the request is completed (e.g.
ConnectionError).
These exceptions should be captured and properly converted to some
native novaclient exception.
Change-Id: Iec7247b715c38c29910b30e76413cead4e951a37
Co-Authored-By: Kuo-tung Kao <jelly.k@inwinstack.com>
Closes-Bug: #1406586
New decorator "novaclient.api_versions.wraps" replaces original method with
substitution. This substitution searches for methods which desire specified
api version.
Also, this patch updates novaclient shell to discover versioned methods and
arguments.
Related to bp api-microversion-support
Co-Authored-By: Alex Xu <hejie.xu@intel.com>
Change-Id: I1939c19664e58e2def684380d64c465dc1cfc132
The table doesn't display right when there are multiple line in
result data. Fixes this by replace "\r" with "".
Change-Id: Ia3ca4146f17c3ae097a2aad0092c25f6807fcbab
Closes-bug: #1476462
This bug was occurred in cell mode.
In cell mode, compute node's id was not identified by integer type. It
was formatted with "path!to!cell@ID".
Therefore we can't using the id of hypervisor-list output.
For example,
> nova hypervisor-list
+----------------+--------------------------+-------+---------+
| ID | Hypervisor hostname | State | Status |
+----------------+--------------------------+-------+---------+
| region!child@1 | vagrant-ubuntu-trusty-64 | up | enabled |
+----------------+--------------------------+-------+---------+
Change-Id: Iba0cc1993f67351b11d034f372d7a5b98dc017f0
Closes-Bug: 1475973
Update the calls to pkg_resources to avoid forcing a requirements check
when the plugins are being loaded.
There are 2 versions of the entry point API in different releases of
setuptools. In one version, the require keyword argument can be passed
to load(). In the other, separate methods resolve() and require() need
to be used. This change updates the mock and fake objects to support
either, since the fakes are subclasses of the EntryPoint class in
pkg_resources.
It would be better to replace the calls to pkg_resources with stevedore,
which provides a more stable API, abstracts away this difference, and
provides an API for creating test managers directly. That change would
have required more extensive updates to the test suite, though, and
since I'm not as familiar with this code base as others will be, I will
leave those changes for someone else.
Change-Id: I2a9aeb53ccad04c7fa687f25340306b84218f9ff
Partial-bug: #1457100
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
Currently find_resource() searches resource with human_id before does
with name_attr. With this logic, find_resource() cannot identify
upper/lower case. In find_resource(), human_id always matches and
name_attr never used in find_resource() because human_id made from
small letters of name_attr string (see bug/1318503).
To identify upper/lower case, name_attr should be used before human_id.
This fix moves name_attr to ahead of human_id with unit-test cases.
Change-Id: I9b821d7111c11a97be38f19de06172daf410022d
Closes-Bug: #1318503
To remove aliases for `arg` and `env` functions in novaclient.utils,
we should use `arg` and `env` directly from cliutils in novaclients modules.
This patch removes aliases in `novaclient.utils` and starts using
`args` and `env` from novaclient.openstack.common.cliutils directly.
Change-Id: I4585adae62bc66ad6bc9d19be10d4679bb3dc5a1
This change defines do_action_on_many function as a helper to run an
action on many resources (like nova delete).
Change-Id: I1c45d11a520703c57e3ac1923d94ec5f864f266b
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
Since module `jsonutils` from common code is graduated in
`oslo.serialization`, we should remove code from oslo-incubator and use this
library.
Change-Id: Ia8b5ef598ff415cdde19f523a36a552918f9f94b
Module `novaclient.utils` contains a lot of functions which are
presented in modules from common code.
* service_type -> novaclient.openstack.common.cliutils.service_type
* get_service_type -> novaclient.openstack.common.cliutils.get_service_type
* pretty_choice_list ->
novaclient.openstack.common.cliutils.pretty_choice_list
* import_class -> oslo.utils.importutils.importclass
* HookableMixin -> novaclient.openstack.common.apiclient.base.HookableMixin
Change-Id: Ia6cac058da12c852d92f26875a66ae31cc4c63d4
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
This reverts commit 3bde9c3f427110dae3480644752f49b79ac66ec5.
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
There is a variable which is not defined but used, we should define it
before using. Add a test for get_resource_manager_extra_kwargs_hook
function, and change the exception to a more detail instead broad
'Exception'.
Change-Id: I7a798dad55a65f06ebbe175925a00028940bb168
F841 detects local variable is assigned to but never used.
This commit fix the violations and enable F841 in gate.
Change-Id: I52419f5e17db70e511ff2d4d61c85458c958e9c3
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
When we delete or show a keypair, if the keypair doesn't exist,
we'll get "The resource could not be found.(HTTP 404)", this
patch will change it to "ERROR: No keypair with a name or ID of
'keypair_name' exists."
Change-Id: Ifebd8d2213c327f3d3fdd672207170aebbe1bb40
Closes-Bug: #1307338
This change applies a regular expression in order to filter
flavor extraspects keys with invalid characters.
The characters allowed are: letters, numbers, underscores,
periods, colons, spaces and hyphens.
A new test flavor has been created which doesn't check the
keys in the post body. This flavor has been created in the
third place (instead of in the last) in order to keep
working existent test cases which depend on the last flavor
received in the get method.
Change-Id: Ifd86bed23a05a5946ae8b9ba6f6c9bf4b24b1d4c
Partial-Bug: #1256119
This change make all the text visible by the user i18n. The
messages changes are in prints, logs, exceptions, helps, etc
Pep8 errors about "Multiple positional placeholders" also fixed
Change-Id: I731afea790baddbc34d059b93a35e3d275fc1df8