[Libguestfs] [libguestfs PATCH 3/3] guestfish, guestmount: enable networking for "--key ID:clevis"

Laszlo Ersek lersek at redhat.com
Tue Jun 28 11:54:18 UTC 2022


Call the C-language helper key_store_requires_network() in guestfish and
guestmount.

(Short log for the "common" submodule, commit range
35b49ce142fb..0399dea30e63:

Laszlo Ersek (11):
      options: fix UUID comparison logic bug in get_keys()
      mltools/tools_utils: remove unused function "key_store_to_cli"
      mltools/tools_utils: allow multiple "--key" options for OCaml tools too
      options: replace NULL-termination with number-of-elements in get_keys()
      options: wrap each passphrase from get_keys() into a struct
      options: add back-end for LUKS decryption with Clevis+Tang
      options: introduce selector tpe "key_clevis"
      options: generalize "--key" selector parsing for C-language utilities
      mltools/tools_utils: generalize "--key" selector parsing for OCaml utils
      options, mltools/tools_utils: parse "--key ID:clevis" options
      options, mltools/tools_utils: add helper for network dependency
).

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1809453
Signed-off-by: Laszlo Ersek <lersek at redhat.com>
---

Notes:
    The submodule commit range 35b49ce142fb..0399dea30e63 needs to be
    refreshed in both the commit message and the "common" hunk, once the
    libguestfs-common series is upstream.

 fish/fish.c       | 3 +++
 fuse/guestmount.c | 4 ++++
 common            | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/fish/fish.c b/fish/fish.c
index 23d9bb94f3a4..19e3d2799e84 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -474,10 +474,13 @@ main (int argc, char *argv[])
   CHECK_OPTION_blocksize_consumed;
 
   /* If we've got drives to add, add them now. */
   add_drives (drvs);
 
+  if (key_store_requires_network (ks) && guestfs_set_network (g, 1) == -1)
+    exit (EXIT_FAILURE);
+
   /* If we've got mountpoints or prepared drives or -i option, we must
    * launch the guest and mount them.
    */
   if (next_prepared_drive > 1 || mps != NULL || inspector) {
     /* RHBZ#612178: If --listen flag is given, then we will fork into
diff --git a/fuse/guestmount.c b/fuse/guestmount.c
index 77c534828fcd..3c6d57bde0d6 100644
--- a/fuse/guestmount.c
+++ b/fuse/guestmount.c
@@ -346,10 +346,14 @@ main (int argc, char *argv[])
   if (guestfs_set_recovery_proc (g, !do_fork) == -1)
     exit (EXIT_FAILURE);
 
   /* Do the guest drives and mountpoints. */
   add_drives (drvs);
+
+  if (key_store_requires_network (ks) && guestfs_set_network (g, 1) == -1)
+    exit (EXIT_FAILURE);
+
   if (guestfs_launch (g) == -1)
     exit (EXIT_FAILURE);
   if (inspector)
     inspect_mount ();
   mount_mps (mps);
diff --git a/common b/common
index 35b49ce142fb..0399dea30e63 160000
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 35b49ce142fb906bcf91edc6a6718d28c8fca9e3
+Subproject commit 0399dea30e6353870183a07a82d05b4ec8f20ca0
-- 
2.19.1.3.g30247aa5d201



More information about the Libguestfs mailing list