mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
Merge pull request #767 from ioito/hotfix/qx-remote-useless-function
移除多余的方法
This commit is contained in:
@@ -137,8 +137,6 @@ type ICloudStoragecache interface {
|
||||
|
||||
GetPath() string
|
||||
|
||||
GetManagerId() string
|
||||
|
||||
CreateIImage(snapshotId, imageName, osType, imageDesc string) (ICloudImage, error)
|
||||
|
||||
DownloadImage(userCred mcclient.TokenCredential, imageId string, extId string, path string) (jsonutils.JSONObject, error)
|
||||
@@ -160,8 +158,6 @@ type ICloudStorage interface {
|
||||
GetStorageConf() jsonutils.JSONObject
|
||||
GetEnabled() bool
|
||||
|
||||
GetManagerId() string
|
||||
|
||||
CreateIDisk(name string, sizeGb int, desc string) (ICloudDisk, error)
|
||||
|
||||
GetIDiskById(idStr string) (ICloudDisk, error)
|
||||
@@ -200,8 +196,6 @@ type ICloudHost interface {
|
||||
GetIsMaintenance() bool
|
||||
GetVersion() string
|
||||
|
||||
GetManagerId() string
|
||||
|
||||
CreateVM(desc *SManagedVMCreateConfig) (ICloudVM, error)
|
||||
GetIHostNics() ([]ICloudHostNetInterface, error)
|
||||
}
|
||||
@@ -288,8 +282,6 @@ type ICloudEIP interface {
|
||||
|
||||
GetInternetChargeType() string
|
||||
|
||||
GetManagerId() string
|
||||
|
||||
Delete() error
|
||||
|
||||
Associate(instanceId string) error
|
||||
@@ -309,7 +301,6 @@ type ICloudSecurityGroup interface {
|
||||
|
||||
type ICloudRouteTable interface {
|
||||
ICloudResource
|
||||
GetManagerId() string
|
||||
|
||||
GetDescription() string
|
||||
GetRegionId() string
|
||||
@@ -380,8 +371,6 @@ type ICloudVpc interface {
|
||||
GetISecurityGroups() ([]ICloudSecurityGroup, error)
|
||||
GetIRouteTables() ([]ICloudRouteTable, error)
|
||||
|
||||
GetManagerId() string
|
||||
|
||||
Delete() error
|
||||
|
||||
GetIWireById(wireId string) (ICloudWire, error)
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/util/compare"
|
||||
"yunion.io/x/pkg/utils"
|
||||
@@ -328,7 +329,7 @@ func syncZoneStorages(ctx context.Context, userCred mcclient.TokenCredential, sy
|
||||
|
||||
func syncStorageCaches(ctx context.Context, userCred mcclient.TokenCredential, provider *SCloudprovider, localStorage *SStorage, remoteStorage cloudprovider.ICloudStorage) (cachePair sStoragecacheSyncPair) {
|
||||
remoteCache := remoteStorage.GetIStoragecache()
|
||||
localCache, isNew, err := StoragecacheManager.SyncWithCloudStoragecache(ctx, userCred, remoteCache)
|
||||
localCache, isNew, err := StoragecacheManager.SyncWithCloudStoragecache(ctx, userCred, remoteCache, provider)
|
||||
if err != nil {
|
||||
msg := fmt.Sprintf("SyncWithCloudStoragecache for storage %s failed %s", remoteStorage.GetName(), err)
|
||||
log.Errorf(msg)
|
||||
@@ -410,7 +411,7 @@ func syncHostStorages(ctx context.Context, userCred mcclient.TokenCredential, sy
|
||||
log.Errorf(msg)
|
||||
return nil
|
||||
}
|
||||
localStorages, remoteStorages, result := localHost.SyncHostStorages(ctx, userCred, storages)
|
||||
localStorages, remoteStorages, result := localHost.SyncHostStorages(ctx, userCred, storages, provider)
|
||||
|
||||
syncResults.Add(StorageManager, result)
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ func (manager *SElasticipManager) SyncEips(ctx context.Context, userCred mcclien
|
||||
}
|
||||
}
|
||||
for i := 0; i < len(added); i += 1 {
|
||||
new, err := manager.newFromCloudEip(ctx, userCred, added[i], region, ownerProjId)
|
||||
new, err := manager.newFromCloudEip(ctx, userCred, added[i], provider, region, ownerProjId)
|
||||
if err != nil {
|
||||
syncResult.AddError(err)
|
||||
} else {
|
||||
@@ -318,7 +318,6 @@ func (self *SElasticip) SyncWithCloudEip(ctx context.Context, userCred mcclient.
|
||||
self.Mode = ext.GetMode()
|
||||
self.Status = ext.GetStatus()
|
||||
self.ExternalId = ext.GetGlobalId()
|
||||
// self.ManagerId = ext.GetManagerId()
|
||||
self.IsEmulated = ext.IsEmulated()
|
||||
|
||||
self.ChargeType = ext.GetInternetChargeType()
|
||||
@@ -346,7 +345,7 @@ func (self *SElasticip) SyncWithCloudEip(ctx context.Context, userCred mcclient.
|
||||
return nil
|
||||
}
|
||||
|
||||
func (manager *SElasticipManager) newFromCloudEip(ctx context.Context, userCred mcclient.TokenCredential, extEip cloudprovider.ICloudEIP, region *SCloudregion, projectId string) (*SElasticip, error) {
|
||||
func (manager *SElasticipManager) newFromCloudEip(ctx context.Context, userCred mcclient.TokenCredential, extEip cloudprovider.ICloudEIP, provider *SCloudprovider, region *SCloudregion, projectId string) (*SElasticip, error) {
|
||||
eip := SElasticip{}
|
||||
eip.SetModelManager(manager)
|
||||
|
||||
@@ -360,7 +359,7 @@ func (manager *SElasticipManager) newFromCloudEip(ctx context.Context, userCred
|
||||
eip.IpAddr = extEip.GetIpAddr()
|
||||
eip.Mode = extEip.GetMode()
|
||||
eip.IsEmulated = extEip.IsEmulated()
|
||||
eip.ManagerId = extEip.GetManagerId()
|
||||
eip.ManagerId = provider.Id
|
||||
eip.CloudregionId = region.Id
|
||||
eip.ChargeType = extEip.GetInternetChargeType()
|
||||
|
||||
@@ -467,7 +466,7 @@ func (self *SElasticip) AssociateVM(ctx context.Context, userCred mcclient.Token
|
||||
return nil
|
||||
}
|
||||
|
||||
func (manager *SElasticipManager) getEipByExtEip(ctx context.Context, userCred mcclient.TokenCredential, extEip cloudprovider.ICloudEIP, region *SCloudregion, projectId string) (*SElasticip, error) {
|
||||
func (manager *SElasticipManager) getEipByExtEip(ctx context.Context, userCred mcclient.TokenCredential, extEip cloudprovider.ICloudEIP, provider *SCloudprovider, region *SCloudregion, projectId string) (*SElasticip, error) {
|
||||
eipObj, err := manager.FetchByExternalId(extEip.GetGlobalId())
|
||||
if err == nil {
|
||||
return eipObj.(*SElasticip), nil
|
||||
@@ -477,7 +476,7 @@ func (manager *SElasticipManager) getEipByExtEip(ctx context.Context, userCred m
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return manager.newFromCloudEip(ctx, userCred, extEip, region, projectId)
|
||||
return manager.newFromCloudEip(ctx, userCred, extEip, provider, region, projectId)
|
||||
}
|
||||
|
||||
func (manager *SElasticipManager) ValidateCreateData(ctx context.Context, userCred mcclient.TokenCredential, ownerProjId string, query jsonutils.JSONObject, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error) {
|
||||
|
||||
@@ -3804,7 +3804,7 @@ func (self *SGuest) SyncVMEip(ctx context.Context, userCred mcclient.TokenCreden
|
||||
// do nothing
|
||||
} else if eip == nil && extEip != nil {
|
||||
// add
|
||||
neip, err := ElasticipManager.getEipByExtEip(ctx, userCred, extEip, self.getRegion(), projectId)
|
||||
neip, err := ElasticipManager.getEipByExtEip(ctx, userCred, extEip, provider, self.getRegion(), projectId)
|
||||
if err != nil {
|
||||
log.Errorf("getEipByExtEip error %v", err)
|
||||
result.AddError(err)
|
||||
@@ -3835,7 +3835,7 @@ func (self *SGuest) SyncVMEip(ctx context.Context, userCred mcclient.TokenCreden
|
||||
result.DeleteError(err)
|
||||
} else {
|
||||
result.Delete()
|
||||
neip, err := ElasticipManager.getEipByExtEip(ctx, userCred, extEip, self.getRegion(), projectId)
|
||||
neip, err := ElasticipManager.getEipByExtEip(ctx, userCred, extEip, provider, self.getRegion(), projectId)
|
||||
if err != nil {
|
||||
result.AddError(err)
|
||||
} else {
|
||||
|
||||
@@ -1378,7 +1378,7 @@ func (manager *SHostManager) SyncHosts(ctx context.Context, userCred mcclient.To
|
||||
}
|
||||
}
|
||||
for i := 0; i < len(added); i += 1 {
|
||||
new, err := manager.newFromCloudHost(ctx, userCred, added[i], zone)
|
||||
new, err := manager.newFromCloudHost(ctx, userCred, added[i], provider, zone)
|
||||
if err != nil {
|
||||
syncResult.AddError(err)
|
||||
} else {
|
||||
@@ -1426,7 +1426,6 @@ func (self *SHost) syncWithCloudHost(ctx context.Context, userCred mcclient.Toke
|
||||
self.StorageType = extHost.GetStorageType()
|
||||
self.HostType = extHost.GetHostType()
|
||||
|
||||
self.ManagerId = extHost.GetManagerId()
|
||||
self.IsEmulated = extHost.IsEmulated()
|
||||
self.Enabled = extHost.GetEnabled()
|
||||
|
||||
@@ -1473,7 +1472,7 @@ func (self *SHost) syncWithCloudPrepaidVM(extVM cloudprovider.ICloudVM, host *SH
|
||||
return err
|
||||
}
|
||||
|
||||
func (manager *SHostManager) newFromCloudHost(ctx context.Context, userCred mcclient.TokenCredential, extHost cloudprovider.ICloudHost, izone *SZone) (*SHost, error) {
|
||||
func (manager *SHostManager) newFromCloudHost(ctx context.Context, userCred mcclient.TokenCredential, extHost cloudprovider.ICloudHost, provider *SCloudprovider, izone *SZone) (*SHost, error) {
|
||||
host := SHost{}
|
||||
host.SetModelManager(manager)
|
||||
|
||||
@@ -1516,7 +1515,7 @@ func (manager *SHostManager) newFromCloudHost(ctx context.Context, userCred mccl
|
||||
host.CpuCmtbound = 8.0
|
||||
host.MemCmtbound = 1.0
|
||||
|
||||
host.ManagerId = extHost.GetManagerId()
|
||||
host.ManagerId = provider.Id
|
||||
host.IsEmulated = extHost.IsEmulated()
|
||||
|
||||
host.IsMaintenance = extHost.GetIsMaintenance()
|
||||
@@ -1537,7 +1536,7 @@ func (manager *SHostManager) newFromCloudHost(ctx context.Context, userCred mccl
|
||||
return &host, nil
|
||||
}
|
||||
|
||||
func (self *SHost) SyncHostStorages(ctx context.Context, userCred mcclient.TokenCredential, storages []cloudprovider.ICloudStorage) ([]SStorage, []cloudprovider.ICloudStorage, compare.SyncResult) {
|
||||
func (self *SHost) SyncHostStorages(ctx context.Context, userCred mcclient.TokenCredential, storages []cloudprovider.ICloudStorage, provider *SCloudprovider) ([]SStorage, []cloudprovider.ICloudStorage, compare.SyncResult) {
|
||||
lockman.LockClass(ctx, StorageManager, StorageManager.GetOwnerId(userCred))
|
||||
defer lockman.ReleaseClass(ctx, StorageManager, StorageManager.GetOwnerId(userCred))
|
||||
|
||||
@@ -1594,7 +1593,7 @@ func (self *SHost) SyncHostStorages(ctx context.Context, userCred mcclient.Token
|
||||
|
||||
for i := 0; i < len(added); i += 1 {
|
||||
log.Infof("host %s is found connected with %s, to add ...", self.Id, added[i].GetId())
|
||||
local, err := self.newCloudHostStorage(ctx, userCred, added[i])
|
||||
local, err := self.newCloudHostStorage(ctx, userCred, added[i], provider)
|
||||
if err != nil {
|
||||
syncResult.AddError(err)
|
||||
} else {
|
||||
@@ -1656,13 +1655,13 @@ func (self *SHost) Attach2Storage(ctx context.Context, userCred mcclient.TokenCr
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *SHost) newCloudHostStorage(ctx context.Context, userCred mcclient.TokenCredential, extStorage cloudprovider.ICloudStorage) (*SStorage, error) {
|
||||
func (self *SHost) newCloudHostStorage(ctx context.Context, userCred mcclient.TokenCredential, extStorage cloudprovider.ICloudStorage, provider *SCloudprovider) (*SStorage, error) {
|
||||
storageObj, err := StorageManager.FetchByExternalId(extStorage.GetGlobalId())
|
||||
if err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
// no cloud storage found, this may happen for on-premise host
|
||||
// create the storage right now
|
||||
storageObj, err = StorageManager.newFromCloudStorage(ctx, userCred, extStorage, self.GetZone())
|
||||
storageObj, err = StorageManager.newFromCloudStorage(ctx, userCred, extStorage, provider, self.GetZone())
|
||||
if err != nil {
|
||||
log.Errorf("create by cloud storage fail %s", err)
|
||||
return nil, err
|
||||
|
||||
@@ -152,14 +152,14 @@ func (self *SStoragecache) getHostId() (string, error) {
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (manager *SStoragecacheManager) SyncWithCloudStoragecache(ctx context.Context, userCred mcclient.TokenCredential, cloudCache cloudprovider.ICloudStoragecache) (*SStoragecache, bool, error) {
|
||||
func (manager *SStoragecacheManager) SyncWithCloudStoragecache(ctx context.Context, userCred mcclient.TokenCredential, cloudCache cloudprovider.ICloudStoragecache, provider *SCloudprovider) (*SStoragecache, bool, error) {
|
||||
lockman.LockClass(ctx, manager, manager.GetOwnerId(userCred))
|
||||
defer lockman.ReleaseClass(ctx, manager, manager.GetOwnerId(userCred))
|
||||
|
||||
localCacheObj, err := manager.FetchByExternalId(cloudCache.GetGlobalId())
|
||||
if err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
localCache, err := manager.newFromCloudStoragecache(ctx, userCred, cloudCache)
|
||||
localCache, err := manager.newFromCloudStoragecache(ctx, userCred, cloudCache, provider)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
} else {
|
||||
@@ -171,12 +171,12 @@ func (manager *SStoragecacheManager) SyncWithCloudStoragecache(ctx context.Conte
|
||||
}
|
||||
} else {
|
||||
localCache := localCacheObj.(*SStoragecache)
|
||||
localCache.syncWithCloudStoragecache(ctx, userCred, cloudCache)
|
||||
localCache.syncWithCloudStoragecache(ctx, userCred, cloudCache, provider)
|
||||
return localCache, false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (manager *SStoragecacheManager) newFromCloudStoragecache(ctx context.Context, userCred mcclient.TokenCredential, cloudCache cloudprovider.ICloudStoragecache) (*SStoragecache, error) {
|
||||
func (manager *SStoragecacheManager) newFromCloudStoragecache(ctx context.Context, userCred mcclient.TokenCredential, cloudCache cloudprovider.ICloudStoragecache, provider *SCloudprovider) (*SStoragecache, error) {
|
||||
local := SStoragecache{}
|
||||
local.SetModelManager(manager)
|
||||
|
||||
@@ -188,7 +188,7 @@ func (manager *SStoragecacheManager) newFromCloudStoragecache(ctx context.Contex
|
||||
local.ExternalId = cloudCache.GetGlobalId()
|
||||
|
||||
local.IsEmulated = cloudCache.IsEmulated()
|
||||
local.ManagerId = cloudCache.GetManagerId()
|
||||
local.ManagerId = provider.Id
|
||||
|
||||
local.Path = cloudCache.GetPath()
|
||||
|
||||
@@ -202,14 +202,14 @@ func (manager *SStoragecacheManager) newFromCloudStoragecache(ctx context.Contex
|
||||
return &local, nil
|
||||
}
|
||||
|
||||
func (self *SStoragecache) syncWithCloudStoragecache(ctx context.Context, userCred mcclient.TokenCredential, cloudCache cloudprovider.ICloudStoragecache) error {
|
||||
func (self *SStoragecache) syncWithCloudStoragecache(ctx context.Context, userCred mcclient.TokenCredential, cloudCache cloudprovider.ICloudStoragecache, provider *SCloudprovider) error {
|
||||
diff, err := db.UpdateWithLock(ctx, self, func() error {
|
||||
self.Name = cloudCache.GetName()
|
||||
|
||||
self.Path = cloudCache.GetPath()
|
||||
|
||||
self.IsEmulated = cloudCache.IsEmulated()
|
||||
self.ManagerId = cloudCache.GetManagerId()
|
||||
self.ManagerId = provider.Id
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -652,7 +652,7 @@ func (manager *SStorageManager) SyncStorages(ctx context.Context, userCred mccli
|
||||
}
|
||||
}
|
||||
for i := 0; i < len(added); i += 1 {
|
||||
new, err := manager.newFromCloudStorage(ctx, userCred, added[i], zone)
|
||||
new, err := manager.newFromCloudStorage(ctx, userCred, added[i], provider, zone)
|
||||
if err != nil {
|
||||
syncResult.AddError(err)
|
||||
} else {
|
||||
@@ -694,7 +694,6 @@ func (self *SStorage) syncWithCloudStorage(ctx context.Context, userCred mcclien
|
||||
self.Enabled = extStorage.GetEnabled()
|
||||
|
||||
self.IsEmulated = extStorage.IsEmulated()
|
||||
self.ManagerId = extStorage.GetManagerId()
|
||||
|
||||
self.IsSysDiskStore = extStorage.IsSysDiskStore()
|
||||
|
||||
@@ -707,7 +706,7 @@ func (self *SStorage) syncWithCloudStorage(ctx context.Context, userCred mcclien
|
||||
return err
|
||||
}
|
||||
|
||||
func (manager *SStorageManager) newFromCloudStorage(ctx context.Context, userCred mcclient.TokenCredential, extStorage cloudprovider.ICloudStorage, zone *SZone) (*SStorage, error) {
|
||||
func (manager *SStorageManager) newFromCloudStorage(ctx context.Context, userCred mcclient.TokenCredential, extStorage cloudprovider.ICloudStorage, provider *SCloudprovider, zone *SZone) (*SStorage, error) {
|
||||
storage := SStorage{}
|
||||
storage.SetModelManager(manager)
|
||||
|
||||
@@ -728,7 +727,7 @@ func (manager *SStorageManager) newFromCloudStorage(ctx context.Context, userCre
|
||||
storage.Enabled = extStorage.GetEnabled()
|
||||
|
||||
storage.IsEmulated = extStorage.IsEmulated()
|
||||
storage.ManagerId = extStorage.GetManagerId()
|
||||
storage.ManagerId = provider.Id
|
||||
|
||||
storage.IsSysDiskStore = extStorage.IsSysDiskStore()
|
||||
|
||||
|
||||
@@ -297,7 +297,7 @@ func (manager *SVpcManager) SyncVPCs(ctx context.Context, userCred mcclient.Toke
|
||||
}
|
||||
}
|
||||
for i := 0; i < len(added); i += 1 {
|
||||
new, err := manager.newFromCloudVpc(ctx, userCred, added[i], region)
|
||||
new, err := manager.newFromCloudVpc(ctx, userCred, added[i], provider, region)
|
||||
if err != nil {
|
||||
syncResult.AddError(err)
|
||||
} else {
|
||||
@@ -348,7 +348,7 @@ func (self *SVpc) SyncWithCloudVpc(ctx context.Context, userCred mcclient.TokenC
|
||||
return nil
|
||||
}
|
||||
|
||||
func (manager *SVpcManager) newFromCloudVpc(ctx context.Context, userCred mcclient.TokenCredential, extVPC cloudprovider.ICloudVpc, region *SCloudregion) (*SVpc, error) {
|
||||
func (manager *SVpcManager) newFromCloudVpc(ctx context.Context, userCred mcclient.TokenCredential, extVPC cloudprovider.ICloudVpc, provider *SCloudprovider, region *SCloudregion) (*SVpc, error) {
|
||||
vpc := SVpc{}
|
||||
vpc.SetModelManager(manager)
|
||||
|
||||
@@ -363,7 +363,7 @@ func (manager *SVpcManager) newFromCloudVpc(ctx context.Context, userCred mcclie
|
||||
vpc.CidrBlock = extVPC.GetCidrBlock()
|
||||
vpc.CloudregionId = region.Id
|
||||
|
||||
vpc.ManagerId = extVPC.GetManagerId()
|
||||
vpc.ManagerId = provider.Id
|
||||
|
||||
vpc.IsEmulated = extVPC.IsEmulated()
|
||||
|
||||
|
||||
@@ -162,10 +162,6 @@ func (self *SEipAddress) GetAssociationExternalId() string {
|
||||
return self.InstanceId
|
||||
}
|
||||
|
||||
func (self *SEipAddress) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SEipAddress) GetBillingType() string {
|
||||
return convertChargeType(self.ChargeType)
|
||||
}
|
||||
|
||||
@@ -167,10 +167,6 @@ func (self *SHost) GetHostType() string {
|
||||
return api.HOST_TYPE_ALIYUN
|
||||
}
|
||||
|
||||
func (self *SHost) GetManagerId() string {
|
||||
return self.zone.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SHost) GetInstanceById(instanceId string) (*SInstance, error) {
|
||||
inst, err := self.zone.region.GetInstance(instanceId)
|
||||
if err != nil {
|
||||
|
||||
@@ -106,10 +106,6 @@ func (self *SRouteTable) GetGlobalId() string {
|
||||
return self.RouteTableId
|
||||
}
|
||||
|
||||
func (self *SRouteTable) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SRouteTable) GetName() string {
|
||||
return self.RouteTableName
|
||||
}
|
||||
|
||||
@@ -98,10 +98,6 @@ func (self *SStorage) GetStorageConf() jsonutils.JSONObject {
|
||||
return conf
|
||||
}
|
||||
|
||||
func (self *SStorage) GetManagerId() string {
|
||||
return self.zone.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SStorage) GetStatus() string {
|
||||
return api.STORAGE_ONLINE
|
||||
}
|
||||
|
||||
@@ -69,10 +69,6 @@ func (self *SStoragecache) IsEmulated() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (self *SStoragecache) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SStoragecache) fetchImages() error {
|
||||
images := make([]SImage, 0)
|
||||
for {
|
||||
|
||||
@@ -228,10 +228,6 @@ func (self *SVpc) GetIRouteTables() ([]cloudprovider.ICloudRouteTable, error) {
|
||||
return self.routeTables, nil
|
||||
}
|
||||
|
||||
func (self *SVpc) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SVpc) Delete() error {
|
||||
err := self.fetchSecurityGroups()
|
||||
if err != nil {
|
||||
|
||||
@@ -129,10 +129,6 @@ func (self *SEipAddress) GetInternetChargeType() string {
|
||||
return api.EIP_CHARGE_TYPE_BY_TRAFFIC
|
||||
}
|
||||
|
||||
func (self *SEipAddress) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SEipAddress) Delete() error {
|
||||
return self.region.DeallocateEIP(self.AllocationId)
|
||||
}
|
||||
|
||||
@@ -161,10 +161,6 @@ func (self *SHost) GetHostType() string {
|
||||
return api.HOST_TYPE_AWS
|
||||
}
|
||||
|
||||
func (self *SHost) GetManagerId() string {
|
||||
return self.zone.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SHost) GetInstanceById(instanceId string) (*SInstance, error) {
|
||||
inst, err := self.zone.region.GetInstance(instanceId)
|
||||
if err != nil {
|
||||
|
||||
@@ -99,10 +99,6 @@ func (self *SSnapshot) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *SSnapshot) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SSnapshot) GetSize() int32 {
|
||||
return self.SourceDiskSize
|
||||
}
|
||||
|
||||
@@ -111,10 +111,6 @@ func (self *SStorage) GetEnabled() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (self *SStorage) GetManagerId() string {
|
||||
return self.zone.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SStorage) CreateIDisk(name string, sizeGb int, desc string) (cloudprovider.ICloudDisk, error) {
|
||||
diskId, err := self.zone.region.CreateDisk(self.zone.ZoneId, self.storageType, name, sizeGb, "", desc)
|
||||
if err != nil {
|
||||
|
||||
@@ -97,10 +97,6 @@ func (self *SStoragecache) GetPath() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (self *SStoragecache) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SStoragecache) CreateIImage(snapshotId, imageName, osType, imageDesc string) (cloudprovider.ICloudImage, error) {
|
||||
imageId, err := self.region.createIImage(snapshotId, imageName, imageDesc)
|
||||
if err != nil {
|
||||
|
||||
@@ -125,10 +125,6 @@ func (self *SVpc) GetIRouteTables() ([]cloudprovider.ICloudRouteTable, error) {
|
||||
return rts, nil
|
||||
}
|
||||
|
||||
func (self *SVpc) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SVpc) Delete() error {
|
||||
// 删除vpc会同步删除关联的安全组
|
||||
return self.region.DeleteVpc(self.VpcId)
|
||||
|
||||
@@ -93,10 +93,6 @@ func (self *SClassicEipAddress) GetIpAddr() string {
|
||||
return self.Properties.IpAddress
|
||||
}
|
||||
|
||||
func (self *SClassicEipAddress) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SClassicEipAddress) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -179,10 +179,6 @@ func (self *SClassicHost) GetIWires() ([]cloudprovider.ICloudWire, error) {
|
||||
return self.zone.GetIClassicWires()
|
||||
}
|
||||
|
||||
func (self *SClassicHost) GetManagerId() string {
|
||||
return self.zone.region.client.providerId
|
||||
}
|
||||
|
||||
func (host *SClassicHost) GetIHostNics() ([]cloudprovider.ICloudHostNetInterface, error) {
|
||||
return nil, cloudprovider.ErrNotSupported
|
||||
}
|
||||
|
||||
@@ -80,10 +80,6 @@ func (self *SClassicSnapshot) GetDiskId() string {
|
||||
return self.diskID
|
||||
}
|
||||
|
||||
func (self *SClassicSnapshot) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SClassicSnapshot) GetRegionId() string {
|
||||
return self.region.GetId()
|
||||
}
|
||||
|
||||
@@ -112,10 +112,6 @@ func (self *SClassicStorage) GetIStoragecache() cloudprovider.ICloudStoragecache
|
||||
return self.zone.region.getStoragecache()
|
||||
}
|
||||
|
||||
func (self *SClassicStorage) GetManagerId() string {
|
||||
return self.zone.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SClassicStorage) GetMediumType() string {
|
||||
if strings.Contains(self.Properties.AccountType, "Premium") {
|
||||
return api.DISK_TYPE_SSD
|
||||
|
||||
@@ -192,10 +192,6 @@ func (self *SClassicVpc) GetIWires() ([]cloudprovider.ICloudWire, error) {
|
||||
return self.iwires, nil
|
||||
}
|
||||
|
||||
func (self *SClassicVpc) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SClassicVpc) GetRegion() cloudprovider.ICloudRegion {
|
||||
return self.region
|
||||
}
|
||||
|
||||
@@ -215,10 +215,6 @@ func (self *SEipAddress) GetIpAddr() string {
|
||||
return self.Properties.IPAddress
|
||||
}
|
||||
|
||||
func (self *SEipAddress) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SEipAddress) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -332,10 +332,6 @@ func (self *SHost) GetIWires() ([]cloudprovider.ICloudWire, error) {
|
||||
return self.zone.GetIWires()
|
||||
}
|
||||
|
||||
func (self *SHost) GetManagerId() string {
|
||||
return self.zone.region.client.providerId
|
||||
}
|
||||
|
||||
func (host *SHost) GetIHostNics() ([]cloudprovider.ICloudHostNetInterface, error) {
|
||||
return nil, cloudprovider.ErrNotSupported
|
||||
}
|
||||
|
||||
@@ -146,10 +146,6 @@ func (self *SStorage) GetIStoragecache() cloudprovider.ICloudStoragecache {
|
||||
return self.zone.region.getStoragecache()
|
||||
}
|
||||
|
||||
func (self *SStorage) GetManagerId() string {
|
||||
return self.zone.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SStorage) GetMediumType() string {
|
||||
if strings.HasPrefix(self.storageType, "premium") {
|
||||
return api.DISK_TYPE_SSD
|
||||
|
||||
@@ -75,10 +75,6 @@ func (self *SStoragecache) IsEmulated() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (self *SStoragecache) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SStoragecache) fetchImages() error {
|
||||
if images, err := self.region.GetImages(""); err != nil {
|
||||
return err
|
||||
|
||||
@@ -199,10 +199,6 @@ func (self *SVpc) GetIWires() ([]cloudprovider.ICloudWire, error) {
|
||||
return self.iwires, nil
|
||||
}
|
||||
|
||||
func (self *SVpc) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SVpc) GetRegion() cloudprovider.ICloudRegion {
|
||||
return self.region
|
||||
}
|
||||
|
||||
@@ -530,10 +530,6 @@ func (self *SHost) GetHostType() string {
|
||||
return api.HOST_TYPE_ESXI
|
||||
}
|
||||
|
||||
func (self *SHost) GetManagerId() string {
|
||||
return self.manager.providerId
|
||||
}
|
||||
|
||||
func (self *SHost) GetIsMaintenance() bool {
|
||||
moHost := self.getHostSystem()
|
||||
return moHost.Summary.Runtime.InMaintenanceMode
|
||||
|
||||
@@ -340,10 +340,6 @@ func (self *SDatastore) GetStorageConf() jsonutils.JSONObject {
|
||||
return conf
|
||||
}
|
||||
|
||||
func (self *SDatastore) GetManagerId() string {
|
||||
return self.manager.providerId
|
||||
}
|
||||
|
||||
const dsPrefix = "ds://"
|
||||
|
||||
func (self *SDatastore) GetUrl() string {
|
||||
|
||||
@@ -135,10 +135,6 @@ func (self *SDatastoreImageCache) GetIImageById(extId string) (cloudprovider.ICl
|
||||
return nil, cloudprovider.ErrNotFound
|
||||
}
|
||||
|
||||
func (self *SDatastoreImageCache) GetManagerId() string {
|
||||
return self.datastore.manager.providerId
|
||||
}
|
||||
|
||||
func (self *SDatastoreImageCache) CreateIImage(snapshotId, imageName, osType, imageDesc string) (cloudprovider.ICloudImage, error) {
|
||||
return nil, cloudprovider.ErrNotImplemented
|
||||
}
|
||||
|
||||
@@ -192,10 +192,6 @@ func (self *SEipAddress) GetInternetChargeType() string {
|
||||
}
|
||||
}
|
||||
|
||||
func (self *SEipAddress) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SEipAddress) GetBillingType() string {
|
||||
if self.Profile == nil {
|
||||
return billing_api.BILLING_TYPE_POSTPAID
|
||||
|
||||
@@ -164,10 +164,6 @@ func (self *SHost) GetVersion() string {
|
||||
return HUAWEI_API_VERSION
|
||||
}
|
||||
|
||||
func (self *SHost) GetManagerId() string {
|
||||
return self.zone.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SHost) GetInstanceById(instanceId string) (*SInstance, error) {
|
||||
instance, err := self.zone.region.GetInstanceByID(instanceId)
|
||||
if err != nil {
|
||||
|
||||
@@ -114,10 +114,6 @@ func (self *SStorage) GetEnabled() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (self *SStorage) GetManagerId() string {
|
||||
return self.zone.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SStorage) CreateIDisk(name string, sizeGb int, desc string) (cloudprovider.ICloudDisk, error) {
|
||||
diskId, err := self.zone.region.CreateDisk(self.zone.GetId(), self.storageType, name, sizeGb, "", desc)
|
||||
if err != nil {
|
||||
|
||||
@@ -115,10 +115,6 @@ func (self *SStoragecache) GetPath() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (self *SStoragecache) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
// 目前支持使用vhd、zvhd、vmdk、qcow2、raw、zvhd2、vhdx、qcow、vdi或qed格式镜像文件创建私有镜像。
|
||||
// 快速通道功能可快速完成镜像制作,但镜像文件需转换为raw或zvhd2格式并完成镜像优化。
|
||||
// https://support.huaweicloud.com/api-ims/zh-cn_topic_0083905788.html
|
||||
|
||||
@@ -170,10 +170,6 @@ func (self *SVpc) GetIRouteTables() ([]cloudprovider.ICloudRouteTable, error) {
|
||||
return rts, nil
|
||||
}
|
||||
|
||||
func (self *SVpc) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SVpc) Delete() error {
|
||||
// todo: 确定删除VPC的逻辑
|
||||
return self.region.DeleteVpc(self.GetId())
|
||||
|
||||
@@ -364,10 +364,6 @@ func (host *SHost) GetVersion() string {
|
||||
return version
|
||||
}
|
||||
|
||||
func (host *SHost) GetManagerId() string {
|
||||
return host.zone.region.client.providerID
|
||||
}
|
||||
|
||||
func (host *SHost) GetStatus() string {
|
||||
return api.HOST_STATUS_RUNNING
|
||||
}
|
||||
|
||||
@@ -93,10 +93,6 @@ func (storage *SStorage) GetStorageConf() jsonutils.JSONObject {
|
||||
return conf
|
||||
}
|
||||
|
||||
func (storage *SStorage) GetManagerId() string {
|
||||
return storage.zone.region.client.providerID
|
||||
}
|
||||
|
||||
func (storage *SStorage) GetStatus() string {
|
||||
return api.STORAGE_ONLINE
|
||||
}
|
||||
|
||||
@@ -65,10 +65,6 @@ func (cache *SStoragecache) IsEmulated() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (cache *SStoragecache) GetManagerId() string {
|
||||
return cache.region.client.providerID
|
||||
}
|
||||
|
||||
func (cache *SStoragecache) fetchImages() error {
|
||||
images, err := cache.region.GetImages("", ACTIVE, "")
|
||||
if err != nil {
|
||||
|
||||
@@ -189,10 +189,6 @@ func (vpc *SVpc) GetIWires() ([]cloudprovider.ICloudWire, error) {
|
||||
return vpc.iwires, nil
|
||||
}
|
||||
|
||||
func (vpc *SVpc) GetManagerId() string {
|
||||
return vpc.region.client.providerID
|
||||
}
|
||||
|
||||
func (vpc *SVpc) GetRegion() cloudprovider.ICloudRegion {
|
||||
return vpc.region
|
||||
}
|
||||
|
||||
@@ -148,10 +148,6 @@ func (self *SEipAddress) GetAssociationExternalId() string {
|
||||
return self.InstanceId
|
||||
}
|
||||
|
||||
func (self *SEipAddress) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SEipAddress) Delete() error {
|
||||
return self.region.DeallocateEIP(self.AddressId)
|
||||
}
|
||||
|
||||
@@ -288,10 +288,6 @@ func (self *SHost) GetIWires() ([]cloudprovider.ICloudWire, error) {
|
||||
return self.zone.GetIWires()
|
||||
}
|
||||
|
||||
func (self *SHost) GetManagerId() string {
|
||||
return self.zone.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SHost) GetSysInfo() jsonutils.JSONObject {
|
||||
info := jsonutils.NewDict()
|
||||
info.Add(jsonutils.NewString(CLOUD_PROVIDER_QCLOUD), "manufacture")
|
||||
|
||||
@@ -83,10 +83,6 @@ func (self *SLocalStorage) GetStorageConf() jsonutils.JSONObject {
|
||||
return conf
|
||||
}
|
||||
|
||||
func (self *SLocalStorage) GetManagerId() string {
|
||||
return self.zone.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SLocalStorage) GetStatus() string {
|
||||
return api.STORAGE_ONLINE
|
||||
}
|
||||
|
||||
@@ -173,10 +173,6 @@ func (self *SSnapshot) GetRegionId() string {
|
||||
return self.region.GetId()
|
||||
}
|
||||
|
||||
func (self *SSnapshot) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SSnapshot) GetSize() int32 {
|
||||
return self.DiskSize
|
||||
}
|
||||
|
||||
@@ -96,10 +96,6 @@ func (self *SStorage) GetStorageConf() jsonutils.JSONObject {
|
||||
return conf
|
||||
}
|
||||
|
||||
func (self *SStorage) GetManagerId() string {
|
||||
return self.zone.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SStorage) GetStatus() string {
|
||||
return api.STORAGE_ONLINE
|
||||
}
|
||||
|
||||
@@ -70,10 +70,6 @@ func (self *SStoragecache) IsEmulated() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (self *SStoragecache) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SStoragecache) CreateIImage(snapshoutId, imageName, osType, imageDesc string) (cloudprovider.ICloudImage, error) {
|
||||
// if imageId, err := self.region.createIImage(snapshoutId, imageName, imageDesc); err != nil {
|
||||
// return nil, err
|
||||
|
||||
@@ -159,10 +159,6 @@ func (self *SVpc) GetIWires() ([]cloudprovider.ICloudWire, error) {
|
||||
return self.iwires, nil
|
||||
}
|
||||
|
||||
func (self *SVpc) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SVpc) GetRegion() cloudprovider.ICloudRegion {
|
||||
return self.region
|
||||
}
|
||||
|
||||
@@ -189,10 +189,6 @@ func (self *SEip) GetInternetChargeType() string {
|
||||
}
|
||||
}
|
||||
|
||||
func (self *SEip) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SEip) Delete() error {
|
||||
return self.region.DeallocateEIP(self.GetId())
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/onecloud/pkg/util/billing"
|
||||
|
||||
@@ -165,10 +166,6 @@ func (self *SHost) GetVersion() string {
|
||||
return UCLOUD_API_VERSION
|
||||
}
|
||||
|
||||
func (self *SHost) GetManagerId() string {
|
||||
return self.zone.region.client.providerId
|
||||
}
|
||||
|
||||
// 不支持user data
|
||||
// 不支持指定keypair
|
||||
func (self *SHost) CreateVM(desc *cloudprovider.SManagedVMCreateConfig) (cloudprovider.ICloudVM, error) {
|
||||
|
||||
@@ -116,10 +116,6 @@ func (self *SStorage) GetEnabled() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (self *SStorage) GetManagerId() string {
|
||||
return self.zone.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SStorage) CreateIDisk(name string, sizeGb int, desc string) (cloudprovider.ICloudDisk, error) {
|
||||
diskId, err := self.zone.region.CreateDisk(self.zone.GetId(), self.storageType, name, sizeGb)
|
||||
if err != nil {
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"math"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/onecloud/pkg/compute/options"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/auth"
|
||||
@@ -106,10 +107,6 @@ func (self *SStoragecache) GetPath() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (self *SStoragecache) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SStoragecache) CreateIImage(snapshotId, imageName, osType, imageDesc string) (cloudprovider.ICloudImage, error) {
|
||||
return nil, cloudprovider.ErrNotSupported
|
||||
}
|
||||
|
||||
@@ -125,10 +125,6 @@ func (self *SVPC) GetIRouteTables() ([]cloudprovider.ICloudRouteTable, error) {
|
||||
return rts, nil
|
||||
}
|
||||
|
||||
func (self *SVPC) GetManagerId() string {
|
||||
return self.region.client.providerId
|
||||
}
|
||||
|
||||
func (self *SVPC) Delete() error {
|
||||
return self.region.DeleteVpc(self.GetId())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user