Commit Graph

89 Commits

Author SHA1 Message Date
Rajesh Tailor 1f029ce578 Fix typos
Change-Id: Iaef3767dd9e7f43503dd8287b9b2345585bd87fb
2023-11-20 17:56:01 +05:30
Stephen Finucane 80ee69aa30 trivial: Remove use of kwargs
Make use of a "sentinel" object to allow us to remove the use of kwargs
and provide a more helpful docstring. With any luck, Python will support
these objects natively in a future release [1].

[1] https://www.python.org/dev/peps/pep-0661/

Change-Id: I411c0393754c8fe8a6698f0d278b73f12209ace8
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2022-12-12 17:43:23 +00:00
René Ribaud ee9b277c5f Microversion 2.91: Support specifying destination host to unshelve
This patch adds ``host`` to novaclient api.
This can help administrators to specify a ``host``
to unshelve a shelve offloaded server from 2.91 microversion.

Depends-On: https://review.opendev.org/c/openstack/nova/+/831507
Implements: blueprint unshelve-to-host
Change-Id: I7efc8f0b0ef159e16cefee761bff5d7e90d0c427
2022-07-28 14:49:46 +02:00
Stephen Finucane 8066f8c745 Microversion 2.90 - Configurable hostnames
Change-Id: Icd4362a07196e59bafcdfaff44323ce1386d4f55
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Depends-On: https://review.opendev.org/c/openstack/nova/+/778550/
2021-09-02 11:01:07 +01:00
Stephen Finucane ea092b2988 Make 'server list --config-drive' a boolean option
Instead of passing through whatever the user provides and exposing this
bug in the REST API, simply make the opt a boolean one in expectation of
a day where the API issues have been resolved.

This also introduces machinery necessary to use more of these types of
opts in the future.

Change-Id: I9033540ac65ac0ee7337f16bdd002060652092ea
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-04-08 17:27:33 +01:00
Victor Coutellier 9ee74d3ac6 Microversion 2.83 - Add more filters for the nova list command
Add these new filters, admin-only until microversion 2.82:

- availability-zone
- config-drive
- key-name
- power-state
- task-state
- vm-state
- progress

Existing user filter will be available to non admin since microversion
2.83.

Part of blueprint non-admin-filter-instance-by-az

Change-Id: Id2b5e600c0a41790830823031b20983808cb5ace
2020-04-07 18:34:13 +02:00
Stephen Finucane c4c44bcb2d Remove six
Mostly a find-replace job. Let's do this now so we don't have to carry
it for the next decade.

Change-Id: I7bef9fb7c6895f746cee1aca6522786f38b9857c
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-02-21 09:48:38 +00:00
Takashi NATSUME d1c5dc61d6 Add a check for --config-drive option on nova boot
A value of the '--config-drive' option must be a boolean value
on the 'nova boot' command because nova accepts a boolean value
only for the 'config_drive' parameter.
So add a check for the '--config-drive' option on the 'nova boot'
command.

Fix a description for 'config_drive' parameter
in the 'create' method of the novaclient.v2.ServerManager class.

Change-Id: Ic6e65139302fbb662fb6ba60e73633dad8ffb72e
Closes-Bug: #1825061
2019-09-18 23:08:28 +00:00
Yongli He aae95dcc7a Microversion 2.78 - show server topology
Add support microversion 2.78 which adds server topology
information in the output of the following new command:

  nova server-topology

Depends-on: https://review.opendev.org/#/c/621476/
Change-Id: I6467d52d2528a37348458baf4842b571a97f3ed2
Implements: blueprint show-server-numa-topology
2019-09-06 17:24:17 -04:00
zhangbailin ecfa521b21 Microversion 2.77: Support Specifying AZ to unshelve
This patch adds a new parameter ``--availability-zone`` to ``nova
unshelve`` command. This can help users to specify an ``availability_zone``
to unshelve a shelve offloaded server from 2.77 microversion.

Depends-On: https://review.opendev.org/#/c/663851/
Implements: blueprint support-specifying-az-when-restore-shelved-server

Change-Id: I8bce8f430bc54f03bacc105e37fc8b3bbf2432c2
2019-08-28 17:43:22 -04:00
Andreas Jaeger acef73c9bd Update api-ref location
The api documentation is now published on docs.openstack.org instead
of developer.openstack.org. Update all links that are changed to the
new location.

Note that redirects will be set up as well but let's point now to the
new location.

For details, see:
http://lists.openstack.org/pipermail/openstack-discuss/2019-July/007828.html

