Update nbdkit-vddk-plugin

Distribute README.VDDK in nbdkit-vddk-plugin subpackage

resolves: rhbz#2018463, rhbz#2011709
This commit is contained in:
Richard W.M. Jones 2021-10-30 14:36:32 +01:00
parent 0d3bf32327
commit ceffede5b1
27 changed files with 957 additions and 88 deletions

View File

@ -0,0 +1,73 @@
From 5c4dcc9ade4b2d46d69478f711bd98b14b99c3d2 Mon Sep 17 00:00:00 2001
From: Hilko Bengen <bengen@hilluzination.de>
Date: Mon, 25 Oct 2021 23:34:20 +0200
Subject: [PATCH] Skip vsock-related checks if AF_VSOCK is not supported.
(cherry picked from commit 068cd85375e9bd309f65ba3971db643e817fe912)
---
tests/functions.sh.in | 10 ++++++++++
tests/test-ip-filter-anyvsock.sh | 1 +
tests/test-nbd-vsock.sh | 1 +
tests/test-vsock.sh | 1 +
4 files changed, 13 insertions(+)
diff --git a/tests/functions.sh.in b/tests/functions.sh.in
index 403fa56e..d6c4255c 100644
--- a/tests/functions.sh.in
+++ b/tests/functions.sh.in
@@ -239,6 +239,16 @@ requires_non_root ()
fi
}
+# Tests that use the vsock interface will fail if vsock is not
+# supported.
+requires_vsock_support ()
+{
+ if ! grep -q ^AF_VSOCK /proc/net/protocols; then
+ echo "$0: test skipped because AF_VSOCK is not supported."
+ exit 77
+ fi
+}
+
# start_nbdkit -P pidfile args...
#
# Run nbdkit with args and wait for it to start up. If it fails to
diff --git a/tests/test-ip-filter-anyvsock.sh b/tests/test-ip-filter-anyvsock.sh
index 3160e982..016b1da9 100755
--- a/tests/test-ip-filter-anyvsock.sh
+++ b/tests/test-ip-filter-anyvsock.sh
@@ -47,6 +47,7 @@ requires nbdsh --version
requires nbdsh -c 'print(h.connect_vsock)'
requires_nbdsh_uri
requires_linux_kernel_version 5.6
+requires_vsock_support
# Not supported on Windows.
if is_windows; then
diff --git a/tests/test-nbd-vsock.sh b/tests/test-nbd-vsock.sh
index e3736898..f1f839a0 100755
--- a/tests/test-nbd-vsock.sh
+++ b/tests/test-nbd-vsock.sh
@@ -47,6 +47,7 @@ set -x
requires_nbdsh_uri
requires nbdsh -c 'print(h.connect_vsock)'
requires_linux_kernel_version 5.6
+requires_vsock_support
# Because vsock ports are 32 bits, we can basically pick one at random
# and be sure that it's not used. However we must pick one >= 1024
diff --git a/tests/test-vsock.sh b/tests/test-vsock.sh
index fc39cb7b..0bcfc4ba 100755
--- a/tests/test-vsock.sh
+++ b/tests/test-vsock.sh
@@ -47,6 +47,7 @@ requires nbdsh --version
requires nbdsh -c 'print(h.connect_vsock)'
requires_nbdsh_uri
requires_linux_kernel_version 5.6
+requires_vsock_support
# Because vsock ports are 32 bits, we can basically pick one at random
# and be sure that it's not used. However we must pick one >= 1024
--
2.31.1

View File

@ -1,4 +1,4 @@
From 72f0a3ce7635c4a94135cb037ae9d36e82bd5f73 Mon Sep 17 00:00:00 2001
From 98da45afe98a59a1dc783968bb3b08008a3d6a68 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 26 Oct 2021 12:55:14 +0100
Subject: [PATCH] vddk: Update comment about VixDiskLib_PrepareForAccess
@ -9,10 +9,10 @@ Subject: [PATCH] vddk: Update comment about VixDiskLib_PrepareForAccess
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index 8955bc51..fc377a29 100644
index c6e023eb..ee9853a7 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -721,10 +721,9 @@ vddk_open (int readonly)
@@ -676,10 +676,9 @@ vddk_open (int readonly)
h->params->specType = VIXDISKLIB_SPEC_VMX;
}

View File

@ -1,4 +1,4 @@
From 6c8f9fada5d50dc3ee5a1304420fdee3ed023d9f Mon Sep 17 00:00:00 2001
From 7d72530453550a613ee311dd0f3bbbbc87165b1c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 26 Oct 2021 14:30:43 +0100
Subject: [PATCH] vddk: Document what I found about VixDiskLib_Flush
@ -9,10 +9,10 @@ Subject: [PATCH] vddk: Document what I found about VixDiskLib_Flush
1 file changed, 8 insertions(+)
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index fc377a29..c506b5a1 100644
index ee9853a7..f5fa3dfc 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -957,6 +957,14 @@ vddk_flush (void *handle, uint32_t flags)
@@ -906,6 +906,14 @@ vddk_flush (void *handle, uint32_t flags)
struct vddk_handle *h = handle;
VixError err;
@ -24,9 +24,9 @@ index fc377a29..c506b5a1 100644
+ * file so it appears to be the correct call to use here.
+ */
+
VDDK_CALL_START (VixDiskLib_Flush, "handle")
VDDK_CALL_START (VixDiskLib_Flush, "handle") {
err = VixDiskLib_Flush (h->handle);
VDDK_CALL_END (VixDiskLib_Flush, 0);
} VDDK_CALL_END (VixDiskLib_Flush);
--
2.31.1

View File

@ -1,4 +1,4 @@
From 21bfaf35b4a0eb825a3db5736792dac97d1dd7c2 Mon Sep 17 00:00:00 2001
From aa9fdf84c9d77f2334501777a3800ac64b494c54 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 26 Oct 2021 19:44:46 +0100
Subject: [PATCH] vddk: Note that we have tested VDDK 7.0.3
@ -9,10 +9,10 @@ Subject: [PATCH] vddk: Note that we have tested VDDK 7.0.3
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/vddk/nbdkit-vddk-plugin.pod b/plugins/vddk/nbdkit-vddk-plugin.pod
index fd8950c2..0702aa75 100644
index 2363b8fa..078badcc 100644
--- a/plugins/vddk/nbdkit-vddk-plugin.pod
+++ b/plugins/vddk/nbdkit-vddk-plugin.pod
@@ -551,7 +551,7 @@ server, which can also be very slow.
@@ -480,7 +480,7 @@ For more information see L<https://bugzilla.redhat.com/1614276>.
This plugin requires VDDK E<ge> 5.5.5, which in turn means that it
is only supported on x64-64 platforms.

View File

