fix(host): start daemon guest on guest not running

Check guest status on Start daemon server.
StartGuest on guest status running will restart guest.

Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
This commit is contained in:
wanyaoqi
2023-03-02 17:30:25 +08:00
parent 06dfb5bbcb
commit c01580be7c
+3 -1
View File
@@ -607,7 +607,7 @@ func (s *SKVMGuestInstance) ImportServer(pendingDelete bool) {
s.manager.SaveServer(s.Id, s)
s.manager.RemoveCandidateServer(s)
if (s.IsDirtyShotdown() || s.IsDaemon()) && !pendingDelete {
if s.IsDirtyShotdown() && !pendingDelete {
log.Infof("Server dirty shutdown or a daemon %s", s.GetName())
if s.Desc.IsMaster || s.Desc.IsSlave ||
@@ -623,6 +623,8 @@ func (s *SKVMGuestInstance) ImportServer(pendingDelete bool) {
if !pendingDelete {
s.StartMonitor(context.Background(), nil)
}
} else if s.IsDaemon() {
s.StartGuest(context.Background(), nil, jsonutils.NewDict())
} else {
var action = "stopped"
if s.IsSuspend() {