'Helper method to create resource dict from node stats.'

def _node_resource(self, node):

    properties = self._parse_node_properties(node)
    vcpus = properties['cpus']
    memory_mb = properties['memory_mb']
    local_gb = properties['local_gb']
    raw_cpu_arch = properties['raw_cpu_arch']
    cpu_arch = properties['cpu_arch']
    nodes_extra_specs = {}
    nodes_extra_specs['cpu_arch'] = raw_cpu_arch
    capabilities = properties['capabilities']
    if capabilities:
        for capability in str(capabilities).split(','):
            parts = capability.split(':')
            if ((len(parts) == 2) and parts[0] and parts[1]):
                nodes_extra_specs[parts[0].strip()] = parts[1]
            else:
                LOG.warning("Ignoring    malformed    capability    '%s'.    Format    should    be    'key:val'.", capability)
    vcpus_used = 0
    memory_mb_used = 0
    local_gb_used = 0
    if self._node_resources_used(node):
        instance_info = self._parse_node_instance_info(node, properties)
        vcpus_used = vcpus = instance_info['vcpus']
        memory_mb_used = memory_mb = instance_info['memory_mb']
        local_gb_used = local_gb = instance_info['local_gb']
    if self._node_resources_unavailable(node):
        vcpus = 0
        memory_mb = 0
        local_gb = 0
    dic = {'hypervisor_hostname': str(node.uuid), 'hypervisor_type': self._get_hypervisor_type(), 'hypervisor_version': self._get_hypervisor_version(), 'resource_class': node.resource_class, 'cpu_info': None, 'vcpus': vcpus, 'vcpus_used': vcpus_used, 'local_gb': local_gb, 'local_gb_used': local_gb_used, 'disk_available_least': (local_gb - local_gb_used), 'memory_mb': memory_mb, 'memory_mb_used': memory_mb_used, 'supported_instances': _get_nodes_supported_instances(cpu_arch), 'stats': nodes_extra_specs, 'numa_topology': None}
    return dic
