'See driver.get_available_resource()
Periodic process that keeps that the compute host\'s understanding of
resource availability and usage in sync with the underlying hypervisor.
:param context: security context
:param startup: True if this is being called when the nova-compute
service is starting, False otherwise.'

@periodic_task.periodic_task(spacing=CONF.update_resources_interval)
def update_available_resource(self, context, startup=False):

    compute_nodes_in_db = self._get_compute_nodes_in_db(context, use_slave=True, startup=startup)
    nodenames = set(self.driver.get_available_nodes())
    for nodename in nodenames:
        self.update_available_resource_for_node(context, nodename)
    for cn in compute_nodes_in_db:
        if (cn.hypervisor_hostname not in nodenames):
            LOG.info('Deleting    orphan    compute    node    %(id)s    hypervisor    host    is    %(hh)s,    nodes    are    %(nodes)s', {'id': cn.id, 'hh': cn.hypervisor_hostname, 'nodes': nodenames})
            cn.destroy()
            self.scheduler_client.reportclient.delete_resource_provider(context, cn, cascade=True)
