Prior to this patch, novaclient was handling sessions in an inconsistent
manner.
Every time we created a client instance, it would use a global
connection pool, which made it difficult to use in a process that is
meant to be forked.
Obviously sessions like the ones provided by the requests library that
will automatically cause connections to be kept alive should not be
implicit. This patch moves the novaclient back to the age of a single
session-less request call by default, but also adds two more
resource-reuse friendly options that a user needs to be explicit about.
The first one is that both v1_1 and v3 clients can now be used as
context managers,. where the session will be kept open (and thus the
connection kept-alive) for the duration of the with block. This is far
more ideal for a web worker use-case as the session can be made
request-long.
The second one is the per-instance session. This is very similar to what
we had up until now, except it is not a global object so forking is
possible as long as each child instantiates it's own client. The session
once created will be kept open for the duration of the client object
lifetime.
Please note: client instances are not thread safe. As can be seen from
above forking example - if you wish to use threading/multiprocessing,
you *must not* share client instances.
DocImpact
Related-bug: #1247056
Closes-Bug: #1297796
Co-authored-by: Nikola Dipanov <ndipanov@redhat.com>
Change-Id: Id59e48f61bb3f3c6223302355c849e1e99673410
The 'nova rebuild' command did not print the adminPass returned by the
server. This is because it discards the instance information returned
by the rebuild action and fetchs the information again. This would lose
the adminPass and it would not be printed for the user.
This patch reuses the instance information returned by the rebuild action
which ensures that the adminPass is printed by the shell.
Change-Id: I144bfa298bef529c78ca04042cd37a763537f09e
Closes-bug: 1302696
It's not used by novaclient anymore and isn't used by any other
openstack common code either.
Change-Id: I96ebf030d0a96436a8a75c6937c354003ee32c58
Closes-bug: 1280033
The method tests rebuilds with and without passwords, but the tests are
independent and should be in two seperate tests.
Also, remove duplication of the rebuild with password test from
test_rebuild_preserve_ephemeral
Change-Id: I40d0376fabf319dbe703d593de8fb4cdcf0aeab1
Switch to using network_utils for splitting the URL. The code
in oslo-incubator supports ipv6 urls
HEAD of oslo-incubator is bb52a3fc49f033b9f36238231ca56e754a78cf4b
Updated openstack-common.conf to pick up the new dependency from
oslo-incubator
Change-Id: Ifa3dec384e85942a191260d17e8141030d31ff84
Closes-Bug: #1298137
reservation_id, min_count, max_count are never specified by any callers.
Remove the arguments and the code that checks the values.
Change-Id: I3794fd1eabbfb999c422c701af1ff64cd667313f
Python 3 changed the map built-in to return an iterable instead of a list.
When tested in a boolean context, this always returns True, even if it
would not return anything when iterated.
Instead of the usage being printed, this error was printed:
ERROR: 'Namespace' object has no attribute 'func'
Use list comprehension instead to ensure that an iterable isn't returned
Change-Id: Ie15f2fa8ee93ab26490e371133fa0f944430737b
Closes-bug: 1295356
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
When running nova boot --poll, any error states that occur will be
seen but, an exit code of 0 will be returned indicating success.
This would be problematic for scripts looking to see if an
operation completed successfully.
To fix this, an exception is raised after the nova api indicates to the
poll code that the vm is in an error state. The exceptions signals the shell
main function to exit with code 1.
Change-Id: I48f6b1c82e2f8b221dda898dcb804b0196018505
Fixes-Bug: #1292669
If a server error is returned that has an unknown code, novaclient will
end up printing something similar to:
ClientException: <attribute 'message' of 'exceptions.BaseException' objects>
Setting a message for ClientException will ensure that something more
useful than that is printed.
Change-Id: I43a2a33017f9a5c1b79d7fd8af4153e91d296f7b
Closes-bug: 1295293
Currently, when the CLI encounters an exception, only the exception
message is shown. However, the name of the exception can be quite
informative as well.
For instance, an error message might read "Cannot do xyz", which
simply indicates the operation was unsucessful. However, the attached
exception name (HTTPNotImplemented, for instance) indicates the
*reason* that the call was unsuccessful.
Change-Id: I0298477bd9d40d98c95bb797c68c47dbc952b345
A recent release of setuptools appears to have introduced a bug that
causes the pypy gate tests to fail. This applies a temporary workaround
that should restore pypy testing while the root cause of the problem is
researched.
Change-Id: I66597e40c1d2e57cca1292844d228af85214197d
Partial-Bug: 1290562
auth_url can be None, for example, when we use bypass_url.
Also, add rstrip('/') for bypass_url (and management_url), which
is done when management_url is gotten from service catalog.
Change-Id: I4f59cc405386a15f8a266d279b27f279eacdb7f1
nova aggregate-set-metadata not given value of a key means delete the
metadata, so explain this usage in help message.
Change-Id: Ie8215bd8b47ed00e3d4686edab9e3052ae84774d
CLI support for blueprint instance-group-api-extension
REST API support:- https://review.openstack.org/#/c/62557/
DocImpact
- supports create, list, get and delete
- only V2 is supported
Change-Id: Iaa5a2922b9a0eed9f682b7584c2acf582379b422
Removes the copy of the otuput of 'nova help' from the README.rst
file. It's out of date and given its not autogenerated is
rather prone to getting out of date again soon anyway. Just leave
the command that people need to run in order to print the help message.
Change-Id: I3cd069838302913bc69cc0ded5d632c7f8c3f408
Currently when booting a server with V3, novaclient sends an empty
os_password to image_cs. This will cause 401(Unauthorized: Invalid
user/password) when trying to find image. This is is a result of
changes nova's V3 API: nova is no longer used as a proxy for the
image service. So novaclient uses two Client instances: one for
nova, the other for image service. This patch checks os_password
before creating the image Client and assigns it if it's empty.
Change-Id: Ic54cef93e9b823fb98b1edd78776c9a1fc06ba46
Closes-Bug: #1277425
In Keystone V3 user names are no longer necessarily unique
accross domains.
A user can still authenticate a user in the non default
domain via the V2 API providng they use IDs instead of names.
Tenant_ID is already supported, this change adds support
for user ID
Change-Id: I36ba75f3e67c8cdb959e31923d5e557414ab6f9b
This adds support for the os-server-external-events extension in nova,
which allows other services to deliver events to nova.
It also adds a shell command to trigger the "network-changed" event
manually, which will cause nova to refresh its network cache from
neutron.
Related to blueprint admin-event-callback-api
Change-Id: I1a302a43b6b7a6d8bdc03965a8f4c1a151bcab88