def _get_networks_for_instance(self, context, instance_id, project_id,
                                   requested_networks=None):
        # get networks associated with project
        if requested_networks is not None and len(requested_networks) != 0:
            network_uuids = [request.network_id
                             for request in requested_networks]
            networks = self._get_networks_by_uuids(context, network_uuids)
        else:
            # NOTE(vish): Allocates network on demand so requires admin.
            networks = objects.NetworkList.get_by_project(
                    context.elevated(), project_id)
        return networks
Determine which networks an instance should connect to.
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/network/manager.py/VlanManager._get_networks_for_instance