Commit graph

904 commits

Author SHA1 Message Date
Stephen Finucane
73021165ff trivial: Add missing ignore_missing arguments
This prevents a class of bugs.

Change-Id: I96e1cd8ed4a682ef5c95f67f3d1246f7026eada9
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-11-14 11:54:40 +00:00
Stephen Finucane
db2c1a5e2b trivial: Normalize some client usage
Ahead of rework in this area.

Change-Id: I1b1c2370967381903970870da8cbe0868b1e23e1
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-11-13 15:20:35 +00:00
Zuul
475d69efad Merge "Bug Fix: Skip invalid server ID during multi-server delete" 2025-09-08 19:43:25 +00:00
dlawton
3dfeb5ed08 Bug Fix: Skip invalid server ID during multi-server delete
Change-Id: I8e5339f07b43dd0a9422eaf33346bbfdf2c9b328
Signed-off-by: Dan Lawton <dlawton@redhat.com>
Closes-Bug: #2122056
2025-09-08 17:13:47 +01:00
Rajesh Tailor
e7554603ac Fix microversion 2.100
This change fixes missing conditional logic for microversion
2.100 which adds support for showing `scheduler_hints` field
to `openstack server list --long` output.

Change-Id: I2820e02a91deb73850f37dc737dbec79dea99e8d
Signed-off-by: Rajesh Tailor <ratailor@redhat.com>
2025-09-03 16:53:35 +05:30
Rajesh Tailor
dbddbf9760 Fix microversion 2.96
This change fixes missing conditional logic for
microversion 2.96 which adds `pinned_availability_zone`
field to `openstack server list` output.

Change-Id: I1e398bb3379fa6443b0a44db76baaf6241a945e7
Signed-off-by: Rajesh Tailor <ratailor@redhat.com>
2025-08-20 18:19:13 +05:30
Stephen Finucane
5feaa952ad compute: Fix flavor create --id auto
This was inadvertently broken during the switch from novaclient to SDK.
Fix it for now but also deprecate it since it is an unnecessary alias.

Change-Id: Iaf136d82e00defc86e57ae4ea7e848246f2ade2c
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-bug: #2120833
2025-08-18 12:20:44 +01:00
psnew14
edb17881d0 Remove leading empty line from server create with --wait
The "openstack server create" with "--wait" args was priting an extra empty line character before the server ID.
This commit removes the extra empty line.

story: 2010947
task: 48984
Change-Id: Ib5ba1c9f23e7655ddfae0e5b644ed167ecd6485e
2025-06-01 22:50:55 +09:00
Zuul
88b59d8975 Merge "evacuate: respect original SHUTOFF state in --wait completion" 2025-05-21 10:29:33 +00:00
waf
3909e93301 evacuate: respect original SHUTOFF state in --wait completion
When running `openstack server evacuate --wait`, the command would hang
indefinitely if the instance was originally in SHUTOFF state, because
only “ACTIVE” was treated as a successful completion. We now capture
the server’s status before evacuation and dynamically include
“SHUTOFF” in the `success_status` list if the instance was already
shut off. This ensures that a shutoff instance is accepted as a valid
completion without requiring manual intervention.

Unit tests have been added and updated to cover both:
- pre-evacuation ACTIVE → success_status=['active']
- pre-evacuation SHUTOFF → success_status=['active','shutoff']

Closes-Bug: #2103426
Change-Id: I86ad1cd173a144b16fde1dbac87819fab2d7a50a
2025-05-21 16:52:24 +09:00
Zuul
d5238d1dab Merge "Add a column to all_projects tag of server list cmd" 2025-05-19 14:17:25 +00:00
xfrnk2
a74850d2c4 Add a column to all_projects tag of server list cmd
Add a Project ID column to the --all-projects tag of server list cmd
Differentiate from the basic command, add a column for Project ID
to facilitate easier identification.
Add test code for the Project ID column of --all-projects tag.

Change-Id: I12af2c91f934e7cd268d21cf76dda78646ed2ff4
2025-05-19 12:38:20 +01:00
Stephen Finucane
32762bcda6 compute: Fix key used for NIC fixed IP field
Change-Id: If099ac0e2663228681e87e2f4821b746c8113ffc
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-bug: #2106221
2025-05-18 15:12:17 +01:00
Zuul
efce69b47f Merge "Don't warn about unsupported version with SDK-based commands" 2025-05-15 16:19:20 +00:00
Zuul
9de5e58bc8 Merge "Bump Python version used for linters to 3.10" 2025-05-09 16:13:11 +00:00
Stephen Finucane
7c7c066096 Bump Python version used for linters to 3.10
Change-Id: I693516fc2a08218c50d83a3ab121b51254f97958
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-07 17:55:39 +01:00
Michael Still
5d730f374b Add support for spice-direct console types.
This patch adds support for Nova microversion 2.99 which exposes the new
spice-direct console type and the pre-existing /os-console-auth-token/ API.

