not honoring user_id during clone volume

Bug #2056081 reported by Rajat Dhasmana
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
In Progress
Undecided
Rajat Dhasmana

Bug Description

When we clone a volume from a source volume, we copy details from old volume and update some fields based on the new volume details[1]
In this, we update the volume's project id based on the context[2] but don't update the user_id based on the context.
This causes issues when trying to access the volume since the volume is created in the user or service context's project but the user ID is of the source volume user and not of the destination volume user.

Failure scenario:
1. Configure glance using cinder backend
2. as a normal upload a volume to image

Expected
cinder should be able to upload the volume as image

Actual
cinder will clone the image-volume with user_id as source volume's user and service project hence glance won't be able to access the volume and fail to register location

We can see the project ID is correct because of [2]

(Pdb) new_vol_values['project_id']
'4f92f53921b849c29f6fc5941152717c'
(Pdb) ctx.project_id
'4f92f53921b849c29f6fc5941152717c'

the user ID is different because we don't set it from current context rather copy it from source volume

(Pdb) new_vol_values['user_id']
'c6bfba032a254641bb390b2a47bcc7ab'
(Pdb) ctx.user_id
'da66c9f8a17b49daa7ca50aa95fb6d79'

[1] https://github.com/openstack/cinder/blob/20fe5b51f6aad2651b460dc43a48d743573ebd02/cinder/volume/manager.py#L1636-L1646
[2] https://github.com/openstack/cinder/blob/20fe5b51f6aad2651b460dc43a48d743573ebd02/cinder/volume/manager.py#L1644

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/cinder/+/911004

Changed in cinder:
status: New → In Progress
Eric Harney (eharney)
Changed in cinder:
assignee: nobody → Rajat Dhasmana (whoami-rajat)
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.