2065 Commits

Author SHA1 Message Date
Eric Fried
3b409e4d0e Refactor AggregateTests
While investigating the referenced story/bug I noticed that
wait_for_status in
openstackclient.tests.functional.compute.v2.test_aggregate.AggregateTests
was doing a lot more than it should ever need to (it probably got copied
in from somewhere). The two places calling it only need to a) check the
output of `openstack aggregate show`, and b) try once -- since they just
got done creating the aggregate synchronously, there should never be a
need to delay/retry. So this commit removes the helper method and just
inlines the check.

At the same time, the addCleanup(aggregate delete) directives are moved
above their respective creates. This is a defensive best practice which
makes sure cleanup happens even if something fails very soon after the
actual back-end create (as was in fact the case with the referenced
bug/story).

It is unknown whether this will impact the referenced bug.

Change-Id: I0d7432f13642fbccd5ca79da9c76adfcbabb5fa9
Story: 2006811
Related-Bug: #1851391
2019-11-05 21:32:15 +00:00
Matt Riedemann
4b393681d9 Use SDK to get compute API extensions
python-novaclient 16.0.0 removed the deprecated
list_extensions module [1] so this changes the
extensions command to use openstacksdk to get the
compute API extensions.

The functional test ExtensionTests.test_extension_list_compute
ensures this works.

[1] https://review.opendev.org/686516/

Change-Id: I9894bc395c0474aaa6494ac4534862efe4ea7984
Story: #2006769
Task: #37284
2019-10-31 16:48:29 +00:00
Eric Fried
f1d742f32a Fix functional tests for py3
Fix various things so the functional tests will work under python3:

- A hashlib.md5() can only be update()d with an encoded string in py3.
- There's no dict.iteritems(), change to dict.items() (which is already
  an iterator).
- Open temp files with 'w+' mode rather than the default 'w+b' (as an
  alternative to encoding all the write and expected-read payloads as
  bytes).
- (This is a weird one) Explicitly raise SkipTest from unittest (rather
  than unittest2, which is where cls.skipException landed). Not sure why
  this is busted, but this moves the ball.

Change-Id: Ic9b2b47848a600e87a3674289ae7ae8c3e091fee
2019-10-31 00:17:35 +00:00
Zuul
7e98aaefa9 Merge "Add parent project filter for listing projects" 2019-10-22 21:16:40 +00:00
Zuul
b7b124f327 Merge "More aggregate functional race chasing" 2019-09-11 02:29:28 +00:00
Dean Troyer
de8ab5e8fd More aggregate functional race chasing
AggregateTests.wait_for_status() was a classmethod, those often
are sources of conflict in parallel testing...

Change-Id: I6211fd9c36926ca97de51a11923933d4d9d2dfda
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2019-09-10 14:09:29 -05:00
Zuul
d1385971bb Merge "Add floating IP Port Forwarding commands" 2019-09-09 16:12:23 +00:00
zhangbailin
fcd46acb69 Microversion 2.77: Support Specifying AZ to unshelve
This patch adds a new parameter ``--availability-zone`` to
``openstack server unshelve`` command. This can help users to specify
an ``availability_zone`` to unshelve a shelve offloaded server from
2.77 microversion.

Depends-On: https://review.opendev.org/679295

Implements: blueprint support-specifying-az-when-restore-shelved-server

Change-Id: Ia431e27c2a17fe16466707cc362532860ecf22df
2019-09-03 21:38:44 +00:00
Takashi Kajinami
7c1b6a799e Add parent project filter for listing projects
This patch introduces a new option --parent into project list,
to specify a parent project to filter projects which has
the given project as their parent.

Depends-on: https://review.opendev.org/#/c/677101
Change-Id: I6725262cf040e0ec6ceca9cf0462ce59224049c6
2019-09-02 09:05:37 +09:00
Dean Troyer
31c47adebb Remove races in floating ip functional tests
Multiple subnets with the same name are occasionally created when
running tests in parallel.

Change-Id: Ifb85e39ee53b529e2b97abf782c7fba93d48e9e2
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2019-08-31 09:03:46 -05:00
Zuul
eed615e7d0 Merge "Remove token_endpoint auth type" 2019-08-29 00:02:31 +00:00
LIU Yulong
f044016e29 Add floating IP Port Forwarding commands
Add following commands:
  floating ip port forwarding create
  floating ip port forwarding delete
  floating ip port forwarding list
  floating ip port forwarding set
  floating ip port forwarding show

Closes-Bug: #1811352
Change-Id: I6a5642e8acce28fc830410d4fa3180597b862761
2019-08-29 07:39:42 +08:00
Zuul
fd63a909a8 Merge "Bump hacking version" 2019-08-28 02:42:06 +00:00
Stephen Finucane
6419533f43 Bump hacking version
Pick up newer versions of this library. Thankfully no serious changes
are needed.

Change-Id: I69e523844529fc1c8aa0c1ce764182dbe29cfeb6
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-08-27 17:12:15 -05:00
Zuul
c9cc8b0ae2 Merge "Format aggregate command fields and de-race functional tests" 2019-08-27 18:04:57 +00:00
Dean Troyer
6fcc2608b1 Remove token_endpoint auth type
The token_endpoint was a compatibility auth type to maintain support
for the --url global option that dated back to the beginning of
OpenStack CLI auth.  The common keystoneauth library implements
'admin_token' which provides the same functionality using
--endpoint rather than --url.

Change-Id: I1b9fbb96e447889a41b705324725a2ffc8ecfd9f
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2019-08-27 11:08:50 -05:00
Dean Troyer
03a2accb2f Format aggregate command fields and de-race functional tests
Rename metadata to property in all aggregate commands

Beef up functional tests to reduce street racing

Change-Id: I4598da73b85a954f3e6a3981db21891b45d9548c
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2019-08-26 17:50:06 -05:00
Dean Troyer
75f0f82c41 Add CLI argument tests before making changes
Add these tests before hacking on the global args and removing
the compatibility stuff so we can clearly see what actually changes.

Change-Id: Ic86c89da1475b4914ff7cb2396199cd219a12097
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2019-08-22 23:50:24 -05:00
Dean Troyer
3b2863e369 Fix functional.base.TestCase.openstack() to optionally omit --os-auth-type
Change the functional test TestCase.openstack() method to add a
way to not include the --os-auth-type option in order to test the
default auth-type logic.

Change-Id: I0f1ca2f7517a41278afaad5aaf4e98accb16bea2
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2019-08-22 11:05:09 -05:00
Zuul
a15e4741fa Merge "Add 'openstack server resize (confirm|revert)' commands" 2019-08-20 18:12:20 +00:00
Zuul
8ef2602447 Merge "Add openstack server create --boot-from-volume option" 2019-08-20 18:10:21 +00:00
Zuul
07fcb733fc Merge "Support type=image with --block-device-mapping option" 2019-08-20 17:58:30 +00:00
Zuul
b0ec909160 Merge "Fix compute service set handling for 2.53+" 2019-08-20 17:53:33 +00:00
Zuul
9042668da4 Merge "Make configuration show not require auth" 2019-08-09 17:29:40 +00:00
Matt Riedemann
b9d6310556 Add openstack server create --boot-from-volume option
This adds a --boot-from-volume option to the server create
command which is used with the --image or --image-property
option and will create a volume-backed server from the
specified image with the specified size. Similar to the
--volume option, the created root volume will not be deleted
when the server is deleted. The --boot-from-volume option
is not allowed with the --volume option since they both create
a block device mapping with boot_index=0.

