On Tue, Jun 20, 2023 at 02:09:36PM +0200, Philippe Midol-Monnet wrote:
Hello
We are using libguestfs with nested partitions: One partition
encrypted with LUKS include a GPT and several partition.
In order to make the nested partition available to the system after
the cryptsetup-open, partprobe need to be run.
I guess it is true for all kind of nested partitions (encrypted or not).
This patch add a partprobe call in the API.
Regards
Philippe
--
*This email and any attachment contains EasyMile’s confidential
information, and must not be modified or circulated without
EasyMile’s prior written consent. It is intended exclusively for
their recipient.s. If you received this message by mistake, please
notify us promptly and immediately delete this email and any of its
attachments.*
(You might want to change this warning, as it may prevent us from
including this code upstream ...)
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index bb2e58d01..8c34f3634 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -164,6 +164,7 @@ guestfsd_SOURCES = \
optgroups.c \
optgroups.h \
parted.c \
+ partprobe.c \
pingdaemon.c \
proto.c \
readdir.c \
diff --git a/docs/C_SOURCE_FILES b/docs/C_SOURCE_FILES
index 7a20e5594..0e845dcec 100644
--- a/docs/C_SOURCE_FILES
+++ b/docs/C_SOURCE_FILES
@@ -125,6 +125,7 @@ daemon/ntfsclone.c
daemon/optgroups.c
daemon/optgroups.h
daemon/parted.c
+daemon/partprobe.c
daemon/pingdaemon.c
daemon/proto.c
daemon/readdir.c
diff --git a/generator/actions_core.ml b/generator/actions_core.ml
index addbe4ec1..f63065426 100644
--- a/generator/actions_core.ml
+++ b/generator/actions_core.ml
@@ -5110,6 +5110,16 @@ partition table), C<gpt> (a GPT/EFI-style partition table).
Other
values are possible, although unusual. See C<guestfs_part_init>
for a full list." };
+ { defaults with
+ name = "partprobe"; added = (1, 0, 54);
This should be the next version, ie. (1, 51, 4)
+ style = RErr, [String (Device, "device")], [];
+ tests = [];
+ shortdesc = "run partprobe";
+ longdesc = "\
+This command runs the C<partprobe> on a device in order to inform
+the OS of partition table change
+usage for C<path>.It is neede in case of nested partition."};
+
{ defaults with
name = "fill"; added = (1, 0, 79);
style = RErr, [Int "c"; Int "len"; String (Pathname,
"path")], [];
diff --git a/generator/proc_nr.ml b/generator/proc_nr.ml
index f71a849c9..342ba6e82 100644
--- a/generator/proc_nr.ml
+++ b/generator/proc_nr.ml
@@ -516,6 +516,7 @@ let proc_nr = [
511, "internal_readdir";
512, "clevis_luks_unlock";
513, "inspect_get_build_id";
+514, "partprobe";
]
(* End of list. If adding a new entry, add it at the end of the list
diff --git a/lib/MAX_PROC_NR b/lib/MAX_PROC_NR
index 31cf34b8d..a08796291 100644
--- a/lib/MAX_PROC_NR
+++ b/lib/MAX_PROC_NR
@@ -1 +1 @@
-513
+514
The patch is fine as far as it goes, but you'll need to include the
new partprobe.c file :-)
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
nbdkit - Flexible, fast NBD server with plugins
https://gitlab.com/nbdkit/nbdkit