Add logic for virt-launcher to exit early when target pod is signaled to shutdown
@@ -221,6 +221,8 @@ func initializeDirs(virtShareDir string,
func waitForDomainUUID(timeout time.Duration, events chan watch.Event, stop chan struct{}, domainManager virtwrap.DomainManager) *api.Domain {
ticker := time.NewTicker(timeout).C
+ checkEarlyExit := time.NewTicker(time.Second * 2).C
+ for {
select {
case <-ticker:
panic(fmt.Errorf("timed out waiting for domain to be defined"))
@@ -237,8 +239,12 @@ func waitForDomainUUID(timeout time.Duration, events chan watch.Event, stop chan
}
case <-stop:
return nil
+ case <-checkEarlyExit:
+ if cmdserver.ReceivedEarlyExitSignal() {
+ panic(fmt.Errorf("received early exit signal"))
+ }
+ }
}
- return nil
}
func waitForFinalNotify(deleteNotificationSent chan watch.Event,
