mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #450 from swordqiu/hotfix/qj-fix-kvm-force-use-qcow2-image
fix: 1. force use qcow2 format when creating kvm VM 2. add template lock
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
@@ -36,6 +37,7 @@ import (
|
||||
|
||||
var (
|
||||
templatesTable map[string]*template.Template
|
||||
templatesTableLock *sync.Mutex
|
||||
notifyClientWorkerMan *appsrv.SWorkerManager
|
||||
|
||||
notifyAdminUsers []string
|
||||
@@ -44,6 +46,7 @@ var (
|
||||
|
||||
func init() {
|
||||
notifyClientWorkerMan = appsrv.NewWorkerManager("NotifyClientWorkerManager", 1, 50, false)
|
||||
templatesTableLock = &sync.Mutex{}
|
||||
templatesTable = make(map[string]*template.Template)
|
||||
}
|
||||
|
||||
@@ -61,6 +64,9 @@ func getTemplateString(topic string, contType string, channel notify.TNotifyChan
|
||||
|
||||
func getTemplate(topic string, contType string, channel notify.TNotifyChannel) (*template.Template, error) {
|
||||
key := fmt.Sprintf("%s.%s.%s", topic, contType, channel)
|
||||
templatesTableLock.Lock()
|
||||
defer templatesTableLock.Unlock()
|
||||
|
||||
if _, ok := templatesTable[key]; !ok {
|
||||
cont, err := getTemplateString(topic, contType, channel)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user