RFC for NBD protocol extension: extended headers
by Eric Blake
In response to this mail, I will be cross-posting a series of patches
to multiple projects as a proof-of-concept implementation and request
for comments on a new NBD protocol extension, called
NBD_OPT_EXTENDED_HEADERS. With this in place, it will be possible for
clients to request 64-bit zero, trim, cache, and block status
operations when supported by the server.
Not yet complete: an implementation of this in nbdkit. I also plan to
tweak libnbd's 'nbdinfo --map' and 'nbdcopy' to take advantage of the
larger block status results. Also, with 64-bit commands, we may want
to also make it easier to let servers advertise an actual maximum size
they are willing to accept for the commands in question (for example,
a server may be happy with a full 64-bit block status, but still want
to limit non-fast zero and cache to a smaller limit to avoid denial of
service).
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
2 years, 1 month
[p2v PATCH 0/2] fix the spinner widget in the Live environment
by Laszlo Ersek
Recently we've made GTK3 the sole GTK option; with that, the spinner
widget is not displayed in the Live environment any more, at least when
said environment is built on Fedora 35. It turns out we've been missing
an obscure dependency.
Laszlo
Laszlo Ersek (2):
Makefile.am: rectify target dependencies on package dependency files
dependencies.m4: add librsvg2
Makefile.am | 4 ++--
dependencies.m4 | 5 +++++
2 files changed, 7 insertions(+), 2 deletions(-)
2 years, 2 months
[v2v PATCH] convert_linux: include the BOCHS DRM driver in the initial ram disk
by Laszlo Ersek
UEFI RHEL-7 guests cannot be successfully converted from VMWare without
including the BOCHS DRM driver -- Plymouth ("rhgb") crashes during early
boot in the converted domain.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2131123
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
---
convert/convert_linux.ml | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml
index b8e9ad15e22d..5bfdac5aa6d9 100644
--- a/convert/convert_linux.ml
+++ b/convert/convert_linux.ml
@@ -731,8 +731,13 @@ let convert (g : G.guestfs) source inspect keep_serial_console _ =
match kernel.ki_initrd with
| None -> ()
| Some initrd ->
- (* Enable the basic virtio modules in the kernel. *)
- (* Also forcibly include the "xts" module; see RHBZ#1658126. *)
+ (* Enable the basic virtio modules in the kernel.
+ *
+ * Also forcibly include the "xts" module; see RHBZ#1658126.
+ *
+ * Include the BOCHS DRM paravirt video driver; see RHBZ#2131123. This
+ * driver is known under two names -- "bochs-drm" and "bochs".
+ *)
let modules =
let modules =
(* The order of modules here is deliberately the same as the
@@ -743,7 +748,8 @@ let convert (g : G.guestfs) source inspect keep_serial_console _ =
*)
List.filter (fun m -> List.mem m kernel.ki_modules)
[ "virtio"; "virtio_ring"; "virtio_blk";
- "virtio_scsi"; "virtio_net"; "virtio_pci"; "xts" ] in
+ "virtio_scsi"; "virtio_net"; "virtio_pci"; "xts";
+ "bochs-drm"; "bochs" ] in
if modules <> [] then modules
else
(* Fallback copied from old virt-v2v. XXX Why not "ide"? *)
2 years, 2 months
[libnbd PATCH] RFC: generator: Mark APIs with allocator/deallocator semantics
by Eric Blake
Modern GCC has two related attributes for functions returning a
pointer:
__attribute__((__malloc__)) - this function returns a new pointer, not
aliased to any existing pointer
__attribute__((__malloc__(fn,1))) - call fn(return_value) to avoid
leaking memory allocated by this function
With those attributes, static analyzers can better detect when we pass
the resulting pointer to the wrong deallocator, deallocate more than
once, have a use after free, or otherwise leak the memory. (Sadly, as
of gcc 12.2.1, -fanalyzer still has a LOT of false positives, such as:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107100; since our code
base triggers some of these, we can't quite rely on it yet).
---
lib/internal.h | 4 +++-
generator/C.ml | 24 +++++++++++++++++++++---
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/lib/internal.h b/lib/internal.h
index 0e17fbea..22f500b4 100644
--- a/lib/internal.h
+++ b/lib/internal.h
@@ -508,8 +508,10 @@ extern void nbd_internal_fork_safe_perror (const char *s)
extern char *nbd_internal_printable_buffer (const void *buf, size_t count)
LIBNBD_ATTRIBUTE_NONNULL(1);
extern char *nbd_internal_printable_string (const char *str)
+ LIBNBD_ATTRIBUTE_ALLOC_DEALLOC(free)
LIBNBD_ATTRIBUTE_NONNULL(1);
-extern char *nbd_internal_printable_string_list (char **list);
+extern char *nbd_internal_printable_string_list (char **list)
+ LIBNBD_ATTRIBUTE_ALLOC_DEALLOC(free);
/* These are wrappers around socket(2) and socketpair(2). They
* always set SOCK_CLOEXEC. nbd_internal_socket can set SOCK_NONBLOCK
diff --git a/generator/C.ml b/generator/C.ml
index c74fae77..cfa2964c 100644
--- a/generator/C.ml
+++ b/generator/C.ml
@@ -244,6 +244,16 @@ let
pr "extern ";
print_call ?wrap ?closure_style name args optargs ret;
+ (* For RString, note that the caller must free() the argument.
+ * Since this is used in a public header, we must use gcc's spelling
+ * of __builtin_free in case bare free is defined as a macro.
+ *)
+ (match ret with
+ | RString ->
+ pr "\n LIBNBD_ATTRIBUTE_ALLOC_DEALLOC(__builtin_free)";
+ | _ -> ()
+ );
+
(* Output __attribute__((nonnull)) for the function parameters:
* eg. struct nbd_handle *, int, char *
* => [ true, false, true ]
@@ -403,6 +413,13 @@ let
pr "#endif\n";
pr "#endif /* ! defined LIBNBD_ATTRIBUTE_NONNULL */\n";
pr "\n";
+ pr "#if defined(__GNUC__) && LIBNBD_GCC_VERSION >= 120000 /* gcc >= 12.0 */\n";
+ pr "#define LIBNBD_ATTRIBUTE_ALLOC_DEALLOC(fn) \\\n";
+ pr " __attribute__((__malloc__, __malloc__(fn, 1)))\n";
+ pr "#else\n";
+ pr "#define LIBNBD_ATTRIBUTE_ALLOC_DEALLOC(fn)\n";
+ pr "#endif\n";
+ pr "\n";
pr "struct nbd_handle;\n";
pr "\n";
List.iter (
@@ -433,12 +450,13 @@ let
pr "#define %-40s %d\n" n i
) constants;
pr "\n";
- pr "extern struct nbd_handle *nbd_create (void);\n";
- pr "#define LIBNBD_HAVE_NBD_CREATE 1\n";
- pr "\n";
pr "extern void nbd_close (struct nbd_handle *h); /* h can be NULL */\n";
pr "#define LIBNBD_HAVE_NBD_CLOSE 1\n";
pr "\n";
+ pr "extern struct nbd_handle *nbd_create (void)\n";
+ pr " LIBNBD_ATTRIBUTE_ALLOC_DEALLOC(nbd_close);\n";
+ pr "#define LIBNBD_HAVE_NBD_CREATE 1\n";
+ pr "\n";
pr "extern const char *nbd_get_error (void);\n";
pr "#define LIBNBD_HAVE_NBD_GET_ERROR 1\n";
pr "\n";
--
2.37.3
2 years, 2 months
another GTK3 regression...
by Laszlo Ersek
(this reproduces at commit 0687cea6a86e; IOW the regression is not from
the recent GTK-related patches, but due to building p2v with GTK3. as
opposed to GTK2)
In the first dialog, when the Test Connection button is clicked, a
spinner is supposed to be shown to the left, while p2v communicates via
v2v over ssh. This spinner is seen when running virt-p2v directly, but
not when running virt-p2v from a VM (using either a Live CD, or the
"run-virt-p2v-in-a-vm" makefile target).
This difference is not seen when virt-p2v is built with GTK2; in that
case, *both* scenarios (direct & VM) show the spinner properly.
I don't have an idea what the cause is. I vaguely suspect it could be
related to the windowing environment (window manager) in use. It pretty
much looks like a GTK3 bug to me; whatever the windowing environment,
the spinner should either be there or not. (It's possible that we have a
virt-p2v bug, of course, but why isn't the symptom consistent then? GTK3
should not have a dependency at all on the Window Manager.)
Laszlo
2 years, 2 months
[PATCH nbdkit] rust: Drop box ptr
by Richard W.M. Jones
This isn't a complete fix. There's still this error when running the
tests. I don't understand which expect function it's complaining
about. One generated by the MockServer?
----------------------------------------------------------------------
warning: the cargo feature `resolver` has been stabilized in the 1.51 release and is no longer necessary to be listed in the manifest
See https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions for more information about using this feature.
Compiling nbdkit v0.2.0 (/home/rjones/d/nbdkit/plugins/rust)
error: associated function `expect` is never used
--> tests/common/mod.rs:49:1
|
49 | / mock!{
50 | | pub Server {}
51 | | impl Server for Server {
52 | | fn cache(&self, count: u32, offset: u64) -> Result<()>;
... |
86 | | }
87 | | }
| |_^
|
= note: `-D dead-code` implied by `-D warnings`
error: could not compile `nbdkit` due to previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `nbdkit` due to previous error
FAIL test.sh (exit status: 101)
----------------------------------------------------------------------
Rich.
2 years, 2 months