builder: Remove nbdkit-xz-plugin support (it was disabled anyway).

We can re-add this later if libvirt gets fixed, but for now simplify
the code and concentrate on the one code path.
This commit is contained in:
Richard W.M. Jones
2013-10-15 14:19:53 +01:00
parent d8499c428a
commit fd63d89644
5 changed files with 16 additions and 70 deletions

3
README
View File

@@ -169,9 +169,6 @@ The full requirements are described below.
+--------------+-------------+---+-----------------------------------------+
| xz | | O | Used by virt-builder for compression |
+--------------+-------------+---+-----------------------------------------+
| nbdkit | | O | Used by virt-builder to speed up |
| | | | template xz-decompression |
+--------------+-------------+---+-----------------------------------------+
| findlib | | O | For the OCaml bindings. |
+--------------+-------------+---+-----------------------------------------+
| ocaml-gettext| | O | For localizing OCaml virt-* tools. |

View File

@@ -74,7 +74,7 @@ let mode =
| (`Install|`List|`Notes|`Print_cache|`Cache_all) as mode -> mode
(* Check various programs/dependencies are installed. *)
let have_nbdkit =
let () =
(* Check that gpg is installed. Optional as long as the user
* disables all signature checks.
*)
@@ -100,18 +100,7 @@ let have_nbdkit =
if Sys.command cmd <> 0 then (
eprintf (f_"%s: virt-resize is not installed (or does not work)\n") prog;
exit 1
);
(* Find out if nbdkit + nbdkit-xz-plugin is installed (optional). *)
let cmd =
sprintf "nbdkit %s/nbdkit/plugins/nbdkit-xz-plugin.so --help >/dev/null 2>&1"
Libdir.libdir in
let have_nbdkit = Sys.command cmd = 0 in
if not have_nbdkit && debug then
eprintf (f_"%s: warning: nbdkit or nbdkit-xz-plugin is not available\n")
prog;
have_nbdkit
)
(* Create the cache directory. *)
let cache =
@@ -296,46 +285,19 @@ let output, size, format, delete_output_file, resize_sparse =
output, Some size, format, delete_output_file, true
let source =
(* XXX Disable this for now because libvirt is broken:
* https://bugzilla.redhat.com/show_bug.cgi?id=1011063
*)
if have_nbdkit && false then (
(* If we have nbdkit, then we can use NBD to uncompress the xz
* file on the fly.
*)
let socket = Filename.temp_file "vbnbd" ".sock" in
let source = sprintf "nbd://?socket=%s" socket in
let argv = [| "nbdkit"; "-r"; "-f"; "-U"; socket;
Libdir.libdir // "nbdkit/plugins/nbdkit-xz-plugin.so";
"file=" ^ template |] in
let pid =
match fork () with
| 0 -> (* child *)
execvp "nbdkit" argv
| pid -> pid in
(* Clean up when the program exits. *)
let clean_up () =
(try kill pid Sys.sigterm with _ -> ());
(try unlink socket with _ -> ())
in
at_exit clean_up;
source
)
else (
(* Otherwise we have to uncompress it to a temporary file. *)
let { Index_parser.file_uri = file_uri } = entry in
let tmpfile = Filename.temp_file "vbsrc" ".img" in
let cmd = sprintf "xzcat %s > %s" (quote template) (quote tmpfile) in
if debug then eprintf "%s\n%!" cmd;
msg (f_"Uncompressing: %s") file_uri;
let r = Sys.command cmd in
if r <> 0 then (
eprintf (f_"%s: error: failed to uncompress template\n") prog;
exit 1
);
unlink_on_exit tmpfile;
tmpfile
)
(* Uncompress it to a temporary file. *)
let { Index_parser.file_uri = file_uri } = entry in
let tmpfile = Filename.temp_file "vbsrc" ".img" in
let cmd = sprintf "xzcat %s > %s" (quote template) (quote tmpfile) in
if debug then eprintf "%s\n%!" cmd;
msg (f_"Uncompressing: %s") file_uri;
let r = Sys.command cmd in
if r <> 0 then (
eprintf (f_"%s: error: failed to uncompress template\n") prog;
exit 1
);
unlink_on_exit tmpfile;
tmpfile
(* Resize the source to the output file. *)
let () =

View File

@@ -695,14 +695,7 @@ The template signature is checked.
=item *
If the template image is xz-compressed: If L<nbdkit(1)> and
L<nbdkit-xz-plugin(1)> are both installed, nbdkit is used to
transparently uncompress the image on the fly. Else it is
uncompressed to a temporary disk which takes more disk space.
[B<Note:> Use of nbdkit is disabled because of a libvirt bug:
L<https://bugzilla.redhat.com/show_bug.cgi?id=1011063> It will
be enabled in a future release.]
The template is uncompressed to a tmp file.
=item *
@@ -1268,8 +1261,6 @@ L<virt-rescue(1)>,
L<virt-resize(1)>,
L<virt-sysprep(1)>,
L<oz-install(1)>,
L<nbdkit(1)>,
L<nbdkit-xz-plugin(1)>,
L<gpg(1)>,
L<curl(1)>,
L<http://libguestfs.org/>.

View File

@@ -151,8 +151,6 @@ For UML backend.
=item xz
=item nbdkit
For virt-builder.
=item golang E<ge> 1.1.1

View File

@@ -119,8 +119,6 @@ RELEASE NOTES FOR LIBGUESTFS 1.24
xz
nbdkit
For virt-builder.
golang ≥ 1.1.1