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

[Libguestfs] [PATCH] Converter: Don't die if we can't do guest-specific conversion



We currently die with an error message if we can't find a Converter for a
specific guest operating system. However, virt-v2v can still usefully transfer
storage and metadata.

This change turns the error into a (lengthy) warning, and continues with
metadata conversion if guest conversion isn't possible.
---
 lib/Sys/VirtV2V/Converter.pm |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/lib/Sys/VirtV2V/Converter.pm b/lib/Sys/VirtV2V/Converter.pm
index a5b7e43..97c212e 100644
--- a/lib/Sys/VirtV2V/Converter.pm
+++ b/lib/Sys/VirtV2V/Converter.pm
@@ -136,7 +136,7 @@ sub convert
     my $class = shift;
 
     my ($g, $guestos, $config, $dom, $desc, $devices) = @_;
-    carp("convert called without guestos argument") unless defined($guestos);
+    # guestos may be undef if none was found
     carp("convert called without config argument") unless defined($config);
     carp("convert called without dom argument") unless defined($dom);
     carp("convert called without desc argument") unless defined($desc);
@@ -152,8 +152,23 @@ sub convert
         }
     }
 
-    die(user_message(__"Unable to find a module to convert this guest"))
-        unless (defined($guestcaps));
+    unless (defined($guestcaps)) {
+        print STDERR user_message(__x("WARNING: Unable to convert this guest ".
+                                      "operating system. Its storage will be ".
+                                      "transfered and a domain created for ".
+                                      "it, but it may not operate correctly ".
+                                      "without manual reconfiguration. The ".
+                                      "domain will present all storage ".
+                                      "devices as IDE, all network interfaces ".
+                                      "as e1000 and the host as x86_64."));
+
+        # Set some conservative defaults
+        $guestcaps = {
+            'arch'   => 'x86_64',
+            'virtio' => 0,
+            'acpi'   => 1
+        };
+    }
 
     # Map network names from config
     _map_networks($dom, $config);
-- 
1.6.6.1


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