diff --git a/pkg/multicloud/ctyun/region.go b/pkg/multicloud/ctyun/region.go index ffcdb1bb0e..a119051a8e 100644 --- a/pkg/multicloud/ctyun/region.go +++ b/pkg/multicloud/ctyun/region.go @@ -115,6 +115,7 @@ func (self *SRegion) CreateVpc(name, cidr string) (*SVpc, error) { return nil, err } + vpc.ResVpcID, _ = resp.GetString("returnObj", "id") vpc.region = self return vpc, nil } diff --git a/pkg/multicloud/ctyun/vpc.go b/pkg/multicloud/ctyun/vpc.go index c0aaab847e..743a51da97 100644 --- a/pkg/multicloud/ctyun/vpc.go +++ b/pkg/multicloud/ctyun/vpc.go @@ -204,6 +204,10 @@ func (self *SRegion) GetVpc(vpcId string) (*SVpc, error) { return nil, errors.Wrap(err, "SRegion.GetVpc.DoGet") } + if id, _ := resp.GetString("returnObj", "resVpcId"); len(id) == 0 { + return nil, errors.Wrap(cloudprovider.ErrNotFound, "SRegion.GetVpc.GetID") + } + err = resp.Unmarshal(vpc, "returnObj") if err != nil { return nil, errors.Wrap(err, "SRegion.GetVpc.Unmarshal")