Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix timeout when stopping KVM machine with CRI-O container runtime #19758

Merged
merged 5 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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