-
Notifications
You must be signed in to change notification settings - Fork 50
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
S3FS Fuse Driver Support #409
Conversation
9e307ec
to
65f29af
Compare
Codecov Report@@ Coverage Diff @@
## master #409 +/- ##
==========================================
+ Coverage 30.47% 30.49% +0.02%
==========================================
Files 29 29
Lines 1739 1741 +2
==========================================
+ Hits 530 531 +1
- Misses 1151 1152 +1
Partials 58 58
Continue to review full report at Codecov.
|
for _, o := range d.opts { | ||
args = append(args, fmt.Sprintf("-o%s", o)) | ||
} | ||
} else if d.szOpts != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused by the difference between opts
and szOpts
. I mean, I can see that the former is a string, and the latter is a slice of strings, but why are the two necessary? The docs say that options
is supposed to be a list of options, and that -o
should not be included in the config value. So shouldn't only one of these be necessary?
Perhaps I'm not familiar with gofig
, but I don't know why, in the Init
function, both GetString
and GetStringSlice
must be used. But if they do have to be used, would it be possible to just have one "opts" field in the driver stuct, as a string slice, and put in the single entry rather than having two different opts fields?
What does "sz" in szOpts
mean here, Size? that's how I read it. But I also don't get why the -o
isn't required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @codenrhoden,
So, szOpts
stands for string of characters terminated by null character ... Opts. The sz
prefix is often found in use by C or C++ programmers to denote a null-terminated string. I will sometimes use it to indicate a variable is a string if there is a similarly named variable of a different type.
The properties in the config file don't really have types per se. It's more how they're interpreted upon being consumed. Thus while it's cleaner to specify the options as an array of arg=value
or flag
items, maybe I also want to read it as a string? The above code first attempts to parse the s3fs.options
value as an array of strings. If it isn't it reads it as a string. That way a user can determine how to put in the options.
"", | ||
DefaultMaxRetries, | ||
"Max number of times to retry failed operations", | ||
ConfigS3FSMaxRetries) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hostname, tag, and maxretries options are not mentioned in the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @codenrhoden,
They're really developer options for overriding the instance ID value and for debugging.
|
||
// Type returns the type of storage the driver provides. | ||
func (d *driver) Type(ctx types.Context) (types.StorageType, error) { | ||
return types.Object, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this true? Even though the backing storage is object, you end up with a file system, so I would think the type is File
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @codenrhoden,
This value refers to the backing storage type.
|
||
// VolumeAttach attaches a volume and provides a token clients can use | ||
// to validate that device has appeared locally. | ||
func (d *driver) VolumeAttach( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a comment that for s3fs, the attach is not performed server-side, but is left to the executor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @codenrhoden,
The client performs a mount, not an attach.
DeviceName: bucket, | ||
} | ||
if iid, iidOK := context.InstanceID(ctx); iidOK { | ||
vatt.InstanceID = iid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know things were weird with this driver, but isn't this going to list every single bucket as attached to the instance if a client provides the IID header?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @codenrhoden,
Ah, you're right. I should make it so all volumes are available if the instance ID is not provided. Thanks.
if config == nil { | ||
hostName = config.GetString(s3fs.ConfigS3FSHostName) | ||
} else { | ||
hostName, _ = os.Hostname() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wasn't until I looked at this code that it dawned on me that this driver is useful outside of AWS. Of course it is, but I just hadn't thought about it. Might be something worth pointing out in the docs, because it is really useful?
Would there be any merit it trying to make sure there is a more uniqueness to the IID, by appending a MAC address or anything? Probably not, but I think once you jump out of the cloud provider, you are much more likely to run into hostname collisions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HI @codenrhoden,
Yes, the S3FS driver is not at all required to be used on EC2 instances. I'll add that to the documentation if you think it is important to call it out. I figured anyone wanting to use S3 would understand that, but there's no harm in calling it out.
The hostname and instance ID are not used by the storage driver except for logging. Even there it could be useful for them to be unique I suppose.
HI @codenrhoden, I'm going to call you to discuss many of your comments due to the unique nature of this driver. |
5f164c7
to
017bc7f
Compare
4e0932a
to
3c24fe3
Compare
14baad8
to
eaac7a5
Compare
This patch introduces support for mounting S3FS buckets as Linux file systems. This initial version of the S3FS storage driver does not yet support volume (bucket) creation/removal. This patch also updates the AWS SDK dependency that is shared by the EBS and EFS storage drivers to v1.6.18, released on 2017/01/27. This patch now includes support for force deleting a non-empty bucket. All of the bucket's objects and their versions will be removed if VolumeRemove is invoked with a truthy force value.
This patch introduces support for mounting S3FS buckets as Linux file systems. This initial version of the S3FS storage driver does not yet support volume (bucket) creation/removal.
This patch also updates the AWS SDK dependency that is shared by the EBS and EFS storage drivers to v1.6.18, released on 2017/01/27.
Finally, this patch also refactors the
VolumeRemove
, and its related signatures, to use the newVolumeRemoveOpts
struct instead of a bareOptions
type. All drivers affected by this change have been updated as part of this patch. For people compiling REX-Ray against this branch, you will need the following patch in order to do so. The linked patch updates REX-Ray's two sources affected by this change to libStorage.This PR replaces the existing S3FS PR #397. Thank you @Andrey-mp and @alexey-mr for your work on this, we could not have done this without you.