'Ensures that the placement API has a record of a resource provider
with the supplied UUID. If not, creates the resource provider record in
the placement API for the supplied UUID, optionally passing in a name
for the resource provider.
The found or created resource provider object is returned from this
method. If the resource provider object for the supplied uuid was not
found and the resource provider record could not be created in the
placement API, we return None.
:param uuid: UUID identifier for the resource provider to ensure exists
:param name: Optional name for the resource provider if the record
does not exist. If empty, the name is set to the UUID
value'

def _ensure_resource_provider(self, uuid, name=None):

    if (uuid in self._resource_providers):
        msg = 'Refreshing    aggregate    associations    for    resource    provider    %s'
        LOG.debug(msg, uuid)
        aggs = self._get_provider_aggregates(uuid)
        self._provider_aggregate_map[uuid] = aggs
        return self._resource_providers[uuid]
    rp = self._get_resource_provider(uuid)
    if (rp is None):
        name = (name or uuid)
        rp = self._create_resource_provider(uuid, name)
        if (rp is None):
            return
    msg = 'Grabbing    aggregate    associations    for    resource    provider    %s'
    LOG.debug(msg, uuid)
    aggs = self._get_provider_aggregates(uuid)
    self._resource_providers[uuid] = rp
    self._provider_aggregate_map[uuid] = aggs
    return rp
