RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1507737 - virsh prompt doesn't change after changing the connection to readonly
Summary: virsh prompt doesn't change after changing the connection to readonly
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.5
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Libvirt Maintainers
QA Contact: Meina Li
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-10-31 03:24 UTC by Lili Zhu
Modified: 2018-10-30 09:51 UTC (History)
7 users (show)

Fixed In Version: libvirt-4.3.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 09:50:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:3113 0 None None None 2018-10-30 09:51:23 UTC

Description Lili Zhu 2017-10-31 03:24:33 UTC
Description of problem:
virsh prompt doesn't change after changing the connection to readonly

Version-Release number of selected component (if applicable):
libvirt-3.8.0-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:

Firstly, connect to libvirtd in read-write mode. Then change the connection
to read-only mode:

# virsh 
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # list --all
 Id    Name                           State
----------------------------------------------------
 8     rhel7.5                        running

virsh # connect --readonly

virsh # destroy rhel7.5               <========the prompt does NOT change
error: Failed to destroy domain rhel7.5
error: operation forbidden: read only access prevents virDomainDestroy

virsh # 


Actual results:
The prompt doesn't change after changing the connection to readonly

Expected results:
The prompt should change to ">" after changing the connection to readonly

Additional info:

Comment 2 Julio Faracco 2017-11-26 22:52:11 UTC
Another test case that works:

virsh # uri
qemu:///system

virsh # connect qemu:///system --readonly     # simulate a re-connection.

virsh >

Comment 3 Erik Skultety 2017-11-27 09:22:09 UTC
Fixed upstream by:

commit 13d45b0dc25ed99a9da0704d01cf21c8fe99f951 (HEAD -> master, origin/master, origin/HEAD, virsh-connect-readonly)
Author:     Julio Faracco <jcfaracco>
AuthorDate: Sun Nov 26 22:18:11 2017 -0200
Commit:     Erik Skultety <eskultet>
CommitDate: Mon Nov 27 10:12:30 2017 +0100

    virsh: Fix virsh prompt when connection changes to readonly mode.
    
    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 change 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=1507737
    
    Signed-off-by: Julio Faracco <jcfaracco>
    Reviewed-by: Erik Skultety <eskultet>

Comment 5 Meina Li 2018-06-22 02:23:48 UTC
Verified on libvirt-4.4.0-2.virtcov.el7.x86_64 and qemu-kvm-rhev-2.12.0-4.el7.x86_64.

Steps:
# virsh 
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # list --all
 Id    Name                           State
----------------------------------------------------
 21    ovmf                           running
 -     lmn                            shut off

virsh # uri
qemu:///system

virsh # connect --readonly

virsh > 
virsh > list --all
 Id    Name                           State
----------------------------------------------------
 21    ovmf                           running
 -     lmn                            shut off

virsh > destroy ovmf
error: Failed to destroy domain ovmf
error: operation forbidden: read only access prevents virDomainDestroy

All the results are expected, so change the status to verified.

Comment 7 errata-xmlrpc 2018-10-30 09:50:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:3113


Note You need to log in before you can comment on or make changes to this bug.