host misc fix

This commit is contained in:
wanyaoqi
2020-01-08 14:19:26 +08:00
parent 8d7808b3fb
commit eb16796db1
3 changed files with 7 additions and 4 deletions
+2 -2
View File
@@ -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}
}
+1 -1
View File
@@ -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()
+4 -1
View File
@@ -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