742 Commits

Author SHA1 Message Date
Zuul
f1cb66a476 Merge "Fix server evacuate command" 2022-09-30 13:12:07 +00:00
Zuul
adac63efe1 Merge "Speed up standard flavor list command" 2022-09-30 13:12:00 +00:00
Zuul
bd4e67452e Merge "compute: Only retrieve necessary images" 2022-09-30 12:31:53 +00:00
Pavlo Shchelokovskyy
4592d2c78f Fix server evacuate command
I don't think it has ever worked in fact..

The server.evacuate() in novaclient returns not a Server() instance,
but a TupleWithMeta() object, that has no .to_dict() method [0]
used in _prep_server_detail() function.

[0] https://review.opendev.org/c/openstack/python-novaclient/+/276639

Change-Id: I22f9ac072eb1b0bfd1263a256e9bea4500c03290
Story: 2010204
Task: 45928
2022-09-30 11:04:45 +00:00
Pavlo Shchelokovskyy
ec8dba29f9 Speed up standard flavor list command
currently this command tries to fetch extra_specs for any flavor
that does not have them (which is quite usual), regardless if the
command was even asked to display them (--long) at all.
This significantly slows down this command as it makes a lot of
unnecessary REST calls, one per each flavor to fetch extra_specs for.

With this patch, client only attempts to fetch flavor extra_specs if
the user actually called the client with --long.

Change-Id: Ia36414d891a41b641d7a9a04f0a1e7d43cfee351
Story: 2010343
Task: 46484
2022-09-30 11:53:00 +01:00
whoami-rajat
4024bdb393 compute: Add support for microversion 2.93
Add '--reimage-boot-volume' and '--no-reimage-boot-volume parameters'
to the rebuild command to allow rebuilding of volume backed instances.

Change-Id: I4a6e30b2cf12f32202a2d9ef1ced347e1dd139f3
2022-09-14 11:24:10 +01:00
whoami-rajat
1f63034441 compute: Require image when rebuilding a volume-backed server
A volume-backed server will have no image attribute (or rather the image
property will be set to the empty string). As such, if you want to try
rebuild you will need to specify an image [*]. Enforce this.

[*] Before microversion 2.93, this must be the same image. However, we
don't touch on that here. This will be addressed later.

Change-Id: I6842dabd7acb4e3a78f894e55e616625757eb6a4
Story: 2010297
Task: 46290
2022-09-14 11:22:43 +01:00
René Ribaud
6e0699c1cf Microversion 2.91: Support specifying destination host to unshelve
This patch adds a new parameter ``--host`` to
``openstack server unshelve`` command. This can help administrators to specify
an ``host`` to unshelve a shelve offloaded server.
And add new parameter ``--no-availability-zone`` to unpin a server availability

These parameters are available in the 2.91 microversion.

Depends-On: https://review.opendev.org/c/openstack/python-novaclient/+/831651
Implements: blueprint unshelve-to-host
Change-Id: I7986adc7563f63bcd4b3caf5eb7bc4329b4e1eca
2022-08-22 15:03:24 +02:00
Violet Kurtz
a9f8133274 Migrate server_groups to the new API
Moved the server_groups to the new API.

Change-Id: Ied7bd6f56e277f0c5efcd5ba028765f9be65050f
2022-08-02 20:39:19 +00:00
Zuul
15608a2696 Merge "Add more filter option of columns for server list -c COLUMN" 2022-06-20 15:19:49 +00:00
melanie witt
93578ef85b Add 'Host Status' to 'server list --long' with >= v2.16
Currently, the 'Host Status' field is shown only for 'server show' but
not for 'server list'. The host_status can be helpful for users who are
having issues with servers that show a status of ACTIVE, as it can show
a hint about the compute host status when nova policy is configured to
allow it.

Story: 2009689
Task: 44003

Change-Id: I6209cf52044218b7b32ab2fa5712574f12ba2f5f
2022-05-16 17:55:40 +00:00
Zuul
ccd877dd40 Merge "Fix typos" 2022-05-16 09:36:14 +00:00
Pavlo Shchelokovskyy
afc5f997c8 Stop using private _is_uuid_like method
currently this double-private method of a dependency library
is used in several places (openstack.cloud._utils._is_uuid_like)

