Mike Latimer
2013-Oct-31 20:14 UTC
[Libguestfs] [PATCH 0/4] virt-v2v: Convert RedHat.pm to Linux.pm
In preparation for an upcoming patch which adds support for SUSE guest conversions, it makes sense to have an intermediate steps that changes the RedHat.pm converter into a more generic Linux converter. The SUSE changes will then be limited in scope to only what is required for SUSE support. This series of patches accomplishes the following: - Renames RedHat.pm to Linux.pm - Modifies Linux.pm to be more generic, and ready for additional distribution support (such as SUSE) - Adds functionality to _remap_block_devices, to ensure root and resume devices are updated in both grub legacy and grub2 environments - Allows for qxl or cirrus settings in LibVirtTarget.pm (based on passing guestcaps->{display} from the conversion. I'll submit the SUSE-specific changes after we work through any issues raised here. Mike Latimer (4): Rename RedHat.pm to Linux.pm Make Linux.pm more generic Handle block remaps in grub and grub2 files Support multiple display types through guestcaps MANIFEST | 2 +- lib/Sys/VirtConvert/Connection/LibVirtTarget.pm | 14 +- .../VirtConvert/Converter/{RedHat.pm => Linux.pm} | 225 ++++++++++++++++----- po/POTFILES.in | 2 +- 4 files changed, 185 insertions(+), 58 deletions(-) rename lib/Sys/VirtConvert/Converter/{RedHat.pm => Linux.pm} (92%) -- 1.8.1.4
--- MANIFEST | 2 +- .../VirtConvert/Converter/{RedHat.pm => Linux.pm} | 39 +++++++++++----------- po/POTFILES.in | 2 +- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/MANIFEST b/MANIFEST index 3724fde..19962a6 100644 --- a/MANIFEST +++ b/MANIFEST @@ -16,7 +16,7 @@ lib/Sys/VirtConvert/Connection/Source.pm lib/Sys/VirtConvert/Connection/VMwareOVASource.pm lib/Sys/VirtConvert/Connection/Volume.pm lib/Sys/VirtConvert/Converter.pm -lib/Sys/VirtConvert/Converter/RedHat.pm +lib/Sys/VirtConvert/Converter/Linux.pm lib/Sys/VirtConvert/Converter/Windows.pm lib/Sys/VirtConvert/ExecHelper.pm lib/Sys/VirtConvert/GuestfsHandle.pm diff --git a/lib/Sys/VirtConvert/Converter/RedHat.pm b/lib/Sys/VirtConvert/Converter/Linux.pm similarity index 98% rename from lib/Sys/VirtConvert/Converter/RedHat.pm rename to lib/Sys/VirtConvert/Converter/Linux.pm index f3926e8..dd3573e 100644 --- a/lib/Sys/VirtConvert/Converter/RedHat.pm +++ b/lib/Sys/VirtConvert/Converter/Linux.pm @@ -1,5 +1,6 @@ -# Sys::VirtConvert::Converter::RedHat +# Sys::VirtConvert::Converter::Linux # Copyright (C) 2009-2012 Red Hat Inc. +# Copyright (C) 2013 SUSE Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -21,7 +22,7 @@ use warnings; # Functions supported by grubby, and therefore common between gruby legacy and # grub2 -package Sys::VirtConvert::Converter::RedHat::Grub; +package Sys::VirtConvert::Converter::Linux::Grub; use Sys::VirtConvert::Util; use Locale::TextDomain 'virt-v2v'; @@ -61,15 +62,15 @@ sub check_efi # Methods for inspecting and manipulating grub legacy -package Sys::VirtConvert::Converter::RedHat::GrubLegacy; +package Sys::VirtConvert::Converter::Linux::GrubLegacy; use Sys::VirtConvert::Util qw(:DEFAULT augeas_error); use File::Basename; use Locale::TextDomain 'virt-v2v'; -@Sys::VirtConvert::Converter::RedHat::GrubLegacy::ISA - qw(Sys::VirtConvert::Converter::RedHat::Grub); +@Sys::VirtConvert::Converter::Linux::GrubLegacy::ISA + qw(Sys::VirtConvert::Converter::Linux::Grub); sub new { @@ -251,7 +252,7 @@ sub check return if scalar(@entries) > 0; my $kernel - Sys::VirtConvert::Converter::RedHat::_inspect_linux_kernel($g, $path); + Sys::VirtConvert::Converter::Linux::_inspect_linux_kernel($g, $path); my $version = $kernel->{version}; my $grub_initrd = dirname($path)."/initrd-$version"; @@ -365,13 +366,13 @@ sub convert_efi # attempt to use grub2's configuration because it's utterly insane. Instead, # we reverse engineer the way the config is automatically generated and use # that instead. -package Sys::VirtConvert::Converter::RedHat::Grub2; +package Sys::VirtConvert::Converter::Linux::Grub2; use Sys::VirtConvert::Util qw(:DEFAULT augeas_error); use Locale::TextDomain 'virt-v2v'; -@Sys::VirtConvert::Converter::RedHat::Grub2::ISA - qw(Sys::VirtConvert::Converter::RedHat::Grub); +@Sys::VirtConvert::Converter::Linux::Grub2::ISA + qw(Sys::VirtConvert::Converter::Linux::Grub); sub new { @@ -486,7 +487,7 @@ sub convert_efi # EFI systems boot using grub2-efi, and probably don't have the base grub2 # package installed. - Sys::VirtConvert::Convert::RedHat::_install_any + Sys::VirtConvert::Convert::Linux::_install_any (undef, ['grub2'], undef, $g, $self->{root}, $self->{config}, $self) or v2vdie __x('Failed to install non-EFI grub2'); @@ -509,7 +510,7 @@ sub convert_efi } -package Sys::VirtConvert::Converter::RedHat; +package Sys::VirtConvert::Converter::Linux; use Sys::VirtConvert::Util qw(:DEFAULT augeas_error scsi_first_cmp); use Locale::TextDomain 'virt-v2v'; @@ -518,7 +519,7 @@ use Locale::TextDomain 'virt-v2v'; =head1 NAME -Sys::VirtConvert::Converter::RedHat - Convert a Red Hat based guest to run on KVM +Sys::VirtConvert::Converter::Linux - Convert a Linux based guest to run on KVM =head1 SYNOPSIS @@ -528,7 +529,7 @@ Sys::VirtConvert::Converter::RedHat - Convert a Red Hat based guest to run on KV =head1 DESCRIPTION -Sys::VirtConvert::Converter::RedHat converts a Red Hat based guest to use KVM. +Sys::VirtConvert::Converter::Linux converts a Linux based guest to use KVM. =head1 METHODS @@ -544,9 +545,9 @@ sub _is_rhel_family ($g->inspect_get_distro($root) =~ /^(rhel|centos|scientificlinux|redhat-based)$/); } -=item Sys::VirtConvert::Converter::RedHat->can_handle(g, root) +=item Sys::VirtConvert::Converter::Linux->can_handle(g, root) -Return 1 if Sys::VirtConvert::Converter::RedHat can convert the given guest +Return 1 if Sys::VirtConvert::Converter::Linux can convert the given guest =cut @@ -560,9 +561,9 @@ sub can_handle (_is_rhel_family($g, $root) || $g->inspect_get_distro($root) eq 'fedora')); } -=item Sys::VirtConvert::Converter::RedHat->convert(g, root, config, meta, options) +=item Sys::VirtConvert::Converter::Linux->convert(g, root, config, meta, options) -Convert a Red Hat based guest. Assume that can_handle has previously returned 1. +Convert a Linux based guest. Assume that can_handle has previously returned 1. =over @@ -601,8 +602,8 @@ sub convert _init_augeas($g); my $grub; - $grub = eval { Sys::VirtConvert::Converter::RedHat::Grub2->new($g, $root, $config) }; - $grub = eval { Sys::VirtConvert::Converter::RedHat::GrubLegacy->new($g, $root) } + $grub = eval { Sys::VirtConvert::Converter::Linux::Grub2->new($g, $root, $config) }; + $grub = eval { Sys::VirtConvert::Converter::Linux::GrubLegacy->new($g, $root) } unless defined($grub); v2vdie __('No grub configuration found') unless defined($grub); diff --git a/po/POTFILES.in b/po/POTFILES.in index d613060..4c8d435 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -13,7 +13,7 @@ ../lib/Sys/VirtConvert/Transfer/SSH.pm ../lib/Sys/VirtConvert/Transfer/ESX.pm ../lib/Sys/VirtConvert/Config.pm -../lib/Sys/VirtConvert/Converter/RedHat.pm +../lib/Sys/VirtConvert/Converter/Linux.pm ../lib/Sys/VirtConvert/Converter/Windows.pm ../lib/Sys/VirtConvert/GuestfsHandle.pm ../p2v/server/virt-p2v-server.pl -- 1.8.1.4
--- lib/Sys/VirtConvert/Converter/Linux.pm | 125 +++++++++++++++++++++++++-------- 1 file changed, 97 insertions(+), 28 deletions(-) diff --git a/lib/Sys/VirtConvert/Converter/Linux.pm b/lib/Sys/VirtConvert/Converter/Linux.pm index dd3573e..344d89b 100644 --- a/lib/Sys/VirtConvert/Converter/Linux.pm +++ b/lib/Sys/VirtConvert/Converter/Linux.pm @@ -31,16 +31,50 @@ sub get_initrd { my $self = shift; my ($path) = @_; + my $initrd; my $g = $self->{g}; - foreach my $line ($g->command_lines(['grubby', '--info', $path])) { - return $1 if $line =~ /^initrd=(\S+)/; + if ($g->exists('/sbin/grubby')) { + foreach my $line ($g->command_lines(['grubby', '--info', $path])) { + return $1 if $line =~ /^initrd=(\S+)/; + } } + # If initrd has not been found, use heuristics if the file exists + ($initrd = $path) =~ s/vmlinuz/initrd/; + return $initrd if ($g->exists($initrd)); + v2vdie __x('Didn\'t find initrd for kernel {path}', path => $path); } +sub get_default_image +{ + my $self = shift; + my $default; + + my $g = $self->{g}; + + if ($g->exists('/sbin/grubby')) { + $default = $g->command(['grubby', '--default-kernel']); + } + + chomp($default); + return $default; +} + +sub set_default_image +{ + my $self = shift; + my ($path) = @_; + + my $g = $self->{g}; + + if ($g->exists('/sbin/grubby')) { + $g->command(['grubby', '--set-default', $path]); + } +} + sub check_efi { my $self = shift; @@ -237,7 +271,7 @@ sub update_console sub check { my $self = shift; - my ($path) = @_; + my ($path, $root) = @_; my $g = $self->{g}; my $grub_conf = $self->{grub_conf}; @@ -256,11 +290,13 @@ sub check my $version = $kernel->{version}; my $grub_initrd = dirname($path)."/initrd-$version"; - # No point in dying if /etc/redhat-release can't be read - my ($title) = eval { $g->read_lines('/etc/redhat-release') }; + # No point in dying if /etc/(distro)-release can't be read + my ($title) = eval { $g->inspect_get_product_name($root) }; $title ||= 'Linux'; - # This is how new-kernel-pkg does it + # Remove codename or architecture + $title =~ s/ \(.*\)//; + # Remove release string and add version (like new-kernel-pkg) $title =~ s/ release.*//; $title .= " ($version)"; @@ -408,8 +444,7 @@ sub list_kernels my @kernels; # Start by adding the default kernel - my $default = $g->command(['grubby', '--default-kernel']); - chomp($default); + my $default = $self->get_default_image(); push(@kernels, $default) if length($default) > 0; # This is how the grub2 config generator enumerates kernels @@ -431,8 +466,15 @@ sub update_console my $g = $self->{g}; + my $grub_cmdline; + if ($g->exists('/etc/sysconfig/grub')) { + $grub_cmdline = '/files/etc/sysconfig/grub/GRUB_CMDLINE_LINUX'; + } else { + $grub_cmdline = '/files/etc/default/grub/GRUB_CMDLINE_LINUX_DEFAULT'; + } + my $cmdline - eval { $g->aug_get('/files/etc/sysconfig/grub/GRUB_CMDLINE_LINUX') }; + eval { $g->aug_get($grub_cmdline) }; if (defined($cmdline) && $cmdline =~ /\bconsole=(?:x|h)vc0\b/) { if ($remove) { @@ -442,7 +484,7 @@ sub update_console } eval { - $g->aug_set('/files/etc/sysconfig/grub/GRUB_CMDLINE_LINUX', $cmdline); + $g->aug_set($grub_cmdline, $cmdline); $g->aug_save(); }; augeas_error($g, $@) if ($@); @@ -464,11 +506,14 @@ sub write my $g = $self->{g}; - my $default = $g->command(['grubby', '--default-kernel']); - chomp($default); + my $default = $self->get_default_image(); if ($default ne $path) { - $g->command(['grubby', '--set-default', $path]); + eval { $self->set_default_image($path) }; + if ($@) { + logmsg WARN, __x('Unable to set default kernel to {path}', + path => $path); + } } } @@ -626,7 +671,8 @@ sub convert my $remove_serial_console = exists($options->{NO_SERIAL_CONSOLE}); _configure_console($g, $grub, $remove_serial_console); - _configure_display_driver($g, $root, $config, $meta, $grub); + my $display = _get_display_driver($g, $root); + _configure_display_driver($g, $root, $config, $meta, $grub, $driver); _remap_block_devices($meta, $virtio, $g, $root); _configure_kernel_modules($g, $virtio); _configure_boot($kernel, $virtio, $g, $root, $grub); @@ -637,6 +683,7 @@ sub convert $guestcaps{net} = $virtio == 1 ? 'virtio' : 'e1000'; $guestcaps{arch} = _get_os_arch($g, $root, $grub); $guestcaps{acpi} = _supports_acpi($g, $root, $guestcaps{arch}); + $guestcaps{display} = $display; return \%guestcaps; } @@ -843,7 +890,7 @@ sub _configure_console sub _configure_display_driver { - my ($g, $root, $config, $meta, $grub) = @_; + my ($g, $root, $config, $meta, $grub, $display) = @_; # Update the display driver if it exists my $updated = 0; @@ -867,7 +914,7 @@ sub _configure_display_driver } foreach my $path ($g->aug_match('/files'.$xorg.'/Device/Driver')) { - $g->aug_set($path, 'qxl'); + $g->aug_set($path, $display); $updated = 1; } @@ -886,13 +933,14 @@ sub _configure_display_driver augeas_error($g, $@) if ($@); # If we updated the X driver, check if X itself is actually installed. If it - # is, ensure the qxl driver is installed. + # is, ensure the specified driver is installed. if ($updated && ($g->exists('/usr/bin/X') || $g->exists('/usr/bin/X11/X')) && - !_install_capability('qxl', $g, $root, $config, $meta, $grub)) + !_install_capability($display, $g, $root, $config, $meta, $grub)) { - logmsg WARN, __('Display driver was updated to qxl, but unable to '. - 'install qxl driver. X may not function correctly'); + logmsg WARN, __('Display driver was updated to {display}, but unable '. + 'to install {display} driver. X may not function '. + 'correctly', display => $display); } } @@ -1014,7 +1062,7 @@ sub _configure_kernel # If the guest is using a Xen PV kernel, choose an appropriate # normal kernel replacement - if ($kernel_pkg eq "kernel-xen" || $kernel_pkg eq "kernel-xenU") { + if ($kernel_pkg =~ /^kernel-xen/) { $kernel_pkg = _get_replacement_kernel_name($g, $root, $kernel_arch, $meta); @@ -1122,8 +1170,8 @@ sub _get_os_arch # Default to x86_64 if we still didn't find an architecture return 'x86_64' unless defined($arch); - # We want an i686 guest for i[345]86 - return 'i686' if($arch =~ /^i[345]86$/); + # Determine the correct 32bit arch + $arch = _set_32bit_arch($g, $root, $arch); return $arch; } @@ -1507,7 +1555,7 @@ sub _install_capability # If the guest is using a Xen PV kernel, choose an appropriate # normal kernel replacement - if ($kernel_pkg eq "kernel-xen" || $kernel_pkg eq "kernel-xenU") + if ($kernel_pkg =~ /^kernel-xen/) { $kernel_pkg _get_replacement_kernel_name($g, $root, $kernel_arch, @@ -1658,7 +1706,7 @@ sub _install_any if (defined($kernel)) { foreach my $k ($g->glob_expand('/boot/vmlinuz-*')) { if (!grep(/^$k$/, @k_before)) { - $grub->check($k); + $grub->check($k, $root); last; } } @@ -1976,9 +2024,8 @@ sub _discover_kernel # directly detected $kernel_arch = $g->inspect_get_arch($root) unless defined($kernel_arch); - # We haven't supported anything other than i686 for the kernel on 32 bit for - # a very long time. - $kernel_arch = 'i686' if ('i386' eq $kernel_arch); + # Determine the correct 32bit kernel_arch + $kernel_arch = _set_32bit_arch($g, $root, $kernel_arch); return ($kernel_pkg, $kernel_arch, $kernel_ver); } @@ -2468,6 +2515,28 @@ sub _supports_virtio return 1; } +# Distributions may use different display drivers. +sub _get_display_driver +{ + my ($g, $root) = @_; + + # RedHat uses qxl, which should be the default driver. + return 'qxl'; +} + +# Distributions may use either i586 or i686 for 32bit architectures +sub _set_32bit_arch +{ + my ($g, $root, $arch) = @_; + + if ($arch =~ /^i[345]86$/) { + # RedHat uses i686, which should be the default 32bit arch + $arch = 'i686'; + } + + return $arch; +} + =back =head1 COPYRIGHT -- 1.8.1.4
Mike Latimer
2013-Oct-31 20:14 UTC
[Libguestfs] [PATCH 3/4] Handle block remaps in grub and grub2 files
--- lib/Sys/VirtConvert/Converter/Linux.pm | 61 ++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 7 deletions(-) diff --git a/lib/Sys/VirtConvert/Converter/Linux.pm b/lib/Sys/VirtConvert/Converter/Linux.pm index 344d89b..531d72b 100644 --- a/lib/Sys/VirtConvert/Converter/Linux.pm +++ b/lib/Sys/VirtConvert/Converter/Linux.pm @@ -673,7 +673,7 @@ sub convert my $display = _get_display_driver($g, $root); _configure_display_driver($g, $root, $config, $meta, $grub, $driver); - _remap_block_devices($meta, $virtio, $g, $root); + _remap_block_devices($meta, $virtio, $g, $root, $grub); _configure_kernel_modules($g, $virtio); _configure_boot($kernel, $virtio, $g, $root, $grub); @@ -2251,7 +2251,7 @@ sub _rpmvercmp sub _remap_block_devices { - my ($meta, $virtio, $g, $root) = @_; + my ($meta, $virtio, $g, $root, $grub) = @_; my @devices = map { $_->{device} } @{$meta->{disks}}; @devices = sort { scsi_first_cmp($a, $b) } @devices; @@ -2338,13 +2338,46 @@ sub _remap_block_devices } eval { - # Update bare device references in fstab and grub's device.map - foreach my $spec ($g->aug_match('/files/etc/fstab/*/spec'), - $g->aug_match('/files/boot/grub/device.map/*'. - '[label() != "#comment"]')) + my @checklist; + my @matchlist; + my $grub2_remap; + + # Add standard configuration files to the checklist + push (@checklist, '/files/etc/fstab/*/spec'); + + # Add grub or grub2 files to the checklist + if (defined($grub->{grub_conf})) { + push (@checklist, "/files$grub->{grub_conf}/*/kernel/root"); + push (@checklist, "/files$grub->{grub_conf}/*/kernel/resume"); + push (@checklist, '/files/boot/grub/device.map/*'. + '[label() != "#comment"]'); + } + elsif (defined($grub->{cfg})) { + push (@checklist, '/files/etc/sysconfig/grub/GRUB_CMDLINE_LINUX'); + push (@checklist, '/files/etc/default/grub/'. + 'GRUB_CMDLINE_LINUX_DEFAULT'); + } + + # Search through all checklist entries and add matches to a matchlist + foreach my $entry (@checklist) { + push (@matchlist, $g->aug_match($entry)); + } + + # Update device references for every entry in the matchlist + foreach my $spec (@matchlist) { my $device = $g->aug_get($spec); + # If this is a grub2 environment, isolate 'resume=' value + my $grub2_start; + my $grub2_end; + if (($spec =~ /.*GRUB_CMDLINE.*/) && + ($device =~ /(.*resume=)(\S+)(\s.*)/)) { + $grub2_start = $1; + $device = $2; + $grub2_end = $3; + } + # Match device names and partition numbers my $name; my $part; foreach my $r (qr{^/dev/(cciss/c\d+d\d+)(?:p(\d+))?$}, @@ -2366,7 +2399,9 @@ sub _remap_block_devices # about. The user will have to fix this post-conversion. if (!exists($map{$name})) { my $warned = 0; - for my $file ('/etc/fstab', '/boot/grub/device.map') { + for my $file ('/etc/fstab', '/boot/grub/device.map', + '/boot/grub/menu.lst', '/etc/sysconfig/grub', + '/etc/default/grub') { if ($spec =~ m{^/files$file}) { logmsg WARN, __x('{file} references unknown device '. '{device}. This entry must be '. @@ -2389,10 +2424,22 @@ sub _remap_block_devices my $mapped = '/dev/'.$map{$name}; $mapped .= $part if defined($part); + + # If this is a grub2 entry, rebuild the entire entry + if ($spec =~ /.*GRUB_CMDLINE.*/) { + $mapped = $grub2_start.$mapped.$grub2_end; + $grub2_remap = 1; + } + $g->aug_set($spec, $mapped); } $g->aug_save(); + + # Re-generate the grub2 config if grub2 files were changed + if (defined($grub2_remap)) { + $g->command(['grub2-mkconfig', '-o', $grub->{cfg}]); + } }; augeas_error($g, $@) if ($@); -- 1.8.1.4
Mike Latimer
2013-Oct-31 20:14 UTC
[Libguestfs] [PATCH 4/4] Support multiple display types through guestcaps
--- lib/Sys/VirtConvert/Connection/LibVirtTarget.pm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/Sys/VirtConvert/Connection/LibVirtTarget.pm b/lib/Sys/VirtConvert/Connection/LibVirtTarget.pm index 6a09800..911a7da 100644 --- a/lib/Sys/VirtConvert/Connection/LibVirtTarget.pm +++ b/lib/Sys/VirtConvert/Connection/LibVirtTarget.pm @@ -336,6 +336,16 @@ sub _meta_to_domxml { my ($meta, $config, $guestcaps) = @_; + my $video_model; + my $display_type; + if ($guestcaps->{display} eq 'cirrus') { + $video_model = "model type='cirrus' vram='9216' heads='1'"; + $display_type = "vnc"; + } else { + $video_model = "model type='qxl' ram='65536' heads='1'"; + $display_type = "spice"; + } + my $dom = new XML::DOM::Parser->parse(<<DOM); <domain type='kvm'> <os> @@ -349,7 +359,7 @@ sub _meta_to_domxml <input type='tablet' bus='usb'/> <input type='mouse' bus='ps2'/> <video> - <model type='qxl' ram='65536' heads='1'/> + <$video_model/> </video> <console type='pty'/> </devices> @@ -386,7 +396,7 @@ DOM } my $graphics = _append_elem($devices, 'graphics'); - $graphics->setAttribute('type', 'spice'); + $graphics->setAttribute('type', $display_type); $graphics->setAttribute('keymap', $display_keymap) if defined($display_keymap); $graphics->setAttribute('passwd', $display_password) -- 1.8.1.4
Matthew Booth
2013-Nov-06 16:47 UTC
Re: [Libguestfs] [PATCH 0/4] virt-v2v: Convert RedHat.pm to Linux.pm
Thanks, Mike. ACK to all of these, and pushed. As it happens, I'd already started breaking some of this stuff out myself when I found this patchset :/ Rather than redo it, I've kept what I'd already done and rebased on top of it. I also did some testing and fixed a couple of bugs: "/files$grub->{grub_conf}*/kernel/root" should have been "/files $grub->{grub_conf}/*/kernel/root" in _remap_block_devices. It turns out that the release suffix used by RHEL 4 and 5 really is 'xen', not '-xen'. Note that this is the release, not the package name, which is what confused me when I originally reviewed it. I've removed this change. Can you please pull the latest from git and rebase any future patches on top of that? Please be careful not to reintroduce the '-xen' change! I've accidentally done that at least once whilst working on this patchset. Matt On Thu, 2013-10-31 at 14:14 -0600, Mike Latimer wrote:> In preparation for an upcoming patch which adds support for SUSE guest > conversions, it makes sense to have an intermediate steps that changes the > RedHat.pm converter into a more generic Linux converter. The SUSE changes > will then be limited in scope to only what is required for SUSE support. > > This series of patches accomplishes the following: > > - Renames RedHat.pm to Linux.pm > - Modifies Linux.pm to be more generic, and ready for additional distribution > support (such as SUSE) > - Adds functionality to _remap_block_devices, to ensure root and resume > devices are updated in both grub legacy and grub2 environments > - Allows for qxl or cirrus settings in LibVirtTarget.pm (based on passing > guestcaps->{display} from the conversion. > > I'll submit the SUSE-specific changes after we work through any issues raised > here. > > Mike Latimer (4): > Rename RedHat.pm to Linux.pm > Make Linux.pm more generic > Handle block remaps in grub and grub2 files > Support multiple display types through guestcaps > > MANIFEST | 2 +- > lib/Sys/VirtConvert/Connection/LibVirtTarget.pm | 14 +- > .../VirtConvert/Converter/{RedHat.pm => Linux.pm} | 225 ++++++++++++++++----- > po/POTFILES.in | 2 +- > 4 files changed, 185 insertions(+), 58 deletions(-) > rename lib/Sys/VirtConvert/Converter/{RedHat.pm => Linux.pm} (92%) >
Mike Latimer
2013-Nov-06 17:55 UTC
Re: [Libguestfs] [PATCH 0/4] virt-v2v: Convert RedHat.pm to Linux.pm
On Wednesday, November 06, 2013 04:47:37 PM Matthew Booth wrote:> Thanks, Mike. ACK to all of these, and pushed.Thank you!> As it happens, I'd already started breaking some of this stuff out > myself when I found this patchset :/ Rather than redo it, I've kept what > I'd already done and rebased on top of it.Sorry for the duplication of efforts. Now that the existing code is a bit more generic, I expect the SUSE specific changes to be much less painful.> I also did some testing and fixed a couple of bugs: > > "/files$grub->{grub_conf}*/kernel/root" should have been "/files > $grub->{grub_conf}/*/kernel/root" in _remap_block_devices.I caught that one in my testing as well. Sorry about that.> It turns out that the release suffix used by RHEL 4 and 5 really is > 'xen', not '-xen'. Note that this is the release, not the package name, > which is what confused me when I originally reviewed it. I've removed > this change.Ok, I understand what is going on. In _inspect_linux_kernel, the version of Xen PV kernels is determined by the filename, such as vmlinuz-2.6.18-348.2.1.el5xen, which indeed can end in 'xen'. I'll likely have to also remove any '-xen' strings for the SUSE case, but I'll look into this a bit further.> Can you please pull the latest from git and rebase any future patches on > top of that? Please be careful not to reintroduce the '-xen' change! > I've accidentally done that at least once whilst working on this > patchset.Will do. Thanks again for the work here. -Mike
Seemingly Similar Threads
- [PATCH 0/4] virt-v2v: Convert RedHat.pm to Linux.pm
- [PATCH 1/7] Push $desc creation into Sys::VirtConvert::Converter->convert
- Re: [PATCH] virt-v2v: Convert RedHat.pm to Linux.pm - for SUSE support
- [PATCH] virt-v2v: Convert RedHat.pm to Linux.pm - for SUSE support
- Re: [PATCH] virt-v2v: Convert RedHat.pm to Linux.pm - for SUSE support