Revert "Lib.pm: unknown filesystem label SWAP-sda2 (RHBZ#666578)"
[libguestfs.git] / perl / lib / Sys / Guestfs / Lib.pm
index 393eb8a..4f094de 100644 (file)
@@ -524,12 +524,12 @@ sub _check_linux_root
             $r->{package_management} = "yum";
         }
 
-        elsif (/(Red Hat Enterprise Linux|CentOS|Scientific Linux)/) {
+        elsif (/(Red Hat|CentOS|Scientific Linux)/) {
             chomp; $r->{product_name} = $_;
 
             my $distro = $1;
 
-            if($distro eq "Red Hat Enterprise Linux") {
+            if($distro eq "Red Hat") {
                 $r->{osdistro} = "rhel";
             }
 
@@ -894,7 +894,7 @@ sub _find_filesystem
         my $label = $1;
         foreach (sort keys %$fses) {
             if (exists $fses->{$_}->{label} &&
-                $fses->{$_}->{label} =~ /$label/i) {
+                $fses->{$_}->{label} eq $label) {
                 return ($_, $fses->{$_});
             }
         }
@@ -922,6 +922,9 @@ sub _find_filesystem
         if (m{^/dev/hd(.*)} && exists $fses->{"/dev/sd$1"}) {
             return ("/dev/sd$1", $fses->{"/dev/sd$1"});
         }
+        if (m{^/dev/vd(.*)} && exists $fses->{"/dev/sd$1"}) {
+            return ("/dev/sd$1", $fses->{"/dev/sd$1"});
+        }
         if (m{^/dev/xvd(.*)} && exists $fses->{"/dev/sd$1"}) {
             return ("/dev/sd$1", $fses->{"/dev/sd$1"});
         }
@@ -1105,7 +1108,7 @@ sub _find_grub_prefix
     die(__"Can't find grub on guest") unless($g->exists('/boot/grub/menu.lst'));
 
     # Look for the most specific mount point in mounts
-    foreach my $path qw(/boot/grub /boot /) {
+    foreach my $path (qw(/boot/grub /boot /)) {
         if(exists($mounts->{$path})) {
             return "" if($path eq '/');
             return $path;