Description of problem: When removing a storage domain containing a VM with memory snapshot and trying to import it back to the same setup the operation fails with unique constraint violation Version-Release number of selected component (if applicable): How reproducible: 100% Steps to Reproduce: 1. Create a VM and take a snapshot with memory 2. Detach the storage domain containing the VM disks and memory 3. Attach the storage domain to a data center 4. Import the VM Actual results: Operation fails Expected results: Operation should succeed Additional info: This occurs since the memory dump disk and the memory metadata disk are not deleted from the database on the detachment and when trying to import the VM the import command is trying to create new entry with the same identifier: 2017-03-22 16:03:38,576+02 ERROR [org.ovirt.engine.core.bll.exportimport.ImportVmFromConfigurationCommand] (org.ovirt.thread.pool-6-thread-6) [b8b971cf-bb56-48d0-a97c-f418a9a06908] Command 'org.ovirt.engine.core.bll.exportimport.ImportVmFromConfigurationCommand' failed: CallableStatementCallback; SQL [{call insertimage(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}]; ERROR: duplicate key value violates unique constraint "pk_images" Detail: Key (image_guid)=(58b55584-a190-44fc-8903-1ee2c48783bd) already exists. Where: SQL statement "INSERT INTO images ( creation_date, image_guid, it_guid, size, ParentId, imageStatus, lastModified, vm_snapshot_id, volume_type, image_group_id, volume_format, active, volume_classification ) VALUES ( v_creation_date, v_image_guid, v_it_guid, v_size, v_ParentId, v_imageStatus, v_lastModified, v_vm_snapshot_id, v_volume_type, v_image_group_id, v_volume_format, v_active, v_volume_classification )"
*** Bug 1437516 has been marked as a duplicate of this bug. ***
Verified with the following code: --------------------------------------- ovirt-engine-4.1.2-0.1.el7.noarch rhevm-4.1.2-0.1.el7.noarch vdsm-4.19.11-1.el7ev.x86_64 Verified with the following scenario: --------------------------------------- Steps to Reproduce: 1. Create a VM and take a snapshot with memory 2. Detach the storage domain containing the VM disks and memory 3. Attach the storage domain to a data center 4. Import the VM ->>> works fine Moving to VERIFIED!