[PATCH v4 0/5] qapi: Add feature flags to enum members
by Markus Armbruster
PATCH 1+2 add feature flags to enum members. Awkward due to an
introspection design mistake; see PATCH 1 for details.
PATCH 3+4 implement policy deprecated-input={reject,crash} for enum
values.
Policy deprecated-output=hide is not implemented, because we can't
hide a value without hiding the entire member, which is almost
certainly more than the requester of this policy bargained for.
Perhaps we want a new policy deprecated-output=hide-or-else-crash to
help us catch unwanted use of deprecated enum values. Perhaps we want
deprecated-output=hide to behave that way together with
deprecated-input=crash. Or even always. Thoughts?
PATCH 5 puts the new feature flags to use. It's RFC because it makes
sense only on top of Vladimir's deprecation of drive-backup. See its
commit message for a reference.
I prefer to commit new features together with a use outside tests/.
PATCH 5 adds such a use, but it's RFC, because it depends on
Vladimir's work. Perhaps another use pops up. I can delay this work
in the hope of a use becoming ready, but the feature flags work I have
in the pipeline will eventually force my hand.
v4:
* PATCH 1: Deprecate SchemaInfoEnum member @values.
* PATCH 2: Doc tweak
v3:
* PATCH 1+2: Update qapi-code-gen.rst [Kevin, Eric]
* PATCH 4: Commit message typo [Eric], doc update moved to PATCH 2
* PATCH 5: Doc comment FIXME resolved [Kevin]
v2:
* Rebased with straightforward conflicts.
* PATCH 1-4: No longer RFC.
* PATCH 1: "Since" information fixed [Eric]. Commit message updated
to reflect feedback.
* PATCH 2: Commit message amended to point out special feature flag
'deprecated' is ignored at this stage.
* PATCH 4: Documentation updated. Commit message tweaked.
Markus Armbruster (5):
qapi: Enable enum member introspection to show more than name
qapi: Add feature flags to enum members
qapi: Move compat policy from QObject to generic visitor
qapi: Implement deprecated-input={reject,crash} for enum values
block: Deprecate transaction type drive-backup
docs/about/deprecated.rst | 6 ++++
docs/devel/qapi-code-gen.rst | 29 ++++++++++++++-----
qapi/compat.json | 3 ++
qapi/introspect.json | 28 ++++++++++++++++--
qapi/transaction.json | 6 +++-
include/qapi/qobject-input-visitor.h | 4 ---
include/qapi/qobject-output-visitor.h | 4 ---
include/qapi/util.h | 6 +++-
include/qapi/visitor-impl.h | 3 ++
include/qapi/visitor.h | 9 ++++++
qapi/qapi-visit-core.c | 27 +++++++++++++++--
qapi/qmp-dispatch.c | 4 +--
qapi/qobject-input-visitor.c | 14 +--------
qapi/qobject-output-visitor.c | 14 +--------
scripts/qapi/expr.py | 3 +-
scripts/qapi/introspect.py | 19 +++++++++---
scripts/qapi/schema.py | 22 ++++++++++++--
scripts/qapi/types.py | 17 ++++++++++-
tests/qapi-schema/doc-good.json | 5 +++-
tests/qapi-schema/doc-good.out | 3 ++
tests/qapi-schema/doc-good.txt | 3 ++
.../qapi-schema/enum-dict-member-unknown.err | 2 +-
tests/qapi-schema/qapi-schema-test.json | 3 +-
tests/qapi-schema/qapi-schema-test.out | 1 +
tests/qapi-schema/test-qapi.py | 1 +
25 files changed, 174 insertions(+), 62 deletions(-)
--
2.31.1
3 years
[virt-v2v RFC wave 2 00/10] replace QXL with standard VGA
by Laszlo Ersek
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1961107
This series advances in small steps, as follows:
- introduce the Standard_VGA data constructor (in addition to QXL,
Cirrus, ...);
- handle Standard_VGA (as a non-default option through the requested
guest caps) in the Linux and Windows guest conversions, and various
output modules;
- flip the default display choice from QXL to Standard_VGA if the
requested guest caps don't express a display preference;
- remove the QXL data constructor;
- clean up the test suite.
I'm posting the series as an RFC for two reasons:
- No actual guests have been converted for testing.
- I need further info (help) on the OVF, JSON and OpenStack output modes
because they are too tightly coupled with QXL, and/or I don't know how
to express "standard VGA" in them. (Watch out for the "Notes" sections
in the relevant patches.)
However, the series should be complete enough to discuss the general
approach (and to convert some actual guests using the "QEMU cmdline" and
"libvirt XML" output formats).
(Side comment: today is a public holiday in Hungary, like in many other
countries. The fact that I'm posting this today does not imply that I
expect any feedback today (or soon after today). For personal reasons,
my work schedule has been very difficult to manage, and today has been a
rare day where I could actually sit down for a few hours
*uninterrupted*, and work on this. So the point of working on a holiday
was not to "be faster than others", but to make *any* progress worth
mentioning.)
Thanks,
Laszlo
Laszlo Ersek (10):
lib/types: introduce "Standard_VGA" constructor for
"guestcaps_video_type"
convert_linux: use "modesetting" X.org driver for Standard_VGA
convert/windows_virtio: restrict the warning with virtio-win.iso
absent
convert/windows_virtio: handle Standard_VGA in the requested guest
caps
output: handle Standard_VGA in the libvirt XML and QEMU cmdline
formats
convert_linux: flip default target display to Standard_VGA
convert/windows_virtio: flip default target display to Standard_VGA
lib/types: remove "QXL" constructor for "guestcaps_video_type"
tests: remove the fake Windows guest drivers for the QXL device
tests: remove the remaining QXL references (for completeness)
convert/convert_linux.ml | 7 ++-
convert/windows_virtio.ml | 48 +++++++-------------
lib/types.ml | 4 +-
lib/types.mli | 2 +-
output/create_json.ml | 2 +-
output/create_libvirt_xml.ml | 2 +-
output/openstack_image_properties.ml | 2 +-
output/output.ml | 5 +-
test-data/fake-virtio-win/Makefile.am | 16 -------
test-data/fake-virtio-win/drivers/amd64/Win2008R2/qxl.cat | 1 -
test-data/fake-virtio-win/drivers/amd64/Win2008R2/qxl.inf | 2 -
test-data/fake-virtio-win/drivers/amd64/Win2008R2/qxl.sys | 1 -
test-data/fake-virtio-win/drivers/amd64/Win2008R2/qxldd.dll | 1 -
test-data/fake-virtio-win/drivers/amd64/Win7/qxl.cat | 1 -
test-data/fake-virtio-win/drivers/amd64/Win7/qxl.inf | 2 -
test-data/fake-virtio-win/drivers/amd64/Win7/qxl.sys | 1 -
test-data/fake-virtio-win/drivers/amd64/Win7/qxldd.dll | 1 -
test-data/fake-virtio-win/drivers/i386/Win7/qxl.cat | 1 -
test-data/fake-virtio-win/drivers/i386/Win7/qxl.inf | 2 -
test-data/fake-virtio-win/drivers/i386/Win7/qxl.sys | 1 -
test-data/fake-virtio-win/drivers/i386/Win7/qxldd.dll | 1 -
test-data/fake-virtio-win/drivers/i386/WinXP/qxl.cat | 1 -
test-data/fake-virtio-win/drivers/i386/WinXP/qxl.inf | 2 -
test-data/fake-virtio-win/drivers/i386/WinXP/qxl.sys | 1 -
test-data/fake-virtio-win/drivers/i386/WinXP/qxldd.dll | 1 -
test-data/phony-guests/guests.xml.in | 2 +-
tests/test-v2v-i-ova.xml | 2 +-
tests/test-v2v-in-place.sh | 2 +-
tests/test-v2v-print-source.expected | 2 +-
tests/test-v2v-print-source.xml.in | 2 +-
tests/test-v2v-windows-conversion.sh | 2 +-
v2v/v2v_unit_tests.ml | 16 -------
32 files changed, 38 insertions(+), 98 deletions(-)
delete mode 100644 test-data/fake-virtio-win/drivers/amd64/Win2008R2/qxl.inf
delete mode 100644 test-data/fake-virtio-win/drivers/amd64/Win7/qxl.inf
delete mode 100644 test-data/fake-virtio-win/drivers/i386/Win7/qxl.inf
delete mode 100644 test-data/fake-virtio-win/drivers/i386/WinXP/qxl.inf
delete mode 100644 test-data/fake-virtio-win/drivers/amd64/Win2008R2/qxl.cat
delete mode 100644 test-data/fake-virtio-win/drivers/amd64/Win2008R2/qxl.sys
delete mode 100644 test-data/fake-virtio-win/drivers/amd64/Win2008R2/qxldd.dll
delete mode 100644 test-data/fake-virtio-win/drivers/amd64/Win7/qxl.cat
delete mode 100644 test-data/fake-virtio-win/drivers/amd64/Win7/qxl.sys
delete mode 100644 test-data/fake-virtio-win/drivers/amd64/Win7/qxldd.dll
delete mode 100644 test-data/fake-virtio-win/drivers/i386/Win7/qxl.cat
delete mode 100644 test-data/fake-virtio-win/drivers/i386/Win7/qxl.sys
delete mode 100644 test-data/fake-virtio-win/drivers/i386/Win7/qxldd.dll
delete mode 100644 test-data/fake-virtio-win/drivers/i386/WinXP/qxl.cat
delete mode 100644 test-data/fake-virtio-win/drivers/i386/WinXP/qxl.sys
delete mode 100644 test-data/fake-virtio-win/drivers/i386/WinXP/qxldd.dll
base-commit: 17e7cbffb9e5dad526dc8f63dc771aa15b306888
--
2.19.1.3.g30247aa5d201
3 years
[PATCH libnbd] golang/make-disst.sh: Remove the @v/list file
by Nir Soffer
This file must list all the version on the server, not latest version.
It should be created on the server after uploading a new release.
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
golang/make-dist.sh | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/golang/make-dist.sh b/golang/make-dist.sh
index 1aef36c..f728b1f 100755
--- a/golang/make-dist.sh
+++ b/golang/make-dist.sh
@@ -93,6 +93,17 @@ rm -rf libguestfs.org
# ├── v1.11.4.mod
# └── v1.11.4.zip
#
+# We create @latest and @v/*{.info,mod,zip} here.
+#
+# The "@v/list" file must be created on the web server after uploading
+# a new release:
+#
+# $ cd libguestfs.org/libnbd/@v
+# $ ls -1 v*.info | awk -F.info '{print $1}' > list
+# $ cat list
+# v1.11.3
+# v1.11.4
+#
# See https://golang.org/ref/mod#serving-from-proxy
module_dir=libguestfs.org/libnbd
@@ -103,12 +114,6 @@ mkdir -p $v_dir
echo "{\"Version\": \"$version\"}" > $module_dir/@latest
echo "{\"Version\": \"$version\"}" > $v_dir/$version.info
-# This is not entirely correct. This file should have a list of all
-# versions available, here we create only single version. This should
-# really be done on the server by appending the new version to the
-# list file.
-echo $version > $v_dir/list
-
cp go.mod $v_dir/$version.mod
mv $version.zip $v_dir
--
2.31.1
3 years
[PATCH libnbd 0/2] Publish the Go binding via a proxy server
by Nir Soffer
Consuming the Go binding now requires downloading the tarball, and
copying the source to your project. This is not the standard way that Go
modules should be consumed.
We can solve this issue in several ways:
- Publish the Go module from the libnbd repo
- Publish the Go module from a new distribution repo
- Publish the Go module via a proxy server
The first option requires that we keep the generated sources in the
repo, and change the package name to it can be imported from the gitlab
subdirectory:
import "gitlab.com/nbdkit/libnbd/-/tree/master/golang"
Since the Go tools do not support yet a module in a sub-directory of a
git repo:
https://github.com/golang/go/issues/34055
I think this is horrible.
The second option requires that we push the Go binding source to a new
repo:
https://gitlab.com/nbdkit/libnbd-golang
I think this may confuse users and will be harder to maintain.
The third option seems most suitable for libnbd use case - serve the Go
module from the same server serving the tarballs. This requires creating
a module zip file, and uploading it to a special directory structure on
the web server, with some metadata files.
For the second and third options, we can keep the name of the module as
"libguestfs.org/libnb" by serving html document with the required meta
tag at:
https://libguestfs.org/libnbd
This series implement the third option by adding a script to create the
distribution tree for the web server.
Nir Soffer (2):
golang: Create distribution for a proxy server
golang/README.md: Remove the hacks
golang/README.md | 31 -----------
golang/make-dist.sh | 123 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 123 insertions(+), 31 deletions(-)
create mode 100755 golang/make-dist.sh
--
2.31.1
3 years
[PATCH nbdkit 0/4] Enhance vector library
by Nir Soffer
Port changes from libnbd:
- Add vector benchmarks
- Add bench make target
- Optmize vector append
- Rename vector fields (size, alloc -> len, cap)
Nir Soffer (4):
common/utils/test-vector.c: Add vector benchmarks
common/urils/vector.c: Optimize vector append
common/utils/vector: Rename `alloc` to `cap`
common/utils/vector: Rename `size` to `len`
Makefile.am | 5 ++
README | 7 ++
common/allocators/allocator.c | 2 +-
common/allocators/malloc.c | 26 +++---
common/allocators/sparse.c | 6 +-
common/allocators/zstd.c | 6 +-
common/regions/regions.h | 6 +-
common/utils/Makefile.am | 3 +
common/utils/bench.h | 72 +++++++++++++++++
common/utils/environ.c | 2 +-
common/utils/test-vector.c | 57 +++++++++++++-
common/utils/vector.c | 14 +++-
common/utils/vector.h | 54 ++++++-------
filters/ddrescue/ddrescue.c | 2 +-
filters/exitwhen/exitwhen.c | 2 +-
filters/extentlist/extentlist.c | 14 ++--
filters/multi-conn/multi-conn.c | 16 ++--
plugins/cc/cc.c | 4 +-
plugins/data/data.c | 4 +-
plugins/data/format.c | 114 +++++++++++++--------------
plugins/eval/eval.c | 2 +-
plugins/floppy/directory-lfn.c | 24 +++---
plugins/floppy/floppy.c | 2 +-
plugins/floppy/virtual-floppy.c | 32 ++++----
plugins/iso/iso.c | 4 +-
plugins/nbd/nbd.c | 6 +-
plugins/partitioning/partition-mbr.c | 8 +-
plugins/partitioning/partitioning.c | 18 ++---
plugins/partitioning/virtual-disk.c | 12 +--
plugins/partitioning/virtual-disk.h | 2 +-
plugins/split/split.c | 14 ++--
plugins/ssh/ssh.c | 2 +-
plugins/vddk/reexec.c | 8 +-
plugins/vddk/stats.c | 4 +-
plugins/vddk/worker.c | 4 +-
server/exports.c | 6 +-
server/extents.c | 22 +++---
server/main.c | 2 +-
server/sockets.c | 8 +-
wrapper.c | 4 +-
40 files changed, 374 insertions(+), 226 deletions(-)
create mode 100644 common/utils/bench.h
--
2.31.1
3 years
[PATCH libnbd v2 0/8] Enhance the vector library
by Nir Soffer
- Add vector benchmarks
- Optimize vector append
- Refine vector fields names
- Clean up vector usage in crypto module
I'm fine with relicensing these changes for for nbdkit.
Changes in v2:
- Benchmarks do not run by default (Richard)
- Add "make bench" target to run the benchmarks
v1:
https://listman.redhat.com/archives/libguestfs/2021-October/msg00286.html
Nir Soffer (8):
common/utils: Add vector benchmarks
common/utils: Do not run benchmarks by default
common/utils/vector.c: Optimize vector append
common/utils/vector: Rename `alloc` to `cap`
common/utils/vector: Rename `size` to `len`
lib/crypto.c: Simplify vector reserve
lib/crypto.c: Don't use empty vector
lib/crypto.c: Remove unneeded else
Makefile.am | 5 ++
README | 4 ++
common/utils/Makefile.am | 5 +-
common/utils/bench.h | 72 ++++++++++++++++++++
common/utils/test-vector.c | 58 +++++++++++++++-
common/utils/vector.c | 14 +++-
common/utils/vector.h | 40 +++++------
copy/file-ops.c | 14 ++--
copy/main.c | 2 +-
copy/multi-thread-copying.c | 2 +-
copy/nbd-ops.c | 20 +++---
copy/synch-copying.c | 2 +-
fuse/nbdfuse.c | 4 +-
fuse/operations.c | 16 ++---
generator/states-connect-socket-activation.c | 2 +-
generator/states-newstyle-opt-meta-context.c | 8 +--
info/list.c | 8 +--
info/map.c | 12 ++--
info/show.c | 6 +-
lib/crypto.c | 18 ++---
lib/handle.c | 4 +-
lib/uri.c | 8 +--
22 files changed, 236 insertions(+), 88 deletions(-)
create mode 100644 common/utils/bench.h
--
2.31.1
3 years
[PATCH libnbd v2] golang/make-dist.sh: Add module release time
by Nir Soffer
Add the optional Time key to the vx.y.z.info file. This should help
https://pkg.go.dev/libguestfs.org/libnbd to show the "Published" date.
Using the commit date so rebuilding the tarball will created identical
metadata.
$ cat libguestfs.org/libnbd/@latest
{
"Version": "v1.11.3-9-g157bc49",
"Time": "2021-11-08"
}
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
v2 changes:
- Use git commit date for reproducible builds (Richard)
- Create indented json
golang/make-dist.sh | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/golang/make-dist.sh b/golang/make-dist.sh
index 1aef36c..32b9735 100755
--- a/golang/make-dist.sh
+++ b/golang/make-dist.sh
@@ -100,8 +100,12 @@ v_dir=$module_dir/@v
mkdir -p $v_dir
-echo "{\"Version\": \"$version\"}" > $module_dir/@latest
-echo "{\"Version\": \"$version\"}" > $v_dir/$version.info
+info="{
+ \"Version\": \"$version\",
+ \"Time\": \"$(git show -s --format=%cs)\"
+}"
+echo "$info" > $module_dir/@latest
+echo "$info" > $v_dir/$version.info
# This is not entirely correct. This file should have a list of all
# versions available, here we create only single version. This should
--
2.31.1
3 years
[PATCH libnbd] golang/make-dist.sh: Add module release time
by Nir Soffer
Add the optional Time key to the vx.y.z.info file. This should help
https://pkg.go.dev/libguestfs.org/libnbd to show the "Published" date.
$ cat libguestfs.org/libnbd/@v/v1.11.3-7-g7954c45.info | jq
{
"Version": "v1.11.3-7-g7954c45",
"Time": "2021-11-08"
}
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
golang/make-dist.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/golang/make-dist.sh b/golang/make-dist.sh
index 1aef36c..614dda3 100755
--- a/golang/make-dist.sh
+++ b/golang/make-dist.sh
@@ -100,8 +100,9 @@ v_dir=$module_dir/@v
mkdir -p $v_dir
-echo "{\"Version\": \"$version\"}" > $module_dir/@latest
-echo "{\"Version\": \"$version\"}" > $v_dir/$version.info
+info="{\"Version\": \"$version\", \"Time\": \"$(date --rfc-3339=date)\"}"
+echo "$info" > $module_dir/@latest
+echo "$info" > $v_dir/$version.info
# This is not entirely correct. This file should have a list of all
# versions available, here we create only single version. This should
--
2.31.1
3 years
[PATCH libnbd v2] tests: Test nbd_connect_systemd_socket_activation
by Nir Soffer
Add trivial test connecting via systemd socket activation.
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
Changes in v2:
- Skip test if nbdkit or nbdkit memory plugin are not available (Richard)
- Use single connection, supporting multiple connections needs more
work.
v1 was here:
https://listman.redhat.com/archives/libguestfs/2021-November/msg00049.html
tests/Makefile.am | 9 ++++
tests/connect-systemd-socket-activation.c | 65 +++++++++++++++++++++++
2 files changed, 74 insertions(+)
create mode 100644 tests/connect-systemd-socket-activation.c
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7f00f6f..0074acf 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -192,6 +192,7 @@ check_PROGRAMS += \
opt-list \
opt-info \
opt-list-meta \
+ connect-systemd-socket-activation \
connect-unix \
connect-tcp \
connect-tcp6 \
@@ -235,6 +236,7 @@ TESTS += \
opt-list \
opt-info \
opt-list-meta \
+ connect-systemd-socket-activation \
connect-unix \
connect-tcp \
connect-tcp6 \
@@ -424,6 +426,13 @@ opt_info_LDADD = $(top_builddir)/lib/libnbd.la
opt_list_meta_SOURCES = opt-list-meta.c
opt_list_meta_LDADD = $(top_builddir)/lib/libnbd.la
+connect_systemd_socket_activation_SOURCES = \
+ connect-systemd-socket-activation.c \
+ requires.c \
+ requires.h \
+ $(NULL)
+connect_systemd_socket_activation_LDADD = $(top_builddir)/lib/libnbd.la
+
connect_unix_SOURCES = connect-unix.c
connect_unix_LDADD = $(top_builddir)/lib/libnbd.la
diff --git a/tests/connect-systemd-socket-activation.c b/tests/connect-systemd-socket-activation.c
new file mode 100644
index 0000000..64da2b6
--- /dev/null
+++ b/tests/connect-systemd-socket-activation.c
@@ -0,0 +1,65 @@
+/* NBD client library in userspace
+ * Copyright (C) 2021 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* Test connecting using systemd socket activation. */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <inttypes.h>
+
+#include <libnbd.h>
+
+#include "requires.h"
+
+int
+main (int argc, char *argv[])
+{
+ char *args[] = {"nbdkit", "-f", "memory", "size=1m", NULL};
+ struct nbd_handle *nbd;
+ char *uri = NULL;
+ int result = EXIT_FAILURE;
+
+ requires ("nbdkit --version");
+ requires ("nbdkit memory --version");
+
+ printf("Connecting via systemd socket activation...\n");
+
+ nbd = nbd_create ();
+ if (nbd == NULL)
+ goto out;
+
+ if (nbd_connect_systemd_socket_activation (nbd, args) == -1)
+ goto out;
+
+ /* Libnbd creates unix socket internally, but this is not documented yet. */
+ uri = nbd_get_uri (nbd);
+
+ printf ("Connected to %s\n", uri);
+ result = EXIT_SUCCESS;
+
+out:
+ if (result == EXIT_FAILURE)
+ fprintf (stderr, "%s\n", nbd_get_error ());
+
+ free (uri);
+ nbd_close (nbd);
+
+ exit (result);
+}
--
2.31.1
3 years