mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-29 17:58:36 +08:00
cloudcommon: options: add constants for lock method
This commit is contained in:
@@ -53,11 +53,11 @@ func InitDB(options *common_options.DBOptions) {
|
||||
sqlchemy.SetDB(dbConn)
|
||||
|
||||
switch options.LockmanMethod {
|
||||
case "inmemory", "":
|
||||
case common_options.LockMethodInMemory, "":
|
||||
log.Infof("using inmemory lockman")
|
||||
lm := lockman.NewInMemoryLockManager()
|
||||
lockman.Init(lm)
|
||||
case "etcd":
|
||||
case common_options.LockMethodEtcd:
|
||||
log.Infof("using etcd lockman")
|
||||
tlsCfg, err := options.GetEtcdTLSConfig()
|
||||
if err != nil {
|
||||
|
||||
@@ -89,6 +89,11 @@ type BaseOptions struct {
|
||||
structarg.BaseOptions
|
||||
}
|
||||
|
||||
const (
|
||||
LockMethodInMemory = "inmemory"
|
||||
LockMethodEtcd = "etcd"
|
||||
)
|
||||
|
||||
type CommonOptions struct {
|
||||
AuthURL string `help:"Keystone auth URL" alias:"auth-uri"`
|
||||
AdminUser string `help:"Admin username"`
|
||||
|
||||
Reference in New Issue
Block a user