diff --git a/README b/README index 5186e9d6e..e171ee5aa 100644 --- a/README +++ b/README @@ -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. | diff --git a/builder/builder.ml b/builder/builder.ml index d3dd9c67a..fef82a1ad 100644 --- a/builder/builder.ml +++ b/builder/builder.ml @@ -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 () = diff --git a/builder/virt-builder.pod b/builder/virt-builder.pod index 6fe6a5503..5aa7e4e94 100644 --- a/builder/virt-builder.pod +++ b/builder/virt-builder.pod @@ -695,14 +695,7 @@ The template signature is checked. =item * -If the template image is xz-compressed: If L and -L 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 Use of nbdkit is disabled because of a libvirt bug: -L It will -be enabled in a future release.] +The template is uncompressed to a tmp file. =item * @@ -1268,8 +1261,6 @@ L, L, L, L, -L, -L, L, L, L. diff --git a/guestfs-release-notes.pod b/guestfs-release-notes.pod index caaea6930..88af9aa4e 100644 --- a/guestfs-release-notes.pod +++ b/guestfs-release-notes.pod @@ -151,8 +151,6 @@ For UML backend. =item xz -=item nbdkit - For virt-builder. =item golang E 1.1.1 diff --git a/guestfs-release-notes.txt b/guestfs-release-notes.txt index a132eeae9..89d997174 100644 --- a/guestfs-release-notes.txt +++ b/guestfs-release-notes.txt @@ -119,8 +119,6 @@ RELEASE NOTES FOR LIBGUESTFS 1.24 xz - nbdkit - For virt-builder. golang ≥ 1.1.1