mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
fix(host): thrown errors on disk fromatfs (#23728)
This commit is contained in:
@@ -244,7 +244,7 @@ func ConvertDiskFsFeaturesToDeploy(fsFeatures *api.DiskFsFeatures) *deployapi.Fs
|
||||
return ret
|
||||
}
|
||||
|
||||
func (d *SBaseDisk) FormatFs(fsFormat string, fsFeatures *api.DiskFsFeatures, uuid string, diskInfo *deployapi.DiskInfo) {
|
||||
func (d *SBaseDisk) FormatFs(fsFormat string, fsFeatures *api.DiskFsFeatures, uuid string, diskInfo *deployapi.DiskInfo) error {
|
||||
log.Infof("Make disk %s fs %s, features: %s", uuid, fsFormat, jsonutils.Marshal(fsFeatures))
|
||||
_, err := deployclient.GetDeployClient().FormatFs(
|
||||
context.Background(),
|
||||
@@ -257,7 +257,9 @@ func (d *SBaseDisk) FormatFs(fsFormat string, fsFeatures *api.DiskFsFeatures, uu
|
||||
)
|
||||
if err != nil {
|
||||
log.Errorf("Format fs error : %s", err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *SBaseDisk) DiskSnapshot(ctx context.Context, params interface{}) (jsonutils.JSONObject, error) {
|
||||
|
||||
@@ -220,7 +220,7 @@ func (d *SLocalDisk) Resize(ctx context.Context, params *SDiskResizeInput) (json
|
||||
|
||||
if err := d.ResizeFs(resizeFsInfo, params.GuestDesc); err != nil {
|
||||
log.Errorf("Resize fs %s fail %s", d.GetPath(), err)
|
||||
// return nil, errors.Wrapf(err, "resize fs %s", d.GetPath())
|
||||
return nil, errors.Wrapf(err, "resize fs %s", d.GetPath())
|
||||
}
|
||||
|
||||
return d.GetDiskDesc(), nil
|
||||
@@ -426,7 +426,9 @@ func (d *SLocalDisk) CreateRaw(ctx context.Context, sizeMB int, diskFormat strin
|
||||
diskInfo.EncryptAlg = string(encryptInfo.Alg)
|
||||
}
|
||||
if utils.IsInStringArray(fsFormat, api.SUPPORTED_FS) {
|
||||
d.FormatFs(fsFormat, fsFeatures, diskId, diskInfo)
|
||||
if err := d.FormatFs(fsFormat, fsFeatures, diskId, diskInfo); err != nil {
|
||||
return nil, errors.Wrap(err, "FormatFs")
|
||||
}
|
||||
}
|
||||
|
||||
return d.GetDiskDesc(), nil
|
||||
|
||||
@@ -151,7 +151,9 @@ func (d *SLVMDisk) CreateRaw(ctx context.Context, sizeMB int, diskFormat string,
|
||||
diskInfo.EncryptAlg = string(encryptInfo.Alg)
|
||||
}
|
||||
if utils.IsInStringArray(fsFormat, api.SUPPORTED_FS) {
|
||||
d.FormatFs(fsFormat, nil, diskId, diskInfo)
|
||||
if err := d.FormatFs(fsFormat, nil, diskId, diskInfo); err != nil {
|
||||
return nil, errors.Wrap(err, "FormatFs")
|
||||
}
|
||||
}
|
||||
return d.GetDiskDesc(), nil
|
||||
}
|
||||
@@ -294,6 +296,7 @@ func (d *SLVMDisk) Resize(ctx context.Context, params *SDiskResizeInput) (jsonut
|
||||
|
||||
if err := d.ResizeFs(resizeFsInfo, params.GuestDesc); err != nil {
|
||||
log.Errorf("Resize fs %s fail %s", d.GetPath(), err)
|
||||
return nil, errors.Wrapf(err, "resize fs %s", d.GetPath())
|
||||
}
|
||||
return d.GetDiskDesc(), nil
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ func (d *SRBDDisk) Resize(ctx context.Context, params *SDiskResizeInput) (jsonut
|
||||
}
|
||||
if err := d.ResizeFs(resizeFsInfo, params.GuestDesc); err != nil {
|
||||
log.Errorf("Resize fs %s fail %s", d.GetPath(), err)
|
||||
// return nil, errors.Wrapf(err, "resize fs %s", d.GetPath())
|
||||
return nil, errors.Wrapf(err, "resize fs %s", d.GetPath())
|
||||
}
|
||||
|
||||
return d.GetDiskDesc(), nil
|
||||
@@ -228,7 +228,9 @@ func (d *SRBDDisk) CreateRaw(ctx context.Context, sizeMb int, diskFormat string,
|
||||
Path: d.GetPath(),
|
||||
}
|
||||
if utils.IsInStringArray(fsFormat, api.SUPPORTED_FS) {
|
||||
d.FormatFs(fsFormat, nil, diskId, diskInfo)
|
||||
if err := d.FormatFs(fsFormat, nil, diskId, diskInfo); err != nil {
|
||||
return nil, errors.Wrap(err, "FormatFs")
|
||||
}
|
||||
}
|
||||
|
||||
return d.GetDiskDesc(), nil
|
||||
|
||||
Reference in New Issue
Block a user