1virt-v2v-output-local(1) Virtualization Support virt-v2v-output-local(1)
2
3
4
6 virt-v2v-output-local - Using virt-v2v to convert guests to local files
7 or libvirt
8
10 virt-v2v [-i* options] [-o libvirt] -os POOL
11
12 virt-v2v [-i* options] -o local -os DIRECTORY
13
14 virt-v2v [-i* options] -o qemu -os DIRECTORY [--qemu-boot]
15
16 virt-v2v [-i* options] -o null
17
19 This page documents how to use virt-v2v(1) to convert guests to local
20 files or to a locally running libvirt instance. There are four output
21 modes you can select on the virt-v2v command line:
22
23 -o libvirt -os "POOL"
24 -os "POOL"
25 This converts the guest to a libvirt directory pool call "POOL",
26 and instantiates the guest in libvirt (but does not start it
27 running). See "OUTPUT TO LIBVIRT" below.
28
29 -o libvirt is the default if no -o option is given, so you can omit
30 it.
31
32 -o local -os "DIRECTORY"
33 This converts the guest to files in "DIRECTORY". A libvirt XML
34 file is also created, but unlike -o libvirt the guest is not
35 instantiated in libvirt, only files are created.
36
37 The files will be called:
38
39 NAME-sda, NAME-sdb, etc. Guest disk(s).
40 NAME.xml Libvirt XML.
41
42 where "NAME" is the guest name.
43
44 -o qemu -os "DIRECTORY"
45 -o qemu -os "DIRECTORY" --qemu-boot
46 This converts the guest to files in "DIRECTORY". Unlike -o local
47 above, a shell script is created which contains the raw qemu
48 command you would need to boot the guest. However the shell script
49 is not run, unless you also add the --qemu-boot option.
50
51 -o null
52 The guest is converted, but the final result is thrown away and no
53 metadata is created. This is mainly useful for testing.
54
56 The -o libvirt option lets you upload the converted guest to a libvirt-
57 managed host. There are several limitations:
58
59 • You can only use a local libvirt connection [see below for how to
60 workaround this].
61
62 • The -os pool option must specify a directory pool, not anything
63 more exotic such as iSCSI [but see below].
64
65 • You can only upload to a KVM hypervisor.
66
67 Workaround for output to a remote libvirt instance and/or a non-directory
68 storage pool
69 1. Use virt-v2v in -o local mode to convert the guest disks and
70 metadata into a local temporary directory:
71
72 virt-v2v [...] -o local -os /var/tmp
73
74 This creates two (or more) files in /var/tmp called:
75
76 /var/tmp/NAME.xml # the libvirt XML (metadata)
77 /var/tmp/NAME-sda # the guest’s first disk
78
79 (for "NAME" substitute the guest’s name).
80
81 2. Upload the converted disk(s) into the storage pool called "POOL":
82
83 size=$(stat -c%s /var/tmp/NAME-sda)
84 virsh vol-create-as POOL NAME-sda $size --format raw
85 virsh vol-upload --pool POOL NAME-sda /var/tmp/NAME-sda
86
87 3. Edit /var/tmp/NAME.xml to change /var/tmp/NAME-sda to the pool
88 name. In other words, locate the following bit of XML:
89
90 <disk type='file' device='disk'>
91 <driver name='qemu' type='raw' />
92 <source file='/var/tmp/NAME-sda' />
93 <target dev='hda' bus='ide' />
94 </disk>
95
96 and change two things: The "type='file'" attribute must be changed
97 to "type='volume'", and the "<source>" element must be changed to
98 include "pool" and "volume" attributes:
99
100 <disk type='volume' device='disk'>
101 ...
102 <source pool='POOL' volume='NAME-sda' />
103 ...
104 </disk>
105
106 4. Define the final guest in libvirt:
107
108 virsh define /var/tmp/NAME.xml
109
111 virt-v2v(1).
112
114 Richard W.M. Jones
115
117 Copyright (C) 2009-2020 Red Hat Inc.
118
120 This program is free software; you can redistribute it and/or modify it
121 under the terms of the GNU General Public License as published by the
122 Free Software Foundation; either version 2 of the License, or (at your
123 option) any later version.
124
125 This program is distributed in the hope that it will be useful, but
126 WITHOUT ANY WARRANTY; without even the implied warranty of
127 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
128 General Public License for more details.
129
130 You should have received a copy of the GNU General Public License along
131 with this program; if not, write to the Free Software Foundation, Inc.,
132 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
133
135 To get a list of bugs against libguestfs, use this link:
136 https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
137
138 To report a new bug against libguestfs, use this link:
139 https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
140
141 When reporting a bug, please supply:
142
143 • The version of libguestfs.
144
145 • Where you got libguestfs (eg. which Linux distro, compiled from
146 source, etc)
147
148 • Describe the bug accurately and give a way to reproduce it.
149
150 • Run libguestfs-test-tool(1) and paste the complete, unedited output
151 into the bug report.
152
153
154
155virt-v2v-2.3.7 2023-12-09 virt-v2v-output-local(1)