mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Merge pull request #104923 from davidkarlsen/xfsFormatIssue
mount-utils: force-format xfs-filesystems too
This commit is contained in:
commit
486ca678a0
@ -439,6 +439,11 @@ func (mounter *SafeFormatAndMount) formatAndMountSensitive(source string, target
|
|||||||
"-m0", // Zero blocks reserved for super-user
|
"-m0", // Zero blocks reserved for super-user
|
||||||
source,
|
source,
|
||||||
}
|
}
|
||||||
|
} else if fstype == "xfs" {
|
||||||
|
args = []string{
|
||||||
|
"-f", // force flag
|
||||||
|
source,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
@ -181,7 +181,7 @@ func TestSafeFormatAndMount(t *testing.T) {
|
|||||||
fstype: "xfs",
|
fstype: "xfs",
|
||||||
execScripts: []ExecArgs{
|
execScripts: []ExecArgs{
|
||||||
{"blkid", []string{"-p", "-s", "TYPE", "-s", "PTTYPE", "-o", "export", "/dev/foo"}, "", &testingexec.FakeExitError{Status: 2}},
|
{"blkid", []string{"-p", "-s", "TYPE", "-s", "PTTYPE", "-o", "export", "/dev/foo"}, "", &testingexec.FakeExitError{Status: 2}},
|
||||||
{"mkfs.xfs", []string{"/dev/foo"}, "", nil},
|
{"mkfs.xfs", []string{"-f", "/dev/foo"}, "", nil},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -198,7 +198,7 @@ func TestSafeFormatAndMount(t *testing.T) {
|
|||||||
mountErrs: []error{fmt.Errorf("unknown filesystem type '(null)'"), nil},
|
mountErrs: []error{fmt.Errorf("unknown filesystem type '(null)'"), nil},
|
||||||
execScripts: []ExecArgs{
|
execScripts: []ExecArgs{
|
||||||
{"blkid", []string{"-p", "-s", "TYPE", "-s", "PTTYPE", "-o", "export", "/dev/foo"}, "", &testingexec.FakeExitError{Status: 4}},
|
{"blkid", []string{"-p", "-s", "TYPE", "-s", "PTTYPE", "-o", "export", "/dev/foo"}, "", &testingexec.FakeExitError{Status: 4}},
|
||||||
{"mkfs.xfs", []string{"/dev/foo"}, "", nil},
|
{"mkfs.xfs", []string{"-f", "/dev/foo"}, "", nil},
|
||||||
},
|
},
|
||||||
expErrorType: GetDiskFormatFailed,
|
expErrorType: GetDiskFormatFailed,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user