diff --git a/pkg/backup/snapshotter/snapshotter_aws.go b/pkg/backup/snapshotter/snapshotter_aws.go index 4c8e877ead8..047ca77f990 100644 --- a/pkg/backup/snapshotter/snapshotter_aws.go +++ b/pkg/backup/snapshotter/snapshotter_aws.go @@ -16,7 +16,7 @@ package snapshotter import ( "errors" "fmt" - bkutil "github.com/pingcap/tidb-operator/pkg/backup/util" + "github.com/pingcap/tidb-operator/pkg/backup/util" "regexp" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" @@ -40,9 +40,9 @@ type AWSSnapshotter struct { } func (s *AWSSnapshotter) Init(deps *controller.Dependencies, conf map[string]string) error { - s.BaseSnapshotter.Init(deps, conf) + err := s.BaseSnapshotter.Init(deps, conf) s.volRegexp = regexp.MustCompile("vol-.*") - return nil + return err } func (s *AWSSnapshotter) GetVolumeID(pv *corev1.PersistentVolume) (string, error) { @@ -99,10 +99,8 @@ func (s *AWSSnapshotter) PrepareRestoreMetadata(r *v1alpha1.Restore, csb *CloudS return s.BaseSnapshotter.prepareRestoreMetadata(r, csb, s) } -type TagMap map[string]string - func (s *AWSSnapshotter) AddVolumeTags(pvs []*corev1.PersistentVolume) error { - resourcesTags := make(map[string]bkutil.TagMap) + resourcesTags := make(map[string]util.TagMap) for _, pv := range pvs { podName := pv.GetAnnotations()[SourcePodNameKey] @@ -115,7 +113,7 @@ func (s *AWSSnapshotter) AddVolumeTags(pvs []*corev1.PersistentVolume) error { resourcesTags[volId] = tags } - ec2Session, err := bkutil.NewEC2Session(CloudAPIConcurrency) + ec2Session, err := util.NewEC2Session(CloudAPIConcurrency) if err != nil { return err } diff --git a/pkg/backup/snapshotter/snapshotter_gcp.go b/pkg/backup/snapshotter/snapshotter_gcp.go index b55ac8e45bc..79049aea242 100644 --- a/pkg/backup/snapshotter/snapshotter_gcp.go +++ b/pkg/backup/snapshotter/snapshotter_gcp.go @@ -32,9 +32,9 @@ type GCPSnapshotter struct { } func (s *GCPSnapshotter) Init(deps *controller.Dependencies, conf map[string]string) error { - s.BaseSnapshotter.Init(deps, conf) + err := s.BaseSnapshotter.Init(deps, conf) s.volRegexp = regexp.MustCompile(`^projects\/[^\/]+\/(zones|regions)\/[^\/]+\/disks\/[^\/]+$`) - return nil + return err } func (s *GCPSnapshotter) GetVolumeID(pv *corev1.PersistentVolume) (string, error) {