Add note about benchmarking.
[libguestfs-talks.git] / 2014-fosdem / notes.txt
1 FOSDEM lightning talk
2 Sunday 2nd Feb 2014, 16:00, H.2215 Ferrer
3 https://fosdem.org/2014/schedule/event/libguestfs/
4
5 Advanced disk image management with libguestfs
6 libguestfs, virt-builder, virt-sparsify, virt-sysprep
7
8 ----------------------------------------------------------------------
9
10
11 Good afternoon.  Today I'm going to talk about libguestfs
12 with is a suite of tools for looking inside and modifying
13 virtual machine disk images.
14
15
16 virt-builder
17 ------------
18
19 First off, a new tool that we've written to create virtual machines.
20
21 [ Show the builder.sh script ]
22 [ Run the builder.sh script ]
23
24 I'll come back to this script at the end of the talk.
25
26 virt-builder can:
27
28  - output raw, qcow2 and other formats
29  - resize using [virt-resize]
30  - write a random seed
31  - set a hostname
32  - edit configuration files
33  - install packages
34  - run custom scripts
35      * at build time
36      * or at first boot
37
38 Libguestfs can safely and securely inspect and modify disk
39 images without needing root.
40
41 Virt-builder doesn't install guests from scratch.  Instead it
42 takes clean, cryptographically signed, compressed templates and uses
43 libguestfs to customize them.
44
45
46
47 Preparing the templates
48 -----------------------
49
50 virt-builder comes with a handful of templates.
51
52 You can also prepare your own.  
53
54 Over the years we have come up with a good way
55 to prepare and distribute reasonably small templates
56
57     virt-install     (or Oz)
58         v
59     virt-sysprep
60         v
61     virt-sparsify
62         v
63        xz
64
65 virt-install runs a regular OS install, using anaconda,
66 debian-installer, etc.  You can automate this completely
67 using kickstart or preseed.
68
69 virt-sysprep unconfigures the guest.  Using libguestfs it
70 removes SSH host keys, log files, network configuration,
71 user accounts and so on.
72
73 virt-sparsify
74 -------------
75
76 virt-sparsify uses libguestfs to make guests sparse a.k.a.
77 thin-provisioned.
78
79 It looks for unused space:
80
81  - in filesystems
82
83  - in LVM physical volumes
84
85  - swap partitions
86
87 Including non-zeroed, but unused blocks.
88
89 It converts that to sparseness in the host file.
90
91
92 xz
93 --
94
95 Finally xz compresses the template.  We like xz for several reasons:
96
97  - nearly best in class compression
98
99  - preserves sparseness
100
101  - compressed files can be random accessed  [nbdkit]
102
103  - virt-builder includes parallel uncompress
104
105
106 Results
107 -------
108
109                disk apparent final
110 CirrOS 0.3.1     39       18    11 MB
111 Debian 7       4096      719   142 MB
112 Fedora 20      6144      826   174 MB
113 Ubuntu 13.10   4096     1019   187 MB
114
115
116 [At the end of the talk, show the progress of the builder script.]
117
118
119 * libguestfs resources and other tools