Skip to content

Commit

Permalink
Merge pull request kubevirt#2244 from vladikr/fix_launcher_panic
Browse files Browse the repository at this point in the history
fix virt-launcher panic after migration cancellation on crio
  • Loading branch information
davidvossel authored May 6, 2019
2 parents c0f9607 + 9470779 commit ad0f636
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 ad0f636

Please sign in to comment.