Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
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.
Description of problem:
"virsh connect --readonly" enters readwrite mode when no name is given.
Version-Release number of selected component:
libvirt-3.1.0-2.el7.x86_64
How reproducible:
100%
Steps to Reproduce:
1. connect to default URI
# virsh "connect --readonly; start vm1"
Domain vm1 started
2. connect to specified URI
# virsh "connect qemu:///system --readonly; destroy vm1"
error: Failed to destroy domain vm1
error: operation forbidden: read only access prevents virDomainDestroy
Actual results:
"virsh connect --readonly" enters readwrite mode when no name is given.
Expected results:
In step1
# virsh "connect --readonly; start vm1"
error: Failed to start domain vm1
error: operation forbidden: read only access prevents virDomainCreate
virshReconnect uses the default readonly state in case when the URI is NULL
Comment 3Martin Kletzander
2017-08-18 14:40:51 UTC
Patch proposed upstream:
https://www.redhat.com/archives/libvir-list/2017-August/msg00529.html
I find these commands pretty nice for testing:
virsh "connect --readonly; start test; connect; start test"
virsh -r "connect; destroy test; connect qemu:///system; destroy test; connect --readonly; destroy test"
The output should report:
error: Failed to start domain test
error: operation forbidden: read only access prevents virDomainCreate
Domain test started
error: Failed to destroy domain test
error: operation forbidden: read only access prevents virDomainDestroy
Domain test destroyed
error: Failed to destroy domain test
error: operation forbidden: read only access prevents virDomainDestroy
Comment 4Martin Kletzander
2017-08-29 09:24:14 UTC
Fixed upstream with v3.6.0-228-g622ea8b6cfe8:
commit 622ea8b6cfe8d2d171064549b9f9c842b1fc38a8
Author: Martin Kletzander <mkletzan>
Date: Fri Aug 18 16:35:23 2017 +0200
virsh: Honour --readonly with cmdConnect and no name
# virsh
Welcome to virsh, the virtualization interactive terminal.
Type: 'help' for help with commands
'quit' to quit
virsh # connect --readonly
virsh # destroy rhel7.5
error: Failed to destroy domain rhel7.5
error: operation forbidden: read only access prevents virDomainDestroy
virsh #
The prompt doesn't change after changing the connection to readonly
Comment 8Martin Kletzander
2017-10-30 10:50:57 UTC
(In reply to Lili Zhu from comment #7)
Oh, ok, please create another BZ for that, thanks.
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/RHEA-2018:0704