mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 08:03:53 +08:00
fix(region): ipv6 gateway purge
This commit is contained in:
@@ -17,10 +17,12 @@ package compute
|
||||
import (
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options/compute"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd := shell.NewResourceCmd(&modules.IPv6Gateways)
|
||||
cmd.List(&compute.IPv6GatewayListOptions{})
|
||||
cmd.Show(&options.BaseIdOptions{})
|
||||
}
|
||||
|
||||
@@ -1125,6 +1125,20 @@ func (vpc *SVpc) purgeWires(ctx context.Context, userCred mcclient.TokenCredenti
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *SVpc) purgeIPv6Gateways(ctx context.Context, userCred mcclient.TokenCredential) error {
|
||||
gws, err := self.GetIPv6Gateways()
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "GetIPv6Gateways for vpc %s", self.Id)
|
||||
}
|
||||
for i := range gws {
|
||||
err := gws[i].RealDelete(ctx, userCred)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (vpc *SVpc) purgeVpcPeeringConnections(ctx context.Context, userCred mcclient.TokenCredential) error {
|
||||
vpcPCs, err := vpc.GetVpcPeeringConnections()
|
||||
if err != nil {
|
||||
@@ -1148,6 +1162,11 @@ func (vpc *SVpc) Purge(ctx context.Context, userCred mcclient.TokenCredential) e
|
||||
return err
|
||||
}
|
||||
|
||||
err = vpc.purgeIPv6Gateways(ctx, userCred)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "purgeIPv6Gateways")
|
||||
}
|
||||
|
||||
err = vpc.purgeWires(ctx, userCred)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -238,7 +238,7 @@ type BaseListOptions struct {
|
||||
|
||||
Manager string `help:"List objects belonging to the cloud provider" json:"manager,omitempty"`
|
||||
Account string `help:"List objects belonging to the cloud account" json:"account,omitempty"`
|
||||
Provider []string `help:"List objects from the provider" choices:"OneCloud|VMware|Aliyun|Qcloud|Azure|Aws|Huawei|OpenStack|Ucloud|ZStack|Google|Ctyun|Cloudpods|Nutanix|BingoCloud" json:"provider,omitempty"`
|
||||
Provider []string `help:"List objects from the provider" choices:"OneCloud|VMware|Aliyun|Apsara|Qcloud|Azure|Aws|Huawei|OpenStack|Ucloud|ZStack|Google|Ctyun|Cloudpods|Nutanix|BingoCloud" json:"provider,omitempty"`
|
||||
Brand []string `help:"List objects belonging to a special brand"`
|
||||
CloudEnv string `help:"Cloud environment" choices:"public|private|onpremise|private_or_onpremise" json:"cloud_env,omitempty"`
|
||||
PublicCloud *bool `help:"List objects belonging to public cloud" json:"public_cloud"`
|
||||
|
||||
Reference in New Issue
Block a user