'Retype from one volume type to another on the same backend.'

def retype(self, context, volume, new_type, diff, host):

    old_vol_replicated = self._is_replicated_type(volume.volume_type)
    new_vol_replicated = self._is_replicated_type(new_type)
    if (old_vol_replicated and (not new_vol_replicated)):
        try:
            return (True, self._disable_replication(volume))
        except Exception:
            err_msg = _('Failed    to    disable    image    replication')
            raise exception.ReplicationError(reason=err_msg, volume_id=volume.id)
    elif ((not old_vol_replicated) and new_vol_replicated):
        try:
            return (True, self._enable_replication(volume))
        except Exception:
            err_msg = _('Failed    to    enable    image    replication')
            raise exception.ReplicationError(reason=err_msg, volume_id=volume.id)
    if ((not new_vol_replicated) and self._is_replication_enabled):
        update = {'replication_status': fields.ReplicationStatus.DISABLED}
    else:
        update = None
    return (True, update)
