Merge pull request #846 from wanyaoqi/bugfix/wyq/fix-host-on-start-failed

bugfix : fix guest on start failed no call task failed
This commit is contained in:
yunion-ci-robot
2019-05-17 14:36:18 +08:00
committed by GitHub
2 changed files with 8 additions and 4 deletions
+2 -1
View File
@@ -364,9 +364,10 @@ func (s *SGuestLiveMigrateTask) startMigrate(string) {
func (s *SGuestLiveMigrateTask) startMigrateStatusCheck(string) {
s.c = make(chan struct{})
for {
for s.c != nil {
select {
case <-s.c: // on c close
s.c = nil
break
case <-time.After(time.Second * 1):
s.Monitor.GetMigrateStatus(s.onGetMigrateStatus)
+6 -3
View File
@@ -273,7 +273,10 @@ func (s *SKVMGuestInstance) asyncScriptStart(ctx context.Context, params interfa
return nil, nil
} else {
log.Infof("Async start server %s failed: %s!!!", s.GetName(), err)
timeutils2.AddTimeout(100*time.Millisecond, s.SyncStatus)
if ctx != nil && len(appctx.AppContextTaskId(ctx)) >= 0 {
hostutils.TaskFailed(ctx, fmt.Sprintf("Async start server failed: %s", err))
}
s.SyncStatus()
return nil, err
}
}
@@ -750,10 +753,10 @@ func (s *SKVMGuestInstance) Stop() bool {
}
func (s *SKVMGuestInstance) scriptStart() error {
_, err := procutils.NewCommand("sh", s.GetStartScriptPath()).Run()
output, err := procutils.NewCommand("sh", s.GetStartScriptPath()).Run()
if err != nil {
s.scriptStop()
return err
return fmt.Errorf("Start VM Failed %s %s", output, err)
}
return nil
}