openstacksdk deliberatly chose not to depend on oslo.utils to keep
dependenies to the minimum, so it just copied several methods from it,
including the is_uuid_like.

python-openstackclient however already depends on oslo.utils, so
using the public method from oslo.utils should be preferred
and more stable.

Change-Id: I578ffa36ffb00c9d47ee12a149313201973edd32
2022-04-20 17:42:02 +03:00
JIHOJU
10835a1886 Add more filter option of columns for server list -c COLUMN
In order to improve the convenient of use,
columns corresponding to the "--long" option has been added
so that it can be used in the filter.
Currently filterable columns include the following:
'ID', 'Name', 'Status', 'Networks', 'Image', 'Flavor'.

Story: 2009150
Task: 43113
Change-Id: I6760ca5da0e3707d1d746ae5eeec7d9162020d15
2022-04-19 11:17:03 +00:00
Stephen Finucane
725b7de13c compute: Only retrieve necessary images
The Glance API allows us to filter by multiple IDs using the 'in:'
operator. Take advantage of this to speed up listing of server in larger
deployments where image counts in the hundreds (or even thousands) are
not uncommon.

Unfortunately the Nova API does not support something similar for
listing flavors. Boo.

Change-Id: I7d3222d0b0b8bf72b4ff3e429bc49e621b569979
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/837613
2022-04-12 20:41:29 +01:00
Thobias Salazar Trevisan
e91e0e001c compute: Add 'Security Groups' for 'server list'
Add a column with security groups name for
--long option on server list.

Change-Id: I7062f224e18c3c8ac96a06d7ce97f9fab473bdb9
2022-03-15 08:56:59 -03:00
Stephen Finucane
c9b84106c3 compute: Move server migrations commands to their own file
The 'openstackclient.compute.v2.server' module is getting rather large.
The server migration commands don't need to be in there. Move them.

Change-Id: I8b2600cfd9f8e37d3093c52c7222d85e84e7fc89
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-03-09 17:32:30 +00:00
Stephen Finucane
cffec4517f compute: Allow retrieval of migration by UUID
The nova API doesn't allow you to retrieve migration records by UUID,
only ID. This is confusing. Work around it by listing records and
filtering this list.

Change-Id: I932c9c70420e85056509513e005bb78168e70611
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-03-09 17:31:44 +00:00
Zuul
8c975ba097 Merge "Fix 'server event list|show' for deleted servers" 2022-03-09 13:44:47 +00:00
Zuul
be1de891ac Merge "compute: Use correct command class for 'show migration'" 2022-03-09 13:44:29 +00:00
melanie witt
72a2477ec0 Fix 'server event list|show' for deleted servers
As of compute microversion >= 2.21, support for list and show of server
events for deleted servers was added. This however wasn't working using
the openstackclient because the compute GET /servers/{server_id} will
not return a deleted server, so osc_lib.utils.find_resource() fails to
find the server and the command bails early.

This adds a check for a uuid-like <server> arg and uses it directly if
the <server> cannot be found via find_resource().

A note is also added to the command help to indicate that list and show
for deleted servers will only work if a server ID is passed (name will
not work).

Story: 2009841
Task: 44443

Change-Id: Icd33b3b9a3a1855d7893dd111bbb2aca059f45fd
2022-02-09 23:26:25 +00:00
Zuul
b072118afc Merge "compute: Don't warn if disk overcommit params unset" 2022-02-09 20:42:33 +00:00
Zuul
7c7a30b3cd Merge "Skip original_name from flavor info" 2022-01-17 09:28:37 +00:00
Ritvik Vinodkumar
b5a2714b83 Switch compute service list, delete and set to sdk.
Switch the compute service commands from novaclient to SDK.

Change-Id: I16498905101d6c2702a3ccbaf8cf5e3098d51992
2022-01-14 18:36:37 +00:00
Artem Goncharov
f461af0ac8 Skip original_name from flavor info
In the new SDK we are going to add additional parameter to the flavor
which make no use for OSC. Exclude it explicitly since it also cause
failing tests.

