397 Commits

Author SHA1 Message Date
Steve Martinelli
0ef8535036 translate all command help strings
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
2016-11-17 02:33:42 +00:00
Yan Xing'an
8ca1cc6370 Add --long option and more columns to the hypervisor list command
Support --long option and more columns in output of hypervisor
list command, including 'Hypervisor Type', 'Host IP', 'State',
and 'vCPU Used', 'vCPUs', 'Memory MB Used', 'Memory MB' with
--long option.

Change-Id: I0c790c7835309dded03e230cf497168e19404537
Closes-Bug: #1637074
2016-10-27 04:33:47 -07:00
Anne Gentle
5055074db0 Adds information about private key generation for instance access
- Also updated the help text in the command itself.

Change-Id: Ib3d4f94ef415a3f12024d0d7c000d2de20de001b
Partial-Bug: 1549410
2016-10-25 08:51:20 +02:00
Cedric Brandily
694a24c309 Fix --shared/block-migration options in server migrate command
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
2016-10-11 22:01:16 +02:00
Jenkins
15069ef50e Merge "Support "--no" option in aggregate set" 2016-09-29 19:22:31 +00:00
qtang
c9fd35a496 Update default nova api version to 2.1
Ref:https://review.openstack.org/#/c/311653/
We should use 2.1 as the default nova version now

The API_MIN_VERSION of novaclient has already changed to 2.1

Change-Id: I9ff16cf052556e5d3756f81e02a8e76e8f315df5
Closes-bug: #1588171
2016-09-28 14:02:00 +00:00
Rui Chen
6371556916 Support "--no" option in aggregate set
Supporting "--no-property" option will apply user a convenience
way to clean all properties of aggregate in a short command,
and this kind of behavior is the recommended way to devref.
The patch add "--no-property" option in "aggregate set" command,
and update related test cases and devref document.

Change-Id: I7614a23c0db05144562330dc600dbab7d003d5d8
Implements: blueprint support-no-property-in-aggregate
2016-09-24 15:59:13 +08:00
Cedric Brandily
e6b09eef0c Correct login name deduction in SshServer
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
2016-09-15 21:57:17 +02:00
Hironori Shiina
98bafda7e9 Display hypervisor information without uptime
Some virt drivers such as ironic virt driver doesn't implement a
method to get host uptime. For such drivers, hypervisor show command
displays no information although these drivers provides other host
information.

This patch fixes the command to display hypervisor information in case
where a virt driver doesn't provide host uptime by ignoring a
HTTPNotImplemented exception.

Change-Id: I7bcca5862cd9c05aadaf6192cb80aa651cd77cad
Closes-Bug: 1612065
2016-09-11 21:58:55 +09:00
Hironori Shiina
d6f99b721d Fix regular expression for uptime in hypervisor show
Hypervisor show command has a few bugs as follows.
- It doesn't trim an extra whitespace in the head of uptime
  information.
- It doesn't display uptime information when the number of user is 1.

This patch fixes the regular expression to match uptime information.

Change-Id: Ic2f7fd9a9274466717084a0886f95f78e98a9007
Closes-Bug: 1611809
2016-09-11 21:48:23 +09:00
Dean Troyer
6a15f90dae osc-lib: shell
Convert to using ClientManager and OpenStackShell from osc-lib.
* Change all internal uses of ClientManager private attributes that are
  now public in osc-lib's ClientManager.  Leave back-compat copies in
  place in OSC's clientManager so we don't break plugins.
* Put some work-arounds in place for changes in osc-lib that we need until
  a new release makes it through the g-r and u-c change process.
* Add a test for Unicode decoding of argv in shell.main() to parallel
  the one in osc-lib.

Change-Id: I85289740d4ca081f2aca8c9b40ec422ad25d302c
2016-08-05 13:48:55 -05:00
Rajasi Kulkarni
e26eecc12f Pass security group id to novaclient while adding security
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
2016-07-28 21:39:02 +05:30
Jenkins
566b8566c0 Merge "Standardize import format" 2016-07-26 07:22:27 +00:00
Jenkins
719c5d79ce Merge ""server list": "Image Name", "Image ID" columns" 2016-07-22 20:38:20 +00:00
Jenkins
b59ade75e5 Merge "Support to get server rdp/serial/mks type console url" 2016-07-22 12:22:34 +00:00
shizhihui
f996138a0d Standardize import format
According to the rule in
http://docs.openstack.org/developer/hacking/#imports
I modify some irregular import format.

Change-Id: Ibf29ccaf3ddec4a956334cc3368ebee7a66e282c
2016-07-22 19:24:02 +08:00
Huanxuan Ao
b0c317ebdd Add Support for showing flavor access list
Add a attribute "access_project_id" for flavor object to
display the access project id list by using "flavor show"
command.

Change-Id: I7f0c152b816e0ca2e32e47f9b5c1aa7663d33b6d
Closes-Bug:#1575461
2016-07-22 10:20:18 +08:00
Rui Chen
cf20225347 Support to get server rdp/serial/mks type console url
The patch add the support to get server rdp/serial/mks
type console url, that make osc capability equal with
current nova server side feature.

Change-Id: I3dee2531c68563725187c8251d5ea8d4c02cca0c
Closes-Bug: #1605088
2016-07-21 15:43:01 +08:00
Jenkins
beaa06138e Merge "Pass security group id to novaclient" 2016-07-18 18:35:15 +00:00
Jenkins
52cb503fb0 Merge "Modify compute agent set command" 2016-07-14 09:22:21 +00:00
Rajasi Kulkarni
8405db900f Pass security group id to novaclient
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
2016-07-11 22:34:35 +05:30
sunyajing
25bdf6811c Modify compute agent set command
Migrate ``compute agent set`` arguments: version, url, md5hash
to be optional.

BackwardsIncompatibleImpact

Change-Id: I092b7ed24274bafa548f0537c4586504be3a2825
Co-Authored-By: Huanxuan Ao <huanxuan.ao@easystack.cn>
2016-07-11 18:07:34 +08:00
zhengsenyan
1e895f3286 fix one spelling mistake and two help messages
I checked all the 70 rst files in doc/source/command-objects and
found that:
 -one spelling mistake as:rescure should be rescue(server.rst)
 -two help messages:xpvnc should be xvpvnc(console-url.rst and
  console.py)

Change-Id: I6f46c79983eaf5650bd3aa0ab448c19f5c6527a9
2016-07-07 14:19:04 +08:00
Marc Abramowitz
b74be57300 "server list": "Image Name", "Image ID" columns
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
2016-07-06 07:11:17 -07:00
Jenkins
7f8999bf54 Merge "Transfer "ip fixed add/remove" to "server add/remove fixed ip"" 2016-07-06 13:59:32 +00:00
Jenkins
2b8213df88 Merge "Transfer "ip floating add/remove" to "server add/remove floating ip"" 2016-07-06 13:59:06 +00:00
Jenkins
8d5a0fd86e Merge "Transfer "ip floating pool list" to "floating ip pool list"" 2016-07-06 13:50:32 +00:00
Huanxuan Ao
43a07e133d Add missing '(name only)' message for keypair in computev2
In 'keypair show' command. One help message had '(name only)'
but the doc had not. And another had not '(name only)' but the
doc had. This patch Fixs them and keeps the consistent between
doc and help message.

Change-Id: Ic88219ae25a6f545a1db39e6b585e1857ae9e2e0
2016-07-04 14:45:40 +08:00
Tang Chen
179ebe6d64 Transfer "ip fixed add/remove" to "server add/remove fixed ip"
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>
2016-07-04 10:41:30 +08:00
Tang Chen
d1f9ea3f75 Transfer "ip floating add/remove" to "server add/remove
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>
2016-07-04 10:40:59 +08:00
Tang Chen
50bd56db25 Transfer "ip floating pool list" to "floating ip pool list"
This patch does the following things to transfer
"ip floating pool list" to "floating ip pool list":

* Add a new command "floating ip pool list" to deprecate
  "ip floating pool list". The source code is in network/v2
  dir.
* Add doc for "floating ip pool list".
* Add floating ip pool unit tests.

Change-Id: Id410f4e4a96cf589a6e8def209574da71395b55f
Implements: blueprint rework-ip-commands
Partial-bug: 1555990
Co-Authored-By: Dean Troyer <dtroyer@gmail.com>
2016-07-04 10:40:00 +08:00
Jenkins
ba6951222a Merge "Add "--property" option to "flavor create" command" 2016-06-30 10:36:55 +00:00
Huanxuan Ao
dbed97a24d Add "--property" option to "flavor create" command
Add "--property" option to "flavor create" command to support
adding properties to a new falvor.

Change-Id: I4f06b364375d5a81584fe41122d48e9568fa712a
Closes-Bug: #1596798
2016-06-29 19:16:35 +08:00
Jenkins
21ad61ddd9 Merge "Support bulk deletion for delete commands in computev2" 2016-06-28 08:24:36 +00:00
Huanxuan Ao
af7ab03693 Support bulk deletion for delete commands in computev2
Support bulk deletion and error handling for "keypair delete"
and "service delete" commands in computev2.
Up to now, all the delete commands in computev2 support bulk
deletion.

