Mike Latimer
2014-Jan-03 20:38 UTC
[Libguestfs] [PATCH] virt-v2v: Default to non-virtio drivers if driver path is missing
During a Windows conversion, _prepare_virtio_drivers aborts the conversion
completely if the configured virtio driver path does not exist. If the path
exists but is empty, the conversion completes correctly by defaulting to the
non-virtio drivers. This patch treats a missing directory just like missing
drivers, by reporting a message, then defaulting to non-virtio drivers.
---
lib/Sys/VirtConvert/Converter/Windows.pm | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/lib/Sys/VirtConvert/Converter/Windows.pm
b/lib/Sys/VirtConvert/Converter/Windows.pm
index ce8b474..feeb2b9 100644
--- a/lib/Sys/VirtConvert/Converter/Windows.pm
+++ b/lib/Sys/VirtConvert/Converter/Windows.pm
@@ -312,13 +312,24 @@ sub _prepare_virtio_drivers
return ($block, $net);
}
- # We can't proceed if there are any files missing
+ # We can't install any drivers if the defined virtio path is missing
my $virtio_guest = $config->get_transfer_path($virtio_host);
- v2vdie __x('Installation failed because the following '.
- 'files referenced in the configuration file are '.
- 'required, but missing: {list}',
- list => $virtio_host)
- unless (defined($virtio_host) && $g->exists($virtio_guest));
+ if (!(defined($virtio_host) && $g->exists($virtio_guest))) {
+ my $block = 'ide';
+ my $net = 'rtl8139';
+
+ logmsg WARN, __x('The installation of virtio drivers failed because
'.
+ 'the driver path referenced in the configuration file '.
+ '({path}) is required, but missing. The guest will be '.
+ 'configured with a {block} block storage adapter and a {net}
'.
+ 'network adapter, but no drivers will be installed for them.
'.
+ 'If the {block} driver is not already installed in the
guest,'.
+ ' it will fail to boot. If the {net} driver is not already
'.
+ 'installed in the guest, you must install it manually after
'.
+ 'conversion.', path => $virtio_host, block =>
$block,
+ net => $net);
+ return ($block, $net);
+ }
my ($block, $net);
my $viostor_guest = File::Spec->catfile($virtio_guest,
'viostor.sys');
--
1.8.1.4
Matthew Booth
2014-Jan-07 11:04 UTC
Re: [Libguestfs] [PATCH] virt-v2v: Default to non-virtio drivers if driver path is missing
On 03/01/14 20:38, Mike Latimer wrote:> During a Windows conversion, _prepare_virtio_drivers aborts the conversion > completely if the configured virtio driver path does not exist. If the path > exists but is empty, the conversion completes correctly by defaulting to the > non-virtio drivers. This patch treats a missing directory just like missing > drivers, by reporting a message, then defaulting to non-virtio drivers. > > --- > lib/Sys/VirtConvert/Converter/Windows.pm | 23 +++++++++++++++++------ > 1 file changed, 17 insertions(+), 6 deletions(-) > > diff --git a/lib/Sys/VirtConvert/Converter/Windows.pm b/lib/Sys/VirtConvert/Converter/Windows.pm > index ce8b474..feeb2b9 100644 > --- a/lib/Sys/VirtConvert/Converter/Windows.pm > +++ b/lib/Sys/VirtConvert/Converter/Windows.pm > @@ -312,13 +312,24 @@ sub _prepare_virtio_drivers > return ($block, $net); > } > > - # We can't proceed if there are any files missing > + # We can't install any drivers if the defined virtio path is missing > my $virtio_guest = $config->get_transfer_path($virtio_host); > - v2vdie __x('Installation failed because the following '. > - 'files referenced in the configuration file are '. > - 'required, but missing: {list}', > - list => $virtio_host) > - unless (defined($virtio_host) && $g->exists($virtio_guest)); > + if (!(defined($virtio_host) && $g->exists($virtio_guest))) { > + my $block = 'ide'; > + my $net = 'rtl8139'; > + > + logmsg WARN, __x('The installation of virtio drivers failed because '. > + 'the driver path referenced in the configuration file '. > + '({path}) is required, but missing. The guest will be '. > + 'configured with a {block} block storage adapter and a {net} '. > + 'network adapter, but no drivers will be installed for them. '. > + 'If the {block} driver is not already installed in the guest,'. > + ' it will fail to boot. If the {net} driver is not already '. > + 'installed in the guest, you must install it manually after '. > + 'conversion.', path => $virtio_host, block => $block, > + net => $net); > + return ($block, $net); > + } > > my ($block, $net); > my $viostor_guest = File::Spec->catfile($virtio_guest, 'viostor.sys'); >ACK. Thanks, Mike. All pushed. Matt -- Matthew Booth, RHCA, RHCSS Red Hat Engineering, Virtualisation Team GPG ID: D33C3490 GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490
Seemingly Similar Threads
- [PATCH] virt-v2v: Fix typo in Windows conversion warning message
- [PATCH] virt-v2v: Check for firstboot before unconfiguring XenPV
- [PATCH] Install VirtIO storage and network drivers in Windows
- [PATCH 1/7] Push $desc creation into Sys::VirtConvert::Converter->convert
- [PATCH] Remove call to set_autosync.