Change-Id: I53120e2ff3ae337a55c4cd0904bc9ad1dd54d082
2019-07-22 20:52:18 +02:00
zhu.boxiang 41c25881e6 Add host and hypervisor_hostname to create servers
Adds the --host and --hypervisor-hostname options to
the nova boot command and related python API bindings.

Depends-On: https://review.opendev.org/#/c/645520/

Change-Id: If16d00b75f4d5f2b96aa6e3f32a973108049d928
Blueprint: add-host-and-hypervisor-hostname-flag-to-create-server
2019-07-08 19:26:01 +00:00
Zuul bdbd0df064 Merge "Allow passing negative values for the locked search_opt in cs.servers.list" 2019-05-23 03:13:33 +00:00
Surya Seetharaman f78a4706d3 Allow passing negative values for the locked search_opt in cs.servers.list
This patch adds support for novaclient to pass the "locked" search_opts
with a "False" value upto the server side. This is required for the OSC
change[1] to support the "unlocked" filter parameter.

[1] https://review.opendev.org/#/c/659124/

Related to blueprint add-locked-reason

Change-Id: I0907f4ad2decb308c9db8b0cf9e7962bf1b517b5
2019-05-22 11:06:52 -04:00
Zuul dfb84228a2 Merge "Optimize limit option docs string description for novaclient" 2019-05-17 15:24:11 +00:00
chenke 2ecb39710f Optimize limit option docs string description for novaclient
Change-Id: I85ee36b0447869771782d1059957a46447940b59
2019-05-17 11:01:30 +08:00
Surya Seetharaman a1ac69c69a Microversion 2.73: Support adding the reason behind a server lock
This patch adds a new parameter ``--reason`` to ``nova lock``
command and ``--locked`` filtering/sorting parameter to
``nova list`` command. This can help users to provide a reason
when locking the server and to filter/sort instances based on their
locked or value from 2.73 microversion.

Implements blueprint add-locked-reason
Depends-On: https://review.opendev.org/#/c/648662/

Change-Id: I438e6db2dd5000ba388d0a0f1c8ab74b96b47a71
2019-05-13 14:37:43 +02:00
Lajos Katona 62bf8809c6 Add support for microversion v2.72
This microversion in Nova is added to support Neutron ports having
resource request during server create to guarantee minimum bandwidth
QoS. This is a behavior-only change in the compute API, there are no
changes to the server create request or response schema.

Change-Id: I1a39390015acd8703e8bab55af13f5c75ae226db
Depends-On: https://review.openstack.org/636360
Partial-Bug: #1578989
See-Also: https://review.openstack.org/502306 (nova spec)
See-Also: https://review.openstack.org/508149 (neutron spec)
2019-03-06 20:44:49 -05:00
Zuul 1ae9a85840 Merge "Fix output of interface-attach command" 2019-02-26 01:48:44 +00:00
Matt Riedemann 874b03068f Make Server.networks use a predictable sort order
This changes the Server.networks property method to return
an OrderedDict where the keys (network labels) are sorted
which will allow for a predictable sort order on the resulting
networks attached to a Server resource.

This affects the output of "nova list" and "nova show" commands
so a simple release note is added to mention the change.

Change-Id: I2e9b3c6a256509c045966035da24d58628f1b33b
2019-02-20 11:58:35 -05:00
Takashi NATSUME 7e56102201 Fix output of interface-attach command
Add output of a result in the 'nova interface-attach'
command when it is successful.
Make the following methods return a 'NetworkInterface'
object instead of a 'Server' object.

* The 'interface_attach' method
  in the 'novaclient.v2.Server' class
* The 'interface_attach' method
  in the 'novaclient.v2.ServerManager' class

Remove unnecessary code in the 'nova interface-detach'
command because the response body is not returned.

Change-Id: Id5316d8ad4a4b67e8399b51e602aafc83bc128c6
Closes-Bug: #1816511
2019-02-19 13:22:49 +09:00
Stephen Finucane 162f4769b8 Microversion 2.68: Remove 'forced' live migrations, evacuations
Update the commands and Python API bindings to reflect the new
microversion. The various evacuate microversion functions are DRY'd up
along the way.

Change-Id: Ibfc905292258ffde05800387e5d6bbad4823085c
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Depends-On: https://review.openstack.org/#/c/634600/
Implements: blueprint remove-force-flag-from-live-migrate-and-evacuate
2019-02-13 21:15:23 +00:00
zhaolihui b13ba0138f Fix flavor keyerror when nova boot vm
When creating a server (the 'nova boot' command),
it calls 'POST /servers' API.

The response does not have 'addresses' and 'flavor' attributes.
When accessing 'networks' attribute in the '_print_server' function,
it calls 'GET /servers/{server_id}' and get the 'addresses' and
'flavor' attributes.

If 'GET /servers/{server_id}' fails, the server object does not have
the 'flavor' attribute, then KeyError is raised when accessing it.

Fix the issue by making it raise a CommandError
when the 'GET /servers/{server_id}' fails.

Co-Authored-By: Takashi Natsume <natsume.takashi@lab.ntt.co.jp>
Change-Id: I3ef096c61b0e05a637ab0c4a1027338fa87e4f09
Closes-Bug: #1781368
2018-12-13 07:50:37 +00:00
Takashi NATSUME 1df18e2d99 Fix a type of block_device_mapping_v2 in a comment
Change-Id: I9c74402fbc4b2390b64265c6f174bc7e343900cc
Closes-Bug: #1804198
2018-11-21 13:39:59 +09:00
Matt Riedemann 4fef02de71 Add support for microversion 2.67: BDMv2 volume_type
This adds the nova boot command and python API binding
support for creating a server with block device mappings
defined using a specific volume type.

Depends-On: https://review.openstack.org/606398/
Depends-On: https://review.openstack.org/#/c/610349/

Part of blueprint boot-instance-specific-storage-backend

Change-Id: I484ee065119b5783db212ea64efa60e87c40338c
2018-10-14 05:34:24 -04:00
Jackie Truong 7f10707e5d Microversion 2.63 - Add trusted_image_certificates
This change adds a `--trusted-image-certificate-id` option to the
`nova boot` and `nova rebuild` commands. This option takes in a
a single trusted certificate ID. The option may be used multiple times
to specify multiple trusted certificate IDs, which will be
used to validate certificates in the image signature verification
process. If ID values are not specified using this option, the value of
the newly added OS_TRUSTED_IMAGE_CERTIFICATE_IDS environment variable
will be used instead. This value will be converted into a list before
being passed on.

The ``nova rebuild`` command also gets a new
``--trusted-image-certificates-unset`` option to unset/reset the
trusted image certificates in a server during rebuild. This is
similar to unsetting key_name and user_data during rebuild.

Corresponding `trusted_image_certificates` kwarg has been added to the
server create and rebuild Python API bindings.

Co-Authored-By: Brianna Poulos <Brianna.Poulos@jhuapl.edu>
Co-Authored-By: Matt Riedemann <mriedem.os@gmail.com>
Change-Id: I235541a689732826950c7b2a510d5835211120c3
Implements: blueprint nova-validate-certificates
2018-06-15 10:40:24 -04:00
Zuul 0cb0ffa32d Merge "Revert "Fix listing of instances above API max_limit"" 2018-06-06 03:59:06 +00:00
Matt Riedemann abaa86fd86 Revert "Fix listing of instances above API max_limit"
This reverts commit eff607ccef.

There was no apparent need for the change being reverted since
user can list all servers by specifying --limit=1 when running
the nova list command.

The change introduced a problem whereby the first pass to
list instances from the server would get up to
[api]/max_limit (default 1000) results and then call again
with a marker. If the last instance in the list (the marker)
is corrupted in the instance_mappings table in the API DB
by not having an associated cell mapping, listing instances
will always fail with a MarkerNotFound error even though
the CLI user is not passing a marker nor specifying
--limit=-1. The corrupted instance mapping record resulting
in the MarkerNotFound error is something else that should
be fixed on the server side (and likely result in a 500) but
the change in behavior of the CLI makes it always fail
if you hit this even if you're not passing a marker.

Change-Id: Ibb43f500a74733b85bd3242592d36985bfb45856
Closes-Bug: #1773945
2018-06-05 19:57:49 +00:00
Tatiana Kholkina 02343c2d8c Fix the docstring for the update method
It is impossible to provide a description to update method
in versions 2.0-2.18. But the docstring of the method says
that it can update a description.

Change-Id: I832e8a752779277a045bd127e2e6c6a3ae88f840
2018-02-19 15:32:53 +03:00
Jacek Tomasiak eff607ccef Fix listing of instances above API max_limit
Output of `nova list` command contained only `max_limit` entries even
when there were more. The list needs to be obtained in multiple
requests and the paging loop was terminated prematurely.

Change-Id: I4194e6d5e34ecc0ac704851c08bb895e223aa850
Closes-Bug: 1743532
2018-02-07 18:00:20 +01:00
Matt Riedemann 038cfdd5b3 Add support for the 2.57 microversion
With the 2.57 microversion, we:

