From f4b7b7e5905dc6f3e38857cba2ff5ead3c96b057 Mon Sep 17 00:00:00 2001 From: John Griffith Date: Thu, 23 May 2013 22:57:57 -0600 Subject: [PATCH] ModifyVolume attributes on Clone. Clones copy over the attributes from the source volume, we want to keep some admin data like source-volid and if it's a clone or not. To do that we just need to call modifyvolume after the clone operation and update this info. Change-Id: I903fe6f8a57880abad8d315d091c1e57624a519c --- cinder/volume/drivers/solidfire.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/cinder/volume/drivers/solidfire.py b/cinder/volume/drivers/solidfire.py index d42dba25c..11f3168c9 100644 --- a/cinder/volume/drivers/solidfire.py +++ b/cinder/volume/drivers/solidfire.py @@ -317,26 +317,27 @@ class SolidFire(SanISCSIDriver): if 'qos' in sf_vol: qos = sf_vol['qos'] - attributes = {'uuid': v_ref['id'], - 'is_clone': 'True', - 'src_uuid': src_uuid} - - if qos: - for k, v in qos.items(): - attributes[k] = str(v) - 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) if (('result' not in data) or ('volumeID' not in data['result'])): raise exception.SolidFireAPIDataException(data=data) - sf_volume_id = data['result']['volumeID'] + + # NOTE(jdg): all attributes are copied via clone, need to do an update + # to set any that were provided + attributes = {'uuid': v_ref['id'], + 'is_clone': 'True', + 'src_uuid': src_uuid} + + params = {'volumeID': sf_volume_id, + 'attributes': attributes} + + data = self._issue_api_request('ModifyVolume', params) + model_update = self._get_model_info(sfaccount, sf_volume_id) if model_update is None: mesg = _('Failed to get model update from clone') -- 2.45.2