From 69e0a94455480ee159cee04847e531d5d771f82b Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 1 Oct 2008 13:07:51 +0000 Subject: - bootloader-config (and other tools): handle /dev/mapper/xxx1 instead of /dev/mapper/xxxp1 (#44182) --- perl-install/NEWS | 3 +++ perl-install/fs/dmraid.pm | 20 ++++++++++++++++++++ perl-install/fsedit.pm | 3 +++ perl-install/standalone/bootloader-config | 1 + 4 files changed, 27 insertions(+) diff --git a/perl-install/NEWS b/perl-install/NEWS index d2e210322..d7b43d741 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,3 +1,6 @@ +- bootloader-config (and other tools): handle /dev/mapper/xxx1 instead of + /dev/mapper/xxxp1 (#44182) + Version 11.62 - 1 October 2008 - fix dithering regression (introduced on 2008-09-29) diff --git a/perl-install/fs/dmraid.pm b/perl-install/fs/dmraid.pm index 7f9e0fbce..fa06e05e9 100644 --- a/perl-install/fs/dmraid.pm +++ b/perl-install/fs/dmraid.pm @@ -112,6 +112,26 @@ sub vgs() { } _sets(); } +# the goal is to handle migration from /dev/mapper/xxx1 to /dev/mapper/xxxp1, +# as used by initrd/nash. +# dmraid has been patched to follow xxxp1 device names. +# so until the box has rebooted on new initrd/dmraid, we must cope with /dev/mapper/xxx1 device names +# (cf #44182) +sub migrate_device_names { + my ($vg) = @_; + + my $dev_name = basename($vg->{device}); + foreach (all('/dev/mapper')) { + my ($nb) = /^\Q$dev_name\E(\d+)$/ or next; + my $new = $dev_name . 'p' . $nb; + if (! -e "/dev/mapper/$new") { + log::l("migrating to $new, creating a compat symlink $_"); + rename "/dev/mapper/$_", "/dev/mapper/$new"; + symlink $new, "/dev/mapper/$_"; + } + } +} + if ($ENV{DRAKX_DEBUG_DMRAID}) { eval(<<'EOF'); my %debug_data = ( diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index bd4831b6b..17ed0647b 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -139,6 +139,9 @@ sub handle_dmraid { return; }; } + if (!$::isInstall) { + fs::dmraid::migrate_device_names($_) foreach @vgs; + } log::l("using dmraid on " . join(' ', map { $_->{device} } @vgs)); my @used_hds = map { diff --git a/perl-install/standalone/bootloader-config b/perl-install/standalone/bootloader-config index e070c37ea..35c117983 100755 --- a/perl-install/standalone/bootloader-config +++ b/perl-install/standalone/bootloader-config @@ -285,6 +285,7 @@ sub _migrate_to_uuids__fstab() { or log::l("migrate_to_uuids: no UUID for $part->{device}, can not migrate it"), next; $part->{prefer_device_UUID} = 1; $part->{prefer_device} = 0; + delete $part->{device_alias} if $part->{device_alias} && $part->{device_alias} =~ m!\bmapper/!; # see fs::dmraid::migrate_device_names() for more log::l("migrate_to_uuids: migrating fstab $part->{device} entry"); $fstab_migrated = 1; -- cgit v1.2.1