450 Commits

Author SHA1 Message Date
Akihiro Motoki
f3bbf52b3c Use flake8-import-order plugin
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
2017-08-17 06:55:00 +00:00
Jenkins
e0d7119c6d Merge "Start using 'cliff.sphinxext'" 2017-07-21 21:46:10 +00:00
Stephen Finucane
9cfa12df2a Start using 'cliff.sphinxext'
'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
2017-07-21 14:48:44 +00:00
Jenkins
57e7d9fdb3 Merge "Now OSC server create check keys in --nic" 2017-07-20 18:43:18 +00:00
Dean Troyer
2689984ba7 Fix column names for server list --no-name-lookup
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
2017-07-17 16:51:10 -05:00
Boris Pavlovic
2c57f7bfb2 Add server list -n and --no-name-lookup arguments
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
2017-07-10 16:20:45 -07:00
M V P Nitesh
fcafd987b0 Now OSC server create check keys in --nic
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
2017-06-23 13:20:43 +05:30
Jenkins
3fabbe9b39 Merge "Create server with security group ID and name" 2017-05-22 23:09:02 +00:00
Rui Chen
45496feee6 Create server with security group ID and name
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
2017-05-22 20:32:01 +00:00
Rui Chen
7a7bb06377 Make block-device-mapping more stable and clear
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
2017-05-17 01:42:12 +00:00
Dean Troyer
bffc98e4e5 Fix server create with nova-net
A Neutron-ism slipped by in server create.

Change-Id: Id590d7f93df2a41d7bd7617459a2af159a6f8071
2017-04-26 18:49:50 -05:00
Jenkins
7977f7df18 Merge "Add --network and --port to server create" 2017-04-25 13:54:46 +00:00
Dean Troyer
b2783dc3c4 Low-level Compute v2 API: network
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
2017-04-17 19:45:21 -05:00
Dean Troyer
4289ddd47a Low-level Compute v2 API: security group
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
2017-04-11 02:08:04 -05:00
David Rabel
8549071363 Add --network and --port to server create
--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
2017-04-07 16:36:18 +02:00
Cedric Brandily
7f9814860a Enable to specify which fixed-ip to add to a vm.
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
2017-04-04 11:15:29 -05:00
Jenkins
c7e7f2b730 Merge "Help/docs cleanups: marker, limit, ip-address metavars" 2017-04-04 12:32:55 +00:00
Dean Troyer
1686dc54f0 Help/docs cleanups: marker, limit, ip-address metavars
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
2017-04-04 03:56:19 +00:00
Jenkins
d0f368ba0e Merge "Enable to add/remove port to/from a server" 2017-04-03 20:51:20 +00:00
Jenkins
e2cd971a03 Merge "Fix block-device-mapping when volume_size is empty" 2017-04-03 19:49:42 +00:00
Cedric Brandily
21510ac1a9 Enable to add/remove port to/from a server
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
2017-04-03 20:19:40 +02:00
Jens Rosenboom
61cde9c8e8 Fix block-device-mapping when volume_size is empty
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
2017-04-03 11:26:35 +00:00
Jenkins
67a4b812c6 Merge "doc: Correct Sphinx warnings" 2017-04-01 21:08:43 +00:00
Stephen Finucane
70170656fd doc: Correct Sphinx warnings
- Fix option-describe typos
- Correct option and envvar markup, for commands that are using the
  reference form instead of the definition form or are marking up
  option arguments as options
- Avoid duplicate commands
- Fix some invalid docstrings
- Fix some invalid indentation
- Disable the murano plugin, which has invalid docs
- Correct issues with- and track the network-topology spec
- Include API modules in docs

Change-Id: I3d5ed5e872540fe13f3e4bd5e9335829dc9a5226
2017-03-28 16:41:54 +01:00
yfzhao
535def3447 Remove log translations
Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.

Change-Id: I504de69b2e64250740ebcab432042a16f966fdbe
Closes-Bug: #1674584
2017-03-21 17:23:09 +08:00
Jenkins
49e866174f Merge "Enable to specify which vm fixed-ip to publish" 2017-03-21 01:55:51 +00:00
Cedric Brandily
f5527877bb Enable to specify which vm fixed-ip to publish
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
2017-03-20 22:33:51 +01:00
Jenkins
495d013431 Merge "Adds missing flavor information in the server list long command" 2017-03-20 17:57:38 +00:00
Jenkins
6cae88fa2b Merge "Add a validation about options for server migrate command" 2017-03-16 15:52:50 +00:00
Jose Castro Leon
429b43a331 Adds missing flavor information in the server list long command
Closes-Bug: #1672396

Change-Id: Ie2a664fd1c3db1b8269ea079df181f87afc702a7
2017-03-13 16:32:15 +01:00
Jenkins
dcb2de9db2 Merge "Add "--private-key" option for "keypair create"" 2017-03-08 02:51:48 +00:00
Rui Chen
c03b9a871c Add server event list and show commands
OSC server event is similar to nova's instance action commands.

