mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #10527 from ioito/hotfix/qx-nat-public
fix: vpc public with nat
This commit is contained in:
@@ -1489,6 +1489,16 @@ func (vpc *SVpc) PerformPublic(ctx context.Context, userCred mcclient.TokenCrede
|
||||
}
|
||||
}
|
||||
}
|
||||
nats, err := vpc.GetNatgateways()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "vpc.GetNatgateways")
|
||||
}
|
||||
for i := range nats {
|
||||
_, err = nats[i].PerformPublic(ctx, userCred, query, input)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "nat.PerformPublic")
|
||||
}
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -1496,6 +1506,16 @@ func (vpc *SVpc) PerformPrivate(ctx context.Context, userCred mcclient.TokenCred
|
||||
if vpc.Id == "default" {
|
||||
return nil, httperrors.NewForbiddenError("Prohibit making default vpc private")
|
||||
}
|
||||
nats, err := vpc.GetNatgateways()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "vpc.GetNatgateways")
|
||||
}
|
||||
for i := range nats {
|
||||
_, err = nats[i].PerformPrivate(ctx, userCred, query, input)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "nat.PerformPrivate")
|
||||
}
|
||||
}
|
||||
// perform private for all emulated wires
|
||||
emptyNets := true
|
||||
wires := vpc.GetWires()
|
||||
|
||||
Reference in New Issue
Block a user