[Libguestfs] virt-v2v should add kernel console= to Xen->KVM converted guest's grub.conf

Chuck Anderson cra at WPI.EDU
Fri Jan 6 00:10:38 UTC 2012


I'm using virt-v2v (0.8.3 currently) on EL6 to convert Xen guests to
KVM.  I see how virt-v2v converts any existing references to xvc0 and
hvc0 serial console devices in /etc/inittab, /etc/securetty, and
grub.conf.  However, my Xen DomU grub.conf's don't have any mention of
console= on the kernel lines, because the Xen DomU kernel defaults to
using the correct xvc0 console.  As a result, after conversion console
messages don't go to the virsh console, although a getty does get
started and securetty is updated correctly.

I'd like to propose that the converter add such kernel console=
arguments if it doesn't find any to replace.  Here is the current
code:

    # Update any kernel console lines
    foreach my $augpath
        ($g->aug_match("/files$grub_conf/title/kernel/console"))
    {
        my $console = $g->aug_get($augpath);
        if ($console =~ /\b(x|h)vc0\b/) {
            $console =~ s/\b(x|h)vc0\b/ttyS0/g;
            $g->aug_set($augpath, $console);
        }
    }

I'd imagine that if no matches are found, it should use augeas to set
console=ttyS0,115200 on all matching kernel lines, but I'm not
familiar enough with augeas nor the perl bindings to attempt this.  I
don't see where the augeas bindings are being imported into virt-v2v,
so I'm not sure where to find the documentation for whatever bindings
are being used (the regular perl bindings as mentioned on upstream
augeas website don't appear anywhere on my system).

I'd appreciate any pointers to documentation so I can attempt this
myself, or even better, a quick patch to try out if this seems like a
good idea.

Thanks!

(A different, but related problem, is that EL5.7 anaconda apparently
isn't smart enough to add console= to grub.conf even though anaconda
itself was booted with a console= parameter via virt-install. So after
the install completes, virsh console becomes silent, and the new
install doesn't get a getty or updated securetty on it.  I'm
investigating kickstart workarounds to manually add console= in this
case.)




More information about the Libguestfs mailing list