[libvirt] [PATCH] virsh: Allow graceful console shutdown
Michal Privoznik
mprivozn at redhat.com
Mon Aug 26 07:12:07 UTC 2019
On 8/23/19 7:40 PM, Roman Bolshakov wrote:
> On Fri, Aug 23, 2019 at 03:33:36PM +0200, Michal Privoznik wrote:
>> Currently, whenever there's a regular EOF on the console stream
>> or an error the virStreamAbort() is called regardless. While this
>> may not actually break anything, we should call virStreamFinish()
>> to let the daemon know we've successfully received all the data
>> and are shutting down the stream gracefully.
>>
>> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>> ---
>> tools/virsh-console.c | 41 +++++++++++++++++++++++++----------------
>> 1 file changed, 25 insertions(+), 16 deletions(-)
>>
>> diff --git a/tools/virsh-console.c b/tools/virsh-console.c
>> index a235a9a283..900faa5087 100644
>> --- a/tools/virsh-console.c
>> +++ b/tools/virsh-console.c
>> @@ -193,7 +202,7 @@ virConsoleEventOnStream(virStreamPtr st,
>> if (done == -2)
>> goto cleanup; /* blocking */
>> if (done < 0) {
>> - virConsoleShutdown(con);
>> + virConsoleShutdown(con, done == 0);
>> goto cleanup;
>> }
>> memmove(con->terminalToStream.data,
>
> done is always non-zero here. If that's expected, a constant would be a
> bit more cleaner here to sign explicit abort, rather than conditional.
Ah, good point.
>
> Reviewed-by: Roman Bolshakov <r.bolshakov at yadro.com>
>
Thanks, I've pushed this.
Michal
More information about the libvir-list
mailing list