From 1761aa75b8ff2e21261b8d3fb456561ccdb517bc Mon Sep 17 00:00:00 2001 From: Drew Sirenko <68304519+AndrewSirenko@users.noreply.github.com> Date: Fri, 16 Feb 2024 21:22:57 +0000 Subject: [PATCH] Remove unused 'IsExistInstance' --- pkg/cloud/cloud.go | 8 -------- pkg/cloud/cloud_interface.go | 1 - pkg/cloud/mock_cloud.go | 14 -------------- 3 files changed, 23 deletions(-) diff --git a/pkg/cloud/cloud.go b/pkg/cloud/cloud.go index 751cb78a18..19cb98d901 100644 --- a/pkg/cloud/cloud.go +++ b/pkg/cloud/cloud.go @@ -963,14 +963,6 @@ func (c *cloud) GetDiskByID(ctx context.Context, volumeID string) (*Disk, error) }, nil } -func (c *cloud) IsExistInstance(ctx context.Context, nodeID string) bool { - instance, err := c.getInstance(ctx, nodeID) - if err != nil || instance == nil { - return false - } - return true -} - func (c *cloud) CreateSnapshot(ctx context.Context, volumeID string, snapshotOptions *SnapshotOptions) (snapshot *Snapshot, err error) { descriptions := "Created by AWS EBS CSI driver for volume " + volumeID diff --git a/pkg/cloud/cloud_interface.go b/pkg/cloud/cloud_interface.go index fad846d086..9a7f199f4f 100644 --- a/pkg/cloud/cloud_interface.go +++ b/pkg/cloud/cloud_interface.go @@ -15,7 +15,6 @@ type Cloud interface { WaitForAttachmentState(ctx context.Context, volumeID, expectedState string, expectedInstance string, expectedDevice string, alreadyAssigned bool) (*ec2.VolumeAttachment, error) GetDiskByName(ctx context.Context, name string, capacityBytes int64) (disk *Disk, err error) GetDiskByID(ctx context.Context, volumeID string) (disk *Disk, err error) - IsExistInstance(ctx context.Context, nodeID string) (success bool) CreateSnapshot(ctx context.Context, volumeID string, snapshotOptions *SnapshotOptions) (snapshot *Snapshot, err error) DeleteSnapshot(ctx context.Context, snapshotID string) (success bool, err error) GetSnapshotByName(ctx context.Context, name string) (snapshot *Snapshot, err error) diff --git a/pkg/cloud/mock_cloud.go b/pkg/cloud/mock_cloud.go index 0f88ec04a4..b35f9ad10f 100644 --- a/pkg/cloud/mock_cloud.go +++ b/pkg/cloud/mock_cloud.go @@ -214,20 +214,6 @@ func (mr *MockCloudMockRecorder) GetSnapshotByName(ctx, name interface{}) *gomoc return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSnapshotByName", reflect.TypeOf((*MockCloud)(nil).GetSnapshotByName), ctx, name) } -// IsExistInstance mocks base method. -func (m *MockCloud) IsExistInstance(ctx context.Context, nodeID string) bool { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsExistInstance", ctx, nodeID) - ret0, _ := ret[0].(bool) - return ret0 -} - -// IsExistInstance indicates an expected call of IsExistInstance. -func (mr *MockCloudMockRecorder) IsExistInstance(ctx, nodeID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsExistInstance", reflect.TypeOf((*MockCloud)(nil).IsExistInstance), ctx, nodeID) -} - // ListSnapshots mocks base method. func (m *MockCloud) ListSnapshots(ctx context.Context, volumeID string, maxResults int64, nextToken string) (*ListSnapshotsResponse, error) { m.ctrl.T.Helper()