mirror of https://github.com/k3s-io/k3s
Merge pull request #14201 from swagiaal/fix-format-and-mount-comment
Correct comments in mount.gopull/6/head
commit
f264ae67c7
|
@ -75,7 +75,7 @@ func (mounter *SafeFormatAndMount) formatAndMount(source string, target string,
|
||||||
// Try to mount the disk
|
// Try to mount the disk
|
||||||
err := mounter.Interface.Mount(source, target, fstype, options)
|
err := mounter.Interface.Mount(source, target, fstype, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// It is possible that this disk is not formatted. Double check using 'file'
|
// It is possible that this disk is not formatted. Double check using diskLooksUnformatted
|
||||||
notFormatted, err := mounter.diskLooksUnformatted(source)
|
notFormatted, err := mounter.diskLooksUnformatted(source)
|
||||||
if err == nil && notFormatted {
|
if err == nil && notFormatted {
|
||||||
// Disk is unformatted so format it.
|
// Disk is unformatted so format it.
|
||||||
|
@ -96,7 +96,7 @@ func (mounter *SafeFormatAndMount) formatAndMount(source string, target string,
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// diskLooksUnformatted uses 'file' to see if the given disk is unformated
|
// diskLooksUnformatted uses 'lsblk' to see if the given disk is unformated
|
||||||
func (mounter *SafeFormatAndMount) diskLooksUnformatted(disk string) (bool, error) {
|
func (mounter *SafeFormatAndMount) diskLooksUnformatted(disk string) (bool, error) {
|
||||||
args := []string{"-nd", "-o", "FSTYPE", disk}
|
args := []string{"-nd", "-o", "FSTYPE", disk}
|
||||||
cmd := mounter.Runner.Command("lsblk", args...)
|
cmd := mounter.Runner.Command("lsblk", args...)
|
||||||
|
|
Loading…
Reference in New Issue