This commit is contained in:
Richard Jones
2009-08-20 16:28:35 +01:00
parent d1c35f8710
commit 7faff93c3c
10 changed files with 46 additions and 437 deletions

2
.gitignore vendored
View File

@@ -74,7 +74,6 @@ html/recipes.html
html/virt-cat.1.html
html/virt-df.1.html
html/virt-inspector.1.html
html/virt-v2v.1.html
images/100kallnewlines
images/100kallspaces
images/100kallzeroes
@@ -189,7 +188,6 @@ stamp-h1
test-tool/libguestfs-test-tool.1
test-tool/libguestfs-test-tool
test-tool/libguestfs-test-tool-helper
v2v/virt-v2v.1
/GNUmakefile
/maint.mk
/build-aux

View File

@@ -132,9 +132,6 @@ src/
test-tool/
Interactive qemu/kernel test tool.
v2v/
Xen to KVM (V2V) conversion tool.
Debugging
----------------------------------------------------------------------

View File

@@ -41,9 +41,6 @@ endif
if HAVE_INSPECTOR
SUBDIRS += inspector
endif
if HAVE_V2V
SUBDIRS += v2v
endif
if HAVE_DF
SUBDIRS += df
endif
@@ -136,7 +133,6 @@ HTMLFILES = html/guestfs.3.html html/guestfish.1.html \
html/virt-cat.1.html \
html/virt-df.1.html \
html/virt-inspector.1.html \
html/virt-v2v.1.html \
html/recipes.html \
html/pod.css html/recipes.css

View File

