Skip to content

Static routes can't be created on ROUTED VPCs #14786

Open

Description

@MitchDrage

problem

On a ROUTED VPC, createStaticRoute always fails with "Failed to create a static route", with either nexthop or gatewayid. Nothing is sent to the VR and nothing useful is logged.

It looks like VpcManagerImpl.applyStaticRoutes picks the provider by asking for the VPC's StaticNat provider. ROUTED VPC offerings can't have StaticNat, so getProviderForServiceInVpc throws UnsupportedServiceException. The finally block in CreateStaticRouteCmd.execute() then throws its own ServerApiException, which hides the original exception.

The job result:

"jobresult":{"errorcode":530,"errortext":"Failed to create a static route"}

The management server log has nothing between these two lines for the job:

INFO  [o.a.c.f.j.i.AsyncJobMonitor] (API-Job-Executor-5:[ctx-22b8d4b6, job-47083]) Add job-47083 into job monitoring
INFO  [o.a.c.f.j.i.AsyncJobMonitor] (API-Job-Executor-5:[ctx-22b8d4b6, job-47083]) Remove job-47083 from job monitoring

versions

CloudStack 4.22.1.1, KVM. The same code is in 4.20 and main.

The steps to reproduce the bug

  1. Create a ROUTED VPC offering on the VPC virtual router with Static routing, and a VPC from it.
  2. Add a private gateway, e.g. 100.64.0.1/30 with gateway 100.64.0.2.
  3. createStaticRoute vpcid=<vpc> cidr=192.0.2.0/24 nexthop=100.64.0.2, or createStaticRoute gatewayid=<gateway> cidr=192.0.2.0/24.
  4. The job fails with error 530 "Failed to create a static route" and the route is removed.

What to do about it?

When the VPC has no StaticNat service, use the provider of the Gateway service. ROUTED VPC offerings always map Gateway to VpcVirtualRouter. I'll raise a PR against 4.20.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions