On Tue, Jan 25, 2011 at 02:09:09PM +0000, Matthew Booth wrote:
We were unconditionally creating /temp/v2v in the guest, and later
using
case_sensitive_path to look the path up again. If C:\Temp already existed, this
would lead to unpredictable results.
Fixes RHBZ#672521
---
lib/Sys/VirtV2V/Converter/Windows.pm | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/lib/Sys/VirtV2V/Converter/Windows.pm b/lib/Sys/VirtV2V/Converter/Windows.pm
index 3050f47..144782b 100644
--- a/lib/Sys/VirtV2V/Converter/Windows.pm
+++ b/lib/Sys/VirtV2V/Converter/Windows.pm
@@ -175,10 +175,6 @@ sub _preconvert
# Note: disks are already mounted by main virt-v2v script.
- # Create directory to store firstboot service temporarily.
- eval { $g->mkdir ("/temp"); };
- eval { $g->mkdir ("/temp/v2v"); };
-
_upload_files ($g, $tmpdir, $desc, $devices, $config);
_add_viostor_to_registry ($g, $tmpdir, $desc, $devices, $config);
_add_service_to_registry ($g, $tmpdir, $desc, $devices, $config);
@@ -451,9 +447,20 @@ sub _upload_files
$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";
- $path = $g->case_sensitive_path ($path);
+ # Copy other files into a temp directory on the guest
+ # N.B. This directory must match up with the configuration of rhsrvany
+ my $path = '';
+ foreach my $d ('Temp', 'V2V') {
+ $path .= '/'.$d;
+
+ eval { $path = $g->case_sensitive_path($path) };
+
+ # case_sensitive_path will fail if the path doesn't exist
+ if ($@) {
+ $g->mkdir($path);
+ }
+ }
+
$g->cp ($files{firstboot}, $path);
$g->cp ($files{firstbootapp}, $path);
$g->cp ($files{rhsrvany}, $path);
Yes, I agree this patch looks like it should fix the problem.
ACK.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/