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

Bug 1503172

Summary: NullPointerException when trying to restore a snapshot with disks parameters on REST API
Product: [oVirt] ovirt-engine Reporter: shani <sleviim>
Component: BLL.StorageAssignee: shani <sleviim>
Status: CLOSED CURRENTRELEASE QA Contact: Kevin Alon Goldblatt <kgoldbla>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.2.0CC: amureini, bugs, derez, ebenahar, lveyde, sleviim, tnisan, ylavi
Target Milestone: ovirt-4.2.2Flags: rule-engine: ovirt-4.2+
ylavi: exception+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-engine-4.2.2.4 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-05 09:39:28 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
NullPointerException when trying to restore a snapshot with disks parameters on REST API
none
engine.log none

Description shani 2017-10-17 13:27:56 UTC
Created attachment 1339728 [details]
NullPointerException when trying to restore a snapshot with disks parameters on REST API

Description of problem:
When trying to restore a snapshot with disks parameters on REST API, the user gets NullPointerException.

Version-Release number of selected component (if applicable):
Reproduced for 4.2 version, although according to the code, was probably present before that.

How reproducible:
100%

Steps to Reproduce:
1. Using the REST API, run the following:

Method:
-------
POST

URL:
----
https://xxxx.xxxx.xxxx.xxxx.com/ovirt-engine/api/vms/<VM_ID>/snapshots/<SNAPSHOT_ID>/restore

Body:
-----
<action>
	<disks>
		<disk id = "DISK_GUID"></disk>
	</disks>
</action>

Actual results:
NullPointerException

Expected results:
The snapshot's restore should be performed.

Additional info:
See attached screenshot.

Comment 1 Allon Mureinik 2017-10-17 14:57:50 UTC
Can you attach the logs too pleaes?

Comment 2 shani 2017-10-18 06:16:12 UTC
Created attachment 1340000 [details]
engine.log

Comment 3 shani 2018-02-26 08:48:47 UTC
Moving back to "assigned", due to some code changes I should do and will affect this bug.

Comment 4 Kevin Alon Goldblatt 2018-04-02 12:10:08 UTC
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/snapshots/967d52c6-0aab-4947-8550-e586e541dfe2/restore

Content-Type
application/xml

Body
<action>
	<disks>
		<disk id = "a2487ec9-53db-42d6-b112-687dd8ddd846">
<image_id>c5b95c67-5713-4a93-8963-987dcdb70835</image_id>
</disk>
	</disks>
</action>

Response
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<action>
    <async>false</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/3e9fd1ee-f3d5-44fb-a8c0-50c6c58903e9" id="3e9fd1ee-f3d5-44fb-a8c0-50c6c58903e9"/>
    <snapshot href="/ovirt-engine/api/vms/9f00362d-3712-44e5-b846-7e6298690ad7/snapshots/967d52c6-0aab-4947-8550-e586e541dfe2" id="967d52c6-0aab-4947-8550-e586e541dfe2">
        <actions>
            <link href="/ovirt-engine/api/vms/9f00362d-3712-44e5-b846-7e6298690ad7/snapshots/967d52c6-0aab-4947-8550-e586e541dfe2/restore" rel="restore"/>
        </actions>
        <link href="/ovirt-engine/api/vms/9f00362d-3712-44e5-b846-7e6298690ad7/snapshots/967d52c6-0aab-4947-8550-e586e541dfe2/cdroms" rel="cdroms"/>
        <link href="/ovirt-engine/api/vms/9f00362d-3712-44e5-b846-7e6298690ad7/snapshots/967d52c6-0aab-4947-8550-e586e541dfe2/nics" rel="nics"/>
        <link href="/ovirt-engine/api/vms/9f00362d-3712-44e5-b846-7e6298690ad7/snapshots/967d52c6-0aab-4947-8550-e586e541dfe2/disks" rel="disks"/>
        <vm href="/ovirt-engine/api/vms/9f00362d-3712-44e5-b846-7e6298690ad7" id="9f00362d-3712-44e5-b846-7e6298690ad7"/>
    </snapshot>
    <status>complete</status>
</action>


The restore snapshot operation was successfull

Moving to VERIFIED

Comment 5 Sandro Bonazzola 2018-04-05 09:39:28 UTC
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.