227 Commits

Author SHA1 Message Date
Jenkins
21924f55b9 Merge "Fix output and error log in server.py" 2016-05-31 13:42:14 +00:00
Rui Chen
1a7284f63a Support to set server state
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
2016-05-28 18:55:50 +08:00
Tang Chen
97162ecd22 Fix output and error log in server.py
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
2016-05-28 15:46:32 +08:00
Tang Chen
5398c96e2a Fix i18n support for help and error messages in compute
Change-Id: Id6eebcb48d1b7b49b6636524506294edbc44a83f
Partial-bug: #1574965
2016-05-24 11:03:49 +08:00
Steve Martinelli
ebcbd6ba71 remove #noqa from i18n imports
hacking checks no longer fail on `import _`

Change-Id: Idd60f0a0e71e5081691eacb39e5091ab08fcce6d
2016-05-13 13:14:02 -07:00
Jenkins
b60ff95edf Merge "Use find_resource() instead of get() in _prep_server_detail()" 2016-05-11 13:26:30 +00:00
Tang Chen
d58280a279 Use find_resource() instead of get() in _prep_server_detail()
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
2016-05-09 14:59:39 +08:00
Tang Chen
809239ca1e Map server power state num to meanful string
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
2016-05-07 14:54:44 +08:00
Tang Chen
32c627eaf0 Doc: Unify repeatable option comments
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
2016-04-12 15:57:17 +08:00
Rui Chen
ee621509be Fix "server unset" document issue
Fix "--property" option describe issue in "server unset"
document, and update the help message to keep consistent.

Change-Id: I68022a187e83fad6320365400ad2a1b0c8cf9a61
2016-03-23 14:45:04 +08:00
Stephen Finucane
13e2bb9b96 Trivial: Use 'SSH' rather than 'Ssh'
This is reflected in the '--help' screen.

Change-Id: Ic22a65ff6a56b069b37a0ea8365cce2b3f93621c
2016-03-09 14:55:55 +00:00
Jenkins
67969e438c Merge "" openstack server image create " doesn't print proper info" 2016-03-06 08:33:44 +00:00
Jenkins
fa3a34322c Merge "[compute] Support restore server" 2016-03-04 23:41:42 +00:00
Jenkins
d763acdf1c Merge "Add test cases to test some commands with '--wait' and fix bug" 2016-03-04 01:29:56 +00:00
Mohan Muppidi
e354d17d2c " openstack server image create " doesn't print proper info
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
2016-03-03 21:03:14 +00:00
ting.wang
84942bb11c Add test cases to test some commands with '--wait' and fix bug
"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
2016-03-02 09:32:27 +08:00
Tom Cocozzello
3d7a26bdec Defaults are ignored with flake8
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
2016-02-23 11:08:36 -06:00
jichenjc
6902a288f8 [compute] Support restore server
Server in soft-delete state can be restored, add this command.

Change-Id: Id9d7246f89ae65273505f36dcb664996534ae986
2016-02-23 13:43:37 +08:00
xiexs
6b3583ab06 Add support for triggering an crash dump
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>
2016-02-05 21:48:41 +08:00
Akihiro Motoki
258c1102cc log take_action parameters in a single place
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
2016-02-02 09:58:32 +09:00
Akihiro Motoki
50d54bb007 log_method: get logger from decorated method if unspecified
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
2016-01-20 22:02:19 +09:00
Jenkins
aa041c5269 Merge "Make --image parameter optional in "server rebuild"" 2016-01-15 17:44:01 +00:00
Richard Theis
57dac0bc3a Refactor network endpoint enablement checking
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
2016-01-04 13:49:49 -06:00
Tang Chen
494659fbe4 Trivial: Remove useless return from files in compute.
Change-Id: I9dc6749256fcd53d292d7f658912c032e9ce9df5
2015-12-17 09:34:12 +08:00
David Moreau Simard
a526777218 Make --image parameter optional in "server rebuild"
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>
2015-12-11 15:34:26 +08:00
Terry Howe
7aa6e5e36c SDK integration extensions and server create networks
Finish up the SDK integration with server create network and port
find and extension list.

Change-Id: I18dbada784d8aa92a45a937f251023ddf899c53e
2015-12-09 11:39:20 -07:00
Jenkins
0cafffa4b2 Merge "Trivial: Import network.common as network_common in server.py" 2015-12-05 23:24:18 +00:00
Tang Chen
dd1ca68f56 Trivial: Import network.common as network_common in server.py
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
2015-12-06 01:18:13 +08:00
Jenkins
e93e1493b6 Merge "Trivial: Improve doc for "server create" command" 2015-12-05 09:14:43 +00:00
Tang Chen
ca76260bf8 Trivial: Improve doc for "server create" command
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
2015-12-04 11:51:15 +08:00
Tang Chen
106f928cb6 Support "server list" searching by both image name and ID.
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
2015-12-01 06:59:22 +00:00
Tang Chen
0069a01967 Support "server list" searching by both flavor name and ID.
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
2015-12-01 06:59:08 +00:00
Jenkins
b221f2ceac Merge "Add --limit option to "server list" command." 2015-12-01 03:00:52 +00:00
Tang Chen
43c11c356b Add --limit option to "server list" command.
This option will limit the total amount of items the command will list up.