+----------+----------------------------------------------------------+
| Field    | Value                                                    |
+----------+----------------------------------------------------------+
| protocol | spice                                                    |
| type     | spice-direct                                             |
| url      | http://127.0.0.1:13002/nova?token=f78009fb-41ad-...      |
+----------+----------------------------------------------------------+

+----------------------+--------------------------------------+
| Field                | Value                                |
+----------------------+--------------------------------------+
| host                 | 127.0.0.1                            |
| instance_uuid        | f2477018-aa93-...                    |
| internal_access_path | None                                 |
| port                 | 5900                                 |
| tls_port             | 5901                                 |
+----------------------+--------------------------------------+

Change-Id: I2d33646d6ac9b25076d69be76dcef8f5c465cd1b
Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/940479
2025-05-07 19:34:17 +10:00
Stephen Finucane
7d64003196 tests: Stop returning FakeResource in compute tests
This was still being used in places where we have our own API bindings
because SDK does not support the API. Those bindings should be returning
dicts, not FakeResource objects. Correct this, and in doing so fix the
bug this highlights in our cell-down output.

Change-Id: I6647d94fcf5ada8186edbf64c03abd3d8ae7ca56
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-04-14 16:43:22 +01:00
Zuul
db4739fc5c Merge "Require confirmation to reset server state." 2025-04-11 13:23:47 +00:00
Sean Mooney
25cd1178b3 Require confirmation to reset server state.
This change updates the server set state command to require confirmation
before it is applied. The same pattern as project clean is used and a
new --auto-approve flag is added to allow skipping the prompt.

Operators often use reset state in cases that are incorrect
this change updates the warning to be more explicit
about when and when not to use it.

Change-Id: Iab14739cf6043ad45ad49edff0580e81d75af2fd
2025-04-11 11:53:14 +01:00
melanie witt
d123be0819 Fix 'openstack keypair list --project <project>'
The --project option of 'openstack keypair list' is supposed to filter
keypairs by a project but has not been working and instead returns
keypairs from all projects.

The reason appears to be because it uses a request for a user list
filtered by project but tenant_id/project_id is not a valid filter for
GET /users.

This fixes the issue by requesting role assignments for the specified
project and then requesting keypairs for users with a role in the
project.

This change depends on a recent openstacksdk bug fix change
Ic552dee83d56278d2b866de0cb365a0c394fe26a which fixed the user_id query
parameter for the compute /os-keypairs APIs. The bug fix was released in
openstacksdk 4.4.0.

Closes-Bug: #2096947

Change-Id: Ibb5757766e3040e58d64388b95678fab9b2b6f23
2025-04-10 17:59:29 -07:00
Zuul
616d6f3a29 Merge "Add support for showing scheduler_hints in server details" 2025-04-10 18:37:26 +00:00
Stephen Finucane
11495e655a Don't warn about unsupported version with SDK-based commands
This doesn't make sense: SDK (and the server) will handle this for us.

Change-Id: I31b84e09eca0dc2bc5316d6727620346ae519512
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-bug: #2106760
2025-04-10 18:21:17 +01:00
Rajesh Tailor
c66abfc76f Workaround for failing tests on openstacksdk change
The 'show-instance-action-finish-time' blueprint [1] adds support for
showing 'finish_time' for InstanceAction object.

This change adds 'finish_time' as hidden column, so it doesn't fail
tests.

We need to remove this from hidden_column list, once all the changes
related to blueprint are merged and show the field only if microversion
is >= 2.101

This is a workaround for failing tests on patch [2], as per suggestion
from Stephen.

[1] https://blueprints.launchpad.net/openstack/?searchtext=show-instance-action-finish-time
[2] https://review.opendev.org/c/openstack/openstacksdk/+/930562

Implements: blueprint show-instance-action-finish-time
Change-Id: Ib9294a603daed0fdb936be128dfba254b9108799
2025-04-09 12:23:38 +05:30
Douglas Viroel
c68622402e Add support for showing scheduler_hints in server details
Adds support for a new compute microversion that returns the
associated scheduler_hints in ``GET /servers/{server_id}``,
``GET /servers/detail``, ``PUT /servers/{server_id}`` and
``POST /server/{server_id}/action`` (rebuild) responses.

Change-Id: Ia5a4e0047b5123f2fb063cfc9ab1f58b2844308f
2025-04-08 19:27:29 +00:00
Stephen Finucane
dae2539490 compute: Migrate to 'compute' client alias
This is no longer assigned to novaclient, meaning we can use it for SDK.

Change-Id: I43d9ede39d36cc29301f94fa462b9b9d9441807c
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-04-03 16:39:03 +01:00
Stephen Finucane
dc8596fe74 Prepare for osc-lib changes
Change-Id: I665cd61272f881dce2d387da6035a2f35c866add
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-04-01 13:39:50 +01:00
Zuul
c9e4e5404f Merge "Permit use of tuple API_VERSIONS" 2025-04-01 12:02:24 +00:00
Stephen Finucane
b2eccdcb1a Permit use of tuple API_VERSIONS
The values of these dictionaries are not used when SDK is in use,
which should soon account for all use cases. Eventually we should
probably look for plugins to return a proper class or typeddict but
that's a job for another day.

