594 Commits

Author SHA1 Message Date
Artem Goncharov
ad3369ed1f Fix formatting of the flavor properties
Do not stringify flavor properties to allow proper output formatting to
json/yaml/etc

Change-Id: I9f4c42acb85b726af87123134dd19de98fe95074
2020-11-02 15:09:09 +01:00
Zuul
987af4e390 Merge "trivial: Rework 'CreateServer' function" 2020-10-30 17:30:35 +00:00
Stephen Finucane
7c239403e9 trivial: Rework 'CreateServer' function
This rather complex function has had stuff tacked on over the years.
Help make working with it a bit easier through liberal application of
whitespace and some nicer indentation. Some option help text is improved
based on changes to modern nova.

Change-Id: I8154dd395dd904c3bcd180a7d0f9037b7e0be64f
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-10-29 11:43:23 +00:00
Zuul
deae091f78 Merge "Validate 'server group create --policy' option" 2020-10-21 20:05:12 +00:00
Zuul
0228790024 Merge "Cleanup of 'server migration list' command" 2020-10-21 19:57:47 +00:00
Zuul
eb75c44656 Merge "Switch openstack console log show operation to use OpenStackSDK" 2020-10-21 16:19:21 +00:00
Zuul
77a45fe685 Merge "Compute: Add tag support for server add fixed ip" 2020-10-15 17:42:50 +00:00
tianhui
2f76bfa3a6 Compute: Add tags support for server
Change-Id: If065602792958ff0145ae9f2e05f5b7a3177905c
Story: 2002006
Task: 19641
2020-10-14 09:53:26 +01:00
Zuul
6216025e9d Merge "Compute: Add tag support for server add volume" 2020-10-14 03:46:06 +00:00
Zuul
f083d42972 Merge "Add 'server migration force complete' command" 2020-10-14 03:46:00 +00:00
Zuul
91027a501f Merge "Add 'server migration abort' command" 2020-10-14 03:45:54 +00:00
Zuul
247ca75d26 Merge "compute: Add --password option for openstack server create" 2020-10-13 23:26:25 +00:00
Zuul
73765da310 Merge "Compute: Add 'keypair create --type' parameter" 2020-10-13 14:53:12 +00:00
Stephen Finucane
ab0b1fe885 Validate 'server group create --policy' option
We were documenting that some of these policies were only supported with
specific microversions, however, we weren't actually enforcing that,
leading to a poor user experience. Correct this.

Change-Id: Ic3c555226a220efd9b0f27edffccf6c4c95c2747
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-10-13 15:35:21 +01:00
Stephen Finucane
5fd399eaba Cleanup of 'server migration list' command
Address some post merge nits.

Change-Id: Ie59521d81fab191194f6c1a114b007fa17f5299f
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-10-13 15:09:55 +01:00
jay
08b0e5855b Add 'server migration force complete' command
This is equivalent to novaclient's 'live-migration-force-complete'
command.

Change-Id: Ic4dc639afa16cdf8c5a46774895e850d92985292
Story: 2007513
Task: 39293
2020-10-13 14:17:28 +01:00
hackertron
1c3cf11331 Add 'server migration abort' command
This is equivalent to nova client's 'live-migration-abort' command.

Change-Id: I0ff520ccfdf2de52c427affad7bef4554c86a06f
Story: 2007489
Task: 39210
2020-10-13 14:17:25 +01:00
Zhaokun Fu
fd9a235de3 compute: Add --password option for openstack server create
Change-Id: Iaf923200efe023655a58ac5acac0b087d2fd5366
Story: #1708570
Task: #13780
2020-10-13 10:37:38 +01:00
Zuul
3cc81dded3 Merge "Remove oslo.utils" 2020-10-13 07:22:37 +00:00
Zuul
44f842b1f8 Merge "Add an error message when server bind floating IP" 2020-10-13 04:59:42 +00:00
Zuul
1bac625d47 Merge "Compute: Add tag support for server add network" 2020-10-13 03:42:52 +00:00
Zuul
ce563f08ba Merge "Compute: Add tag support for server add port" 2020-10-13 01:36:46 +00:00
Monty Taylor
9385113d40 Remove oslo.utils
Oslo things are really server-side oriented and are heavy-weight
for client things. Remove oslo.utils and just use iso8601 and
importlib directly. It's not actually a bad library, but pulling
it and its other deps in just for a couple of wrapper methods
is a bit much here.

oslo.i18n, fwiw, is lightweight and helpful.

Change-Id: I463993170c03a1d98c47ab6a3c19131b7fca1099
2020-10-12 17:29:57 +01:00
yanpuqing
415545ab9f Add an error message when server bind floating IP
If we add a floating IP for the server with no fixed IP, CLI doesn't
report an error and nothing happens. The patch adds an error message
when the server which don't have fixed IP bind floating IP.

Change-Id: I400f2bab08521bb7fa443d87c7f45cc79eb80694
Task: 27941
Story: 2004346
2020-10-12 17:09:19 +01:00
Zuul
ad2ac13c97 Merge "Add server migration list CLI" 2020-10-12 16:01:52 +00:00
tianhui
742c80a825 Compute: Add tag support for server add fixed ip
Change-Id: I62ed4729dead9f91630d1f568c834c9642965558
Story: 2002195
Task: 21679
2020-10-12 15:25:09 +01:00
tianhui
6f1602312b Compute: Add tag support for server add network
Change-Id: I31a66b2d4dac44052a71f43a5a67836247ccac64
Story: 2002195
Task: 21678
2020-10-12 15:19:27 +01:00
tianhui
4855fef8b8 Compute: Add 'keypair create --type' parameter
Change-Id: I2d251e1b97fb9a8069431c867fb7fc5f42d1fd6e
Story: 2002606
Task: 22225
2020-10-12 12:25:11 +01:00
tianhui
f3fbb1b648 Compute: Add tag support for server add port
Change-Id: Ice6bf5fb57afeb10862c870b42732dcf166772d1
Story: 2002195
Task: 21676
2020-10-12 11:37:20 +01:00
Zuul
a48c05b90a Merge "Remove usage of six" 2020-10-09 19:37:48 +00:00
tianhui
1c7fe3b6bd Compute: Add tag support for server add volume
Change-Id: Id9f2e09426f6824e9ca672bf7808b5165c650a69
Story: 2002195
Task: 21675
2020-10-09 17:31:14 +01:00
Zuul
960004dcc7 Merge "Add 'openstack server create --use-config-drive'" 2020-10-09 10:43:59 +00:00
songwenping
c2df9215e1 Remove usage of six
With python3.x, classes can use 'metaclass=' instead of
'six.add_metaclass', 'six.iteritems' and 'six.iterkeys' can
be replaced by 'items' and 'keys', 'six.moves.urllib.parse'
can be replaced by 'urllib.parse', 'six.StringIO' and
'six.moves.cStringIO' can be replaced by 'io.StringIO',
'six.text_type' and 'six.string_type' are just 'str'.

Change-Id: I84848c0bf8ab3c36dd821141191e2725e4e3b58b
2020-10-07 02:15:25 +00:00
Artem Goncharov
74db8dd65d Switch openstack console log show operation to use OpenStackSDK
A short switch onto SDK for fetching console logs of the server

Change-Id: I3f750ea4f13a4e72272aa67ea4506bd7182b13f9
2020-10-06 15:04:02 +02:00
Zuul
eb5416a257 Merge "Fix --image-property option in 'create server'" 2020-10-01 05:52:39 +00:00
Zuul
3902efc292 Merge "Add API check for server_groups.create" 2020-09-30 20:35:00 +00:00
Zuul
2308a05733 Merge "Add API check for server_groups.list" 2020-09-30 20:34:55 +00:00
Zuul
e7b2528c4a Merge "Show words indicating booted from volume for server image" 2020-09-30 20:34:53 +00:00
Zuul
03b9216318 Merge "Output correct json for security groups in 'openstack server show'" 2020-09-25 09:44:41 +00:00
zhangbailin
b77c28d295 Add server migration list CLI
Add ``openstack server migration list`` to fetch server migrations.

Part of blueprint add-user-id-field-to-the-migrations-table

Change-Id: I15b4a5aca8d0dee59dd293e7b1c7272cdfbeea20
2020-09-24 18:45:13 +08:00
jay
bae89b3014 Output correct json for security groups in 'openstack server show'
Fixes incorrect json output for 'openstack server show -f json'.
The security group json output groups all the json as one
for e.g. "security_groups": "name='group1'\nname='group2'"
The correct output should be
"security_groups" : [{"name" : "group1"}, {"name" : "group2"}]
properties and volumes_attached fields also has similar issue.

Story: 2007755

