From nobody Mon Apr 29 03:26:51 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511742217614457.28898692435746; Sun, 26 Nov 2017 16:23:37 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2E34C5F723; Mon, 27 Nov 2017 00:23:36 +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 20428600CA; Mon, 27 Nov 2017 00:23:35 +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 591F94A467; Mon, 27 Nov 2017 00:23:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAR0IQ1I010502 for ; Sun, 26 Nov 2017 19:18:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id F06ED600D5; Mon, 27 Nov 2017 00:18:26 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EBE30600CA for ; Mon, 27 Nov 2017 00:18:24 +0000 (UTC) Received: from mail-qt0-f195.google.com (mail-qt0-f195.google.com [209.85.216.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A3678356CA for ; Mon, 27 Nov 2017 00:18:23 +0000 (UTC) Received: by mail-qt0-f195.google.com with SMTP id d15so37082376qte.4 for ; Sun, 26 Nov 2017 16:18:23 -0800 (PST) Received: from localhost.localdomain ([187.107.182.187]) by smtp.googlemail.com with ESMTPSA id e69sm19040401qkj.52.2017.11.26.16.18.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 26 Nov 2017 16:18:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=f4j7JDJ7uap4FHBGAB8PUSFwAjoqXF2ftJiS9wMW9jc=; b=YZ41/BMsveocJhs1laj/00u1VRsYcyZOEe/DW3wKhUvzIARwtGlNP1M1fi0EuC6m+L xu21i7J/gY+XJYpZjJ1zrndtYgVB5aOtRByDM/aPotXNFCaPqvsABADH/OzLfL/PE49r SxhEWyimbjHduxKcnC3hBUrTfr1brbXo9nG5pbxEzwF/yMbawQjXLpyVB+jRn9saKnd5 OY60A43MEVRjYEOQME/w01f5H6GbdD4x8+F90luTi5ZPQsHfQqHO4RNqoPCPF7CGiR/k ZFHtN+Evvhdk3DZi/wXUe4ROg1c4COyxD147sKrWyAHt+kbu0KcrhDtCEQloQsQWYyKv peQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=f4j7JDJ7uap4FHBGAB8PUSFwAjoqXF2ftJiS9wMW9jc=; b=qZnr/YAZfKYvsC/izWoNGIuLeGUtKRyae01JDzWQ/bUde62Ty/bnhhTYyIHz3TsR9D qxMroyxztW3PS/tWMXHXveA73T+//BNEFwZsk2Yu4VKX8gkkmMeIzi0hSli1cj7QlbOS zQhvba3a2kzm8PMlw1aLQpqNW+dxICuwYiw7OdoASUAQfmSqz9baICRgMdMK0g5iBZtO D6H9+i2IZm0lCvv2/tYK/HRULxhPtj4K6uEsAZgU6C8sMB7VSEUDIZoF0iHmighy1W/m Xj5UUi56E4vc2VtQilPFciVbJx91jqEBe/iNqmeDoL8PYDEdsj+NahH+GLWQ1zDZ6lXz 5LFw== X-Gm-Message-State: AJaThX6cPQRpLw+NvSpUjA4fXCoN6i0WBGOXFdtSHqklbHZzKsxcGWGP YTffFbjBnzzaJQnwxsrR7rp48Q== X-Google-Smtp-Source: AGs4zMZqK/6OYuUmd3CWWAcDgFOBCZ40K69XDG74AlknCWg+dllJtKSAK8DVIrO7HQTWO8iRm91yuQ== X-Received: by 10.200.23.18 with SMTP id w18mr4084318qtj.47.1511741902549; Sun, 26 Nov 2017 16:18:22 -0800 (PST) From: Julio Faracco To: libvir-list@redhat.com Date: Sun, 26 Nov 2017 22:18:11 -0200 Message-Id: <1511741891-6539-1-git-send-email-jcfaracco@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 27 Nov 2017 00:18:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 27 Nov 2017 00:18:23 +0000 (UTC) for IP:'209.85.216.195' DOMAIN:'mail-qt0-f195.google.com' HELO:'mail-qt0-f195.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.13 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.216.195 mail-qt0-f195.google.com 209.85.216.195 mail-qt0-f195.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] virsh: fixing virsh prompt when connection changes to readonly mode. 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: , MIME-Version: 1.0 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 27 Nov 2017 00:23:36 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This commit, fixes the virsh prompt when reconnection to the same URI is called: `virsh # connect --readonly` (Reconnect). The problem is happening because the code is considering URI (name) as a mandatory parameter to chan= ge the prompt. This commit remove the assignment into `priv->readonly` from `if (name)` conditional. Before: virsh # uri qemu:///system virsh # connect --readonly virsh # After: virsh # uri qemu:///system virsh # connect --readonly virsh > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1507737 Signed-off-by: Julio Faracco Reviewed-by: Erik Skultety --- tools/virsh.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/virsh.c b/tools/virsh.c index d1789f0..89a2bea 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -251,8 +251,10 @@ virshReconnect(vshControl *ctl, const char *name, bool= readonly, bool force) if (name) { VIR_FREE(ctl->connname); ctl->connname =3D vshStrdup(ctl, name); - priv->readonly =3D readonly; } + + priv->readonly =3D readonly; + if (virConnectRegisterCloseCallback(priv->conn, virshCatchDisconne= ct, ctl, NULL) < 0) vshError(ctl, "%s", _("Unable to register disconnect callback"= )); --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list