mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-11-25 03:29:10 +08:00
fix for issue #35
This commit is contained in:
parent
ff1c04c486
commit
123b0cc2df
@ -90,14 +90,18 @@ func (s *Store) findFreeLocation() (ret *DiskLocation) {
|
||||
}
|
||||
return ret
|
||||
}
|
||||
func (s *Store) addVolume(vid VolumeId, replicationType ReplicationType) (err error) {
|
||||
func (s *Store) addVolume(vid VolumeId, replicationType ReplicationType) error {
|
||||
if s.findVolume(vid) != nil {
|
||||
return fmt.Errorf("Volume Id %s already exists!", vid)
|
||||
}
|
||||
if location := s.findFreeLocation(); location != nil {
|
||||
log.Println("In dir", location.directory, "adds volume =", vid, ", replicationType =", replicationType)
|
||||
location.volumes[vid], err = NewVolume(location.directory, vid, replicationType)
|
||||
return err
|
||||
if volume, err := NewVolume(location.directory, vid, replicationType); err == nil {
|
||||
location.volumes[vid] = volume
|
||||
return nil
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("No more free space left")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user