Bug 1229385

Summary: virt-p2v in kernel command line mode should power off the machine after conversion
Product: Red Hat Enterprise Linux 7 Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 7.2CC: juzhou, mzhan, ptoscano, tzheng, virt-bugs, xiaodwan
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: P2V
Fixed In Version: libguestfs-1.28.1-1.38.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1229262 Environment:
Last Closed: 2015-11-19 07:01:46 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 Richard W.M. Jones 2015-06-08 15:02:31 UTC
Description of problem:

After conversion using the automated kernel command line mode, virt-p2v
really ought to power off the machine.

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

virt-p2v from git, or RHEL 7.1

How reproducible:

100%

Steps to Reproduce:

Please see my reproducer steps here:
https://bugzilla.redhat.com/show_bug.cgi?id=1229262#c2

Actual results:

virt-p2v runs invisibly (or fails invisibly), and there's no obvious
conclusion to the conversion, unless you study the log files on the
conversion server.

Expected results:

virt-p2v should power off the server after completion.

Comment 2 Richard W.M. Jones 2015-06-09 19:24:46 UTC
Upstream fixes:

716244c33718c866edce9e7ee8f21ee612f53337
b45f6a04359b4b64256b7b21a04416fa772c9423

These fixes actually add various commands you can use to
run scripts before and after conversion:

       p2v.pre=COMMAND
       p2v.pre="COMMAND ARG ..."
           Select a pre-conversion command to run.  Any command or script can
           be specified here.  If the command contains spaces, you must quote
           the whole command with double quotes.  The default is not to run
           any command.

       p2v.post=poweroff
       p2v.post=reboot
       p2v.post=COMMAND
       p2v.post="COMMAND ARG ..."
           Select a post-conversion command to run if conversion is
           successful.  This can be any command or script.  If the command
           contains spaces, you must quote the whole command with double
           quotes.

           If virt-p2v is running as root, and the command line was set from
           "/proc/cmdline" (not --cmdline), then the default is to run the
           poweroff(8) command.  Otherwise the default is not to run any
           command.

       p2v.fail=COMMAND
       p2v.fail="COMMAND ARG ..."
           Select a post-conversion command to run if conversion fails.  Any
           command or script can be specified here.  If the command contains
           spaces, you must quote the whole command with double quotes.  The
           default is not to run any command.

I have included the fixes in the latest test ISO at:

http://oirase.annexia.org/virt-p2v/RHEL-7.2-preview/

Comment 4 tingting zheng 2015-06-11 03:29:13 UTC
Tested with:
livecd-p2v-201506091319.iso
virt-v2v-1.28.1-1.38.el7.x86_64
libguestfs-1.28.1-1.38.el7.x86_64

1.Check virt-p2v manual:
# man virt-p2v,the part about p2v.pre,p2v.post have been added.
  p2v.pre=COMMAND
       p2v.pre="COMMAND ARG ..."
           Select a pre-conversion command to run.  Any command or script can be specified here.  If the
           command contains spaces, you must quote the whole command with double quotes.  The default is not to
           run any command.

       p2v.post=poweroff
       p2v.post=reboot
       p2v.post=COMMAND
       p2v.post="COMMAND ARG ..."
           Select a post-conversion command to run if conversion is successful.  This can be any command or
           script.  If the command contains spaces, you must quote the whole command with double quotes.

           If virt-p2v is running as root, and the command line was set from "/proc/cmdline" (not --cmdline),
           then the default is to run the poweroff(8) command.  Otherwise the default is not to run any
           command.

       p2v.fail=COMMAND
       p2v.fail="COMMAND ARG ..."
           Select a post-conversion command to run if conversion fails.  Any command or script can be specified
           here.  If the command contains spaces, you must quote the whole command with double quotes.  The
           default is not to run any command.

2.Use virt-p2v to convert host.
For default(didn't set anything about p2v.post) in kernel command line,it will poweroff after conversion.

If set p2v.fail=reboot or p2v.post=reboot,If the conversion fail or finish,the host will reboot.

Refer to the above comments,move the bug to VERIFIED.

Comment 6 errata-xmlrpc 2015-11-19 07:01:46 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-2183.html