cloudcommon: options: add constants for lock method

This commit is contained in:
Yousong Zhou
2020-03-12 18:55:58 +08:00
parent e88a520aa5
commit 487b7e189b
2 changed files with 7 additions and 2 deletions
+2 -2
View File
@@ -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 {
+5
View File
@@ -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"`