Bug 1659829 - [Backup restore API] Preview snapshot operation, while the VM has a snapshot disk attached, fails with NullPointerException and leaves the snapshot and a disk in status LOCKED. The VM cannot be started
Summary: [Backup restore API] Preview snapshot operation, while the VM has a snapshot ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: BLL.Storage
Version: 4.3.0
Hardware: x86_64
OS: Unspecified
high
high
Target Milestone: ovirt-4.4.3
: ---
Assignee: Bella Khizgiyaev
QA Contact: Evelina Shames
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-12-16 21:26 UTC by Elad
Modified: 2020-11-11 06:43 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-11 06:39:43 UTC
oVirt Team: Storage
pm-rhel: ovirt-4.4+
mtessun: Triaged+
mtessun: planning_ack+
sfishbai: testing_ack+


Attachments (Terms of Use)
logs (3.71 MB, application/gzip)
2018-12-16 21:26 UTC, Elad
no flags Details
engine-log (10.58 MB, text/plain)
2020-08-11 11:52 UTC, Evelina Shames
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 111103 0 master MERGED core: Preview snapshot with backup snapshot disk 2020-10-04 08:06:33 UTC

Description Elad 2018-12-16 21:26:29 UTC
Created attachment 1514924 [details]
logs

Description of problem:
Previewing a snapshot, while the VM has a snapshot disk of another VM attached, fails on engine and the VM disk and snapshot are left LOCKED

Version-Release number of selected component (if applicable):
ovirt-engine-4.3.0-0.4.master.20181207184726.git7928cae.el7.noarch
vdsm-4.30.4-4.git91d4310.el7.x86_64


How reproducible:
Tested once so far 

Steps to Reproduce:
1. Create 2 VMs with disk - VM1 and VM2
2. Create a snapshot for VM1, include the disk in it
3. Attach the snapshot disk of VM1 to VM2
4. Create a snapshot for VM2, include both disks
5. Preview the snapshot of VM2


Actual results:
Preview snapshot:

2018-12-16 23:06:30,574+02 INFO  [org.ovirt.engine.core.vdsbroker.SetVmStatusVDSCommand] (default task-56) [e7be615b-cf25-4559-a732-bcb2a40e7aab] FINISH, SetVmStatusVDSCommand, return: , log id: 3398d260
2018-12-16 23:06:30,598+02 INFO  [org.ovirt.engine.core.bll.snapshots.TryBackToAllSnapshotsOfVmCommand] (default task-56) [e7be615b-cf25-4559-a732-bcb2a40e7aab] Lock freed to object 'EngineLock:{exclusiveLocks='
[c0a4c36a-599b-43ac-89b2-931260628867=VM]', sharedLocks=''}'


An error during TryBackToSnapshotCommand:

2018-12-16 23:06:31,163+02 ERROR [org.ovirt.engine.core.bll.snapshots.TryBackToSnapshotCommand] (default task-56) [e7be615b-cf25-4559-a732-bcb2a40e7aab] Can't find image to update to active 'false', snapshot type 'PREVIEW', original image id '6934db47-e233-434b-8060-01a62fc53ec9'


And finally, NullPointerException:

2018-12-16 23:11:43,800+02 INFO  [org.ovirt.engine.core.utils.transaction.TransactionSupport] (EE-ManagedThreadFactory-engine-Thread-218537) [] transaction rolled back
2018-12-16 23:11:43,847+02 ERROR [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (EE-ManagedThreadFactory-engine-Thread-218537) [] EVENT_ID: USER_TRY_BACK_TO_SNAPSHOT_FINISH_FAILURE(99), F
ailed to complete Snapshot-Preview 1 for VM test2.
2018-12-16 23:11:43,847+02 ERROR [org.ovirt.engine.core.bll.tasks.CommandAsyncTask] (EE-ManagedThreadFactory-engine-Thread-218537) [] [within thread]: endAction for action type TryBackToAllSnapshotsOfVm threw an
 exception.: java.lang.NullPointerException
        at org.ovirt.engine.core.bll.snapshots.SnapshotsManager.synchronizeDisksFromSnapshot(SnapshotsManager.java:666) [bll.jar:]
        at org.ovirt.engine.core.bll.snapshots.SnapshotsManager.attempToRestoreVmConfigurationFromSnapshot(SnapshotsManager.java:415) [bll.jar:]
        at org.ovirt.engine.core.bll.snapshots.TryBackToAllSnapshotsOfVmCommand.restoreVmConfigFromSnapshot(TryBackToAllSnapshotsOfVmCommand.java:211) [bll.jar:]
        at org.ovirt.engine.core.bll.snapshots.TryBackToAllSnapshotsOfVmCommand.endSuccessfully(TryBackToAllSnapshotsOfVmCommand.java:170) [bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.internalEndSuccessfully(CommandBase.java:687) [bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.endActionInTransactionScope(CommandBase.java:642) [bll.jar:]



Cannot start the VM now.

Expected results:
Preview snapshot, while the VM has a snapshot disk attached, should succeed

Additional info:
logs

Comment 1 Sandro Bonazzola 2019-01-28 09:34:32 UTC
This bug has not been marked as blocker for oVirt 4.3.0.
Since we are releasing it tomorrow, January 29th, this bug has been re-targeted to 4.3.1.

Comment 3 Elad 2019-04-15 11:56:08 UTC
For attaching snapshot disk, send the following REST POST:
url:/ovirt-engine/api/vms/%VM_ID%/diskattachments body:
<disk_attachment id="">
    <active>true</active>
    <interface>virtio</interface>
    <disk id="">
        <snapshot id=""/>
    </disk>
</disk_attachment>

Comment 5 Elad 2019-05-01 09:45:17 UTC
Hi Fedor, I'm able to reproduce every time on my setup, according to the steps mentioned in the description.
Sent you offline my setup details.

Comment 7 Bella Khizgiyaev 2020-08-04 10:22:17 UTC
Seems that the bug was fixed since a newer backup feature was included in ovirt (the bug been open for 1.5 years), this functionality was blocked and a snapshot disk can't be added to a snapshot of a different VM.

steps to repredoce:

1. Create 2 VMs with two different disk - VM1 and VM2
2. Create a snapshot for VM1, include the disk in it
3. Attach the snapshot disk of VM1 to VM2 using the POST REST command:
 url:/ovirt-engine/api/vms/%VM_ID%/diskattachments body:
 <disk_attachment id="">
     <active>true</active>
     <interface>virtio</interface>
     <disk id="">
         <snapshot id=""/>
     </disk>
 </disk_attachment>
4. Try to create a snapshot for VM2, include both disks:
   4.1 Using the UI.
   4.2.Using a POST REST :
   url: http://localhost:8080/ovirt-engine/api/vms/"VMid"/snapshots
   <snapshot>
    <description>"SnapshotName"</description>
    <disk_attachments>
      <disk_attachment>
        <disk id="">
        </disk>
      </disk_attachment>
    </disk_attachments>
  </snapshot>

Actual results:
In both cases the snapshot will be created only for the original attached disk for VM2 without the snapshot disk.
from the UI an error will be raised in the create snapshot stage:
"Disk snapshot(s) will not be a part of the VM snapshot: <disk name>"
from the REST the snapshot will be created without the disk.

I wasn't able to find the patch with the fix but validation was added and the above-dscribed bug can't be reproduced.

Comment 8 Evelina Shames 2020-08-11 11:51:11 UTC
Still occurs on engine-4.4.2.1-0.15.el8ev:
2020-08-11 14:42:33,738+03 ERROR [org.ovirt.engine.core.bll.snapshots.TryBackToSnapshotCommand] (default task-19) [8dcc4006-4a9b-45f2-9bb2-749a754e853f] Can't find image to update to active 'false', snapshot type 'PREVIEW', original image id '6f0e2a13-be4b-45e3-ac41-a0c91fc26e29'

Attaching engine logs.

Bella, notice that after the snapshot was created, the next step is to preview the snapshot and it fails on this step.

Steps to Reproduce:
1. Create 2 VMs with disk - VM1 and VM2
2. Create a snapshot for VM1, include the disk in it
3. Attach the snapshot disk of VM1 to VM2
4. Create a snapshot for VM2, include both disks
5. Preview the snapshot of VM2 -> fails on engine and the VM disk and snapshot are left in LOCKED state.

Comment 9 RHEL Program Management 2020-08-11 11:51:18 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 10 Evelina Shames 2020-08-11 11:52:53 UTC
Created attachment 1711071 [details]
engine-log

Comment 11 Evelina Shames 2020-10-05 15:40:57 UTC
Verified on ovirt-engine-4.4.3.5-0.5.el8ev.noarch

Comment 12 Sandro Bonazzola 2020-11-11 06:39:43 UTC
This bugzilla is included in oVirt 4.4.3 release, published on November 10th 2020.

Since the problem described in this bug report should be resolved in oVirt 4.4.3 release, it has been closed with a resolution of CURRENT RELEASE.

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


Note You need to log in before you can comment on or make changes to this bug.