8
"github.com/cubefs/cubefs/util/auth"
9
"github.com/cubefs/cubefs/util/config"
72
MinWriteAbleDataPartitionCnt
83
MasterAddr = "masterAddr"
85
ObjectNodeDomain = "objectNodeDomain"
89
type MountOption struct {
96
func (opt MountOption) String() string {
97
return fmt.Sprintf("[%v] %T: %v", opt.keyword, opt.value, opt.value)
100
func NewMountOptions() []MountOption {
101
opts := make([]MountOption, MaxMountOption)
105
func InitMountOptions(opts []MountOption) {
106
opts[MountPoint] = MountOption{"mountPoint", "Mount Point", "", ""}
107
opts[VolName] = MountOption{"volName", "Volume Name", "", ""}
108
opts[Owner] = MountOption{"owner", "Owner", "", ""}
109
opts[Master] = MountOption{MasterAddr, "Master Address", "", ""}
110
opts[LogDir] = MountOption{"logDir", "Log Path", "", ""}
111
opts[WarnLogDir] = MountOption{"warnLogDir", "Warn Log Path", "", ""}
112
opts[LogLevel] = MountOption{"logLevel", "Log Level", "", ""}
113
opts[ProfPort] = MountOption{"profPort", "PProf Port", "", ""}
114
opts[LocallyProf] = MountOption{"locallyProf", "Locally PProf", "", false}
115
opts[IcacheTimeout] = MountOption{"icacheTimeout", "Inode Cache Expiration Time", "", int64(-1)}
116
opts[LookupValid] = MountOption{"lookupValid", "Lookup Valid Duration", "", int64(-1)}
117
opts[AttrValid] = MountOption{"attrValid", "Attr Valid Duration", "", int64(-1)}
118
opts[ReadRate] = MountOption{"readRate", "Read Rate Limit", "", int64(-1)}
119
opts[WriteRate] = MountOption{"writeRate", "Write Rate Limit", "", int64(-1)}
120
opts[EnSyncWrite] = MountOption{"enSyncWrite", "Enable Sync Write", "", int64(-1)}
121
opts[AutoInvalData] = MountOption{"autoInvalData", "Auto Invalidate Data", "", int64(-1)}
122
opts[Rdonly] = MountOption{"rdonly", "Mount as readonly", "", false}
123
opts[WriteCache] = MountOption{"writecache", "Enable FUSE writecache feature", "", false}
124
opts[KeepCache] = MountOption{"keepcache", "Enable FUSE keepcache feature", "", false}
125
opts[FollowerRead] = MountOption{"followerRead", "Enable read from follower", "", false}
126
opts[NearRead] = MountOption{"nearRead", "Enable read from nearest node", "", true}
128
opts[Authenticate] = MountOption{"authenticate", "Enable Authenticate", "", false}
129
opts[ClientKey] = MountOption{"clientKey", "Client Key", "", ""}
130
opts[TicketHost] = MountOption{"ticketHost", "Ticket Host", "", ""}
131
opts[EnableHTTPS] = MountOption{"enableHTTPS", "Enable HTTPS", "", false}
132
opts[CertFile] = MountOption{"certFile", "Cert File", "", ""}
134
opts[AccessKey] = MountOption{"accessKey", "Access Key", "", ""}
135
opts[SecretKey] = MountOption{"secretKey", "Secret Key", "", ""}
137
opts[DisableDcache] = MountOption{"disableDcache", "Disable Dentry Cache", "", false}
138
opts[SubDir] = MountOption{"subdir", "Mount sub directory", "", ""}
139
opts[FsyncOnClose] = MountOption{"fsyncOnClose", "Perform fsync upon file close", "", true}
140
opts[MaxCPUs] = MountOption{"maxcpus", "The maximum number of CPUs that can be executing", "", int64(-1)}
141
opts[EnableXattr] = MountOption{"enableXattr", "Enable xattr support", "", false}
142
opts[EnablePosixACL] = MountOption{"enablePosixACL", "Enable posix ACL support", "", false}
143
opts[EnableSummary] = MountOption{"enableSummary", "Enable content summary", "", false}
144
opts[EnableUnixPermission] = MountOption{"enableUnixPermission", "Enable unix permission check(e.g: 777/755)", "", false}
146
opts[VolType] = MountOption{"volType", "volume type", "", int64(0)}
147
opts[EbsEndpoint] = MountOption{"ebsEndpoint", "Ebs service address", "", ""}
148
opts[EbsServerPath] = MountOption{"ebsServerPath", "Ebs service path", "", ""}
149
opts[CacheAction] = MountOption{"cacheAction", "Cold cache action", "", int64(0)}
150
opts[EbsBlockSize] = MountOption{"ebsBlockSize", "Ebs object size", "", ""}
151
// opts[EnableBcache] = MountOption{"enableBcache", "Enable block cache", "", false}
152
opts[BcacheDir] = MountOption{"bcacheDir", "block cache dir", "", ""}
153
opts[ReadThreads] = MountOption{"readThreads", "Cold volume read threads", "", int64(10)}
154
opts[WriteThreads] = MountOption{"writeThreads", "Cold volume write threads", "", int64(10)}
155
opts[MetaSendTimeout] = MountOption{"metaSendTimeout", "Meta send timeout", "", int64(600)}
156
opts[BuffersTotalLimit] = MountOption{"buffersTotalLimit", "Send/Receive packets memory limit", "", int64(32768)} // default 4G
157
opts[MaxStreamerLimit] = MountOption{"maxStreamerLimit", "The maximum number of streamers", "", int64(0)} // default 0
158
opts[BcacheFilterFiles] = MountOption{"bcacheFilterFiles", "The block cache filter files suffix", "", "py;pyx;sh;yaml;conf;pt;pth;log;out"}
159
opts[BcacheBatchCnt] = MountOption{"bcacheBatchCnt", "The block cache get meta count", "", int64(100000)}
160
opts[BcacheCheckIntervalS] = MountOption{"bcacheCheckIntervalS", "The block cache check interval", "", int64(300)}
161
opts[EnableAudit] = MountOption{"enableAudit", "enable client audit logging", "", false}
162
opts[RequestTimeout] = MountOption{"requestTimeout", "The Request Expiration Time", "", int64(0)}
163
opts[MinWriteAbleDataPartitionCnt] = MountOption{
164
"minWriteAbleDataPartitionCnt",
165
"Min writeable data partition count retained int dpSelector when update DataPartitionsView from master",
169
opts[FileSystemName] = MountOption{"fileSystemName", "The explicit name of the filesystem", "", ""}
170
opts[SnapshotReadVerSeq] = MountOption{"snapshotReadSeq", "Snapshot read seq", "", int64(0)} // default false
172
for i := 0; i < MaxMountOption; i++ {
173
flag.StringVar(&opts[i].cmdlineValue, opts[i].keyword, "", opts[i].description)
177
func ParseMountOptions(opts []MountOption, cfg *config.Config) {
178
for i := 0; i < MaxMountOption; i++ {
179
switch v := opts[i].value.(type) {
181
if opts[i].cmdlineValue != "" {
182
opts[i].value = opts[i].cmdlineValue
184
if value, present := cfg.CheckAndGetString(opts[i].keyword); present {
185
opts[i].value = value
190
fmt.Printf("keyword[%v] value[%v] type[%T]\n", opts[i].keyword, opts[i].value, v)
193
if opts[i].cmdlineValue != "" {
194
opts[i].value = parseInt64(opts[i].cmdlineValue)
196
if present := cfg.HasKey(opts[i].keyword); present {
197
opts[i].value = cfg.GetInt64(opts[i].keyword)
202
fmt.Printf("keyword[%v] value[%v] type[%T]\n", opts[i].keyword, opts[i].value, v)
205
if opts[i].cmdlineValue != "" {
206
opts[i].value = parseBool(opts[i].cmdlineValue)
208
if value, present := cfg.CheckAndGetBool(opts[i].keyword); present {
209
opts[i].value = value
214
fmt.Printf("keyword[%v] value[%v] type[%T]\n", opts[i].keyword, opts[i].value, v)
217
fmt.Printf("keyword[%v] unknown type[%T]\n", opts[i].keyword, v)
222
func parseInt64(s string) int64 {
226
val, err := strconv.Atoi(s)
234
func parseBool(s string) bool {
243
func (opt *MountOption) GetString() string {
244
val, ok := opt.value.(string)
251
func (opt *MountOption) GetBool() bool {
252
val, ok := opt.value.(bool)
259
func (opt *MountOption) GetInt64() int64 {
260
val, ok := opt.value.(int64)
267
type MountOptions struct {
268
Config *config.Config
290
TicketMess auth.TicketMess
302
EnableTransaction string
304
TxConflictRetryNum int64
305
TxConflictRetryInterval int64
308
EbsServicePath string
314
BcacheFilterFiles string
315
BcacheCheckIntervalS int64
320
EnableUnixPermission bool
322
MetaSendTimeout int64
323
BuffersTotalLimit int64
324
MaxStreamerLimit int64
327
MinWriteAbleDataPartitionCnt int
328
FileSystemName string