@ -0,0 +1,54 @@
From 31317e5d7c249ed318398451ab36d81b0eb5095f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 27 Oct 2021 20:20:31 +0100
Subject: [PATCH] tests: vddk: Cannot test real VDDK under valgrind
The LD_LIBRARY_PATH munging done in nbdkit-vddk-plugin is incompatible
with valgrind, so skip it for both of the real VDDK tests. This is
already done in the dummy VDDK tests.
(cherry picked from commit d501b5266c3239b974b79fd6a74ad046729cd046)
---
tests/test-vddk-real-dump-plugin.sh | 7 +++++++
tests/test-vddk-real.sh | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/tests/test-vddk-real-dump-plugin.sh b/tests/test-vddk-real-dump-plugin.sh
index 1479e416..2cb7724e 100755
--- a/tests/test-vddk-real-dump-plugin.sh
+++ b/tests/test-vddk-real-dump-plugin.sh
@@ -39,6 +39,13 @@ requires test -d "$vddkdir"
requires test -f "$vddkdir/lib64/libvixDiskLib.so"
requires cut --version
+# Testing $LD_LIBRARY_PATH stuff breaks valgrind, so skip the rest of
+# this test if valgrinding.
+if [ "x$NBDKIT_VALGRIND" = "x1" ]; then
+ echo "$0: skipped LD_LIBRARY_PATH test when doing valgrind"
+ exit 77
+fi
+
# VDDK > 5.1.1 only supports x86_64.
if [ `uname -m` != "x86_64" ]; then
echo "$0: unsupported architecture"
diff --git a/tests/test-vddk-real.sh b/tests/test-vddk-real.sh
index 08f6f8d8..e7007bfa 100755
--- a/tests/test-vddk-real.sh
+++ b/tests/test-vddk-real.sh
@@ -45,6 +45,13 @@ requires nbdcopy --version
requires nbdinfo --version
requires stat --version
+# Testing $LD_LIBRARY_PATH stuff breaks valgrind, so skip the rest of
+# this test if valgrinding.
+if [ "x$NBDKIT_VALGRIND" = "x1" ]; then
+ echo "$0: skipped LD_LIBRARY_PATH test when doing valgrind"
+ exit 77
+fi
+
# VDDK > 5.1.1 only supports x86_64.
if [ `uname -m` != "x86_64" ]; then
echo "$0: unsupported architecture"
--
2.31.1

View File

@ -0,0 +1,36 @@
From 4b69e586155d10781390a607eb346421187bd72d Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 27 Oct 2021 20:21:24 +0100
Subject: [PATCH] tests/test-vddk-real.sh: Don't hide log messages on failure
Use tee here so we always get the log messages in the log file.
Previously if nbdkit returned an error then the log messages were not
printed (since "cat $log" line was not reached).
(cherry picked from commit efa13d12cd5eb1e15d783a39da5a9e709d157843)
---
tests/test-vddk-real.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/test-vddk-real.sh b/tests/test-vddk-real.sh
index e7007bfa..a6aceac9 100755
--- a/tests/test-vddk-real.sh
+++ b/tests/test-vddk-real.sh
@@ -80,11 +80,11 @@ qemu-img create -f vmdk $vmdk 10M
# Check first that the VDDK library can be fully loaded. We have to
# check the log file for missing modules since they may not show up as
# errors.
-nbdkit -fv -U - vddk libdir="$vddkdir" $vmdk --run 'nbdinfo "$uri"' >$log 2>&1
+nbdkit -fv -U - vddk libdir="$vddkdir" $vmdk --run 'nbdinfo "$uri"' 2>&1 |
+ tee $log
# Check the log for missing modules
-cat $log
-if grep 'cannot open shared object file' test-vddk-real.log; then
+if grep 'cannot open shared object file' $log; then
exit 1
fi
--
2.31.1

View File

@ -0,0 +1,47 @@
From 0923b0e70735139e1a548addecf6e20c567a96a0 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 30 Oct 2021 08:25:03 +0100
Subject: [PATCH] vddk: Small copyedits to README.VDDK
Clean up the sentence about LD_LIBRARY_PATH which could be
misconstrued to mean that we recommend setting this (we do not).
Remove "bugs" section which was wrong.
(cherry picked from commit 55c2a029692fc20bf4a7d4ae857e3609b45ec3dd)
---
plugins/vddk/README.VDDK | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/plugins/vddk/README.VDDK b/plugins/vddk/README.VDDK
index f2204d75..c38eaa51 100644
--- a/plugins/vddk/README.VDDK
+++ b/plugins/vddk/README.VDDK
@@ -14,21 +14,10 @@ export VMDK files and VMware disks over NBD.
You do NOT require VDDK to compile the plugin, and the plugin does not
contain any VMware code. You only need VDDK at runtime. The plugin
uses dlopen to load the library from a directory determined by the
-configuration parameter libdir (LD_LIBRARY_PATH or the standard shared
-library locations can also be used, although that approach is not
-recommended).
+configuration parameter libdir. It is NOT recommended to put VDDK in
+your regular library path (eg /usr/lib) because it contains components
+that conflict with system libraries.
After building nbdkit-vddk-plugin.so, read the man page to find out
how to use it (nbdkit-vddk-plugin(1)). You'll probably also want to
read the VDDK developer documentation.
-
-Bugs
-----
-
-Write calls sometimes return VIX_E_DISK_OUTOFRANGE even for write
-requests which are well inside the disk.
-
-The way we do threading in nbdkit is not congruent with the way you're
-supposed to call VDDK from multithreaded programs. For more
-information see:
-https://www.redhat.com/archives/libguestfs/2019-October/msg00062.html
--
2.31.1

View File

@ -0,0 +1,31 @@
From 6a1d99df5750e0da071f7a246b2adea5ee297dd1 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 30 Oct 2021 08:35:05 +0100
Subject: [PATCH] vddk: Fix man page section in --help output
$ nbdkit vddk --help
...
Many optional parameters are supported, see nbdkit-vddk-plugin(3).
^^^^^^^^^^
(cherry picked from commit 10c43ad240ec219e7af3d680599dd8c7ef841bba)
---
plugins/vddk/vddk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index f5fa3dfc..80f5870e 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -513,7 +513,7 @@ vddk_config_complete (void)
#define vddk_config_help \
"[file=]<FILENAME> (required) The filename (eg. VMDK file) to serve.\n" \
- "Many optional parameters are supported, see nbdkit-vddk-plugin(3)."
+ "Many optional parameters are supported, see nbdkit-vddk-plugin(1)."
static int
vddk_get_ready (void)
--
2.31.1

View File

@ -1,4 +1,4 @@
From 7ab943bbb0ac0dd0094d6771d4cb04374d569eb3 Mon Sep 17 00:00:00 2001
From ec9c61a3f8950f0a196cd5904eea6f1a2a4c05dc Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 21 Oct 2021 14:49:52 +0100
Subject: [PATCH] vddk: Refactor how -D vddk.stats=1 is collected
@ -12,7 +12,7 @@ struct per API for storing these stats.
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index c6e023eb..fc872883 100644
index 80f5870e..3d751544 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -1,5 +1,5 @@

View File

