Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Handle invalid FS type on mount. #639

Merged
merged 1 commit into from
Oct 24, 2016
Merged

Handle invalid FS type on mount. #639

merged 1 commit into from
Oct 24, 2016

Conversation

govint
Copy link
Contributor

@govint govint commented Oct 20, 2016

Handle invalid FS type returned by a GET call to the plugin server and fail back to using ext2 as FS type in such a case. This handles both any corruption on the server side plus makes a best effort to mount a volume with a default FS type.

@govint
Copy link
Contributor Author

govint commented Oct 20, 2016

Fixes #638

Copy link
Contributor

@pdhamdhere pdhamdhere left a comment

Choose a reason for hiding this comment

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

This is not an issue with new volumes.
How are old volumes mounted with latest code? Can you please test using old volumes with new plugin and update Testing Done in PR?

@@ -82,7 +82,7 @@
# Filesystem type
# This option is handled in the volume-plugin at the docker host, and tracked in volume metadata.
FILESYSTEM_TYPE = 'fstype'
DEFAULT_FILESYSTEM_TYPE = ''
DEFAULT_FILESYSTEM_TYPE = 'ext4'
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't old volumes formatted with ext2?

@govint govint force-pushed the fix-fstype branch 2 times, most recently from f021a86 to 91af52e Compare October 21, 2016 06:01
Copy link
Contributor

@pdhamdhere pdhamdhere left a comment

Choose a reason for hiding this comment

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

I am fine with proposed change. Report an appropriate error. No backward compatibility.

I believe this change will also help if Host is attempting to mount volume created and formatted with filesystem which is not available on current Host.

Minor comment below. Please update and then LGTM.

Forgot to mention that you should update PR description to reflect new behavior.

log.WithFields(
log.Fields{"name": r.Name, "error": "Invalid filesystem type."},
).Error("Failed to mount ")
return volume.Response{Err: "Failed mount - invalid filesystem type."}
Copy link
Contributor

Choose a reason for hiding this comment

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

minor edit: "Failed to mount - Invalid filesystem type"

Copy link
Contributor

@msterin msterin left a comment

Choose a reason for hiding this comment

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

the PR comment says "use ext4 if not known". I do not see it in code - can you elaborate where 'ext4' is pick up from ?

@@ -84,14 +84,18 @@ func getMountPoint(volName string) string {

// Get info about a single volume
func (d *vmdkDriver) Get(r volume.Request) volume.Response {
log.Debug("calling GET ")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this debug should be one layer above, when misc. methods are called.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry this was a debug added to root cause, removed this.

Copy link
Contributor Author

@govint govint Oct 24, 2016

Choose a reason for hiding this comment

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

Removed the code to return a default FS type. The change to add FS type for a volume effectively uses the KV on the server to store meta-data that the client wants persisted. Am changing the client to also fall back to ext2 in case the server sends an invalid response for fstype (empty)

status, err := d.ops.Get(r.Name)
log.Debug("returned GET ")
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto


if !exists {
log.WithFields(
log.Fields{"name": r.Name, "error": "Invalid filesystem type."},
Copy link
Contributor

Choose a reason for hiding this comment

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

can you use a var for message instead of copy-n-paste here and on line 374 ? Also I believe the text ("failed mount - invalid filesystem type" ) should be the same in both cases, and ideally include some hint on what to do next. Though I have no idea what to do next ...

@govint govint changed the title Return default fstype if volume options doesn't have one. Handle invalid FS type on mount. Oct 24, 2016
@govint
Copy link
Contributor Author

govint commented Oct 25, 2016

With old volumes the client plugin just appears hung (no response causing
docker "run" to error, plugin responds to new commands but the volume used
for the mount is left with a refcount thats not going away till the client
is restarted. The behavior is documented in the description for the issue.

Yes, ext2 is the default.

On Fri, Oct 21, 2016 at 6:39 AM, Prashant Dhamdhere <
notifications@github.com> wrote:

@pdhamdhere commented on this pull request.

This is not an issue with new volumes.
How are old volumes mounted with latest code? Can you please test using

old volumes with new plugin and update Testing Done in PR?

In esx_service/volume_kv.py
#639 (review)
:

@@ -82,7 +82,7 @@

Filesystem type

This option is handled in the volume-plugin at the docker host, and tracked in volume metadata.

FILESYSTEM_TYPE = 'fstype'
-DEFAULT_FILESYSTEM_TYPE = ''
+DEFAULT_FILESYSTEM_TYPE = 'ext4'

Aren't old volumes formatted with ext2?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#639 (review),
or mute the thread
https://github.com/notifications/unsubscribe-auth/APHseHSlGQUiDhBZMQgMFH0OO9wPWpE-ks5q2BCugaJpZM4KcERk
.

brunotm added a commit to brunotm/docker-volume-vsphere that referenced this pull request Oct 26, 2016
* master: (25 commits)
  Update new ESX IP
  added forgotten .so file
  Install sqlite3 py libs on ESX and load for Python2
  Added py code and binaries for sqlite3 python libs
  Update drone security
  Removed accidental .pyc files
  Handle byte to string conversions for status command.
  Auth configuration and operation admission check (Auth.liping) (vmware-archive#603)
  Revert "Cli auth.liping"
  Cli auth.liping (vmware-archive#640)
  Handle missing or invalid fs type on mount. (vmware-archive#639)
  Updated Admin CLI commands to support tenants. (vmware-archive#620)
  Workaround older versions of e2fsprogs (vmware-archive#631)
  Add auth proposal
  Made handing of missing metafile less harsh. (vmware-archive#627)
  Fixed ACLs in payload bin dir (vmware-archive#624)
  Fixed error handling for set command. (vmware-archive#610)
  Use new error variables when rolling back volume creation to avoid nil reassignment. (vmware-archive#617)
  Change wording
  Fix broken link
  ...
@msterin msterin deleted the fix-fstype branch October 28, 2016 23:59
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants