summaryrefslogtreecommitdiff
path: root/openstackclient/compute
Commit message (Collapse)AuthorAgeFilesLines
* Merge "compute: Show flavor in 'server list' with API >= 2.47" into ↵Zuul2022-07-061-20/+22
|\ | | | | | | stable/victoria
| * compute: Show flavor in 'server list' with API >= 2.47Khomesh Thakre2021-12-081-20/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the issue where the flavor name was empty in server list output. This requires somewhat invasive unit test changes to reflect the changed API response from the server, but this has the upside of meaning we don't need new tests since what we have validates things. Also drop the flavor ID column as it is removed from the compute API. Conflicts: openstackclient/tests/unit/compute/v2/test_server.py NOTE(melwitt): The conflicts and differences from the cherry picked change are because the following changes are not in Victoria: * I4811f8f66dcb14ed99cc1cfb80b00e2d77afe45f (compute: Add 'server * --all-projects' option) * I7a8349106e211c57c4577b75326b39b88bd9ac1e (compute: Fix 'server * -f yaml' output) * I84848c0bf8ab3c36dd821141191e2725e4e3b58b (Remove usage of six) * Ieeb1f22df7092e66a411b6a36eafb3e16efc2fc2 (compute: Add missing options for 'server list') * If065602792958ff0145ae9f2e05f5b7a3177905c (Compute: Add tags support for server) * I25a4da697e27c0fba4d28b504377667eb18f15fe (compute: Add '--force' option to 'server delete') * I463993170c03a1d98c47ab6a3c19131b7fca1099 (Remove oslo.utils) * I18991adf899c7b72c98bb89871bf0715d35943f0 (Add a few selectable fields to the "openstack server list" output) * I62b2ed8488ee4ac9c42051311bcfb455506ddd90 (Switch compute flavors from novaclient/direct to SDK) Change-Id: Ica3320242a38901c1180b2b29109c9474366fde0 Signed-off-by: Khomesh Thakre <khomeshthakre24@gmail.com> Story: 2008257 Task: 41113 (cherry picked from commit 8e362402dee07744668bcf7f6774af4fbe9a07e3) (cherry picked from commit 0873e7580eceab07c3be0824d2ea4163491f8d6e) (cherry picked from commit 4b7e777c0ce19aa67a9a33cbeb3b4ee2b052383f)
* | Merge "compute: Reorder building of columns for 'server list'" into ↵Zuul2022-07-061-77/+99
|\ \ | |/ | | | | stable/victoria
| * compute: Reorder building of columns for 'server list'Stephen Finucane2021-12-041-77/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This has no impact on the end result, but it should make fixing issues introduced by API microversion 2.69 a little easier. Conflicts: openstackclient/compute/v2/server.py NOTE(melwitt): The conflicts are because the following changes are not in Victoria: * I463993170c03a1d98c47ab6a3c19131b7fca1099 (Remove oslo.utils) * I18991adf899c7b72c98bb89871bf0715d35943f0 (Add a few selectable fields to the "openstack server list" output) * I2f2033a8d49ee42eb21696a9cd28e63ad9712fad (trivial: Cleanup docs for 'server list') Change-Id: I7d70eac8aa1a6197ed05a49f071e6899ec219c03 Signed-off-by: Stephen Finucane <sfinucan@redhat.com> (cherry picked from commit 4c3de28e83babb0672950320a20492dc61803b4a) (cherry picked from commit f4adbcef7b1b18d9454109a020e5e2c6ad78b5f1) (cherry picked from commit cb621f22d4547c20f5722058be8d99de936a48c6)
* | compute: Add missing options for 'server group list'Stephen Finucane2022-07-041-1/+37
|/ | | | | | | | | | Add pagination parameters, '--limit' and '--offset'. It's unfortunate that we can't use '--marker' like elsewhere but that requires server-side support to be truly effective. Change-Id: I186adc8cdf28e9c540ad22bca6684d9dd892976a Signed-off-by: Stephen Finucane <sfinucan@redhat.com> (cherry picked from commit 5ec4d4c7188f4766d270be32e12b64b709d2b835)
* Validate 'server group create --policy' optionStephen Finucane2021-01-111-5/+20
| | | | | | | | | | | | We were documenting that some of these policies were only supported with specific microversions, however, we weren't actually enforcing that, leading to a poor user experience. Correct this. Change-Id: Ic3c555226a220efd9b0f27edffccf6c4c95c2747 Signed-off-by: Stephen Finucane <sfinucan@redhat.com> Story: #2007727 Task: #39882 (cherry picked from commit ab0b1fe885ee0a210a58008b631521025be7f3eb)
* Merge "Fix --image-property option in 'create server'"Zuul2020-10-011-3/+11
|\
| * Fix --image-property option in 'create server'Myeongchul Chae2020-09-101-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was a problem that the '-image-property' option, which can be used to create an instance, did not work as intended. I found that there were two problems with this option. First, I cannot select an image as its metadata. The second is that when there are multiple images available, the desired image may not be selected depending on the situation. This patch solves these two problems. I wrote the test case with these two problems considered together. Change-Id: Ib2745d7e067056ff4ca8bfaf6cff492d0dacb73a story: #2007860
* | Merge "Add API check for server_groups.create"Zuul2020-09-301-2/+6
|\ \
| * | Add API check for server_groups.createLewis Denny2020-08-261-2/+7
| |/ | | | | | | | | | | | | | | | | | | | | | | | | The policies field has been replaced with the policy field since Nova API version 2.64[1] This commit adds a check to make sure the correct field is used. [1]https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id59 Change-Id: I06d3211937d822c26070b7f8ad757c365dcbb1bb Story: #2007822 Task: #40101
* | Merge "Add API check for server_groups.list"Zuul2020-09-301-2/+7
|\ \
| * | Add API check for server_groups.listLewis Denny2020-08-211-2/+7
| |/ | | | | | | | | | | | | | | | | | | | | | | | | The policies parameter has been replaced with the policy parameter since Nova API version 2.64[1] This commit adds a check to make sure the correct parameter is used. [1]https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id59 Change-Id: Ia37beb7790884d6d15bec45074f446e64af1a2aa Story: #2008041 Task: #40703
* | Merge "Show words indicating booted from volume for server image"Zuul2020-09-301-2/+14
|\ \
| * | Show words indicating booted from volume for server imagemelanie witt2020-08-271-2/+14
| |/ | | | | | | | | | | | | | | | | | | | | | | | | For a server booted from a volume, nova API does not store an image_id and instead returns an empty string. Currently, openstackclient similarly shows an empty string for Image Name and Image ID for servers booted from volumes. To aid CLI users in understanding the meaning of no image_id, we can display the string "N/A (booted from volume)" in the image field if the server was booted from a volume. Change-Id: I9c62cf6fe23b2e934dcbf5ebbf706b2705d2e424
* | Merge "Output correct json for security groups in 'openstack server show'"Zuul2020-09-251-6/+11
|\ \
| * | Output correct json for security groups in 'openstack server show'jay2020-09-141-6/+11
| |/ | | | | | | | | | | | | | | | | | | | | | | | | Fixes incorrect json output for 'openstack server show -f json'. The security group json output groups all the json as one for e.g. "security_groups": "name='group1'\nname='group2'" The correct output should be "security_groups" : [{"name" : "group1"}, {"name" : "group2"}] properties and volumes_attached fields also has similar issue. Story: 2007755 Change-Id: I1b1cac716329e0530400aff782c08000b21d8e1d
* | Allow openstack flavor set to update flavor description using nameGabriel Ramirez2020-06-101-1/+1
|/ | | | | | | | | | | Modified take_action() method for SetFlavor to use flavor id instead of flavor name when setting description Closes-Bug: #1844708 Story: #2007781 Task: #40019 Change-Id: If6798c89fef4c9feb4ebb460722b891f5655037d
* Correct image lookup during server rebuildAdam Harwell2020-05-041-3/+6
| | | | | | | | | | | | The switch to using glance from the SDK accidentally used get_image directly during a server rebuild, when it should have used find_image to match existing functionality. Bug introduced in: I36f292fb70c98f6e558f58be55d533d979c47ca7 Change-Id: I2005bd40a1bd6719670c7f7854316b4f9801b140 Story: 2007620 Task: 39643
* Switch image to use SDKArtem Goncharov2020-03-233-28/+17
| | | | | | | | | | | | | This is a work to switch OSC from using glanceclient to OpenStackSDK. With this change only v2 is using OpenStackSDK. V1 is still using glanceclient and will be switched in a separate change. Remove the direct depend on keystoneauth- let that flow through openstacksdk. Depends-on: https://review.opendev.org/#/c/698972 Change-Id: I36f292fb70c98f6e558f58be55d533d979c47ca7
* Use 'KeyValueAppendAction' from osc-libStephen Finucane2020-02-031-31/+1
| | | | | | | | Does what it says on the tin. This action was added to osc-lib in change If73cab759fa09bddf1ff519923c5972c3b2052b1. Change-Id: I51efaa096bb26e297d99634c5d9cca34c0919074 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Stop silently ignoring invalid 'server create --hint' optionsStephen Finucane2020-02-031-11/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The '--hint' option for 'server create' expects a key-value pair like so: openstack server create --hint group=245e1dfe-2d0e-4139-80a9-fce124948896 ... However, the command doesn't complain if this isn't the case, meaning typos like the below aren't indicated to the user: openstack server create --hint 245e1dfe-2d0e-4139-80a9-fce124948896 Due to how we'd implemented this here, this ultimately results in us POSTing the following as part of the body to 'os-servers': { ... "OS-SCH-HNT:scheduler_hints": { "245e1dfe-2d0e-4139-80a9-fce124948896": null } ... } Which is unfortunately allowed and ignored by nova due to the use of 'additionalProperties' in the schema [1] Do what we do for loads of other options and explicitly fail on invalid values. This involves adding a new argparse action since none of those defined in osc-lib work for us. This is included here to ease backporting of the fix but will be moved to osc-lib in a future patch. [1] https://github.com/openstack/nova/blob/19.0.0/nova/api/openstack/compute/schemas/servers.py#L142-L146 Change-Id: I9e96d2978912c8dfeadae4a782c481a17cd7e348 Signed-off-by: Stephen Finucane <sfinucan@redhat.com> Story: #2006628 Task: #36840 Related-Bug: #1845322
* Replace six.iteritems() with .items()lihaijing2020-01-0912-30/+19
| | | | | | | | | | | | | | | | 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 Co-Authored-By: Akihiro Motoki <amotoki@gmail.com> Change-Id: I4b9edb326444264c0f6c4ad281acaac356a07e85 Implements: blueprint replace-iteritems-with-items
* Fix openstack server list --deleted --marker optionKeithMnemonic2020-01-021-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes using the "name" option for a marker when --deleted is also used. The find_resource() function that is being called does not correctly handle using the marker as the "name" in the search when also using deleted=True. One simple way to fix this is force the marker to only be an ID when --deleted is used. This is how the nova client works. Using the --deleted option is available to users with the admin role by default. If you're an admin listing --deleted servers with a marker by name, find_resource() is going to fail to find it since it doesn't apply the --deleted filter to find_resource(). The find_resource() function is trying to find the marker server by name if it's not found by id, and to find it by name it's listing servers with the given marker as the name, but not applying the --deleted filter so it doesn't get back any results. In the story it was suggested modifying find_resource to include the deleted query param when it's specified on the command line but that didn't work because it still results in something like this: http://192.168.1.123/compute/v2.1/servers?deleted=True&name=4cecd49f-bc25-4a7e-826e-4aea6f9267d9 It seems like there are bugs in find_resource(). Restricting the marker to be the server ID when listing deleted servers is probably OK since if you're using --deleted you're an admin and you could be listing across all projects and if you're filtering by a server across all projects anyway (not that you have to, I'm just saying if you are), or even showing a server in another project, you have to do it by id rather than name because find_resource() won't find the server in another project by name, only ID. story: 2006761 Task: 37258 Change-Id: Ib878982b1d469212ca3483dcfaf407a8e1d2b417
* Microversion 2.79: Add delete_on_termination to volume-attach APIzhangbailin2019-11-191-1/+40
| | | | | | | | | | | | | Added ``--disable-delete-on-termination`` and ``--enable-delete-on-termination`` options to the ``openstack server add volume`` command that enables users to mark whether to delete the attached volume when the server is destroyed. Depends-On: https://review.opendev.org/#/c/681267/ Part of blueprint support-delete-on-termination-in-server-attach-volume Change-Id: I6b5cd54b82a1135335a71b9768a1a2c2012f755b
* Merge "Add 'openstack server migrate (confirm|revert)' commands"Zuul2019-10-031-5/+26
|\
| * Add 'openstack server migrate (confirm|revert)' commandsStephen Finucane2019-09-101-5/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While cold migration and resize are essentially the same operation under the hood, meaning one could use the 'openstack server resize confirm' and 'openstack server resize revert' commands instead, there is no reason the operator needs to know this. Add these flags as syntactic sugar to help simplify operators lives. The help texts for both the 'openstack server resize' and 'openstack server migrate' commands are updated to clarify the relationship between the two operations. Change-Id: I0cb6304c794bffaec785add9f7b8cf53ab28cacd Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | Microversion 2.77: Support Specifying AZ to unshelvezhangbailin2019-09-031-4/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a new parameter ``--availability-zone`` to ``openstack server 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/679295 Implements: blueprint support-specifying-az-when-restore-shelved-server Change-Id: Ia431e27c2a17fe16466707cc362532860ecf22df
* | Merge "Bump hacking version"Zuul2019-08-282-30/+30
|\ \
| * | Bump hacking versionStephen Finucane2019-08-272-30/+30
| | | | | | | | | | | | | | | | | | | | | | | | Pick up newer versions of this library. Thankfully no serious changes are needed. Change-Id: I69e523844529fc1c8aa0c1ce764182dbe29cfeb6 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | Format aggregate command fields and de-race functional testsDean Troyer2019-08-261-3/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | Rename metadata to property in all aggregate commands Beef up functional tests to reduce street racing Change-Id: I4598da73b85a954f3e6a3981db21891b45d9548c Signed-off-by: Dean Troyer <dtroyer@gmail.com>
* | | Merge "Document 2.53 behavior for compute service list/delete"Zuul2019-08-221-2/+9
|\ \ \ | |_|/ |/| |
| * | Document 2.53 behavior for compute service list/deleteMatt Riedemann2019-08-201-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With compute API microversion 2.53, nova-compute services can only be deleted with the ID as a UUID to uniquely identify the service in a multi-cell deployment. This documents that for the "compute service delete <service>" argument. The description of the "compute service list" command is also updated to mention that the ID can be retrieved as a UUID using 2.53 or greater. Change-Id: If7d4a27c0aaef588bcd77dd9edddec1e535fbf31 Story: 2005349 Task: 30302
* | | Merge "Add 'openstack server resize (confirm|revert)' commands"Zuul2019-08-201-0/+55
|\ \ \
| * | | Add 'openstack server resize (confirm|revert)' commandsStephen Finucane2019-08-091-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are currently exposed as flags on the 'openstack server resize' command but they are in fact operation and should be exposed as commands in their own right. The old flag-based variants are deprecated for removal in 4.0. Change-Id: I733796d3bda6c3755a3d3548bbe695abb474a6a0 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | | Merge "Add openstack server create --boot-from-volume option"Zuul2019-08-201-2/+31
|\ \ \ \ | | |_|/ | |/| |
| * | | Add openstack server create --boot-from-volume optionMatt Riedemann2019-08-091-2/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a --boot-from-volume option to the server create command which is used with the --image or --image-property option and will create a volume-backed server from the specified image with the specified size. Similar to the --volume option, the created root volume will not be deleted when the server is deleted. The --boot-from-volume option is not allowed with the --volume option since they both create a block device mapping with boot_index=0. Change-Id: I88c590361cb232c1df7b5bb010dcea307080d34c Story: 2006302 Task: 36017
* | | | Merge "Fix <id> description for --block-device-mapping"Zuul2019-08-201-2/+1
|\ \ \ \ | |/ / /
| * | | Fix <id> description for --block-device-mappingMatt Riedemann2019-08-091-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The <id> portion of a --block-device-mapping value can be the resource name or id since the code uses the appropriate type-specific find_resource utility to lookup the resource based on the value given. This change simply fixes the description of <id> to mention it's name or id rather than just "UUID". My guess is the description was originally copied from novaclient where id must be an id since name resolution does not happen in novaclient. Change-Id: I567f6f6efb3a3b6d387133d21aa81354b2d753bc
* | | | Merge "Support type=image with --block-device-mapping option"Zuul2019-08-201-6/+24
|\ \ \ \ | |/ / / | | | / | |_|/ |/| |
| * | Support type=image with --block-device-mapping optionMatt Riedemann2019-08-091-6/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The --block-device-mapping option on the server create command currently only supports booting from volume and volume snapshot. A common boot-from-volume scenario is providing an image and letting nova orchestrate the creation of the image-backed volume and attaching it to the server. This adds support for type=image in the --block-device-mapping option. The volume size is required in this case. Note that the CLI currently says if type=snapshot that size is also required but that's technically not true. When booting from a volume snapshot, the compute API will use the size of the volume snapshot to create the volume if an explicit size is not provided. For the purposes of this patch, we need the size anyway for the image being the block device mapping source type. Change-Id: I57b3c261d8309f7b9f62a3e91612bce592a887a3 Story: 2006302 Task: 36016
* | | Fix compute service set handling for 2.53+Matt Riedemann2019-08-091-7/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With compute API microversion 2.53 there is a single PUT /os-services/{service_id} API which takes the service id as a UUID. Since the openstack compute service set command only takes --host and --service (binary) to identify the service, this change checks if 2.53 or greater is being used and if so, looks up the service by host and binary and calls the appropriate methods in novaclient. If the command cannot uniquely identify a compute service with the given host and binary, an error is raised. A future change could add an --id option to be used with 2.53+ to pass the service id (as UUID) directly to avoid the host/binary filtering. Change-Id: I868e0868e8eb17e7e34eef3d2d58dceedd29c2b0 Story: 2005349 Task: 30302
* | | Mention compute service set --up|--down requires 2.11 or greaterMatt Riedemann2019-07-241-2/+4
|/ / | | | | | | | | | | | | | | This simply updates the docs for the compute service set --up and --down options to mention that --os-compute-api-version 2.11 or greater is required to use those options. Change-Id: I52891fe36c84d0df3e868ab4f3c8e2357e9ba529
* | Merge "Add host and hypervisor_hostname to create servers"Zuul2019-07-231-0/+29
|\ \
| * | Add host and hypervisor_hostname to create serverszhu.boxiang2019-07-191-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds the --host and --hypervisor-hostname options to ``openstack server create`` CLI. Depends-On: https://review.opendev.org/670558 Change-Id: If188c3d96fa506dbe62ef256418f2f9bca1520c2 Blueprint: add-host-and-hypervisor-hostname-flag-to-create-server
* | | Merge "Fix BFV server list handling with --name-lookup-one-by-one"Zuul2019-07-191-1/+4
|\ \ \
| * | | Fix BFV server list handling with --name-lookup-one-by-onemelanie witt2019-06-281-1/+4
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the --name-lookup-one-by-one option passed to the 'server list' command, the image and flavor names will be looked up for each server being listed instead of fetching all image/flavor names. The current code assumes all servers have an image attribute, but servers booted from volumes have no image, so the following error is raised when listing BFV servers with --name-lookup-one-by-one: AttributeError: ('unicode'|'str') object has no attribute 'get' The error occurs when the code attempts server.image.get('id'). This fixes the --name-lookup-one-by-one code not to assume an image for a server. The unit tests for 'server list' have also been robustified to feature one BFV server to enhance our test coverage. Story: #2006063 Task: #34777 Change-Id: I312c971346c7ded93f6fcaa515098554b8580295
* | | docs: clarify compute service --service optionMatt Riedemann2019-07-011-2/+4
|/ / | | | | | | | | | | | | | | | | | | | | | | | | The compute service commands emit a "Binary" in the output but the --service filter option isn't as clear that it's the binary (for set it is but not list) nor do the docs give an example of a binary (typically nova-compute but could be others like nova-conductor, nova-scheduler, etc). This simply mentions that the --service option is the binary for "compute service list" and gives an example value for the option in both list and set help. Change-Id: If87fc37352c3a251cc89041723adbe04dedf4f8a
* | Merge "Add server add/remove volume description for microversion 2.20"Zuul2019-06-221-2/+9
|\ \
| * | Add server add/remove volume description for microversion 2.20Matt Riedemann2019-06-121-2/+9
| |/ | | | | | | | | | | | | | | | | | | | | | | | | The compute API 2.20 microversion allows attaching and detaching a volume to/from a server with status SHELVED or SHELVED_OFFLOADED. For OSC this just means the user has to specify the appropriate minimum microversion to make that work, so this change mentions that in the "server add volume" and "server remove volume" command description. Related to nova blueprint volume-ops-when-shelved Change-Id: I4824175e5d9e124e3bd9e9a8fd5a89277efc6cff
* | Merge "Remove deprecated compute commands"Zuul2019-06-212-197/+0
|\ \