Bug 1396969

Summary: Diskless VM can be registered after re-attach storage domain to data-center
Product: [oVirt] ovirt-engine Reporter: Eyal Shenitzky <eshenitz>
Component: BLL.StorageAssignee: Maor <mlipchuk>
Status: CLOSED WONTFIX QA Contact: Raz Tamir <ratamir>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.0.6CC: amureini, bugs, eshenitz, tnisan, ylavi
Target Milestone: ---Keywords: Automation, Regression
Target Release: ---Flags: sbonazzo: ovirt-4.1-
sbonazzo: blocker-
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-27 15:34:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
engine logs none

Description Eyal Shenitzky 2016-11-21 10:05:40 UTC
Created attachment 1222354 [details]
engine logs

Description of problem:

In environment with more than one storage domain, and diskless VM.
After detaching one storage domain from the environment, the VM remain in the data-center but after the storage-domain attached back, the VM can be registered from it.

Version-Release number of selected component (if applicable):
Engine - 4.0.6-0.1.el7ev

How reproducible:
100%

Steps to Reproduce:
1. Create 2 storage-domains
2. Create a VM without disks
3. Detach one of the storage-domains
4. Attach the storage-domain from step 3 back to the data-center
5. Try to import the VM from step 2.
 
Actual results:
Failed to import the VM back since it's already exist

Expected results:
VM should not appear as available for registration. 

Additional info:
Engine logs attached

Comment 1 Maor 2016-12-25 00:00:44 UTC
Basically, we don't have any obligation not to show unregistered entities in a storage domain even if they are already registered in the system.
Looking at the code it looks like this was always worked like this (even with VMs containing disks on separate storage domains).
because of that reason I don't think it is a bug, although since you marked it as a regression I'm interesting to see what was the behavior before and when it was changed

Comment 2 Red Hat Bugzilla Rules Engine 2016-12-25 00:00:51 UTC
This bug report has Keywords: Regression or TestBlocker.
Since no regressions or test blockers are allowed between releases, it is also being identified as a blocker for this release. Please resolve ASAP.

Comment 3 Maor 2016-12-25 14:25:29 UTC
(In reply to Maor from comment #1)
> Basically, we don't have any obligation not to show unregistered entities in
> a storage domain even if they are already registered in the system.
> Looking at the code it looks like this was always worked like this (even
> with VMs containing disks on separate storage domains).
> because of that reason I don't think it is a bug, although since you marked
> it as a regression I'm interesting to see what was the behavior before and
> when it was changed

I think that we can remove this automatic test since I don't see any reason to filter out unregistered diskless vms.
The behavior should be consistent and unregistered entities should still get presented even if they are already registered in the engine.
The validation, how ever should block the entity from being registered twice.

Allon, is there any other reason you think we should filter out unregistered entities, or can we close this bug?

Comment 4 Yaniv Lavi 2016-12-27 15:34:20 UTC
As we consistent with unregistered vms behavior (diskless or not) and we don't have any RFE requesting filtering. I'm closing this won't fix.

Comment 5 Raz Tamir 2016-12-27 15:48:02 UTC
Eyal,
I remember you open this because the documentation says this should not be allowed.  Please refer to the place it is written so the documentation will change accordingly

Comment 6 Eyal Shenitzky 2017-01-04 07:26:18 UTC
http://www.ovirt.org/develop/release-management/features/engine/importunregisteredentities/ : 

 - On detach of Storage Domain the VMs/Templates related to the Storage Domain should be deleted from the engine, but their data will be converted to an XML data which will be preserved in a DB table called unregistered_ovf_of_entities, and will still be part of the OVF disk contained in the Storage Domain.

-> add that an exception about diskless VM, Stay at the engine after storage domain detached.

I didn't find any reference to VM without disks in the documentations.