'Initialize the compute node if it does not already exist.
The resource tracker will be inoperable if compute_node
is not defined. The compute_node will remain undefined if
we fail to create it or if there is no associated service
registered.
If this method has to create a compute node it needs initial
values - these come from resources.
:param context: security context
:param resources: initial values'

def _init_compute_node(self, context, resources):

    nodename = resources['hypervisor_hostname']
    if (nodename in self.compute_nodes):
        cn = self.compute_nodes[nodename]
        self._copy_resources(cn, resources)
        self._setup_pci_tracker(context, cn, resources)
        self._update(context, cn)
        return
    cn = self._get_compute_node(context, nodename)
    if cn:
        self.compute_nodes[nodename] = cn
        self._copy_resources(cn, resources)
        self._setup_pci_tracker(context, cn, resources)
        self._update(context, cn)
        return
    cn = objects.ComputeNode(context)
    cn.host = self.host
    self._copy_resources(cn, resources)
    self.compute_nodes[nodename] = cn
    cn.create()
    LOG.info('Compute    node    record    created    for    %(host)s:%(node)s    with    uuid:    %(uuid)s', {'host': self.host, 'node': nodename, 'uuid': cn.uuid})
    self._setup_pci_tracker(context, cn, resources)
    self._update(context, cn)
