Bug 869433 - [MLA] StorageAdmin can't attach disk.
Summary: [MLA] StorageAdmin can't attach disk.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: ---
Assignee: Nobody's working on this, feel free to take it
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-23 21:17 UTC by Ondra Machacek
Modified: 2012-10-24 11:46 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-10-24 02:16:59 UTC
oVirt Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Ondra Machacek 2012-10-23 21:17:34 UTC
Description of problem:


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

How reproducible:
always

Steps to Reproduce:
1. As admin create disk and vm without disk.
1. Add user StorageAdmin permissions on 'system' object.
2. As user try to attach disk to vm.
  
Actual results:
User is not authorized to perform this action.

Expected results:
Disk is attached.

Additional info:

2012-10-23 23:07:14,896 INFO  [org.ovirt.engine.core.bll.LoginAdminUserCommand] (ajp-/127.0.0.1:8009-18) Checking if user portaluser2 is an admin, result true
2012-10-23 23:07:14,896 INFO  [org.ovirt.engine.core.bll.LoginAdminUserCommand] (ajp-/127.0.0.1:8009-18) Running command: LoginAdminUserCommand internal: false.
2012-10-23 23:07:49,107 WARN  [org.ovirt.engine.core.bll.AttachDiskToVmCommand] (ajp-/127.0.0.1:8009-18) [33aeaa1f] CanDoAction of action AttachDiskToVm failed. Reasons:VAR__ACTION__ATTACH_ACTION_TO,VAR__TYPE__VM_DISK,USER_NOT_AUTHORIZED_TO_PERFORM_ACTION

Comment 1 Itamar Heim 2012-10-24 02:16:59 UTC
storage admin is allowed to manage storage domains, and disks. not VMs.
attaching/removing disks from VMs requires more permissions.
I don't see this as a bug.

Comment 2 Ondra Machacek 2012-10-24 11:17:39 UTC
So the backend shouldn't return that it can:

for r in API.roles.list():
    if r.get_name() == 'StorageAdmin':
        print 'attach_disk' in [p.get_name() for p in r.get_permits().list()]

>>> True

Comment 3 Oved Ourfali 2012-10-24 11:46:52 UTC
(In reply to comment #2)
> So the backend shouldn't return that it can:
> 
> for r in API.roles.list():
>     if r.get_name() == 'StorageAdmin':
>         print 'attach_disk' in [p.get_name() for p in r.get_permits().list()]
> 
> >>> True

That's true as well.
You need two permissions in order to attach a disk to a VM:
1. Permissions on the disk, that allows you to attach it - "ATTACH_DISK" on the disk.
2. Permissions on the VM, that allows you to configure storage for it - "CONFIGURE_VM_STORAGE".


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