'Populate filter properties with history of retries for request.
If maximum retries is exceeded, raise NoValidBackend.'

def _populate_retry(self, filter_properties, properties):

    max_attempts = self.max_attempts
    retry = filter_properties.pop('retry', {})
    if (max_attempts == 1):
        return
    if retry:
        retry['num_attempts'] += 1
    else:
        retry = {'num_attempts': 1, 'backends': [], 'hosts': []}
    filter_properties['retry'] = retry
    volume_id = properties.get('volume_id')
    self._log_volume_error(volume_id, retry)
    if (retry['num_attempts'] > max_attempts):
        raise exception.NoValidBackend(reason=(_('Exceeded    max    scheduling    attempts    %(max_attempts)d    for    volume    %(volume_id)s') % {'max_attempts': max_attempts, 'volume_id': volume_id}))