This began as a fix for in openstackclient/object/client.py which
referenced a non-existent class and quickly snowballed.

Change-Id: I7b807ec3a97124b35828ffdecbb36f6fde11e7b5
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-04-01 10:36:02 +01:00
Stephen Finucane
e28046cc19 typing: Correct type for missing attributes
Change-Id: I55652220ecd663fa024937646dfef92595e1cd0f
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-03-31 17:52:16 +01:00
Stephen Finucane
7380fbe300 typing: Add types for empty dicts, tuples
In some cases, simply remove them.

Change-Id: I24a311a24eb533325dda83005777bcb2e0afc320
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-03-31 17:48:36 +01:00
Stephen Finucane
bdd55d989d typing: Indicate tuples to be extended
Change-Id: Ie5907de8d60f2f39e98f6a88227cebb2e2ff565c
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-03-31 17:48:36 +01:00
Zuul
ab2e68f407 Merge "Prepare for ruff bump" 2025-03-31 10:37:30 +00:00
Stephen Finucane
290bc580e6 Prepare for ruff bump
Change-Id: Ia9c402edebc8537d5019d18920b6679b05ea4378
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-03-19 12:04:39 +00:00
Rajesh Tailor
f65e4835d3 Fix missing space in help messages
This change fixes missing space in help messages to make those
consistent and pretty rendering when calling help.

Change-Id: I947374821a4dbb5e68651c0e72fc5fd2f938e6a1
2025-03-05 19:58:27 +05:30
Zuul
83de58fa33 Merge "compute: Workaround bug #2089821" 2024-12-10 14:03:49 +00:00
Stephen Finucane
22b30b99ce compute: Workaround bug #2089821
By passing a dict instead of a single value, we force SDK to populate
the correct attribute on the object.

Change-Id: I9f4c5964dc0546215474c92db567966ffad68a1a
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Related-bug: #2089821
2024-12-09 13:56:58 +00:00
Stephen Finucane
5ef5cc9c82 compute: Add server create --no-security-group option
To allow users to create servers with no security groups associated with
the ports.

Change-Id: I91b1d9dd5c3fbba838640841d98341cd8ccb1b16
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-11-29 10:33:18 +00:00
Takashi Natsume
fb1f841d2d Replace deprecated datetime.utcnow()
The datetime.utcnow() is deprecated in Python 3.12.
Replace datetime.utcnow() with
datetime.now(datetime.timezone.utc).replace(tzinfo=None).

Change-Id: Ic20174a9c6cacac05471fa57b105c1f784a73057
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2024-11-13 15:48:59 +00:00
Sylvain Bauza
58d1b06fdc evacuate SDK actually uses admin_pass param
Change I0cd86675a884e6c2cbd3a861b8e111f961f0f336 was incorrect,
the SDK param name is admin_pass.

Change-Id: Ibe22c3d7d7ba0f1a5178475143e35fee5cac2ca2
2024-09-18 08:46:44 +02:00
Zuul
b92291f0aa Merge "compute: Allow adding, removing multiple SGs" 2024-09-17 13:26:47 +00:00
Zuul
e46a7a2adc Merge "pre-commit: Migrate pyupgrade to ruff" 2024-09-13 17:35:54 +00:00
Zuul
eaec72e2ba Merge "pre-commit: Migrate bandit to ruff" 2024-09-13 17:35:52 +00:00
Zuul
f63784606d Merge "evacuate: Fix password parameter name for SDK" 2024-09-13 17:35:50 +00:00
Dr. Jens Harbott
8932282952 evacuate: Fix password parameter name for SDK
The parameter is called admin_password on the SDK side.

Change-Id: I0cd86675a884e6c2cbd3a861b8e111f961f0f336
2024-09-13 13:22:26 +02:00
Zuul
067261e80d Merge "Removed the emit_duplicated_warning() funtion." 2024-09-12 19:19:48 +00:00
Zuul
e319df4726 Merge "compute: Fix --host in server list for new openstacksdk" 2024-09-12 18:37:15 +00:00
Stephen Finucane
f98006ca9d pre-commit: Migrate pyupgrade to ruff
Change-Id: Ic50d2a5e0bc9dcdfe29f382607135cab510cd396
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-09-12 18:08:23 +01:00
Stephen Finucane
fc6852cd94 pre-commit: Migrate bandit to ruff
The name of the errors change and we need to move things around a
little, but it's otherwise a straight swap.

Change-Id: I0a19765ebeaa14c0534faa1542165b76ed2bf4e2
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-09-12 18:08:23 +01:00
Mohammed Al-Dokimi
2bf123f315 Removed the emit_duplicated_warning() funtion.
Since this function is called once, I moved its implementaion to where
its called.

Story: 2010344

Change-Id: Iaf06def1a06ffbb605ee42569e6f87b409a72772
2024-09-12 14:42:57 +01:00