NAME

virt-v2v-in-place - Convert a guest to use KVM in-place

SYNOPSIS

 virt-v2v-in-place -i disk [other -i* options]
                   [virt-customize options]
                   filename
                   [-O output.xml]

 virt-v2v-in-place -i libvirt|libvirtxml [other -i* options]
                   [virt-customize options]
                   guest
                   [-O output.xml]

DESCRIPTION

Virt-v2v-in-place converts a single guest from a foreign hypervisor to run on KVM. It does this conversion in place, modifying the original disk.

This manual page only documents the differences between this tool and virt-v2v. You should read virt-v2v(1) first.

Selecting the input disk

You normally run virt-v2v with one or more -i* options controlling the input mode. Virt-v2v-in-place can only convert guests stored in local files.

This command will do an in-place conversion of filename.img:

 virt-v2v-in-place -i disk filename.img

If the guest has been copied to local libvirt then:

 virt-v2v-in-place -i libvirt guest

Output XML

Optionally use the -O option to write post-conversion metadata about the guest to an XML file. This is in the same format as virt-v2v-inspector(1). This can be used, for example, to find out what operating system and firmware was found inside the guest during conversion.

Exit code

If virt-v2v-in-place fails it will return a non-zero (error) exit code. In this case, the disk image will be in an unknown, possibly corrupted state.

If the image contains important information you should ensure you have a backup before trying a virt-v2v-in-place conversion. And you should check the exit code is zero before using the disk image after a conversion.

EXAMPLES

OPTIONS

--help

Display help.

-i disk

Set the input method to disk.

In this mode you can read a virtual machine disk image with no metadata. virt-v2v tries to guess the best default metadata. This is usually adequate but you can get finer control (eg. of memory and vCPUs) by using -i libvirtxml instead. Only guests that use a single disk can be imported this way.

-i libvirt

Set the input method to libvirt. This is the default.

In this mode you have to specify a libvirt guest name or UUID on the command line. You may also specify a libvirt connection URI (see -ic).

-i libvirtxml

Set the input method to libvirtxml.

In this mode you have to pass a libvirt XML file on the command line. This file is read in order to get metadata about the source guest (such as its name, amount of memory), and also to locate the input disks. See "Minimal XML for -i libvirtxml option" below.

-i local

This is the same as -i disk.

-ic libvirtURI

Specify a libvirt connection URI to use when reading the guest. This is only used when -i libvirt.

Only local libvirt connections to locally stored disks can be used.

-if format

For -i disk only, this specifies the format of the input disk image. For other input methods you should specify the input format in the metadata.

-io OPTION=VALUE

Set input option(s) related to the current input mode or transport. To display short help on what options are available you can use:

 virt-v2v-in-place -it disk -io "?"
-ip filename

Supply a file containing a password to be used when connecting to the source. If this is omitted then the input hypervisor may ask for the password interactively. Note the file should contain the whole password, without any trailing newline, and for security the file should have mode 0600 so that others cannot read it.

-O output.xml
-O -

If this option is present, write post-conversion metadata about the guest to the named XML file, or to stdout if -O - is used. This is in the same format as virt-v2v-inspector(1).

-v
--verbose

Enable verbose messages for debugging.

-V
--version

Display version number and exit.

-x

Enable tracing of libguestfs API calls.

-b ...
--bridge ...
--block-driver ...
--collect ...
--collect-output ...
--colors
--colours
--echo-keys
--key ...
--keys-from-stdin
--mac ...
--machine-readable
--machine-readable=format
-m MB
--memsize MB
-n ...
--network ...
--no-fstrim
--print-source
-q
--quiet
--root ...
--smp N
--wrap

These options work in the same way as the equivalent virt-v2v options.

Minimal XML for -i libvirtxml option

When using the -i libvirtxml option, you have to supply some libvirt XML. Writing this from scratch is hard, so the template below is helpful.

Note this should only be used for testing and/or where you know what you're doing! If you have libvirt metadata for the guest, always use that instead.

 <domain type='kvm'>
   <name> NAME </name>
   <memory>1048576</memory>
   <vcpu>2</vcpu>
   <os>
     <type>hvm</type>
     <boot dev='hd'/>
   </os>
   <features>
     <acpi/>
     <apic/>
     <pae/>
   </features>
   <devices>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/path/to/disk/image'/>
       <target dev='hda' bus='ide'/>
       <checksum method='sha256' fail='error'>123123...</checksum>
     </disk>
     <interface type='network'>
       <mac address='52:54:00:01:02:03'/>
       <source network='default'/>
       <model type='rtl8139'/>
     </interface>
   </devices>
 </domain>

Disk checksum

The optional <checksum> field specifies the expected hash of the corresponding disk. It can be specified by management tools in order to do end-to-end data integrity checks.

Note this is the checksum of the raw format content of the disk. If the disk is in a container format (eg. qcow2) it is the checksum of the content, not of the container.

The checksum method attribute can be md5, sha256 or sha512.

The fail attribute can be error to fail the conversion if the checksum does not match; warn to print a warning but continue; ignore to ignore the checksum and not even compute it; or print to print the actual checksum and continue. The default is fail=warn.

Computing the checksum of a remote (eg HTTP) source can be slow and expensive.

FILES

Files used are the same as for virt-v2v. See "FILES" in virt-v2v(1).

ENVIRONMENT VARIABLES

Environment variables used are the same as for virt-v2v. See "ENVIRONMENT VARIABLES" in virt-v2v(1).

SEE ALSO

virt-v2v(1), virt-p2v(1), guestfs(3), guestfish(1), qemu-img(1), nbdkit(1), http://libguestfs.org/.

AUTHORS

Matthew Booth

Cédric Bosdonnat

Laszlo Ersek

Tomáš Golembiovský

Shahar Havivi

Richard W.M. Jones

Roman Kagan

Mike Latimer

Nir Soffer

Pino Toscano

Xiaodai Wang

Ming Xie

Tingting Zheng

COPYRIGHT

Copyright (C) 2009-2025 Red Hat Inc.

LICENSE

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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

BUGS

To get a list of bugs against libguestfs, use this link: https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools

To report a new bug against libguestfs, use this link: https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools

When reporting a bug, please supply: