summaryrefslogtreecommitdiff
path: root/openstackclient/compute/v2/server.py
Commit message (Collapse)AuthorAgeFilesLines
* Re-implement novaclient bits removed in 10.03.14.2Dean Troyer2018-04-201-17/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. Closes-Bug: #1745795 Change-Id: I5116086f9a9e4b2b31a744bf8f4558c79f0bfe59 (cherry picked from commit 53e7aab7ed4d6c981ca067c1db8bce290a5f0055)
* 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
* | 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
* 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
|\
| * Add --network and --port to server createDavid Rabel2017-04-071-3/+37
| | | | | | | | | | | | | | | | | | --nic option is quite unhandy. It is better to have two seperate options --network and --port to add a network to a new server. Change-Id: I523abdc83ca2dd4c5dd3871f8f109c2bf57c2e02 Closes-Bug: #1612898
* | Low-level Compute v2 API: networkDean Troyer2017-04-171-4/+6
| | | | | | | | | | | | | | | | | | | | api.compute.APIv2 network functions. novaclient 8.0 is now released without support for the previously deprecated nova-net functions, so include a new low-level REST implementation of the removed APIs. Change-Id: If230f128e91cda44461fe93c976cac2aecec2252
* | Low-level Compute v2 API: security groupDean Troyer2017-04-111-11/+5
| | | | | | | | | | | | | | | | | | | | api.compute.APIv2 starts with security group functions. novaclient 8.0 is now released without support for the previously deprecated nova-net functions, so include a new low-level REST implementation of the removed APIs. Change-Id: Id007535f0598226a8202716232313e37fe6247f9
* | Enable to specify which fixed-ip to add to a vm.Cedric Brandily2017-04-041-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This change enables to specify which fixed-ip will be added to a vm using: openstack server add fixed ip <vm> <network> --fixed-ip-address <ip> This change uses interface_attach instead of add_fixed_ip[1] which is less flexible and uses a deprecated API. [1] https://review.openstack.org/384261 Closes-Bug: #1678140 Change-Id: I7fe4621439ef0d8dca080551ffaeb614c5a91174
* | Merge "Help/docs cleanups: marker, limit, ip-address metavars"Jenkins2017-04-041-23/+22
|\ \
| * | Help/docs cleanups: marker, limit, ip-address metavarsDean Troyer2017-04-041-23/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cleanup help strings and docs for clarity and to keep things consistent: * --limit metavar should be <num-resource> to indicate what is being counted * --marker metavar should be <resource> or <resource-id> to indicate the type of value being specified * <*-ip-address> metavars should be just <ip-address> as there is no difference in format between fixed and floating IPs * Move all occurances of '(name or ID)' to end of help text Change-Id: I2c31746ed6ded3845244e03e57d809f8bc0e6b9d
* | | Merge "Enable to add/remove port to/from a server"Jenkins2017-04-031-0/+66
|\ \ \
| * | | Enable to add/remove port to/from a serverCedric Brandily2017-04-031-0/+66
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change enables to add/remove a specific port to/from a server using the new commands: openstack server add port <vm> <port> openstack server remove port <vm> <port> Closes-Bug: #1678137 Change-Id: I6ee57df089235ccc1fb9d38316bd484956b1134d
* | | Fix block-device-mapping when volume_size is emptyJens Rosenboom2017-04-031-1/+1
|/ / | | | | | | | | | | | | | | | | The Nova API responds with an validation error when a bdm is submitted containing an empty volume_size. So instead omit that attribute when it is empty. Change-Id: Iba905fca8c440a03e828c20922f3b813bba3fa3a Closes-Bug: 1677236
* | Merge "Enable to specify which vm fixed-ip to publish"Jenkins2017-03-211-1/+8
|\ \
| * | Enable to specify which vm fixed-ip to publishCedric Brandily2017-03-201-1/+8
| |/ | | | | | | | | | | | | | | | | | | This change enables to specify which vm fixed-ip will be associated to a floating ip using: openstack server add floating ip <vm> <fip> --fixed-ip-address <ip> Closes-Bug: #1624524 Change-Id: I2ddb68c5873bfed7293b0e661d1adbe111681136
* | Merge "Adds missing flavor information in the server list long command"Jenkins2017-03-201-2/+25
|\ \
| * | Adds missing flavor information in the server list long commandJose Castro Leon2017-03-131-2/+25
| |/ | | | | | | | | | | Closes-Bug: #1672396 Change-Id: Ie2a664fd1c3db1b8269ea079df181f87afc702a7
* | Add a validation about options for server migrate commandRikimaru Honjo2017-03-011-0/+4
|/ | | | | | | | | | | | | | | | | | | | | The behavior of server migrate command are different depending on whether user specify --live option or not. server migrate command will call live migration API if user specify --live option. Ohterwise server migrate command will call migration(cold migration) API. Now then, "--block-migraiton" option and "--disk-overcommit" option only affect live-migration. But, openstackclient doesn't warn user if user specify these options without "--live". But, user can't recognize that specifying options are ignored. This patch adds a validation that checks whether or not user specify these options without "--live". Change-Id: Ifa278abb23ecdba4b13f3742998359ac74eb7ad4 Closes-bug: #1662755
* Fix "server create" command failed when --nic auto or noneRui Chen2017-02-151-8/+28
| | | | | | | | | | | "auto" and "none" options was added into --nic argument of server create command in patch https://review.openstack.org/#/c/412698/ , but that don't work and raise internal error when execute command. The patch fix that issue and add unit and functional tests. Change-Id: Ia718c3bac0a5172a0cdbe9f0d97972a9346c1172 Co-Authored-By: Kevin_Zheng <zhengzhenyu@huawei.com> Closes-Bug: #1663520
* Cleanup for 3.8.0 releaseDean Troyer2017-01-261-2/+5
| | | | | | Release notes and proofreading cleanups. Change-Id: Iddc6a64e6ea3082aa220a2465793e6f7f2aecaa9
* Merge "Add options to "server list" command"Jenkins2017-01-261-0/+25
|\
| * Add options to "server list" commandjiahui.qiang2017-01-251-0/+25
| | | | | | | | | | | | | | Add "--deleted" and "--changes-since" options to "server list" command. Change-Id: Id94f6e5831a60b172b6cfcfca29b1d89de8db621 Closes-Bug:#1647242
* | Switch server create to block_device_mapping_v2Nikita Gerasimov2017-01-261-20/+32
|/ | | | | | | | | | | | | | | | | | | | | | | | | Current compute_client.servers.create() relies on block_device_mapping arg which is legacy[1]. "block_device_mapping" format require device_name which is leads to hard-coded hack in --volume key handler to KVM specific. "block_device_mapping_v2" format is more friendly to hypervisiors. Support of block_device_mapping_v2 appear in python-novaclient 2.16.0, openstackclient require at least 2.29.0 Makes options --volume and --block-device-mapping work simultaneously. Appends --block-device-mapping data even if --volume used. After bug 1383338 only --volume was taken when both are used. [1]http://docs.openstack.org/developer/nova/block_device_mapping.html NOTE(dtroyer): I moved the new test_boot_from_volume() functional test to Ie51b1c375c5940856ec76a5770df3c6bd18a3eba to test our previous behaviour. The only changes required to support the new behaviour should be that the empty_volume is now attached in that test. Change-Id: I7bac3d870dd9ca404093142f8bce22a62e49180d Closes-Bug: 1647406 Closes-Bug: 1497845
* Use image client for images instead of computeArtom Lifshitz2017-01-241-8/+12
| | | | | | | | | | | | | With the deprecation of the Nova proxy APIs in microversion 2.36 [1], any operation that uses a microversion higher than 2.36 and works with images will fail because the /images endpoint will return 404. This patch updates openstackclient to query images using the image client in places where previously the compute client was used. [1] http://docs.openstack.org/developer/nova/api_microversion_history.html#id33 Change-Id: Ia66e44e530799ce6531922dcf6a84e38528c8725 Closes-bug: 1630161
* Error in the return of command server show, createjiahui.qiang2017-01-171-0/+14
| | | | | | | | | | | | The raw output in the command 'openstack server create'(also in show) is used in display table directily. the item like os-extended-volumes:volumes_attached and security_groups needs to convert. the worry output: os-extended-volumes:volumes_attached | [{u'id': u'c3525de9-1cbf-4ac8-8b7a-ca295c46633b'}] security_groups | [{u'name': u'default'}] Change-Id: Id9db251c315f989e1dc5b1b6231ab328014213e3
* update server migrate '--wait' descriptionlicanwei2016-12-301-1/+1
| | | | | | | | 'Wait for resize to complete' ==> 'Wait for migrate to complete' Change-Id: I0e08968c0132f0a8e1ef1ce2e6179001315372c3
* Should support 'auto' and 'none' as network parameter when boot instancesKevin_Zheng2016-12-221-30/+36
| | | | | | | | | | Nova added support using 'auto' and 'none' as network parameters since microversion 2.37: http://git.openstack.org/cgit/openstack/nova/tree/nova/api/openstack/rest_api_version_history.rst#n389 we should also add support for this in OSC. Change-Id: I6e5f616dfa48895ebd13144effe9fda7cb94c649 Closes-bug: #1651288
* translate all command help strings3.4.0Steve Martinelli2016-11-171-32/+33
| | | | | | | | | | | | | | Leverage the new cliff command class attribute (_description) to get the help of a command, this allows us to mark strings for translation. We could not do this before since the help was grabbed from the docstring. This also depends on a new release of cliff and a bump to the minimum level in osc's requirements. Closes-Bug: 1636209 Depends-On: Id915f6aa7d95a0ff3dc6e2ceaac5decb3f3bf0da Change-Id: I8673080bb5625e8e3c499feaefd42dfc7121e96f
* Fix --shared/block-migration options in server migrate commandCedric Brandily2016-10-111-8/+8
| | | | | | | | | | | | Currently, --shared-migration and --block-migration options effects are reversed: --block-migration requests a migration with share, --shared-migration a block-migration. This change corrects OSC implementation and clarifies arguments passed to novaclient (the root cause of the bug). Change-Id: Ib682cff0c44d3b1304670f8606907b1762d8b1e7 Closes-Bug: #1518059
* Correct login name deduction in SshServerCedric Brandily2016-09-151-1/+1
| | | | | | | | | Currently SshServer ("server ssh" command) raises an AttributeError if no explicit login is provided because it uses an attribute which no more exists. Change-Id: I86f68230037d51efb41aca62e07e058733ecd67a Closes-Bug: #1624085
* Pass security group id to novaclient while adding securityRajasi Kulkarni2016-07-281-1/+1
| | | | | | | | | | | | | | group to server In AddServerSecurityGroup, we currently pass the security group name to novaclient. If multiple security groups with same name exist, then even while passing secuity group using id to command 'openstack server add security group <server> <group>' it results in error 'Multiple security_group matches found'. Added unit test case to test the command. Change-Id: I6097eb36e1545c85209cfd767c477e10f82c6999 Closes-Bug: 1604076
* Merge ""server list": "Image Name", "Image ID" columns"Jenkins2016-07-221-11/+42
|\
| * "server list": "Image Name", "Image ID" columnsMarc Abramowitz2016-07-061-11/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `Image Name` column is shown by default (i.e.: without passing `--long`). E.g.: ``` $ openstack server list WARNING: openstackclient.common.utils is deprecated and will be removed after Jun 2017. Please use osc_lib.utils +--------------------------------------+-----------------+---------+----------------------+----------------------+ | ID | Name | Status | Networks | Image Name | +--------------------------------------+-----------------+---------+----------------------+----------------------+ | abe67035-b14f-4541-b436-e0e778ec4227 | n9anonw302mgm1 | ACTIVE | mnky3-3000=10.3.0.55 | Koala.2016-07-01-175 | | 8f6a2d12-2bc3-4d89-ba94-8916ce9cdf92 | n9anonw301mgm1 | ACTIVE | mnky3-3000=10.3.0.37 | Koala.2016-07-01-175 | | b316d6d1-67cf-4f75-94a4-4c9a2b03f6a4 | n9dobby301mgm0 | ACTIVE | mnky3-3000=10.3.0.36 | Koala.2016-05-04-130 | +--------------------------------------+-----------------+---------+----------------------+----------------------+ ``` The `Image ID` column is only available with `--long`. E.g.: ``` $ openstack server list --long -c Name -c "Image Name" -c "Image ID" WARNING: openstackclient.common.utils is deprecated and will be removed after Jun 2017. Please use osc_lib.utils +-----------------+----------------------+--------------------------------------+ | Name | Image Name | Image ID | +-----------------+----------------------+--------------------------------------+ | n9anonw302mgm1 | Koala.2016-07-01-175 | f587c6fc-1df3-42cd-ac86-8cd2c995a8d9 | | n9anonw301mgm1 | Koala.2016-07-01-175 | f587c6fc-1df3-42cd-ac86-8cd2c995a8d9 | | n9dobby301mgm0 | Koala.2016-05-04-130 | 37ff47a6-3e51-4986-bfa5-62afbfad5dfc | +-----------------+----------------------+--------------------------------------+ ``` Closes-Bug: #1599304 Change-Id: I477995b840eb9520b285948926ebbfe1777dd86c
* | Pass security group id to novaclientRajasi Kulkarni2016-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | In RemoveServerSecurityGroup we currently pass the entire security group object, which results in TypeError in novaclient. Added unit test case to test command 'openstack server remove security group -h <server> <group>' Change-Id: I6d486403a83804c3a30d6f89d2cf7f64f09797c6 Closes-Bug: 1590883
* | Transfer "ip fixed add/remove" to "server add/remove fixed ip"Tang Chen2016-07-041-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch does the following things to transfer "ip fixed add/remove" to "server add/remove fixed ip": * Add new command "server add/remove fixed ip", and unit tests and doc. * Deprecate "ip fixed add/remove" command. compute/v2/fixedip.py is not removed because the arguments' positions are different between the new and old commands. * ip fixed add <network> <server> server add fixed ip <server> <network> * ip fixed remove <ip-address> <server> server remove fixed ip <server> <ip-address> Change-Id: Ica07ccf92a76c21fd5608ecaff86ff7c4d96f5a0 Implements: blueprint rework-ip-commands Partial-bug: 1555990 Co-Authored-By: Dean Troyer <dtroyer@gmail.com>
* | Transfer "ip floating add/remove" to "server add/removeTang Chen2016-07-041-0/+55
|/ | | | | | | | | | | | | | | | | | | | | | floating ip" This patch does the following things to transfer "ip floating add/remove" to "server add/remove floating ip": * Add new command "server add/remove floating ip", and unit tests and doc. * Deprecate "ip floating add/remove" command. compute/v2/floatingip.py is not removed because the arguments' positions are different between the new and old commands. * ip floating add <ip-address> <server> server add floating ip <server> <ip-address> * ip floating remove <ip-address> <server> server remove floating ip <server> <ip-address> Change-Id: Ic0dd22ca6fb7b7bc3e820fd5a14d7c551e7ab963 Implements: blueprint rework-ip-commands Partial-bug: 1555990 Co-Authored-By: Dean Troyer <dtroyer@gmail.com>