

@staticmethod
def _get_resources_by_project(host_name, instances):
    project_map = {
        
    }
    for instance in instances:
        resource = project_map.setdefault(instance['project_id'], {
            'host': host_name,
            'project': instance['project_id'],
            'cpu': 0,
            'memory_mb': 0,
            'disk_gb': 0,
        })
        resource['cpu'] += instance['vcpus']
        resource['memory_mb'] += instance['memory_mb']
        resource['disk_gb'] += (instance['root_gb'] + instance['ephemeral_gb'])
    return project_map

dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/api/openstack/compute/hosts.py HostController._get_resources_by_project/original