Displaying 6 results from an estimated 6 matches for "get_init_flags".
2020 Feb 10
2
[nbdkit PATCH 05/10] plugins: Wire up file-based plugin support for NBD_INFO_INIT_STATE
...ABILITY,
+# 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 initial state of the file plugin.
+
+source ./functions.sh
+set -e
+
+requires nbdsh -c 'exit (not hasattr (h, "get_init_flags"))'
+requires truncate --help
+requires stat --help
+
+sock=`mktemp -u`
+files="file-init.pid $sock file-init.out"
+rm -f $files
+cleanup_fn rm -f $files
+
+# See if the current file system creates sparse files
+truncate --size=1M file-init.out
+if test "$(stat -c %b file-in...
2020 Feb 10
0
[libnbd PATCH 1/1] generator: Add support for NBD_INFO_INIT_STATE extension
The NBD protocol is adding an extension for servers to report the
initial state of the image (for now, whether it is sparse and/or reads
as all zeroes). Time to expose this to clients, via the new API
nbd_get_init_flags(). The patch requires refreshing the
nbd-protocol.h file from a corresponding contemporary nbdkit commit.
Testing is possible with recent enough qemu.
---
.gitignore | 1 +
generator/generator | 40 +++++++++++++--
generator/states-newstyle-opt-go.c | 12 +...
2020 Feb 10
17
Cross-project NBD extension proposal: NBD_INFO_INIT_STATE
...bd/run your command here
to pick up just-built qemu-nbd, nbdsh, and nbdkit that all support the
feature.
For quickly setting flags:
nbdkit eval init_sparse='exit 0' init_zero='exit 0' ...
For quickly checking flags:
qemu-nbd --list ... | grep init
nbdsh -u uri... -c 'print(h.get_init_flags())'
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
2020 Feb 10
2
[nbdkit PATCH 04/10] plugins: Wire up in-memory plugin support for NBD_INFO_INIT_STATE
...ta, so it
doesn't need changes. The info plugin is never sparse, but can be all
zeroes in base64exportname mode.
Adding initial state support to file-based and language binding
plugins will be done separately.
Testing of this addition relies on a contemporary patch to libnbd
adding a new nbd_get_init_flags() function for reading the advertised
initial state, then demonstrating changes in state observable from the
memory plugin over successive clients.
Signed-off-by: Eric Blake <eblake@redhat.com>
---
common/sparse/sparse.c | 30 +++++++++++++++++-
common/sparse/sparse.h | 19 +++++++++++...
2020 Feb 10
1
[nbdkit PATCH 10/10] plugins: Wire up nbd plugin support for NBD_INFO_INIT_STATE
...and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -702,6 +702,42 @@ nbdplug_can_extents (void *handle)
return i;
}
+static int
+nbdplug_init_sparse (void *handle)
+{
+ struct handle *h = handle;
+ int i = 0;
+
+#if LIBNBD_HAVE_NBD_GET_INIT_FLAGS
+ i = nbd_get_init_flags (h->nbd);
+
+ if (i == -1) {
+ nbdkit_error ("failure to check init flags: %s", nbd_get_error ());
+ return -1;
+ }
+ i = !!(i & LIBNBD_INIT_SPARSE);
+#endif
+ return i;
+}
+
+static int
+nbdplug_init_zero (void *handle)
+{
+ struct handle *h =...
2020 Feb 11
0
Re: [nbdkit PATCH 05/10] plugins: Wire up file-based plugin support for NBD_INFO_INIT_STATE
..."extents enabled, image includes data before hole");
> + h->init_sparse = true;
> + }
> + }
> + }
> + }
In the non-block case, can't we stat(2) the file and look at statbuf.st_blocks?
> +requires nbdsh -c 'exit (not hasattr (h, "get_init_flags"))'
Not wrong, but it's easier to do it like this:
https://github.com/libguestfs/nbdkit/blob/5e4745641bb4676f607fdb3f8750dbf6e9516877/tests/test-vsock.sh#L48
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualizati...