[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH] Converter: Blacklist ACPI for RHEL 3 x86_64



---
 lib/Sys/VirtV2V/Converter.pm       |   13 +++++++++++--
 lib/Sys/VirtV2V/Converter/Linux.pm |   16 ++++++++++++++++
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/lib/Sys/VirtV2V/Converter.pm b/lib/Sys/VirtV2V/Converter.pm
index 3b0500b..a6eba45 100644
--- a/lib/Sys/VirtV2V/Converter.pm
+++ b/lib/Sys/VirtV2V/Converter.pm
@@ -319,10 +319,19 @@ sub _configure_capabilities
     }
 
     foreach my $feature ($dom->findnodes('/domain/features/*')) {
-        if (!exists($features{$feature->getNodeName()})) {
+        my $name = $feature->getNodeName();
+
+        if (!exists($features{$name})) {
             print STDERR user_message
                 (__x("The connected hypervisor does not support ".
-                     "feature {feature}", feature => $feature->getNodeName()));
+                     "feature {feature}", feature => $name));
+            $feature->getParentNode()->removeChild($feature);
+        }
+
+        if ($name eq 'acpi' && !$guestcaps->{acpi}) {
+            print STDERR user_message
+                (__"The target guest does not support acpi under KVM. ACPI ".
+                   "will be disabled.");
             $feature->getParentNode()->removeChild($feature);
         }
     }
diff --git a/lib/Sys/VirtV2V/Converter/Linux.pm b/lib/Sys/VirtV2V/Converter/Linux.pm
index db7a1ed..057ef45 100644
--- a/lib/Sys/VirtV2V/Converter/Linux.pm
+++ b/lib/Sys/VirtV2V/Converter/Linux.pm
@@ -105,6 +105,7 @@ sub convert
 
     $guestcaps{virtio} = $virtio;
     $guestcaps{arch}   = _get_os_arch($desc);
+    $guestcaps{acpi}   = _supports_acpi($desc, $guestcaps{arch});
 
     return \%guestcaps;
 }
@@ -495,6 +496,21 @@ sub _find_xen_kernel_modules
     return @modules;
 }
 
+# Return 1 if the guest supports ACPI, 0 otherwise
+sub _supports_acpi
+{
+    my ($desc, $arch) = @_;
+
+    # Blacklist configurations which are known to fail
+    # RHEL 3, x86_64
+    if ($desc->{distro} eq 'rhel' && $desc->{major_version} == 3 &&
+        $arch eq 'x86_64') {
+        return 0;
+    }
+
+    return 1;
+}
+
 =back
 
 =head1 COPYRIGHT
-- 
1.6.5.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]