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

Support set deadline for qmp socket connection #206

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MaJin1996
Copy link

If some other process(e.g. libvirtd) occupy the qmp socket, run command will hang.

Sometimes we use go-qemu to take over VM when libvirtd stopped, but libvirtd service will start automatically at an undetermined time. Deadline could prevent the impact of race condition.

example:
`

socket, err := qmp.NewSocketMonitor("unix", sockFile, timeout)

if err != nil {
	return nil, err
}

if err := socket.SetRWDeadline(time.Now().Add(timeout)); err != nil {
	return nil, err
}

if err := socket.Connect(); err != nil {
	return nil, err
}
defer socket.Disconnect()

`

If some other process(e.g. libvirtd) occupy the qmp socket,
run command will hang.

Sometimes we use go-qemu to take over VM when libvirtd
stopped, but libvirtd service will start automatically at
an undetermined time. Deadline could prevent the impact of
race condition.
@MaJin1996 MaJin1996 requested a review from a team as a code owner October 7, 2023 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant