
-----Original Message----- From: Daniel P. Berrangé <berrange@redhat.com> Subject: Re: [PATCH rfcv3 10/11] virsh: add new option "timekeep" to keep virsh console alive
On Mon, Nov 27, 2023 at 04:55:20PM +0800, Zhenzhong Duan wrote:
From: Chenyi Qiang <chenyi.qiang@intel.com>
User can add a new option --timekeep to keep the virsh console alive for several seconds. Then it would try to reconnenct the same domain.
This option is mainly aimed to support hard reboot in Libvirt, which would kill the QEMU process and create a new one. The console would be lost due the destroy of QEMU. To make it user-friendly (avoid creating a new virsh console), a certain time waiting to reconnnect can be a solution. However, the procedure to destroy and create QEMU may take a while and the speciifc time can't be determined due to different situations. So, users can specify the waiting time (e.g. "virsh console domain --timekeep 2" will stay alive for 2 seconds), if timeout or fail to open the console, adjusting the waiting time can help.
I don't think we should be doing this with manually requested timeouts.
Agree it's tricky.
IIUC when we do the fake reboot, we should be emitting one or more domain events to show what's happening. virsh should listen for the events and just "do the right thing" with automatically reconnecting when it sees the reboot taking place.
Thanks for your suggestion, I'll dig into it. BRs. Zhenzhong