New upstream version 1.6.0, stable branch.

This commit is contained in:
Richard W.M. Jones 2018-08-28 16:58:45 +01:00
parent 7d3de34ec7
commit d9bde53553
8 changed files with 9 additions and 456 deletions

View File

@ -1,25 +0,0 @@
From 9aa3a2a229e1dc3936e0295b05e151b4ef9a8826 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 27 Aug 2018 12:17:33 +0100
Subject: [PATCH 1/6] common/sparse: Fix include directory for nbdkit-plugin.h.
Fixes commit 5986c3063ee1d2f28a33d01006bc31b596b4d5f6.
---
common/sparse/Makefile.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/common/sparse/Makefile.am b/common/sparse/Makefile.am
index b6cf2f9..6d73878 100644
--- a/common/sparse/Makefile.am
+++ b/common/sparse/Makefile.am
@@ -38,6 +38,7 @@ libsparse_la_SOURCES = \
sparse.c \
sparse.h
libsparse_la_CPPFLAGS = \
+ -I$(top_srcdir)/include \
-I$(top_srcdir)/common/include
libsparse_la_CFLAGS = \
$(WARNINGS_CFLAGS)
--
2.18.0

View File

@ -1,52 +0,0 @@
From 087cd104e7fcbd48db66e1a4f4b134ae2e456842 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 27 Aug 2018 12:45:50 +0100
Subject: [PATCH 2/6] data, memory: Small refinements to the man pages.
---
plugins/data/nbdkit-data-plugin.pod | 3 +++
plugins/memory/nbdkit-memory-plugin.pod | 7 ++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/plugins/data/nbdkit-data-plugin.pod b/plugins/data/nbdkit-data-plugin.pod
index 27a7850..c174abb 100644
--- a/plugins/data/nbdkit-data-plugin.pod
+++ b/plugins/data/nbdkit-data-plugin.pod
@@ -28,6 +28,9 @@ image, possibly followed by zeroes (using the C<size> parameter to pad
the image to the full size), or use the C<data> parameter creatively
to make mostly sparse disk images.
+The C<size> parameter can specify any virtual size up to the maximum
+supported by nbdkit (C<2⁶³-1> bytes).
+
=head1 EXAMPLES
=over 4
diff --git a/plugins/memory/nbdkit-memory-plugin.pod b/plugins/memory/nbdkit-memory-plugin.pod
index 0493d8d..bc1fecc 100644
--- a/plugins/memory/nbdkit-memory-plugin.pod
+++ b/plugins/memory/nbdkit-memory-plugin.pod
@@ -13,7 +13,8 @@ single disk image in virtual memory, and discards it when nbdkit
exits.
All nbdkit clients will see the same disk content, initially all
-zeroes.
+zeroes. This plugin can be used for testing or where you don't care
+about the final content of the disk image.
The disk image is stored in memory using a sparse array. The
allocated parts of the disk image cannot be larger than physical RAM
@@ -26,8 +27,8 @@ maximum supported by nbdkit (C<2⁶³-1> bytes). This limit is tested
when nbdkit is compiled, and it should work on all platforms and
architectures supported by nbdkit.
-This can be used for testing where you don't care about the final
-content of the disk image.
+If you want an in-memory disk image preinitialized with some data,
+look at L<nbdkit-data-plugin(1)> instead.
=head1 PARAMETERS
--
2.18.0

View File

@ -1,44 +0,0 @@
From 7544ba9c12edc462799969129f49f0a1b76a6ef1 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 27 Aug 2018 13:48:21 +0100
Subject: [PATCH 3/6] memory: Document how to preload disk images into the
plugin.
---
plugins/memory/nbdkit-memory-plugin.pod | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/plugins/memory/nbdkit-memory-plugin.pod b/plugins/memory/nbdkit-memory-plugin.pod
index bc1fecc..d5ea8ba 100644
--- a/plugins/memory/nbdkit-memory-plugin.pod
+++ b/plugins/memory/nbdkit-memory-plugin.pod
@@ -27,8 +27,24 @@ maximum supported by nbdkit (C<2⁶³-1> bytes). This limit is tested
when nbdkit is compiled, and it should work on all platforms and
architectures supported by nbdkit.
-If you want an in-memory disk image preinitialized with some data,
-look at L<nbdkit-data-plugin(1)> instead.
+=head2 Preloading data
+
+If you want an in-memory disk image preinitialized with a small amount
+of data specified on the command line, look at
+L<nbdkit-data-plugin(1)> instead.
+
+If you want to preload a large amount of data (eg. a disk image) into
+the memory plugin, use L<qemu-img(1)>:
+
+ $ rm -f pid
+ $ nbdkit -P pid memory size=10G
+
+ # wait for nbdkit to become ready to accept connections:
+ $ while [ ! -f pid ]; do sleep 1; done
+
+ # preload Fedora disk image:
+ $ virt-builder fedora-28 --size=10G
+ $ qemu-img convert -p -n fedora-28.img nbd:localhost:10809
=head1 PARAMETERS
--
2.18.0

View File

@ -1,58 +0,0 @@
From 5afc6acd0719ed5b5c4e48763237efe9230fb8a7 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 27 Aug 2018 16:18:26 +0100
Subject: [PATCH 4/6] data: Fix this plugin to work with 64 bit offsets.
It can now handle 64 bit offsets on both 32 and 64 bit platforms.
---
plugins/data/data.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/plugins/data/data.c b/plugins/data/data.c
index e61e3be..3d27227 100644
--- a/plugins/data/data.c
+++ b/plugins/data/data.c
@@ -35,6 +35,8 @@
#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
+#include <inttypes.h>
#include <string.h>
#if defined(HAVE_GNUTLS) && defined(HAVE_GNUTLS_BASE64_DECODE2)
@@ -107,25 +109,23 @@ read_base64 (const char *value)
static int
read_data (const char *value)
{
- size_t offset = 0;
+ int64_t offset = 0;
size_t i, len = strlen (value);
for (i = 0; i < len; ++i) {
- int j, n;
+ int64_t j;
+ int n;
char c;
- /* XXX Using the %i type specifier limits this plugin to creating
- * 32 bit data (even on 64 bit platforms).
- */
- if (sscanf (&value[i], " @%i%n", &j, &n) == 1) {
- if (j == -1) {
+ if (sscanf (&value[i], " @%" SCNi64 "%n", &j, &n) == 1) {
+ if (j < 0) {
nbdkit_error ("data parameter @OFFSET must not be negative");
return -1;
}
i += n;
offset = j;
}
- else if (sscanf (&value[i], " %i%n", &j, &n) == 1) {
+ else if (sscanf (&value[i], " %" SCNi64 "%n", &j, &n) == 1) {
if (j < 0 || j > 255) {
nbdkit_error ("data parameter BYTE must be in the range 0..255");
return -1;
--
2.18.0

View File

@ -1,29 +0,0 @@
From f6d1419f36905965ec5ccb43236617639ea21c7f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 27 Aug 2018 18:52:51 +0100
Subject: [PATCH 5/6] data: Permit whitespace at the end of the data string.
---
plugins/data/data.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/plugins/data/data.c b/plugins/data/data.c
index 3d27227..0925233 100644
--- a/plugins/data/data.c
+++ b/plugins/data/data.c
@@ -141,6 +141,12 @@ read_data (const char *value)
return -1;
offset++;
}
+ /* We have to have a rule to skip just whitespace so that
+ * whitespace is permitted at the end of the string.
+ */
+ else if (sscanf (&value[i], " %n", &n) == 0) {
+ i += n;
+ }
else {
nbdkit_error ("data parameter: parsing error at offset %zu", i);
return -1;
--
2.18.0

View File

@ -1,235 +0,0 @@
From 2c548ffcf2745f23a504d646f64a20c984bc2e32 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 27 Aug 2018 18:48:51 +0100
Subject: [PATCH 6/6] data: Add example of partitioned 7 EB disk, and test.
---
plugins/data/nbdkit-data-plugin.pod | 48 ++++++++++-
tests/Makefile.am | 2 +
tests/test-data-7E.sh | 128 ++++++++++++++++++++++++++++
3 files changed, 177 insertions(+), 1 deletion(-)
create mode 100755 tests/test-data-7E.sh
diff --git a/plugins/data/nbdkit-data-plugin.pod b/plugins/data/nbdkit-data-plugin.pod
index c174abb..5d66f43 100644
--- a/plugins/data/nbdkit-data-plugin.pod
+++ b/plugins/data/nbdkit-data-plugin.pod
@@ -56,7 +56,7 @@ base64 decoding of C<MTIz>), followed by S<1M - 3 bytes> of zeroes.
@0x1fe 0x55 0xaa" \
size=1M
-The last example was created by running:
+This example was created by running:
$ rm -f disk
$ truncate -s 1M disk
@@ -75,6 +75,52 @@ The last example was created by running:
and then translating the disk data and offsets into the C<data>
string (see L</DATA FORMAT>).
+=item Create a 7 EB (exabyte) disk with one empty GPT-formatted partition:
+
+The data plugin supports huge sparse virtual disks, up to the maximum
+size supported by nbdkit itself (S<2⁶³-1 bytes> =
+S<8 exabytes - 1 byte>). These cause all sorts of problems for
+software and so make excellent test cases. To partition such a huge
+disk requires the GPT (GUID Partition Table) format since MBR is
+limited to just 2 TB.
+
+ nbdkit data data="
+ @0x1c0 2 0 0xee 0xfe 0xff 0xff 0x01 0 0 0 0xff 0xff 0xff 0xff
+ @0x1fe 0x55 0xaa
+ @0x200 0x45 0x46 0x49 0x20 0x50 0x41 0x52 0x54
+ 0 0 1 0 0x5c 0 0 0
+ 0x9b 0xe5 0x6a 0xc5 0 0 0 0 1 0 0 0 0 0 0 0
+ 0xff 0xff 0xff 0xff 0xff 0xff 0x37 0 0x22 0 0 0 0 0 0 0
+ 0xde 0xff 0xff 0xff 0xff 0xff 0x37 0
+ 0x72 0xb6 0x9e 0x0c 0x6b 0x76 0xb0 0x4f
+ 0xb3 0x94 0xb2 0xf1 0x61 0xec 0xdd 0x3c 2 0 0 0 0 0 0 0
+ 0x80 0 0 0 0x80 0 0 0 0x79 0x8a 0xd0 0x7e 0 0 0 0
+ @0x400 0xaf 0x3d 0xc6 0x0f 0x83 0x84 0x72 0x47
+ 0x8e 0x79 0x3d 0x69 0xd8 0x47 0x7d 0xe4
+ 0xd5 0x19 0x46 0x95 0xe3 0x82 0xa8 0x4c
+ 0x95 0x82 0x7a 0xbe 0x1c 0xfc 0x62 0x90
+ 0x80 0 0 0 0 0 0 0 0x80 0xff 0xff 0xff 0xff 0xff 0x37 0
+ 0 0 0 0 0 0 0 0 0x70 0 0x31 0 0 0 0 0
+ @0x6fffffffffffbe00
+ 0xaf 0x3d 0xc6 0x0f 0x83 0x84 0x72 0x47
+ 0x8e 0x79 0x3d 0x69 0xd8 0x47 0x7d 0xe4
+ 0xd5 0x19 0x46 0x95 0xe3 0x82 0xa8 0x4c
+ 0x95 0x82 0x7a 0xbe 0x1c 0xfc 0x62 0x90
+ 0x80 0 0 0 0 0 0 0 0x80 0xff 0xff 0xff 0xff 0xff 0x37 0
+ 0 0 0 0 0 0 0 0 0x70 0 0x31 0 0 0 0 0
+ @0x6ffffffffffffe00
+ 0x45 0x46 0x49 0x20 0x50 0x41 0x52 0x54
+ 0 0 1 0 0x5c 0 0 0
+ 0x6c 0x76 0xa1 0xa0 0 0 0 0
+ 0xff 0xff 0xff 0xff 0xff 0xff 0x37 0
+ 1 0 0 0 0 0 0 0 0x22 0 0 0 0 0 0 0
+ 0xde 0xff 0xff 0xff 0xff 0xff 0x37 0
+ 0x72 0xb6 0x9e 0x0c 0x6b 0x76 0xb0 0x4f
+ 0xb3 0x94 0xb2 0xf1 0x61 0xec 0xdd 0x3c
+ 0xdf 0xff 0xff 0xff 0xff 0xff 0x37 0
+ 0x80 0 0 0 0x80 0 0 0 0x79 0x8a 0xd0 0x7e 0 0 0 0
+ " size=7E
+
=back
=head1 PARAMETERS
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1dbfd32..aa7c0e2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -48,6 +48,7 @@ EXTRA_DIST = \
test-captive.sh \
test-cow.sh \
test-cxx.sh \
+ test-data-7E.sh \
test-data-base64.sh \
test-data-raw.sh \
test-debug-flags.sh \
@@ -281,6 +282,7 @@ endif HAVE_GUESTFISH
# data plugin test.
LIBGUESTFS_TESTS += test-data
TESTS += \
+ test-data-7E.sh \
test-data-base64.sh \
test-data-raw.sh
diff --git a/tests/test-data-7E.sh b/tests/test-data-7E.sh
new file mode 100755
index 0000000..8327511
--- /dev/null
+++ b/tests/test-data-7E.sh
@@ -0,0 +1,128 @@
+#!/usr/bin/env bash
+# nbdkit
+# Copyright (C) 2018 Red Hat Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Red Hat nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+# Test the data plugin creating a 7 EB partitioned disk, and
+# the partition filter on top.
+
+set -e
+set -x
+
+files="data-7E.out data-7E.pid data-7E.sock"
+rm -f $files
+
+# Test that qemu-io works
+if ! qemu-io --help >/dev/null; then
+ echo "$0: missing or broken qemu-io"
+ exit 77
+fi
+
+# Run nbdkit.
+nbdkit -P data-7E.pid -U data-7E.sock \
+ --filter=partition \
+ data size=7E partition=1 \
+ data="
+ @0x1c0 2 0 0xee 0xfe 0xff 0xff 0x01 0 0 0 0xff 0xff 0xff 0xff
+ @0x1fe 0x55 0xaa
+ @0x200 0x45 0x46 0x49 0x20 0x50 0x41 0x52 0x54
+ 0 0 1 0 0x5c 0 0 0
+ 0x9b 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0 0x4f
+ 0xb3 0x94 0xb2 0xf1 0x61 0xec 0xdd 0x3c
+ 0xdf 0xff 0xff 0xff 0xff 0xff 0x37 0
+ 0x80 0 0 0 0x80 0 0 0 0x79 0x8a 0xd0 0x7e 0 0 0 0
+ "
+
+# We may have to wait a short time for the pid file to appear.
+for i in `seq 1 10`; do
+ if test -f data-7E.pid; then
+ break
+ fi
+ sleep 1
+done
+if ! test -f data-7E.pid; then
+ echo "$0: PID file was not created"
+ exit 1
+fi
+
+pid="$(cat data-7E.pid)"
+
+# Kill the nbdkit process on exit.
+cleanup ()
+{
+ status=$?
+ trap '' INT QUIT TERM EXIT ERR
+ echo $0: cleanup: exit code $status
+
+ kill $pid
+ rm -f $files
+
+ exit $status
+}
+trap cleanup INT QUIT TERM EXIT ERR
+
+# Since we're reading the empty first partition, any read returns zeroes.
+qemu-io -r -f raw 'nbd+unix://?socket=data-7E.sock' \
+ -c 'r -v 498 16' | grep -E '^[[:xdigit:]]+:' > data-7E.out
+if [ "$(cat data-7E.out)" != "000001f2: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................" ]
+then
+ echo "$0: unexpected pattern:"
+ cat data-7E.out
+ exit 1
+fi
+
+# The cleanup() function is called implicitly on exit.
--
2.18.0

View File

@ -25,14 +25,14 @@
%global verify_tarball_signature 1
# If there are patches which touch autotools files, set this to 1.
%global patches_touch_autotools 1
%global patches_touch_autotools %{nil}
# The source directory.
%global source_directory 1.5-development
%global source_directory 1.6-stable
Name: nbdkit
Version: 1.5.10
Release: 3%{?dist}
Version: 1.6.0
Release: 1%{?dist}
Summary: NBD server
License: BSD
@ -45,13 +45,6 @@ Source1: http://libguestfs.org/download/nbdkit/%{source_directory}/%{name
Source2: libguestfs.keyring
%endif
Patch1: 0001-common-sparse-Fix-include-directory-for-nbdkit-plugi.patch
Patch2: 0002-data-memory-Small-refinements-to-the-man-pages.patch
Patch3: 0003-memory-Document-how-to-preload-disk-images-into-the-.patch
Patch4: 0004-data-Fix-this-plugin-to-work-with-64-bit-offsets.patch
Patch5: 0005-data-Permit-whitespace-at-the-end-of-the-data-string.patch
Patch6: 0006-data-Add-example-of-partitioned-7-EB-disk-and-test.patch
%if 0%{patches_touch_autotools}
BuildRequires: autoconf, automake, libtool
%endif
@ -957,6 +950,9 @@ popd
%changelog
* Tue Aug 28 2018 Richard W.M. Jones <rjones@redhat.com> - 1.6.0-1
- New upstream version 1.6.0, stable branch.
* Mon Aug 27 2018 Richard W.M. Jones <rjones@redhat.com> - 1.5.10-3
- New upstream version 1.5.10.
- Add upstream patches after 1.5.10.

View File

@ -1,2 +1,2 @@
SHA512 (nbdkit-1.5.10.tar.gz) = 342a9d2e0f91b31767a2d522237054a238bd903b8c49f3ccc6f7652d9a011395ca874adfb9ebda9cc150b62d9293f16d67b7d116d0cc7bcf7835608e0289737f
SHA512 (nbdkit-1.5.10.tar.gz.sig) = 3af2258227c16b78c3ffeb8ab915f7f21a2dc43577fa2199403a412901be210776815a8c5a9b0f9eea5becdad1c95de8453def764c40edab07d9856c1a43cac4
SHA512 (nbdkit-1.6.0.tar.gz) = d395e1b62a370b6ba66768b866534c4341210b77e47ff4b120b00722bda63e2c317573f9d0a1a85ee8c3dd6f7d1f0726bcacdebf3bf34f36272eea4baa047916
SHA512 (nbdkit-1.6.0.tar.gz.sig) = 89b14d8a70752642268fdbd06236d603b2716a930739d5d1e037f195153ab8d70b38c379c1bffeec65f78d391c2204a6f171920b74684fb02fd3c5996c1040a4