Bug 1985830

Summary: Start or remove VM failure even v2v has already finished
Product: Red Hat Enterprise Linux 9 Reporter: Xiaodai Wang <xiaodwan>
Component: virt-v2vAssignee: Tomáš Golembiovský <tgolembi>
Status: CLOSED ERRATA QA Contact: Xiaodai Wang <xiaodwan>
Severity: high Docs Contact:
Priority: high    
Version: 9.0CC: chhu, juzhou, kkiwi, mxie, rjones, tyan, tzheng, vwu
Target Milestone: betaKeywords: Automation, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-v2v-2.0.7-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1985827 Environment:
Last Closed: 2022-11-15 09:55:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Xiaodai Wang 2021-07-26 02:08:43 UTC
+++ This bug was initially created as a clone of Bug #1985827 +++

Description of problem:
Start or remove VM failure even v2v has already finished

Version-Release number of selected component (if applicable):
virt-v2v-1.42.0-14.module+el8.5.0+11846+77888a74.x86_64
Software Version:4.4.7.6-0.11.el8ev

How reproducible:
30%

Steps to Reproduce:
1. Run virt-v2v to convert a VM to rhv by rhv-upload.
2. Start the VM or Remove the VM once v2v finishes off.

The issue is hard to reproduce manually, it's better to keep running following script by automation.
function_test_xen.positive_test.rhev.scsi_disk.output_mode.rhev.rhv_upload

Actual results:
2021-07-22 13:22:49,124+08 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (default task-876) [] Operation Failed: [Cannot run VM. VM Auto-xen-rhel7.9-scsidisk is being imported.]

Expected results:
The VM operation should success when v2v finishes.

Additional info:

--- Additional comment from Xiaodai Wang on 2021-07-26 02:05:28 UTC ---

Comments from Nir Soffer, thanks.

Looking at the code related to creating  a vm it is expected that the vm
will not finish the import when virt-v2v finishes, since it does not wait for
compilation.

vm = vms_service.add(
    types.Vm(
        cluster=cluster,
        initialization=types.Initialization(
            configuration=types.Configuration(
                type=types.ConfigurationType.OVA,
                data=ovf,
            )
        )
    )
)

This completes before the vm is created.

Waiting until an operation is completed is a great pain in RHV.

The best way to do this for most operations is to use jobs, as used here:
https://gitlab.com/nirs/ovirt-stress/-/blob/bb2088f05b3e186733da99260f7b5ecb0a0d03a8/delete-snapshot/test.py#L148

The general idea is to add correlation_id when calling the API, and
then wait for
the job with that id.

Comment 4 Xiaodai Wang 2022-05-06 02:44:40 UTC
I triggered one of our v2v functional job[1] which always has the issue of this bug. 
In the link below, we can see almost all scripts are PASS or FIXED. That means the issue
reported in this bug cannot be reproduced in the job.

So I think this bug can be moved to VERIFIED.

[1]https://libvirt-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/job/v2v-RHEL-9.1-runtest-x86_64-function-specific_kvm-rhel/2/testReport/rhel/specific_kvm/

Comment 6 errata-xmlrpc 2022-11-15 09:55:51 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 (Low: virt-v2v security, bug fix, and enhancement 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/RHSA-2022:7968