@@ -610,7 +610,7 @@ AC_CHECK_PROG([GHC],[ghc],[ghc],[no])
AM_CONDITIONAL([HAVE_HASKELL],
[test "x$GHC" != "xno"])
dnl Check for Perl modules needed by virt-df, inspector, V2V etc.
dnl Check for Perl modules needed by virt-df, inspector, etc.
missing_perl_modules=no
for pm in Pod::Usage Getopt::Long Sys::Virt Data::Dumper XML::Writer Locale::TextDomain; do
AC_MSG_CHECKING([for $pm])
@@ -622,7 +622,7 @@ for pm in Pod::Usage Getopt::Long Sys::Virt Data::Dumper XML::Writer Locale::Tex
fi
done
if test "x$missing_perl_modules" = "xyes"; then
AC_MSG_WARN([some Perl modules required to compile virt-cat, virt-df, virt-inspector and virt-v2v are missing])
AC_MSG_WARN([some Perl modules required to compile virt-cat, virt-df and virt-inspector are missing])
fi
AM_CONDITIONAL([HAVE_CAT],
@@ -631,8 +631,6 @@ AM_CONDITIONAL([HAVE_DF],
[test "x$PERL" != "xno" -a "x$missing_perl_modules" != "xyes"])
AM_CONDITIONAL([HAVE_INSPECTOR],
[test "x$PERL" != "xno" -a "x$missing_perl_modules" != "xyes"])
AM_CONDITIONAL([HAVE_V2V],
[test "x$PERL" != "xno" -a "x$missing_perl_modules" != "xyes"])
dnl Library versioning.
MAX_PROC_NR=`cat $srcdir/src/MAX_PROC_NR`
@@ -671,7 +669,6 @@ AC_CONFIG_FILES([Makefile
cat/Makefile
df/Makefile
inspector/Makefile
v2v/Makefile
libguestfs.pc
gnulib/lib/Makefile
gnulib/tests/Makefile
@@ -705,8 +702,6 @@ echo -n "virt-df ............................. "
if test "x$HAVE_DF" = "x"; then echo "yes"; else echo "no"; fi
echo -n "virt-inspector ...................... "
if test "x$HAVE_INSPECTOR" = "x"; then echo "yes"; else echo "no"; fi
echo -n "virt-v2v ............................ "
if test "x$HAVE_V2V" = "x"; then echo "yes"; else echo "no"; fi
echo "supermin appliance .................. $enable_supermin"
echo
echo "If any optional component is configured 'no' when you expected 'yes'"

View File

@@ -85,4 +85,3 @@ src/guestfs-bindtests.c
src/guestfs.c
test-tool/helper.c
test-tool/test-tool.c
v2v/virt-v2v.pl

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-19 09:09+0100\n"
"POT-Creation-Date: 2009-08-19 17:53+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -1105,47 +1105,47 @@ msgstr ""
msgid "guestfish: empty command on command line\n"
msgstr ""
#: fish/fish.c:843
#: fish/fish.c:868
msgid "display a list of commands or help on a command"
msgstr ""
#: fish/fish.c:845
#: fish/fish.c:870
msgid "quit guestfish"
msgstr ""
#: fish/fish.c:848
#: fish/fish.c:873
msgid "allocate an image"
msgstr ""
#: fish/fish.c:850
#: fish/fish.c:875
msgid "display a line of text"
msgstr ""
#: fish/fish.c:852
#: fish/fish.c:877
msgid "edit a file in the image"
msgstr ""
#: fish/fish.c:854
#: fish/fish.c:879
msgid "local change directory"
msgstr ""
#: fish/fish.c:856
#: fish/fish.c:881
msgid "expand wildcards in command"
msgstr ""
#: fish/fish.c:858
#: fish/fish.c:883
msgid "view a file in the pager"
msgstr ""
#: fish/fish.c:860
#: fish/fish.c:885
msgid "close and reopen libguestfs handle"
msgstr ""
#: fish/fish.c:862
#: fish/fish.c:887
msgid "measure time taken to run command"
msgstr ""
#: fish/fish.c:874
#: fish/fish.c:899
#, c-format
msgid ""
"alloc - allocate an image\n"
@@ -1165,7 +1165,7 @@ msgid ""
" <nn>sects number of 512 byte sectors\n"
msgstr ""
#: fish/fish.c:890
#: fish/fish.c:915
#, c-format
msgid ""
"echo - display a line of text\n"
@@ -1174,7 +1174,7 @@ msgid ""
" This echos the parameters to the terminal.\n"
msgstr ""
#: fish/fish.c:897
#: fish/fish.c:922
#, c-format
msgid ""
"edit - edit a file in the image\n"
@@ -1192,7 +1192,7 @@ msgid ""
" (> 2 MB) or binary files containing \\0 bytes.\n"
msgstr ""
#: fish/fish.c:911
#: fish/fish.c:936
#, c-format
msgid ""
"lcd - local change directory\n"
@@ -1203,7 +1203,7 @@ msgid ""
" place.\n"
msgstr ""
#: fish/fish.c:918
#: fish/fish.c:943
#, c-format
msgid ""
"glob - expand wildcards in command\n"
@@ -1214,7 +1214,7 @@ msgid ""
" once for each expanded argument.\n"
msgstr ""
#: fish/fish.c:925
#: fish/fish.c:950
#, c-format
msgid ""
"help - display a list of commands or help on a command\n"
@@ -1222,7 +1222,7 @@ msgid ""
" help\n"
msgstr ""
#: fish/fish.c:930
#: fish/fish.c:955
#, c-format
msgid ""
"more - view a file in the pager\n"
@@ -1240,14 +1240,14 @@ msgid ""
" (> 2 MB) or binary files containing \\0 bytes.\n"
msgstr ""
#: fish/fish.c:946
#: fish/fish.c:971
#, c-format
msgid ""
"quit - quit guestfish\n"
" quit\n"
msgstr ""
#: fish/fish.c:949
#: fish/fish.c:974
#, c-format
msgid ""
"reopen - close and reopen the libguestfs handle\n"
@@ -1258,7 +1258,7 @@ msgid ""
"exits. However this is occasionally useful for testing.\n"
msgstr ""
#: fish/fish.c:956
#: fish/fish.c:981
#, c-format
msgid ""
"time - measure time taken to run command\n"
@@ -1268,7 +1268,7 @@ msgid ""
" time afterwards.\n"
msgstr ""
#: fish/fish.c:962
#: fish/fish.c:987
#, c-format
msgid "%s: command not known, use -h to list all commands\n"
msgstr ""

View File

@@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: pl\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-19 09:09+0100\n"
"POT-Creation-Date: 2009-08-19 17:53+0100\n"
"PO-Revision-Date: 2009-07-29 17:31+0200\n"
"Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n"
"Language-Team: Polish <pl@li.org>\n"
@@ -1182,47 +1182,47 @@ msgstr "guestfish: za dużo parametrów\n"
msgid "guestfish: empty command on command line\n"
msgstr "guestfish: puste polecenie wiersza poleceń\n"
#: fish/fish.c:843
#: fish/fish.c:868
msgid "display a list of commands or help on a command"
msgstr "wyświetla listę poleceń lub pomoc polecenia"
#: fish/fish.c:845
#: fish/fish.c:870
msgid "quit guestfish"
msgstr "kończy pracę guestfish"
#: fish/fish.c:848
#: fish/fish.c:873
msgid "allocate an image"
msgstr "przydziela obraz"
#: fish/fish.c:850
#: fish/fish.c:875
msgid "display a line of text"
msgstr "wyświetla wiersz tekstu"
#: fish/fish.c:852
#: fish/fish.c:877
msgid "edit a file in the image"
msgstr "modyfikuje plik w obrazie"
#: fish/fish.c:854
#: fish/fish.c:879
msgid "local change directory"
msgstr "zmienia lokalny folder"
#: fish/fish.c:856
#: fish/fish.c:881
msgid "expand wildcards in command"
msgstr "rozwija wieloznaczniki w poleceniach"
#: fish/fish.c:858
#: fish/fish.c:883
msgid "view a file in the pager"
msgstr "wyświetla plik w pagerze"
#: fish/fish.c:860
#: fish/fish.c:885
msgid "close and reopen libguestfs handle"
msgstr "zamyka i ponownie otwiera program obsługi libguestfs"
#: fish/fish.c:862
#: fish/fish.c:887
msgid "measure time taken to run command"
msgstr "mierzy czas wykonania polecenia"
#: fish/fish.c:874
#: fish/fish.c:899
#, c-format
msgid ""
"alloc - allocate an image\n"
@@ -1258,7 +1258,7 @@ msgstr ""
" <nn>G lub <nn>GB liczba gigabajtów\n"
" <nn>sektory liczba 512 bajtowych sektorów\n"
#: fish/fish.c:890
#: fish/fish.c:915
#, c-format
msgid ""
"echo - display a line of text\n"
@@ -1271,7 +1271,7 @@ msgstr ""
"\n"
" Wyświetla ostatnie parametry w terminalu.\n"
#: fish/fish.c:897
#: fish/fish.c:922
#, c-format
msgid ""
"edit - edit a file in the image\n"
@@ -1303,7 +1303,7 @@ msgstr ""
" UWAGA: nie będzie działało poprawnie dla dużych plików\n"
" (> 2 MB) lub plików binarnych zawierających \\0 bajtów.\n"
#: fish/fish.c:911
#: fish/fish.c:936
#, c-format
msgid ""
"lcd - local change directory\n"
@@ -1320,7 +1320,7 @@ msgstr ""
" przydatne, jeśli chcesz pobrać pliki do konkretnego\n"
" miejsca.\n"
#: fish/fish.c:918
#: fish/fish.c:943
#, c-format
msgid ""
"glob - expand wildcards in command\n"
@@ -1338,7 +1338,7 @@ msgstr ""
" Zauważ, że polecenie jest wykonywane raz dla\n"
" każdego rozwiniętego parametru.\n"
#: fish/fish.c:925
#: fish/fish.c:950
#, c-format
msgid ""
"help - display a list of commands or help on a command\n"
@@ -1349,7 +1349,7 @@ msgstr ""
" help polecenie\n"
" help\n"
#: fish/fish.c:930
#: fish/fish.c:955
#, c-format
msgid ""
"more - view a file in the pager\n"
@@ -1380,7 +1380,7 @@ msgstr ""
" UWAGA: nie będzie działało poprawnie dla dużych plików\n"
" (> 2 MB) lub plików binarnych zawierających \\0 bajtów.\n"
#: fish/fish.c:946
#: fish/fish.c:971
#, c-format
msgid ""
"quit - quit guestfish\n"
@@ -1389,7 +1389,7 @@ msgstr ""
"quit - kończy pracę guestfish\n"
" quit\n"
#: fish/fish.c:949
#: fish/fish.c:974
#, c-format
msgid ""
"reopen - close and reopen the libguestfs handle\n"
@@ -1407,7 +1407,7 @@ msgstr ""
"zamykany, kiedy guestfish kończy działania. Mimo to może być czasem\n"
"przydatne do testowania.\n"
#: fish/fish.c:956
#: fish/fish.c:981
#, c-format
msgid ""
"time - measure time taken to run command\n"
@@ -1421,7 +1421,7 @@ msgstr ""
"\n"
" Wykonuje <polecenie> i wyświetla czas, jaki upłynął.\n"
#: fish/fish.c:962
#: fish/fish.c:987
#, c-format
msgid "%s: command not known, use -h to list all commands\n"
msgstr ""

View File

@@ -1,48 +0,0 @@
# libguestfs virt-v2v
# Copyright (C) 2009 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
EXTRA_DIST = \
run-v2v-locally \
virt-v2v.pl
if HAVE_V2V
man_MANS = virt-v2v.1
noinst_DATA = @top_builddir@/html/virt-v2v.1.html
virt-v2v.1: virt-v2v.pl
$(POD2MAN) \
--section 1 \
-c "Virtualization Support" \
--release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
$< > $@
@top_builddir@/html/virt-v2v.1.html: virt-v2v.pl
mkdir -p @top_builddir@/html
cd @top_builddir@ && pod2html \
--css 'pod.css' \
--title 'virt-v2v, convert virtual machine from Xen to KVM' \
--htmldir html \
--outfile html/virt-v2v.1.html \
v2v/$<
install-data-hook:
mkdir -p $(DESTDIR)$(bindir)
install -m 0755 virt-v2v.pl $(DESTDIR)$(bindir)/virt-v2v
endif

View File

@@ -1,52 +0,0 @@
#!/usr/bin/perl
# virt-v2v
# Copyright (C) 2009 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# This script sets up the environment so you can run virt-v2v in place
# without needing to do 'make install' first. You can also run virt-v2v
# by creating a symlink to this script and putting it in your path.
#
# Use it like this:
# ./run-v2v-locally [usual virt-v2v args ...]
use strict;
use warnings;
use File::Basename qw(dirname);
use File::Spec;
use Cwd qw(abs_path);
my $path = $0;
# Follow symlinks until we get to the real file
while(-l $path) {
my $link = readlink($path);
if(File::Spec->file_name_is_absolute($link)) {
$path = $link;
} else {
$path = File::Spec->catfile(dirname($path), $link);
}
}
# Get the absolute path of the parent directory
$path = abs_path(dirname($path).'/..');
$ENV{LD_LIBRARY_PATH} = $path.'/src/.libs';
$ENV{LIBGUESTFS_PATH} = $path.'/appliance';
$ENV{PERL5LIB} = $path.'/perl/blib/lib:'.$path.'/perl/blib/arch';
exec('perl', $path.'/v2v/virt-v2v.pl', @ARGV);

View File

@@ -1,276 +0,0 @@
#!/usr/bin/perl -w
# virt-v2v
# Copyright (C) 2009 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
use warnings;
use strict;
use Sys::Guestfs;
use Sys::Guestfs::Lib qw(open_guest get_partitions resolve_windows_path
inspect_all_partitions inspect_partition
inspect_operating_systems mount_operating_system inspect_in_detail);
use Pod::Usage;
use Getopt::Long;
use Data::Dumper;
use File::Temp qw/tempdir/;
use XML::Writer;
use Locale::TextDomain 'libguestfs';
=encoding utf8
=head1 NAME
virt-v2v - Convert Xen or VMWare guests to KVM
=head1 SYNOPSIS
virt-v2v xen_name -o kvm_name
virt-v2v guest.ovf.zip -o kvm_name
virt-v2v guest.img [guest.img ...]
=head1 DESCRIPTION
Virt-v2v converts guests from one virtualization hypervisor to
another. Currently it is limited in what it can convert. See the
table below.
-------------------------------+----------------------------
SOURCE | TARGET
-------------------------------+----------------------------
Xen domain managed by |
libvirt |
|
Xen compatibility: |
- PV or FV kernel | KVM guest managed by
- with or without PV drivers | libvirt
- RHEL 3.9+, 4.8+, 5.3+ | - with virtio drivers
- Windows XP, 2003 |
|
-------------------------------+
|
VMWare VMDK image with |
OVF metadata, exported from |
vSphere |
|
VMWare compatibility: |
- RHEL 3.9+, 4.8+, 5.3+ |
- VMWare tools |
|
-------------------------------+----------------------------
=head2 CONVERTING XEN DOMAINS
For Xen domains managed by libvirt, perform the initial conversion
using:
virt-v2v xen_name -o kvm_name
where C<xen_name> is the libvirt Xen domain name, and C<kvm_name> is
the (new) name for the converted KVM guest.
Then test boot the new guest in KVM:
virsh start kvm_name
virt-viewer kvm_name
When you have verified that this works, shut down the new KVM domain
and I<commit> the changes by doing:
virt-v2v --commit kvm_name
I<This command will destroy the original Xen domain>.
Or you can I<rollback> to the original Xen domain by doing:
virt-v2v --rollback kvm_name
B<Very important note:> Do I<not> try to run both the original Xen
domain and the KVM domain at the same time! This will cause guest
corruption.
=head2 CONVERTING VMWARE GUESTS
I<This section to be written>
=head1 OPTIONS
=over 4
=cut
my $help;
=item B<--help>
Display brief help.
=cut
my $version;
=item B<--version>
Display version number and exit.
=cut
my $uri;
=item B<--connect URI> | B<-c URI>
If using libvirt, connect to the given I<URI>. If omitted,
then we connect to the default libvirt hypervisor.
Libvirt is only used if you specify a C<domname> on the
command line. If you specify guest block devices directly,
then libvirt is not used at all.
=cut
my $output;
=item B<--output name> | B<-o name>
Set the output guest name.
=cut
=back
=cut
GetOptions ("help|?" => \$help,
"version" => \$version,
"connect|c=s" => \$uri,
"output|o=s" => \$output,
) or pod2usage (2);
pod2usage (1) if $help;
if ($version) {
my $g = Sys::Guestfs->new ();
my %h = $g->version ();
print "$h{major}.$h{minor}.$h{release}$h{extra}\n";
exit
}
pod2usage (__"virt-v2v: no image or VM names given") if @ARGV == 0;
# 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);
# Only work on single-root operating systems.
my $root_dev;
my @roots = keys %$oses;
die __"no root device found in this operating system image" if @roots == 0;
die __"multiboot operating systems are not supported by v2v" if @roots > 1;
$root_dev = $roots[0];
# Mount up the disks and check for applications.
my $os = $oses->{$root_dev};
mount_operating_system ($g, $os);
inspect_in_detail ($g, $os);
$g->umount_all ();
=head1 SEE ALSO
L<virt-inspector(1)>,
L<guestfs(3)>,
L<guestfish(1)>,
L<Sys::Guestfs(3)>,
L<Sys::Guestfs::Lib(3)>,
L<Sys::Virt(3)>,
L<http://libguestfs.org/>.
For Windows registry parsing we require the C<reged> program
from L<http://home.eunet.no/~pnordahl/ntpasswd/>.
=head1 AUTHOR
Richard W.M. Jones L<http://et.redhat.com/~rjones/>
Matthew Booth L<mbooth@redhat.com>
=head1 COPYRIGHT
Copyright (C) 2009 Red Hat Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.