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

isilon: add Supported() to executor #297

Merged

Conversation

codenrhoden
Copy link
Contributor

Isilon clients NFS mount the volumes, so make sure that mount.nfs
is present.

FWIW, I was hesitant to implement this way, as it is Linux specific. At first I was just going to check if /usr/sbin/mount.nfs existed, but that could be distro specific. But the executor already parses files in /proc, which binds it to Linux. So I'm not adding any new restrictions.

Also, it seemed possible that a client could by using NFSv4, and if they were they would need mount.nfs4, but the Linux driver actually doesn't use mount -t nfs or mount -t nfs4, it just calls mount, and can't be overriden, so this is also not a current issue. It merely relies on the presence of a : in the device to infer it is NFS.

This was inspired by #296

@codecov-io
Copy link

codecov-io commented Oct 12, 2016

Current coverage is 25.01% (diff: 0.00%)

Merging #297 into master will decrease coverage by 0.01%

@@             master       #297   diff @@
==========================================
  Files            46         46          
  Lines          2708       2710     +2   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits            678        678          
- Misses         1960       1962     +2   
  Partials         70         70          

Powered by Codecov. Last update 08af1c0...6929b0c

// resides.
func Supported(ctx types.Context, opts types.Store) (bool, error) {
// make sure mount.nfs is present
if err := exec.Command(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This assumes that both the which and mount.nfs commands are in the PATH variable as provided to the executor. Is there perhaps a cleaner way to do this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is definitely assuming that. My (flawed?) reasoning for why this is okay is that libstorage is already making such assumptions for NFS: https://github.com/emccode/libstorage/blob/master/drivers/os/linux/linux.go#L185

Another tactic would be to survey our supported OS's, and see where the binary would be located on each of them, and then just stat for the file in all of the locations, returning true if any of them were successful.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Your logic works for me :) You could also use this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, nice! LookPath() is very convenient. It's which in Go. :)

I'm happy to change it. Do you prefer me to use LookPath() directly, or to import gotil ?

Copy link
Collaborator

@akutz akutz Oct 12, 2016

Choose a reason for hiding this comment

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

Feel free to use LookPath() directly. I only abstract it in order to ignore the error and make the code a tad cleaner, but no reason for you to import this here just for this. However, if you build the transitive dependency graph for the executor binary you'll see it's already imported for another dependency on which the executor relies, so why not I suppose? Your call.

Isilon clients NFS mount the volumes, so make sure that mount.nfs
is present.
@akutz akutz self-assigned this Oct 14, 2016
@akutz akutz changed the base branch from master to release/0.3.0 October 14, 2016 19:29
@akutz akutz merged commit 6929b0c into thecodeteam:release/0.3.0 Oct 14, 2016
@akutz akutz removed the in progress label Oct 14, 2016
@codenrhoden codenrhoden deleted the feature/isilon_exec_supported branch December 9, 2016 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants