Add support for nbd+unix:// URIs

resolves: RHEL-33851
This commit is contained in:
Richard W.M. Jones 2024-04-24 16:15:12 +01:00
parent 8295920bc2
commit 1574b7d34d
8 changed files with 238 additions and 3 deletions

View File

@ -0,0 +1,44 @@
From 62e0172825304e3abe8e917d12bc5e5cb45b76cd Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 19 Jan 2024 13:18:00 +0000
Subject: [PATCH] generator/customize.ml: Split --chown parameter on ':'
character
The previous code split it on ',' which was completely wrong.
(It reveals the lack of testing however).
Fixes: commit c08032ebe2763f5e9ce5b14e003721475219d390
Reported-by: Yongkui Guo
(cherry picked from commit e9a728bb22dfa1de5328fbbe7d6d7acad2dbed64)
---
common | 2 +-
generator/customize.ml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Submodule common 0dba002c..54869c98:
diff --git a/common/mlcustomize/customize_cmdline.ml b/common/mlcustomize/customize_cmdline.ml
index 245d9960..48ee3344 100644
--- a/common/mlcustomize/customize_cmdline.ml
+++ b/common/mlcustomize/customize_cmdline.ml
@@ -157,7 +157,7 @@ let rec argspec () =
let len = String.length arg in
String.sub arg 0 i, String.sub arg (i+1) (len-(i+1))
and split_string_triplet option_name arg =
- match String.nsplit ~max:3 "," arg with
+ match String.nsplit ~max:3 ":" arg with
| [a; b; c] -> a, b, c
| _ ->
error (f_"invalid format for '--%s' parameter, see the man page")
diff --git a/generator/customize.ml b/generator/customize.ml
index e64b45c0..e2c4b605 100644
--- a/generator/customize.ml
+++ b/generator/customize.ml
@@ -775,7 +775,7 @@ let rec argspec () =
let len = String.length arg in
String.sub arg 0 i, String.sub arg (i+1) (len-(i+1))
and split_string_triplet option_name arg =
- match String.nsplit ~max:3 \",\" arg with
+ match String.nsplit ~max:3 \":\" arg with
| [a; b; c] -> a, b, c
| _ ->
error (f_\"invalid format for '--%%s' parameter, see the man page\")

View File

@ -0,0 +1,24 @@
From fad637f859e89a8110c353fe26029de818d369f1 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 7 Mar 2024 14:17:45 +0000
Subject: [PATCH] daemon: parted: Print field we are extracting in error
message
(cherry picked from commit c8cefa6f0f11dc813e6f881799694da0916e1831)
---
daemon/parted.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/daemon/parted.ml b/daemon/parted.ml
index 8280ef32..e0ca7a60 100644
--- a/daemon/parted.ml
+++ b/daemon/parted.ml
@@ -173,7 +173,7 @@ let sgdisk_info_extract_field device partnum field extractor =
commandr ~fold_stdout_on_stderr:true
"sgdisk" [ device; "-i"; string_of_int partnum ] in
if r <> 0 then
- failwithf "sgdisk: %s" err;
+ failwithf "getting %S: sgdisk: %s" field err;
udev_settle ();

View File

@ -0,0 +1,24 @@
From 25adec46d2b2042aa8c58b8c6103a9aa195d046a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 12 Mar 2024 14:08:03 +0000
Subject: [PATCH] python: Fix exception name in example
Fixes: https://github.com/libguestfs/libguestfs/issues/138
(cherry picked from commit 1d760b0d8ffc4229738e86cda9559a057439a161)
---
python/examples/guestfs-python.pod | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/python/examples/guestfs-python.pod b/python/examples/guestfs-python.pod
index 03ff2ba8..6bd420db 100644
--- a/python/examples/guestfs-python.pod
+++ b/python/examples/guestfs-python.pod
@@ -29,7 +29,7 @@ In a future version of libguestfs, this will become the default.
=head2 EXCEPTIONS
-Errors from libguestfs functions are mapped into C<RuntimeException>
+Errors from libguestfs functions are mapped into C<RuntimeError>
with a single string argument which is the error message.
=head2 MORE DOCUMENTATION

View File

@ -0,0 +1,28 @@
From 21d7687521e611a243f9f217b8de799452dff260 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 4 Apr 2024 09:28:43 +0100
Subject: [PATCH] po-docs: Rename guestfs-release-notes-historical to
guestfs-release-notes
This was missed from earlier commit 25ddaefb03 ("docs: Recreate
guestfs-release-notes(1) page").
Fixes: commit 25ddaefb03f1a7364a71a71a2ba4a6a99e1bad48
(cherry picked from commit d8297785298cfe0b222f8f7d8c43c5405f1d861a)
---
po-docs/language.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/po-docs/language.mk b/po-docs/language.mk
index 2d5f0fef..4c2a5595 100644
--- a/po-docs/language.mk
+++ b/po-docs/language.mk
@@ -61,7 +61,7 @@ MANPAGES = \
guestfs-release-notes-1.8.1 \
guestfs-release-notes-1.6.1 \
guestfs-release-notes-1.4.1 \
- guestfs-release-notes-historical.1 \
+ guestfs-release-notes.1 \
guestfs-ruby.3 \
guestfs-security.1 \
guestfs-testing.1 \

View File

@ -0,0 +1,40 @@
From e1ee1fb65798777287ae7722b9391969623da97f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 4 Apr 2024 09:38:28 +0100
Subject: [PATCH] po-docs: Run po4a-translate and sed commands separately
I noticed that 1-byte translated POD files were being generated in the
output directory (po-docs/ja/). This seems to have happened because
po4a-translate was generating an error, but because we were
immediately pipeing the output into sed the error was suppressed.
By running them as two separate commands this cannot happen.
Fixes: commit bd896d68c06d7f66303bd77daa666367b0de5f3a
(cherry picked from commit d755070346c0498672517c844d7ced52e9263197)
---
po-docs/language.mk | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/po-docs/language.mk b/po-docs/language.mk
index 4c2a5595..9fdb4c2f 100644
--- a/po-docs/language.mk
+++ b/po-docs/language.mk
@@ -179,13 +179,16 @@ virt-p2v.1: virt-p2v.pod virt-p2v-kernel-config.pod
# Remove both.
# XXX Fix po4a so it doesn't do this.
%.pod: $(srcdir)/../$(LINGUA).po
+ rm -f $@ $@-t
$(guestfs_am_v_po4a_translate)$(PO4A_TRANSLATE) \
-f pod \
-M utf-8 -L utf-8 \
-k 0 \
-m $(top_srcdir)/$(shell grep '/$(notdir $@)$$' $(top_srcdir)/po-docs/podfiles) \
-p $< \
- | $(SED) '0,/^=encoding/d' > $@
+ -l $@-t
+ $(SED) '0,/^=encoding/d' < $@-t > $@
+ rm $@-t
# XXX Can automake do this properly?
install-data-hook:

View File

@ -0,0 +1,65 @@
From 55810672dedbabf40938519eb37d7a470c28ea6a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 24 Apr 2024 12:23:34 +0100
Subject: [PATCH] Update common submodule
In particular pick this:
commit 93a7f3af5c23ece6a8e092827ed5928a8973fd3c
Author: Richard W.M. Jones <rjones@redhat.com>
Date: Wed Apr 24 12:08:01 2024 +0100
options: Allow nbd+unix:// URIs
(cherry picked from commit 7968de46f17eed7f18c200c6528ebdfec5c3f279)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 54869c98..93a7f3af:
diff --git a/common/options/uri.c b/common/options/uri.c
index 84d393c1..9180d6a2 100644
--- a/common/options/uri.c
+++ b/common/options/uri.c
@@ -99,7 +99,7 @@ is_uri (const char *arg)
return 0;
for (p--; p >= arg; p--) {
- if (!c_islower (*p))
+ if (! (c_islower (*p) || *p == '+'))
return 0;
}
@@ -148,7 +148,10 @@ parse (const char *arg, char **path_ret, char **protocol_ret,
}
*/
- *protocol_ret = strdup (uri->scheme);
+ if (STREQ (uri->scheme, "nbd+unix"))
+ *protocol_ret = strdup ("nbd");
+ else
+ *protocol_ret = strdup (uri->scheme);
if (*protocol_ret == NULL) {
perror ("strdup: protocol");
return -1;
@@ -194,7 +197,7 @@ parse (const char *arg, char **path_ret, char **protocol_ret,
if (path && path[0] == '/' &&
(STREQ (uri->scheme, "gluster") ||
STREQ (uri->scheme, "iscsi") ||
- STREQ (uri->scheme, "nbd") ||
+ STRPREFIX (uri->scheme, "nbd") ||
STREQ (uri->scheme, "rbd") ||
STREQ (uri->scheme, "sheepdog")))
path++;
diff --git a/common/progress/progress.c b/common/progress/progress.c
index e4b30663..5848abd7 100644
--- a/common/progress/progress.c
+++ b/common/progress/progress.c
@@ -123,6 +123,7 @@ progress_bar_init (unsigned flags)
bar->machine_readable = 1;
bar->utf8_mode = 0;
bar->have_terminfo = 0;
+ bar->fp = NULL;
} else {
bar->machine_readable = 0;

View File

@ -7,7 +7,7 @@ set -e
# ./copy-patches.sh
project=libguestfs
rhel_version=9.4
rhel_version=9.5
# Check we're in the right directory.
if [ ! -f $project.spec ]; then

View File

@ -45,7 +45,7 @@ Summary: Access and modify virtual machine disk images
Name: libguestfs
Epoch: 1
Version: 1.50.1
Release: 7%{?dist}
Release: 8%{?dist}
License: LGPLv2+
# Build only for architectures that have a kernel
@ -88,7 +88,7 @@ Source8: copy-patches.sh
Source9: libguestfs-common-1.50.1.tar.gz
# Patches are maintained in the following repository:
# https://github.com/libguestfs/libguestfs/commits/rhel-9.4
# https://github.com/libguestfs/libguestfs/commits/rhel-9.5
# Patches.
Patch0001: 0001-update-common-submodule.patch
@ -130,6 +130,12 @@ Patch0036: 0036-ocaml-Use-Gc.finalise-instead-of-a-C-finalizer.patch
Patch0037: 0037-ocaml-Nullify-custom-block-before-releasing-runtime-.patch
Patch0038: 0038-Update-common-submodule.patch
Patch0039: 0039-tests-Test-guestfish-key-all-.-selector.patch
Patch0040: 0040-generator-customize.ml-Split-chown-parameter-on-char.patch
Patch0041: 0041-daemon-parted-Print-field-we-are-extracting-in-error.patch
Patch0042: 0042-python-Fix-exception-name-in-example.patch
Patch0043: 0043-po-docs-Rename-guestfs-release-notes-historical-to-g.patch
Patch0044: 0044-po-docs-Run-po4a-translate-and-sed-commands-separate.patch
Patch0045: 0045-Update-common-submodule.patch
%if 0%{patches_touch_autotools}
BuildRequires: autoconf, automake, libtool, gettext-devel
@ -1143,6 +1149,10 @@ rm ocaml/html/.gitignore
%changelog
* Wed Apr 24 2024 Richard W.M. Jones <rjones@redhat.com> - 1:1.50.1-8
- Add support for nbd+unix:// URIs
resolves: RHEL-33851
* Thu Dec 14 2023 Richard W.M. Jones <rjones@redhat.com> - 1:1.50.1-7
- Add --key all:... selector
resolves: RHEL-19367