Image owner incorrectly changes when accepting shared image membership with --project flag

Bug #2136795 reported by Abhishek Kekane
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-openstackclient
Fix Released
Undecided
Abhishek Kekane

Bug Description

When using `openstack image set --project <project_id> --accept <image_id>` to accept a shared image membership, the command incorrectly changes the image owner to the specified project instead of only updating the member status.

Steps to Reproduce:
===================
1. Create an image in tenantA as a private image
2. Change the image visibility to shared
3. Add tenantB as a member: `openstack image add project <image_id> <tenantB_id>` (from tenantA)
4. In tenantB, accept the membership: `openstack image set --project <tenantB_id> --accept <image_id>`
5. Check the image owner: `openstack image show <image_id>`

Expected Behavior:
=================
- The member status should change from `pending` to `accepted`
- The image owner should remain tenantA (the original producer)
- Users in tenantA should still be able to see and manage the image

Actual Behavior:
================
- The member status changes to `accepted` (correct)
- The image owner changes to tenantB (incorrect - BUG)
- Users in tenantA can no longer see the image in their image list
- The original producer (tenantA) loses access to their own image

Workaround:
===========
Use separate commands:
- `openstack image set --accept <image_id>` (uses current project)
- OR `openstack image member set <image_id> <member_project_id> accepted`

Proposed Fix:
=============
When --accept, --reject, or --pending flags are used, the --project parameter should only identify which member's status to update, and should NOT set the owner_id. Only set owner_id when --project is used without membership flags.

Changed in python-openstackclient:
assignee: nobody → Abhishek Kekane (abhishek-kekane)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-openstackclient (master)
Changed in python-openstackclient:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-openstackclient (master)

Reviewed: https://review.opendev.org/c/openstack/python-openstackclient/+/971392
Committed: https://opendev.org/openstack/python-openstackclient/commit/ed2dc692ddaf0b5b7fd62d2c7e0eb03c2e4b1287
Submitter: "Zuul (22348)"
Branch: master

commit ed2dc692ddaf0b5b7fd62d2c7e0eb03c2e4b1287
Author: Abhishek Kekane <email address hidden>
Date: Thu Dec 18 06:43:10 2025 +0000

    Fix image owner change when accepting membership with --project

    When using 'openstack image set --project <project> --accept <image>',
    the command incorrectly changed the image owner. The --project parameter
    when used with membership flags should only identify which member's
    status to update, not change ownership.

    Closes-Bug: #2136795
    Change-Id: I1044b51f38000fb5339740bc40c7f8645c794402
    Signed-off-by: Abhishek Kekane <email address hidden>

Changed in python-openstackclient:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-openstackclient (stable/2025.2)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-openstackclient (stable/2025.2)

Reviewed: https://review.opendev.org/c/openstack/python-openstackclient/+/971462
Committed: https://opendev.org/openstack/python-openstackclient/commit/ad2689d1d346e12787d8ce7714427237b65afc2f
Submitter: "Zuul (22348)"
Branch: stable/2025.2

commit ad2689d1d346e12787d8ce7714427237b65afc2f
Author: Abhishek Kekane <email address hidden>
Date: Thu Dec 18 06:43:10 2025 +0000

    Fix image owner change when accepting membership with --project

    When using 'openstack image set --project <project> --accept <image>',
    the command incorrectly changed the image owner. The --project parameter
    when used with membership flags should only identify which member's
    status to update, not change ownership.

    Closes-Bug: #2136795
    Change-Id: I1044b51f38000fb5339740bc40c7f8645c794402
    Signed-off-by: Abhishek Kekane <email address hidden>
    (cherry picked from commit ed2dc692ddaf0b5b7fd62d2c7e0eb03c2e4b1287)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-openstackclient 8.3.0

This issue was fixed in the openstack/python-openstackclient 8.3.0 Gazpacho release.

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.