Skip to content

Commit

Permalink
Merge pull request #268 from akutz/bugfix/next-device-path
Browse files Browse the repository at this point in the history
NextDevice Fix
  • Loading branch information
akutz authored Sep 14, 2016
2 parents f072fd1 + f4960be commit 030b994
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
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

0 comments on commit 030b994

Please sign in to comment.