merge changes from about dealing with read only volumes.

97482255d5.diff
This commit is contained in:
Chris Lu
2013-04-14 19:30:26 -07:00
parent 4d8ce2fe26
commit a4369b35a7
5 changed files with 47 additions and 14 deletions

View File

@@ -39,13 +39,15 @@ func (vl *VolumeLayout) RegisterVolume(v *storage.VolumeInfo, dn *DataNode) {
}
func (vl *VolumeLayout) isWritable(v *storage.VolumeInfo) bool {
return uint64(v.Size) < vl.volumeSizeLimit && v.Version == storage.CurrentVersion
return uint64(v.Size) < vl.volumeSizeLimit &&
v.Version == storage.CurrentVersion &&
!v.ReadOnly
}
func (vl *VolumeLayout) Lookup(vid storage.VolumeId) []*DataNode {
if location := vl.vid2location[vid]; location != nil {
return location.list
}
if location := vl.vid2location[vid]; location != nil {
return location.list
}
return nil
}