Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NextDevice Fix #268

Merged
merged 1 commit into from
Sep 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/lsx/lsx.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func Run() {
} else if cmd == "nextdevice" {
op = "next device"
opResult, opErr := d.NextDevice(ctx, store)
if opErr != nil {
if opErr != nil && opErr != apitypes.ErrNotImplemented {
err = opErr
} else {
result = opResult
Expand Down
12 changes: 11 additions & 1 deletion drivers/storage/libstorage/libstorage_driver_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,18 @@ func (d *driver) VolumeAttach(
return nil, "", goof.New("missing service name")
}

nextDevice, err := d.NextDevice(ctx, utils.NewStore())
if err != nil {
return nil, "", err
}

var nextDevicePtr *string
if nextDevice != "" {
nextDevicePtr = &nextDevice
}

req := &types.VolumeAttachRequest{
NextDeviceName: opts.NextDevice,
NextDeviceName: nextDevicePtr,
Force: opts.Force,
Opts: opts.Opts.Map(),
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/storage/scaleio/executor/scaleio_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (d *driver) Name() string {
func (d *driver) NextDevice(
ctx types.Context,
opts types.Store) (string, error) {
return "", nil
return "", types.ErrNotImplemented
}

// LocalDevices returns a map of the system's local devices.
Expand Down
2 changes: 1 addition & 1 deletion drivers/storage/vfs/storage/vfs_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ func (d *driver) VolumeAttach(

vol.Attachments = []*types.VolumeAttachment{att}

return vol, "1234", nil
return vol, nextDevice, nil
}

func (d *driver) VolumeDetach(
Expand Down
2 changes: 1 addition & 1 deletion drivers/storage/vfs/tests/vfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ func TestVolumeAttach(t *testing.T) {
if reply == nil {
t.FailNow()
}
assert.Equal(t, "1234", attTokn)
assert.Equal(t, "/dev/xvdc", attTokn)
assert.Equal(t, "vfs-002", reply.ID)
assert.Equal(t, "/dev/xvdc", reply.Attachments[0].DeviceName)

Expand Down