Re: controlled shutdown of VMs by ups software, before shutting sown the host
- In reply to: Paul Vixie : "Re: controlled shutdown of VMs by ups software, before shutting sown the host"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 26 Oct 2026 22:36:24 UTC
On Oct 26, 2026, at 11:30 AM, Paul Vixie <paul@redbarn.org> wrote: > > On Monday, October 26, 2026 10:47:52 a.m. Pacific Daylight Time Bakul Shah wrote: > > On Oct 26, 2026, at 8:31 AM, Paul Vixie <paul@redbarn.org> wrote: > > > On Monday, October 26, 2026 5:21:11 a.m. Pacific Daylight Time void wrote: > > > > ... > > > > > > ... > > > > I believe this warrants a PR in the hope that this fixed up right! > > I think a general fix is impossible, since bhyve has insufficient insight as to what the guest is doing after the ACPI Poweroff signal is transmitted. The guest might use a little or a lot of CPU time, or do a little or a lot of I/O, and none of that can be taken as evidence that it should be allowed to keep doing whatever it's doing. And there's not going to be a way for bhyve to ask the host kernel to delay final shutdown, since the need for shutdown may be some emergency like power loss or thermal overrun. > > If we want our guests to end cleanly, ACPI is not the way to ask. > > A best efforts approach in the host shutdown path might be to wait some period like 30 seconds for all processes to be quiet (of both CPU and I/O), similarly to waiting for the number of dirty file system pages to reach zero. But sooner or later the time will run out. In this example, Void is talking about a UPS reaching its last 5% of capacity, and in my view, every guest kernel should be told about that, so that their own local policy can react to it. If the host power is lost, all bets are off but the more common case is orderly shutdown of the host. If this sends a virual ACPI poweroff signal (much like pressing the power button momentarily), this can be intercepted and used by the guest to do the equivalent of "poweroff". The host can wait for a certain amount of time for to complete. The exact same behavior (of sending an acpi event of momentary power button press) should also help the host shutdown in an orderly fashion. Similarly for other ACPI notify events such as suspend, resume etc.