k3s/pkg/util
Kubernetes Submit Queue 1ed77078da Merge pull request #43378 from jsafrane/fix-partition-mount
Automatic merge from submit-queue (batch tested with PRs 43378, 43216, 43384, 43083, 43428)

Do not reformat devices with partitions

`lsblk` reports FSTYPE of devices with partition tables as empty string `""`,
which is indistinguishable from empty devices. We must look for dependent
devices (i.e. partitions) to see that the device is really empty and report
error otherwise.

The main point of this patch is to run `lsblk` without `"-n"`, i.e. print all
dependent devices and check it output.

Sample output:
```
  FirstSeen     LastSeen        Count   From                                    SubObjectPath   Type            Reason          Message
  ---------     --------        -----   ----                                    -------------   --------        ------          -------
  10s           10s             1       default-scheduler                                       Normal          Scheduled       Successfully assigned testpod to ip-172-18-11-149.ec2.internal
  2s            2s              1       kubelet, ip-172-18-11-149.ec2.internal                  Warning         FailedMount     MountVolume.MountDevice failed for volume "kubernetes.io/aws-ebs/vol-0fa9da8b91913b187" (spec.Name: "vol") pod "b74f68c5-0d6a-11e7-9233-0e11251010c0" (UID: "b74f68c5-0d6a-11e7-9233-0e11251010c0") with: failed to mount the volume as "ext4", it already contains unknown data, probably partitions. Mount error: mount failed: exit status 32
Mounting command: mount
Mounting arguments: /dev/xvdbb /var/lib/kubelet/plugins/kubernetes.io/aws-ebs/mounts/vol-0fa9da8b91913b187 ext4 [defaults]
Output: mount: wrong fs type, bad option, bad superblock on /dev/xvdbb,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

```

Without this patch, the device would be reformatted and all data in the device partitions would be lost.

Fixes #13212

Release note:
```release-note
NONE
```

@kubernetes/sig-storage-pr-reviews
2017-03-25 21:22:22 -07:00
..
async
bandwidth teach kubenet to use annotation instead of pod object for traffic shaper 2017-02-27 10:11:09 -08:00
chmod
chown
config Update generated files 2017-01-24 20:56:03 +01:00
configz
crlf
dbus
ebtables
env
errors add back just enough empty packages to allow heapster cycles to succeed 2017-01-17 08:07:30 -05:00
exec Add support for attacher/detacher interface in Flex volume 2017-02-24 20:18:06 -05:00
flock pkg/util/flock: Fix the flock so it actually locks. 2017-03-13 14:24:59 -07:00
framer add back just enough empty packages to allow heapster cycles to succeed 2017-01-17 08:07:30 -05:00
goroutinemap OWNERS: Update latest OWNERS files 2017-01-23 10:05:48 -08:00
hash
i18n Update extraction script, sort messages, add .pot file. 2017-02-23 18:53:00 +00:00
initsystem
interrupt
intstr move util/intstr to apimachinery 2017-01-30 12:46:59 -05:00
io Update generated files 2017-01-29 21:41:45 +01:00
ipconfig Fix DNS suffix search list issue for Windows container and workaround in kube-proxy. 2017-02-27 19:25:46 -08:00
iptables pkg/util/iptables missing unit tests 2017-01-20 10:50:45 +01:00
json add back just enough empty packages to allow heapster cycles to succeed 2017-01-17 08:07:30 -05:00
keymutex
labels Create meta/internalversion for ListOptions 2017-01-23 16:53:18 -05:00
limitwriter
logs start the apimachinery repo 2017-01-11 09:09:48 -05:00
maps
metrics move authoritative client-go utils out of pkg 2017-01-24 08:59:18 -05:00
mount Do not reformat devices with partitions 2017-03-20 13:08:13 +01:00
net add back just enough empty packages to allow heapster cycles to succeed 2017-01-17 08:07:30 -05:00
netsh cleanup proxier 2017-02-27 16:00:49 -08:00
node Update generated files 2017-01-25 19:49:45 +01:00
oom
parsers
procfs Fix regex match doc of procfs.PidOf 2017-02-13 23:10:14 +08:00
rand move pkg/util/rand 2017-01-16 16:04:03 -05:00
removeall Make kubelet never delete files on mounted filesystems 2017-02-28 14:32:07 +01:00
resourcecontainer
rlimit
runtime add back just enough empty packages to allow heapster cycles to succeed 2017-01-17 08:07:30 -05:00
selinux
sets add back just enough empty packages to allow heapster cycles to succeed 2017-01-17 08:07:30 -05:00
slice move pkg/util/rand 2017-01-16 16:04:03 -05:00
strings
sysctl
system refactor: use metav1.ObjectMeta in other types 2017-01-17 16:17:19 -05:00
tail Limit the size of the termination log and allow log input 2017-01-23 12:26:38 -05:00
taints make kubectl respect taint effect NoExecute 2017-02-26 22:41:57 +08:00
term start the apimachinery repo 2017-01-11 09:09:48 -05:00
threading
uuid Update generated files 2017-01-25 19:49:45 +01:00
validation add back just enough empty packages to allow heapster cycles to succeed 2017-01-17 08:07:30 -05:00
version
wait add back just enough empty packages to allow heapster cycles to succeed 2017-01-17 08:07:30 -05:00
workqueue/prometheus move workqueue to client-go 2017-01-30 09:08:21 -05:00
yaml add back just enough empty packages to allow heapster cycles to succeed 2017-01-17 08:07:30 -05:00
BUILD Merge pull request #37698 from jsafrane/remove-all-filesystems 2017-03-24 12:33:27 -07:00
doc.go
template.go
template_test.go
umask.go
umask_windows.go delete ErrorTimeout() function and modify Umask() args 2017-01-12 11:05:30 +08:00
util.go
util_test.go pkg/util: move CompileRegex helper into apiserver 2017-01-25 17:21:12 +01:00