crc-org / crc

CRC is a tool to help you run containers. It manages a local OpenShift 4.x cluster, Microshift or a Podman VM optimized for testing and development purposes
https://crc.dev
Apache License 2.0
1.25k stars 236 forks source link

Support for crc pause #3751

Open josecastillolema opened 1 year ago

josecastillolema commented 1 year ago

It would be great to implement support for pausing the CRC virtual machine. In development laptops, where CRC consumes a significant amount of resources/batteries, this would allow for an easy (and MUCH quicker than stop/start) pause/resume mechanism to interact with the local OCP environment. A couple of failed attempts to pause the VM form the virsh perspective:

❯ sudo virsh managedsave 1
error: Failed to save domain '1' state
error: Requested operation is not valid: cannot migrate domain: non-migratable device: 0000:00:02.0:00.0/vhost-user-fs

❯ sudo virsh dompmsuspend 1 disk
error: Domain 'crc' could not be suspended
error: argument unsupported: QEMU guest agent is not configured
gbraad commented 1 year ago

This might have unforeseen consequences of time-skew, possibly expired certificates, and who knows what else... plus not all hypervisors support this. We already have/had some issues on macOS when the machine went in suspend/hibernate and the cluster would not continue properly. though, at the moment I 'paused' my own Microshift VM using cockpit and see what happens when resumed. Also, not sure why but the guest agent does not start in the Microshift image. This I also noticed yesterday when debugging an issue around the startup phase.

cfergeau commented 1 year ago

Also, not sure why but the guest agent does not start in the Microshift image. This I also noticed yesterday when debugging an issue around the startup phase.

We configure qemu-guest-agent to use vsock for communication, but we don't add a vsock device to our VM at least on linux iirc, maybe this is what you saw.

gbraad commented 1 year ago

maybe this is what you saw.

Does this prevent the guest-agent from functioning properly, as the service on Linux-hosted VMs fails.

cfergeau commented 1 year ago

maybe this is what you saw.

Does this prevent the guest-agent from functioning properly, as the service on Linux-hosted VMs fails.

If you start the agent with --listen vsock://... but the VM does not support vsock devices, yes the guest agent will fail to start.

gbraad commented 1 year ago

Is there any other use of the guest-agent? if not, perhaps we have to remove it, or fix the start definition, as at the moment it shows 'degraded' as state from systemd.

cfergeau commented 1 year ago

The only user of qemu-guest-agent is macos timesync. With recent changes in snc, we could add it only to the macos bundle. On the other hand, should be a simple change to always add vsock to our VMs.

gbraad commented 11 months ago

similar tools do not provide a pause either; prefer to use stop and start (and the optimization could be to speed up the 'restart' process).