Skip to content

Commit 2db6b9e

Browse files
committed
fix lint and test
1 parent e43efce commit 2db6b9e

File tree

6 files changed

+8
-20
lines changed

6 files changed

+8
-20
lines changed

pkg/cloud/cloud.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type Interface interface {
2424
DetachVolume(ctx context.Context, volumeID string) error
2525
ExpandVolume(ctx context.Context, volumeID string, newSizeInGB int64) error
2626

27-
CreateVolumeFromSnapshot(ctx context.Context, zoneID, name, domainID, projectID, snapshotID string, sizeInGB int64) (*Volume, error)
27+
CreateVolumeFromSnapshot(ctx context.Context, zoneID, name, projectID, snapshotID string, sizeInGB int64) (*Volume, error)
2828
GetSnapshotByID(ctx context.Context, snapshotID string) (*Snapshot, error)
2929
GetSnapshotByName(ctx context.Context, name string) (*Snapshot, error)
3030
CreateSnapshot(ctx context.Context, volumeID string) (*Snapshot, error)

pkg/cloud/fake/fake.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
)
1414

1515
const zoneID = "a1887604-237c-4212-a9cd-94620b7880fa"
16-
const snapshotID = "9d076136-657b-4c84-b279-455da3ea484c"
1716

1817
type fakeConnector struct {
1918
node *cloud.VM
@@ -150,7 +149,7 @@ func (f *fakeConnector) ExpandVolume(_ context.Context, volumeID string, newSize
150149
return cloud.ErrNotFound
151150
}
152151

153-
func (f *fakeConnector) CreateVolumeFromSnapshot(ctx context.Context, zoneID, name, domainID, projectID, snapshotID string, sizeInGB int64) (*cloud.Volume, error) {
152+
func (f *fakeConnector) CreateVolumeFromSnapshot(ctx context.Context, zoneID, name, projectID, snapshotID string, sizeInGB int64) (*cloud.Volume, error) {
154153
vol := &cloud.Volume{
155154
ID: "fake-vol-from-snap-" + name,
156155
Name: name,
@@ -163,15 +162,15 @@ func (f *fakeConnector) CreateVolumeFromSnapshot(ctx context.Context, zoneID, na
163162
return vol, nil
164163
}
165164

166-
func (f *fakeConnector) GetSnapshotByID(ctx context.Context, snapshotID string) (*cloud.Snapshot, error) {
165+
func (f *fakeConnector) GetSnapshotByID(_ context.Context, snapshotID string) (*cloud.Snapshot, error) {
167166
return f.snapshot, nil
168167
}
169168

170-
func (f *fakeConnector) CreateSnapshot(ctx context.Context, volumeID string) (*cloud.Snapshot, error) {
169+
func (f *fakeConnector) CreateSnapshot(_ context.Context, volumeID string) (*cloud.Snapshot, error) {
171170
return f.snapshot, nil
172171
}
173172

174-
func (f *fakeConnector) DeleteSnapshot(ctx context.Context, snapshotID string) error {
173+
func (f *fakeConnector) DeleteSnapshot(_ context.Context, snapshotID string) error {
175174
return nil
176175
}
177176

pkg/cloud/snapshots.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func (c *client) CreateSnapshot(ctx context.Context, volumeID string) (*Snapshot
7171
return &snap, nil
7272
}
7373

74-
func (c *client) DeleteSnapshot(ctx context.Context, snapshotID string) error {
74+
func (c *client) DeleteSnapshot(_ context.Context, snapshotID string) error {
7575
p := c.Snapshot.NewDeleteSnapshotParams(snapshotID)
7676
_, err := c.Snapshot.DeleteSnapshot(p)
7777
if err != nil && strings.Contains(err.Error(), "4350") {

pkg/cloud/volumes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func (c *client) ExpandVolume(ctx context.Context, volumeID string, newSizeInGB
164164
return nil
165165
}
166166

167-
func (c *client) CreateVolumeFromSnapshot(ctx context.Context, zoneID, name, domainID, projectID, snapshotID string, sizeInGB int64) (*Volume, error) {
167+
func (c *client) CreateVolumeFromSnapshot(ctx context.Context, zoneID, name, projectID, snapshotID string, sizeInGB int64) (*Volume, error) {
168168
logger := klog.FromContext(ctx)
169169

170170
p := c.Volume.NewCreateVolumeParams()

pkg/driver/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
148148
sizeInGB = snapshotSizeGiB
149149
}
150150

151-
volFromSnapshot, err := cs.connector.CreateVolumeFromSnapshot(ctx, snapshot.ZoneID, name, snapshot.DomainID, snapshot.ProjectID, snapshotID, sizeInGB)
151+
volFromSnapshot, err := cs.connector.CreateVolumeFromSnapshot(ctx, snapshot.ZoneID, name, snapshot.ProjectID, snapshotID, sizeInGB)
152152
if err != nil {
153153
return nil, status.Errorf(codes.Internal, "Cannot create volume from snapshot %s: %v", snapshotID, err.Error())
154154
}

pkg/mount/mount.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -231,17 +231,6 @@ func (m *mounter) isDeviceMounted(devicePath string) (bool, error) {
231231
return len(output) > 0, nil
232232
}
233233

234-
func (m *mounter) isDeviceInUse(devicePath string) (bool, error) {
235-
output, err := m.Exec.Command("lsof", devicePath).Output()
236-
if err != nil {
237-
if strings.Contains(err.Error(), "exit status 1") {
238-
return false, nil
239-
}
240-
return false, err
241-
}
242-
return len(output) > 0, nil
243-
}
244-
245234
func (m *mounter) getDeviceProperties(devicePath string) (map[string]string, error) {
246235
output, err := m.Exec.Command("udevadm", "info", "--query=property", devicePath).Output()
247236
if err != nil {

0 commit comments

Comments
 (0)