Bug 1518459 - Add missing validations for affinity group, label, users and roles when registering a VM or a Template
Summary: Add missing validations for affinity group, label, users and roles when regis...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: Backend.Core
Version: 4.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ovirt-4.2.1
: ---
Assignee: Benny Zlotnik
QA Contact: Elad
URL:
Whiteboard: DR
Depends On:
Blocks: 1505419
TreeView+ depends on / blocked
 
Reported: 2017-11-28 23:46 UTC by Maor
Modified: 2018-02-12 11:56 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-02-12 11:56:56 UTC
oVirt Team: Storage
Embargoed:
rule-engine: ovirt-4.2+
ylavi: exception+


Attachments (Terms of Use)
verification screenshot (12.97 KB, image/png)
2018-02-01 14:17 UTC, Elad
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1505421 0 unspecified CLOSED DR (site to site) - Support affinity label related to a VM as part of the VM's OVF 2021-02-22 00:41:40 UTC
oVirt gerrit 84509 0 master MERGED core: validate affinity group when registering a VM 2018-01-10 09:47:00 UTC
oVirt gerrit 84864 0 master MERGED core: add validation for affinity label when registering VMs 2018-01-10 09:47:02 UTC
oVirt gerrit 84900 0 master MERGED core: validate users and roles 2018-01-10 09:47:06 UTC
oVirt gerrit 85241 0 master MERGED core: add auditlog when registering VM or template 2018-01-10 09:47:12 UTC

Internal Links: 1505421

Description Maor 2017-11-28 23:46:33 UTC
Description of problem:
As part of the DR site to site we added the ability to support other entity attributes such as permissions, affinity group and affinity labels.
All those properties are already part of the entity's OVF.
If some of those properties are missing like role or user, we simply register the entity without those properties.
We should add validations for those properties which will be validated as part of the entity registration process.
For example, we should check if user/role/affinity exists, if not the registration should fail unless the user will register the entity with the partial import flag.
The missing properties should be displayed in an audit log message

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


How reproducible:


Steps to Reproduce:
1. Create VM + Add it to an affinity group 
2. detach the storage domain the VM's disks are reside on
3. attach the storage domain to a new DC and register the VM

Actual results:
The VM will be registered without the affinity group

Expected results:
The VM should fail to be registered

Additional info:

Comment 1 Allon Mureinik 2017-11-29 07:30:22 UTC
Maor, the link to the patch seems to be broken - can you take a look please?

Comment 2 Yaniv Kaul 2017-11-29 13:16:42 UTC
Severity?

Comment 3 Elad 2018-02-01 11:18:14 UTC
Hi Benny, I can't see any audit message in case a user/role/affinity-group/label is missing in the DC/cluster where the VM is registered to, after this VM's storage domain was detached from a different DC.

Comment 4 Elad 2018-02-01 11:34:50 UTC
Tested with rhvm-4.2.1.4-0.1.el7.noarch

Comment 5 Elad 2018-02-01 12:00:38 UTC
No warning in audit log in Webadmin events is shown, it does in engine.log [1]. 
I think we should also have this logged in the Webadmin. 

Leaving the bug ON_QA for now. Allon/Benny, please add your input, thanks.



[1]

2018-02-01 13:55:57,602+02 WARN  [org.ovirt.engine.core.bll.validator.ImportValidator] (default task-5) [] Affinity group g1 for cluster id df476b9e-8c90-40ae-a9ea-a0ba5bbeaef9 does not match VM cluster id 72112289-46ee-4049-a7a4-bc9f90ac1145

Comment 6 Elad 2018-02-01 14:17:20 UTC
Created attachment 1389518 [details]
verification screenshot

As seen in the screenshot, in case an entity doesn't exist in the DC (such as affinity group or label), an event is shown in events tab in Webadmin along with log entry in engine.log:


2018-02-01 16:14:13,229+02 WARN  [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (EE-ManagedThreadFactory-engine-Thread-69063) [6df7d601-4341-4496-af31-677c1eb0daf4] EVENT_ID: IMPORTEXPORT
_PARTIAL_VM_MISSING_ENTITIES(1,188), The following entities could not be verified and will not be part of the imported VM test: 'Affinity groups: g1 Affinity labels: label Users: elad@internal-authz ' (User: adm
in@internal-authz)


Used rhvm-4.2.1.4-0.1.el7.noarch

Comment 7 Sandro Bonazzola 2018-02-12 11:56:56 UTC
This bugzilla is included in oVirt 4.2.1 release, published on Feb 12th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.1 release, it has been closed with a resolution of CURRENT RELEASE.

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


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