[PATCH 1/2] Allow absolute paths in virt-v2v.conf
This patch allows paths in virt-v2v.conf to be either relative or absolute. If relative, they are relative to software-root. This allows virt-v2v.conf to use files provided by packages independent of virt-v2v. --- lib/Sys/VirtV2V/Config.pm | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Sys/VirtV2V/Config.pm b/lib/Sys/VirtV2V/Config.pm index f703152..121e774 100644 --- a/lib/Sys/VirtV2V/Config.pm +++ b/lib/Sys/VirtV2V/Config.pm @@ -118,14 +118,16 @@ sub get_transfer_iso foreach my $path ($dom->findnodes('/virt-v2v/app/path/text()')) { $path = $path->getData(); - # Get the absolute path if iso-root was defined my $abs; - if (defined($root)) { - $abs = File::Spec->catfile($root, $path); - } else { + if (File::Spec->file_name_is_absolute($path) || !defined($root)) { $abs = $path; } + # Make relative paths relative to iso-root if it was defined + else { + $abs = File::Spec->catfile($root, $path); + } + if (-r $abs) { $path_args{"$path=$abs"} = 1; $paths{$abs} = 1; -- 1.7.2.1
This patch updates the default virt-v2v.conf to use files installed by the virtio-win package. virt-v2v.conf also now specifies the directory containing viostor.sys rather than the file itself. --- lib/Sys/VirtV2V/Converter/Windows.pm | 9 ++++----- v2v/virt-v2v.conf | 24 +++++++++++++----------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/lib/Sys/VirtV2V/Converter/Windows.pm b/lib/Sys/VirtV2V/Converter/Windows.pm index 90822dd..1d4c526 100644 --- a/lib/Sys/VirtV2V/Converter/Windows.pm +++ b/lib/Sys/VirtV2V/Converter/Windows.pm @@ -357,7 +357,7 @@ sub _upload_files my @missing; my %files; - for my $file ("viostor", "firstboot", "firstbootapp", "rhsrvany") { + for my $file ("virtio", "firstboot", "firstbootapp", "rhsrvany") { my ($path) = $config->match_app ($desc, $file, $desc->{arch}); my $local = $config->get_transfer_path ($g, $path); push (@missing, $path) unless ($g->exists($local)); @@ -371,10 +371,9 @@ sub _upload_files "required, but missing: {list}", list => join(' ', @missing)))) if (@missing > 0); - # Copy viostor into place - my $driverpath = "/windows/system32/drivers"; - $driverpath = $g->case_sensitive_path ($driverpath); - $g->cp ($files{viostor}, $driverpath); + # Copy viostor directly into place as it's a critical boot device + $g->cp (File::Spec->catfile($files{virtio}, 'viostor.sys'), + $g->case_sensitive_path ("/windows/system32/drivers")); # Copy other files into a temp directory my $path = "/temp/v2v"; diff --git a/v2v/virt-v2v.conf b/v2v/virt-v2v.conf index a79f3a8..c2a3523 100644 --- a/v2v/virt-v2v.conf +++ b/v2v/virt-v2v.conf @@ -141,21 +141,23 @@ </app> <!-- Windows --> - <app os='windows' major='5' minor='1' arch='i386' name='viostor'> - <path>windows/xp/i386/viostor.sys</path> - </app> - <app os='windows' major='5' minor='2' arch='i386' name='viostor'> - <path>windows/2003/i386/viostor.sys</path> + + <!-- Each of these should point to the directory containing the appropriate + VirtIO drivers. On some platforms (RHEL 6), the directories below will + correspond to directories installed by the 'virtio-win' package. --> + <app os='windows' major='5' minor='2' arch='i386' name='virtio'> + <path>/usr/share/virtio-win/drivers/i386/Win2003</path> </app> - <app os='windows' major='5' minor='2' arch='x86_64' name='viostor'> - <path>windows/2003/x86_64/viostor.sys</path> + <app os='windows' major='5' minor='2' arch='x86_64' name='virtio'> + <path>/usr/share/virtio-win/drivers/amd64/Win2003</path> </app> - <app os='windows' major='6' arch='i386' name='viostor'> - <path>windows/2008/i386/viostor.sys</path> + <app os='windows' major='6' arch='i386' name='virtio'> + <path>/usr/share/virtio-win/drivers/i386/Win2008</path> </app> - <app os='windows' major='6' arch='x86_64' name='viostor'> - <path>windows/2008/x86_64/viostor.sys</path> + <app os='windows' major='6' arch='x86_64' name='virtio'> + <path>/usr/share/virtio-win/drivers/amd64/Win2008</path> </app> + <!-- RHSrvAny is compiled as a 32 bit app even on 64 bit Windows --> <app os='windows' name='rhsrvany'> <path>windows/rhsrvany.exe</path> -- 1.7.2.1
On Mon, Aug 16, 2010 at 02:39:49PM +0100, Matthew Booth wrote:
This patch updates the default virt-v2v.conf to use files installed by the virtio-win package. virt-v2v.conf also now specifies the directory containing viostor.sys rather than the file itself.
Patch looks fine. The change above will break anyone who installed and edited the old virt-v2v.conf file, if that is a problem. ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
On 16/08/10 15:15, Richard W.M. Jones wrote:
On Mon, Aug 16, 2010 at 02:39:49PM +0100, Matthew Booth wrote:
This patch updates the default virt-v2v.conf to use files installed by the virtio-win package. virt-v2v.conf also now specifies the directory containing viostor.sys rather than the file itself.
Patch looks fine. The change above will break anyone who installed and edited the old virt-v2v.conf file, if that is a problem.
Yes. Unfortunately this won't be the first time I've broken this. 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
On Mon, Aug 16, 2010 at 02:39:48PM +0100, Matthew Booth wrote:
This patch allows paths in virt-v2v.conf to be either relative or absolute. If relative, they are relative to software-root.
This allows virt-v2v.conf to use files provided by packages independent of virt-v2v. --- lib/Sys/VirtV2V/Config.pm | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/Sys/VirtV2V/Config.pm b/lib/Sys/VirtV2V/Config.pm index f703152..121e774 100644 --- a/lib/Sys/VirtV2V/Config.pm +++ b/lib/Sys/VirtV2V/Config.pm @@ -118,14 +118,16 @@ sub get_transfer_iso foreach my $path ($dom->findnodes('/virt-v2v/app/path/text()')) { $path = $path->getData();
- # Get the absolute path if iso-root was defined my $abs; - if (defined($root)) { - $abs = File::Spec->catfile($root, $path); - } else { + if (File::Spec->file_name_is_absolute($path) || !defined($root)) { $abs = $path; }
+ # Make relative paths relative to iso-root if it was defined + else { + $abs = File::Spec->catfile($root, $path); + } + if (-r $abs) { $path_args{"$path=$abs"} = 1; $paths{$abs} = 1;
ACK, seems reasonable. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
participants (2)
-
Matthew Booth -
Richard W.M. Jones