File: virt-v2v-output-local.pod

package info (click to toggle)
libguestfs 1%3A1.40.2-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 123,660 kB
  • sloc: ansic: 460,074; ml: 63,059; sh: 14,955; java: 9,512; makefile: 9,133; cs: 6,300; haskell: 5,652; python: 3,856; perl: 3,619; erlang: 2,435; xml: 1,683; ruby: 350; pascal: 255; lex: 135; yacc: 128; cpp: 10
file content (155 lines) | stat: -rw-r--r-- 3,624 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155

=head1 名前

virt-v2v-output-local - Using virt-v2v to convert guests to local files or
libvirt

=head1 書式

 virt-v2v [-i* options] [-o libvirt] -os POOL

 virt-v2v [-i* options] -o local -os DIRECTORY

 virt-v2v [-i* options] -o qemu -os DIRECTORY [--qemu-boot]

 virt-v2v [-i* options] -o null

=head1 説明

This page documents how to use L<virt-v2v(1)> to convert guests to local
files or to a locally running libvirt instance.  There are four output modes
you can select on the virt-v2v command line:

=over 4

=item B<-o libvirt -os> C<POOL>

=item B<-os> C<POOL>

This converts the guest to a libvirt directory pool call C<POOL>, and
instantiates the guest in libvirt (but does not start it running).  See
L</OUTPUT TO LIBVIRT> below.

I<-o libvirt> is the default if no I<-o> option is given, so you can omit
it.

=item B<-o local -os> C<DIRECTORY>

This converts the guest to files in C<DIRECTORY>.  A libvirt XML file is
also created, but unlike I<-o libvirt> the guest is not instantiated in
libvirt, only files are created.

The files will be called:

 NAME-sda, NAME-sdb, etc.      Guest disk(s).
 NAME.xml                      Libvirt XML.

where C<NAME> is the guest name.

=item B<-o qemu -os> C<DIRECTORY>

=item B<-o qemu -os> C<DIRECTORY> B<--qemu-boot>

This converts the guest to files in C<DIRECTORY>.  Unlike I<-o local> above,
a shell script is created which contains the raw qemu command you would need
to boot the guest.  However the shell script is not run, I<unless> you also
add the I<--qemu-boot> option.

=item B<-o null>

The guest is converted, but the final result is thrown away and no metadata
is created.  This is mainly useful for testing.

=back

=head1 OUTPUT TO LIBVIRT

The I<-o libvirt> option lets you upload the converted guest to a
libvirt-managed host.  There are several limitations:

=over 4

=item *

You can only use a local libvirt connection [see below for how to workaround
this].

=item *

The I<-os pool> option must specify a directory pool, not anything more
exotic such as iSCSI [but see below].

=item *

You can only upload to a KVM hypervisor.

=back

=head2 Workaround for output to a remote libvirt instance and/or a non-directory
storage pool

=over 4

=item 1.

Use virt-v2v in I<-o local> mode to convert the guest disks and metadata
into a local temporary directory:

 virt-v2v [...] -o local -os /var/tmp

This creates two (or more) files in F</var/tmp> called:

 /var/tmp/NAME.xml     # the libvirt XML (metadata)
 /var/tmp/NAME-sda     # the guest’s first disk

(for C<NAME> substitute the guest’s name).

=item 2.

Upload the converted disk(s) into the storage pool called C<POOL>:

 size=$(stat -c%s /var/tmp/NAME-sda)
 virsh vol-create-as POOL NAME-sda $size --format raw
 virsh vol-upload --pool POOL NAME-sda /var/tmp/NAME-sda

=item 3.

Edit F</var/tmp/NAME.xml> to change F</var/tmp/NAME-sda> to the pool name.
In other words, locate the following bit of XML:

 <disk type='file' device='disk'>
   <driver name='qemu' type='raw' cache='none' />
   <source file='/var/tmp/NAME-sda' />
   <target dev='hda' bus='ide' />
 </disk>

and change two things: The C<type='file'> attribute must be changed to
C<type='volume'>, and the C<E<lt>sourceE<gt>> element must be changed to
include C<pool> and C<volume> attributes:

 <disk type='volume' device='disk'>
   ...
   <source pool='POOL' volume='NAME-sda' />
   ...
 </disk>

=item 4.

Define the final guest in libvirt:

 virsh define /var/tmp/NAME.xml

=back

=head1 関連項目

L<virt-v2v(1)>.

=head1 著者

Richard W.M. Jones

=head1 COPYRIGHT

Copyright (C) 2009-2019 Red Hat Inc.