From ce315bba284b40c2a729fce1ed2e3d7a746173f8 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Sat, 11 Jul 2009 11:20:46 +0100 Subject: [PATCH 1/1] V2V outline program. --- v2v/virt-v2v.pl | 79 +++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 27 deletions(-) diff --git a/v2v/virt-v2v.pl b/v2v/virt-v2v.pl index 5895eaa..92b5329 100755 --- a/v2v/virt-v2v.pl +++ b/v2v/virt-v2v.pl @@ -96,41 +96,66 @@ if ($version) { } pod2usage ("$0: no image or VM names given") if @ARGV == 0; -# my $g; -# if ($uri) { -# $g = open_guest (\@ARGV, rw => $rw, address => $uri); -# } else { -# $g = open_guest (\@ARGV, rw => $rw); -# } +# XXX This should be an option. Disable for now until we get +# downloads working reliably. +my $use_windows_registry = 0; + +my @params = (\@ARGV); +if ($uri) { + push @params, address => $uri; +} +my ($g, $conn, $dom) = open_guest (@params); + +$g->launch (); +$g->wait_ready (); + +# List of possible filesystems. +my @partitions = get_partitions ($g); + +# Now query each one to build up a picture of what's in it. +my %fses = + inspect_all_partitions ($g, \@partitions, + use_windows_registry => $use_windows_registry); + +#print "fses -----------\n"; +#print Dumper(\%fses); + +my $oses = inspect_operating_systems ($g, \%fses); + +#print "oses -----------\n"; +#print Dumper($oses); + +# We should probably refuse to do anything with those rare +# multiboot VMs at this point ... (XXX) + +# Mount up the disks and check for applications. + +my $root_dev; +foreach $root_dev (sort keys %$oses) { + my $os = $oses->{$root_dev}; + mount_operating_system ($g, $os); + inspect_in_detail ($g, $os); + $g->umount_all (); +} + + + + + + + + + + + -# $g->launch (); -# $g->wait_ready (); -# # List of possible filesystems. -# my @partitions = get_partitions ($g); -# # Now query each one to build up a picture of what's in it. -# my %fses = -# inspect_all_partitions ($g, \@partitions, -# use_windows_registry => $windows_registry); -# #print "fses -----------\n"; -# #print Dumper(\%fses); -# my $oses = inspect_operating_systems ($g, \%fses); -# #print "oses -----------\n"; -# #print Dumper($oses); -# # Mount up the disks and check for applications. -# my $root_dev; -# foreach $root_dev (sort keys %$oses) { -# my $os = $oses->{$root_dev}; -# mount_operating_system ($g, $os); -# inspect_in_detail ($g, $os); -# $g->umount_all (); -# } =head1 SEE ALSO -- 1.8.3.1