mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #10817 from rainzm/vmware/image_sync
fix(esxi): prevent fake template and real template from duplication
This commit is contained in:
@@ -577,6 +577,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) {
|
||||
log.Debugf("syncStorageCaches for storage %s", localStorage.GetId())
|
||||
remoteCache := remoteStorage.GetIStoragecache()
|
||||
if remoteCache == nil {
|
||||
log.Errorf("remote storageCache is nil")
|
||||
@@ -1343,7 +1344,7 @@ func syncOnPremiseCloudProviderInfo(
|
||||
result := storageCachePairs[i].syncCloudImages(ctx, userCred)
|
||||
syncResults.Add(StoragecachedimageManager, result)
|
||||
msg := result.Result()
|
||||
log.Infof("syncCloudImages result: %s", msg)
|
||||
log.Infof("syncCloudImages for stroagecache %s result: %s", storageCachePairs[i].local.GetId(), msg)
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,6 +292,7 @@ func (self *SDatastore) FetchFakeTempateVMById(id string, regex string) (*SVirtu
|
||||
filter["summary.config.uuid"] = uuid
|
||||
filter["datastore"] = mods.Reference()
|
||||
filter["summary.runtime.powerState"] = types.VirtualMachinePowerStatePoweredOff
|
||||
filter["config.template"] = false
|
||||
movms, err := self.datacenter.fetchMoVms(filter, []string{"name"})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "unable to fetch mo.VirtualMachines")
|
||||
@@ -311,6 +312,7 @@ func (self *SDatastore) FetchFakeTempateVMs(regex string) ([]*SVirtualMachine, e
|
||||
filter := property.Filter{}
|
||||
filter["datastore"] = mods.Reference()
|
||||
filter["summary.runtime.powerState"] = types.VirtualMachinePowerStatePoweredOff
|
||||
filter["config.template"] = false
|
||||
movms, err := self.datacenter.fetchMoVms(filter, []string{"name"})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "unable to fetch mo.VirtualMachines")
|
||||
|
||||
@@ -173,8 +173,13 @@ func (self *SDatastoreImageCache) GetIImageInTemplateVMs() ([]cloudprovider.IClo
|
||||
}
|
||||
|
||||
log.Infof("get templates successfully")
|
||||
log.Debugf("fake template name: ")
|
||||
for i := range fakeTemplates {
|
||||
log.Infof("fake template name: %s", fakeTemplates[i].GetName())
|
||||
log.Debugf("%s ", fakeTemplates[i].GetName())
|
||||
}
|
||||
log.Debugf("real template name: ")
|
||||
for i := range realTemplates {
|
||||
log.Debugf("%s ", realTemplates[i].GetName())
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user