Bug 1518134

Summary: Cannot import VM from attached data storage domain
Product: [oVirt] ovirt-engine Reporter: Lilach Zitnitski <lzitnits>
Component: BLL.StorageAssignee: Maor <mlipchuk>
Status: CLOSED CURRENTRELEASE QA Contact: Lilach Zitnitski <lzitnits>
Severity: high Docs Contact:
Priority: urgent    
Version: 4.2.0CC: amureini, bugs, lzitnits, tnisan, ylavi
Target Milestone: ovirt-4.2.0Keywords: Regression
Target Release: ---Flags: rule-engine: ovirt-4.2+
rule-engine: blocker+
ylavi: planning_ack+
rule-engine: devel_ack+
ratamir: testing_ack+
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: 2017-12-20 11:23:50 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:
Embargoed:
Bug Depends On:    
Bug Blocks: 1138177    
Attachments:
Description Flags
logs none

Description Lilach Zitnitski 2017-11-28 10:00:00 UTC
Description of problem:
When attaching data storage domain to a dc and trying to import vms from it, it fails with error Cannot import VM. Storage Domain doesn't exist.

Version-Release number of selected component (if applicable):
ovirt-engine-4.2.0-0.0.master.20171124141652.gita5b4f9b.el7.centos.noarch
vdsm-4.20.8-29.git6ceb389.el7.centos.x86_64

How reproducible:
100%

Steps to Reproduce:
1. create vm with disk 
2. move to maintenance the storage domain where the vm's disk is located
3. deactivate and detach the storage domain 
4. attach to a different dc
5. try to import the vm 

Actual results:
Cannot import VM. Storage Domain doesn't exist.

Expected results:
VM is imported 

Additional info:

engine.log

2017-11-28 11:52:55,446+02 ERROR [org.ovirt.engine.core.bll.validator.ImportValidator] (default task-5) [46690cb5-5983-4278-acd2-3ca96933db4f] Storage Domain 'null' with id 'e84a4cb
4-19d2-4b45-b0e3-82aaee450f99', could not be found for disk alias 'vm1_Disk1' with image id '240a457e-4b8e-4bf4-975d-2e02fc166f7d'

Comment 1 Lilach Zitnitski 2017-11-28 10:00:51 UTC
Created attachment 1359761 [details]
logs

Comment 2 Maor 2017-11-28 16:14:43 UTC
This error means that the data center which the Template was registered from has not contained the storage domain which the VM was imported from.

I saw also the following comment:
  Entity 'golden_mixed_virtio_template' with id '8731b686-5242-4fbc-857c-cff0730d3280', already exists as unregistered entity. override it with the new entity from the engine

It means that there was an unregistered entity of that Template in the DB although this Template was already registered in the engine.
This is an inconsistent state, and we need to figure out how we got there in the first place.

It could happen in several use cases, the most common one is a Template which was registered to the setup only with part of its disks or part of its copies of the disk, using the partial_import flag.

Is there a chance to reproduce this and send the full engine log including the Template creation so we can analyze what was the use case

Comment 3 Lilach Zitnitski 2017-11-28 16:21:03 UTC
I will reproduce it and send full logs, but I have to add that I tried also to register VM I created from Blank template, and I still received the same error and the import vm failed.

Comment 4 Maor 2017-11-28 21:42:16 UTC
(In reply to Lilach Zitnitski from comment #3)
> I will reproduce it and send full logs, but I have to add that I tried also
> to register VM I created from Blank template, and I still received the same
> error and the import vm failed.

Thanks Lilach, I've eventually found the issue and sent a patch.
Thanks again for the help

Comment 5 Lilach Zitnitski 2017-12-07 09:39:17 UTC
--------------------------------------
Tested with the following code:
----------------------------------------
rhvm-4.2.0-0.6.el7.noarch
vdsm-4.20.9-1.el7ev.x86_64

Tested with the following scenario:

Steps to Reproduce:
1. create vm with disk 
2. move to maintenance the storage domain where the vm's disk is located
3. deactivate and detach the storage domain 
4. attach to a different dc
5. try to import the vm 


Actual results:
VM is imported

Expected results:

Moving to VERIFIED!

Comment 6 Sandro Bonazzola 2017-12-20 11:23:50 UTC
This bugzilla is included in oVirt 4.2.0 release, published on Dec 20th 2017.

Since the problem described in this bug report should be
resolved in oVirt 4.2.0 release, published on Dec 20th 2017, it has been closed with a resolution of CURRENT RELEASE.

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