Bug 1721025 - User with edit permission cannot start/stop virtual machine
Summary: User with edit permission cannot start/stop virtual machine
Keywords:
Status: CLOSED DUPLICATE of bug 1720433
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: Virtualization
Version: 2.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Marc Sluiter
QA Contact: Israel Pinto
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-06-17 07:30 UTC by Guohua Ouyang
Modified: 2019-06-17 08:00 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-06-17 08:00:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Guohua Ouyang 2019-06-17 07:30:08 UTC
Description of problem:
User with edit permission cannot start/stop virtual machine, an interesting thing is 'oc auth can-i restart vm" is 'no', but virtctl restart vm is okay.

login a user just with edit permission.

[cnv-qe-jenkins@cnv-executor-ghua ~]$ oc auth can-i create vm
yes
[cnv-qe-jenkins@cnv-executor-ghua ~]$ oc auth can-i start vm
no
[cnv-qe-jenkins@cnv-executor-ghua ~]$ oc auth can-i restart vm
no
[cnv-qe-jenkins@cnv-executor-ghua ~]$ oc auth can-i stop vm
no
[cnv-qe-jenkins@cnv-executor-ghua ~]$ oc auth can-i delete vm
yes

[cnv-qe-jenkins@cnv-executor-ghua ~]$ oc create -f example.yaml 
virtualmachine.kubevirt.io/example created
[cnv-qe-jenkins@cnv-executor-ghua ~]$ virtctl start example
Error starting VirtualMachine virtualmachines.subresources.kubevirt.io "example" is forbidden: User "ghua" cannot update resource "virtualmachines/start" in API group "subresources.kubevirt.io" in the namespace "default"
[cnv-qe-jenkins@cnv-executor-ghua ~]$ oc patch vm example -p '{"spec":{"running":true}}' --type=merge
virtualmachine.kubevirt.io/example patched
[cnv-qe-jenkins@cnv-executor-ghua ~]$ oc get vm
NAME      AGE       RUNNING   VOLUME
example   3m19s     true      
[cnv-qe-jenkins@cnv-executor-ghua ~]$ virtctl stop example
Error stopping VirtualMachine virtualmachines.subresources.kubevirt.io "example" is forbidden: User "ghua" cannot update resource "virtualmachines/stop" in API group "subresources.kubevirt.io" in the namespace "default"
[cnv-qe-jenkins@cnv-executor-ghua ~]$ virtctl restart example
VM example was scheduled to restart
[cnv-qe-jenkins@cnv-executor-ghua ~]$ oc delete vm example
virtualmachine.kubevirt.io "example" deleted


Version-Release number of selected component (if applicable):
hco-26

How reproducible:
100%

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
This issue is for virt component, the issue for UI is: https://bugzilla.redhat.com/show_bug.cgi?id=1720603

Comment 1 Guohua Ouyang 2019-06-17 08:00:30 UTC

*** This bug has been marked as a duplicate of bug 1720433 ***


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