* Deprecate the --file option from the nova boot and
  nova rebuild CLIs and API bindings.
* Add --user-data and --user-data-unset to the nova rebuild
  CLI and API bindings.
* Deprecate the maxPersonality and maxPersonalitySize fields
  from the nova limits and nova absolute-limits CLIs and API
  bindings.
* Deprecate injected_files, injected_file_content_bytes, and
  injected_file_path_bytes from the nova quota-show,
  nova quota-update, nova quota-defaults, nova quota-class-show,
  and nova quota-class-update CLIs and API bindings.

Part of blueprint deprecate-file-injection

Change-Id: Id13e3eac3ef87d429454042ac7046e865774ff8e
2018-01-15 14:42:53 +08:00
Matt Riedemann 01fb16533b Remove deprecated fixedip/floatingip/virtual interface CLIs/APIs
The add-fixed-ip, remove-fixed-ip, floating-ip-associate,
floating-ip-disassociate, and virtual-interface-list CLIs
and related python API bindings were deprecated in the 9.0.0
release in Pike via change Ie76283962c375b735f30ccb3053db07cf2330de2.
This removes the CLIs and related python API bindings and will go
into the 10.0.0 release.

Change-Id: Icb667973c65d26395db660b1c7b919550db66d08
2018-01-11 21:03:00 -05:00
Takashi NATSUME e5e8cebc81 Microversion 2.56 - Enable cold migration with target host
Change-Id: I4deea811ffae3e7944d5ec10ca0bbf2bfa056a7c
Implements: blueprint cold-migration-with-target-queens
2017-12-04 10:48:47 +09:00
Takashi NATSUME bef6765104 Microversion 2.54 - Enable reset keypair while rebuild
Adds support for microversion 2.54 which adds resetting keypair and
unsetting keypair in rebuild operation.
Adds optional ``--key-name`` and ``--key-unset`` options
in the ``nova rebuild`` command.
The ``--key-name`` and ``--key-unset`` cannot be specified
at the same time.

Change-Id: Ie2a39bb29dd59c070adc94e79ea0f6473227a427
Implements: blueprint rebuild-keypair-reset
2017-11-17 05:44:57 +00:00
Monty Taylor e24421b793 Stop posting to os-volumes_boot
os-volumes_boot is an old clone of /servers and is not documented in the
API docs. POST to /servers.

Change-Id: If0161a89877f19f24e91d780cf227fdc48e7e860
2017-11-16 11:25:50 -05:00
Jeremy Liu da44174c54 Fix reservation_id not supported by Nova API
Nova API accepts "return_reservation_id" instead of "reservation_id" when
creating instances [1]. This patch fixed that.

[1] https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/schemas/multiple_create.py#L19

Change-Id: Ie58248aa1cd981b877c7e592db698faffcd01d9a
Closes-bug: #1693818
2017-08-06 14:06:02 +08:00
Takashi NATSUME 561b35a8a8 Update URLs in docs, comments and setup.cfg
Some URLs are broken, so fix them.
The other URLs are redirect to new URLs,
so replace them with new ones.

Change-Id: Ida2fd70ad0d7b029fadfe91be14d7180b9b5b8d1
Closes-Bug: #1707104
2017-07-28 12:14:12 +09:00
Andrey Kurilin ec15bf30e7 Allow tuple as for nics value
`novaclient.servers.boot` accepts 'nics' argument with information about
network interfaces to attach. Originally, it accepts a list or a string.

In case if a list value, the proper method iterates over it for
processing and constructs a right structure for Nova-API. A tuple type
is similar to a list type in the processing method and can look more
logical for some developers (a tuple is a sequence of immutable python
object, which can be ideal for predefined nics) and doensn't require
anything to change in code except one validation check.

Also, this patch adds more info in the error message for validation
step.

Change-Id: Ief9d22fefb0a64afc346c56e832c6c0b2b3d8fcb
2017-07-27 15:57:19 +00:00
Kevin_Zheng 30c9215da7 Microversion 2.52 - Support tag when boot
Change-Id: Ib65894f0e128c599db8d3440fe5a8427e62d5782
Depends-On: Ifcaaf285c8f98a1d0e8bbbc87b2f57fbce057346
Implements: blueprint support-tag-instance-when-boot
2017-07-19 14:19:56 -04:00
Takashi NATSUME e11a1266bb Microversion 2.49 - Virt device tagged attach
Change-Id: I65a2d33710f85e9b8c342d6ff4c1e4cc82990b8c
Implements: blueprint virt-device-tagged-attach-detach
2017-07-12 01:16:31 +09:00
Andrey Kurilin c6d58d4356 Cleanup duplicated methods
Methods `get_vnc_console`, `get_rdp_console`, `get_serial_console` and
`get_spice_console` of ServersManager have complitely equal code, args spec
and docstrings for 2.0-2.5 and 2.6+ microversions. There is no reason to
duplicate those methods, so this patch removes duplicates.

