mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
correct .vif file creation
This commit is contained in:
parent
b6f7033478
commit
03ab0b1b9a
|
@ -52,10 +52,8 @@ func MaybeLoadVolumeInfo(fileName string) (*volume_server_pb.VolumeInfo, bool) {
|
||||||
|
|
||||||
func SaveVolumeInfo(fileName string, volumeInfo *volume_server_pb.VolumeInfo) error {
|
func SaveVolumeInfo(fileName string, volumeInfo *volume_server_pb.VolumeInfo) error {
|
||||||
|
|
||||||
tierFileName := fileName + ".vif"
|
if exists, _, canWrite, _, _ := util.CheckFile(fileName); exists && !canWrite {
|
||||||
|
return fmt.Errorf("%s not writable", fileName)
|
||||||
if exists, _, canWrite, _, _ := util.CheckFile(tierFileName); exists && !canWrite {
|
|
||||||
return fmt.Errorf("%s not writable", tierFileName)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m := jsonpb.Marshaler{
|
m := jsonpb.Marshaler{
|
||||||
|
@ -68,9 +66,9 @@ func SaveVolumeInfo(fileName string, volumeInfo *volume_server_pb.VolumeInfo) er
|
||||||
return fmt.Errorf("marshal to %s: %v", fileName, marshalErr)
|
return fmt.Errorf("marshal to %s: %v", fileName, marshalErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
writeErr := ioutil.WriteFile(tierFileName, []byte(text), 0755)
|
writeErr := ioutil.WriteFile(fileName, []byte(text), 0755)
|
||||||
if writeErr != nil {
|
if writeErr != nil {
|
||||||
return fmt.Errorf("fail to write %s : %v", tierFileName, writeErr)
|
return fmt.Errorf("fail to write %s : %v", fileName, writeErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue