'Get the current state and resource usage for this instance.
If the instance is not found this method returns (a dictionary
with) NOSTATE and all resources == 0.
:param instance: the instance object.
:returns: a InstanceInfo object'

def get_info(self, instance):

    try:
        node = self._validate_instance_and_node(instance)
    except exception.InstanceNotFound:
        return hardware.InstanceInfo(state=map_power_state(ironic_states.NOSTATE))
    properties = self._parse_node_properties(node)
    memory_kib = (properties['memory_mb'] * 1024)
    if (memory_kib == 0):
        LOG.warning('Warning,    memory    usage    is    0    for    %(instance)s    on    baremetal    node    %(node)s.', {'instance': instance.uuid, 'node': instance.node})
    num_cpu = properties['cpus']
    if (num_cpu == 0):
        LOG.warning('Warning,    number    of    cpus    is    0    for    %(instance)s    on    baremetal    node    %(node)s.', {'instance': instance.uuid, 'node': instance.node})
    return hardware.InstanceInfo(state=map_power_state(node.power_state), max_mem_kb=memory_kib, mem_kb=memory_kib, num_cpu=num_cpu)