Change-Id: I8c0e6f1f9138958bdb5d840cfd89e584c89895b0
2017-06-22 15:11:29 +03:00
Matt Riedemann 603f0eae9f 2.45: createImage/createBackup image_id is in response body
This adds support for microversion 2.45 which changes the response
on the createImage and createBackup server action APIs to return
the image_id for the created snapshot image in a json dict in the
response body rather than in a Location header (which is gone in
microversion >= 2.45).

Since the 'nova backup' command was not printing out the created
image ID before, that is also added in this microversion.

Part of blueprint remove-create-image-location-header-response

Change-Id: Id48aa7b14e2d25008287549b04db437ca9c3f548
2017-04-26 09:32:59 -04:00
Matt Riedemann e303cf11bf 2.44: Deprecate multinic/floatingIP actions and os-virtual-interfaces
The 2.44 microversion deprecates the addFixedIP, removeFixedIP,
addFloatingIP, removeFloatingIP server action APIs and
os-virtual-interfaces API.

This change deprecates the CLIs and python API bindings in novaclient.

Implements blueprint deprecate-multinic-proxy-api

Change-Id: Ie76283962c375b735f30ccb3053db07cf2330de2
2017-04-25 21:11:47 -04:00
Matt Riedemann a298b29cc7 Remove deprecated security_groups APIs
These were deprecated in Newton:

aaebeb05a0

The SecurityGroup resource object is left
since the list-secgroup command and
list_security_group servers API code
still uses that object. The
/servers/{server_id}/os-security-groups API
is a proxy to Neutron but was not deprecated
in microversion 2.36 so it's not yet deprecated
here in the client.

Change-Id: I6fa14f43d48f1e035ef54bd2d0078506f0c6d6e0
2017-03-20 19:26:43 -04:00
Jeffrey Guan 0a88bd439f Grammar typo in the comments for function set_meta.
Change-Id: Ia62c8e37f240f0dfc00950f6ef6e1ecc4d5b9453
Closes-Bug: #1668336
2017-02-23 13:49:47 +00:00
huangtianhua 2512a28dc1 Make _console() public
Heat wants to use 'novaclient.v2.servers.
ServerManager._console' method to simplify the
implementation of retrieving server console.
It's better to change the method to public for
public use.
The patch changes:
1. add public method named get_console_url() for class
   'novaclient.v2.servers.Server'
2. rename _console() to get_console_url() for class
   'novaclient.v2.servers.ServerManager'

Change-Id: I3d1485468d1d0a79d4002981ebe05b6cdf2332e7
Closes-Bug: #1651677
2017-01-18 09:36:43 +08:00
gengchc2 56bb3dae5f Replace six.iteritems() with .items()
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
2016-12-09 11:04:16 +08:00
Matt Riedemann 030ce53d4e Add support for v2.37 and auto-allocated networking
This adds support for the v2.37 microversion. The networks
part of the server create request is required in this
microversion so if nothing is specified for --nic arguments
on the command line we default to 'auto' for backward
compatibility in the CLI.

Part of blueprint get-me-a-network

Change-Id: I6636ddcd3be7bf393d2d69cc6c1ba5c7d65ff674
2016-08-19 21:32:52 -04:00
Artom Lifshitz 7fb0bd4f35 Virtual device tagging client support
In order to support virtual device role tagging that was introduced in
microversion 2.32, this patch adds:

* The 'tag' key to the --nic flag when booting an instance.
* The 'tag' key to the --block-device flag when booting an instance.

Change-Id: I1866c670994254bc2849b494e318f4ff8cc44eb7
Implements: blueprint virt-device-role-tagging
2016-07-12 07:39:58 -04:00
Sylvain Bauza c649678991 Add support for microversion 2.30
Now the os-migrateLive API supports a new body argument called 'force' which
helps the operators to bypass the scheduler call in case they provide a host.

Also modifies the host_evacuate_live helper method in the contrib tree to make
sure operators also have the force flag in case they need it for a global call.

Change-Id: Id7fcd88ad060390ac6d1a21510d84363ed643957
Implements: blueprint check-destination-on-migrations-newton
2016-06-22 09:40:40 +02:00