mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-28 03:23:25 +08:00
host misc fix
This commit is contained in:
@@ -303,7 +303,7 @@ func FsckXfsFs(fpath string) bool {
|
||||
|
||||
func Mkpartition(imagePath, fsFormat string) error {
|
||||
var (
|
||||
parted = "/sbin/parted"
|
||||
parted = "parted"
|
||||
labelType = "gpt"
|
||||
diskType = fileutils2.FsFormatToDiskType(fsFormat)
|
||||
)
|
||||
@@ -352,7 +352,7 @@ func FormatPartition(path, fs, uuid string) error {
|
||||
// #case fs == "ntfs":
|
||||
// # cmd = []string{"/sbin/mkfs.ntfs"}
|
||||
case fs == "xfs":
|
||||
cmd = []string{"/sbin/mkfs.xfs", "-f", "-m", "crc=0", "-i", "projid32bit=0", "-n", "ftype=0"}
|
||||
cmd = []string{"mkfs.xfs", "-f", "-m", "crc=0", "-i", "projid32bit=0", "-n", "ftype=0"}
|
||||
cmdUuid = []string{"xfs_admin", "-U", uuid}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ func MountFusefs(fetcherfsPath, url, tmpdir, token, mntpath string, blocksize in
|
||||
|
||||
var cmd = []string{fetcherfsPath, "-s", "-o", opts, mntpath}
|
||||
log.Infof("%s", strings.Join(cmd, " "))
|
||||
err := procutils.NewCommand(cmd[0], cmd[1:]...).Run()
|
||||
err := procutils.NewRemoteCommandAsFarAsPossible(cmd[0], cmd[1:]...).Run()
|
||||
if err != nil {
|
||||
log.Errorf("Mount fetcherfs filed: %s", err)
|
||||
procutils.NewCommand("umount", mntpath).Run()
|
||||
|
||||
@@ -96,13 +96,16 @@ func detectiveKVMModuleSupport() string {
|
||||
func ModprobeKvmModule(name string, remove, nest bool) bool {
|
||||
var params = []string{"modprobe"}
|
||||
if remove {
|
||||
params = append(params, "-r")
|
||||
if err := procutils.NewCommand("rmmod", name).Run(); err != nil {
|
||||
log.Errorf("rmmod failed %s: %s", name, err)
|
||||
}
|
||||
}
|
||||
params = append(params, name)
|
||||
if nest {
|
||||
params = append(params, "nested=1")
|
||||
}
|
||||
if err := procutils.NewCommand(params[0], params[1:]...).Run(); err != nil {
|
||||
log.Errorf("Modprobe kvm %v failed: %s", params, err)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user