mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 18:24:07 +00:00
Add more detailed error output when disk formatting fails
This commit is contained in:
parent
0f9a3f756b
commit
99f567aa7a
@ -345,10 +345,11 @@ func (mounter *SafeFormatAndMount) formatAndMount(source string, target string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
klog.Infof("Disk %q appears to be unformatted, attempting to format as type: %q with options: %v", source, fstype, args)
|
klog.Infof("Disk %q appears to be unformatted, attempting to format as type: %q with options: %v", source, fstype, args)
|
||||||
_, err := mounter.Exec.Command("mkfs."+fstype, args...).CombinedOutput()
|
output, err := mounter.Exec.Command("mkfs."+fstype, args...).CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("format of disk %q failed: type:(%q) target:(%q) options:(%q)error:(%v)", source, fstype, target, options, err)
|
detailedErr := fmt.Sprintf("format of disk %q failed: type:(%q) target:(%q) options:(%q) errcode:(%v) output:(%v) ", source, fstype, target, options, err, string(output))
|
||||||
return NewMountError(FormatFailed, err.Error())
|
klog.Error(detailedErr)
|
||||||
|
return NewMountError(FormatFailed, detailedErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
klog.Infof("Disk successfully formatted (mkfs): %s - %s %s", fstype, source, target)
|
klog.Infof("Disk successfully formatted (mkfs): %s - %s %s", fstype, source, target)
|
||||||
|
Loading…
Reference in New Issue
Block a user