Change-Id: Ie35e60498cf18f05c878611df6f88607a04b1870
2022-01-14 17:37:59 +01:00
Zuul
b79c0b6cfb Merge "Include hosts in aggregate list --long" 2021-12-25 10:54:27 +00:00
Zuul
eb139f6fe8 Merge "compute: Return information about fixed IP" 2021-12-25 10:54:24 +00:00
Zuul
9b49363c0d Merge "Switch add fixed IP to SDK" 2021-12-25 10:54:22 +00:00
Hugh Saunders
3a929611c0 compute: Pass through args to ssh
Why limit a user to preset ssh arguments? Capture them all and send
them along to ssh to deal with. This allows users to use the full range of
ssh arguments, including specifying a command to run on the
instance. For example:

  openstack server ssh -4 upg -- -l cirros -i ~/id_rsa_upg "date; uptime"

SSH arguments that openstackclient currently mirrors are deprecated
except for -4 and -6, as they are useful for retrieving the correct
instance IP.

Change-Id: Ia50786d5eee52688e180550fe16aeb8af610154b
Co-authored-by: Stephen Finucane <stephen@that.guru>
2021-12-15 17:41:58 +00:00
Stephen Finucane
ba69870d86 compute: Fix weird option definition for 'server ssh'
argparse allows you to specify multiple options for a given argument
when declaring the argument. For some reason, we weren't doing this for
the 'server ssh' command. There's no apparent reason for doing things
this way and it's been that way since the beginning (2013) so let's not
do that.

We also add unit tests since they were missing and should exist.

Change-Id: I67a9e6516d7057266210cd4083e9ddeb1cfaa5de
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-12-15 17:41:05 +00:00
Stephen Finucane
0cde82dcd8 compute: Return information about fixed IP
The compute API provides this information to us. We might as well use
it.

Change-Id: I5608fa80745975ce49712718452cfe296c0f64d2
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-12-14 15:55:33 +00:00
Ritvik Vinodkumar
9971d7253e Switch add fixed IP to SDK
Switch the add fixed IP command from novaclient to SDK.

Change-Id: I4752ea7b4bfc17e04b8f46dbe9a68d938501a89e
2021-12-14 14:55:22 +00:00
Dr. Jens Harbott
32e18253fa Fix RemoveServerVolume
The nova API we're using to delete a server volume attachment needs to
be handed a volume, not a volume attachment.

Also make sure that we create an error if the volume isn't actually
attached to the server.

Signed-off-by: Dr. Jens Harbott <harbott@osism.tech>
Co-authored-by: Stephen Finucane <sfinucan@redhat.com>
Change-Id: I12abd3787ea47acb4da282d00fdc1989405a0564
2021-12-08 17:59:27 +00:00
Zuul
9eb42403d3 Merge "compute: Show flavor in 'server list' with API >= 2.47" 2021-11-30 19:45:10 +00:00
Zuul
d9ad0b5d46 Merge "Switch openstack server remove port/network to using sdk" 2021-11-30 19:08:01 +00:00
Zuul
e02fd2ab18 Merge "Switch server suspend and server resume to SDK" 2021-11-30 19:07:58 +00:00
Zuul
cf02135b52 Merge "Switch server pause and server unpause to SDK" 2021-11-30 19:07:55 +00:00
Khomesh Thakre
8e362402de compute: Show flavor in 'server list' with API >= 2.47
Fix the issue where the flavor name was empty in server list output.
This requires somewhat invasive unit test changes to reflect the changed
API response from the server, but this has the upside of meaning we
don't need new tests since what we have validates things.
Also drop the flavor ID column as it is removed from the compute API.

Change-Id: Ica3320242a38901c1180b2b29109c9474366fde0
Signed-off-by: Khomesh Thakre <khomeshthakre24@gmail.com>
Story: 2008257
Task: 41113
2021-11-30 16:52:37 +00:00
Stephen Finucane
4c3de28e83 compute: Reorder building of columns for 'server list'
This has no impact on the end result, but it should make fixing issues
introduced by API microversion 2.69 a little easier.

