import nbdkit-1.28.5-1.el9

This commit is contained in:
CentOS Sources 2022-03-01 06:12:06 -05:00 committed by Stepan Oksanichenko
parent 5bc64aec06
commit 12379ee01a
40 changed files with 1015 additions and 55 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
SOURCES/libguestfs.keyring
SOURCES/nbdkit-1.28.4.tar.gz
SOURCES/nbdkit-1.28.5.tar.gz

View File

@ -1,2 +1,2 @@
cc1b37b9cfafa515aab3eefd345ecc59aac2ce7b SOURCES/libguestfs.keyring
fe835102a83e76babc7050b6551beabc2f7fb226 SOURCES/nbdkit-1.28.4.tar.gz
60f2c2021658a94d778eb9cde0123d1c092ff15d SOURCES/nbdkit-1.28.5.tar.gz

View File

@ -1,4 +1,4 @@
From 1d9a1341c6d9b0f2150a37ec3617eeee01bbfee2 Mon Sep 17 00:00:00 2001
From 4f2f557b349ad621e502e304c87280835cf13146 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

View File

@ -1,4 +1,4 @@
From 3c72e2d273fd446905086c6611ca11bd7dace149 Mon Sep 17 00:00:00 2001
From edfdfff0dae54a41bbfca30fa60f4fa6438d45b9 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

View File

@ -1,4 +1,4 @@
From a87b9b1ecd0b98ffb9e04d7de525952962875ec2 Mon Sep 17 00:00:00 2001
From cbcf2a2f158a9889bd597b31159ab357dea05cd6 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

View File

@ -1,4 +1,4 @@
From ae618b75f2b158b4563ab94371b01b2951b1bfec Mon Sep 17 00:00:00 2001
From 8353ab55b8c6e7f1dc9ea27260fd7ec90b9d75af 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

View File

@ -1,4 +1,4 @@
From 01f3fb69c8cdb730b74c36d0e5909adc7c50b35e Mon Sep 17 00:00:00 2001
From d994773724266dd5f0a8b4282cc604f6b75e077c 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

View File

@ -1,4 +1,4 @@
From 8b62059a60444f2e85b0cdfc34cbe7e123796fc8 Mon Sep 17 00:00:00 2001
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

View File

@ -1,4 +1,4 @@
From a7e524ffec7c144d45838f4c2e9e311c0a0f4d01 Mon Sep 17 00:00:00 2001
From 4b0d278f3851baf37affa26d34e52963dc8c7c04 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

View File

@ -1,4 +1,4 @@
From 4c451e9e8f0916c319f6a89ef5ecbb0536cb36c0 Mon Sep 17 00:00:00 2001
From 670c1ddb6591046256511a680605c5e2349746e8 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

View File

@ -1,4 +1,4 @@
From 11bb4d037a9a14537cde30cef4e6a17cec2d47b8 Mon Sep 17 00:00:00 2001
From 21d6c2f8f29f0d7f98852b72ee33751814be49fe 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

View File

@ -1,4 +1,4 @@
From 498b4210c1f1a4b4d6cdc09ae354b86522e1d536 Mon Sep 17 00:00:00 2001
From f4379f04ea27e25c00e98db2e60d0fdb647442e9 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

View File

@ -1,4 +1,4 @@
From b6e9c0ad8d498d5f50ca0aa4f05530709349adea Mon Sep 17 00:00:00 2001
From 90dc3311582784f8b078a30a7207c15c6298b1e2 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 6d720b2ca5a63fa6782b2b4a2183d336269cc98e Mon Sep 17 00:00:00 2001
From c9e432e08e889d9e6edea52344b2452f0141f56b 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

View File

@ -1,4 +1,4 @@
From 78acd88165f3dfc5eb05c2204b270a01ed15e8a6 Mon Sep 17 00:00:00 2001
From 66945d24e9192a67af421eecbb1835d42636ab93 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

View File

@ -1,4 +1,4 @@
From 13223e8e3219d0310ce4d94093bbdb7732a891fb Mon Sep 17 00:00:00 2001
From 11a40792fde602861b987dc5a2c91a0539abfe78 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

View File

@ -1,4 +1,4 @@
From 6a61ddd5a57e75fd1c76d3e61d746964d925b608 Mon Sep 17 00:00:00 2001
From c91ac233f6474b07ef181a08093c5d0f2f4ec4c3 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

View File

@ -1,4 +1,4 @@
From fd3632aaa6528d1164f729442bd2f104d18bb941 Mon Sep 17 00:00:00 2001
From 984e95fcbdb19c2495851322a4c33f34291ecfab 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

View File

@ -1,4 +1,4 @@
From 7ae399e41e20b7684f475d67311f4ed02039374a Mon Sep 17 00:00:00 2001
From 342efed6bb9f8f0c8d2cb4aa2b09da64ed2e7ed4 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

View File

@ -1,4 +1,4 @@
From acf05e6d431c29ac8adc56a2680771c5051edb09 Mon Sep 17 00:00:00 2001
From edbded52b144ce3c8c45c7ef352f8969a1f5d1bb 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

View File

@ -1,4 +1,4 @@
From 0106334335271ad35e1be041492f2e9795a97a60 Mon Sep 17 00:00:00 2001
From 239df6ee9583bc520e9a3e18f0c0d8e58602fb5c Mon Sep 17 00:00:00 2001
From: Nir Soffer <nsoffer@redhat.com>
Date: Fri, 5 Nov 2021 20:36:42 +0200
Subject: [PATCH] common/utils/test-vector.c: Add vector benchmarks

View File

@ -1,4 +1,4 @@
From 58f10b380d63b061b71ad0b3e8462e9ef7f1d49a Mon Sep 17 00:00:00 2001
From e544d86c797edec613673c7272f8d4f8b05d87f8 Mon Sep 17 00:00:00 2001
From: Nir Soffer <nsoffer@redhat.com>
Date: Fri, 5 Nov 2021 22:16:26 +0200
Subject: [PATCH] common/urils/vector.c: Optimize vector append

View File

@ -1,4 +1,4 @@
From a3e28d8cfa2d3252ec6bd348b2f15fd9e0c81329 Mon Sep 17 00:00:00 2001
From 24e2694b302f6602e0fc7808a53a766cb983dfb4 Mon Sep 17 00:00:00 2001
From: Nir Soffer <nsoffer@redhat.com>
Date: Fri, 5 Nov 2021 22:59:38 +0200
Subject: [PATCH] common/utils/vector: Rename `alloc` to `cap`

View File

@ -1,4 +1,4 @@
From e06b90e7609a1f107d4e21467e84a300666e2d91 Mon Sep 17 00:00:00 2001
From 1674e453d5652018c989059ea19eb79bed7e12c8 Mon Sep 17 00:00:00 2001
From: Nir Soffer <nsoffer@redhat.com>
Date: Sat, 6 Nov 2021 00:03:11 +0200
Subject: [PATCH] common/utils/vector: Rename `size` to `len`
@ -1688,7 +1688,7 @@ index 5fd8308f..225258de 100644
write_pidfile ();
top->after_fork (top);
diff --git a/server/sockets.c b/server/sockets.c
index 95fce484..f13f8600 100644
index 18b68f0a..15a26f69 100644
--- a/server/sockets.c
+++ b/server/sockets.c
@@ -246,14 +246,14 @@ bind_tcpip_socket (sockets *socks)

View File

@ -1,4 +1,4 @@
From 4e49f3c9c122458f318d94dfe0549cabdf24aede Mon Sep 17 00:00:00 2001
From 2df98ef35c3b023a44983583f65379793599e57f Mon Sep 17 00:00:00 2001
From: Nir Soffer <nsoffer@redhat.com>
Date: Mon, 8 Nov 2021 19:47:57 +0200
Subject: [PATCH] podwrapper.pl.in: Use short commit date

View File

@ -1,4 +1,4 @@
From ca7dbd9c37b3b80ee33e3dae7a29c122f5b5d2ff Mon Sep 17 00:00:00 2001
From e9f77e9da946c963e4ec5d82dfd144305f79ebb5 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 9 Nov 2021 09:07:42 +0000
Subject: [PATCH] ocaml: Replace "noalloc" with [@@noalloc] annotation

View File

@ -1,4 +1,4 @@
From a18e18b3a50476a5364b32dd62d162a641fd0fd8 Mon Sep 17 00:00:00 2001
From 5da14da22c1e26aff24baf41fb2ae0f2832acae1 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 27 Nov 2021 16:44:41 +0000
Subject: [PATCH] vddk: Drop obsolete documentation related to thread model

View File

@ -1,4 +1,4 @@
From 9678df33ecb45f7943acf3e485efed061ea4b856 Mon Sep 17 00:00:00 2001
From b986f25be4f013eb02cd327826fa225c8202571e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 20 Nov 2021 17:50:25 +0000
Subject: [PATCH] Revert "podwrapper.pl.in: Use short commit date"

View File

@ -1,4 +1,4 @@
From 38948544e6e12091506b658ab10ff1b0a5bf36b5 Mon Sep 17 00:00:00 2001
From 0c430f02eec2671155c001c8a1d2f964b42022e5 Mon Sep 17 00:00:00 2001
From: Eric Blake <eblake@redhat.com>
Date: Tue, 30 Nov 2021 12:42:01 -0600
Subject: [PATCH] Fix "podwrapper.pl.in: Use short commit date"

View File

@ -1,4 +1,4 @@
From f8d649063edb9744c98aca17c6c82e5fce0a4be7 Mon Sep 17 00:00:00 2001
From e00a8f2709fdf238daa195da03d8ea2aec9b05e1 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 30 Nov 2021 17:56:02 +0000
Subject: [PATCH] scripts: Add simple script for automating VDDK disk
@ -42,7 +42,7 @@ index 49f5d91c..6df5eba0 100644
if !ENABLE_LIBFUZZER
# NB: This is not the real nbdkit binary. It's a wrapper that allows
diff --git a/configure.ac b/configure.ac
index 263714f0..60e7cce2 100644
index 1b737fc1..08c307e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1249,6 +1249,8 @@ dnl Produce output files.

View File

@ -1,4 +1,4 @@
From aaead0f62b190f0686f86d825c698f9cd3e803c6 Mon Sep 17 00:00:00 2001
From 5cb4adb94a6ff4325205fea3512c037c91579263 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 7 Dec 2021 21:08:26 +0000
Subject: [PATCH] file: Fix implementation of cache=none for writes

View File

@ -0,0 +1,95 @@
From 92773e6852719354a136d31519948436f9adf7e9 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 18 Dec 2021 20:31:10 +0000
Subject: [PATCH] tests: Add configure --disable-libguestfs-tests flag
This can be used to disable tests which need libguestfs*. We were
already doing that in a hackish way in the Fedora build on some
architectures. This makes it more supportable.
Note that you can use
./configure --enable-libguestfs --disable-libguestfs-tests
to enable the bindings but disable the tests.
The difference between without and with the new flag on an otherwise
fully configured Fedora machine:
# TOTAL: 286
# PASS: 273
# SKIP: 13
# TOTAL: 263
# PASS: 251
# SKIP: 12
* except for those which directly test for requirements using
expressions like:
requires guestfish --version
(cherry picked from commit c09ae98ff3b4b786565de4aa173274531a753d30)
---
configure.ac | 17 ++++++++++++++++-
tests/Makefile.am | 2 ++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 08c307e9..96d738d9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1146,7 +1146,8 @@ AS_IF([test "$with_libzstd" != "no"],[
])
AM_CONDITIONAL([HAVE_LIBZSTD],[test "x$LIBZSTD_LIBS" != "x"])
-dnl Check for libguestfs (only for the guestfs plugin and the test suite).
+dnl Check for libguestfs (only for the guestfs plugin and parts of
+dnl the test suite).
AC_ARG_WITH([libguestfs],
[AS_HELP_STRING([--without-libguestfs],
[disable guestfs plugin and tests @<:@default=check@:>@])],
@@ -1173,6 +1174,17 @@ AS_IF([test "$with_libguestfs" != "no"],[
])
AM_CONDITIONAL([HAVE_LIBGUESTFS],[test "x$LIBGUESTFS_LIBS" != "x"])
+dnl Disable tests which need libguestfs.
+AC_ARG_ENABLE([libguestfs-tests],
+ [AS_HELP_STRING([--disable-libguestfs-tests],
+ [disable tests which need libguestfs])],
+ [],
+ [enable_libguestfs_tests=check]
+)
+AM_CONDITIONAL([USE_LIBGUESTFS_FOR_TESTS],
+ [test "x$LIBGUESTFS_LIBS" != "x" && \
+ test "x$enable_libguestfs_tests" != "xno"])
+
dnl Check for ext2fs and com_err, for the ext2 filter.
AC_ARG_WITH([ext2],
[AS_HELP_STRING([--without-ext2],
@@ -1447,6 +1459,9 @@ echo "Other optional features:"
echo
feature "allocator=zstd ......................... " \
test "x$HAVE_LIBZSTD_TRUE" = "x"
+feature "tests using libguestfs ................. " \
+ test "x$HAVE_LIBGUESTFS_TRUE" = "x" -a \
+ "x$USE_LIBGUESTFS_FOR_TESTS_TRUE" = "x"
echo
echo "If any optional component is configured no when you expected yes"
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2b7ae9f3..43b60943 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1888,6 +1888,8 @@ TESTS += $(LIBNBD_TESTS)
endif HAVE_LIBNBD
if HAVE_LIBGUESTFS
+if USE_LIBGUESTFS_FOR_TESTS
check_PROGRAMS += $(LIBGUESTFS_TESTS)
TESTS += $(LIBGUESTFS_TESTS)
+endif USE_LIBGUESTFS_FOR_TESTS
endif HAVE_LIBGUESTFS
--
2.31.1

View File

@ -0,0 +1,538 @@
From cf58241f19ed179e48c53f4d6c71df47dd2f5931 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 18 Jan 2022 08:58:15 +0000
Subject: [PATCH] vddk: Implement VMDK creation
Add the create=(true|false) parameter. Setting this to true causes
the VMDK local file to be created. Currently this is done on first
connection, but we might change that in future. Various other
parameters can be used to control aspects of the VMDK file.
(cherry picked from commit a39d5773afc3ebab7e5768118a2bccb89a654585)
---
plugins/vddk/nbdkit-vddk-plugin.pod | 102 ++++++++++++++++++++++-
plugins/vddk/vddk-structs.h | 32 +++++++
plugins/vddk/vddk-stubs.h | 7 ++
plugins/vddk/vddk.c | 125 ++++++++++++++++++++++++++++
plugins/vddk/vddk.h | 5 ++
tests/Makefile.am | 6 +-
tests/dummy-vddk.c | 10 +++
tests/test-vddk-real-create.sh | 70 ++++++++++++++++
8 files changed, 354 insertions(+), 3 deletions(-)
create mode 100755 tests/test-vddk-real-create.sh
diff --git a/plugins/vddk/nbdkit-vddk-plugin.pod b/plugins/vddk/nbdkit-vddk-plugin.pod
index acec0bd2..b96192d0 100644
--- a/plugins/vddk/nbdkit-vddk-plugin.pod
+++ b/plugins/vddk/nbdkit-vddk-plugin.pod
@@ -6,7 +6,11 @@ nbdkit-vddk-plugin - nbdkit VMware VDDK plugin
nbdkit vddk [file=]FILENAME
[compression=none|zlib|fastlz|skipz]
- [config=FILENAME] [cookie=COOKIE] [libdir=LIBRARY]
+ [config=FILENAME] [cookie=COOKIE]
+ [create=true] [create-adapter-type=ide|scsi-buslogic|...]
+ [create-hwversion=workstation4|workstation5|...]
+ [create-size=...] [create-type=monolithic-sparse|...]
+ [libdir=LIBRARY]
[nfchostport=PORT] [single-link=true]
[password=PASSWORD | password=- | password=+FILENAME |
password=-FD]
@@ -26,7 +30,7 @@ yourself (see L</LIBRARY LOCATION> below).
=head1 EXAMPLES
-=head2 Open a local VMDK file
+=head2 Open an existing local VMDK file
nbdkit vddk /absolute/path/to/file.vmdk
@@ -38,6 +42,18 @@ I<-r> option):
nbdkit -r vddk /absolute/path/to/file.vmdk
+=head2 Create a new local VMDK file
+
+You can use VDDK to create a VMDK file and fill it with the contents
+of a disk image. Note the C<create-size> parameter is the virtual
+size of the final VMDK disk image and must be at least as large as the
+input disk:
+
+ nbdkit -U - vddk \
+ /absolute/path/to/output.vmdk \
+ create=1 create-size=100M \
+ --run 'qemu-img convert input.qcow2 $uri'
+
=head2 Open a file on a remote VMware ESXi hypervisor
Connect directly to a VMware ESXi hypervisor and export a particular
@@ -136,6 +152,88 @@ C<VIXDISKLIB_CRED_SESSIONID> which can improve performance. The
cookie can be found by connecting to a VCenter Server over HTTPS and
retrieving the C<vmware_soap_session> cookie.
+=item B<create=true>
+
+(nbdkit E<ge> 1.30)
+
+Create a new, local VMDK file. Instead of opening an existing VMDK
+file, a new VMDK file is created and opened. The filename is given by
+the C<file> parameter (see below). The file must not exist already.
+It is not possible to create a remote file using nbdkit.
+
+If this is used, the C<create-size> parameter is required to specify
+the virtual size of the disk. Other C<create-*> parameters (see
+below) can be used to control the VMDK sub-format.
+
+=item B<create-adapter-type=ide>
+
+=item B<create-adapter-type=scsi-buslogic>
+
+=item B<create-adapter-type=scsi-lsilogic>
+
+(nbdkit E<ge> 1.30)
+
+Specify the VMDK disk adapter type. The default is C<scsi-buslogic>.
+
+=item B<create-hwversion=workstation4>
+
+=item B<create-hwversion=workstation5>
+
+=item B<create-hwversion=workstation6>
+
+=item B<create-hwversion=esx30>
+
+=item B<create-hwversion=esx4x>
+
+=item B<create-hwversion=esx50>
+
+=item B<create-hwversion=esx51>
+
+=item B<create-hwversion=esx55>
+
+=item B<create-hwversion=esx60>
+
+=item B<create-hwversion=esx65>
+
+(nbdkit E<ge> 1.30)
+
+Specify the VMDK virtual hardware version. The default is
+C<workstation5>.
+
+=item B<create-size=>SIZE
+
+(nbdkit E<ge> 1.30)
+
+Specify the virtual size of the created disk. The C<SIZE> can use
+modifiers like C<100M> etc. It must be a multiple of 512 bytes
+because VMware only supports sector sizes.
+
+If you use C<create=true> then this parameter is required.
+
+=item B<create-type=monolithic-sparse>
+
+=item B<create-type=monolithic-flat>
+
+=item B<create-type=split-sparse>
+
+=item B<create-type=split-flat>
+
+=item B<create-type=vmfs-flat>
+
+=item B<create-type=stream-optimized>
+
+=item B<create-type=vmfs-thin>
+
+=item B<create-type=vmfs-sparse>
+
+(nbdkit E<ge> 1.30)
+
+Specify the VMDK sub-format. The default is C<monolithic-sparse>.
+
+Some VMDK sub-formats use multiple files, where the C<file> parameter
+specifies the "Disk Descriptor File" and the disk contents are stored
+in adjacent files.
+
=item [B<file=>]FILENAME
=item [B<file=>]B<[>datastoreB<] >vmname/vmnameB<.vmdk>
diff --git a/plugins/vddk/vddk-structs.h b/plugins/vddk/vddk-structs.h
index e97f017c..799c4aec 100644
--- a/plugins/vddk/vddk-structs.h
+++ b/plugins/vddk/vddk-structs.h
@@ -43,6 +43,7 @@
typedef uint64_t VixError;
#define VIX_OK 0
+#define VIX_E_NOT_SUPPORTED 6
#define VIX_ASYNC 25000
#define VIXDISKLIB_FLAG_OPEN_UNBUFFERED 1
@@ -54,6 +55,28 @@ typedef uint64_t VixError;
#define VIXDISKLIB_SECTOR_SIZE 512
+enum VixDiskLibDiskType {
+ VIXDISKLIB_DISK_MONOLITHIC_SPARSE = 1,
+ VIXDISKLIB_DISK_MONOLITHIC_FLAT = 2,
+ VIXDISKLIB_DISK_SPLIT_SPARSE = 3,
+ VIXDISKLIB_DISK_SPLIT_FLAT = 4,
+ VIXDISKLIB_DISK_VMFS_FLAT = 5,
+ VIXDISKLIB_DISK_STREAM_OPTIMIZED = 6,
+ VIXDISKLIB_DISK_VMFS_THIN = 7,
+ VIXDISKLIB_DISK_VMFS_SPARSE = 8
+};
+
+#define VIXDISKLIB_HWVERSION_WORKSTATION_4 3
+#define VIXDISKLIB_HWVERSION_WORKSTATION_5 4
+#define VIXDISKLIB_HWVERSION_WORKSTATION_6 6
+#define VIXDISKLIB_HWVERSION_ESX30 4
+#define VIXDISKLIB_HWVERSION_ESX4X 7
+#define VIXDISKLIB_HWVERSION_ESX50 8
+#define VIXDISKLIB_HWVERSION_ESX51 9
+#define VIXDISKLIB_HWVERSION_ESX55 10
+#define VIXDISKLIB_HWVERSION_ESX60 11
+#define VIXDISKLIB_HWVERSION_ESX65 13
+
#define VIXDISKLIB_MIN_CHUNK_SIZE 128
#define VIXDISKLIB_MAX_CHUNK_NUMBER (512*1024)
@@ -148,4 +171,13 @@ typedef struct {
VixDiskLibBlock blocks[1];
} VixDiskLibBlockList;
+typedef struct {
+ enum VixDiskLibDiskType diskType;
+ enum VixDiskLibAdapterType adapterType;
+ uint16_t hwVersion;
+ uint64_t capacity;
+ uint32_t logicalSectorSize;
+ uint32_t physicalSectorSize;
+} VixDiskLibCreateParams;
+
#endif /* NBDKIT_VDDK_STRUCTS_H */
diff --git a/plugins/vddk/vddk-stubs.h b/plugins/vddk/vddk-stubs.h
index 7d8644c3..d5affa10 100644
--- a/plugins/vddk/vddk-stubs.h
+++ b/plugins/vddk/vddk-stubs.h
@@ -99,6 +99,13 @@ STUB (VixDiskLib_Write,
(VixDiskLibHandle handle,
uint64_t start_sector, uint64_t nr_sectors,
const unsigned char *buf));
+STUB (VixDiskLib_Create,
+ VixError,
+ (const VixDiskLibConnection connection,
+ const char *path,
+ const VixDiskLibCreateParams *create_params,
+ void *progress_function_unused,
+ void *progress_data_unused));
/* Added in VDDK 6.0. */
STUB (VixDiskLib_Flush,
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index 31e5e23b..5ebf9a2c 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -81,6 +81,14 @@ bool is_remote; /* true if remote connection */
enum compression_type compression; /* compression */
char *config; /* config */
const char *cookie; /* cookie */
+bool create; /* create */
+enum VixDiskLibAdapterType create_adapter_type =
+ VIXDISKLIB_ADAPTER_SCSI_BUSLOGIC; /* create-adapter-type */
+uint16_t create_hwversion =
+ VIXDISKLIB_HWVERSION_WORKSTATION_5; /* create-hwversion */
+uint64_t create_size; /* create-size */
+enum VixDiskLibDiskType create_type =
+ VIXDISKLIB_DISK_MONOLITHIC_SPARSE; /* create-type */
const char *filename; /* file */
char *libdir; /* libdir */
uint16_t nfc_host_port; /* nfchostport */
@@ -119,6 +127,7 @@ static int
vddk_config (const char *key, const char *value)
{
int r;
+ int64_t r64;
if (strcmp (key, "compression") == 0) {
if (strcmp (value, "zlib") == 0)
@@ -144,6 +153,82 @@ vddk_config (const char *key, const char *value)
else if (strcmp (key, "cookie") == 0) {
cookie = value;
}
+ else if (strcmp (key, "create") == 0) {
+ r = nbdkit_parse_bool (value);
+ if (r == -1)
+ return -1;
+ create = r;
+ }
+ else if (strcmp (key, "create-adapter-type") == 0) {
+ if (strcmp (value, "ide") == 0)
+ create_adapter_type = VIXDISKLIB_ADAPTER_IDE;
+ else if (strcmp (value, "scsi-buslogic") == 0)
+ create_adapter_type = VIXDISKLIB_ADAPTER_SCSI_BUSLOGIC;
+ else if (strcmp (value, "scsi-lsilogic") == 0)
+ create_adapter_type = VIXDISKLIB_ADAPTER_SCSI_LSILOGIC;
+ else {
+ nbdkit_error ("unknown create-adapter-type: %s", value);
+ return -1;
+ }
+ }
+ else if (strcmp (key, "create-hwversion") == 0) {
+ if (strcmp (value, "workstation4") == 0)
+ create_hwversion = VIXDISKLIB_HWVERSION_WORKSTATION_4;
+ else if (strcmp (value, "workstation5") == 0)
+ create_hwversion = VIXDISKLIB_HWVERSION_WORKSTATION_5;
+ else if (strcmp (value, "workstation6") == 0)
+ create_hwversion = VIXDISKLIB_HWVERSION_WORKSTATION_6;
+ else if (strcmp (value, "esx30") == 0)
+ create_hwversion = VIXDISKLIB_HWVERSION_ESX30;
+ else if (strcmp (value, "esx4x") == 0)
+ create_hwversion = VIXDISKLIB_HWVERSION_ESX4X;
+ else if (strcmp (value, "esx50") == 0)
+ create_hwversion = VIXDISKLIB_HWVERSION_ESX50;
+ else if (strcmp (value, "esx51") == 0)
+ create_hwversion = VIXDISKLIB_HWVERSION_ESX51;
+ else if (strcmp (value, "esx55") == 0)
+ create_hwversion = VIXDISKLIB_HWVERSION_ESX55;
+ else if (strcmp (value, "esx60") == 0)
+ create_hwversion = VIXDISKLIB_HWVERSION_ESX60;
+ else if (strcmp (value, "esx65") == 0)
+ create_hwversion = VIXDISKLIB_HWVERSION_ESX65;
+ else {
+ nbdkit_error ("unknown create-hwversion: %s", value);
+ return -1;
+ }
+ }
+ else if (strcmp (key, "create-size") == 0) {
+ r64 = nbdkit_parse_size (value);
+ if (r64 == -1)
+ return -1;
+ if (r64 <= 0 || (r64 & 511) != 0) {
+ nbdkit_error ("create-size must be greater than zero and a multiple of 512");
+ return -1;
+ }
+ create_size = r64;
+ }
+ else if (strcmp (key, "create-type") == 0) {
+ if (strcmp (value, "monolithic-sparse") == 0)
+ create_type = VIXDISKLIB_DISK_MONOLITHIC_SPARSE;
+ else if (strcmp (value, "monolithic-flat") == 0)
+ create_type = VIXDISKLIB_DISK_MONOLITHIC_FLAT;
+ else if (strcmp (value, "split-sparse") == 0)
+ create_type = VIXDISKLIB_DISK_SPLIT_SPARSE;
+ else if (strcmp (value, "split-flat") == 0)
+ create_type = VIXDISKLIB_DISK_SPLIT_FLAT;
+ else if (strcmp (value, "vmfs-flat") == 0)
+ create_type = VIXDISKLIB_DISK_VMFS_FLAT;
+ else if (strcmp (value, "stream-optimized") == 0)
+ create_type = VIXDISKLIB_DISK_STREAM_OPTIMIZED;
+ else if (strcmp (value, "vmfs-thin") == 0)
+ create_type = VIXDISKLIB_DISK_VMFS_THIN;
+ else if (strcmp (value, "vmfs-sparse") == 0)
+ create_type = VIXDISKLIB_DISK_VMFS_SPARSE;
+ else {
+ nbdkit_error ("unknown create-type: %s", value);
+ return -1;
+ }
+ }
else if (strcmp (key, "file") == 0) {
/* NB: Don't convert this to an absolute path, because in the
* remote case this can be a path located on the VMware server.
@@ -266,6 +351,18 @@ vddk_config_complete (void)
#undef missing
}
+ if (create) {
+ if (is_remote) {
+ nbdkit_error ("create=true can only be used to create local VMDK files");
+ return -1;
+ }
+
+ if (create_size == 0) {
+ nbdkit_error ("if using create=true you must specify the size using the create-size parameter");
+ return -1;
+ }
+ }
+
/* Restore original LD_LIBRARY_PATH after reexec. */
if (restore_ld_library_path () == -1)
return -1;
@@ -618,6 +715,34 @@ vddk_open (int readonly)
goto err1;
}
+ /* Creating a disk? The first time the connection is opened we will
+ * create it here (we need h->connection). Then set create=false so
+ * we don't create it again. This is all serialized through
+ * open_close_lock so it is safe.
+ */
+ if (create) {
+ VixDiskLibCreateParams cparams = {
+ .diskType = create_type,
+ .adapterType = create_adapter_type,
+ .hwVersion = create_hwversion,
+ .capacity = create_size / VIXDISKLIB_SECTOR_SIZE,
+ .logicalSectorSize = 0,
+ .physicalSectorSize = 0
+ };
+
+ VDDK_CALL_START (VixDiskLib_Create,
+ "h->connection, %s, &cparams, NULL, NULL",
+ filename)
+ err = VixDiskLib_Create (h->connection, filename, &cparams, NULL, NULL);
+ VDDK_CALL_END (VixDiskLib_Create, 0);
+ if (err != VIX_OK) {
+ VDDK_ERROR (err, "VixDiskLib_Create: %s", filename);
+ goto err2;
+ }
+
+ create = false; /* Don't create it again. */
+ }
+
flags = 0;
if (readonly)
flags |= VIXDISKLIB_FLAG_OPEN_READ_ONLY;
diff --git a/plugins/vddk/vddk.h b/plugins/vddk/vddk.h
index d99b6f4b..3a808013 100644
--- a/plugins/vddk/vddk.h
+++ b/plugins/vddk/vddk.h
@@ -56,6 +56,11 @@ extern bool is_remote;
extern enum compression_type compression;
extern char *config;
extern const char *cookie;
+extern bool create;
+extern enum VixDiskLibAdapterType create_adapter_type;
+extern uint16_t create_hwversion;
+extern uint64_t create_size;
+extern enum VixDiskLibDiskType create_type;
extern const char *filename;
extern char *libdir;
extern uint16_t nfc_host_port;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 43b60943..ad2d43b9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -171,7 +171,9 @@ if HAVE_VDDK
#
# make check-vddk vddkdir=vmware-vix-disklib-distrib
check-vddk:
- $(MAKE) check TESTS="test-vddk-real.sh test-vddk-real-dump-plugin.sh"
+ $(MAKE) check TESTS="test-vddk-real.sh
+ test-vddk-real-dump-plugin.sh
+ test-vddk-real-create.sh"
endif HAVE_VDDK
#----------------------------------------------------------------------
@@ -1033,6 +1035,7 @@ TESTS += \
test-vddk-dump-plugin.sh \
test-vddk-password-fd.sh \
test-vddk-password-interactive.sh \
+ test-vddk-real-create.sh \
test-vddk-real-dump-plugin.sh \
test-vddk-real.sh \
test-vddk-reexec.sh \
@@ -1063,6 +1066,7 @@ EXTRA_DIST += \
test-vddk-dump-plugin.sh \
test-vddk-password-fd.sh \
test-vddk-password-interactive.sh \
+ test-vddk-real-create.sh \
test-vddk-real-dump-plugin.sh \
test-vddk-real.sh \
test-vddk-reexec.sh \
diff --git a/tests/dummy-vddk.c b/tests/dummy-vddk.c
index b6f12042..0c5e505f 100644
--- a/tests/dummy-vddk.c
+++ b/tests/dummy-vddk.c
@@ -236,3 +236,13 @@ VixDiskLib_Wait (VixDiskLibHandle handle)
{
return VIX_OK;
}
+
+NBDKIT_DLL_PUBLIC VixError
+VixDiskLib_Create (const VixDiskLibConnection connection,
+ const char *path,
+ const VixDiskLibCreateParams *create_params,
+ void *progress_function_unused,
+ void *progress_data_unused)
+{
+ return VIX_E_NOT_SUPPORTED;
+}
diff --git a/tests/test-vddk-real-create.sh b/tests/test-vddk-real-create.sh
new file mode 100755
index 00000000..8f39a4c9
--- /dev/null
+++ b/tests/test-vddk-real-create.sh
@@ -0,0 +1,70 @@
+#!/usr/bin/env bash
+# nbdkit
+# Copyright (C) 2018-2022 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.
+
+source ./functions.sh
+set -e
+set -x
+
+requires test "x$vddkdir" != "x"
+requires test -d "$vddkdir"
+requires test -f "$vddkdir/lib64/libvixDiskLib.so"
+requires test -f disk
+requires nbdcopy --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"
+ exit 77
+fi
+
+vmdk=$PWD/test-vddk-real-create.vmdk ;# note must be an absolute path
+files="$vmdk"
+rm -f $files
+cleanup_fn rm -f $files
+
+size="$(stat -c %s disk)"
+
+nbdkit -fv -U - vddk libdir="$vddkdir" $vmdk \
+ create=true create-size=$size \
+ --run 'nbdcopy disk $uri'
+
+# Check the VMDK file was created and looks reasonable.
+test -f $vmdk
+file $vmdk | grep 'VMware'
--
2.31.1

View File

@ -0,0 +1,29 @@
From eb5d5a628968c7fd5401cf7e73a6cff6c43994aa Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 18 Jan 2022 13:14:01 +0000
Subject: [PATCH] vddk: Fix documentation of new create flag
create=1 works, but for consistency use create=true
Fixes: commit a39d5773afc3ebab7e5768118a2bccb89a654585
(cherry picked from commit 0b21897b64a6a1d97a8a7361e8f781ae743dedca)
---
plugins/vddk/nbdkit-vddk-plugin.pod | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/vddk/nbdkit-vddk-plugin.pod b/plugins/vddk/nbdkit-vddk-plugin.pod
index b96192d0..6c7ae989 100644
--- a/plugins/vddk/nbdkit-vddk-plugin.pod
+++ b/plugins/vddk/nbdkit-vddk-plugin.pod
@@ -51,7 +51,7 @@ input disk:
nbdkit -U - vddk \
/absolute/path/to/output.vmdk \
- create=1 create-size=100M \
+ create=true create-size=100M \
--run 'qemu-img convert input.qcow2 $uri'
=head2 Open a file on a remote VMware ESXi hypervisor
--
2.31.1

View File

@ -0,0 +1,55 @@
From c8cdce47bc38d2f59ecc4b75d6db7f032b63d527 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 18 Jan 2022 20:49:21 +0000
Subject: [PATCH] vddk: Allow create-hwversion to be specified as a number
This gives us a bit of future-proofing so we don't always need to add
new hardware versions immediately. Another reason for this is that
VDDK allows you to specify seemingly any number here without
complaint.
Updates: commit a39d5773afc3ebab7e5768118a2bccb89a654585
(cherry picked from commit 071e32927237c2c00d78684c8a0f2e5fbca9963e)
---
plugins/vddk/nbdkit-vddk-plugin.pod | 8 ++++++--
plugins/vddk/vddk.c | 3 ++-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/plugins/vddk/nbdkit-vddk-plugin.pod b/plugins/vddk/nbdkit-vddk-plugin.pod
index 6c7ae989..e6972900 100644
--- a/plugins/vddk/nbdkit-vddk-plugin.pod
+++ b/plugins/vddk/nbdkit-vddk-plugin.pod
@@ -195,10 +195,14 @@ Specify the VMDK disk adapter type. The default is C<scsi-buslogic>.
=item B<create-hwversion=esx65>
+=item B<create-hwversion=>N
+
(nbdkit E<ge> 1.30)
-Specify the VMDK virtual hardware version. The default is
-C<workstation5>.
+Specify the VMDK virtual hardware version. You can give either the
+named version or the equivalent 16 bit number.
+
+The default is C<workstation5> (N = 4).
=item B<create-size=>SIZE
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index 5ebf9a2c..bab8de6f 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -192,7 +192,8 @@ vddk_config (const char *key, const char *value)
create_hwversion = VIXDISKLIB_HWVERSION_ESX60;
else if (strcmp (value, "esx65") == 0)
create_hwversion = VIXDISKLIB_HWVERSION_ESX65;
- else {
+ else if (nbdkit_parse_uint16_t ("create-hwversion", value,
+ &create_hwversion) == -1) {
nbdkit_error ("unknown create-hwversion: %s", value);
return -1;
}
--
2.31.1

View File

@ -0,0 +1,31 @@
From 84c5bc4664607fdf1f051e9e52ac6d0e4f0be049 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 18 Jan 2022 21:02:32 +0000
Subject: [PATCH] tests: Fix VDDK tests
We need to use quoting for the subcommand split across lines.
Fixes: commit a39d5773afc3ebab7e5768118a2bccb89a654585
(cherry picked from commit 4df525566b38202ed8a7485ac8e7f06edd5ee49a)
---
tests/Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ad2d43b9..62a6f05b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -171,8 +171,8 @@ if HAVE_VDDK
#
# make check-vddk vddkdir=vmware-vix-disklib-distrib
check-vddk:
- $(MAKE) check TESTS="test-vddk-real.sh
- test-vddk-real-dump-plugin.sh
+ $(MAKE) check TESTS="test-vddk-real.sh \
+ test-vddk-real-dump-plugin.sh \
test-vddk-real-create.sh"
endif HAVE_VDDK
--
2.31.1

View File

@ -0,0 +1,204 @@
From 222bce6b83421db1afdad24cf4e8ab7b1aa7b273 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Tue, 18 Jan 2022 14:48:33 +0100
Subject: [PATCH] server/sockets: get rid of AI_ADDRCONFIG
The AI_ADDRCONFIG hint of getaddrinfo() is supposed to restrict the name
resolution to such address families (IPv4 vs. IPv6) for which the
resolving host has publicly routable addresses assigned.
The main problem with AI_ADDRCONFIG can be shown with the following
command line:
$ nbdkit -f -p 32776 -P pidfile -i ::1 --exit-with-parent null
On a host where ::1 is the only IPv6 address assigned (namely to the
loopback interface), the command fails with
> nbdkit: getaddrinfo: ::1: 32776: Address family for hostname not
> supported
due to the "publicly routable" requirement.
Remove AI_ADDRCONFIG from the getaddrinfo() hints, and as a replacement,
introduce the "-4" and "-6" options, similarly to netcat and ssh.
(1) This makes options of the form:
-i 127.0.0.1
-i ::1
work regardless of "public" IPv6 / IPv4 connectivity;
(2) options of the form
-i localhost
-i FQDN
will bind both IPv4 and IPv6 addresses of the desired interface(s);
(3) omitting the option "-i" will bind both IPv4 and IPv6 wildcard
addresses (0.0.0.0 and ::);
(4) the configurations in (2) and (3) can be restricted to IPv4 or IPv6
addresses by adding the "-4" or "-6" option, respectively.
Importantly, this change allows the "connect-tcp6" test case of libnbd to
pass on such hosts that have no IPv6 connectivity (i.e., where the only
assigned IPv6 address is ::1, namely on the loopback interface).
Ref: https://listman.redhat.com/archives/libguestfs/2022-January/msg00110.html
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220118134833.13246-3-lersek@redhat.com>
[lersek@redhat.com: fix typo in "--exit-with-parent" (Eric)]
Acked-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit 9eec2335d630ae8ef947a927c1922d725d482f4a)
---
common/utils/windows-compat.h | 7 -------
docs/nbdkit.pod | 20 +++++++++++++++++++-
docs/synopsis.txt | 3 ++-
server/internal.h | 1 +
server/main.c | 9 +++++++++
server/options.h | 4 +++-
server/sockets.c | 3 ++-
7 files changed, 36 insertions(+), 11 deletions(-)
diff --git a/common/utils/windows-compat.h b/common/utils/windows-compat.h
index 7695bf7e..658c1d8b 100644
--- a/common/utils/windows-compat.h
+++ b/common/utils/windows-compat.h
@@ -75,13 +75,6 @@ struct sockaddr_un
#define O_NOCTTY 0
#endif
-/* AI_ADDRCONFIG is not available on Windows. It enables a rather
- * obscure feature of getaddrinfo to do with IPv6.
- */
-#ifndef AI_ADDRCONFIG
-#define AI_ADDRCONFIG 0
-#endif
-
/* Windows <errno.h> lacks certain errnos, so replace them here as
* best we can.
*/
diff --git a/docs/nbdkit.pod b/docs/nbdkit.pod
index 99cfb362..042607fb 100644
--- a/docs/nbdkit.pod
+++ b/docs/nbdkit.pod
@@ -173,6 +173,24 @@ Display information about nbdkit or a specific plugin:
Display brief command line usage information and exit.
+=item B<-4>
+
+=item B<--ipv4-only>
+
+=item B<-6>
+
+=item B<--ipv6-only>
+
+When a non-numeric argument is passed to the I<-i> option (such as a
+Fully Qualified Domain Name, or a host name from C</etc/hosts>),
+restrict the name resolution to IPv4 or IPv6 addresses.
+
+When the I<-i> option is omitted, listen on only the IPv4 or IPv6
+address of all interfaces (C<0.0.0.0> or C<::>, respectively).
+
+When both I<-4> and I<-6> options are present on the command line, the
+last one takes effect.
+
=item B<-D> PLUGIN.FLAG=N
=item B<-D> FILTER.FLAG=N
@@ -265,7 +283,7 @@ See also I<-u>.
=item B<--ipaddr> IPADDR
Listen on the specified interface. The default is to listen on all
-interfaces. See also I<-p>.
+interfaces. See also I<-4>, I<-6>, and I<-p>.
=item B<--log=stderr>
diff --git a/docs/synopsis.txt b/docs/synopsis.txt
index 07b9dcff..6154bb2e 100644
--- a/docs/synopsis.txt
+++ b/docs/synopsis.txt
@@ -1,4 +1,5 @@
-nbdkit [-D|--debug PLUGIN|FILTER|nbdkit.FLAG=N]
+nbdkit [-4|--ipv4-only] [-6|--ipv6-only]
+ [-D|--debug PLUGIN|FILTER|nbdkit.FLAG=N]
[-e|--exportname EXPORTNAME] [--exit-with-parent]
[--filter FILTER ...] [-f|--foreground]
[-g|--group GROUP] [-i|--ipaddr IPADDR]
diff --git a/server/internal.h b/server/internal.h
index bc81b786..46fcdd46 100644
--- a/server/internal.h
+++ b/server/internal.h
@@ -113,6 +113,7 @@ enum log_to {
LOG_TO_NULL, /* --log=null forced on the command line */
};
+extern int tcpip_sock_af;
extern struct debug_flag *debug_flags;
extern const char *export_name;
extern bool foreground;
diff --git a/server/main.c b/server/main.c
index 225258de..8e7ac149 100644
--- a/server/main.c
+++ b/server/main.c
@@ -86,6 +86,7 @@ static void error_if_stdio_closed (void);
static void switch_stdio (void);
static void winsock_init (void);
+int tcpip_sock_af = AF_UNSPEC; /* -4, -6 */
struct debug_flag *debug_flags; /* -D */
bool exit_with_parent; /* --exit-with-parent */
const char *export_name; /* -e */
@@ -367,6 +368,14 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
#endif
+ case '4':
+ tcpip_sock_af = AF_INET;
+ break;
+
+ case '6':
+ tcpip_sock_af = AF_INET6;
+ break;
+
case 'D':
add_debug_flag (optarg);
break;
diff --git a/server/options.h b/server/options.h
index e59ef17f..39299b9d 100644
--- a/server/options.h
+++ b/server/options.h
@@ -59,8 +59,10 @@ enum {
VSOCK_OPTION,
};
-static const char *short_options = "D:e:fg:i:nop:P:rst:u:U:vV";
+static const char *short_options = "46D:e:fg:i:nop:P:rst:u:U:vV";
static const struct option long_options[] = {
+ { "ipv4-only", no_argument, NULL, '4' },
+ { "ipv6-only", no_argument, NULL, '6' },
{ "debug", required_argument, NULL, 'D' },
{ "dump-config", no_argument, NULL, DUMP_CONFIG_OPTION },
{ "dump-plugin", no_argument, NULL, DUMP_PLUGIN_OPTION },
diff --git a/server/sockets.c b/server/sockets.c
index 15a26f69..4e4ccbc4 100644
--- a/server/sockets.c
+++ b/server/sockets.c
@@ -179,7 +179,8 @@ bind_tcpip_socket (sockets *socks)
port = "10809";
memset (&hints, 0, sizeof hints);
- hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
+ hints.ai_flags = AI_PASSIVE;
+ hints.ai_family = tcpip_sock_af;
hints.ai_socktype = SOCK_STREAM;
err = getaddrinfo (ipaddr, port, &hints, &ai);
--
2.31.1

View File

@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEE93dPsa0HSn6Mh2fqkXOPc+G3aKAFAmHUTfMRHHJpY2hAYW5u
ZXhpYS5vcmcACgkQkXOPc+G3aKCVdg/8DUlMyYdSwFGGD3uInUSiZPhmceI+azN8
dg7FwVJHwTI+Xir71KoAcSnQXD1FCYVMGLNPdaFE/cA/pCLXt4dcoc3PhGcNeEJo
lJDVodLliE7ZfDXIUDNF7cxGnYCTGtqFetiP3p2hiLndNWvQcYqVDmkqv5wKsgSw
nf14Sik8VOmanRzVEauqKWTRfnasRYFL523gGFBeC4iPJ3d+bFbB6PvhgrZJ9khq
p4lceODiWuLpnfVSE0gDPEXbqnSG5rWsUUzKbYeZarU/6VwCGywf2fIbAtfWbLEy
Nv9xOmH6ECJDmCRQKak/1aPf/D4pGPILoJVFow9VqyiGRlFREP8SkklknJ4WGQCE
oGKl7W4uWHKSmnxCk5atdil4jOOH92ZUjubtwXAFWYn4uP9/Is9ZjmCF5O7mHRli
lzbhCS3c4Eg95Li0aX7JJfdEMVHZLKXY9AFuMvbbQX13v/I3RsQE/v5X+8d7lG5a
v9Ac+/yvNCwdGr4mxsOAGXyiRi++PmWxWho3JWRPWEY2R/d9iEISef18OMOfOfUh
wrbqpKCuD68K3mdiLSWY1pUF4eZ3Vwrcv0qB/75ncMwv0c4Hm+3kwG2bTPybKhBq
YAcV/+2+EoIlh1kD6spR8ShLduzL4k/Et0lkXVNOP+LeW028LiEFDpCtGb0JTqN6
y9aEofWy6Aw=
=DOH3
-----END PGP SIGNATURE-----

View File

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEE93dPsa0HSn6Mh2fqkXOPc+G3aKAFAmHumIgRHHJpY2hAYW5u
ZXhpYS5vcmcACgkQkXOPc+G3aKAt/RAAlUnU/dJ6d1bec5ggmfTgWYwHcXqc6bGi
Tp0vxG+2LiE/D52xhGvaRWQwd2mR4vvHiDLlBitlBZNHItyuB9wM9r5SAIRw5PcR
1kCILAKGQN2dLSS+HUyib6cnlughFwIeSt4XuhwgedLlIBZ+2d38IRC3ia4ShbIX
btZMwRmpD/06Py8A+tM856zb1YgjpA3nQIC56r/ne25vLyAY4LE8T2BtjlkmBxBy
Lswg0KM3+SBsMWwbo0aCfyTOW9lpVa2WnLgu/9nsfIjA+m9kcjfpjfmhduV6lfrx
KRFGtKQnl+RWfhhfmxeCWo5/mXqrqOga7VIWltxRkjQ916TrzTWwMnWBtOvVfRSL
QS1tlJYbClRGHHkM9YHjvV0v+xHcUTt9VAd+RruVjnz2H4hZrEi8klAHWjOUe/1m
37PEoLAh9+ox+zcSODc+MWWOA98oJoXyS0PZvPOzzlSokxaLEY/TRUMrILGBJSyz
hIwdMi63gM1KzIw0ysNJ639Nvu0n/PiIgpPheXK81fNyNpzsThS1uEqonAMC9+Hr
QIMBgfRMdvbG791lVo7WRHSdGpSO+hun4scla+3VZpszqSwFX2+O/ji0+5cos4RR
dxfzV4gt/1FH72OhWGHMSmmTpd+G2ZjXFsjNTmzMYbS0kMeXdIXalVXJrfDroSoU
ITXkfk5uFtU=
=Wlxf
-----END PGP SIGNATURE-----

View File

@ -51,7 +51,7 @@ ExclusiveArch: x86_64
%global source_directory 1.28-stable
Name: nbdkit
Version: 1.28.4
Version: 1.28.5
Release: 1%{?dist}
Summary: NBD server
@ -106,6 +106,12 @@ Patch0026: 0026-Revert-podwrapper.pl.in-Use-short-commit-date.patch
Patch0027: 0027-Fix-podwrapper.pl.in-Use-short-commit-date.patch
Patch0028: 0028-scripts-Add-simple-script-for-automating-VDDK-disk-c.patch
Patch0029: 0029-file-Fix-implementation-of-cache-none-for-writes.patch
Patch0030: 0030-tests-Add-configure-disable-libguestfs-tests-flag.patch
Patch0031: 0031-vddk-Implement-VMDK-creation.patch
Patch0032: 0032-vddk-Fix-documentation-of-new-create-flag.patch
Patch0033: 0033-vddk-Allow-create-hwversion-to-be-specified-as-a-num.patch
Patch0034: 0034-tests-Fix-VDDK-tests.patch
Patch0035: 0035-server-sockets-get-rid-of-AI_ADDRCONFIG.patch
BuildRequires: make
%if 0%{patches_touch_autotools}
@ -816,11 +822,12 @@ skip_test tests/test-cache-max-size.sh
# https://www.redhat.com/archives/libguestfs/2020-March/msg00191.html
skip_test tests/test-nbd-tls.sh tests/test-nbd-tls-psk.sh
# This test fails on RHEL 9 & aarch64 with the error:
# This test fails on RHEL 9 aarch64 & ppc64le with the error:
# nbdkit: error: allocator=malloc: mlock: Cannot allocate memory
# It could be the mlock limit on the builder is too low.
# https://bugzilla.redhat.com/show_bug.cgi?id=2044432
%if 0%{?rhel}
%ifarch aarch64
%ifarch aarch64 %{power64}
skip_test tests/test-memory-allocator-malloc-mlock.sh
%endif
%endif
@ -1214,8 +1221,8 @@ export LIBGUESTFS_TRACE=1
%changelog
* Tue Jan 04 2022 Richard W.M. Jones <rjones@redhat.com> - 1.28.4-1
- Rebase to new stable branch version 1.28.4
* Mon Jan 24 2022 Richard W.M. Jones <rjones@redhat.com> - 1.28.5-1
- Rebase to new stable branch version 1.28.5
resolves: rhbz#2011709
- Move nbdkit-null-plugin to nbdkit-server package
resolves: rhbz#2021154
@ -1227,6 +1234,7 @@ export LIBGUESTFS_TRACE=1
- Fix nbdkit-cow-filter cow-block-size=4096
- file: Fix implementation of cache=none for writes
resolves: rhbz#2029751
- vddk: Implement VMDK creation
* Thu Aug 19 2021 Richard W.M. Jones <rjones@redhat.com> - 1.26.5-1
- Rebase along stable branch to 1.26.5