Bug 1641326 - NPE while querying for an ancestor image with no entry on 'images' table
Summary: NPE while querying for an ancestor image with no entry on 'images' table
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: BLL.Storage
Version: 4.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ovirt-4.2.8
: ---
Assignee: Tal Nisan
QA Contact: Avihai
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-10-21 08:40 UTC by shani
Modified: 2019-01-22 10:23 UTC (History)
1 user (show)

Fixed In Version: ovirt-engine-4.2.8.1
Clone Of:
Environment:
Last Closed: 2019-01-22 10:23:33 UTC
oVirt Team: Storage
Embargoed:
rule-engine: ovirt-4.2+


Attachments (Terms of Use)
NullPointerException on GetAncestorImagesByImagesIdsQuery by using toMap() (17.05 KB, text/plain)
2018-10-21 08:40 UTC, shani
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1635405 0 high CLOSED Move Disk dialog keeps spinning - API method works 2022-03-13 16:53:10 UTC
oVirt gerrit 94992 0 master MERGED core: Fix UI for moving a disk with a damaged ancestor 2018-11-05 11:32:50 UTC
oVirt gerrit 95044 0 master ABANDONED core: NPE while querying a null ancestor image 2018-10-22 13:35:06 UTC
oVirt gerrit 95266 0 ovirt-engine-4.2 MERGED core: Fix UI for moving a disk with a damaged ancestor 2018-11-06 11:55:02 UTC

Internal Links: 1635405

Description shani 2018-10-21 08:40:55 UTC
Created attachment 1496131 [details]
NullPointerException on GetAncestorImagesByImagesIdsQuery by using toMap()

Description of problem:
In case of trying to move a disk which its ancestor image doesn't have an entry on 'images' table), the query 'GetAncestorImagesByImagesIdsQuery' returns a null DiskImage as the image's ancestor.
Using Collectors.toMap(), and receiving the null object mentioned above as the map's ValueMapper function causes to a NullPionterException.

Version-Release number of selected component (if applicable):
master-e60d148b70f

How reproducible:
100%

Steps to Reproduce:
1. Create a VM with a disk attached.
2. Take a snapshot for that VM.
3. From images table, delete the entry of the image's ancestor.
4. Try to move VM's the disk.

Actual results:
Should be no error on the engine

Expected results:
[org.ovirt.engine.core.bll.storage.disk.image.GetAncestorImagesByImagesIdsQuery]  Exception: java.lang.NullPointerException

Additional info:
engine.log

Comment 1 Avihai 2018-11-21 13:44:19 UTC
Verified on upstream ovirt-engine 4.2.8-0.0.master.20181119152157.gita72a684.

Details:

Engine log after GetAncestorImagesByImagesIdsQuery :
- Opened UI move disk window resulted in :
2018-11-21 15:32:10,918+02 WARN  [org.ovirt.engine.core.bll.storage.disk.image.GetAncestorImagesByImagesIdsQuery] (default task-18) [e047f1f3-3c3e-4259-9012-77e029d65162] Ancestor is missing for the following image id(s): 65e2975b-66f1-4c94-9537-81dd7faec400


- Base/Ancestor volume/image ID = 9a28b5c9-d660-4004-9190-862f8a3ef038 :
>engine=# select * from images;

-[ RECORD 30 ]--------+-------------------------------------
image_guid            | 9a28b5c9-d660-4004-9190-862f8a3ef038
creation_date         | 2018-11-21 15:19:44+02
size                  | 1073741824
it_guid               | 00000000-0000-0000-0000-000000000000
parentid              | 00000000-0000-0000-0000-000000000000
imagestatus           | 1
lastmodified          | 2018-11-21 15:19:58.494+02
vm_snapshot_id        | 8a418feb-4227-4ea9-b85e-403c06a6b290
volume_type           | 2
volume_format         | 4
image_group_id        | 34b069e7-3c46-44fd-ab7e-18b3700b1b72
_create_date          | 2018-11-21 15:19:41.169706+02
_update_date          | 2018-11-21 15:19:58.495286+02
active                | f
volume_classification | 1
qcow_compat           | 2


- Created new snapshot , new volume created imageID = 65e2975b-66f1-4c94-9537-81dd7faec400 :
-[ RECORD 31 ]--------+-------------------------------------
image_guid            | 65e2975b-66f1-4c94-9537-81dd7faec400
creation_date         | 2018-11-21 15:20:04+02
size                  | 1073741824
it_guid               | 00000000-0000-0000-0000-000000000000
parentid              | 9a28b5c9-d660-4004-9190-862f8a3ef038
imagestatus           | 1
lastmodified          | 1970-01-01 02:00:00+02
vm_snapshot_id        | 315683b4-e966-4310-b74b-0ca7795d57bf
volume_type           | 2
volume_format         | 4
image_group_id        | 34b069e7-3c46-44fd-ab7e-18b3700b1b72
_create_date          | 2018-11-21 15:19:58.495286+02
_update_date          | 2018-11-21 15:20:19.247328+02
active                | t
volume_classification | 0
qcow_compat           | 2



3. From images table, delete the entry of the image's ancestor.
DELETE from images WHERE image_guid='9a28b5c9-d660-4004-9190-862f8a3ef038';

Comment 2 Raz Tamir 2018-11-28 15:30:08 UTC
QE verification bot: the bug was verified upstream

Comment 3 Sandro Bonazzola 2019-01-22 10:23:33 UTC
This bugzilla is included in oVirt 4.2.8 release, published on January 22nd 2019.

Since the problem described in this bug report should be
resolved in oVirt 4.2.8 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.