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

Executor Supported Enhancements #399

Merged
merged 1 commit into from
Jan 26, 2017

Conversation

akutz
Copy link
Collaborator

@akutz akutz commented Jan 25, 2017

This patch enhances the executor CLI to change the behavior of the "supported" function. Internally, storage platforms will still implement the same "Supported" function as previously, but now the executor CLI returns more than simply a flag. The executor CLI will now return a bitmask that corresponds to the functions supported by a storage platform on the executing host. This provides a means to indicate whether an executor supports mounting/unmounting for a given storage platform. The update also centralizes the query for future additions to the executor logic.

This patch also introduces the interface StorageExecutorWithMount with two new functions, Mount and Unmount, but these functions are not yet a part of the storage workflow.

This is a WiP. I will likely squash a future commit onto this PR that allows the new mount functionality in the executor to participate in the standard workflow. I just pushed the PR in order to allow others to review the work so far.

@akutz akutz requested a review from codenrhoden January 25, 2017 19:27
@akutz akutz force-pushed the feature/executor-supported branch 2 times, most recently from 79cae1f to 94a7b4f Compare January 25, 2017 19:38
Copy link
Contributor

@codenrhoden codenrhoden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good to me! I like the changes.

@@ -150,6 +150,24 @@ type StorageExecutorWithSupported interface {
opts Store) (bool, error)
}

// StorageExecutorWithMount is an interface that executor implementations may
// may use to become part of the mount/unmount workflow.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double "may"

} else {
result = opResult
result = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to see this as LSXSOpNone, even though they are same value.

}

out, err := c.runExecutor(ctx, driverName, types.LSXCmdSupported)
if err != nil {
if err == types.ErrNotImplemented {
ctx.WithField("serviceDriver", driverName).Warn(
"supported cmd not implemented")
c.supportedCache.Set(driverName, true)
c.supportedCache.Set(driverName, types.LSXOpAllNoMount)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize that this code here isn't new, just modified, but I'm surprised it's hear. I thought the containing function here was only called if we had already done a type assertion that the executor implemented the interface that includes the Supported() method. As such, I would consider it an actual error if it's defined in the executor, but returns a Not Implemented error. I think this is probably here for backwards compatibility, but is that an issue at this point?

I guess I'm really wondering if it is safe to assume that if Supported is not implemented, we say this is LSXOpAllNomount, and I believe the answer to that is yes, since that's what we require from a minimal Executor. Which probably means this whole comment is moot. :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @codenrhoden,

Pretty much :) It's back-compat. The only reason I'm still including it is the outstanding driver PRs there are. I don't know if they've all implemented Supported or not. I had originally used this PR to move the Supported function to the core type, but as I said, outstanding drivers made me think twice.

@akutz akutz force-pushed the feature/executor-supported branch 5 times, most recently from e775648 to 5dbde3e Compare January 25, 2017 22:41
Copy link
Contributor

@codenrhoden codenrhoden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! One question on an unused interface, and that's it.

@@ -159,7 +182,8 @@ type ProvidesStorageExecutorCLI interface {
// StorageExecutorCLI provides a way to interact with the CLI tool built with
// the driver implementations of the StorageExecutor interface.
type StorageExecutorCLI interface {
StorageExecutorWithSupported
StorageExecutorFunctions
StorageExecutorWithMount
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the StorageExecutorWithSupported interface is still defined, but not referenced. And it now has the wrong return type of bool instead of LSXSupportedOp for the Supported function. Does it need to stick around, deleted, or updated?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed on the phone, there are two interfaces:

  1. StorageExecutorWithSupported
  2. StorageExecutorCLI

The former is for the platform implementations of the executor and the latter is for the executor CLI itself. They're both required and correct.

@codecov-io
Copy link

Current coverage is 30.53% (diff: 0.00%)

No coverage report found for master at a1103d3.

Powered by Codecov. Last update a1103d3...5dbde3e

This patch enhances the executor CLI to change the behavior of the
"supported" function. Internally, storage platforms will still implement
the same "Supported" function as previously, but now the executor CLI
returns more than simply a flag. The executor CLI will now return a
bitmask that corresponds to the functions supported by a storage
platform on the executing host. This provides a means to indicate
whether an executor supports mounting/unmounting for a given storage
platform. The update also centralizes the query for future additions to
the executor logic.

This patch also introduces the interface StorageExecutorWithMount with
two new functions, Mount and Unmount, but these functions are not yet a
part of the storage workflow.
@akutz akutz force-pushed the feature/executor-supported branch from 5dbde3e to 0886969 Compare January 26, 2017 00:32
@akutz akutz changed the title WiP - Executor Supported Enhancements Executor Supported Enhancements Jan 26, 2017
@akutz akutz self-assigned this Jan 26, 2017
@akutz akutz added this to the 0.5.0 milestone Jan 26, 2017
@akutz akutz merged commit e81e3be into thecodeteam:master Jan 26, 2017
@akutz akutz deleted the feature/executor-supported branch January 26, 2017 00:37
@akutz akutz removed the in progress label Jan 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants