Bug 2278127 - import of guest with shared disk and snapshot is failing
Summary: import of guest with shared disk and snapshot is failing
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 4.5.3
Hardware: x86_64
OS: Unspecified
unspecified
high
Target Milestone: ---
: ---
Assignee: Nobody
QA Contact: meital avital
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-05-01 10:11 UTC by Marian Jankular
Modified: 2024-06-10 11:57 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2024-06-10 11:57:03 UTC
oVirt Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 7072746 0 None None None 2024-05-30 01:21:55 UTC
Red Hat Product Errata RHBA-2024:3751 0 None None None 2024-06-10 11:57:05 UTC

Description Marian Jankular 2024-05-01 10:11:02 UTC
Description of problem:
import of guest with shared disk and snapshot is failing

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


How reproducible:
everytime

Steps to Reproduce:
1, create 4 vms on sd_A:

vm_A with bootable disk disk_A and shared disk shared_1
vm_B with bootable disk disk_B and shared disk shared_1
vm_C with bootable disk disk_C and shared disk shared_2
vm_D with bootable disk disk_D and shared disk shared_2

2, create snapshot for the vms (in my case it was enough to create snapshot for the vm_A and vm_B)
3, put in maintenance & detach sd_A fro the datacenter
4, attach sd_A back to the datacenter or import it in new dc
5, import all 4 vms at once 

Actual results:
import fails for one of 4 vms with error below:

~~~
2024-04-30 15:12:28,824Z ERROR [org.ovirt.engine.core.bll.exportimport.ImportVmFromConfigurationCommand] (EE-ManagedThreadFactory-engine-Thread-2266) [50da4d21-0a8b-4791-8255-0b221abb40ae] Command 'org.ovirt.engine.core.bll.exportimpor
t.ImportVmFromConfigurationCommand' failed: CallableStatementCallback; SQL [{call insertsnapshot(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}]; ERROR: duplicate key value violates unique constraint "pk_snapshots"
  Detail: Key (snapshot_id)=(00000000-0000-0000-0000-000000000000) already exists.
  Where: SQL statement "INSERT INTO snapshots (
        snapshot_id,
        status,
        vm_id,
        snapshot_type,
        description,
        creation_date,
        app_list,
        vm_configuration,
        memory_dump_disk_id,
        memory_metadata_disk_id,
        changed_fields
        )
    VALUES(
        v_snapshot_id,
        v_status,
        v_vm_id,
        v_snapshot_type,
        v_description,
        v_creation_date,
        v_app_list,
        v_vm_configuration,
        v_memory_dump_disk_id,
        v_memory_metadata_disk_id,
        v_changed_fields
        )"
PL/pgSQL function insertsnapshot(uuid,uuid,character varying,character varying,character varying,timestamp with time zone,text,text,uuid,uuid,text) line 3 at SQL statement; nested exception is org.postgresql.util.PSQLException: ERROR: 
duplicate key value violates unique constraint "pk_snapshots"
  Detail: Key (snapshot_id)=(00000000-0000-0000-0000-000000000000) already exists.
~~~

Expected results:
all guests will be imported

Additional info:

Comment 1 Marian Jankular 2024-05-01 10:22:43 UTC
so it looks like the issue is that when engine is importing VM with snapshot for common disk(s) it assigns snapshot id for the shared disk 00000000-0000-0000-0000-000000000000

so it can be reproduced even with 2 vms with snapshot for common disks + shared disk

if the snapshot is removed vms are imported without any issue

Comment 2 Marian Jankular 2024-05-01 10:51:27 UTC
there was already PR for this https://github.com/oVirt/ovirt-engine/pull/905

Comment 3 Michal Skrivanek 2024-05-10 06:26:31 UTC
https://github.com/oVirt/ovirt-engine/pull/940

Comment 8 Michal Skrivanek 2024-05-30 07:53:41 UTC
verified by Germano manually. Thanks a lot!

Comment 10 errata-xmlrpc 2024-06-10 11:57:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Red Hat Virtualization security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2024:3751


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