Philippe Midol-Monnet
2023-Jun-20 12:09 UTC
[Libguestfs] [PATCH] Add partprobe call in the API
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.* *As data controller, EasyMile processes personal data, in compliance with the European GDPR (EU) 2016/679 of 27 April 2016. To exercise your rights, you can contact EasyMile at?privacy at easymile.com, and if necessary, you may contact the local competent supervisory authority.?* *Cet e-mail et toute pi?ce jointe contiennent des informations confidentielles d'EasyMile et ne doivent pas ?tre modifi?s ou diffus?s sans le consentement ?crit pr?alable d'EasyMile. Ils sont destin?s exclusivement ? leur destinataire.s. Si vous avez re?u ce message par erreur, veuillez nous en informer rapidement et supprimer imm?diatement cet e-mail et toutes ses pi?ces jointes.??* *En tant que responsable de traitement, EasyMile traite des donn?es personnelles, conform?ment au RGPD europ?en (UE) 2016/679 du 27 avril 2016. Pour exercer vos droits, vous pouvez contacter EasyMile ?? privacy at easymile.com <mailto:privacy at easymile.com>, et si n?cessaire, vous pouvez contacter l'autorit? de contr?le locale comp?tente.* -------------- next part -------------- A non-text attachment was scrubbed... Name: partprobe.patch Type: text/x-patch Size: 1930 bytes Desc: not available URL: <http://listman.redhat.com/archives/libguestfs/attachments/20230620/89ced753/attachment.bin>
Richard W.M. Jones
2023-Jun-20 12:30 UTC
[Libguestfs] [PATCH] Add partprobe call in the API
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 > +514The 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