Files
kubernetes/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
..
2017-01-24 20:56:03 +01:00
2017-01-05 14:14:13 -08:00
2017-01-05 14:14:13 -08:00
2017-01-05 14:14:13 -08:00
2017-01-05 14:14:13 -08:00
2017-01-30 12:46:59 -05:00
2017-01-29 21:41:45 +01:00
2017-01-11 09:09:48 -05:00
2017-01-05 14:14:13 -08:00
2017-02-27 16:00:49 -08:00
2017-01-25 19:49:45 +01:00
2017-01-05 14:14:13 -08:00
2017-01-16 16:04:03 -05:00
2017-01-16 16:04:03 -05:00
2017-01-11 09:09:48 -05:00
2017-01-25 19:49:45 +01:00
2016-07-16 13:48:21 -04:00