mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
fix(host-deployer): loop dev resize diskfs umounted and f2fs support (#23358)
This commit is contained in:
@@ -174,13 +174,19 @@ func (d *SFsutilDriver) ResizeDiskPartition(diskPath string, sizeMb int) (string
|
||||
if len(parts) > 0 && (label == "gpt" ||
|
||||
(label == "msdos" && parts[len(parts)-1][5] == "primary")) {
|
||||
var part = parts[len(parts)-1]
|
||||
if part[5] == "lvm" || IsSupportResizeFs(part[6]) {
|
||||
fsType := part[6]
|
||||
if len(fsType) == 0 {
|
||||
partDev := fmt.Sprintf("%s%s", diskPath, part[0])
|
||||
fsType = d.GetFsFormat(partDev)
|
||||
log.Infof("blkid get fstype %s", fsType)
|
||||
}
|
||||
if part[5] == "lvm" || IsSupportResizeFs(fsType) {
|
||||
// growpart script replace parted resizepart
|
||||
output, err := d.Exec("growpart", diskPath, part[0])
|
||||
if err != nil {
|
||||
return "", "", errors.Wrapf(err, "growpart failed %s", output)
|
||||
}
|
||||
return part[7], part[6], nil
|
||||
return part[7], fsType, nil
|
||||
}
|
||||
}
|
||||
return "", "", nil
|
||||
@@ -263,7 +269,7 @@ func IsSupportResizeFs(fs string) bool {
|
||||
return true
|
||||
} else if strings.HasPrefix(fs, "ext") {
|
||||
return true
|
||||
} else if fs == "xfs" {
|
||||
} else if fs == "xfs" || fs == "f2fs" {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -330,7 +336,7 @@ func (d *SFsutilDriver) ResizePartitionFs(fpath, fs string, raiseError, onlineRe
|
||||
// cmds = [][]string{{"ntfsresize", "-c", fpath}, {"ntfsresize", "-P", "-f", fpath}}
|
||||
} else if fs == "f2fs" {
|
||||
if !onlineResize {
|
||||
cmds = [][]string{{"resize.f2fs"}}
|
||||
cmds = [][]string{{"resize.f2fs", fpath}}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -308,7 +308,7 @@ func (m *SCpuFreqRealTimeSimulateManager) startSetCpuFreqSimulate() {
|
||||
}
|
||||
cpuDir := pod.getContainerSystemCpusDir(ctr.Id)
|
||||
if !fileutils2.Exists(cpuDir) {
|
||||
log.Errorf("%s %s has no cpuDir", pod.GetName(), criIds[i])
|
||||
log.Debugf("%s %s has no cpuDir", pod.GetName(), criIds[i])
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ func (*DeployerServer) ResizeFs(ctx context.Context, req *deployapi.ResizeFsPara
|
||||
log.Infof("********* Resize fs on %#v", req.DiskInfo)
|
||||
if strings.HasPrefix(req.DiskInfo.Path, "/dev/loop") {
|
||||
// HACK: container loop device, do resize locally
|
||||
if err := fsutils.ResizeDiskFs(req.DiskInfo.Path, 0, true); err != nil {
|
||||
if err := fsutils.ResizeDiskFs(req.DiskInfo.Path, 0, false); err != nil {
|
||||
return new(deployapi.Empty), errors.Wrap(err, "fsutils.ResizeDiskFs")
|
||||
}
|
||||
return new(deployapi.Empty), nil
|
||||
|
||||
Reference in New Issue
Block a user