Created attachment 1384439 [details] engine.log and vdsm logs Description of problem: When trying to preview a snapshot of a VM using REST-API, and supply in the body a list of disks (in this case 1 disk), the operation fails with NPE. Version-Release number of selected component: rhevm-4.1.9.1-0.1.el7.noarch vdsm-4.19.45-1.el7ev.x86_64 How reproducible: 100% Steps to Reproduce: Using RestApi, preview snapshot of a VM, and supply the disk id (as a list). Example: Method: POST URL: https://engine-url/ovirt-engine/api/vms/ebb6da72-48a5-46ca-83f4-e332155850de/previewsnapshot Body: <action> <async>true</async> <disks> <disk id="cd22352e-11da-4336-abe3-b4ccad09a383"/> </disks> <restore_memory>false</restore_memory> <snapshot id="47d3c165-07e6-4c02-abc0-c04a664621f3"/> <vm id="ebb6da72-48a5-46ca-83f4-e332155850de"/> </action> Actual results: Fails with the following error: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <action> <async>true</async> <disks> <disk id="cd22352e-11da-4336-abe3-b4ccad09a383"/> </disks> <fault> <detail>[Internal Engine Error]</detail> <reason>Operation Failed</reason> </fault> <restore_memory>false</restore_memory> <snapshot id="47d3c165-07e6-4c02-abc0-c04a664621f3"/> <status>failed</status> <vm id="ebb6da72-48a5-46ca-83f4-e332155850de"/> </action> engine.log: 2018-01-22 13:42:04,110+02 INFO [org.ovirt.engine.core.bll.snapshots.TryBackToAllSnapshotsOfVmCommand] (default task-11) [7653c805-6f2c-48cc-bd1f-828011304dd0] Running command: TryBackToAllSnapshotsOfVmCommand internal: false. Entities affected : ID: ebb6da72-48a5-46ca-83f4-e332155850de Type: VMAction group MANIPULATE_VM_SNAPSHOTS with role type USER 2018-01-22 13:42:04,112+02 ERROR [org.ovirt.engine.core.bll.snapshots.TryBackToAllSnapshotsOfVmCommand] (default task-11) [7653c805-6f2c-48cc-bd1f-828011304dd0] Command 'org.ovirt.engine.core.bll.snapshots.TryBackToAllSnapshotsOfVmCommand' failed: null 2018-01-22 13:42:04,113+02 ERROR [org.ovirt.engine.core.bll.snapshots.TryBackToAllSnapshotsOfVmCommand] (default task-11) [7653c805-6f2c-48cc-bd1f-828011304dd0] Exception: java.lang.NullPointerException at org.ovirt.engine.core.bll.snapshots.TryBackToAllSnapshotsOfVmCommand.getImagesExcludedFromPreview(TryBackToAllSnapshotsOfVmCommand.java:388) [bll.jar:] at org.ovirt.engine.core.bll.snapshots.TryBackToAllSnapshotsOfVmCommand.executeVmCommand(TryBackToAllSnapshotsOfVmCommand.java:197) [bll.jar:] . . . at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_151] 2018-01-22 13:42:04,161+02 ERROR [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (default task-11) [7653c805-6f2c-48cc-bd1f-828011304dd0] EVENT_ID: USER_FAILED_TRY_BACK_TO_SNAPSHOT(115), Correlation ID: 7653c805-6f2c-48cc-bd1f-828011304dd0, Job ID: 04c27cbd-c6d4-4f43-a5f3-8fcc5d035256, Call Stack: null, Custom ID: null, Custom Event ID: -1, Message: Failed to preview Snapshot VM1_A for VM VM1 (User: admin@internal-authz). 2018-01-22 13:42:04,177+02 INFO [org.ovirt.engine.core.bll.snapshots.TryBackToAllSnapshotsOfVmCommand] (default task-11) [7653c805-6f2c-48cc-bd1f-828011304dd0] Lock freed to object 'EngineLock:{exclusiveLocks='[ebb6da72-48a5-46ca-83f4-e332155850de=VM]', sharedLocks=''}' 2018-01-22 13:42:04,178+02 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (default task-11) [] Operation Failed: [Internal Engine Error] Expected results: For the preview snapshot operation to succeed, and if the data sent is incorrect then a suitable error - either way, no java.lang.NullPointerException Additional info: When removing the following part: <disks> <disk id="cd22352e-11da-4336-abe3-b4ccad09a383"/> </disks> preview works How to use REST-API to preview snapshots: https://ovirt-engine-url/ovirt-engine/apidoc/#services-vm-methods-preview_snapshot
Shani, I have a vague recollection that you worked on something like this a couple of month ago, although I can't see any trace of it in the engine's git (perhaps you worked on this and ultimately decided to push this out of 4.2?). Can you please take a look? Tentative targetting to 4.2.2. If we see this is too risky I think we can safely push this out to 4.3, considering the fact that this bug occurs even in 4.1 - assuming this isn't a regression from an earlier 4.1 z-stream. Natalie - is this part of the automation, or a manual test? What's the last version this flow worked properly (if at all)?
(In reply to Allon Mureinik from comment #1) > Shani, I have a vague recollection that you worked on something like this a > couple of month ago, although I can't see any trace of it in the engine's > git (perhaps you worked on this and ultimately decided to push this out of > 4.2?). > > Can you please take a look? > > Tentative targetting to 4.2.2. > If we see this is too risky I think we can safely push this out to 4.3, > considering the fact that this bug occurs even in 4.1 - assuming this isn't > a regression from an earlier 4.1 z-stream. > Natalie - is this part of the automation, or a manual test? What's the last > version this flow worked properly (if at all)? I've open this [1] bug a couple of months ago. It's not the exact same scenario, but it seems to be related. I haven't tried to solve it yet (just opened the bug so we would be able to track it) [1] https://bugzilla.redhat.com/show_bug.cgi?id=1503172
(In reply to Allon Mureinik from comment #1) > Natalie - is this part of the automation, or a manual test? What's the last > version this flow worked properly (if at all)? This was tested manually, we have automated tests that are performing custom snapshot preview - but AFAIK, they all work fine because the *tests specify the snapshot to preview for a disk*, like this: Method: POST URL: https://ovirt-engine-url/ovirt-engine/api/vms/vm-id/previewsnapshot Body: <action> <async>false</async> <disks> <disk id="disk_id"> <image_id>image_id</image_id> <snapshot id="snapshot_id"/> <-- It works when specifing the snapshot </disk> </disks> <restore_memory>false</restore_memory> <snapshot id="snapshot_id"/> </action> So, the problem was that I didn't specify a snapshot-id to preview for a disk (another problem is the documentation about it but that's a whole nother story..) My guess is no one ever tried it that way.. Shani, The issue you opened looks almost the same to me, only differences I see is, you were using /restore and I used /previewsnapshot and the ovirt versions this issue addresses 4.1.9 and Bug 1503172 is for 4.2. If you want you can close it as dup.
This bug report has Keywords: Regression or TestBlocker. Since no regressions or test blockers are allowed between releases, it is also being identified as a blocker for this release. Please resolve ASAP.
Not all patches are merged yet, returning to POST.
The patch wasn't included in 4.2.2-0.1 moving to modified.
Moving back to "assigned", due to some code changes I should do and will affect this bug.
Verified with the following code: ---------------------------------------- ovirt-engine-4.2.2.6-0.1.el7.noarch vdsm-4.20.23-1.el7ev.x86_64 Verified with the following scenario: ---------------------------------------- Method POST Url https://storage-ge-10.scl.lab.tlv.redhat.com/ovirt-engine/api/vms/9f00362d-3712-44e5-b846-7e6298690ad7/previewsnapshot Content-Type application/xml Body <action> <async>true</async> <disks> <disk id="a2487ec9-53db-42d6-b112-687dd8ddd846"> <image_id>c5b95c67-5713-4a93-8963-987dcdb70835</image_id> </disk> </disks> <restore_memory>false</restore_memory> <snapshot id="967d52c6-0aab-4947-8550-e586e541dfe2"/> <vm id="9f00362d-3712-44e5-b846-7e6298690ad7"/> </action> Response <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <action href="/ovirt-engine/api/vms/9f00362d-3712-44e5-b846-7e6298690ad7/previewsnapshot/2b67ee45-85c5-455a-84b7-269cacbbd30f" id="2b67ee45-85c5-455a-84b7-269cacbbd30f"> <link href="/ovirt-engine/api/vms/9f00362d-3712-44e5-b846-7e6298690ad7" rel="parent"/> <link href="/ovirt-engine/api/vms/9f00362d-3712-44e5-b846-7e6298690ad7/previewsnapshot" rel="replay"/> <async>true</async> <disks> <disk id="a2487ec9-53db-42d6-b112-687dd8ddd846"> <image_id>c5b95c67-5713-4a93-8963-987dcdb70835</image_id> </disk> </disks> <job href="/ovirt-engine/api/jobs/65d76c62-c48f-480e-9eb3-c4d0e1dba7c7" id="65d76c62-c48f-480e-9eb3-c4d0e1dba7c7"/> <restore_memory>false</restore_memory> <snapshot id="967d52c6-0aab-4947-8550-e586e541dfe2"/> <status>pending</status> <vm id="9f00362d-3712-44e5-b846-7e6298690ad7"/> </action> Moving to VERIFIED
This bugzilla is included in oVirt 4.2.2 release, published on March 28th 2018. Since the problem described in this bug report should be resolved in oVirt 4.2.2 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.