Change-Id: I46af0d479d795ebb6a74585d0f76629dd940b117
2015-12-01 10:12:58 +08:00
Tang Chen
b36b477e81 Add --marker option to "server list" command.
This option will give user a chance to display the server list
from wherever they want.

Change-Id: I92cca5e98cd473f1113a9106eb9d1f490694b1fe
2015-12-01 09:30:43 +08:00
Jenkins
e63de0db2d Merge "Add --marker option to "server list" command." 2015-11-30 18:58:14 +00:00
xiexs
af5dbf72c4 Add "openstack server unshelve" into OSC
The unshelve operation is not supported by OSC,
and this patch tries to add it.

Change-Id: Ic60a4616cb63ad21c1a3c8e02611da8bad3a8bd0
Implements: blueprint introduce-shelve-into-osc
2015-11-28 11:21:05 +08:00
Jenkins
13dfacc5ff Merge "Add "openstack server shelve" into OSC" 2015-11-24 23:23:30 +00:00
Tang Chen
bfa223f615 Enable "openstack server resume" command to take multiple servers.
Current "openstack server resume" command could only resume one server.
Improve it to be able to handle more than one servers. Also improve
the doc to reflect the new feature.

Change-Id: I726eb86bfa3df3a9911f45770e6641264dbc1e0b
Implements: blueprint cmd-with-multi-servers
2015-11-24 18:54:03 +08:00
Tang Chen
4955117dff Enable "openstack server suspend" command to take multiple servers.
Current "openstack server suspend" command could only suspend one server.
Improve it to be able to handle more than one servers. Also improve
the doc to reflect the new feature.

Change-Id: Ic0417ee28f46c9198a35744c0180342e61966b26
Implements: blueprint cmd-with-multi-servers
2015-11-24 18:47:26 +08:00
xiexs
a41a8c42af Add "openstack server shelve" into OSC
Currently, the shelve operation is not supported by OSC.
So, this patch attempts to add it into OSC.

Change-Id: I92545300bef006a069338168d2de800e8a58af69
Implements: blueprint introduce-shelve-into-osc
2015-11-24 00:40:26 -05:00
Jenkins
74d53cdd50 Merge "Enable "openstack server unlock" command to take multiple servers." 2015-11-17 02:26:15 +00:00
Jenkins
5dffc9d860 Merge "Enable "openstack server lock" command to take multiple servers." 2015-11-16 03:28:01 +00:00
Jenkins
f177160991 Merge "Enable "openstack server unpause" command to take multiple servers." 2015-11-16 02:28:41 +00:00
Jenkins
c6949c782c Merge "Improve "server list" command to have the same output as "nova list"." 2015-11-13 22:54:27 +00:00
Tang Chen
fc32b0d76b Improve "server list" command to have the same output as "nova list".
"nova list" will also output "Task State" and "Power State" by default.
This patch improves "server list" command to have the same columns, but
not by default. These two columns will be output if --long is added.

The power state is an int, so also adds a formatter helper function
to translate it to human readable string, just as "Networks" does.

Change-Id: I0530a910bec03835839a5ba7687c66d5643338f3
2015-11-14 09:38:01 +08:00
Tang Chen
91fbb0e136 Enable "openstack server unlock" command to take multiple servers.
Current "openstack server unlock" command could only unlock one server.
Improve it to be able to handle more than one servers. Also improve the
doc to reflect the new feature.

Change-Id: Ibf57b2021a504da950a491d63139a438087aed0b
Implements: blueprint cmd-with-multi-servers
2015-11-13 11:02:01 +08:00
Tang Chen
c1f0ad6d71 Enable "openstack server lock" command to take multiple servers.
Current "openstack server lock" command could only lock one server.
Improve it to be able to handle more than one servers. Also improve
the doc to reflect the new feature.

Change-Id: Ifcf103b1c32e6c547ac09f688b887b1c03f92b09
Implements: blueprint cmd-with-multi-servers
2015-11-13 10:36:22 +08:00
Tang Chen
90d86ef01c Enable "openstack server unpause" command to take multiple servers.
Current "openstack server unpause" command could only unpause one server.
Improve it to be able to handle more than one servers. Also improve the
doc to reflect the new feature.

Change-Id: I069ebdd6dcd121f6e55c2bf40d42197f93830e0c
Implements: blueprint cmd-with-multi-servers
2015-11-13 10:36:16 +08:00
xiexs
8b23c2690c Split the vol_id from a dev mapping
Add a split into the dev mapping to get the right vol_id.

Change-Id: I1a7bf6351491b1321c5ca0fa4a27f29825400eaf
Closes-Bug: #1514394
2015-11-11 23:47:02 -05:00