aleph-vm icon indicating copy to clipboard operation
aleph-vm copied to clipboard

Shutdown an instance properly

Open hoh opened this issue 2 years ago • 1 comments

Program VMs are stopped using a custom message via the VSOCK connection to the custom init.

In the case of instances, this is not guaranteed to work as an agent is not required to run within the VM.

Firecracker provides a solution for x86 platforms: an action via the firecracker API that sends the Ctrl-Alt-Del command to the VM. This approach is not supported on arm64.

https://github.com/firecracker-microvm/firecracker/blob/main/docs/api_requests/actions.md#intel-and-amd-only-sendctrlaltdel

hoh avatar Jun 14 '23 17:06 hoh

Base for development:

        connector = aiohttp.UnixConnector(path=unix_socket)
        headers = {
            "accept": "application/json",
            "Content-Type": "application/json"
        }
        async with aiohttp.ClientSession(connector=connector) as session:
            async with session.put(f"/actions", json={"action_type": "SendCtrlAltDel"}, headers=headers) as response:
                response.raise_for_status()
                data = await response.json()
                print(data)

hoh avatar Jun 14 '23 17:06 hoh