Bug 1018554

Summary: [restapi] undo snapshot preview through restapi commits snapshot instead of undoing preview
Product: Red Hat Enterprise Virtualization Manager Reporter: Gadi Ickowicz <gickowic>
Component: ovirt-engine-restapiAssignee: Ravi Nori <rnori>
Status: CLOSED CANTFIX QA Contact: Gadi Ickowicz <gickowic>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 3.3.0CC: acanan, acathrow, amureini, bazulay, eedri, hateya, iheim, mpastern, nlevinki, oramraz, pstehlik, Rhev-m-bugs, scohen, yeylon
Target Milestone: ---Keywords: Reopened, Triaged
Target Release: 3.3.0Flags: amureini: Triaged+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-26 09:05:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
engine and vdsm logs none

Description Gadi Ickowicz 2013-10-13 08:54:18 UTC
Created attachment 811690 [details]
engine and vdsm logs

Description of problem:
Attempting to undo a snapshot preview through RESTAPI commits that snapshot, removing any snapshots that were taken after the snapshot was originally created, just like committing the snapshot preview, instead of returning to the "Active before preview" snapshot and having all snapshots available.

Version-Release number of selected component (if applicable):
rhevm-3.3.0-0.25.beta1.el6ev.noarch

How reproducible:
100%

Steps to Reproduce:
1. Create a vm with a disk and take 2 snapshots
2. preview the first snapshot
3. Send REST post request to the following url:
https://<engine>/api/vms/<vm-id>/snapshots/<first_snapshot_id>/undo
with body:
<action>
    <async>false</async>
    <grace_period>
        <expiry>10</expiry>
    </grace_period>
    <restore_memory>false</restore_memory>
</action>


Actual results:
first snapshot is no longer previewed but second snapshot disappears

Expected results:
second snapshot should be available

Additional info:

Comment 1 Maor 2013-10-20 15:02:29 UTC
The problem is in the REST and does not reproduce in the GUI.

A previewed snapshot has two rows in the volumes DB table, one is active the other is the previewed volume.

Since the user send the original snapshot id, the REST delegates it to the engine and cause the commit of the first snapshot.
The fix should be in the REST, by getting the other volume id (The temporary previewed volume) and send the correct volume id to the engine.

Comment 2 Ayal Baron 2013-10-28 12:31:31 UTC
This API was introduced by patch http://gerrit.ovirt.org/#/c/11163/
This functionality was broken from the day it was introduced and should be reverted.

Comment 4 Ravi Nori 2013-10-28 15:50:02 UTC
The exception is occuring because undo has been invoked on the wrong snapshot. It needs to be invoked on the snapshot that shows a description of "Active VM before preview". When undo is invoked from webadmin, the front end code takes care of choosing the right snapshot. When invoking from rest api please invoke the undo action on the snapshot with <type>preview</type>.

Comment 8 Michael Pasternak 2013-11-04 08:44:54 UTC

*** This bug has been marked as a duplicate of bug 867339 ***

Comment 14 Michael Pasternak 2013-11-26 09:05:07 UTC
this feature was reverted due to lack of appropriate infrastructure in the engine,
it will be reconsidered in one of the following versions, for more details please
follow RFE bug 867339.

thanks.