Commit Graph

142 Commits (56dc8f9a6ab09debeddf5349ee26730d3e9107f8)

Author SHA1 Message Date
Jan Safranek be2ca8dec3 Add path to log messages.
It is useful to see the path that failed to mount in the log messages.
2016-04-08 09:41:09 +02:00
Jan Safranek 92f181174b Fixed mounting with containerized kubelet.
Kubelet was not able to mount volumes when running inside a container and
using nsenter mounter,

NsenterMounter.IsLikelyNotMountPoint() should return ErrNotExist when the
checked directory does not exists as the regular mounted does this and
some volume plugins depend on this behavior.
2016-03-24 17:27:11 +01:00
Filip Grzadkowski 217d9f38e7 Don't return error when findmnt exits with error.
Fixes #21303
2016-02-19 14:09:33 +01:00
laushinka 7ef585be22 Spelling fixes inspired by github.com/client9/misspell 2016-02-18 06:58:05 +07:00
Jan Safranek 220163f67d Fixed races in Cinder volume attach/detach.
Add a mutex to guard SetUpAt() and TearDownAt() calls - they should not
run in parallel.  There is a race in these calls when there are two pods
using the same volume, one of them is dying and the other one starting.

TearDownAt() checks that a volume is not needed by any pods and detaches the
volume. It does so by counting how many times is the volume mounted
(GetMountRefs() call below).

When SetUpAt() of the starting pod already attached the volume and did not mount
it yet, TearDownAt() of the dying pod will detach it - GetMountRefs() does not
count with this volume.

