3387 Commits

Author SHA1 Message Date
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
Zuul
a48c05b90a Merge "Remove usage of six" 2020-10-09 19:37:48 +00: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
pedh
f50bd40866 Fix: port attribute name propagate_uplink_status
Change the incorrect port attribute name "uplink_status_propagation"
to "propagate_uplink_status".

Change-Id: Icd7c49af8d988a6e3a52a58c784bd701b2d36faf
Closes-Bug: #1891873
2020-10-06 10:16:58 +00: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
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
Zuul
51aee432d9 Merge "Support tagging Neutron ports on creation" 2020-09-13 20:34:00 +00: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
Zuul
15d0bfc185 Merge "Add NUMA affinity policy parameter to "port"" 2020-09-07 16:11:00 +00:00
Miguel Lavalle
67700e6dd9 Support tagging Neutron ports on creation
This change adds support for tagging ports on creation

Co-Authored-By: Slawek Kaplonski <skaplons@redhat.com>

Change-Id: I3148a568664588eb2f529138f984859570c0fca1
Related-Bug: #1815933
2020-09-04 14:30:07 +02:00
Zuul
0566ad66a9 Merge "Allow openstack flavor set to update flavor description using name" 2020-09-03 22:01:16 +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
Zuul
95cc05bdf6 Merge "Bypass user and group verification in RemoveRole" 2020-08-13 06:29:54 +00:00
Lance Bragstad
e246732670 Bypass user and group verification in RemoveRole
Keystone let's users remove role assignments that reference non-existent
users and groups. This is nice when keystone backs to an identity store
like LDAP and users or groups are removed.

Previously, openstackclient would validate the user and group existed in
keystone before sending the request to delete the role assignment. This
commit updates the code to bypass that validation so that users can use
IDs to forcibly cleanup role assignments.

Change-Id: I102b41677736bbe37a82abaa3c5b3e1faf2475d5
Story: 2006635
Task: 36848
2020-08-12 12:24:17 -05:00
Zuul
b1477647fa Merge "Add system role assignment tests for users and groups" 2020-08-06 13:37:03 +00:00
Zuul
af28a2f664 Merge "Fix reverted osc-lib interface change" 2020-08-03 14:52:17 +00:00
Rodolfo Alonso Hernandez
454b219564 Add NUMA affinity policy parameter to "port"
Added port NUMA affinity policy parameter to "port create",
"port set" and "port unset" commands.

Change-Id: I48cacab275856af2911829f9b7176bb87fd039b3
Related-Bug: #1886798
2020-07-31 15:18:55 +00:00
mb711d
4e2aefb5fa Delete the testcases that arent needed anymore
The file test_examples.py has never worked since its written and and cli in
the example directory are covered by other functional tests for container,
flavor and object lists and they have better asserts. So, deleting the file

Change-Id: Ib9af40da96e66354fe878e79a80048a58f8dd6fe
2020-07-23 17:08:42 -04:00
Roger Luethi
0a8753dc3e Fix reverted osc-lib interface change
The patch https://review.opendev.org/#/c/673389/ introduced a regression
by changing the osc-lib interface.

Two conflicting attempts to fix the regression were launched:

1) Reverting the patch.

2) The patch https://review.opendev.org/683119 changes the exception
   from the generic CommandError back to a specific Forbidden exception.

   The patch https://review.opendev.org/683118 catches this exception
   and passes on, i.e. re-implements the same behavior as before.

The first idea was implemented, the initial patch reverted. The second
idea was partially implemented. The change in python-openstackclient
(683118) was merged. The change in osc-lib was approved but failed to
merge because the initial change had been reverted.

Now we have again a situation where the exception produced in osc-lib
does not match the exception expected by the caller.

It is unclear if the osc-lib interface will ever get a rebased version
of https://review.opendev.org/683119 merged, so the safest way to
address the issue is to also catch the exception that used to be
thrown before the inital change and is again thrown after the inital
change has been reverted.

Change-Id: I2ea2def607ec5be112e42d53a1e660fef0cdd69c
2020-07-23 20:35:21 +02: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
Felix Yan
82ebddca00 Fix compatibility issue in 5.3
The offending entry point object looks like:
EntryPoint(name='compute', value='openstackclient.compute.client',
group='openstack.cli.base')

Story: 2007917
Task: 40323
Change-Id: I0f3cc62e23efdc14203ce6645581d5ba5dbf7fa0
2020-07-14 08:06:55 -05:00
Lance Bragstad
a8aad9fec8 Add system role assignment tests for users and groups
I was writing some additional functionality and noticed these tests were
missing. This commit adds tests for adding and removing system role
assignments for users and groups.

