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

Add alpine pause and alpine resume #126

Merged
merged 8 commits into from
Apr 17, 2023
Merged

Add alpine pause and alpine resume #126

merged 8 commits into from
Apr 17, 2023

Conversation

maxzinkus
Copy link
Collaborator

Support for pausing/unpausing instances using SIGSTOP and SIGCONT

  • alpine pause and alpine resume commands
  • show Paused in alpine list
  • logic in start, stop, and ssh to keep things coherent

@maxzinkus maxzinkus requested a review from idroz April 17, 2023 18:17
@maxzinkus
Copy link
Collaborator Author

Note that a paused VM will still take system resources, particularly, RAM.

@idroz
Copy link
Collaborator

idroz commented Apr 17, 2023

I've been looking into this recently, particularly at VM suspension, but haven't considered SIGSTOP approach.

My current thinking was to hook up to the QMP socket (socket file is created for each running VM inside VM's subdirectory) and issue a Stop command, but not sure if it's an overkill, particularly if it won't free up resources (need to investigate).

I'm not familiar enough with SIGSTOP. What would be the main use case here and are there any downsides?

@maxzinkus
Copy link
Collaborator Author

maxzinkus commented Apr 17, 2023

SIGSTOP suspends a process, stopping it from being scheduled onto the CPU. It keeps around all the resources (process table entry, VMM, etc) for immediate resumption with SIGCONT.

The guest will resume thinking no time has passed, so this could contribute to clock desync. We could throw a machineConfig.Exec("hwclock -s") in the resume flow?

In my mind, the use case is to free up host CPU cycles and power consumption without having to fully shut down.

@idroz
Copy link
Collaborator

idroz commented Apr 17, 2023

Cool - I think resume should have machineConfig.Exec("hwclock -s"), similar to alpine start. Would make it more seamless for the user

@maxzinkus
Copy link
Collaborator Author

Notably, (and I think this is kind of nice), it does not release the port bindings for hostfwd. That means we won't have weird bind crashes upon resume.

@idroz
Copy link
Collaborator

idroz commented Apr 17, 2023

Agreed - was playing around with the PR and spotted that - it is quite nice I think.

@maxzinkus
Copy link
Collaborator Author

maxzinkus commented Apr 17, 2023

Added the hwclock-resync, again with the assumption that the system time is the user's responsibility

@idroz
Copy link
Collaborator

idroz commented Apr 17, 2023

Nice - could you also run go run document.go inside /docs directory and commit changes into this PR - it'll update the main docs with the new CLI commands.

@maxzinkus
Copy link
Collaborator Author

Done! And thanks, I can do that in the future for PRs now that I know how :)

@maxzinkus maxzinkus self-assigned this Apr 17, 2023
@idroz idroz merged commit 1bbfb71 into beringresearch:main Apr 17, 2023
@maxzinkus maxzinkus deleted the pause-instance branch April 17, 2023 19:20
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.

2 participants