Skip to content

Commit

Permalink
fix virt-launcher panic after migration cancellation
Browse files Browse the repository at this point in the history
Signed-off-by: Vladik Romanovsky <[email protected]>
  • Loading branch information
vladikr committed May 3, 2019
1 parent 7ff1296 commit 9470779
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pkg/virt-launcher/virtwrap/cli/libvirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ func (l *LibvirtConnection) NewStream(flags libvirt.StreamFlags) (Stream, error)

func (l *LibvirtConnection) Close() (int, error) {
close(l.stop)
return l.Connect.Close()
if l.Connect != nil {
return l.Connect.Close()
} else {
return 0, nil
}
}

func (l *LibvirtConnection) DomainEventLifecycleRegister(callback libvirt.DomainEventLifecycleCallback) (err error) {
Expand Down Expand Up @@ -243,9 +247,12 @@ func (l *LibvirtConnection) installWatchdog(checkInterval time.Duration) {
return

case <-time.After(checkInterval):
l.reconnectIfNecessary()

alive, err := l.Connect.IsAlive()
var alive bool
var err error
err = l.reconnectIfNecessary()
if l.Connect != nil {
alive, err = l.Connect.IsAlive()
}

// If the connection is ok, continue
if alive {
Expand Down

0 comments on commit 9470779

Please sign in to comment.