Bug 2095215 - Uploading disk with same ID causes sql errors and locked disk
Summary: Uploading disk with same ID causes sql errors and locked disk
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: BLL.Storage
Version: 4.5.0.8
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ovirt-4.5.2
: ---
Assignee: Artiom Divak
QA Contact: Ilia Markelov
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-06-09 10:13 UTC by Jean-Louis Dupond
Modified: 2022-08-30 08:47 UTC (History)
6 users (show)

Fixed In Version: ovirt-engine-4.5.2
Clone Of:
Environment:
Last Closed: 2022-08-30 08:47:42 UTC
oVirt Team: Storage
Embargoed:
pm-rhel: ovirt-4.5?


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github oVirt ovirt-engine pull 507 0 None open core: Uploading an image with an existing disk id 2022-07-05 16:02:37 UTC
Red Hat Issue Tracker RHV-46385 0 None None None 2022-06-09 10:18:08 UTC

Description Jean-Louis Dupond 2022-06-09 10:13:46 UTC
Upload a disk via the python tools:
$ ./upload_disk.py -c OV --disk-format raw --sd-name STORAGE 6914eec5-6e89-46ad-aa44-e545de7e296b.1b60a0c1-76e9-4cdc-ab67-a1af8430cf2f.202
206021456.full.qcow2 
[  0.0 ] Checking image... 
[  0.0 ] Image format: qcow2 
[  0.0 ] Disk format: raw 
[  0.0 ] Disk content type: data 
[  0.0 ] Disk provisioned size: 2147483648 
[  0.0 ] Disk initial size: 2147483648 
[  0.0 ] Disk name: 6914eec5-6e89-46ad-aa44-e545de7e296b.1b60a0c1-76e9-4cdc-ab67-a1af8430cf2f.202206021456.full.raw 
[  0.0 ] Disk backup: False 
[  0.0 ] Connecting... 
[  0.0 ] Creating disk... 
[ 16.4 ] Disk ID: 33396852-743f-46e2-bcc4-013b04ec9b2a 
[ 16.4 ] Creating image transfer... 
[ 18.1 ] Transfer ID: 1199d383-8eb9-4e95-bc14-31f6551fe25b 
[ 18.1 ] Transfer host name: xxxxxx 
[ 18.1 ] Uploading image... 
[ 100.00% ] 2.00 GiB, 2.88 seconds, 711.54 MiB/s                               
[ 21.0 ] Finalizing image transfer... 
[ 23.0 ] Upload completed successfully 

And then uploading the disk with the disk-id specified (as displayed above)

$ ./upload_disk.py -c OV --disk-format raw --disk-id 33396852-743f-46e2-bcc4-013b04ec9b2a --sd-name STORAGE 6914eec5-6e89-46ad-aa44-e545de
7e296b.c50753d4-9897-42d5-be5b-c7c58325e0d3.202206021534.diff.qcow2 
[  0.0 ] Checking image... 
[  0.0 ] Image format: qcow2 
[  0.0 ] Disk format: raw 
[  0.0 ] Disk content type: data 
[  0.0 ] Disk provisioned size: 2147483648 
[  0.0 ] Disk initial size: 2147483648 
[  0.0 ] Disk name: 6914eec5-6e89-46ad-aa44-e545de7e296b.c50753d4-9897-42d5-be5b-c7c58325e0d3.202206021534.diff.raw 
[  0.0 ] Disk backup: False 
[  0.0 ] Connecting... 
[  0.0 ] Creating disk... 
Traceback (most recent call last): 

This causes the following error in oVirt:
2022-06-09 11:34:07,033+02 ERROR [org.ovirt.engine.core.bll.storage.disk.AddDiskCommand] (default task-303) [6aacac59-b539-480d-b43f-23d068408496] Command 'org.ovirt.engine.core.bll.storage.disk.AddDiskCommand' failed: CallableStatementCallback; SQL [{call insertpermission(?, ?, ?, ?, ?)}ERROR: duplicate key value violates unique constraint "idx_combined_ad_role_object"
  Detail: Key (ad_element_id, role_id, object_id)=(7740299e-9b9c-11ec-b93c-00505697d7a8, def0000a-0000-0000-0000-def00000000b, 33396852-743f-46e2-bcc4-013b04ec9b2a) already exists.
  Where: SQL statement "INSERT INTO permissions (
        ad_element_id,
        id,
        role_id,
        object_id,
        object_type_id
        )
    VALUES (
        v_ad_element_id,
        v_id,
        v_role_id,
        v_object_id,
        v_object_type_id
        )"
PL/pgSQL function insertpermission(uuid,uuid,uuid,uuid,integer) line 3 at SQL statement; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "idx_combined_ad_role_object"


And resulting in a failed disk creation + a locked image.

This should have been resolved by https://gerrit.ovirt.org/c/ovirt-engine/+/114134/
But it seems like the check is not complete enough here :)

Comment 1 RHEL Program Management 2022-06-09 13:25:43 UTC
The documentation text flag should only be set after 'doc text' field is provided. Please provide the documentation text and set the flag to '?' again.

Comment 2 Arik 2022-06-09 14:49:27 UTC
What is the type of the storage domain you upload the image to?

Comment 3 Jean-Louis Dupond 2022-06-09 15:29:37 UTC
Storage domain is a DATA/iSCSI domain

Comment 4 Arik 2022-06-13 14:21:21 UTC
Seems like we validate the uniqueness of the image-id but not that of the image-group-id (disk id), need to add a similar validation then

Comment 5 Ilia Markelov 2022-07-25 12:22:48 UTC
Verified.

Operation fails with a proper error:
2022-07-25 15:04:25,280+03 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (default task-13) [] Operation Failed: [Cannot add Virtual Disk. The selected disk ID: <disk-id> is already used by the following existing disk: <disk-name>.]

Versions:
engine-4.5.2-0.3.el8ev.noarch
vdsm-4.50.2.1-1.el8ev.x86_64

Comment 6 Sandro Bonazzola 2022-08-30 08:47:42 UTC
This bugzilla is included in oVirt 4.5.2 release, published on August 10th 2022.
Since the problem described in this bug report should be resolved in oVirt 4.5.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.


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