Change-Id: I6d5c960e9716188e56615514d0921618a15a88ec
Partially-Implements: blueprint multi-argument-compute
Partial-Bug: #1592906
2016-06-27 20:39:23 +00:00
Huanxuan Ao
c7b137e421 Modify some unusual help messages in computev2
Some command help messages are unusual, for example:
common help message for a list command:
"list objects"
unusual help message:
"list obejcets command"
I think we should keep help message consistent, so I modify
the unusual help messages in computev2.

Change-Id: Ic5f11eba1a4397949e85d91cc067519752e89bff
2016-06-27 15:27:34 +08:00
Jenkins
377daebaa4 Merge "Fix errors for "host set" command" 2016-06-23 15:27:37 +00:00
Jenkins
51fcd7c30c Merge "Refactor unit test of "compute service list" command" 2016-06-23 06:20:34 +00:00
Jenkins
775b1acccd Merge "Make set/unset commands in compute/image/common return normally when nothing specified" 2016-06-22 14:37:44 +00:00
Huanxuan Ao
70f8ae7534 Refactor unit test of "compute service list" command
The unit test of "compute service list" only checked the
"Disabled Reason" columns and its data. It is not enough.
This patch change the test to check all datas in the list.

Also, this patch modify the "Id" to "ID" in this command.

Change-Id: I988fd6365f2652185dd96d9417f294eba9c31cd9
2016-06-22 19:02:39 +08:00
Jenkins
de909e4afc Merge "Support bulk deletion for "flavor/aggregate delete"" 2016-06-22 06:48:50 +00:00
Huanxuan Ao
7177014fcc Fix errors for "host set" command
"Host set" command cannot work. Because:
1.Host has no 'ID' attribute, so 'ID' attribute cannot be found
in "host set" command.
2.value "True" and "Flase" are invalid in updata() method of host.
3.Some update functionalities is not supported in host API now.

This patch solves the problems 1 and 2 in OSC. But the problem 3
is a API problem and can't be solved in OSC, only XenServer driver
support to set enable/disable and maintenance host, it is a normal
problem.
After this patch the output of "host set" command is:
The requested functionality is not supported. (HTTP 501)
(Request-ID: req-14031fce-8c90-48a0-8492-dc8e3dd349f3)
Just the same as the "host-update" command in novaclient.

Change-Id: Ibe94c4d3d492d3d63355de803810edb988e1b4e9
Closes-Bug: #1594689
2016-06-22 14:20:53 +08:00
Huanxuan Ao
014835930d Add "--project" option to the "flavor create" command.
Add ``--project`` and ``--project-domain`` options to the
``flavor create`` command. We can use these options to add
the flavor access to a givin project when we create the flavor.

Change-Id: Ic1907272c1d1ae526f9c9e86f32ba06c6da147c0
2016-06-21 16:28:18 +00:00
Tang Chen
9c62af8a42 Make set/unset commands in compute/image/common return normally when nothing specified
After this patch, all set/unset commands will return normally
when nothing specified.

Change-Id: Id94d0329faa1a674006a9aae901f834b41917317
Close-bug: #1588588
2016-06-21 15:15:18 +08:00
Huanxuan Ao
640014fa91 Support bulk deletion for "flavor/aggregate delete"
Support bulk deletion and error handling for "aggregate delete"
and "flavor delete" commands.

Change-Id: I3f6105cbeeab1c9f8cd571c63ce0e7ac3d4252b3
Partially-Implements: blueprint multi-argument-compute
Partial-Bug: #1592906
2016-06-21 11:04:13 +08:00
Jenkins
f5ae23ab86 Merge "Standardize logger usage" 2016-06-20 17:26:57 +00:00
Jenkins
a99b54ef75 Merge "Fix console url show command broken in microversion case" 2016-06-20 15:51:20 +00:00
Tang Chen
047cb68493 Standardize logger usage
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
2016-06-20 15:16:51 +00:00
Tang Chen
d67c2e8383 Use osc_lib in server_image.py
server_image.py is a newly created file. So I think
we forgot to use osc_lib in it.

Change-Id: Ieda13438662ea55b03f549108aac63c18b9af913
2016-06-20 20:02:05 +08:00
Rui Chen
8cceaddaac Fix console url show command broken in microversion case
The response data of nova get_xxx_console API is changed
from "console" to "remote_console" in microversion 2.6, and nova
server side API schema verify the spice vnc type to "spice-html5",
update OSC code to apply these change so that OSC can work in
different nova microversion cases.

Change-Id: I3bb4fe057e656209d00d2bb308ac3f7f837cb03f
Closes-Bug: #1590318
2016-06-16 21:13:47 +08:00