From af023fe0cce3b8ef2b90ec37f1bc49feb17eac83 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mathieu=20Gagne=CC=81?= Date: Thu, 23 May 2013 15:26:44 -0400 Subject: [PATCH] Fix ownership transfer when cloning with SolidFire 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 --- cinder/volume/drivers/solidfire.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cinder/volume/drivers/solidfire.py b/cinder/volume/drivers/solidfire.py index e21752857..d42dba25c 100644 --- a/cinder/volume/drivers/solidfire.py +++ b/cinder/volume/drivers/solidfire.py @@ -311,6 +311,9 @@ class SolidFire(SanISCSIDriver): if sf_vol is None: raise exception.VolumeNotFound(volume_id=src_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'] @@ -325,6 +328,7 @@ class SolidFire(SanISCSIDriver): 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) -- 2.45.2