Bug 1138586

Summary: No error shows when converting running guest with virt-v2v
Product: Red Hat Enterprise Linux 7 Reporter: tingting zheng <tzheng>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: codong, juzhou, mbooth, mzhan, ptoscano, rjones
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: V2V
Fixed In Version: libguestfs-1.27.38-1.1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 13:44:16 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 tingting zheng 2014-09-05 09:10:40 UTC
Description
No error shows when converting running guest with virt-v2v

Version:
libguestfs-tools-c-1.27.32-1.1.el7.x86_64
libguestfs-1.27.32-1.1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Prepare a running guest.
# virsh list 
 Id    Name                           State
----------------------------------------------------
 15    demo-clone                     running

2.Use virt-v2v to convert the funning guest,no error shows.
# virt-v2v -o rhev -os 10.66.90.115:/vol/v2v_auto/auto_export --network rhevm demo-clone
[   0.0] Opening the source -i libvirt demo-clone
[   0.0] Creating an overlay to protect the source from being modified
[   1.0] Opening the overlay
……

It should give error info like old virt-2v does:
# virt-v2v  -o rhev -os 10.66.90.115:/vol/v2v_auto/auto_export --network rhevm test
virt-v2v: Guest test is currently running. It must be shut down first.

Actual results:
As described.

Expected results:
Warning info shows like:virt-v2v: Guest $guest is currently running. It must be shut down first.

Additional info:

Comment 2 Richard W.M. Jones 2014-09-05 12:57:11 UTC
Fixed in:

https://github.com/libguestfs/libguestfs/commit/096c05a750b8b525e48149c0c6522769c92ab07c

(libguestfs >= 1.27.38)

Comment 3 zhoujunqin 2014-09-09 09:58:57 UTC
I can reproduce it as bug description.
Then try to verify it with package:
libguestfs-1.27.39-1.1.el7.x86_64
virt-v2v-1.27.39-1.1.el7.x86_64

Steps:
1. Prepare a running guest.
# virsh list 
 Id    Name                           State
----------------------------------------------------
 38    rhel6                          running

2.Use virt-v2v to convert the running guest
# virt-v2v -o rhev -os 10.66.90.115:/vol/v2v_auto/auto_export --network rhevm rhel6
[   0.0] Opening the source -i libvirt rhel6
virt-v2v: error: internal error: invalid argument: libvirt domain 'rhel6' 
is running, it must be shut down in order to perform virt-v2v conversion

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]

Result: It prevent converting running guest with virt-v2v and showing error message, so move to VERFILED.

Comment 4 zhoujunqin 2014-09-12 04:04:15 UTC
Hi rjones,
I want to confirm with you about some points:
1. can we convert a paused guest, if not should show some error.
now the result is, i can convert a paused guest successfully.
steps:
1.1 Prepare a paused guest.
# virsh list 
 Id    Name                           State
----------------------------------------------------
 2     rhel6                          paused
# virsh domstate rhel6 --reason
paused (user)
1.2. Use virt-v2v to convert the paused guest,no error shows.
# virt-v2v -o rhev -os 10.66.90.115:/vol/v2v_auto/auto_export --network rhevm rhel6
[   0.0] Opening the source -i libvirt rhel6
[   0.0] Creating an overlay to protect the source from being modified
[   0.0] Opening the overlay
[   2.0] Initializing the target -o rhev -os 10.66.90.115:/vol/v2v_auto/auto_export
[   2.0] Inspecting the overlay
[  11.0] Checking for sufficient free disk space in the guest
[  11.0] Converting Red Hat Enterprise Linux Server release 6.6 Beta (Santiago) to run on KVM
[  39.0] Mapping filesystem data to avoid copying unused and blank areas
[  40.0] Closing the overlay
[  40.0] Copying disk 1/1 to /tmp/v2v.m2kJOS/5b625e34-c943-4407-949d-9b9926bdf406/images/7b847ca5-1b02-4a70-aaa3-1b0a39613dee/5c2ede42-c5e3-4535-a5cf-6d82dc5d91de (raw)
    (100.00/100%)
[ 114.0] Creating output metadata
[ 114.0] Finishing off

2. when virt-v2v operation will check the guest status, that's to say at the beginning or monitoring the whole conversion process.

Please help me check it, thanks.

Comment 5 Richard W.M. Jones 2014-09-12 05:01:44 UTC
(In reply to zhoujunqin from comment #4)
> Hi rjones,
> I want to confirm with you about some points:
> 1. can we convert a paused guest, if not should show some error.
> now the result is, i can convert a paused guest successfully.

Yes, this is correct.  You are allowed to convert a paused guest.
The current test only checks the guest is not running.

> 2. when virt-v2v operation will check the guest status, that's to say at the
> beginning or monitoring the whole conversion process.

Yes, it only checks the status at the beginning of the operation.

If you start the guest half way through v2v, you'll end up with a
corrupted guest.  There's not a way to stop this from happening.
There is no concept in libvirt of blocking a guest from running.

Comment 6 Richard W.M. Jones 2014-09-16 15:31:16 UTC
(In reply to Richard W.M. Jones from comment #5)
> (In reply to zhoujunqin from comment #4)
> > Hi rjones,
> > I want to confirm with you about some points:
> > 1. can we convert a paused guest, if not should show some error.
> > now the result is, i can convert a paused guest successfully.
> 
> Yes, this is correct.  You are allowed to convert a paused guest.
> The current test only checks the guest is not running.

I've changed my mind on this.  Starting with libguestfs 1.27.47,
virt-v2v prevents you from starting conversion on a guest which
is paused (or "idle", which was an actual bug).

The upstream commit is:

https://github.com/libguestfs/libguestfs/commit/8856fadadb4f10b89f13068d01d40643e31c488d

Comment 8 errata-xmlrpc 2015-03-05 13:44:16 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, 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://rhn.redhat.com/errata/RHBA-2015-0303.html