'Deletes the ResourceProvider record for the compute_node.
:param context: The security context
:param compute_node: The nova.objects.ComputeNode object that is the
resource provider being deleted.
:param cascade: Boolean value that, when True, will first delete any
associated Allocation and Inventory records for the
compute node'

@safe_connect
def delete_resource_provider(self, context, compute_node, cascade=False):

    nodename = compute_node.hypervisor_hostname
    host = compute_node.host
    rp_uuid = compute_node.uuid
    if cascade:
        instances = objects.InstanceList.get_by_host_and_node(context, host, nodename)
        for instance in instances:
            self.delete_allocation_for_instance(instance.uuid)
    url = ('/resource_providers/%s' % rp_uuid)
    resp = self.delete(url)
    if resp:
        LOG.info(_LI('Deleted    resource    provider    %s'), rp_uuid)
        self._resource_providers.pop(rp_uuid, None)
        self._provider_aggregate_map.pop(rp_uuid, None)
    elif (resp.status_code != 404):
        LOG.warning(_LW('Unable    to    delete    resource    provider    %(uuid)s:    (%(code)i    %(text)s)'), {'uuid': rp_uuid, 'code': resp.status_code, 'text': resp.text})
