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

Bug 1651137

Summary: virt-v2v: Cleanup on import failure, failed to remove VM disk image.
Product: [oVirt] ovirt-engine Reporter: Nisim Simsolo <nsimsolo>
Component: BLL.VirtAssignee: Steven Rosenberg <srosenbe>
Status: CLOSED WORKSFORME QA Contact: Nisim Simsolo <nsimsolo>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.3.0CC: bugs, nsimsolo, rbarry
Target Milestone: ovirt-4.3.0Flags: rule-engine: ovirt-4.3+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-01-27 12:44:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
vdsm.log
none
engine.log
none
import.log (failure simulated during copying disk phase) none

Description Nisim Simsolo 2018-11-19 09:44:47 UTC
Description of problem:
- When VM import failed, Disk image of imported VM failed to be removed.
- In several cases, It may cause to re-import failure of the same VM due to:
ERROR: duplicate key value violates unique constraint "pk_disk_vm_element"
(see https://bugzilla.redhat.com/show_bug.cgi?id=1562093#c6)

from vdsm.log: 
 2018-11-19 10:32:32,374+0200 INFO  (jsonrpc/5) [api.host] START deleteV2VJob(jobid=u'7849e31c-c9dc-449b-aea4-102149e89cc7') from=::ffff:10.35.162.75,43742, flow_id=e0a9edf2-cdb1-4136-960d-f2a89218e7b6 (api:48)
2018-11-19 10:32:32,375+0200 INFO  (jsonrpc/5) [root] Cannot delete job, error: No such job u'7849e31c-c9dc-449b-aea4-102149e89cc7' (v2v:271)
2018-11-19 10:32:32,375+0200 INFO  (jsonrpc/5) [api.host] FINISH deleteV2VJob return={'status': {'message': 'Job Id does not exists', 'code': 66}} from=::ffff:10.35.162.75,43742, flow_id=e0a9edf2-cdb1-4136-960d-f2a89218e7b6 (api:54)

From engine.log
2018-11-19 10:32:35,543+02 ERROR [org.ovirt.engine.core.bll.storage.disk.image.RemoveImageCommand] (EE-ManagedThreadFactory-engineScheduled-Thread-3) [30b0f0bd] Command 'org.o
virt.engine.core.bll.storage.disk.image.RemoveImageCommand' failed: EngineException: Cannot allocate IRS server (Failed with error IRS_REPOSITORY_NOT_FOUND and code 5009)
2018-11-19 10:32:35,557+02 INFO  [org.ovirt.engine.core.bll.tasks.AsyncTaskManager] (EE-ManagedThreadFactory-engineScheduled-Thread-3) [30b0f0bd] Removed task 'c79d8b7c-64fb-4
4db-a01c-d8e7c96a0320' from DataBase
2018-11-19 10:32:35,562+02 ERROR [org.ovirt.engine.core.bll.storage.disk.image.RemoveAllVmImagesCommand] (EE-ManagedThreadFactory-engineScheduled-Thread-3) [30b0f0bd] Can't re
move image id 'a9b51e8e-537e-45f2-8667-150788ca8971' for VM id '7849e31c-c9dc-449b-aea4-102149e89cc7' from domain id '5ef3e31c-bddd-4700-a3df-54c381d24f9a' due to: IRS_REPOSIT
ORY_NOT_FOUND.

Version-Release number of selected component (if applicable):
ovirt-engine-4.3.0-0.0.master.20181101091940.git61310aa.el7
vdsm-4.30.1-54.git4ceca62.el7.x86_64
qemu-kvm-ev-2.10.0-21.el7_5.7.1.x86_64
libvirt-client-4.5.0-10.el7.x86_64
sanlock-3.6.0-1.el7.x86_64
virt-v2v-1.38.2-12.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Import VM from external provider (VMware or Xen)
2. during "copying disk" phase, disconnect host network and wait for couple of minutes. 
3. Reconnect host network.

Actual results:
deleteV2VJob failed to remove image.
Browsing Webadmin -> storage domain -> disks tab, shows that there is a VM image which is not attached to any VM.

Expected results:
Disk image should be removed.

Additional info:
This Issue is related to https://bugzilla.redhat.com/show_bug.cgi?id=1562093#c6
vdsm.log and engine.log attached.

Comment 1 Nisim Simsolo 2018-11-19 09:49:10 UTC
Created attachment 1507153 [details]
vdsm.log

Comment 2 Nisim Simsolo 2018-11-19 09:49:33 UTC
Created attachment 1507154 [details]
engine.log

Comment 3 Nisim Simsolo 2018-11-19 09:50:22 UTC
Created attachment 1507156 [details]
import.log (failure simulated during copying disk phase)

Comment 4 Steven Rosenberg 2019-01-02 14:15:46 UTC
I was not able to simulate this after many tries. In my testing the disk is removed. Maybe this is an intermittent issue? Please retest this manually as per previous requests and advise accordingly.

Thank you.

Comment 5 Nisim Simsolo 2019-01-27 12:44:05 UTC
Cannot reproduce:
ovirt-engine-4.3.0-0.8.master.20190122121624.git9a8a519.el7
virt-v2v-1.38.2-12.el7_6.1.x86_64q
vdsm-4.30.8-1.el7.x86_64
qemu-kvm-ev-2.12.0-18.el7_6.1.1.x86_64
libvirt-client-4.5.0-10.el7_6.3.x86_64