Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1138200

Summary: [engine-backend] [importDomain] removal of a template that was imported from a data domain and had additional disks from previous DC is blocked on CDA
Product: [Retired] oVirt Reporter: Elad <ebenahar>
Component: ovirt-engine-coreAssignee: Maor <mlipchuk>
Status: CLOSED CURRENTRELEASE QA Contact: Kevin Alon Goldblatt <kgoldbla>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.5CC: amureini, bugs, ebenahar, ecohen, gklein, iheim, rbalakri, yeylon
Target Milestone: ---   
Target Release: 3.5.0   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: ovirt-3.5.0_rc3 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-17 12:28:26 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:
Attachments:
Description Flags
engine.log none

Description Elad 2014-09-04 09:15:39 UTC
Created attachment 934333 [details]
engine.log

Description of problem:
I tried to remove a template that was imported from a data domain which was attached to another DC before. The template has disks from another storage domains from the previous DC. The removal failed in CDA although all its disks registration succeeded when it was imported the current DC.

Version-Release number of selected component (if applicable):
ovirt-3.5 RC1.1
ovirt-engine-3.5.0-0.0.master.20140821064931.gitb794d66.el6.noarch

How reproducible:
Always

Steps to Reproduce:
1. Have 2 DCs. One with 2 SDs (DC1) 
2. Create a VM on DC1 with 2 disks, each on a different domain. Create a template out of it
3. Detach one of the storage domains from DC1 and attach it to DC2
4. Import the template 
5. Try to remove the template

Actual results:
Template that has a disk which isn't part of the imported storage domain cannot be removed from the system

2014-09-04 11:56:57,690 WARN  [org.ovirt.engine.core.bll.RemoveVmTemplateCommand] (ajp--127.0.0.1-8702-8) [58816c91] CanDoAction of action RemoveVmTemplate failed. Reasons:VAR__
ACTION__REMOVE,VAR__TYPE__VM_TEMPLATE,ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST


Expected results:
If the template was successfully imported to the new DC with all its disks (even the one that are not part of the SD), its removal shouldn't be blocked.
This scenario is different from the one described in https://bugzilla.redhat.com/show_bug.cgi?id=1108904 because in my situation, the template was already imported to the DC.

Additional info: engine.log

Comment 1 Maor 2014-09-11 06:31:06 UTC
The template import should be blocked on VMT_CANNOT_IMPORT_TEMPLATE_EXISTS.

I tried to reproduce with following the steps, but on the template import I got the following failure : 
"Import Template failed - Template Id already exist in the system. Please remove the Template (templateCheck) from the system first"

How did you managed to import the Template?

Comment 2 Maor 2014-09-11 09:32:45 UTC
After talking with Elad, the reproduce steps should be as follow:
Steps to Reproduce:
1. Have 2 DCs. One with 2 SDs (DC1) 
2. Create a VM on DC1 with 2 disks, each on a different domain. Create a template out of it
3. Detach one of the storage domains from DC1 and attach it to DC2
4. Remove the template
5. Import the template to the new Data Center
6. Try to remove the template

The Template import should be blocked by CDA until all the Storage Domains will be attached to the new Data Center

Comment 3 Elad 2014-09-11 10:19:12 UTC
According to comment #2, removing the need-info flag

Comment 4 Sandro Bonazzola 2014-10-17 12:28:26 UTC
oVirt 3.5 has been released and should include the fix for this issue.