Server event is the event record that had been done on a server,
include: event type(create, delete, reboot and so on),
event result(success, error), start time, finish time and so on.
These are important information for server maintains.

Change-Id: I8111091f46a0d2755728d8f9d43cc0dfe8842d13
Closes-Bug: #1642030
2017-03-07 15:25:43 +08:00
Rui Chen
dee22d8faa Add "--private-key" option for "keypair create"
Aim to specify the private key file to save when keypair
is created. That is a convenient way to save private key
in OSC interactive mode, avoid to copy CLI output, then
paste it into file.

Change-Id: I119d2f2a3323d17ecbe3de4e27f35e1ceef6e0a5
Closes-Bug: #1549410
2017-03-06 08:34:28 +00:00
Rikimaru Honjo
7063ffb3ca Add a validation about options for server migrate command
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
2017-03-01 17:37:39 +09:00
Jenkins
477694db49 Merge "Use public and unified method get_console_url()" 2017-02-20 19:46:15 +00:00
Rui Chen
c051c5f090 Fix "server create" command failed when --nic auto or none
"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
2017-02-15 14:25:37 +08:00
huangtianhua
f891b6862f Use public and unified method get_console_url()
Novaclient has provided a public and unified method
get_console_url() to get console urls of server.
This change switches to use it.

Change-Id: Ie6b9d8cfc57a6943b5d64a4064e4bdd372cd8cd3
Depends-on: I36c6209b17ef453e1c2e47841daf41f81af471dc
Closes-Bug: #1654913
2017-02-14 03:22:03 +00:00
Jenkins
f945cf7b5c Merge "Handle log message interpolation by the logger in compute/" 2017-02-14 01:28:54 +00:00
Jenkins
655e73683a Merge "Overwrite/Clear Flavor property" 2017-02-13 18:19:26 +00:00
Gábor Antal
1c91e9828d Handle log message interpolation by the logger in compute/
According to OpenStack Guideline[1], logged string message should be
interpolated by the logger.

[1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages

Change-Id: Ib7b5fb5f794026fc8a84260c4803afea321a9cf5
Closes-Bug: #1596829
2017-02-13 18:43:12 +01:00
Reedip
6a3c7c2a68 Overwrite/Clear Flavor property
This patch adds support to overwrite/clear the flavor's
property using the new ``--no-property`` option in the
``flavor set`` command.

Change-Id: I873c96fcf223bbd638a19b908766d904a84e8431
Implements: blueprint allow-overwrite-set-options
Co-Authored By: zhiyong.dai@easystack.cn
2017-02-13 15:16:09 +00:00
Dean Troyer
16aeee4303 Cleanup for 3.8.0 release
Release notes and proofreading cleanups.

Change-Id: Iddc6a64e6ea3082aa220a2465793e6f7f2aecaa9
2017-01-26 10:41:30 -06:00
Jenkins
d189e807fd Merge "Add options to "server list" command" 2017-01-26 06:38:27 +00:00
Nikita Gerasimov
95c8661f86 Switch server create to block_device_mapping_v2
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
2017-01-26 02:02:30 +00:00
jiahui.qiang
c46f9dc501 Add options to "server list" command
Add "--deleted" and "--changes-since" options to "server list" command.

Change-Id: Id94f6e5831a60b172b6cfcfca29b1d89de8db621
Closes-Bug:#1647242
2017-01-25 21:31:45 +00:00
Artom Lifshitz
98f803e0f0 Use image client for images instead of compute
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
2017-01-24 16:56:35 +00:00
jiahui.qiang
89d9449dcf Error in the return of command server show, create
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
2017-01-17 17:49:16 +08:00
Pavlo Shchelokovskyy
e637e9c6c8 Fix flavor create help re swap size units
nova actually expects and uses swap size in MB, while in openstackclient
currently help states that swap must be specified in GB and passes this
value to nova without changes.

Fix the help string.

Change-Id: I95f46246c072961ce77f818d80d75e6a51f728d0
Closes-Bug: #1656018
2017-01-12 18:27:14 +02:00
Jens Rosenboom
d8749f9148 Fix creating a private flavor with ID auto
When a private flavor is created with ID auto (=default) and a project
is specified for it, instead of trying to add the project to the flavor
called "auto" the ID of the newly created project should be used.

Change-Id: I19f7a0ec26bd5d147f00ecba3312240e3601567e
Closes-Bug: 1654221
2017-01-05 15:58:47 +01:00
licanwei
0948aa6aeb update server migrate '--wait' description
'Wait for resize to complete'
==>
'Wait for migrate to complete'

Change-Id: I0e08968c0132f0a8e1ef1ce2e6179001315372c3
2016-12-30 14:16:32 +08:00