Change-Id: I7d70eac8aa1a6197ed05a49f071e6899ec219c03
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-11-30 09:34:38 -05:00
Thrivikram Mudunuri
ff96fea012
Switch server suspend and server resume to SDK
Switch the server suspend and server resume commands from novaclient to
SDK. Use the SDK versions of test fakes to support fake Server
resources.

Change-Id: Idd0b4f13fab0f238e42844a7d759538bbda24f68
2021-11-29 11:50:04 -05:00
Thrivikram Mudunuri
b515fe61b2
Switch server pause and server unpause to SDK
Switch the server pause and server unpause commands from novaclient to
SDK. Use the SDK versions of test fakes to support fake Server
resources.

Change-Id: Id626f06f3d7edd44b306b7fc7b9b00d04af09621
2021-11-29 11:47:58 -05:00
Diwei Zhu
f82afc7f37 Switch openstack server remove port/network to using sdk
Change-Id: I1540c1f52e9a107dba20eeea9dc323c5510fe2b1
2021-11-29 14:31:07 +00:00
Zuul
397688320d Merge "Switch server image create to SDK" 2021-11-29 13:38:51 +00:00
Diwei Zhu
fae293dd52 Switch command server remove volume to sdk
Change-Id: If6f6cf93b55a67e767c54de8ce21f25252cf99ca
2021-11-26 16:11:21 +00:00
Diwei Zhu
3078a0a121 Switch command server add volume to sdk.
File tests.unit.volume.v2.fakes is modified to provide sdk volume fakes.
File tests.unit.compute.v2.fakes is modified to provide sdk volume
attachment fakes. For test, setup_sdk_volumes_mock() method is created
so that volumes are created in similar way as servers are created.

Change-Id: I290ba83b6ba27a1377ab73fd0ae06ecced25efd1
2021-11-22 16:01:29 +00:00
Thrivikram Mudunuri
9acbd3e105
Switch server image create to SDK
Switch the server image create command from novaclient to SDK. Use the
SDK versions of test fakes to support fake Server resources. Also,
fetch updated image *after* waiting. If a user requests that we wait
(--wait) for a server image to become active before returning, then we
should probably return the final image. If we don't then the image can
appear to be in a non-active state when it fact it's active. Correct
this by fetching the image after the wait call.

Change-Id: I83a403c035add9ab041ed6d59b5b29e42267f143
2021-11-16 11:36:02 -05:00
Zuul
8b394e5641 Merge "Switch openstack server add port/network to using sdk." 2021-11-15 16:31:15 +00:00
Diwei Zhu
2183a61147 Switch openstack server add port/network to using sdk.
The old novaclient.v2.server.Server.interface_attach() method is
replaced with proxy.create_server_interface().
In swargs, 'net_id' and 'port_id' are mutual-exclusive, if one of
them is given with value, the other one cannot be None, as the
API would responde with 400 (None is not string).
In unit test, temporary method 'setup_sdk_servers_mock' is added,
because other tests are still using the old 'setup_servers_mock'.
Functional tests are added. Releasenote is generated.

Change-Id: I9899f0509febc5143560a1859ae6344d0a6d1427
2021-11-14 15:23:36 +00:00
Stephen Finucane
163cb01e46 compute: Return details of attached volumes
The API behind the 'server add volume' command returns details of the
created volume attachment, however, we were dropping these results
rather than displaying them to the user. Correct this.

Change-Id: I3f7e121220d29422ccf4e6940de2f28bb8496c83
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-11-03 11:57:31 +00:00
Stephen Finucane
442838ed15 compute: Use correct command class for 'show migration'
We should be inheriting from 'ShowOne'. Failure to do so results in a
tuple being dumped to the screen. Not what we intended.

While we're here, we update the docstring of this command to clarify the
command's intent. Nova does not provide an API to retrieve an individual
migration record for a cold migration or completed live migration. As
such, the 'server migration show' command only works for in-progress
live-migrations.

Change-Id: I2e2fe3da7d642b9e8e3d930603dcde178cd68cde
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Story: 2009658
Task: 43837
2021-11-03 10:19:52 +00:00