Change-Id: I30fdc6ec55e1eb1cfa55f4cbf92c3f001d89865f
2020-07-10 08:09:51 -05:00
Zuul
8aed5feab8 Merge "Fix uploading an signed image does not work if private signing key is encrypted" 2020-07-08 17:30:38 +00:00
Zuul
9fb68eca44 Merge "Expose flag for forcing use of import for images" 2020-07-08 17:01:22 +00:00
Alexander Gräb
c06d825635 Fix uploading an signed image does not work if private signing key is encrypted
Change-Id: Ia7c84aa7b840bf92aeb7db7246d14119eb727b03
Story: 2007890
Task: 40269
2020-07-07 13:26:51 +02:00
Zuul
42692264f7 Merge "switch to stevedore for entry points" 2020-07-07 06:23:55 +00:00
Zuul
d0741d7853 Merge "Add '--force; parameter to 'openstack quota set'" 2020-07-06 20:50:24 +00:00
Doug Hellmann
870cf01148 switch to stevedore for entry points
Importing pkg_resources scans every installed distribution to find
all of the entry points. Stevedore is adding a new caching layer using
importlib.metadata, which will not.  Switching to the stevedore should
eventually speed up load times, especially for command line apps. This
change makes the switch now to ensure API compatibility.

We were already using stevedore for tests, so this moves the dependency
from test-requirements.txt to requirements.txt and raises the minimum
version to something more recent.

Change-Id: I3e3632783bc745979b6db73e610df8a77ffaceb0
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2020-07-06 08:44:31 -04:00
Monty Taylor
c04ec16cf7 Expose flag for forcing use of import for images
openstacksdk added support for using image import as a fallback
which is transparently supported here, but also provides an
override flag to allow a user to force use of import. Expose that
here.

Depends-On: https://review.opendev.org/737608
Change-Id: Ied938a8f63f305305a20ace42e9f4c84b0a5c00e
2020-06-30 07:02:23 -05:00
Zuul
d3691b81c6 Merge "Allow os quota list query to filter by project" 2020-06-29 22:22:25 +00:00
Zuul
abfca138d9 Merge "port: add --host to list command" 2020-06-26 01:13:35 +00:00
Mohammed Naser
307d23bb58 port: add --host to list command
This adds an option to allow filtering ports bound to a specific host
when listing them.

Change-Id: I747ed0f8b070074c51789576a158345f670fe733
2020-06-17 16:33:34 +00:00
Jens Harbott
8b7a2c8d59 Don't display Munch objects in the output
When the sdk gives us a resource that contains Munch columns, drop them
from the output as they are for programmatic usage only and have no use
in a CLI context.

Change-Id: Idd7306cd763b5a017a66e410e70e1adb02663c2a
2020-06-17 10:09:36 +00:00
Jens Harbott (frickler)
a04172969a Revert "Format location columns in network commands"
This reverts commit 6ee7b8d138e07bfc37c5cd887f7afa49cdabb02f.

Change-Id: I5f59959ba8a01aba49e29f4cb007397467344e58
2020-06-17 10:09:36 +00:00
Zuul
3e6874dc87 Merge "Remove os-client-config references" 2020-06-11 15:44:42 +00: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
Zuul
831dd3fe12 Merge "Make container list --all work" 2020-06-09 00:21:52 +00:00
Monty Taylor
7696593dc1 Remove os-client-config references
We've depended on openstacksdk for config for ages now, clean up
after ourselves and stop installing it in tests.

Change-Id: I66b3ec2a36bc462d2f1ac151e95ccbdc946076b8
2020-06-08 16:20:28 -05:00
Alfredo Moralejo
a15b1addb4 Replace assertItemsEqual with assertCountEqual
assertItemsEqual was removed from Python's unittest.TestCase in
Python 3.3 [1][2]. We have been able to use them since then, because
testtools required unittest2, which still included it. With testtools
removing Python 2.7 support [3][4], we will lose support for
assertItemsEqual, so we should switch to use assertCountEqual.

[1] - https://bugs.python.org/issue17866
[2] - https://hg.python.org/cpython/rev/d9921cb6e3cd
[3] - testing-cabal/testtools#286
[4] - testing-cabal/testtools#277

Change-Id: I1ad0da8deda3a8cbec384b5a9c88860a526eb48c
2020-06-01 16:39:54 +02:00
yanpuqing
533af9f1b2 Client should parse string to boolean for value 'is_domain'
When we use "--property" parameter, client get lists these the
value is string type, but the type of the value 'is_domain'
should be boolean, so we should judge it and parse it.
The patch parse string to boolean for value 'is_domain'.

Co-Authored-By: Lance Bragstad <lbragstad@gmail.com>

Change-Id: I37c9eb854524bde3a1530bfe2e3a03810fb1a676
Task: 30039
Story: 2005246
2020-05-29 07:53:13 -05:00
Pete Zaitcev
41a2e82939 Make container list --all work
The caller in openstackclient/object/v1/object.py passed a keyword
argument full_listing, but the eventual callee container_list()
expected all_data. So, --all did not work at all.

The issue passed undetected because --all did not have a test,
so we added a unit test.

In addition, exisiting tests were using a test set that did
not look like the real container listing, so we changed
LIST_CONTAINER_RESP to be realistic.

Change-Id: Id0604bcab25892e43c26cd6656b2b2eef5daa69b
2020-05-16 14:40:28 +00:00
Pete Zaitcev
f6ee42cd32 Cleanup: remove a useless reference to "object"
The method "object_list" does not have an argument "object",
so we were using a built-in class "object" by mistake.

Change-Id: I74687659223d31d3c3c119eee5874edff30634fd
2020-05-15 11:24:25 -05:00
Zuul
d394bac1de Merge "Resolve PEP8" 2020-05-15 07:27:35 +00:00