Skip to content

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