qos = {}
valid_presets = self.sf_qos_dict.keys()
- #First look to see if they included a preset
+ # First look to see if they included a preset
presets = [i.value for i in volume.get('volume_metadata')
if i.key == 'sf-qos' and i.value in valid_presets]
if len(presets) > 0:
'detected, using %s') % presets[0])
qos = self.sf_qos_dict[presets[0]]
else:
- #look for explicit settings
+ # look for explicit settings
for i in volume.get('volume_metadata'):
if i.key in self.sf_qos_keys:
qos[i.key] = int(i.value)
if 'result' not in data:
raise exception.SolidFireAPIDataException(data=data)
+ volume['project_id': new_project]
+ volume['user_id': new_user]
+ model_update = self._do_export(volume)
LOG.debug("Leaving SolidFire transfer volume")
+ return model_update
def retype(self, ctxt, volume, new_type, diff, host):
"""Convert the volume to be of the new type.
# NOTE(jdg): need elevated context as we haven't "given" the vol
# yet
volume_ref = self.db.volume_get(context.elevated(), volume_id)
- self.driver.accept_transfer(context, volume_ref, new_user, new_project)
+
+ # NOTE(jdg): Some drivers tie provider info (CHAP) to tenant
+ # for those that do allow them to return updated model info
+ model_update = self.driver.accept_transfer(context,
+ volume_ref,
+ new_user,
+ new_project)
+
+ if model_update:
+ try:
+ self.db.volume_update(context,
+ volume_id,
+ model_update)
+ except exception.CinderException:
+ with excutils.save_and_reraise_exception():
+ LOG.exception(_("Failed updating model of "
+ "volume %(volume_id)s "
+ "with drivers update %(model)s "
+ "during xfr.") %
+ {'volume_id': volume_id,
+ 'model': model_update})
+ self.db.volume_update(context.elevated(),
+ volume_id,
+ {'status': 'error'})
def _migrate_volume_generic(self, ctxt, volume, host, new_type_id):
rpcapi = volume_rpcapi.VolumeAPI()