def _compute_node_to_inventory_dict(compute_node):
 result = {}
 if (compute_node.vcpus > 0):
  result[VCPU] = {'total': compute_node.vcpus, 'reserved': 0, 'min_unit': 1, 'max_unit': compute_node.vcpus, 'step_size': 1, 'allocation_ratio': compute_node.cpu_allocation_ratio}
 if (compute_node.memory_mb > 0):
  result[MEMORY_MB] = {'total': compute_node.memory_mb, 'reserved': CONF.reserved_host_memory_mb, 'min_unit': 1, 'max_unit': compute_node.memory_mb, 'step_size': 1, 'allocation_ratio': compute_node.ram_allocation_ratio}
 if (compute_node.local_gb > 0):
  result[DISK_GB] = {'total': compute_node.local_gb, 'reserved': (CONF.reserved_host_disk_mb * 1024), 'min_unit': 1, 'max_unit': compute_node.local_gb, 'step_size': 1, 'allocation_ratio': compute_node.disk_allocation_ratio}
 return result

def _compute_node_to_inventory_dict ( compute_node ) : result = { } if ( compute_node . vcpus > 0 ) : result [ VCPU ] = { 'total' : compute_node . vcpus , 'reserved' : 0 , 'min_unit' : 1 , 'max_unit' : compute_node . vcpus , 'step_size' : 1 , 'allocation_ratio' : compute_node . cpu_allocation_ratio } if ( compute_node . memory_mb > 0 ) : result [ MEMORY_MB ] = { 'total' : compute_node . memory_mb , 'reserved' : CONF . reserved_host_memory_mb , 'min_unit' : 1 , 'max_unit' : compute_node . memory_mb , 'step_size' : 1 , 'allocation_ratio' : compute_node . ram_allocation_ratio } if ( compute_node . local_gb > 0 ) : result [ DISK_GB ] = { 'total' : compute_node . local_gb , 'reserved' : ( CONF . reserved_host_disk_mb * 1024 ) , 'min_unit' : 1 , 'max_unit' : compute_node . local_gb , 'step_size' : 1 , 'allocation_ratio' : compute_node . disk_allocation_ratio } return result
given a supplied objects .