Change-Id: I88c590361cb232c1df7b5bb010dcea307080d34c
Story: 2006302
Task: 36017
2019-08-09 16:44:46 +00:00
Matt Riedemann
6a199bd141 Support type=image with --block-device-mapping option
The --block-device-mapping option on the server create
command currently only supports booting from volume and
volume snapshot. A common boot-from-volume scenario is
providing an image and letting nova orchestrate the
creation of the image-backed volume and attaching it to
the server.

This adds support for type=image in the --block-device-mapping
option. The volume size is required in this case. Note that
the CLI currently says if type=snapshot that size is also required
but that's technically not true. When booting from a volume
snapshot, the compute API will use the size of the volume snapshot
to create the volume if an explicit size is not provided. For the
purposes of this patch, we need the size anyway for the image
being the block device mapping source type.

Change-Id: I57b3c261d8309f7b9f62a3e91612bce592a887a3
Story: 2006302
Task: 36016
2019-08-09 16:36:17 +00:00
Matt Riedemann
4bd53dc109 Fix compute service set handling for 2.53+
With compute API microversion 2.53 there is a single
PUT /os-services/{service_id} API which takes the service
id as a UUID. Since the openstack compute service set
command only takes --host and --service (binary) to identify
the service, this change checks if 2.53 or greater is being
used and if so, looks up the service by host and binary and
calls the appropriate methods in novaclient.

If the command cannot uniquely identify a compute service
with the given host and binary, an error is raised. A future
change could add an --id option to be used with 2.53+ to
pass the service id (as UUID) directly to avoid the host/binary
filtering.

Change-Id: I868e0868e8eb17e7e34eef3d2d58dceedd29c2b0
Story: 2005349
Task: 30302
2019-08-09 16:00:13 +00:00
Stephen Finucane
7561e062eb Add 'openstack server resize (confirm|revert)' commands
These are currently exposed as flags on the 'openstack server resize'
command but they are in fact operation and should be exposed as commands
in their own right.

The old flag-based variants are deprecated for removal in 4.0.

Change-Id: I733796d3bda6c3755a3d3548bbe695abb474a6a0
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-08-09 15:48:15 +00:00
Zuul
6f60f833e8 Merge "openstack port create support --extra-dhcp-option" 2019-08-01 21:56:43 +00:00
Zuul
daadcd79c5 Merge "Support IPv6 addresses better" 2019-08-01 21:54:02 +00:00
Dean Troyer
865e182970 Make configuration show not require auth
The configuration show should not require auth to just display the
OSC config object.  Changes to make it not require auth have
knock-on effects of needing to change a bunch of tests that use it
assuming it _does_ require auth so change those to use 'extension list'
instead.

This sets up further testing of the command line options for changes
in behaviour when we switch to straight SDK usage for configuration.

Change-Id: I6c52485341214ba401064c0f2d1e2b95fdc225c0
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2019-08-01 14:53:02 -05:00
zhouhenglc
68809fce5a openstack port create support --extra-dhcp-option
neutron create-port API  has extra_dhcp_opts parameter, this parameter
can set port with special extra dhcp options.

Change-Id: I199f17e95c509a33f809ac85c65f685a37acd198
2019-07-25 06:13:11 +00:00
Zuul
c474319909 Merge "Add host and hypervisor_hostname to create servers" 2019-07-23 01:32:32 +00:00
zhu.boxiang
340f25fa14 Add host and hypervisor_hostname to create servers
Adds the --host and --hypervisor-hostname options to
``openstack server create`` CLI.

Depends-On: https://review.opendev.org/670558

Change-Id: If188c3d96fa506dbe62ef256418f2f9bca1520c2
Blueprint: add-host-and-hypervisor-hostname-flag-to-create-server
2019-07-19 15:45:18 +00:00
Brian Haley
969e6abd20 Support IPv6 addresses better
When adding a security group rule, if no IP address is given
we will use '0.0.0.0/0', but if the ethertype is IPv6 we will
leave it as None.  Change this to be '::/0' to match what we
do for IPv4 - use the "any" address.  The neutron server
treats them both the same when checking for duplicates.

