Skip to content

GCP: Custom subnet names were incorrectly using the VPC name #5726

Description

@jimmycgz
## Issue Description: 
At GCP, when custom subnet names provided in the benchmark argument, they got incorrectly copied from the network name

## Suggested Changes:
- Modify GceNetwork class to properly handle subnet names
- Ensure network name and subnet names are managed separately
- Fix references to subnet resources to use the correct network name

## Test command to reproduce and verify this fix

source ../../venv/bin/activate
cd $HOME/projects/PerfKitBenchmarker
export LOG_FOLDER=../pkb-logs
export MACHINE_TYPE=c4d-standard-4

python3 ./pkb.py \
  --benchmarks=nginx \
  --temp_dir=$LOG_FOLDER \
  --cloud=GCP \
  --project=your-gcp-proj1 \
  --zone=us-central1-a \
  --machine_type=$MACHINE_TYPE \
  --run_uri=standalone \
  --nginx_server_machine_type=$MACHINE_TYPE \
  --nginx_upstream_server_machine_type=$MACHINE_TYPE \
  --nginx_client_machine_type=$MACHINE_TYPE \
  --nginx_content_size=1024 \
  --nginx_load_configs="32:300:32:1000,512:300:512:1000" \
  --gce_network_name=your-custom-vpc \
  --gce_subnet_name=your-custom-subnet \
  --owner=owner-name \
  --accept_licenses

## Error
2025-05-05 16:42:30,314 standalone Thread-2 (_ExecuteBackgroundThreadTasks) nginx(1/1) gce_network.py:601 INFO     Ran: {gcloud compute firewall-rules create perfkit-firewall-standalone-22-22 --allow tcp:22-22,udp:22-22 --format json --network my-subnet --project my-project1 --quiet}
ReturnCode:1
STDOUT: 
STDERR: Creating firewall...
failed.
ERROR: (gcloud.compute.firewall-rules.create) Could not fetch resource:
- The resource 'projects/my-project1/global/networks/my-subnet' was not found

Pull Request with suggested fix: #5725

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions