summaryrefslogtreecommitdiff
path: root/openstackclient/compute
Commit message (Collapse)AuthorAgeFilesLines
* Stop silently ignoring invalid 'server create --hint' optionsStephen Finucane2020-02-191-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 (cherry picked from commit ea27ebb0f918db9eab2f5751a1b065818faa0e6d) (cherry picked from commit 576d9ecfd0ac27611ec89af6d34e7378b7a39fb3) (cherry picked from commit 38e1274f478219bee8899b6c9eaa09dbfd03bbcd)
* Merge "Document 2.53 behavior for compute service list/delete" into stable/rockyrocky-em3.16.3Zuul2019-09-251-2/+9
|\
| * Document 2.53 behavior for compute service list/deleteMatt Riedemann2019-09-231-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 (cherry picked from commit 1557afb554e908e097abd39081891ea78083e20e) (cherry picked from commit 111d6a9b23d8c6b9bcce437039ff49536f0b5dd1)
* | Merge "Fix compute service set handling for 2.53+" into stable/rockyZuul2019-09-241-7/+56
|\ \ | |/
| * Fix compute service set handling for 2.53+Matt Riedemann2019-09-211-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 (cherry picked from commit 4bd53dc1090fda86f6ce25b76a079e250c9206d8) (cherry picked from commit 100d34c54ecdfedf6fb40a2686e1aae1f54df97e)
* | Fix BFV server list handling with --name-lookup-one-by-onemelanie witt2019-07-221-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 (cherry picked from commit bfc34e11b3437506508b3e120accc0e212268ac6) (cherry picked from commit 83359fbe4fd7e5850abd45a467bf197c284519b1)
* | Add --name-lookup-one-by-one option to server listPavlo Shchelokovskyy2019-07-221-22/+48
|/ | | | | | | | | | | | | | | | | | | | | usually in a big cloud there are many images and flavors, while each given project might use only some of those. This patch introduces '--name-lookup-one-by-one' argument to server list command (mutually exclusive with '--no-name-lookup') When provided (or either '--image' or '--flavor' is specified) to the `server list` command, name resolving for corresponding entity is now using targeted GET commands instead of full entities list. In some situations this can significantly speedup the execution of the `server list` command by reducing the number of API requests performed. Change-Id: I59cbf3f75c55e5d3747654edcc9be86ad954cf40 Story: #2002039 Task: #19682 (cherry picked from commit e782f49927a6b142a35f85a1a4a759fd2b1ceedf)
* Handle multiple ports in AddFloatingIP3.16.2melanie witt2018-11-081-7/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AddFloatingIP refers to an old nova proxy API to neutron that was deprecated in nova. The neutron API for floating IP associate requires a port to be specified. Currently, the code is selecting the first port if the server has multiple ports. But, an attempt to associate the first port with a floating IP can fail if the first port is not on a network that is attached to an external gateway. In order to make the command work better for users who have a server with multiple ports, we can: 1. Select the port corresponding to the fixed_ip_address, if one was specified 2. Try to associate the floating IP with each port until one of the attempts succeeds, else re-raise the last exception. (404 ExternalGatewayForFloatingIPNotFound from neutron) This also fixes incorrect FakeFloatingIP attributes that were being set in the TestServerAddFloatingIPNetwork unit tests, which were causing the tests to use None as parsed args for ip-address and --fixed-ip-address and thus bypassing code in the 'if parsed_args.fixed_ip_address:' block. Task: 27800 Story: 2004263 Change-Id: I11fbcebf6b00f12a030b000c84dcf1d6b5e86250 (cherry picked from commit 013c9a4f3a44cb0b81fc7affe9b933e701cb5dba)
* Default --nic to 'auto' if creating a server with >= 2.37Matt Riedemann2018-10-251-3/+8
| | | | | | | | | | | | | | | Compute API version >= 2.37 requires a 'networks' value in the server create request. The novaclient CLI defaults this to 'auto' if not specified, but the novaclient ServerManager.create python API binding code does not, as it wants clients to be explicit. For the purposes of the OSC CLI, we should follow suit and if the user is requesting OS_COMPUTE_API_VERSION>=2.37 without specific nics, we should just default to 'auto'. Change-Id: Ib760c55e31209223338a4086ff1f4fee88dc6959 Closes-Bug: #1750395 (cherry picked from commit 1008544882fbdae16b045abca05cf3e2e8a14787)
* Merge "Don't sent disk_over_commit if nova api > 2.24"Zuul2018-07-251-5/+8
|\
| * Don't sent disk_over_commit if nova api > 2.24Artom Lifshitz2018-07-241-5/+8
| | | | | | | | | | | | | | | | | | | | In API microversion 2.25 Nova removed the disk_over_commit parameter to the live migration server action. This patch makes sure that we don't include it in our request if we're running with 2.25 or higher. Story: #2002963 Task: #22966 Change-Id: I1bbdd33be96d82422a05982508e370237c3560f3
* | compute: host: expand kwargs in host_set() callBenoƮt Knecht2018-07-201-1/+1
|/ | | | | | | | | | | | | | | | | | | | | `host_set()` expects `status` and `maintenance_mode` as keyword arguments, but in `SetHost.take_action()`, it is called without expanding the keyword arguments. So it's called as ``` host_set(host, {'status': 'enable'}) ``` instead of ``` host_set(host, status='enable') ``` Change-Id: If0b37ac60091161a892bfc694fce31a988f66005 Task: 23023
* Skip calls to glance and nova when got no serversPavlo Shchelokovskyy2018-07-091-2/+2
| | | | | | | | | | save (potentially many) HTTP calls to Glance API for image list and a call to Nova API for flavor list when the server list actually returned no servers. Change-Id: I93a56138c50b82fb4dce67a2f788107f71c5f423 Story: #2002039 Task: #19681
* Merge "Display private flavors in server list"Zuul2018-06-291-1/+1
|\
| * Display private flavors in server listnpraveen352018-03-211-1/+1
| | | | | | | | | | | | | | | | Update the code so that "openstack server list --all" also displays the names of private flavors. Change-Id: I4804fcd905eaf67b1ad9b461084eaf0caa820d2f Closes-Bug: #1742453
* | Merge "Compute: Add description support for flavor"Zuul2018-06-281-1/+27
|\ \
| * | Compute: Add description support for flavortianhui2018-06-201-1/+27
| | | | | | | | | | | | | | | | | | | | | Co-Authored-By: Fan Zhang <zh.f@outlook.com> Change-Id: I0dc80bee3ba6ff4ec8cc3fc113b6de7807e0bf2a Story: 2002196 Task: 21681
* | | compute: limit the service's force down command above 2.10He Jie Xu2018-06-191-10/+16
|/ / | | | | | | | | | | | | The force down action is added in Microversion 2.11, we should limit the command only can be executed when the microversion is above 2.10. Change-Id: I0a87e02e71ff025d30181fc17ebcd003a590f110
* | Fix server show for microversion 2.47Matt Riedemann2018-06-081-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Compute API version 2.47 embeds the server's internal flavor in the response. The original flavor id is not preserved since it could have changed if the flavor was deleted and re-created after the server was created, which was the dreaded Horizon "Edit Flavor" issue. So the flavor dict in the server response is a dict of information about the flavor representing the server "right now" excluding the id. The original flavor name is shown though along with the ram/disk/vcpu etc information. The server list command has a similar issue which will be fixed in a follow up change. Change-Id: I1a92999758006d02567c542b6be8902a049899cc Task: 13864 Story: 1751104
* | Optimize _prep_server_detail to avoid redundant find_resourceMatt Riedemann2018-06-081-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When showing a server or doing a rebuild, we already have the latest version of the server so _prep_server_detail getting the server again is an unnecessary performance hit. ShowServer is pretty obvious here. For RebuildServer, the compute API actually refreshes the server before returning it in the response, so the client already gets the latest when the rebuild call returns. The only other usage of _prep_server_detail that does require a refresh is CreateServer since the POST /servers response is a minimal version of the server object. This adds a new refresh kwarg, backward compatible by default, to _prep_server_detail but changes ShowServer and RebuildServer to no longer refresh. Change-Id: Ib1c9c424ed1cafc2dfd8be90af8de8a774bdfbf0
* | Use Server.to_dict() rather than Server._infoMatt Riedemann2018-06-081-4/+6
| | | | | | | | | | | | | | | | | | | | | | There is a to_dict() method on the Server object from python-novaclient which makes a deepcopy of the internal Server._info - use this instead of accessing the _info attribute directly. Also, while in here, fixed a typo in _prep_server_detail. Change-Id: I679b4489c815f8a54368ef6b23b9f77e75b4d0bc
* | Prevent "server migrate --wait" from hangingJulie Pichon2018-05-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Migrate uses the same mechanism in the backend than Resize and so the steps and step names are similar. Currently when using the --wait option with 'migrate', we wait forever because the status won't get to active until the user performs an action. This makes it return on verify_resize status just like 'resize' does, so that the user can perform the next manual step. Change-Id: Ie1aeac52506bc8801f88fd6a6eb4f6094cf20050 Story: 2001994 Task: 19621
* | Merge "Add --image-property parameter in 'server create'"Zuul2018-03-311-0/+45
|\ \
| * | Add --image-property parameter in 'server create'Chen Hanxiao2018-03-281-0/+45
| | | | | | | | | | | | | | | | | | | | | add --image-property option, just like --image-with of novaclient did. Change-Id: Ic1a8976559255529a8785b1b301a0307812433cb Signed-off-by: Chen Hanxiao <chenhx@certusnet.com.cn>
* | | Merge "Fix additional output encoding issues"Zuul2018-03-294-41/+67
|\ \ \ | |/ / |/| |
| * | Fix additional output encoding issuesDean Troyer2018-03-204-41/+67
| | | | | | | | | | | | | | | | | | | | | | | | This is a followup to https://review.openstack.org/#/c/541609/ that changes most outstanding direct uses of sys.stdout to use the encoded stdout set up by cliff. Change-Id: I07cfc418385fc787d3b7d3c32d39676cf81bb91f
* | | Merge "Fix crashing "console log show""Zuul2018-03-231-3/+4
|\ \ \ | |/ /
| * | Fix crashing "console log show"Thomas Goirand2018-03-161-3/+4
| |/ | | | | | | | | | | | | | | | | | | | | Because of encoding issue, the "openstack console show log" is prone to a stack dump, as explained in the bug report. Use the stdout handle that has already been set up by cliff's App class with a sane default encoding. Change-Id: I4d8b0df7f16ee0463e638bb11276220e5b92023b Closes-Bug: 1747862
* | Re-implement novaclient bits removed in 10.0Dean Troyer2018-03-132-28/+49
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a) /os-floating-ips was removed in Compute API 2.36 and from novaclient's Python API in 10.0 Add to api.computev2: floating_ip_add() floating_ip_remove() Convert add floating IP command to nova-net/neutron split: "server add floating ip" "server remove floating ip" b) /os-hosts was removed in Compute API 2.43 and from novaclient's Python API in 10.0. Add to api.computev2: host_list() host_set() host_show() Convert host commands to use intenal api: "host list" "host set" "host show" c) The introduction of the Network-style commands into the server group broke cliff's autoprogram directive as it executes the get_parser() methods without fully initializing the Command object. NOTE: This is really three reviews squashed to get through the gate in one pass. Depends-on: Id6de87211d6c4ea8fd14aa9203d8d5b17e9e2f04 Change-Id: I5116086f9a9e4b2b31a744bf8f4558c79f0bfe59
* Corrected spelling mistakeDavid Rabel2018-01-191-1/+1
| | | | | | in quotas -> in quotes Change-Id: I3adb1ccd8f3a9c495f0b9cf688aee5c4c1e63507
* flavor: clarify --swap descriptionChen Hanxiao2017-12-281-1/+1
| | | | | | | | | | --swap will add a additional storage device, which not affect the original swap partition/device. This patch will clarify this misleading description. Change-Id: Ic079c069985d39cc969b97876901007a81883f57 Signed-off-by: Chen Hanxiao <chenhx@certusnet.com.cn>
* Merge "Send 'changes-since' instead of 'changes_since' query parameter"3.13.0Zuul2017-12-131-6/+7
|\
| * Send 'changes-since' instead of 'changes_since' query parameterDaniel Speichert2017-12-111-6/+7
| | | | | | | | | | | | | | | | | | | | Per API reference, only 'changes-since' is accepted and the variant with underscore is ignored, making the CLI functionality broken. [dtroyer] added release note and fixed unit tests. Change-Id: I0c596531a8af03da17d5ce39d75b12e941403aa5 Closes-Bug: 1732216
* | Remove hard-coded policy choices for creating a server groupMatt Riedemann2017-11-191-2/+3
| | | | | | | | | | | | | | | | | | | | | | The hard-coded choices for the server group policy make it impossible to create a server group with the soft-affinity or soft-anti-affinity policy rules which were added in compute API microversion 2.15. This removes the hard-coded choices so that the policy is restricted on the server side rather than the client side. Change-Id: Ib3dc39422ac1015872d56ae2fdeddf0f29613494 Closes-Bug: #1732938
* | Add RemoveNetwork command to serverHongbin Lu2017-11-141-0/+35
|/ | | | | | | This command will detach a server from a network. All server's neutron ports that belongs to the specified networks will be removed. Change-Id: I83a064ed62ab00c6f1016900b9cf30f1c15b8382
* Merge "Added AddNetwork command to server"Zuul2017-10-301-0/+33
|\
| * Added AddNetwork command to serverHongbin Lu2017-10-261-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently, if users want to add another NIC to a running instance, they need to (i) create a neutron port and (ii) add the port to the server via teh AddPort command. It would be more convenient to have a single command to achieve the equivalent. Novaclient already support adding network to an instance via the interface-attach command. This patch introduces a similar capability in OSC. Change-Id: Ia3e39c57ae7ecb96aae1b66adc52c289daccb6ec
* | Add missing parameters on openstack server rescueJose Castro Leon2017-10-271-5/+24
|/ | | | | Change-Id: I27afca9e826378dbcb7feb7528e0c65c528b04b0 Closes-Bug: #1703278
* Use flake8-import-order pluginAkihiro Motoki2017-08-171-1/+1
| | | | | | | | | | | | | | | | In reviews we usually check import grouping but it is boring. By using flake8-import-order plugin, we can avoid this. It enforces loose checking so it sounds good to use it. This flake8 plugin is already used in tempest. Note that flake8-import-order version is pinned to avoid unexpected breakage of pep8 job. Setup for unit tests of hacking rules is tweaked to disable flake8-import-order checks. This extension assumes an actual file exists and causes hacking rule unit tests. Change-Id: I12b596820727aeeb379bee16c2bc993dee9eb637
* Merge "Start using 'cliff.sphinxext'"Jenkins2017-07-211-9/+23
|\
| * Start using 'cliff.sphinxext'Stephen Finucane2017-07-211-9/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 'cliff', the command line library used by 'osc_lib' (and, thus, 'python-openstackclient') recently gained a Sphinx extension to automatically document cliff commands. This allows us to use the documentation we already have in code instead of duplicating it in the documentation. Introduce the use of this, starting with the 'server' commands. This requires extending the descriptions for two commands to ensure no information is lost. Change-Id: If701af8d5a3f78f4b173ceb476dd0c163be4b6ca
* | Merge "Now OSC server create check keys in --nic"Jenkins2017-07-201-6/+10
|\ \ | |/ |/|
| * Now OSC server create check keys in --nicM V P Nitesh2017-06-231-6/+10
| | | | | | | | | | | | | | | | Now OSC command to create server will check all the keys in --nic and throws an exception if the key is invalid key. Change-Id: I5482da0ae63d6d4298aa614e4d09bb0547da9ec3 Closes-Bug: #1681411
* | Fix column names for server list --no-name-lookupDean Troyer2017-07-171-14/+21
| | | | | | | | | | | | | | | | When --long is not present change the 'Image Name' column to 'Image' and add the 'Flavor' column. These columns will contain Names unless --no-name-lookup is specified when they will contain IDs. Change-Id: I92cfb22136aee32616894e60e9227b4da185da99
* | Add server list -n and --no-name-lookup argumentsBoris Pavlovic2017-07-101-16/+29
|/ | | | | | | | | | | | | | Remove translation of Image ID and Flavor ID to Image and Flavor names In large environments amount of images can be very large (thousands) Which requires ~hundreds of requests to Glance to get all images (by default client request only 20 images) As a result listing even few servers is going to take minutes This patch allows to avoid these queries by not doing translation, which allows one to get information about servers in seconds. Change-Id: I4ae00e6324a41c4c79bf5b620179dae99aea5431
* Merge "Create server with security group ID and name"Jenkins2017-05-221-2/+18
|\
| * Create server with security group ID and nameRui Chen2017-05-221-2/+18
| | | | | | | | | | | | | | | | | | | | | | Both resource ID and name are supported to identify an object in openstackclient to make user easy to input, for security group, nova only support security group name in API when launch a new server, this patch convert ID to name, then pass name to nova API, and check the security group exist before creating server. Change-Id: I1ed4a967fb9de3f91c8945a1ef63f6c7b6b2dfb2 Closes-Bug: #1687814
* | Make block-device-mapping more stable and clearRui Chen2017-05-171-30/+48
|/ | | | | | | | | | | | | | | | | | | | | | The patch fix the following issues: 1. ValueError is raised if input don't contain "=". Sometimes the whole "server create" command is very complex, it's difficult to find out root reason directly. 2. Don't support to add block device from snapshot, like: --block-device-mapping vdb=0c8ae9d8-cadc-4a23-8337-4254614d277e:snapshot:1, it's supported by novaclient, but not in osc. 3. If input "vdb=", not add any mapping information, the server will be launched successfully, not raise error message to let use add volume/snapshot id, just ignore "--block-device-mapping" option. 4. The help message of "block-device-mapping" option is so simple, need to add some details about how to add <type>, <delete_on_terminate> contains. Change-Id: Ib7f7a654c3dc2a8272545f168b4c4ced230ce39e Depends-On: Ib37913891bbf7a31b570404c4668c490d5ac859b Closes-Bug: #1667266
* Fix server create with nova-netDean Troyer2017-04-261-3/+2
| | | | | | A Neutron-ism slipped by in server create. Change-Id: Id590d7f93df2a41d7bd7617459a2af159a6f8071
* Merge "Add --network and --port to server create"Jenkins2017-04-251-3/+37
|\