Because there are most likely entries in the DB using None
for the IP, print them as '0.0.0.0/0' or '::/0' so it is more
obvious what address they are actually referring to.

Also change to display the Ethertype column by default
instead of with --long, since easily knowing IPv4 or IPv6
is useful.

Change-Id: Ic396fc23caa66b6b0034c5d30b27c6ed499de5a6
Closes-bug: #1735575
2019-07-15 22:35:49 -04:00
melanie witt
bfc34e11b3 Fix BFV server list handling with --name-lookup-one-by-one
When the --name-lookup-one-by-one option passed to the 'server list'
command, the image and flavor names will be looked up for each
server being listed instead of fetching all image/flavor names.

The current code assumes all servers have an image attribute, but
servers booted from volumes have no image, so the following error is
raised when listing BFV servers with --name-lookup-one-by-one:

  AttributeError: ('unicode'|'str') object has no attribute 'get'

The error occurs when the code attempts server.image.get('id').

This fixes the --name-lookup-one-by-one code not to assume an image
for a server. The unit tests for 'server list' have also been
robustified to feature one BFV server to enhance our test coverage.

Story: #2006063
Task: #34777

Change-Id: I312c971346c7ded93f6fcaa515098554b8580295
2019-06-28 22:06:39 +00:00
Zuul
eada2db332 Merge "Use cliff formattable columns in identity commands" 2019-06-23 04:49:33 +00:00
Zuul
f0fafec54f Merge "Use cliff formattable columns in image commands" 2019-06-23 04:30:51 +00:00
Zuul
46ef850ce9 Merge "Use cliff formattable columns in volume v2 commands" 2019-06-23 00:45:37 +00:00
Zuul
d3df7d67d7 Merge "Use cliff formattable columns in volume v1 commands" 2019-06-23 00:45:36 +00:00
Zuul
3258b9e5e3 Merge "Change default security group protocol to 'any'" 2019-06-22 21:39:31 +00:00
Akihiro Motoki
4cd614305f Use cliff formattable columns in volume v2 commands
Partial-Bug: #1687955
Partially implement blueprint osc-formattable-columns

Change-Id: I761ccac126208927594ad0d98a3cf5ad8b44bd48
2019-06-22 14:56:10 -05:00
Akihiro Motoki
1af3056e30 Use cliff formattable columns in volume v1 commands
Partial-Bug: #1687955
Partially implement blueprint osc-formattable-columns

Change-Id: Ib4c5798171e32a8ddc08a37ee1d416e366a71d76
2019-06-22 14:53:28 -05:00
Akihiro Motoki
8d63e3f0c3 Use cliff formattable columns in image commands
Related functional tests are converted into JSON format.
Otherwise, it is not easy to check results.

Partial-Bug: #1687955
Partially implement blueprint osc-formattable-columns

Change-Id: Ib82e15738544975fede0c54cc5eaf239f4c67277
2019-06-22 13:36:46 -05:00
Zuul
1a21f02bc7 Merge "Use cliff formattable columns in network commands" 2019-06-22 18:27:00 +00:00
Akihiro Motoki
fa5046a3db Use cliff formattable columns in identity commands
Partial-Bug: #1687955
Partially implement blueprint osc-formattable-columns

Change-Id: Ia13314a012b3a7363ffb24a13c79c6ecdff1ed7b
2019-06-22 16:18:26 +00:00
Zuul
c20421c467 Merge "Remove deprecated volume commands and args" 2019-06-22 07:17:28 +00:00
Zuul
1d6e24246a Merge "Remove deprecated network options" 2019-06-21 23:00:59 +00:00
Zuul
3161f87c44 Merge "Remove deprecated image commands" 2019-06-21 23:00:57 +00:00
Zuul
377c0ce0f7 Merge "Remove deprecated identity commands and args" 2019-06-21 23:00:56 +00:00