Merge pull request #727 in YUNIONIO/onecloud from ~QIUJIAN/onecloud:hotfix/qj-vmware-vcenter-test to release/2.4.0

* commit 'e7b978955c3a17712095964102afad558c68d2da':
  set cmtbound for storage & cpu & memory
  修正:由于datastore url信息不一致导致通过vcenter创建主机失败
This commit is contained in:
邱剑
2018-12-12 23:35:53 +08:00
5 changed files with 18 additions and 1 deletions
+7
View File
@@ -7,6 +7,7 @@ import (
"yunion.io/x/jsonutils"
"yunion.io/x/log"
"github.com/golang-plus/errors"
"yunion.io/x/onecloud/pkg/cloudcommon/db/taskman"
"yunion.io/x/onecloud/pkg/compute/models"
"yunion.io/x/onecloud/pkg/util/httputils"
@@ -63,6 +64,12 @@ func (self *SESXiHostDriver) CheckAndSetCacheImage(ctx context.Context, host *mo
content.Format = cacheImage.GetFormat()
storage := host.GetStorageByFilePath(storageCache.Path)
if storage == nil {
msg := fmt.Sprintf("fail to find storage for storageCache %s", storageCache.Path)
log.Errorf(msg)
return errors.New(msg)
}
accessInfo, err := host.GetCloudaccount().GetVCenterAccessInfo(storage.ExternalId)
if err != nil {
return err
+2
View File
@@ -1340,6 +1340,8 @@ func (manager *SHostManager) newFromCloudHost(extHost cloudprovider.ICloudHost,
host.MemSize = extHost.GetMemSizeMB()
host.StorageSize = extHost.GetStorageSizeMB()
host.StorageType = extHost.GetStorageType()
host.CpuCmtbound = 8.0
host.MemCmtbound = 1.0
host.ManagerId = extHost.GetManagerId()
host.IsEmulated = extHost.IsEmulated()
+1
View File
@@ -746,6 +746,7 @@ func (manager *SStorageManager) newFromCloudStorage(extStorage cloudprovider.ICl
storage.MediumType = extStorage.GetMediumType()
storage.StorageConf = extStorage.GetStorageConf()
storage.Capacity = extStorage.GetCapacityMB()
storage.Cmtbound = 1.0
storage.Enabled = extStorage.GetEnabled()
@@ -91,6 +91,7 @@ func (self *CloudAccountSyncInfoTask) OnCloudaccountSyncComplete(ctx context.Con
err := skus.SyncSkusByProviderIds([]string{cloudprovider.Provider})
return nil, err
})
return
}
}
self.SetStageComplete(ctx, nil)
+7 -1
View File
@@ -332,8 +332,14 @@ func (self *SDatastore) GetManagerId() string {
return self.manager.providerId
}
const dsPrefix = "ds://"
func (self *SDatastore) GetUrl() string {
return self.getDatastore().Info.GetDatastoreInfo().Url
url := self.getDatastore().Info.GetDatastoreInfo().Url
if strings.HasPrefix(url, dsPrefix) {
url = url[len(dsPrefix):]
}
return url
}
func (self *SDatastore) GetMountPoint() string {