'openstack server migration show' command is broken

Bug #2051701 reported by Bence Romsics
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
openstacksdk
Fix Released
Undecided
Bence Romsics

Bug Description

First I noticed this:

$ openstack server create --flavor cirros256 --image cirros-0.6.2-x86_64-disk --nic net-id=private vm0 --wait
...
$ openstack server migrate vm0 --wait
...
$ openstack server migration list --server vm0
+----+-----------------------+-------------+-----------+----------------+--------------+-----------------+--------+-----------------------+------------+------------+-----------+-----------------------+-----------------------+
| Id | UUID | Source Node | Dest Node | Source Compute | Dest Compute | Dest Host | Status | Server UUID | Old Flavor | New Flavor | Type | Created At | Updated At |
+----+-----------------------+-------------+-----------+----------------+--------------+-----------------+--------+-----------------------+------------+------------+-----------+-----------------------+-----------------------+
| 1 | f6ab557c-4207-40c0- | devstack0a | devstack0 | devstack0a | devstack0 | 192.168.122.225 | error | 24e41ff4-741d-40d3- | 1 | 1 | migration | 2024-01- | 2024-01- |
| | 9924-69d434bf063a | | | | | | | a742-56229181a5ae | | | | 30T13:33:08.000000 | 30T13:33:10.000000 |
+----+-----------------------+-------------+-----------+----------------+--------------+-----------------+--------+-----------------------+------------+------------+-----------+-----------------------+-----------------------+

$ openstack server migration show vm0 f6ab557c-4207-40c0-9924-69d434bf063a
'server_uuid'
$ echo $?
1

Then I realized that the same happens even with a non-existent uuid:

$ openstack server migration show vm0 00000000-0000-0000-0000-000000000000
'server_uuid'
$ echo $?
1

The environment is a recent master devstack with:

$ openstack --version
openstack 6.4.1

I plan to come back and fix this in the near future.

Changed in python-openstackclient:
assignee: nobody → Bence Romsics (bence-romsics)
Revision history for this message
Bence Romsics (bence-romsics) wrote (last edit ):

I had some time to look into this and I found the root cause:

First of all here's traceback printed at debug level:

Traceback (most recent call last):
  File "/opt/stack/data/venv/lib/python3.10/site-packages/cliff/app.py", line 410, in run_subcommand
    result = cmd.run(parsed_args)
  File "/opt/stack/data/venv/lib/python3.10/site-packages/osc_lib/command/command.py", line 38, in run
    return super(Command, self).run(parsed_args)
  File "/opt/stack/data/venv/lib/python3.10/site-packages/cliff/display.py", line 117, in run
    column_names, data = self.take_action(parsed_args)
  File "/opt/stack/python-openstackclient/openstackclient/compute/v2/server_migration.py", line 316, in take_action
    server_migration = _get_migration_by_uuid(
  File "/opt/stack/python-openstackclient/openstackclient/compute/v2/server_migration.py", line 252, in _get_migration_by_uuid
    for migration in compute_client.server_migrations(server_id):
  File "/opt/stack/openstacksdk/openstack/resource.py", line 2060, in list
    uri = base_path % params
KeyError: 'server_uuid'

Please note that the traceback above is incomplete between _get_migration_by_uuid() and list().

However it's quite clear that here we pass 'server_id':
https://opendev.org/openstack/openstacksdk/src/commit/c2baf1db41cce65ce1aa8ac8908c4e0d98f7a94c/openstack/compute/v2/_proxy.py#L2196

But when we fill in the base_path template here:
https://opendev.org/openstack/openstacksdk/src/commit/c2baf1db41cce65ce1aa8ac8908c4e0d98f7a94c/openstack/resource.py#L2060

We expect 'server_uuid' instead of 'server_id':
https://opendev.org/openstack/openstacksdk/src/commit/c2baf1db41cce65ce1aa8ac8908c4e0d98f7a94c/openstack/compute/v2/server_migration.py#L21

Both sides of the conflicting code were merged in:
https://review.opendev.org/c/openstack/openstacksdk/+/815099

I suspect the source of the confusion may have been this:
https://review.opendev.org/c/openstack/openstacksdk/+/815099/3/openstack/compute/v2/server_migration.py#56

Since the root cause is in openstacksdk, I'm moving the ticket accordingly.

affects: python-openstackclient → openstacksdk
Revision history for this message
Bence Romsics (bence-romsics) wrote :
Revision history for this message
Bence Romsics (bence-romsics) wrote (last edit ):

I believe this was fixed by https://review.opendev.org/c/openstack/openstacksdk/+/887847 and released in 3.0.0.

Changed in openstacksdk:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.