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

Bug 1328725

Summary: Re importing template version after the base template has changed fails
Product: [oVirt] ovirt-engine Reporter: sefi litmanovich <slitmano>
Component: BLL.VirtAssignee: Marek Libra <mlibra>
Status: CLOSED CURRENTRELEASE QA Contact: sefi litmanovich <slitmano>
Severity: medium Docs Contact:
Priority: high    
Version: 4.0.0CC: bugs, mgoldboi, michal.skrivanek, sbonazzo, tjelinek
Target Milestone: ovirt-4.0.4Flags: rule-engine: ovirt-4.0.z+
rule-engine: planning_ack+
rule-engine: devel_ack+
mavital: testing_ack+
Target Release: 4.0.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-26 12:31:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
engine log none

Description sefi litmanovich 2016-04-20 07:35:04 UTC
Created attachment 1148881 [details]
engine log

Description of problem:

In 4.0 a new feature is introduced that allows to remove the base/parent template of some template versions, this results with the next template version becoming the new 'base' template version: Bug 1194989 
A problem occurs when some template version e.g (3) was exported and later it's parent base template is removed. In that case if version (3) is removed as well and then we try to re import it from export domain (without cloning) the action fails with the message regarding missing base template in storage domain.
While this makes sense technically, this flow should be fix in such way that the new parent child relation between the new base template and version (3) will be reflected also in case of import/export. 

flow: create template 'test' -> create version (2) for template 'test' -> create version (3) for template 'test' -> export version (3) -> delete base version, now version (2) becomes base -> delete version (3) -> import version (3) from export domain (not clone): 
Result -> Cannot import the template because it's base version is missing. 

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

ovirt-engine-4.0.0-0.0.master.20160405102116.git3819ab7.el7.centos.noarch

How reproducible:
always

Steps to Reproduce:
1.create template 'test'.
2.create version (2) for template 'test'
3.create version (3) for template 'test'
4.export version (3)
5.delete base version -> now version (2) becomes base
6.delete version (3)
7.import version (3) from export domain (not clone)

Actual results:
Cannot import the template because it's base version is missing.

Expected results:
Import succeeds

Additional info:
Not much information in engine.log:

2016-04-20 10:31:14,403 WARN  [org.ovirt.engine.core.bll.exportimport.ImportVmTemplateCommand] (default task-11) [323cd52f] Validation of action 'ImportVmTemplate' failed for user admin@internal. Reasons: VAR__ACTION__IMPORT,VAR__TYPE__VM_TEMPLATE,VMT_CANNOT_IMPORT_TEMPLATE_VERSION_MISSING_BASE

Comment 1 Michal Skrivanek 2016-04-25 13:49:29 UTC
it should be imported as a standalone template then

Comment 2 Sandro Bonazzola 2016-05-02 09:47:12 UTC
Moving from 4.0 alpha to 4.0 beta since 4.0 alpha has been already released and bug is not ON_QA.

Comment 3 Marek Libra 2016-08-03 09:35:33 UTC
The bug was incorrectly switched to MODIFIED before backport by automation@.

Comment 4 Red Hat Bugzilla Rules Engine 2016-08-03 09:35:37 UTC
Target release should be placed once a package build is known to fix a issue. Since this bug is not modified, the target version has been reset. Please use target milestone to plan a fix for a oVirt release.

Comment 5 sefi litmanovich 2016-09-05 08:49:18 UTC
Verified with rhevm-4.0.4-0.1.el7ev.noarch -
Following the flow in bug description.
When trying to import the template without base, cloning is forced.