mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
add verify server
This commit is contained in:
@@ -114,6 +114,7 @@ func (m *SGuestManager) OnVerifyExistingGuestsSucc(servers []jsonutils.JSONObjec
|
||||
} else {
|
||||
var unknownServerrs = make([]*SKVMGuestInstance, 0)
|
||||
for _, server := range m.CandidateServers {
|
||||
go server.RequestVerifyDirtyServer()
|
||||
log.Errorf("Server %s not found on this host", server.GetName())
|
||||
unknownServerrs = append(unknownServerrs, server)
|
||||
}
|
||||
|
||||
@@ -193,6 +193,18 @@ func (s *SKVMGuestInstance) DirtyServerRequestStart() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *SKVMGuestInstance) RequestVerifyDirtyServer() {
|
||||
hostId, _ := s.Desc.GetString("host_id")
|
||||
var body = jsonutils.NewDict()
|
||||
body.Set("guest_id", jsonutils.NewString(s.Id))
|
||||
body.Set("host_id", jsonutils.NewString(hostId))
|
||||
_, err := modules.Servers.PerformClassAction(
|
||||
hostutils.GetComputeSession(context.Background()), "dirty-server-verify", body)
|
||||
if err != nil {
|
||||
log.Errorf("Dirty server request start error: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Delay Process
|
||||
func (s *SKVMGuestInstance) asyncScriptStart(ctx context.Context, params interface{}) (jsonutils.JSONObject, error) {
|
||||
data, ok := params.(*jsonutils.JSONDict)
|
||||
@@ -273,7 +285,7 @@ func (s *SKVMGuestInstance) ImportServer(pendingDelete bool) {
|
||||
log.Infof("Server dirty shotdown %s", s.GetName())
|
||||
if jsonutils.QueryBoolean(s.Desc, "is_master", false) ||
|
||||
jsonutils.QueryBoolean(s.Desc, "is_slave", false) {
|
||||
s.DirtyServerRequestStart()
|
||||
go s.DirtyServerRequestStart()
|
||||
} else {
|
||||
s.StartGuest(context.Background(), jsonutils.NewDict())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user