mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
fix(region): qcloud classic nic and storage sync
This commit is contained in:
@@ -1578,6 +1578,13 @@ func (manager *SDiskManager) newFromCloudDisk(ctx context.Context, userCred mccl
|
||||
|
||||
disk.IsEmulated = extDisk.IsEmulated()
|
||||
|
||||
if templateId := extDisk.GetTemplateId(); len(templateId) > 0 {
|
||||
cachedImage, err := db.FetchByExternalId(CachedimageManager, templateId)
|
||||
if err == nil && cachedImage != nil {
|
||||
disk.TemplateId = cachedImage.GetId()
|
||||
}
|
||||
}
|
||||
|
||||
if provider.GetFactory().IsSupportPrepaidResources() {
|
||||
disk.BillingType = extDisk.GetBillingType()
|
||||
if expired := extDisk.GetExpiredAt(); !expired.IsZero() {
|
||||
|
||||
@@ -222,6 +222,7 @@ func (self *SInstance) GetIDisks() ([]cloudprovider.ICloudDisk, error) {
|
||||
DiskSize: self.SystemDisk.DiskSize,
|
||||
DisktType: self.SystemDisk.DiskType,
|
||||
DiskUsage: "SYSTEM_DISK",
|
||||
imageId: self.ImageId,
|
||||
}
|
||||
idisks = append(idisks, &disk)
|
||||
}
|
||||
@@ -273,13 +274,23 @@ func (self *SInstance) GetINics() ([]cloudprovider.ICloudNic, error) {
|
||||
|
||||
nics []cloudprovider.ICloudNic
|
||||
)
|
||||
if classic {
|
||||
for _, ipAddr := range self.PrivateIpAddresses {
|
||||
nic := SInstanceNic{
|
||||
instance: self,
|
||||
ipAddr: ipAddr,
|
||||
classic: true,
|
||||
}
|
||||
nics = append(nics, &nic)
|
||||
}
|
||||
}
|
||||
client, err := region.client.getVpcClient(region.GetId())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req := qvpc.NewDescribeNetworkInterfacesRequest()
|
||||
req.Filters = []*qvpc.Filter{
|
||||
&qvpc.Filter{
|
||||
{
|
||||
Values: qcommon.StringPtrs([]string{self.InstanceId}),
|
||||
Name: qcommon.StringPtr("attachment.instance-id"),
|
||||
},
|
||||
|
||||
@@ -32,6 +32,7 @@ type SLocalDisk struct {
|
||||
DiskSize float32
|
||||
DisktType string
|
||||
DiskUsage string
|
||||
imageId string
|
||||
}
|
||||
|
||||
func (self *SLocalDisk) GetSysTags() map[string]string {
|
||||
@@ -112,7 +113,7 @@ func (self *SLocalDisk) Reset(ctx context.Context, snapshotId string) (string, e
|
||||
}
|
||||
|
||||
func (self *SLocalDisk) GetTemplateId() string {
|
||||
return ""
|
||||
return self.imageId
|
||||
}
|
||||
|
||||
func (self *SLocalDisk) GetStatus() string {
|
||||
|
||||
@@ -128,3 +128,7 @@ func (self *SLocalStorage) GetMountPoint() string {
|
||||
func (self *SLocalStorage) IsSysDiskStore() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (self *SLocalStorage) DisableSync() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -170,6 +170,12 @@ func (self *SZone) fetchStorages() error {
|
||||
storage := SLocalStorage{zone: self, storageType: localstorageType, available: true}
|
||||
self.istorages = append(self.istorages, &storage)
|
||||
}
|
||||
for _, storageType := range QCLOUD_LOCAL_STORAGE_TYPES {
|
||||
if !utils.IsInStringArray(storageType, self.localstorages) {
|
||||
storage := SLocalStorage{zone: self, storageType: storageType, available: false}
|
||||
self.istorages = append(self.istorages, &storage)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user