Bug 1506092

Summary: Disks and interfaces don't appear in VM's snapshots
Product: [oVirt] ovirt-engine Reporter: Michael Burman <mburman>
Component: BLL.StorageAssignee: Maor <mlipchuk>
Status: CLOSED CURRENTRELEASE QA Contact: Raz Tamir <ratamir>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 4.2.0CC: amureini, bugs
Target Milestone: ovirt-4.2.0Keywords: Regression
Target Release: ---Flags: rule-engine: ovirt-4.2+
rule-engine: blocker+
Hardware: x86_64   
OS: Linux   
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:20:04 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 Michael Burman 2017-10-25 06:03:54 UTC
Description of problem:
Snapshot preview removes VM's origin disks.

After performing a snapshot preview, the VM's origin disks are gone

Version-Release number of selected component (if applicable):
4.2.0-0.0.master.20171024223752.gite85d7f2.el7.centos

How reproducible:
100%

Steps to Reproduce:
1. Create snapshot for VM with disk/s
2. Preview snapshot

Actual results:
The disk/s are removed

Expected results:
Disks to remain

Comment 1 Michael Burman 2017-10-25 06:06:32 UTC
After undo, the VM remains with no disks and non-operational

Comment 2 Michael Burman 2017-10-25 06:07:58 UTC
Created attachment 1343095 [details]
engine log

Comment 3 Michael Burman 2017-10-25 06:26:21 UTC
The root issue here is that the snapshot created without the VM's disks and without the VM's network interfaces.
In the bottom line, when creating a snaphsot, it contains no disks and no networks cards.
Doing undo will leave the VM completely non-operational.

Comment 4 Allon Mureinik 2017-10-25 09:36:18 UTC
Maor, this bug was introduced here:

https://gerrit.ovirt.org/#/c/82429/18/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/snapshots/SnapshotsManager.java (see line 616)

You're creating an empty ArrayList, and then iterate it, which of course does nothing, whereas the original implementation of ovfManager.importVm before the patch received this List and populated it before iterating it.

Please address this ASAP.

Comment 5 Tal Nisan 2017-10-25 10:14:37 UTC
Note that the same problem exists here:

https://gerrit.ovirt.org/#/c/82429/18/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/disk/image/ImagesHandler.java (line 765)

Line 766 should be changed to fullEntityOvfData.setDiskImages(fullEntityOvfData.getDiskImages());

Comment 6 Maor 2017-10-25 11:30:00 UTC
(In reply to Tal Nisan from comment #5)
> Note that the same problem exists here:
> 
> https://gerrit.ovirt.org/#/c/82429/18/backend/manager/modules/bll/src/main/
> java/org/ovirt/engine/core/bll/storage/disk/image/ImagesHandler.java (line
> 765)
> 
> Line 766 should be changed to
> fullEntityOvfData.setDiskImages(fullEntityOvfData.getDiskImages());

That is not a bug since we already set this list in line 766:
  fullEntityOvfData.setDiskImages(snapshotImages);

Comment 7 Maor 2017-10-25 11:30:14 UTC
(In reply to Tal Nisan from comment #5)
> Note that the same problem exists here:
> 
> https://gerrit.ovirt.org/#/c/82429/18/backend/manager/modules/bll/src/main/
> java/org/ovirt/engine/core/bll/storage/disk/image/ImagesHandler.java (line
> 765)
> 
> Line 766 should be changed to
> fullEntityOvfData.setDiskImages(fullEntityOvfData.getDiskImages());

That is not a bug since we already set this list in line 766:
  fullEntityOvfData.setDiskImages(snapshotImages);

Comment 8 Maor 2017-10-25 11:31:30 UTC
I published a patch which fix the issue and also make the code a bit more clear in ImagesHandler.java (line 765)

Comment 9 Raz Tamir 2017-10-30 16:44:31 UTC
Verified on ovirt-engine-4.2.0-0.0.master.20171027213842.gitded437c.el7.centos

After preview/preview + undo the VM's disks/network interfaces still exists

Comment 10 Sandro Bonazzola 2017-12-20 11:20:04 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.