@ -1,4 +1,4 @@
From 7139553f4008c0d4dfdce1dae4c933713af60548 Mon Sep 17 00:00:00 2001
From 4636e9b9c9590b520463b16d9f7dedd7355fa54d Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 21 Oct 2021 15:10:00 +0100
Subject: [PATCH] vddk: Extend -D vddk.stats=1 to show number of calls and
@ -34,7 +34,7 @@ nbdkit: debug: AllocateConnectParams 22 3
2 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/plugins/vddk/nbdkit-vddk-plugin.pod b/plugins/vddk/nbdkit-vddk-plugin.pod
index 2363b8fa..88df0ddb 100644
index 078badcc..e53d3286 100644
--- a/plugins/vddk/nbdkit-vddk-plugin.pod
+++ b/plugins/vddk/nbdkit-vddk-plugin.pod
@@ -517,8 +517,7 @@ Suppress debugging of datapath calls (C<Read> and C<Write>).
@ -48,7 +48,7 @@ index 2363b8fa..88df0ddb 100644
=back
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index fc872883..b623c25c 100644
index 3d751544..5f1d223b 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -106,6 +106,8 @@ static bool is_remote;
@ -117,7 +117,7 @@ index fc872883..b623c25c 100644
}
statlist_reset (&stats);
}
@@ -832,7 +863,7 @@ vddk_pread (void *handle, void *buf, uint32_t count, uint64_t offset,
@@ -831,7 +862,7 @@ vddk_pread (void *handle, void *buf, uint32_t count, uint64_t offset,
"%" PRIu32 " sectors, buffer",
offset, count) {
err = VixDiskLib_Read (h->handle, offset, count, buf);
@ -126,7 +126,7 @@ index fc872883..b623c25c 100644
if (err != VIX_OK) {
VDDK_ERROR (err, "VixDiskLib_Read");
return -1;
@@ -872,7 +903,7 @@ vddk_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset,
@@ -871,7 +902,7 @@ vddk_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset,
"%" PRIu32 " sectors, buffer",
offset, count) {
err = VixDiskLib_Write (h->handle, offset, count, buf);

View File

@ -1,4 +1,4 @@
From 8bd83802eb36508c2ca647da9ba8fb8a5dce7a2b Mon Sep 17 00:00:00 2001
From f746ca775d28ac59a56be705b03fe804766204fa Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 21 Oct 2021 22:55:17 +0100
Subject: [PATCH] vddk: Simplify and consolidate VDDK_CALL_START/END macros
@ -13,7 +13,7 @@ Furthermore we can remove extra { .. } when the macros are applied.
1 file changed, 56 insertions(+), 68 deletions(-)
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index b623c25c..85b0c722 100644
index 5f1d223b..993f2d76 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -125,28 +125,16 @@ static void display_stats (void);
@ -121,7 +121,7 @@ index b623c25c..85b0c722 100644
}
else
free (params);
@@ -717,13 +705,13 @@ vddk_open (int readonly)
@@ -716,13 +704,13 @@ vddk_open (int readonly)
"h->params, %d, %s, %s, &connection",
readonly,
snapshot_moref ? : "NULL",
@ -137,7 +137,7 @@ index b623c25c..85b0c722 100644
if (err != VIX_OK) {
VDDK_ERROR (err, "VixDiskLib_ConnectEx");
goto err1;
@@ -744,25 +732,25 @@ vddk_open (int readonly)
@@ -743,25 +731,25 @@ vddk_open (int readonly)
}
VDDK_CALL_START (VixDiskLib_Open,
@ -169,7 +169,7 @@ index b623c25c..85b0c722 100644
err1:
free_connect_params (h->params);
err0:
@@ -777,12 +765,12 @@ vddk_close (void *handle)
@@ -776,12 +764,12 @@ vddk_close (void *handle)
ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&open_close_lock);
struct vddk_handle *h = handle;
@ -186,7 +186,7 @@ index b623c25c..85b0c722 100644
free_connect_params (h->params);
free (h);
@@ -797,9 +785,9 @@ vddk_get_size (void *handle)
@@ -796,9 +784,9 @@ vddk_get_size (void *handle)
VixError err;
uint64_t size;
@ -198,7 +198,7 @@ index b623c25c..85b0c722 100644
if (err != VIX_OK) {
VDDK_ERROR (err, "VixDiskLib_GetInfo");
return -1;
@@ -828,9 +816,9 @@ vddk_get_size (void *handle)
@@ -827,9 +815,9 @@ vddk_get_size (void *handle)
info->uuid ? : "NULL");
}
@ -210,7 +210,7 @@ index b623c25c..85b0c722 100644
return (int64_t) size;
}
@@ -858,12 +846,12 @@ vddk_pread (void *handle, void *buf, uint32_t count, uint64_t offset,
@@ -857,12 +845,12 @@ vddk_pread (void *handle, void *buf, uint32_t count, uint64_t offset,
offset /= VIXDISKLIB_SECTOR_SIZE;
count /= VIXDISKLIB_SECTOR_SIZE;
@ -228,7 +228,7 @@ index b623c25c..85b0c722 100644
if (err != VIX_OK) {
VDDK_ERROR (err, "VixDiskLib_Read");
return -1;
@@ -898,12 +886,12 @@ vddk_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset,
@@ -897,12 +885,12 @@ vddk_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset,
offset /= VIXDISKLIB_SECTOR_SIZE;
count /= VIXDISKLIB_SECTOR_SIZE;
@ -246,9 +246,9 @@ index b623c25c..85b0c722 100644
if (err != VIX_OK) {
VDDK_ERROR (err, "VixDiskLib_Write");
return -1;
@@ -938,9 +926,9 @@ vddk_flush (void *handle, uint32_t flags)
struct vddk_handle *h = handle;
VixError err;
@@ -945,9 +933,9 @@ vddk_flush (void *handle, uint32_t flags)
* file so it appears to be the correct call to use here.
*/
- VDDK_CALL_START (VixDiskLib_Flush, "handle") {
+ VDDK_CALL_START (VixDiskLib_Flush, "handle")
@ -258,7 +258,7 @@ index b623c25c..85b0c722 100644
if (err != VIX_OK) {
VDDK_ERROR (err, "VixDiskLib_Flush");
return -1;
@@ -976,17 +964,17 @@ vddk_can_extents (void *handle)
@@ -983,17 +971,17 @@ vddk_can_extents (void *handle)
*/
VDDK_CALL_START (VixDiskLib_QueryAllocatedBlocks,
"handle, 0, %d sectors, %d sectors",
@ -280,7 +280,7 @@ index b623c25c..85b0c722 100644
}
if (err != VIX_OK) {
char *errmsg = VixDiskLib_GetErrorText (err, NULL);
@@ -1066,12 +1054,12 @@ vddk_extents (void *handle, uint32_t count, uint64_t offset, uint32_t flags,
@@ -1073,12 +1061,12 @@ vddk_extents (void *handle, uint32_t count, uint64_t offset, uint32_t flags,
VDDK_CALL_START (VixDiskLib_QueryAllocatedBlocks,
"handle, %" PRIu64 " sectors, %" PRIu64 " sectors, "
"%d sectors",
@ -295,7 +295,7 @@ index b623c25c..85b0c722 100644
if (err != VIX_OK) {
VDDK_ERROR (err, "VixDiskLib_QueryAllocatedBlocks");
return -1;
@@ -1090,15 +1078,15 @@ vddk_extents (void *handle, uint32_t count, uint64_t offset, uint32_t flags,
@@ -1097,15 +1085,15 @@ vddk_extents (void *handle, uint32_t count, uint64_t offset, uint32_t flags,
add_extent (extents, &position, blk_offset, true) == -1) ||
(add_extent (extents,
&position, blk_offset + blk_length, false) == -1)) {

View File

@ -1,4 +1,4 @@
From 5bd343fff4a8bb7a115e4b39555a727b33ba52dd Mon Sep 17 00:00:00 2001
From e5fc041defb7cb0e275ed5949bbf7406af70043c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 22 Oct 2021 18:00:27 +0100
Subject: [PATCH] vddk: Document troubleshooting performance problems
@ -12,7 +12,7 @@ with VDDK.
1 file changed, 57 insertions(+)
diff --git a/plugins/vddk/nbdkit-vddk-plugin.pod b/plugins/vddk/nbdkit-vddk-plugin.pod
index 88df0ddb..6c50877e 100644
index e53d3286..5a426135 100644
--- a/plugins/vddk/nbdkit-vddk-plugin.pod
+++ b/plugins/vddk/nbdkit-vddk-plugin.pod
@@ -475,6 +475,63 @@ and restarting the C<hostd> service:

View File

@ -1,4 +1,4 @@
From 7777f1a86f692a9e9bc720e29272321f124208b8 Mon Sep 17 00:00:00 2001
From ab07f475e3bc3980322902aa112c726beada2955 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 23 Oct 2021 16:16:39 +0100
Subject: [PATCH] vddk: Include VDDK major library version in --dump-plugin
@ -16,7 +16,7 @@ VDDK major version. Currently this can be 5, 6 or 7.
3 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/plugins/vddk/nbdkit-vddk-plugin.pod b/plugins/vddk/nbdkit-vddk-plugin.pod
index 6c50877e..5c356cc4 100644
index 5a426135..bc3c3c94 100644
--- a/plugins/vddk/nbdkit-vddk-plugin.pod
+++ b/plugins/vddk/nbdkit-vddk-plugin.pod
@@ -422,6 +422,10 @@ at runtime.
@ -31,7 +31,7 @@ index 6c50877e..5c356cc4 100644
Prints the full path to the VDDK shared library. Since this requires
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index 85b0c722..14e7ada9 100644
index 993f2d76..d74a484d 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -81,6 +81,7 @@ NBDKIT_DLL_PUBLIC int vddk_debug_stats;
@ -120,10 +120,10 @@ index 85b0c722..14e7ada9 100644
#if defined(HAVE_DLADDR)
/* It would be nice to print the version of VDDK from the shared
diff --git a/tests/test-vddk-real-dump-plugin.sh b/tests/test-vddk-real-dump-plugin.sh
index 1479e416..59c79693 100755
index 2cb7724e..0a079c6c 100755
--- a/tests/test-vddk-real-dump-plugin.sh
+++ b/tests/test-vddk-real-dump-plugin.sh
@@ -51,10 +51,12 @@ rm -f $files
@@ -58,10 +58,12 @@ rm -f $files
cleanup_fn rm -f $files
nbdkit -f -v vddk libdir="$vddkdir" --dump-plugin > $out

View File

@ -1,4 +1,4 @@
From b4a6854a45eed920ed6631c8c38e979b95a52470 Mon Sep 17 00:00:00 2001
From 3288201c18294bd526f646acded4b2b8333a0a82 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 23 Oct 2021 16:24:27 +0100
Subject: [PATCH] vddk: Add logical and physical sector size to -D
@ -17,10 +17,10 @@ before.
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index 14e7ada9..290a99a8 100644
index d74a484d..50bdde26 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -823,6 +823,12 @@ vddk_get_size (void *handle)
@@ -822,6 +822,12 @@ vddk_get_size (void *handle)
info->parentFileNameHint ? : "NULL");
nbdkit_debug ("disk info: uuid: %s",
info->uuid ? : "NULL");
@ -34,10 +34,10 @@ index 14e7ada9..290a99a8 100644
VDDK_CALL_START (VixDiskLib_FreeInfo, "info")
diff --git a/tests/test-vddk-real.sh b/tests/test-vddk-real.sh
index 08f6f8d8..b5f85067 100755
index a6aceac9..ae965245 100755
--- a/tests/test-vddk-real.sh
+++ b/tests/test-vddk-real.sh
@@ -82,7 +82,8 @@ if grep 'cannot open shared object file' test-vddk-real.log; then
@@ -89,7 +89,8 @@ if grep 'cannot open shared object file' $log; then
fi
# Now run nbdkit for the test.

View File

@ -1,4 +1,4 @@
From a11757f193bc86f74cb67b52b727bd9b762bf573 Mon Sep 17 00:00:00 2001
From 39a97a678ec1a900681c93743f37b930ea002cc9 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 23 Oct 2021 19:41:07 +0100
Subject: [PATCH] vddk: Fix typo in debug message
@ -10,10 +10,10 @@ Fixes: commit 5bb8f0586e1faabcbf4f43d722a3b3cb5b352e33
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index 290a99a8..e206a47f 100644
index 50bdde26..65399a91 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -824,7 +824,7 @@ vddk_get_size (void *handle)
@@ -823,7 +823,7 @@ vddk_get_size (void *handle)
nbdkit_debug ("disk info: uuid: %s",
info->uuid ? : "NULL");
if (library_version >= 7) {

View File

@ -1,4 +1,4 @@
From 574d356f6c55b8f0873586a20b07f7a898e955b0 Mon Sep 17 00:00:00 2001
From 99d0b4cc090efe3af47b14fdb089929af1ed09bf Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 23 Oct 2021 19:50:52 +0100
Subject: [PATCH] vddk: Only print vddk_library_version when we managed to load
@ -19,7 +19,7 @@ Fixes: commit 8700649d147948897f3b97810a1dff37924bdd6e
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/plugins/vddk/nbdkit-vddk-plugin.pod b/plugins/vddk/nbdkit-vddk-plugin.pod
index 5c356cc4..a5534f2e 100644
index bc3c3c94..49e3d75d 100644
--- a/plugins/vddk/nbdkit-vddk-plugin.pod
+++ b/plugins/vddk/nbdkit-vddk-plugin.pod
@@ -425,6 +425,7 @@ by this build.
@ -31,7 +31,7 @@ index 5c356cc4..a5534f2e 100644
=item C<vddk_dll=...>
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index e206a47f..e54eb9a8 100644
index 65399a91..39a7d261 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -591,7 +591,14 @@ vddk_dump_plugin (void)

View File

@ -1,4 +1,4 @@
From bb1c6bc5db8169498e05adce22b01ac51eaaae47 Mon Sep 17 00:00:00 2001
From 157ccfc0445eaa8cae99555d8ad31ba3cdf8c4bf Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 25 Oct 2021 08:36:53 +0100
Subject: [PATCH] vddk: Print one line in --dump-plugin output for each VDDK
@ -15,7 +15,7 @@ as flush and extents.
3 files changed, 20 insertions(+)
diff --git a/plugins/vddk/nbdkit-vddk-plugin.pod b/plugins/vddk/nbdkit-vddk-plugin.pod
index a5534f2e..fd8950c2 100644
index 49e3d75d..0702aa75 100644
--- a/plugins/vddk/nbdkit-vddk-plugin.pod
+++ b/plugins/vddk/nbdkit-vddk-plugin.pod
@@ -432,6 +432,15 @@ If this is omitted it means the library could not be loaded.
@ -35,7 +35,7 @@ index a5534f2e..fd8950c2 100644
=head1 NOTES
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index e54eb9a8..8955bc51 100644
index 39a7d261..096b04bf 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -616,6 +616,16 @@ vddk_dump_plugin (void)
@ -56,10 +56,10 @@ index e54eb9a8..8955bc51 100644
/* The rules on threads and VDDK are here:
diff --git a/tests/test-vddk-real-dump-plugin.sh b/tests/test-vddk-real-dump-plugin.sh
index 59c79693..92e1f3d2 100755
index 0a079c6c..e37c8b54 100755
--- a/tests/test-vddk-real-dump-plugin.sh
+++ b/tests/test-vddk-real-dump-plugin.sh
@@ -58,6 +58,7 @@ grep ^vddk_default_libdir= $out
@@ -65,6 +65,7 @@ grep ^vddk_default_libdir= $out
grep ^vddk_has_nfchostport= $out
grep ^vddk_library_version= $out
grep ^vddk_dll= $out

View File

@ -1,4 +1,4 @@
From a50111258e315abe3f8f2bf89cb72a1d6711f454 Mon Sep 17 00:00:00 2001
From cf4a8fe83b9f232a16631c157edb1b560ee893a1 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 26 Oct 2021 19:46:32 +0100
Subject: [PATCH] vddk: Move minimum version to VDDK 6.5
@ -63,7 +63,7 @@ index 5e70238d..a94df9cd 100644
STUB (VixDiskLib_InitEx,
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index c506b5a1..bf12c3c9 100644
index 096b04bf..babffc28 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -75,13 +75,13 @@ NBDKIT_DLL_PUBLIC int vddk_debug_stats;

View File

@ -1,4 +1,4 @@
From cf60f0e3a2f6fb8efe79ec41ca284050990b4d79 Mon Sep 17 00:00:00 2001
From 96d09a3a3d5306891300eb4b07af7bb605d4515c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 27 Oct 2021 11:57:35 +0100
Subject: [PATCH] vddk: Add read, write and wait asynchronous functions

View File

@ -1,4 +1,4 @@
From da7c163452d2a1f073a6d5c6d4d6fda824aa9a6f Mon Sep 17 00:00:00 2001
From 11b89043e0f1875b3ce912fe85d79fe61f3e6386 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 27 Oct 2021 12:20:31 +0100
Subject: [PATCH] vddk: Start to split VDDK over several files
@ -15,7 +15,7 @@ Acked-by: Laszlo Ersek <lersek@redhat.com>
2 files changed, 112 insertions(+), 68 deletions(-)
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index bf12c3c9..0167aa2f 100644
index babffc28..041bff1a 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -50,14 +50,12 @@

View File

@ -1,4 +1,4 @@
From 837407bebdf1d746e047d3664156d2ad09784e31 Mon Sep 17 00:00:00 2001
From 10a6d7b4a1552862d6a68dd4a0d8a55f6938c8b5 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 27 Oct 2021 12:30:41 +0100
Subject: [PATCH] vddk: Refactor -D vddk.stats=1 into a new file
@ -150,7 +150,7 @@ index 00000000..18a42714
+ statlist_reset (&stats);
+}
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index 0167aa2f..c05dbfcc 100644
index 041bff1a..67ac775c 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -61,7 +61,6 @@

View File

@ -1,4 +1,4 @@
From 43e4f0cba34e2b96579339c2c0293c085a591877 Mon Sep 17 00:00:00 2001
From bec712790d982f4e33a2e68157eef47372435f38 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 27 Oct 2021 10:17:22 +0100
Subject: [PATCH] vddk: Implement parallel thread model
@ -83,7 +83,7 @@ index 1c16d096..ce82a734 100644
=item B<-D vddk.stats=1>
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index c05dbfcc..cd3c3134 100644
index 67ac775c..9f223db0 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -50,9 +50,6 @@

View File

@ -0,0 +1,57 @@
From 1baf75aa963bf3193ba62f9c8865cd0feeca1c82 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 29 Oct 2021 20:56:55 +0100
Subject: [PATCH] vddk: Assume that VixDiskLib_Flush is available
Since we now require and check that VDDK >= 6.5, we can assume that
VixDiskLib_Flush is always available.
(cherry picked from commit e3685e6f0d0b71ab24b96fe85430a3b75da58736)
---
plugins/vddk/vddk.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index 9f223db0..f967e2d9 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -378,6 +378,12 @@ load_library (bool load_error_is_fatal)
"See nbdkit-vddk-plugin(1) man page section \"SUPPORTED VERSIONS OF VDDK\".");
exit (EXIT_FAILURE);
}
+
+ /* Added in VDDK 6.0 so it must always be present. Since we are
+ * going to call this function unconditionally, fail early and hard
+ * if for some reason it's not present.
+ */
+ assert (VixDiskLib_Flush != NULL);
}
static int
@@ -725,18 +731,19 @@ vddk_get_size (void *handle)
return (int64_t) size;
}
+/* The Flush call was added in VDDK 6.0, since we support minimum 6.5
+ * we are always able to do FUA / flush.
+ */
static int
vddk_can_fua (void *handle)
{
- /* The Flush call was not available in VDDK < 6.0. */
- return VixDiskLib_Flush != NULL ? NBDKIT_FUA_NATIVE : NBDKIT_FUA_NONE;
+ return NBDKIT_FUA_NATIVE;
}
static int
vddk_can_flush (void *handle)
{
- /* The Flush call was not available in VDDK < 6.0. */
- return VixDiskLib_Flush != NULL;
+ return 1;
}
/* Read data from the file.
--
2.31.1

View File

@ -0,0 +1,186 @@
From 85f208d1641be515c21f8a3cded609cb1e5f8765 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 29 Oct 2021 21:02:54 +0100
Subject: [PATCH] vddk: Simplify detection of VDDK symbols and baseline 6.5
Make all symbols from VDDK 6.5 into required symbols and use a single
error message function if one of these is missing. The new error is:
nbdkit: error: required VDDK symbol "VixDiskLib_Wait" is
missing. VDDK version must be >= 6.5. See nbdkit-vddk-plugin(1) man
page section "SUPPORTED VERSIONS OF VDDK". Original dlopen error:
vmware-vix-disklib-distrib/lib64/libvixDiskLib.so.6: undefined
symbol: VixDiskLib_Wait
Remove the extra check and assert.
Be more consistent about #define OPTIONAL_STUB(fn,ret,args) STUB(fn,ret,args)
when we want the optional and required stubs to do the same thing.
(cherry picked from commit ec0d22e61881efa39a69d02ccb9e4ede8bf95e75)
---
plugins/vddk/stats.c | 2 +-
plugins/vddk/vddk-stubs.h | 45 ++++++++++++++++++---------------------
plugins/vddk/vddk.c | 36 ++++++++++++-------------------
plugins/vddk/vddk.h | 2 +-
4 files changed, 37 insertions(+), 48 deletions(-)
diff --git a/plugins/vddk/stats.c b/plugins/vddk/stats.c
index 18a42714..76e0c244 100644
--- a/plugins/vddk/stats.c
+++ b/plugins/vddk/stats.c
@@ -89,7 +89,7 @@ display_stats (void)
if (!vddk_debug_stats) return;
#define STUB(fn,ret,args) statlist_append (&stats, stats_##fn)
-#define OPTIONAL_STUB(fn,ret,args) statlist_append (&stats, stats_##fn)
+#define OPTIONAL_STUB(fn,ret,args) STUB(fn,ret,args)
#include "vddk-stubs.h"
#undef STUB
#undef OPTIONAL_STUB
diff --git a/plugins/vddk/vddk-stubs.h b/plugins/vddk/vddk-stubs.h
index 66353691..7d8644c3 100644
--- a/plugins/vddk/vddk-stubs.h
+++ b/plugins/vddk/vddk-stubs.h
@@ -39,10 +39,7 @@
* function name, return value, arguments.
*/
-/* Required stubs, present in all versions of VDDK that we support. I
- * have checked that all these exist in at least VDDK 5.5.5 (2015).
- */
-
+/* Required stubs, present in all versions of VDDK since 6.5 (Nov 2016). */
STUB (VixDiskLib_InitEx,
VixError,
(uint32_t major, uint32_t minor,
@@ -103,27 +100,27 @@ STUB (VixDiskLib_Write,
uint64_t start_sector, uint64_t nr_sectors,
const unsigned char *buf));
-/* Added in VDDK 6.0, these will be NULL in earlier versions. */
-OPTIONAL_STUB (VixDiskLib_Flush,
- VixError,
- (VixDiskLibHandle handle));
-OPTIONAL_STUB (VixDiskLib_ReadAsync,
- VixError,
- (VixDiskLibHandle handle,
- uint64_t start_sector, uint64_t nr_sectors,
- unsigned char *buf,
- VixDiskLibCompletionCB callback, void *data));
-OPTIONAL_STUB (VixDiskLib_WriteAsync,
- VixError,
- (VixDiskLibHandle handle,
- uint64_t start_sector, uint64_t nr_sectors,
- const unsigned char *buf,
- VixDiskLibCompletionCB callback, void *data));
+/* Added in VDDK 6.0. */
+STUB (VixDiskLib_Flush,
+ VixError,
+ (VixDiskLibHandle handle));
+STUB (VixDiskLib_ReadAsync,
+ VixError,
+ (VixDiskLibHandle handle,
+ uint64_t start_sector, uint64_t nr_sectors,
+ unsigned char *buf,
+ VixDiskLibCompletionCB callback, void *data));
+STUB (VixDiskLib_WriteAsync,
+ VixError,
+ (VixDiskLibHandle handle,
+ uint64_t start_sector, uint64_t nr_sectors,
+ const unsigned char *buf,
+ VixDiskLibCompletionCB callback, void *data));
-/* Added in VDDK 6.5, this will be NULL in earlier versions. */
-OPTIONAL_STUB (VixDiskLib_Wait,
- VixError,
- (VixDiskLibHandle handle));
+/* Added in VDDK 6.5. */
+STUB (VixDiskLib_Wait,
+ VixError,
+ (VixDiskLibHandle handle));
/* Added in VDDK 6.7, these will be NULL for earlier versions: */
OPTIONAL_STUB (VixDiskLib_QueryAllocatedBlocks,
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index f967e2d9..271b5ee0 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -63,7 +63,7 @@ NBDKIT_DLL_PUBLIC int vddk_debug_datapath = 1;
* initialized when the plugin is loaded (by vddk_get_ready).
*/
#define STUB(fn,ret,args) ret (*fn) args
-#define OPTIONAL_STUB(fn,ret,args) ret (*fn) args
+#define OPTIONAL_STUB(fn,ret,args) STUB(fn,ret,args)
#include "vddk-stubs.h"
#undef STUB
#undef OPTIONAL_STUB
@@ -282,6 +282,17 @@ vddk_config (const char *key, const char *value)
return 0;
}
+static void
+missing_required_symbol (const char *fn)
+{
+ nbdkit_error ("required VDDK symbol \"%s\" is missing. "
+ "VDDK version must be >= 6.5. "
+ "See nbdkit-vddk-plugin(1) man page section \"SUPPORTED VERSIONS OF VDDK\". "
+ "Original dlopen error: %s\n",
+ fn, dlerror ());
+ exit (EXIT_FAILURE);
+}
+
/* Load the VDDK library. */
static void
load_library (bool load_error_is_fatal)
@@ -358,32 +369,13 @@ load_library (bool load_error_is_fatal)
#define STUB(fn,ret,args) \
do { \
fn = dlsym (dl, #fn); \
- if (fn == NULL) { \
- nbdkit_error ("required VDDK symbol \"%s\" is missing: %s", \
- #fn, dlerror ()); \
- exit (EXIT_FAILURE); \
- } \
+ if (fn == NULL) \
+ missing_required_symbol (#fn); \
} while (0)
#define OPTIONAL_STUB(fn,ret,args) fn = dlsym (dl, #fn)
#include "vddk-stubs.h"
#undef STUB
#undef OPTIONAL_STUB
-
- /* Additionally, VDDK version must be >= 6.5. This was the first
- * version which introduced VixDiskLib_Wait symbol so we can check
- * for that.
- */
- if (VixDiskLib_Wait == NULL) {
- nbdkit_error ("VDDK version must be >= 6.5. "
- "See nbdkit-vddk-plugin(1) man page section \"SUPPORTED VERSIONS OF VDDK\".");
- exit (EXIT_FAILURE);
- }
-
- /* Added in VDDK 6.0 so it must always be present. Since we are
- * going to call this function unconditionally, fail early and hard
- * if for some reason it's not present.
- */
- assert (VixDiskLib_Flush != NULL);
}
static int
diff --git a/plugins/vddk/vddk.h b/plugins/vddk/vddk.h
index be0b3492..0e3dd79e 100644
--- a/plugins/vddk/vddk.h
+++ b/plugins/vddk/vddk.h
@@ -76,7 +76,7 @@ extern int vddk_debug_datapath;
extern int vddk_debug_stats;
#define STUB(fn,ret,args) extern ret (*fn) args
-#define OPTIONAL_STUB(fn,ret,args) extern ret (*fn) args
+#define OPTIONAL_STUB(fn,ret,args) STUB(fn,ret,args)
#include "vddk-stubs.h"
#undef STUB
#undef OPTIONAL_STUB
--
2.31.1

View File

@ -0,0 +1,40 @@
From be040472beb5a4d2aeac088ec8c9c4e654c37b0f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 30 Oct 2021 08:34:28 +0100
Subject: [PATCH] vddk: Remove some whitespace from a couple of functions
(cherry picked from commit 974dce2c2ef84fc096ee319f340054234a29df91)
---
plugins/vddk/vddk.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index 271b5ee0..184f1a9c 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -792,9 +792,7 @@ static int
vddk_flush (void *handle, uint32_t flags)
{
struct vddk_handle *h = handle;
- struct command flush_cmd = {
- .type = FLUSH,
- };
+ struct command flush_cmd = { .type = FLUSH };
return send_command_and_wait (h, &flush_cmd);
}
@@ -804,10 +802,7 @@ vddk_can_extents (void *handle)
{
struct vddk_handle *h = handle;
int ret;
- struct command can_extents_cmd = {
- .type = CAN_EXTENTS,
- .ptr = &ret,
- };
+ struct command can_extents_cmd = { .type = CAN_EXTENTS, .ptr = &ret };
if (send_command_and_wait (h, &can_extents_cmd) == -1)
return -1;
--
2.31.1

View File

@ -0,0 +1,338 @@
From 71d2609243de560f1e49e6e5d3ad1f638e198108 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 30 Oct 2021 08:27:39 +0100
Subject: [PATCH] vddk: Move config, debug/error and utility functions around
Move the functions so they are nearer to where they are used.
Introduce a utils.c file for utility functions.
This is just code rearrangement with no other effects.
(cherry picked from commit c59be086210a06688b9195e0b91f8603a668654a)
---
plugins/vddk/Makefile.am | 1 +
plugins/vddk/utils.c | 51 ++++++++++
plugins/vddk/vddk.c | 201 +++++++++++++++++++--------------------
plugins/vddk/vddk.h | 3 +
4 files changed, 151 insertions(+), 105 deletions(-)
create mode 100644 plugins/vddk/utils.c
diff --git a/plugins/vddk/Makefile.am b/plugins/vddk/Makefile.am
index f8382fc9..02113da0 100644
--- a/plugins/vddk/Makefile.am
+++ b/plugins/vddk/Makefile.am
@@ -47,6 +47,7 @@ nbdkit_vddk_plugin_la_SOURCES = \
vddk.h \
reexec.c \
stats.c \
+ utils.c \
vddk-structs.h \
vddk-stubs.h \
worker.c \
diff --git a/plugins/vddk/utils.c b/plugins/vddk/utils.c
new file mode 100644
index 00000000..f0c19950
--- /dev/null
+++ b/plugins/vddk/utils.c
@@ -0,0 +1,51 @@
+/* nbdkit
+ * Copyright (C) 2013-2021 Red Hat Inc.
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define NBDKIT_API_VERSION 2
+#include <nbdkit-plugin.h>
+
+#include "vddk.h"
+
+void
+trim (char *str)
+{
+ size_t len = strlen (str);
+
+ if (len > 0 && str[len-1] == '\n')
+ str[len-1] = '\0';
+}
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index 184f1a9c..31e5e23b 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -114,61 +114,6 @@ vddk_unload (void)
free (password);
}
-static void
-trim (char *str)
-{
- size_t len = strlen (str);
-
- if (len > 0 && str[len-1] == '\n')
- str[len-1] = '\0';
-}
-
-/* Turn log messages from the library into nbdkit_debug. */
-static void
-debug_function (const char *fs, va_list args)
-{
- CLEANUP_FREE char *str = NULL;
-
- if (vasprintf (&str, fs, args) == -1) {
- nbdkit_debug ("lost debug message: %s", fs);
- return;
- }
-
- trim (str);
-
- nbdkit_debug ("%s", str);
-}
-
-/* Turn error messages from the library into nbdkit_error. */
-static void
-error_function (const char *fs, va_list args)
-{
- CLEANUP_FREE char *str = NULL;
-
- /* If the thread-local error_suppression flag is non-zero then we
- * will suppress error messages from VDDK in this thread.
- */
- if (error_suppression) return;
-
- if (vasprintf (&str, fs, args) == -1) {
- nbdkit_error ("lost error message: %s", fs);
- return;
- }
-
- trim (str);
-
- /* VDDK 7 added a useless error message about their "phone home"
- * system called CEIP which only panics users. Demote it to a debug
- * statement. https://bugzilla.redhat.com/show_bug.cgi?id=1834267
- */
- if (strstr (str, "Get CEIP status failed") != NULL) {
- nbdkit_debug ("%s", str);
- return;
- }
-
- nbdkit_error ("%s", str);
-}
-
/* Configuration. */
static int
vddk_config (const char *key, const char *value)
@@ -282,6 +227,56 @@ vddk_config (const char *key, const char *value)
return 0;
}
+static int
+vddk_config_complete (void)
+{
+ if (filename == NULL) {
+ nbdkit_error ("you must supply the file=<FILENAME> parameter "
+ "after the plugin name on the command line");
+ return -1;
+ }
+
+ /* For remote connections, check all the parameters have been
+ * passed. Note that VDDK will segfault if parameters that it
+ * expects are NULL (and there's no real way to tell what parameters
+ * it is expecting). This implements the same test that the VDDK
+ * sample program does.
+ */
+ is_remote =
+ vmx_spec ||
+ server_name ||
+ username ||
+ password ||
+ cookie ||
+ thumb_print ||
+ port ||
+ nfc_host_port;
+
+ if (is_remote) {
+#define missing(test, param) \
+ if (test) { \
+ nbdkit_error ("remote connection requested, missing parameter: %s", \
+ param); \
+ return -1; \
+ }
+ missing (!server_name, "server");
+ missing (!username, "user");
+ missing (!password, "password");
+ missing (!vmx_spec, "vm");
+#undef missing
+ }
+
+ /* Restore original LD_LIBRARY_PATH after reexec. */
+ if (restore_ld_library_path () == -1)
+ return -1;
+
+ return 0;
+}
+
+#define vddk_config_help \
+ "[file=]<FILENAME> (required) The filename (eg. VMDK file) to serve.\n" \
+ "Many optional parameters are supported, see nbdkit-vddk-plugin(1)."
+
static void
missing_required_symbol (const char *fn)
{
@@ -378,56 +373,6 @@ load_library (bool load_error_is_fatal)
#undef OPTIONAL_STUB
}
-static int
-vddk_config_complete (void)
-{
- if (filename == NULL) {
- nbdkit_error ("you must supply the file=<FILENAME> parameter "
- "after the plugin name on the command line");
- return -1;
- }
-
- /* For remote connections, check all the parameters have been
- * passed. Note that VDDK will segfault if parameters that it
- * expects are NULL (and there's no real way to tell what parameters
- * it is expecting). This implements the same test that the VDDK
- * sample program does.
- */
- is_remote =
- vmx_spec ||
- server_name ||
- username ||
- password ||
- cookie ||
- thumb_print ||
- port ||
- nfc_host_port;
-
- if (is_remote) {
-#define missing(test, param) \
- if (test) { \
- nbdkit_error ("remote connection requested, missing parameter: %s", \
- param); \
- return -1; \
- }
- missing (!server_name, "server");
- missing (!username, "user");
- missing (!password, "password");
- missing (!vmx_spec, "vm");
-#undef missing
- }
-
- /* Restore original LD_LIBRARY_PATH after reexec. */
- if (restore_ld_library_path () == -1)
- return -1;
-
- return 0;
-}
-
-#define vddk_config_help \
- "[file=]<FILENAME> (required) The filename (eg. VMDK file) to serve.\n" \
- "Many optional parameters are supported, see nbdkit-vddk-plugin(1)."
-
static int
vddk_get_ready (void)
{
@@ -435,6 +380,52 @@ vddk_get_ready (void)
return 0;
}
+/* Turn log messages from the library into nbdkit_debug. */
+static void
+debug_function (const char *fs, va_list args)
+{
+ CLEANUP_FREE char *str = NULL;
+
+ if (vasprintf (&str, fs, args) == -1) {
+ nbdkit_debug ("lost debug message: %s", fs);
+ return;
+ }
+
+ trim (str);
+
+ nbdkit_debug ("%s", str);
+}
+
+/* Turn error messages from the library into nbdkit_error. */
+static void
+error_function (const char *fs, va_list args)
+{
+ CLEANUP_FREE char *str = NULL;
+
+ /* If the thread-local error_suppression flag is non-zero then we
+ * will suppress error messages from VDDK in this thread.
+ */
+ if (error_suppression) return;
+
+ if (vasprintf (&str, fs, args) == -1) {
+ nbdkit_error ("lost error message: %s", fs);
+ return;
+ }
+
+ trim (str);
+
+ /* VDDK 7 added a useless error message about their "phone home"
+ * system called CEIP which only panics users. Demote it to a debug
+ * statement. https://bugzilla.redhat.com/show_bug.cgi?id=1834267
+ */
+ if (strstr (str, "Get CEIP status failed") != NULL) {
+ nbdkit_debug ("%s", str);
+ return;
+ }
+
+ nbdkit_error ("%s", str);
+}
+
/* Defer VDDK initialization until after fork because it is known to
* create background threads from VixDiskLib_InitEx. Unfortunately
* error reporting from this callback is difficult, but we have
diff --git a/plugins/vddk/vddk.h b/plugins/vddk/vddk.h
index 0e3dd79e..d99b6f4b 100644
--- a/plugins/vddk/vddk.h
+++ b/plugins/vddk/vddk.h
@@ -183,6 +183,9 @@ extern pthread_mutex_t stats_lock;
#undef OPTIONAL_STUB
extern void display_stats (void);
+/* utils.c */
+extern void trim (char *str);
+
/* worker.c */
extern const char *command_type_string (enum command_type type);
extern int send_command_and_wait (struct vddk_handle *h, struct command *cmd);
--
2.31.1

View File

@ -51,7 +51,7 @@ ExclusiveArch: x86_64
Name: nbdkit
Version: 1.28.1
Release: 1%{?dist}
Release: 2%{?dist}
Summary: NBD server
License: BSD
@ -76,23 +76,32 @@ Source3: copy-patches.sh
# https://gitlab.com/nbdkit/nbdkit/-/commits/rhel-9.0/
# Patches.
Patch0001: 0001-vddk-Refactor-how-D-vddk.stats-1-is-collected.patch
Patch0002: 0002-vddk-Extend-D-vddk.stats-1-to-show-number-of-calls-a.patch
Patch0003: 0003-vddk-Simplify-and-consolidate-VDDK_CALL_START-END-ma.patch
Patch0004: 0004-vddk-Document-troubleshooting-performance-problems.patch
Patch0005: 0005-vddk-Include-VDDK-major-library-version-in-dump-plug.patch
Patch0006: 0006-vddk-Add-logical-and-physical-sector-size-to-D-vddk..patch
Patch0007: 0007-vddk-Fix-typo-in-debug-message.patch
Patch0008: 0008-vddk-Only-print-vddk_library_version-when-we-managed.patch
Patch0009: 0009-vddk-Print-one-line-in-dump-plugin-output-for-each-V.patch
Patch0010: 0010-vddk-Update-comment-about-VixDiskLib_PrepareForAcces.patch
Patch0011: 0011-vddk-Document-what-I-found-about-VixDiskLib_Flush.patch
Patch0012: 0012-vddk-Note-that-we-have-tested-VDDK-7.0.3.patch
Patch0013: 0013-vddk-Move-minimum-version-to-VDDK-6.5.patch
Patch0014: 0014-vddk-Add-read-write-and-wait-asynchronous-functions.patch
Patch0015: 0015-vddk-Start-to-split-VDDK-over-several-files.patch
Patch0016: 0016-vddk-Refactor-D-vddk.stats-1-into-a-new-file.patch
Patch0017: 0017-vddk-Implement-parallel-thread-model.patch
Patch0001: 0001-Skip-vsock-related-checks-if-AF_VSOCK-is-not-support.patch
Patch0002: 0002-vddk-Update-comment-about-VixDiskLib_PrepareForAcces.patch
Patch0003: 0003-vddk-Document-what-I-found-about-VixDiskLib_Flush.patch
Patch0004: 0004-vddk-Note-that-we-have-tested-VDDK-7.0.3.patch
Patch0005: 0005-tests-vddk-Cannot-test-real-VDDK-under-valgrind.patch
Patch0006: 0006-tests-test-vddk-real.sh-Don-t-hide-log-messages-on-f.patch
Patch0007: 0007-vddk-Small-copyedits-to-README.VDDK.patch
Patch0008: 0008-vddk-Fix-man-page-section-in-help-output.patch
Patch0009: 0009-vddk-Refactor-how-D-vddk.stats-1-is-collected.patch
Patch0010: 0010-vddk-Extend-D-vddk.stats-1-to-show-number-of-calls-a.patch
Patch0011: 0011-vddk-Simplify-and-consolidate-VDDK_CALL_START-END-ma.patch
Patch0012: 0012-vddk-Document-troubleshooting-performance-problems.patch
Patch0013: 0013-vddk-Include-VDDK-major-library-version-in-dump-plug.patch
Patch0014: 0014-vddk-Add-logical-and-physical-sector-size-to-D-vddk..patch
Patch0015: 0015-vddk-Fix-typo-in-debug-message.patch
Patch0016: 0016-vddk-Only-print-vddk_library_version-when-we-managed.patch
Patch0017: 0017-vddk-Print-one-line-in-dump-plugin-output-for-each-V.patch
Patch0018: 0018-vddk-Move-minimum-version-to-VDDK-6.5.patch
Patch0019: 0019-vddk-Add-read-write-and-wait-asynchronous-functions.patch
Patch0020: 0020-vddk-Start-to-split-VDDK-over-several-files.patch
Patch0021: 0021-vddk-Refactor-D-vddk.stats-1-into-a-new-file.patch
Patch0022: 0022-vddk-Implement-parallel-thread-model.patch
Patch0023: 0023-vddk-Assume-that-VixDiskLib_Flush-is-available.patch
Patch0024: 0024-vddk-Simplify-detection-of-VDDK-symbols-and-baseline.patch
Patch0025: 0025-vddk-Remove-some-whitespace-from-a-couple-of-functio.patch
Patch0026: 0026-vddk-Move-config-debug-error-and-utility-functions-a.patch
BuildRequires: make
%if 0%{patches_touch_autotools}
@ -1116,7 +1125,7 @@ export LIBGUESTFS_TRACE=1
%ifarch x86_64
%files vddk-plugin
%doc README
%doc README plugins/vddk/README.VDDK
%license LICENSE
%{_libdir}/%{name}/plugins/nbdkit-vddk-plugin.so
%{_mandir}/man1/nbdkit-vddk-plugin.1*
@ -1263,11 +1272,9 @@ export LIBGUESTFS_TRACE=1
%changelog
* Fri Oct 29 2021 Richard W.M. Jones <rjones@redhat.com> - 1.28.1-1
* Sat Oct 30 2021 Richard W.M. Jones <rjones@redhat.com> - 1.28.1-2
- Add asynchronous support in nbdkit-vddk-plugin
resolves: rhbz#2018463, rhbz#2011709
* Fri Oct 08 2021 Richard W.M. Jones <rjones@redhat.com> - 1.28.0-1
resolves: rhbz#2018463
- Rebase to new stable branch version 1.28.0
resolves: rhbz#2011709