Skip to content

Commit

Permalink
Fix ownership transfer when cloning with SolidFire
Browse files Browse the repository at this point in the history
When cloning a volume with SolidFire driver, the owner of
the cloned volume is not set correctly in SolidFire when there is
a transfer of ownership.

This results in inconsistent states where the cloned volume
is owned by the new tenant in Cinder but SolidFire thinks it is still
owned by the original volume's tenant.

This patch adds the newAccountID parameter to all CloneVolume calls.

If the cloned volume is owned by the same tenant, newAccountID will
be set to the same value as the original SolidFire volume. There
will be no change of ownership done by the cloning process in SolidFire.

If the cloned volume should be owned by a different tenant, newAccountID
will be set to the appropriate SolidFire account corresponding
to the new tenant. If the SolidFire account does not exist already,
it will be created.

Fixes: bug #1183521
Change-Id: I622ca2962478298e3e0c5a26866e39919805075f
(cherry picked from commit af023fe)
  • Loading branch information
mgagne authored and j-griffith committed May 25, 2013
1 parent 3b2180e commit c56d031
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cinder/volume/drivers/solidfire.py
Expand Up @@ -304,6 +304,9 @@ def _do_clone_volume(self, src_uuid, src_project_id, v_ref):
if sf_vol is None:
raise exception.VolumeNotFound(volume_id=uuid)

if src_project_id != v_ref['project_id']:
sfaccount = self._create_sfaccount(v_ref['project_id'])

if 'qos' in sf_vol:
qos = sf_vol['qos']

Expand All @@ -318,6 +321,7 @@ def _do_clone_volume(self, src_uuid, src_project_id, v_ref):
params = {'volumeID': int(sf_vol['volumeID']),
'name': 'UUID-%s' % v_ref['id'],
'attributes': attributes,
'newAccountID': sfaccount['accountID'],
'qos': qos}

data = self._issue_api_request('CloneVolume', params)
Expand Down

0 comments on commit c56d031

Please sign in to comment.