From nobody Sun May 5 20:17:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=yadro.com ARC-Seal: i=1; a=rsa-sha256; t=1566394828; cv=none; d=zoho.com; s=zohoarc; b=ff30bGP9HRZhrFhvtPOmhTH2n5YUnwQ59BS8ltu6DxHRJupBOKM6wggcOnt+pzpa146tu1Ggk/WljjWQ1fdSckRcNALm8AkNzMT6hbBI7HRphb1OTAfdl6DXBr1OC841yrNulgIG7L8ccivAJ0aJjlZ6h1IYrLascqn920UEZRE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566394828; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=CFX4uPCwTKKH80AjgEy4YGERkIlC1gK2s72t5Sn0/t4=; b=lClB4yPei+xGnDiOV92Qu5807SjOchTHbIvLeseno9cZEEHmQZLdbRK1NNrYwYkm+aDkjv0YZlnjNkwy/8UixPgQzhqTYfej5lPI59Z9DT0AwTl5BvW4xwSQ0iF75xw0pvwh1Hjj85Iz6gL0fQuaDF0TY4ShHGFiPQUVWrlMmGo= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1566394827961606.5041439447103; Wed, 21 Aug 2019 06:40:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3750A195627B; Wed, 21 Aug 2019 13:40:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 84CE96D0BC; Wed, 21 Aug 2019 13:40:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1EBB62551D; Wed, 21 Aug 2019 13:40:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7LDeIBj009349 for ; Wed, 21 Aug 2019 09:40:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id C05145C25B; Wed, 21 Aug 2019 13:40:18 +0000 (UTC) Received: from mx1.redhat.com (ext-mx23.extmail.prod.ext.phx2.redhat.com [10.5.110.64]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BA5015C1D6; Wed, 21 Aug 2019 13:40:15 +0000 (UTC) Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5624A10576DF; Wed, 21 Aug 2019 13:40:14 +0000 (UTC) Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 4C5E742004; Wed, 21 Aug 2019 13:40:12 +0000 (UTC) Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id y4cMLqV0rKQp; Wed, 21 Aug 2019 16:40:11 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 06AB44120B; Wed, 21 Aug 2019 16:40:11 +0300 (MSK) Received: from localhost (172.17.128.60) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Wed, 21 Aug 2019 16:40:10 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :x-mailer:message-id:date:date:subject:subject:from:from :received:received:received; s=mta-01; t=1566394811; x= 1568209212; bh=mtTDUcKW+BL0D1ZzWlmbuRO1N43cEpF8/dpUS19Ndkg=; b=n SsF3i01txAIOlHZCLuZJHjKNJ3j+iG8jGeNacFoDPFC8I/MjxFpONJocKCXapV/0 TgPrz63Fu5RatvL9wHNz3CD0R0WNnI4wNIzRGvSL+rdzQiztLWKINLl1B1cubLN1 rGf0m9ItUOFWghssfT6V74eV4tN3mE0y1EzrukN20M= X-Virus-Scanned: amavisd-new at yadro.com From: Roman Bolshakov To: Date: Wed, 21 Aug 2019 16:33:18 +0300 Message-ID: <20190821133314.96107-1-r.bolshakov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [172.17.128.60] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) X-Greylist: Sender passed SPF test, ACL 264 matched, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.64]); Wed, 21 Aug 2019 13:40:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.64]); Wed, 21 Aug 2019 13:40:14 +0000 (UTC) for IP:'89.207.88.252' DOMAIN:'mta-02.yadro.com' HELO:'mta-01.yadro.com' FROM:'r.bolshakov@yadro.com' RCPT:'' X-RedHat-Spam-Score: -0.1 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_NONE, SPF_PASS) 89.207.88.252 mta-02.yadro.com 89.207.88.252 mta-02.yadro.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.64 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Michal Privoznik , Roman Bolshakov , Daniel Henrique Barboza , Nikolay Shirokovskiy Subject: [libvirt] [PATCH v3] tools: console: Relax stream EOF handling X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.62]); Wed, 21 Aug 2019 13:40:27 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Regular VM shutdown triggers the error for existing session of virsh console and it returns with non-zero exit code: error: internal error: console stream EOF The message and status code are misleading because there's no real error. virStreamRecv returns 0 correctly when EOF is reached. Existing implementations of esx, fd, and remote streams behave the same for virStreamFinish and virStreamAbort: they close the stream. So, we can continue to use virStreamAbort to handle EOF and errors from virStreamRecv but additonally we can report error if virStreamAbort fails. Fixes: 29f2b5248c6 ("tools: console: pass stream/fd errors to user") Signed-off-by: Roman Bolshakov Reviewed-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik Tested-by: Daniel Henrique Barboza --- tools/virsh-console.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/virsh-console.c b/tools/virsh-console.c index e16f841e57..a235a9a283 100644 --- a/tools/virsh-console.c +++ b/tools/virsh-console.c @@ -106,7 +106,9 @@ virConsoleShutdown(virConsolePtr con) =20 if (con->st) { virStreamEventRemoveCallback(con->st); - virStreamAbort(con->st); + if (virStreamAbort(con->st) < 0) + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot terminate console stream")); virStreamFree(con->st); con->st =3D NULL; } @@ -172,10 +174,6 @@ virConsoleEventOnStream(virStreamPtr st, if (got =3D=3D -2) goto cleanup; /* blocking */ if (got <=3D 0) { - if (got =3D=3D 0) - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("console stream EOF")); - virConsoleShutdown(con); goto cleanup; } --=20 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list