summaryrefslogtreecommitdiff
path: root/openstackclient/compute/v2/server.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix --shared/block-migration options in server migrate commandnewton-eolstable/newtonCedric Brandily2017-07-051-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 (cherry picked from commit 694a24c3093f5b2595b63ccf988da7972e532084)
* Use image client for images instead of computeArtom Lifshitz2017-02-061-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 (cherry picked from commit 98f803e0f0e622e7770cfab52e99168f6a68f427)
* 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>
* Standardize logger usageTang Chen2016-06-201-16/+20
| | | | | | | | | | | | | | | | | | | Use file logger for all command specific logs. This patch also fixes some usage that doesn't follow rules in: http://docs.openstack.org/developer/oslo.i18n/guidelines.html After this patch, all self.log and self.app.log will be standardized to LOG(). NOTE: In shell.py, we got the log in class OpenStackShell, which is also known as self.app.log in other classes. This logger is used to record non-command-specific logs. So we leave it as-is. Change-Id: I114f73ee6c7e84593d71e724bc1ad00d343c1896 Implements: blueprint log-usage
* Merge "Move server image create command to its own resource file."Jenkins2016-06-161-74/+0
|\
| * Move server image create command to its own resource file.Dean Troyer2016-06-031-74/+0
| | | | | | | | Change-Id: If37e82072bd7a32b81bfb1a8bb048f018dd5b04f
* | osc-lib: commandDean Troyer2016-06-131-1/+1
| | | | | | | | | | | | | | Leave command.py and test_command.py as a sanity check during the deprecation period. Change-Id: I24e1b755cbfbcbcaeb5273ec0c9706b82384fc85
* | osc-lib: parseractionsDean Troyer2016-06-131-1/+1
| | | | | | | | | | | | | | Leave parseractions.py and test_parseractions.py as a sanity check during the deprecation period. Change-Id: I1a7469b6d872284e0276502a1a287bc0b87f8f83
* | osc-lib: utilsDean Troyer2016-06-131-1/+1
| | | | | | | | | | | | | | | | Use osc-lib directly for utils. Leave openstackclient.common.utils for deprecation period. Change-Id: I5bd9579abc4e07f45219ccd0565626e6667472f7
* | osc-lib: exceptionsDean Troyer2016-06-131-3/+3
| | | | | | | | | | | | | | | | Use osc-lib directly for exceptions. Leave openstackclient.common.exceptions for deprecation period. Change-Id: Iea3e862302372e1b31ccd27f69db59b4953ca828
* | Add newline to strings in stdout/stderr.write()Lu lei2016-06-061-1/+1
|/ | | | | | Function stdout/stderr.write() can't break line automatically. Change-Id: I903c2d1cc1a669adb6be5aa4eb783d3b9943e685
* Merge "Fix output and error log in server.py"Jenkins2016-05-311-9/+17
|\
| * Fix output and error log in server.pyTang Chen2016-05-281-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes 2 problems: 1. The '\n' should be in the end of a message, not the beginning. i.e.: The original code was: sys.stdout.write(_('\nError deleting server')) It will make the output look like this: [root@tangchen /]# openstack server delete aaa bbb Error deleting server Error deleting server[root@tangchen /]# We change it to: sys.stdout.write(_('Error deleting server\n')) Then the output will become: [root@tangchen /]# openstack server delete aaa bbb Error deleting server Error deleting server [root@tangchen /]# which is much better. 2. Record the error in log for those who didn't. Change-Id: I38b00c2321014757970183205f95f026e20a8090
* | Support to set server stateRui Chen2016-05-281-0/+9
|/ | | | | | | | | | When a server is unexpected state, OSC don't support reset the server to active or error state, that's supported by novaclient, and it's an important command for operators, the patch implement this function. Change-Id: I3e7800feb192832b0719ef9a353945beb6bfd509 Implements: blueprint server-reset-state
* Fix i18n support for help and error messages in computeTang Chen2016-05-241-14/+23
| | | | | Change-Id: Id6eebcb48d1b7b49b6636524506294edbc44a83f Partial-bug: #1574965
* remove #noqa from i18n importsSteve Martinelli2016-05-131-1/+1
| | | | | | hacking checks no longer fail on `import _` Change-Id: Idd60f0a0e71e5081691eacb39e5091ab08fcce6d
* Merge "Use find_resource() instead of get() in _prep_server_detail()"Jenkins2016-05-111-4/+1
|\
| * Use find_resource() instead of get() in _prep_server_detail()Tang Chen2016-05-091-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There is such a comment in test_server.py: # Call .get() to retrieve all of the server information # as findall(name=blah) and REST /details are not the same # and do not return flavor and image information. This is an out of date comment. There is no function named findall() in OSC now. So use find_resource() instead of get(), and remove this comment. Change-Id: I8d79afc5f341fb5caf771d905506b7f1c7a41ae8
* | Map server power state num to meanful stringTang Chen2016-05-071-0/+5
|/ | | | | | | | | | | | | In _prep_server_detail(), power_state is not formatted by _format_servers_list_power_state(). So when executing "server show" or "server create", the power state is represented by number. This patch map the numbers to meanful strings. This patch also adds power_state attribute to FakeServer, and improves unit tests for this attribute. Change-Id: I2ec674327de4e5133b8712ba6bb53fa5ce55e3f4
* Doc: Unify repeatable option commentsTang Chen2016-04-121-4/+4
| | | | | | | | | | | | There are lots of "this option can be repeated" comments in the doc, which are not consistent to other similar docs. This patch changes them to the following format: "repeat option to do something" Change-Id: I54e01053091c428bf87bb36bb95f73a0b80ab6e7
* Fix "server unset" document issueRui Chen2016-03-231-1/+1
| | | | | | | Fix "--property" option describe issue in "server unset" document, and update the help message to keep consistent. Change-Id: I68022a187e83fad6320365400ad2a1b0c8cf9a61
* Trivial: Use 'SSH' rather than 'Ssh'Stephen Finucane2016-03-091-1/+1
| | | | | | This is reflected in the '--help' screen. Change-Id: Ic22a65ff6a56b069b37a0ea8365cce2b3f93621c
* Merge "" openstack server image create " doesn't print proper info"Jenkins2016-03-061-5/+19
|\
| * " openstack server image create " doesn't print proper infoMohan Muppidi2016-03-031-5/+19
| | | | | | | | | | | | | | | | | | | | | | After creating a snapshot of a running instance, a print out similar to server create is expected, but it prints out something like "_info" which is nothing related to created image. _prep_image_detail method is added to /compute/v2/server.py to enable the priting, while running the test properly. Change-Id: I4b06be959768bcdaafd9aa8df497490958bee649 Closes-Bug:1551586
* | Merge "[compute] Support restore server"Jenkins2016-03-041-0/+22
|\ \
| * | [compute] Support restore serverjichenjc2016-02-231-0/+22
| | | | | | | | | | | | | | | | | | Server in soft-delete state can be restored, add this command. Change-Id: Id9d7246f89ae65273505f36dcb664996534ae986
* | | Merge "Add test cases to test some commands with '--wait' and fix bug"Jenkins2016-03-041-2/+2
|\ \ \ | |_|/ |/| |
| * | Add test cases to test some commands with '--wait' and fix bugting.wang2016-03-021-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | "server image create" "server rebuild" "server resize" Above 3 commands are not covered by unit test. So add some unit tests. Meanwhile, fix bug. Now that image name is an optional argument, we'd better record error messages with positional arguments instead of optional argument. So, record server name. Change-Id: I41bc025d4824dc46f63a3213d82e1528bacbbe12
* | Defaults are ignored with flake8Tom Cocozzello2016-02-231-1/+1
|/ | | | | | | | | | | | If “ignore” is not set under flake8 in the tox.ini file there there are defaults set to be ignored. The depended patch fixes many of the problems. Change-Id: Ieed2fe1c4654e201d3fe6d40ef93e247ee736f8b Doc: http://flake8.readthedocs.org/en/latest/config.html#default Depends-On: I935ab48e7c5bac5f88ecdb3a05f73fb44fc9f41d Closes-Bug: #1548910
* Add support for triggering an crash dumpxiexs2016-02-051-0/+28
| | | | | | | | | | | | | The triggering crash dump feature is supported by nova [1] and novaclient [2] now, it's time to introduce this feature into OSC correspondingly. [1]The change id is: I6ed777ff637254b4b79417008f9055dd19fc7405 [2]The change id is: If03b1864bbe7074c720b946fc2700bd5d07debc3 Change-Id: I5a411f283fdf0fc3c00380d069848a332c799cdd Closes-Bug: #1538372 Co-Authored-By: Tang Chen <chen.tang@easystack.cn>
* log take_action parameters in a single placeAkihiro Motoki2016-02-021-32/+0
| | | | | | | | | | | | Previously each command logs take_action parameters explicitly by using @utils.log_method decorator or log.debug(). Some commands have no logging. This commit calls a logger in the base class and drops all logging definition from individual commands. Closes-Bug: #1532294 Change-Id: I43cd0290a4353c68c075bade9571c940733da1be
* log_method: get logger from decorated method if unspecifiedAkihiro Motoki2016-01-201-90/+31
| | | | | | | | | | | | | This commit makes 'log' optional. 'log' attribute of each command class does not exist when the class is defined because 'log' is now setup dynamically when a class is instantiated. Instead log_method looks for a logger from a decorating method. compute.v2.server is changed in this commit as an example. Change-Id: Ic4d128f8e027d3b8e6f884f31369e9085c0f0871 Partial-Bug: #1532294
* Merge "Make --image parameter optional in "server rebuild""Jenkins2016-01-151-5/+6
|\
| * Make --image parameter optional in "server rebuild"David Moreau Simard2015-12-111-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | The command will now default to the image currently in-use by the server, effectively making the --image parameter optional. This commit also adds basic tests for ServerRebuild since there wasn't any. Will add more full tests for it. Change-Id: I733fd3ad5a825f06563c72aa430122e1a0e3b3b0 Closes-bug: #1524406 Co-Authored-By: David Moreau Simard <dms@redhat.com> Co-Authored-By: Tang Chen <tangchen@cn.fujitsu.com>
* | Refactor network endpoint enablement checkingRichard Theis2016-01-041-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the network endpoint enablement checking from the 'server create' command to the common client manager. This allows future network commands to use either nova or neutron networking based on the cloud environment. This patch set also includes related unit test enhancements to the common client manager to trigger authentication on the tests. Change-Id: Ia37e81d4fb05a1e2fceb3e5d367bda769ab8e64b Related-Bug: #1519511 Related-to: blueprint neutron-client
* | Trivial: Remove useless return from files in compute.Tang Chen2015-12-171-2/+0
|/ | | | Change-Id: I9dc6749256fcd53d292d7f658912c032e9ce9df5
* SDK integration extensions and server create networksTerry Howe2015-12-091-13/+6
| | | | | | | Finish up the SDK integration with server create network and port find and extension list. Change-Id: I18dbada784d8aa92a45a937f251023ddf899c53e
* Merge "Trivial: Import network.common as network_common in server.py"Jenkins2015-12-051-9/+13
|\
| * Trivial: Import network.common as network_common in server.pyTang Chen2015-12-061-9/+13
| | | | | | | | | | | | | | | | In server.py, identity.common is imported as identity_common. But network.common is imported as common, which is confuseing. This patch imports network.common as network_common. Change-Id: I74295bc88b22de398ab64fe556aedaca2453d17d
* | Merge "Trivial: Improve doc for "server create" command"Jenkins2015-12-051-4/+4
|\ \ | |/ |/|
| * Trivial: Improve doc for "server create" commandTang Chen2015-12-041-4/+4
| | | | | | | | | | | | | | | | | | The following options of "server create" command support searching by both name and ID. So add this info into doc. --image, --volume, --flavor, --security. Change-Id: I93b167da58144e5de6c9996009b7ea2449fb4cd8
* | Support "server list" searching by both image name and ID.Tang Chen2015-12-011-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | Nova API only supports list servers searching by image ID. In OSC, we can support both image name and ID by mapping the name to ID. This patch also fix the inconsistent doc in .py and .rst files. Closes-Bug: 1521492 Change-Id: I70613843f82d74732bd32a457cd4a31aba57825f
* | Support "server list" searching by both flavor name and ID.Tang Chen2015-12-011-2/+9
|/ | | | | | | | | | | | Nova API only supports list servers searching by flavor ID. In OSC, we can support both flavor name and ID by mapping the name to ID. This patch also fix the inconsistent doc in .py and .rst files. Partial-Bug: 1521492 Change-Id: I1d1a6aa91aef4e2846745babe8382481185fa96e
* Merge "Add --limit option to "server list" command."Jenkins2015-12-011-1/+12
|\
| * Add --limit option to "server list" command.Tang Chen2015-12-011-1/+12
| | | | | | | | | | | | This option will limit the total amount of items the command will list up. Change-Id: I46af0d479d795ebb6a74585d0f76629dd940b117