These two threads run in parallel:

 dying pod.TearDownAt("myVolume")          starting pod.SetUpAt("myVolume")
   |                                       |
   |                                       AttachDisk("myVolume")
   refs, err := mount.GetMountRefs()       |
   Unmount("myDir")                        |
   if refs == 1 {                          |
   |  |                                    Mount("myVolume", "myDir")
   |  |                                    |
   |  DetachDisk("myVolume")               |
   |                                       start containers - OOPS! The volume is detached!
   |
   finish the pod cleanup


Also, add some logs to cinder plugin for easier debugging in the future, add
a test and update the fake mounter to know about bind mounts.
2016-02-02 14:38:49 +01:00
Mike Danese 82509a46a7 Merge pull request #19585 from smarterclayton/skip_mount
Skip format and mount test on windows or mac
2016-01-14 17:03:44 -08:00
Clayton Coleman 389d5e48cb Skip format and mount test on windows or mac 2016-01-12 21:43:50 -05:00
Sami Wagiaalla c18f342ac6 Use constants for fsck return values 2015-12-08 10:51:12 -05:00
Sami Wagiaalla 10688f1a11 Run fsck before formatting disk
Signed-off-by: Sami Wagiaalla <swagiaal@redhat.com>
2015-12-08 10:50:30 -05:00
k8s-merge-robot 9e896e3416 Merge pull request #16948 from swagiaal/move-formatAndMount
Auto commit by PR queue bot
2015-12-04 10:37:33 -08:00
k8s-merge-robot 13b0fd3cda Merge pull request #16942 from swagiaal/distinguish-format-and-mount
Auto commit by PR queue bot
2015-12-03 10:51:26 -08:00
Sami Wagiaalla 66c905d63e Distinguish normal mount from format and mount in SafeFormatAndMount 2015-12-02 11:16:00 -05:00
Brendan Burns ce90b83689 Update some flags 2015-11-20 11:47:31 -08:00
Sami Wagiaalla 1880c4eedb move formatAndMount and diskLooksUnformatted to mount_linux 2015-11-06 15:37:46 -05:00
Huamin Chen a31d23ea0e don't use ext4 mkfs options for other fs
Signed-off-by: Huamin Chen <hchen@redhat.com>
2015-10-30 11:53:10 -04:00
Huamin Chen 3b14135cad mount returns more verbose message upon error
Signed-off-by: Huamin Chen <hchen@redhat.com>
2015-10-21 11:52:02 -04:00
Sami Wagiaalla 3e9587997f Correct comments in mount.go
Signed-off-by: Sami Wagiaalla <swagiaal@redhat.com>
2015-09-23 11:40:17 -04:00
Michael Schmidt 57f89da69a Fix to detect unformatted volumes in CoreOS
The `file` command used here to check whether a device is formatted is not
available for CoreOS. The effect is that the mounter tries to mount an
unformatted volume which fails. This makes it quite tedious to use persistent
volumes in CoreOS.

This patch replaces the `file` command with `lsblk` which is available in
CoreOS. I checked that it's also available on RHEL, Debian, Ubuntu and SLES.
2015-09-17 15:25:23 +02:00
Filip Grzadkowski 1a9b0d6018 Fix mounting volumes in docker based kubernetes setup. 2015-09-01 16:42:23 +02:00
Sami Wagiaalla ab0258f259 Support formatting and mounting GCE PD without 'safe_format_and_mount'
The GCE PD plugin uses safe_format_and_mount found on standard GCE images:

https://github.com/GoogleCloudPlatform/compute-image-packages/blob/master/google-startup-scripts/usr/share/google/safe_format_and_mount

On custom images where this is not available pods fail to format and
mount GCE PDs. This patch uses linux utilities in a similar way to the
safe_format_and_mount script to format and mount the GCE PD and AWS EBC
devices. That is first attempt a mount. If mount fails try to use file to
investigate the device. If 'file' fails to get any information about
the device and simply returns "data" then assume the device is not
formatted and format it and attempt to mount it again.

Signed-off-by: Sami Wagiaalla <swagiaal@redhat.com>
2015-08-26 11:53:40 -04:00
Eric Paris f125ad88ce Rename IsMountPoint to IsLikelyNotMountPoint
IsLikelyNotMountPoint determines if a directory is not a mountpoint.
It is fast but not necessarily ALWAYS correct. If the path is in fact
a bind mount from one part of a mount to another it will not be detected.
mkdir /tmp/a /tmp/b; mount --bin /tmp/a /tmp/b; IsLikelyNotMountPoint("/tmp/b")
will return true. When in fact /tmp/b is a mount point. So this patch
renames the function and switches it from a positive to a negative (I
could think of a good positive name). This should make future users of
this function aware that it isn't quite perfect, but probably good
enough.
2015-08-14 18:45:43 -04:00
Mike Danese 17defc7383 run gofmt on everything we touched 2015-08-05 17:52:56 -07:00
Mike Danese 8e33cbfa28 rewrite go imports 2015-08-05 17:30:03 -07:00
Clayton Coleman 93b14b9ede Search the parent FS for the proper binaries 2015-06-26 14:48:22 -04:00
Clayton Coleman fa7000a5bc Use nsenter on PATH in container, and separate args
nsenter needs '--' to separate calls
2015-06-26 14:28:08 -04:00
markturansky 450002a52e Fixed formatting of error message 2015-06-19 11:21:57 -04:00
Justin Santa Barbara c4a2631593 Mount logic breaks if /var/lib/kubelet is a symlink
Pass the correct kubelet root-dir on AWS
2015-05-29 20:13:09 -04:00
Justin Santa Barbara 9839253233 Add logging to volume tear-down to help understand mount behaviour 2015-05-29 20:11:13 -04:00
Paul Morie feb0880b1e Add tests for secret volume plugin reboot/idempotency 2015-05-25 13:34:07 -04:00
Paul Morie 14243d3bd6 Fix typo in nsenter_mount.go 2015-05-11 11:41:01 -04:00
Paul Morie 553265ce0c Add containerized option to kubelet binary 2015-05-05 13:10:06 -04:00
Paul Morie e5521234e4 Add NsenterMounter mount implementation 2015-05-04 14:40:04 -04:00
Eric Paris 6b3a6e6b98 Make copyright ownership statement generic
Instead of saying "Google Inc." (which is not always correct) say "The
Kubernetes Authors", which is generic.
2015-05-01 17:49:56 -04:00
Deyuan Deng 6897095e56 Change mount.Interface.Mount to exec('mount'), instead of syscall 2015-04-29 10:46:32 -04:00
Huamin Chen 7a82af31de add iscsi volume plugin
Signed-off-by: Huamin Chen <hchen@redhat.com>
2015-04-06 16:20:28 -04:00
Deyuan Deng d62afa85ff Abstract ismountpoint and use platform mounter for NFS volume 2015-04-01 23:05:02 -04:00
Tim Hockin 50c96789e7 Add an action log to FakeMounter.
# *** ERROR: *** docs are out of sync between cli and markdown
# run hack/run-gendocs.sh > docs/kubectl.md to regenerate

#
# Your commit will be aborted unless you regenerate docs.
    COMMIT_BLOCKED_ON_GENDOCS
2015-03-13 13:33:50 -07:00
Paul Morie 17b51a93a3 Fix mount refactor nits 2015-03-06 11:46:07 -05:00
Paul Morie 8ef04a8425 Factor mount utility code out gce_pd volume plugin 2015-03-05 13:49:32 -05:00
Brendan Burns ab0acae7d3 fix build on non-linux hosts. 2015-02-03 08:13:09 -08:00
Brendan Burns ac21ac24fa Add a mounter that uses google's safe_format_and_mount. 2015-02-02 16:16:20 -08:00
Tim Hockin fc69379b8c Add a util/mount pkg 2014-12-30 14:38:49 -08:00