Blob Blame History Raw
From 4c80b474a2c2a552e5bdfcaabfa2981540afe8d8 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
 vddk.diskinfo output

In VDDK >= 7 it is possible to display the logical and physical sector
size in debug output.

This commit also extends the test since this flag was not tested
before.

(cherry picked from commit 5bb8f0586e1faabcbf4f43d722a3b3cb5b352e33)
---
 plugins/vddk/vddk.c     | 6 ++++++
 tests/test-vddk-real.sh | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index d74a484d..50bdde26 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -822,6 +822,12 @@ vddk_get_size (void *handle)
                   info->parentFileNameHint ? : "NULL");
     nbdkit_debug ("disk info: uuid: %s",
                   info->uuid ? : "NULL");
+    if (library_version >= 7) {
+      nbdkit_debug ("disk info: sectory size: "
+                    "logical %" PRIu32 " physical %" PRIu32,
+                    info->logicalSectorSize,
+                    info->physicalSectorSize);
+    }
   }
 
   VDDK_CALL_START (VixDiskLib_FreeInfo, "info")
diff --git a/tests/test-vddk-real.sh b/tests/test-vddk-real.sh
index a6aceac9..ae965245 100755
--- a/tests/test-vddk-real.sh
+++ b/tests/test-vddk-real.sh
@@ -89,7 +89,8 @@ if grep 'cannot open shared object file' $log; then
 fi
 
 # Now run nbdkit for the test.
-start_nbdkit -P $pid -U $sock -D vddk.stats=1 vddk libdir="$vddkdir" $vmdk
+start_nbdkit -P $pid -U $sock -D vddk.stats=1 -D vddk.diskinfo=1 \
+             vddk libdir="$vddkdir" $vmdk
 uri="nbd+unix:///?socket=$sock"
 
 # VDDK < 6.0 did not support flush, so disable flush test there.  Also
-- 
2.31.1