Skip to content

Commit

Permalink
fix timeout when stopping KVM machine with CRI-O container runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
prezha committed Oct 7, 2024
1 parent a0ea907 commit 76887a9
Show file tree
Hide file tree
Showing 3 changed files with 237 additions and 126 deletions.
10 changes: 7 additions & 3 deletions pkg/drivers/kvm/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
func (d *Driver) getDomain() (*libvirt.Domain, *libvirt.Connect, error) {
conn, err := getConnection(d.ConnectionURI)
if err != nil {
return nil, nil, errors.Wrap(err, "getting domain")
return nil, nil, errors.Wrap(err, "getting libvirt connection")
}

dom, err := conn.LookupDomainByName(d.MachineName)
Expand Down Expand Up @@ -71,9 +71,13 @@ func (d *Driver) createDomain() (*libvirt.Domain, error) {
}
conn, err := getConnection(d.ConnectionURI)
if err != nil {
return nil, errors.Wrap(err, "error getting libvirt connection")
return nil, errors.Wrap(err, "getting libvirt connection")
}
defer conn.Close()
defer func() {
if _, err := conn.Close(); err != nil {
log.Errorf("unable to close libvirt connection: %v", err)
}
}()

log.Infof("define libvirt domain using xml: %v", domainXML.String())
// define the domain in libvirt using the generated XML
Expand Down
Loading

0 comments on commit 76887a9

Please sign in to comment.