Change-Id: I1b1cac716329e0530400aff782c08000b21d8e1d
2020-09-14 15:22:27 +02:00
Myeongchul Chae
fbd2c00b89 Fix --image-property option in 'create server'
There was a problem that the '-image-property' option, which can be used
to create an instance, did not work as intended.

I found that there were two problems with this option.

First, I cannot select an image as its metadata.

The second is that when there are multiple images available, the desired
image may not be selected depending on the situation.

This patch solves these two problems.

I wrote the test case with these two problems considered together.

Change-Id: Ib2745d7e067056ff4ca8bfaf6cff492d0dacb73a
story: #2007860
2020-09-10 16:12:11 +00:00
melanie witt
4a3c5207c1 Show words indicating booted from volume for server image
For a server booted from a volume, nova API does not store an image_id
and instead returns an empty string. Currently, openstackclient
similarly shows an empty string for Image Name and Image ID for servers
booted from volumes.

To aid CLI users in understanding the meaning of no image_id, we can
display the string "N/A (booted from volume)" in the image field if the
server was booted from a volume.

Change-Id: I9c62cf6fe23b2e934dcbf5ebbf706b2705d2e424
2020-08-27 20:24:48 +00:00
Lewis Denny
51a1ea65f4 Add API check for server_groups.create
The policies field has been replaced with the
policy field since Nova API version 2.64[1]

This commit adds a check to make sure the correct field is used.

[1]https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id59

Change-Id: I06d3211937d822c26070b7f8ad757c365dcbb1bb
Story: #2007822
Task: #40101
2020-08-26 17:11:46 +10:00
Lewis Denny
ed6d8d9411 Add API check for server_groups.list
The policies parameter has been replaced with the
policy parameter since Nova API version 2.64[1]

This commit adds a check to make sure the correct parameter is used.

[1]https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id59

Change-Id: Ia37beb7790884d6d15bec45074f446e64af1a2aa
Story: #2008041
Task: #40703
2020-08-21 14:57:29 +10:00
Stephen Finucane
12f1e56ebf Add 'openstack server create --use-config-drive'
Despite what the help text for this options says, the nova API only
accepts boolean values for this value and has done so since at least the
introduction of the 2.1 microversioned API. While it would be nice to
convert '--config-drive' to a boolean flag, we'd need to be able to
retain temporary support for people passing arguments. 'nargs=?' [1]
looks promising but it has an annoying tendency to swallow a positional
argument following it [2]. Since that is not an option, we have to live
with a new config option, '--use-config-drive' and a '--no-config-drive'
counterpart.

[1] https://docs.python.org/3/library/argparse.html#nargs
[2] https://bugs.python.org/issue9338

Change-Id: If9cce0ad4094cc9cef1c9136b80c3b0f35a82c7a
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Story: #2005468
Task: #30547
2020-07-22 10:59:07 +01:00
Gabriel Ramirez
176907f70e Allow openstack flavor set to update flavor description using name
Modified take_action() method for SetFlavor to use
flavor id instead of flavor name when setting description

Closes-Bug: #1844708 
Story: #2007781
Task: #40019

Change-Id: If6798c89fef4c9feb4ebb460722b891f5655037d
2020-06-10 22:49:44 +00:00
Adam Harwell
ae67317109 Correct image lookup during server rebuild
The switch to using glance from the SDK accidentally used get_image
directly during a server rebuild, when it should have used find_image to
match existing functionality.

Bug introduced in: I36f292fb70c98f6e558f58be55d533d979c47ca7

Change-Id: I2005bd40a1bd6719670c7f7854316b4f9801b140
Story: 2007620
Task: 39643
2020-05-04 16:06:02 -07:00
Artem Goncharov
60e7c51df4 Switch image to use SDK
This is a work to switch OSC from using glanceclient to OpenStackSDK.

With this change only v2 is using OpenStackSDK. V1 is still using
glanceclient and will be switched in a separate change.

Remove the direct depend on keystoneauth- let that flow through
openstacksdk.

Depends-on: https://review.opendev.org/#/c/698972
Change-Id: I36f292fb70c98f6e558f58be55d533d979c47ca7
2020-03-23 14:38:32 -05:00
Stephen Finucane
cefa571d4b Use 'KeyValueAppendAction' from osc-lib
Does what it says on the tin. This action was added to osc-lib in change
If73cab759fa09bddf1ff519923c5972c3b2052b1.

Change-Id: I51efaa096bb26e297d99634c5d9cca34c0919074
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-02-03 15:25:40 +00:00