mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
修正:由于datastore url信息不一致导致通过vcenter创建主机失败
This commit is contained in:
@@ -110,4 +110,4 @@ func (hi *SHandlerInfo) GetAppParams(params map[string]string, path []string) *S
|
||||
appParams.Params = params
|
||||
appParams.Path = path
|
||||
return &appParams
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/db/taskman"
|
||||
"yunion.io/x/onecloud/pkg/compute/models"
|
||||
"yunion.io/x/onecloud/pkg/util/httputils"
|
||||
"github.com/golang-plus/errors"
|
||||
)
|
||||
|
||||
type SESXiHostDriver struct {
|
||||
@@ -62,6 +63,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
|
||||
|
||||
@@ -23,6 +23,7 @@ import (
|
||||
"yunion.io/x/pkg/utils"
|
||||
"yunion.io/x/sqlchemy"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/appsrv"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/db"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/db/lockman"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/db/taskman"
|
||||
@@ -35,7 +36,6 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/util/httputils"
|
||||
"yunion.io/x/onecloud/pkg/util/logclient"
|
||||
"yunion.io/x/onecloud/pkg/appsrv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
package esxi
|
||||
|
||||
import (
|
||||
"github.com/vmware/govmomi/vim25/mo"
|
||||
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/vmware/govmomi/object"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@@ -16,8 +12,14 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/vmware/govmomi/object"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
"github.com/vmware/govmomi/vim25/mo"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/compute/models"
|
||||
"yunion.io/x/onecloud/pkg/util/vmdkutils"
|
||||
@@ -330,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 {
|
||||
|
||||
Reference in New Issue
Block a user