Browse Source

fix for issue #35

pull/2/head
Chris Lu 12 years ago
parent
commit
123b0cc2df
  1. 8
      go/storage/store.go

8
go/storage/store.go

@ -90,15 +90,19 @@ func (s *Store) findFreeLocation() (ret *DiskLocation) {
} }
return ret 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 { if s.findVolume(vid) != nil {
return fmt.Errorf("Volume Id %s already exists!", vid) return fmt.Errorf("Volume Id %s already exists!", vid)
} }
if location := s.findFreeLocation(); location != nil { if location := s.findFreeLocation(); location != nil {
log.Println("In dir", location.directory, "adds volume =", vid, ", replicationType =", replicationType) log.Println("In dir", location.directory, "adds volume =", vid, ", replicationType =", replicationType)
location.volumes[vid], err = NewVolume(location.directory, vid, replicationType)
if volume, err := NewVolume(location.directory, vid, replicationType); err == nil {
location.volumes[vid] = volume
return nil
} else {
return err return err
} }
}
return fmt.Errorf("No more free space left") return fmt.Errorf("No more free space left")
} }

Loading…
Cancel
Save