Merge pull request #18097 from wanyaoqi/automated-cherry-pick-of-#18096-upstream-release-3.11

Automated cherry pick of #18096: Fix/backup guest prelaunch
This commit is contained in:
Zexi Li
2023-09-21 22:43:58 +08:00
committed by GitHub
2 changed files with 21 additions and 19 deletions
+12 -10
View File
@@ -2447,18 +2447,20 @@ func (s *SKVMGuestInstance) doBlockIoThrottle() {
func (s *SKVMGuestInstance) onGuestPrelaunch() error {
s.LiveMigrateDestPort = nil
if options.HostOptions.SetVncPassword {
s.SetVncPassword()
}
if s.isMemcleanEnabled() {
if err := s.startMemCleaner(); err != nil {
return err
if !s.Desc.IsSlave {
if options.HostOptions.SetVncPassword {
s.SetVncPassword()
}
if s.isMemcleanEnabled() {
if err := s.startMemCleaner(); err != nil {
return err
}
}
s.OnResumeSyncMetadataInfo()
s.GuestPrelaunchSetCgroup()
s.optimizeOom()
s.doBlockIoThrottle()
}
s.OnResumeSyncMetadataInfo()
s.GuestPrelaunchSetCgroup()
s.optimizeOom()
s.doBlockIoThrottle()
return nil
}
+9 -9
View File
@@ -1305,16 +1305,16 @@ func (h *SHostInfo) ensureHostRecord(zoneId string) (*api.HostDetails, error) {
h.Domain_id = hosts[0].DomainId
h.HostId = hosts[0].Id
h.Project_domain = strings.ReplaceAll(hosts[0].ProjectDomain, " ", "+")
}
// 上次未能正常offline, 补充一次健康日志
if hosts[0].HostStatus == api.HOST_ONLINE {
reason := fmt.Sprintf("The host status is online when it staring. Maybe the control center was down earlier")
logclient.AddSimpleActionLog(h, logclient.ACT_HEALTH_CHECK, map[string]string{"reason": reason}, hostutils.GetComputeSession(context.Background()).GetToken(), false)
data := jsonutils.NewDict()
data.Add(jsonutils.NewString(h.GetName()), "name")
data.Add(jsonutils.NewString(reason), "message")
notifyclient.SystemExceptionNotify(context.TODO(), napi.ActionSystemException, napi.TOPIC_RESOURCE_HOST, data)
// 上次未能正常offline, 补充一次健康日志
if hosts[0].HostStatus == api.HOST_ONLINE {
reason := fmt.Sprintf("The host status is online when it staring. Maybe the control center was down earlier")
logclient.AddSimpleActionLog(h, logclient.ACT_HEALTH_CHECK, map[string]string{"reason": reason}, hostutils.GetComputeSession(context.Background()).GetToken(), false)
data := jsonutils.NewDict()
data.Add(jsonutils.NewString(h.GetName()), "name")
data.Add(jsonutils.NewString(reason), "message")
notifyclient.SystemExceptionNotify(context.TODO(), napi.ActionSystemException, napi.TOPIC_RESOURCE_HOST, data)
}
}
return h.updateOrCreateHost(h.HostId)