mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
冲突解决
This commit is contained in:
@@ -114,6 +114,18 @@ func (self *SCloudprovider) ValidateDeleteCondition(ctx context.Context) error {
|
||||
return self.SEnabledStatusStandaloneResourceBase.ValidateDeleteCondition(ctx)
|
||||
}
|
||||
|
||||
func (self *SCloudprovider) CleanSchedCache() {
|
||||
hosts := []SHost{}
|
||||
q := HostManager.Query().Equals("manager_id", self.Id)
|
||||
if err := db.FetchModelObjects(HostManager, q, &hosts); err != nil {
|
||||
log.Errorf("failed to get hosts for cloudprovider %s error: %v", self.Name, err)
|
||||
return
|
||||
}
|
||||
for _, host := range hosts {
|
||||
host.ClearSchedDescCache()
|
||||
}
|
||||
}
|
||||
|
||||
func (self *SCloudprovider) GetGuestCount() int {
|
||||
sq := HostManager.Query("id").Equals("manager_id", self.Id)
|
||||
return GuestManager.Query().In("host_id", sq).Count()
|
||||
|
||||
@@ -80,6 +80,7 @@ func (self *CloudProviderSyncInfoTask) OnInit(ctx context.Context, obj db.IStand
|
||||
}
|
||||
|
||||
provider.SetStatus(self.UserCred, models.CLOUD_PROVIDER_CONNECTED, "")
|
||||
provider.CleanSchedCache()
|
||||
self.SetStageComplete(ctx, nil)
|
||||
logclient.AddActionLog(provider, getAction(self.Params), body, self.UserCred, true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user