Bug 1412090 - Virt-v2v will use the latest kernel instead of the default kernel.
Summary: Virt-v2v will use the latest kernel instead of the default kernel.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.3
Hardware: x86_64
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard: V2V
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-11 08:57 UTC by kuwei@redhat.com
Modified: 2017-02-16 17:00 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-02-16 17:00:49 UTC
Target Upstream Version:


Attachments (Terms of Use)
v2v.log (1.25 MB, text/plain)
2017-01-11 10:41 UTC, kuwei@redhat.com
no flags Details

Description kuwei@redhat.com 2017-01-11 08:57:25 UTC
Description of problem:

Virt-v2v will use the latest kernel instead of the default kernel.

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

virt-v2v-1.32.7-3.el7_3.2.x86_64
libvirt-2.0.0-10.el7_3.4.x86_64
libguestfs-1.32.7-3.el7_3.2.x86_64

How reproducible:

100%

Steps to Reproduce:

1.Prepare a rhel6.6 guest which has more than one kernel.
2:Before convert check the default kernel.
#uname -a
Linux localhost.localdomain 2.6.32-504.el6.x86_64 #1 SMP Tue Sep 16 01:56:35 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux

#cat /boot/grub/grub.conf
#boot=/dev/vda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.32-680.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-680.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
        initrd /initramfs-2.6.32-680.el6.x86_64.img
title Red Hat Enterprise Linux 6 (2.6.32-504.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-504.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
        initrd /initramfs-2.6.32-504.el6.x86_64.img



3:Using virt-v2v convert the guest from kvm to rhv4.0.
[root@localhost yum.repos.d]# virt-v2v rhel6.6-two-kernel -o rhev -os 10.73.131.93:/home/nfs_export
[   0.0] Opening the source -i libvirt rhel6.6-two-kernel
[   0.0] Creating an overlay to protect the source from being modified
[   0.6] Initializing the target -o rhev -os 10.73.131.93:/home/nfs_export
[   1.0] Opening the overlay
[   7.4] Inspecting the overlay
[  24.1] Checking for sufficient free disk space in the guest
[  24.1] Estimating space required on target for each disk
[  24.1] Converting Red Hat Enterprise Linux Server release 6.6 (Santiago) to run on KVM
virt-v2v: warning: /files/boot/grub/device.map/hd0 references unknown
device "vda".  You may have to fix this entry manually after conversion.
virt-v2v: warning: /files/etc/sysconfig/grub/boot references unknown device
"vda".  You may have to fix this entry manually after conversion.
virt-v2v: This guest has virtio drivers installed.
[ 156.9] Mapping filesystem data to avoid copying unused and blank areas
[ 157.4] Closing the overlay
[ 158.3] Checking if the guest needs BIOS or UEFI to boot
[ 158.3] Assigning disks to buses
[ 158.3] Copying disk 1/1 to /tmp/v2v.R9CvD0/39dd1fc0-8a72-42f7-bc49-0ad67388f665/images/094280d5-2c86-4bb0-a69c-d462c09ca757/9d63632e-0177-49ee-ad5b-02d746497afd (raw)
    (100.00/100%)
    [ 200.8] Creating output metadata
    [ 200.9] Finishing off



4.After conversion ,power on the guest to check default kernel.
#uname -a
Linux localhost.localdomain 2.6.32-680.el6.x86_64 #1 SMP Tue Dec 13 19:38:29 EST 2016 x86_64 x86_64 x86_64 GNU/Linux

#cat /boot/grub/grub.conf
#boot=/dev/vda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.32-680.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-680.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
        initrd /initramfs-2.6.32-680.el6.x86_64.img
title Red Hat Enterprise Linux 6 (2.6.32-504.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-504.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
        initrd /initramfs-2.6.32-504.el6.x86_64.img

Actual results:
As above description


Expected results:

virt-v2v should use the default kernel when convert a guest.

Additional info:
1:With below builds virt-v2v also will use the latest kernel instead of the default kernel.
virt-v2v-1.32.7-3.el7.x86_64
libguestfs-1.32.7-3.el7.x86_64
libvirt-2.0.0-10.el7.x86_64

Comment 1 Pino Toscano 2017-01-11 09:49:24 UTC
Hi Kun Wei,

can you please provide the full log of the virt-v2v invocation, running it with -v -x?

Comment 2 kuwei@redhat.com 2017-01-11 10:41:05 UTC
Created attachment 1239401 [details]
v2v.log

Comment 3 Pino Toscano 2017-01-11 18:44:52 UTC
Yup, I can confirm this.

It looks like this was changed in upstream commit 16e817456cf7e5162ba053c92f1a4df24a4160d5:
- before, the list of kernels was iterated from the first kernel to the last, returning the first good kernel (i.e. not for the old hypervisor, and that supports virtio when requested); this matched what the old virt-v2v did (lib/Sys/VirtConvert/Converter/Linux.pm, _configure_kernel function)
- after, the list of kernel is sorted first by virtio, then by kernel version, and then by non-debug flavour, picking the resulting first kernel
in both cases, the starting list of kernels contains all the valid kernels available in the bootloader, with the one marked as default as first element.
It is thus clear than then sorting of kernels done now basically ignores whatever is the default kernel: any kernel with the same features (with virtio, non-debug) but with the higher version will be used instead.

Possible options are:
1) decide the best kernel must be used anyway, no matter the previous default
2) keep the same default, if that kernels has the features needed (i.e. with virtio, non-debug, non-xen)
3) something else I'm currently missing

Comment 4 Richard W.M. Jones 2017-01-16 07:11:01 UTC
I agree this does appear to be a silent change in the old virt-v2v
behaviour.

However what I'm missing here: Does changing to the latest
kernel cause any demonstrable problem?  The bug report just
says the new default kernel is different, but doesn't say
(AFAICT) that this caused a problem.

Comment 6 Richard W.M. Jones 2017-02-16 17:00:49 UTC
I don't believe this is a real bug until it causes some problems,
so I am closing it for now.  Please reopen if there is a real
problem identified.


Note You need to log in before you can comment on or make changes to this bug.