File: virt-p2v-make-kickstart.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 (331 lines) | stat: -rw-r--r-- 9,057 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331

=head1 名前

virt-p2v-make-kickstart - Build the virt-p2v kickstart

=head1 書式

 virt-p2v-make-kickstart [-o p2v.ks] [--proxy=http://...] repo [repo...]

=head1 説明

L<virt-p2v(1)> converts a physical machine to run virtualized on KVM,
managed by libvirt, OpenStack, oVirt, Red Hat Enterprise Virtualisation
(RHEV), or one of the other targets supported by L<virt-v2v(1)>.

Kickstart is a format used by Red Hat-derived distributions (such as Fedora,
Red Hat Enterprise Linux, CentOS, Scientific Linux, and others) to describe
how to make live CDs, install the distro, make "Spins" and so on.  It is
driven by a kickstart file.

virt-p2v-make-kickstart builds a kickstart file which can be used to build a
bootable P2V ISO, live CD, USB key, or PXE image.  This tool only builds the
kickstart file, but this manual page describes some of the ways you can use
the kickstart file.

=head1 BUILDING THE KICKSTART FILE

Using virt-p2v-make-kickstart is very simple:

 virt-p2v-make-kickstart fedora

will build a kickstart file for Fedora.  The kickstart file will be called
F<p2v.ks> and located in the current directory.

The parameters are a list of one or more repositories.  Some built-in
repositories are available: C<fedora>, C<rawhide>, C<koji> or
C<rhel-VERSION> (eg. C<rhel-7.1>).  You can also use a URL as a parameter to
point to a repository, for example:

 virt-p2v-make-kickstart https://dl.fedoraproject.org/pub/fedora/linux/releases/21/Everything/x86_64/os/

To control the name of the output file, use the I<-o> parameter.  To tell
kickstart to use a proxy server or web cache to download files, use the
I<--proxy> parameter.

=head1 BUILDING A LIVE CD / ISO

Once you have the kickstart file, you can use L<livecd-creator(8)> to make a
live CD:

 sudo livecd-creator p2v.ks

Before running this note that you should probably run C<livecd-creator> in a
disposable virtual machine for these reasons:

=over 4

=item *

You have to disable SELinux when running the tool.

=item *

This tool has to be run as root, and has some nasty failure modes.

=item *

You can only create the exact same Live CD distro as the host distro.
Cross-builds will fail in strange ways (eg. RHBZ#1092327).

=back

=head1 BUILDING A FEDORA SPIN USING KOJI

This requires C<spin-livecd> permissions on Koji, which are not given out
usually, even to Fedora packagers.  However assuming you have been given
these permissions (or have your own Koji instance, I guess), then you can
do:

 koji spin-livecd [--scratch] virt-p2v 1.XX.YY rawhide x86_64 p2v.ks

=over 4

=item *

Add the C<--scratch> option to do a scratch build (recommended for testing).

=item *

C<1.XX.YY> should match the libguestfs version

=item *

Instead of C<rawhide> you can use any Koji target.

=back

=head1 BUILDING A BOOTABLE USB KEY

Use the L<livecd-iso-to-disk(8)> program to convert the ISO created above to
a USB key:

 sudo livecd-iso-to-disk livecd-p2v.iso /dev/sdX

=head1 BUILDING A PXE BOOT IMAGE

Use the C<livecd-iso-to-pxeboot> program to convert the ISO created above to
a PXE boot image.

 sudo livecd-iso-to-pxeboot livecd-p2v.iso

This creates a C<tftpboot> subdirectory under the current directory
containing the files required to PXE boot virt-p2v:

 $ ls -1R tftpboot/
 tftpboot/:
 initrd0.img
 pxelinux.0
 pxelinux.cfg/
 vmlinuz0
 
 tftpboot/pxelinux.cfg:
 default

=head1 32 OR 64 BIT VIRT-P2V?

Virt-p2v can convert any 32 or 64 bit guest, regardless of whether virt-p2v
itself is built as a 32 or 64 bit binary.  The only restriction is that 64
bit virt-p2v cannot run on 32 bit hardware.

Old virt-p2v 0.9 was always built as a 32 bit (i686) ISO.  This meant that
the CD could be booted on any 32- or 64-bit i686 or x86-64 hardware, and
could convert any guest.  The old virt-p2v ISO shipped by Red Hat was based
on Red Hat Enterprise Linux (RHEL) 6.

Since RHEL 7 dropped support for 32 bit machines, current virt-p2v on RHEL
can only be built for 64 bit.  It cannot run on old 32 bit only hardware.

Fedora virt-p2v ISOs are generally built for 32 bit, so like the old RHEL
6-based virt-p2v 0.9 they can boot on any hardware.

=head1 TESTING VIRT-P2V USING QEMU

=head2 TESTING THE P2V ISO USING QEMU

You can use qemu to test-boot the P2V ISO:

 qemu-kvm -m 1024 -hda /tmp/guest.img -cdrom /tmp/livecd-p2v.iso -boot d

Note that C<-hda> is the (virtual) system that you want to convert (for test
purposes).  It could be any guest type supported by L<virt-v2v(1)>,
including Windows or Red Hat Enterprise Linux.

=head2 TESTING PXE SUPPORT USING QEMU

=over 4

=item *

Unpack the tftpboot directory into F</tmp> (so it appears as
F</tmp/tftpboot>).

=item *

Copy F<pxelinux.0> and F<ldlinux.c32> from syslinux (usually from
F</usr/share/syslinux>) into F</tmp/tftpboot>.

=item *

Adjust the C<APPEND> line in F</tmp/tftpboot/pxelinux.cfg/default> if
required.  See L<virt-p2v(1)/KERNEL COMMAND LINE CONFIGURATION>.

=item *

Run qemu like this so that it acts as a TFTP and BOOTP server, emulating a
netboot:

 qemu-kvm \
     -m 4096 -hda /tmp/guest.img \
     -boot n \
     -netdev user,id=unet,tftp=/tmp/tftpboot,bootfile=/pxelinux.0 \
     -device virtio-net-pci,netdev=unet \
     -serial stdio

Note that this requires considerably more memory because the PXE image is
loaded into memory.  Also that qemu’s TFTP server is very slow and the
virt-p2v PXE image is very large, so it can appear to "hang" after pxelinux
starts up.

=back

=head1 ADDING EXTRA PACKAGES

You can install extra packages using the I<--install> option.  This can be
useful for making a more fully-featured virt-p2v disk with extra tools for
debugging and troubleshooting.  Give a list of packages, separated by
commas.  For example:

 virt-p2v-make-kickstart [...] --install tcpdump,traceroute

=head1 ADDING AN SSH IDENTITY

You can inject an SSH identity (private key) file to the kickstart and hence
into the ISO using the I<--inject-ssh-identity> option.  Note that you
I<cannot> inject a key once the ISO has been built.

First create a key pair.  It must have an empty passphrase:

 ssh-keygen -t rsa -N '' -f id_rsa

This creates a private key (C<id_rsa>) and a public key (C<id_rsa.pub>)
pair.  The public key should be appended to the C<authorized_keys> file on
the virt-v2v conversion server (usually to C</root/.ssh/authorized_keys>).

The private key should be added to the kickstart file and then discarded:

 virt-p2v-make-kickstart [...] --inject-ssh-identity id_rsa
 rm id_rsa

The ISO can then be built from the kickstart in the usual way (see above),
and it will contain the embedded SSH identity (F</var/tmp/id_rsa>).

When booting virt-p2v, specify the URL of the injected file like this:

 │         User name: [root_____________________________] │
 │                                                        │
 │          Password: [    <leave this field blank>     ] │
 │                                                        │
 │  SSH Identity URL: [file:///var/tmp/id_rsa___________] │

or if using the kernel command line, add:

 p2v.identity=file:///var/tmp/id_rsa

For more information, see L<virt-p2v(1)/SSH IDENTITIES>.

=head1 オプション

=over 4

=item B<--help>

ヘルプを表示します。

=item B<--inject-ssh-identity> id_rsa

Add an SSH identity (private key) file into the kickstart.  See L</ADDING AN
SSH IDENTITY> above.

=item B<--install> pkg,pkg,...

Add extra packages to the kickstart C<%packages> section.  See L</ADDING
EXTRA PACKAGES> above.

=item B<-o> OUTPUT

=item B<--output> OUTPUT

Write kickstart to C<OUTPUT>.  If not specified, the default is F<p2v.ks> in
the current directory.

=item B<--proxy> URL

Tell the kickstart to use a proxy server or web cache for downloads.

=item B<-v>

=item B<--verbose>

Enable verbose output.  Use this if you need to debug problems with the
script or if you are filing a bug.

=item B<-V>

=item B<--version>

バージョン番号を表示して、終了します。

=back

=head1 ファイル

=over 4

=item F<$libdir/virt-p2v/virt-p2v.xz>

The L<virt-p2v(1)> binary which is copied into the kickstart file.

The location of the binary can be changed by setting the
C<VIRT_P2V_DATA_DIR> environment variable.

=item F<$datadir/virt-p2v/issue>

=item F<$datadir/virt-p2v/launch-virt-p2v.in>

=item F<$datadir/virt-p2v/p2v.ks.in>

=item F<$datadir/virt-p2v/p2v.service>

Various data files that are used to make the kickstart.

The location of these files can be changed by setting the
C<VIRT_P2V_DATA_DIR> environment variable.

=back

=head1 環境変数

=over 4

=item C<VIRT_P2V_DATA_DIR>

The directory where virt-p2v-make-kickstart looks for data files and the
virt-p2v binary (see L</FILES> above).  If not set, a compiled-in location
is used.

=back

=head1 関連項目

L<virt-p2v(1)>, L<virt-p2v-make-disk(1)>, L<virt-v2v(1)>,
L<livecd-creator(8)>, L<livecd-iso-to-disk(8)>, L<http://libguestfs.org/>.

=head1 著者

Richard W.M. Jones L<http://people.redhat.com/~rjones/>

=head1 COPYRIGHT

Copyright (C) 2009-2019 Red Hat Inc.