Rebase to libguestfs 1.54.0
resolves: RHEL-56810
This commit is contained in:
parent
9794220812
commit
bd8b34e6b3
@ -1,657 +0,0 @@
|
||||
From 1638cd9e58161147bd2f440b6e28bf7365fc5688 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Fri, 10 May 2024 13:27:22 +0100
|
||||
Subject: [PATCH] daemon: Reimplement partition GPT functions using sfdisk
|
||||
|
||||
sfdisk can now do everything with GPT that sgdisk was needed for
|
||||
before. In particular we are able to reimplement the following
|
||||
functions using sfdisk:
|
||||
|
||||
- part_set_disk_guid (replace with sfdisk --disk-id)
|
||||
- part_get_disk_guid
|
||||
- part_set_disk_guid_random
|
||||
- part_set_gpt_attributes (sfdisk --part-attrs)
|
||||
- part_get_gpt_attributes
|
||||
- part_set_gpt_guid (sfdisk --part-uuid)
|
||||
- part_get_gpt_guid
|
||||
- part_set_gpt_type (sfdisk --part-type)
|
||||
- part_get_gpt_type
|
||||
|
||||
This allows us to drop the requirement for gdisk in many cases.
|
||||
|
||||
There is only one API remaining which requires gdisk, part_expand_gpt,
|
||||
which we do not use in our tools. In a prior commit I already moved
|
||||
this solitary function to a new source file (daemon/gdisk.c).
|
||||
|
||||
Fixes: https://issues.redhat.com/browse/RHEL-35998
|
||||
(cherry picked from commit c6c266a85d76dc2db90460202415790c585ac625)
|
||||
---
|
||||
.gitignore | 1 +
|
||||
daemon/Makefile.am | 3 +
|
||||
daemon/inspect_fs_windows.ml | 2 +-
|
||||
daemon/listfs.ml | 2 +-
|
||||
daemon/parted.c | 144 -----------------------------
|
||||
daemon/parted.ml | 92 +------------------
|
||||
daemon/sfdisk.ml | 172 +++++++++++++++++++++++++++++++++++
|
||||
generator/actions_core.ml | 24 ++---
|
||||
8 files changed, 189 insertions(+), 251 deletions(-)
|
||||
create mode 100644 daemon/sfdisk.ml
|
||||
|
||||
diff --git a/.gitignore b/.gitignore
|
||||
index 00e59fb37..2fc52e843 100644
|
||||
--- a/.gitignore
|
||||
+++ b/.gitignore
|
||||
@@ -108,6 +108,7 @@ Makefile.in
|
||||
/daemon/parted.mli
|
||||
/daemon/realpath.mli
|
||||
/daemon/rpm.mli
|
||||
+/daemon/sfdisk.mli
|
||||
/daemon/stamp-guestfsd.pod
|
||||
/daemon/statvfs.mli
|
||||
/daemon/structs-cleanups.c
|
||||
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
|
||||
index 04370b7cd..bc74b6ef7 100644
|
||||
--- a/daemon/Makefile.am
|
||||
+++ b/daemon/Makefile.am
|
||||
@@ -59,6 +59,7 @@ generator_built = \
|
||||
parted.mli \
|
||||
realpath.mli \
|
||||
rpm.mli \
|
||||
+ sfdisk.mli \
|
||||
statvfs.mli \
|
||||
structs.ml \
|
||||
structs.mli
|
||||
@@ -306,6 +307,7 @@ SOURCES_MLI = \
|
||||
parted.mli \
|
||||
realpath.mli \
|
||||
rpm.mli \
|
||||
+ sfdisk.mli \
|
||||
statvfs.mli \
|
||||
structs.mli \
|
||||
sysroot.mli \
|
||||
@@ -337,6 +339,7 @@ SOURCES_ML = \
|
||||
md.ml \
|
||||
mount.ml \
|
||||
mount_utils.ml \
|
||||
+ sfdisk.ml \
|
||||
parted.ml \
|
||||
listfs.ml \
|
||||
realpath.ml \
|
||||
diff --git a/daemon/inspect_fs_windows.ml b/daemon/inspect_fs_windows.ml
|
||||
index 5d29c3a46..6537481e1 100644
|
||||
--- a/daemon/inspect_fs_windows.ml
|
||||
+++ b/daemon/inspect_fs_windows.ml
|
||||
@@ -419,7 +419,7 @@ and map_registry_disk_blob_gpt partitions blob =
|
||||
let typ = Parted.part_get_parttype device in
|
||||
if typ <> "gpt" then false
|
||||
else (
|
||||
- let guid = Parted.part_get_gpt_guid device partnum in
|
||||
+ let guid = Sfdisk.part_get_gpt_guid device partnum in
|
||||
String.lowercase_ascii guid = blob_guid
|
||||
)
|
||||
) partitions in
|
||||
diff --git a/daemon/listfs.ml b/daemon/listfs.ml
|
||||
index 4cc3c437a..93c1e7145 100644
|
||||
--- a/daemon/listfs.ml
|
||||
+++ b/daemon/listfs.ml
|
||||
@@ -114,7 +114,7 @@ and is_partition_can_hold_filesystem partition =
|
||||
else if is_mbr then
|
||||
true
|
||||
else (
|
||||
- let gpt_type = Parted.part_get_gpt_type device partnum in
|
||||
+ let gpt_type = Sfdisk.part_get_gpt_type device partnum in
|
||||
match gpt_type with
|
||||
(* Windows Logical Disk Manager metadata partition. *)
|
||||
| "5808C8AA-7E8F-42E0-85D2-E1E90434CFB3"
|
||||
diff --git a/daemon/parted.c b/daemon/parted.c
|
||||
index 9af5556c9..0f19baae5 100644
|
||||
--- a/daemon/parted.c
|
||||
+++ b/daemon/parted.c
|
||||
@@ -456,58 +456,6 @@ do_part_set_mbr_id (const char *device, int partnum, int idbyte)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-int
|
||||
-do_part_set_gpt_type (const char *device, int partnum, const char *guid)
|
||||
-{
|
||||
- if (partnum <= 0) {
|
||||
- reply_with_error ("partition number must be >= 1");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- CLEANUP_FREE char *typecode = NULL;
|
||||
- if (asprintf (&typecode, "%i:%s", partnum, guid) == -1) {
|
||||
- reply_with_perror ("asprintf");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- CLEANUP_FREE char *err = NULL;
|
||||
- int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
|
||||
- "sgdisk", device, "-t", typecode, NULL);
|
||||
-
|
||||
- if (r == -1) {
|
||||
- reply_with_error ("%s %s -t %s: %s", "sgdisk", device, typecode, err);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-int
|
||||
-do_part_set_gpt_guid (const char *device, int partnum, const char *guid)
|
||||
-{
|
||||
- if (partnum <= 0) {
|
||||
- reply_with_error ("partition number must be >= 1");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- CLEANUP_FREE char *typecode = NULL;
|
||||
- if (asprintf (&typecode, "%i:%s", partnum, guid) == -1) {
|
||||
- reply_with_perror ("asprintf");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- CLEANUP_FREE char *err = NULL;
|
||||
- int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
|
||||
- "sgdisk", device, "-u", typecode, NULL);
|
||||
-
|
||||
- if (r == -1) {
|
||||
- reply_with_error ("%s %s -u %s: %s", "sgdisk", device, typecode, err);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
char *
|
||||
do_part_get_name (const char *device, int partnum)
|
||||
{
|
||||
@@ -564,95 +512,3 @@ do_part_get_name (const char *device, int partnum)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
-
|
||||
-static char *
|
||||
-extract_uuid (const char *value)
|
||||
-{
|
||||
- /* The value contains only valid GUID characters */
|
||||
- const size_t value_len = strspn (value, "-0123456789ABCDEF");
|
||||
-
|
||||
- char *ret = malloc (value_len + 1);
|
||||
- if (ret == NULL) {
|
||||
- reply_with_perror ("malloc");
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- memcpy (ret, value, value_len);
|
||||
- ret[value_len] = '\0';
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
-char *
|
||||
-do_part_get_disk_guid (const char *device)
|
||||
-{
|
||||
- const char *pattern = "Disk identifier (GUID):";
|
||||
- size_t i;
|
||||
-
|
||||
- CLEANUP_FREE char *err = NULL;
|
||||
- int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
|
||||
- "sgdisk", device, "-p", NULL);
|
||||
- if (r == -1) {
|
||||
- reply_with_error ("%s %s -p: %s", "sgdisk", device, err);
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- CLEANUP_FREE_STRING_LIST char **lines = split_lines (err);
|
||||
- if (lines == NULL) {
|
||||
- reply_with_error ("'%s %s -p' returned no output",
|
||||
- "sgdisk", device);
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- for (i = 0; lines[i] != NULL; ++i) {
|
||||
- if (STRPREFIX (lines[i], pattern)) {
|
||||
- char *value = lines[i] + strlen (pattern);
|
||||
-
|
||||
- /* Skip any leading whitespace */
|
||||
- value += strspn (value, " \t");
|
||||
-
|
||||
- /* Extract the actual information from the field. */
|
||||
- char *ret = extract_uuid (value);
|
||||
- if (ret == NULL) {
|
||||
- /* The extraction function already sends the error. */
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- return ret;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /* If we got here it means we didn't find the field */
|
||||
- reply_with_error ("sgdisk output did not contain disk GUID. "
|
||||
- "See LIBGUESTFS_DEBUG output for more details");
|
||||
- return NULL;
|
||||
-}
|
||||
-
|
||||
-int
|
||||
-do_part_set_disk_guid (const char *device, const char *guid)
|
||||
-{
|
||||
- CLEANUP_FREE char *err = NULL;
|
||||
- int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
|
||||
- "sgdisk", device, "-U", guid, NULL);
|
||||
-
|
||||
- if (r == -1) {
|
||||
- reply_with_error ("%s %s -U %s: %s", "sgdisk", device, guid, err);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-int
|
||||
-do_part_set_disk_guid_random (const char *device)
|
||||
-{
|
||||
- CLEANUP_FREE char *err = NULL;
|
||||
- int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
|
||||
- "sgdisk", device, "-U", "R", NULL);
|
||||
-
|
||||
- if (r == -1) {
|
||||
- reply_with_error ("%s %s -U R: %s", "sgdisk", device, err);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
diff --git a/daemon/parted.ml b/daemon/parted.ml
|
||||
index c9e55890b..f8f142bc5 100644
|
||||
--- a/daemon/parted.ml
|
||||
+++ b/daemon/parted.ml
|
||||
@@ -25,18 +25,6 @@ open Utils
|
||||
|
||||
include Structs
|
||||
|
||||
-let part_get_mbr_id device partnum =
|
||||
- if partnum <= 0 then
|
||||
- failwith "partition number must be >= 1";
|
||||
-
|
||||
- udev_settle ();
|
||||
- let out =
|
||||
- command "sfdisk" ["--part-type"; device; string_of_int partnum] in
|
||||
- udev_settle ();
|
||||
-
|
||||
- (* It's printed in hex, possibly with a leading space. *)
|
||||
- sscanf out " %x" identity
|
||||
-
|
||||
(* This is almost equivalent to print_partition_table in the C code. The
|
||||
* difference is that here we enforce the "BYT;" header internally.
|
||||
*)
|
||||
@@ -110,7 +98,7 @@ let part_get_parttype device =
|
||||
|
||||
let part_get_mbr_part_type device partnum =
|
||||
let parttype = part_get_parttype device in
|
||||
- let mbr_id = part_get_mbr_id device partnum in
|
||||
+ let mbr_id = Sfdisk.part_get_mbr_id device partnum in
|
||||
|
||||
(* 0x05 - extended partition.
|
||||
* 0x0f - extended partition using BIOS INT 13h extensions.
|
||||
@@ -120,81 +108,3 @@ let part_get_mbr_part_type device partnum =
|
||||
| "msdos", (1|2|3|4), _ -> "primary"
|
||||
| "msdos", _, _ -> "logical"
|
||||
| _, _, _ -> "primary"
|
||||
-
|
||||
-let part_set_gpt_attributes device partnum attributes =
|
||||
- if partnum <= 0 then failwith "partition number must be >= 1";
|
||||
-
|
||||
- udev_settle ();
|
||||
-
|
||||
- let arg = sprintf "%d:=:%LX" partnum attributes in
|
||||
- let r, _, err =
|
||||
- commandr ~fold_stdout_on_stderr:true
|
||||
- "sgdisk" [ device; "-A"; arg ] in
|
||||
- if r <> 0 then
|
||||
- failwithf "sgdisk: %s" err;
|
||||
-
|
||||
- udev_settle ()
|
||||
-
|
||||
-let extract_guid value =
|
||||
- (* The value contains only valid GUID characters. *)
|
||||
- String.sub value 0 (String.span value "-0123456789ABCDEF")
|
||||
-
|
||||
-let extract_hex value =
|
||||
- (* The value contains only valid numeric characters. *)
|
||||
- let str = String.sub value 0 (String.span value "0123456789ABCDEF") in
|
||||
- Int64.of_string ("0x" ^ str)
|
||||
-
|
||||
-let sgdisk_info_extract_field device partnum field extractor =
|
||||
- if partnum <= 0 then failwith "partition number must be >= 1";
|
||||
-
|
||||
- udev_settle ();
|
||||
-
|
||||
- let r, _, err =
|
||||
- commandr ~fold_stdout_on_stderr:true
|
||||
- "sgdisk" [ device; "-i"; string_of_int partnum ] in
|
||||
- if r <> 0 then
|
||||
- failwithf "getting %S: sgdisk: %s" field err;
|
||||
-
|
||||
- udev_settle ();
|
||||
-
|
||||
- let err = String.trim err in
|
||||
- let lines = String.nsplit "\n" err in
|
||||
-
|
||||
- (* Parse the output of sgdisk -i:
|
||||
- * Partition GUID code: 21686148-6449-6E6F-744E-656564454649 (BIOS boot partition)
|
||||
- * Partition unique GUID: 19AEC5FE-D63A-4A15-9D37-6FCBFB873DC0
|
||||
- * First sector: 2048 (at 1024.0 KiB)
|
||||
- * Last sector: 411647 (at 201.0 MiB)
|
||||
- * Partition size: 409600 sectors (200.0 MiB)
|
||||
- * Attribute flags: 0000000000000000
|
||||
- * Partition name: 'EFI System Partition'
|
||||
- *)
|
||||
- let field_len = String.length field in
|
||||
- let rec loop = function
|
||||
- | [] ->
|
||||
- failwithf "%s: sgdisk output did not contain '%s'" device field
|
||||
- | line :: _ when String.is_prefix line field &&
|
||||
- String.length line >= field_len + 2 &&
|
||||
- line.[field_len] = ':' ->
|
||||
- let value =
|
||||
- String.sub line (field_len+1) (String.length line - field_len - 1) in
|
||||
-
|
||||
- (* Skip any whitespace after the colon. *)
|
||||
- let value = String.triml value in
|
||||
-
|
||||
- (* Extract the value. *)
|
||||
- extractor value
|
||||
-
|
||||
- | _ :: lines -> loop lines
|
||||
- in
|
||||
- loop lines
|
||||
-
|
||||
-let rec part_get_gpt_type device partnum =
|
||||
- sgdisk_info_extract_field device partnum "Partition GUID code"
|
||||
- extract_guid
|
||||
-and part_get_gpt_guid device partnum =
|
||||
- sgdisk_info_extract_field device partnum "Partition unique GUID"
|
||||
- extract_guid
|
||||
-and part_get_gpt_attributes device partnum =
|
||||
- sgdisk_info_extract_field device partnum "Attribute flags"
|
||||
- extract_hex
|
||||
diff --git a/daemon/sfdisk.ml b/daemon/sfdisk.ml
|
||||
new file mode 100644
|
||||
index 000000000..2aea399aa
|
||||
--- /dev/null
|
||||
+++ b/daemon/sfdisk.ml
|
||||
@@ -0,0 +1,172 @@
|
||||
+(* guestfs-inspection
|
||||
+ * Copyright (C) 2009-2023 Red Hat Inc.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 2 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License along
|
||||
+ * with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *)
|
||||
+
|
||||
+open Scanf
|
||||
+open Printf
|
||||
+
|
||||
+open Std_utils
|
||||
+
|
||||
+open Utils
|
||||
+
|
||||
+include Structs
|
||||
+
|
||||
+let part_get_mbr_id device partnum =
|
||||
+ if partnum <= 0 then
|
||||
+ failwith "partition number must be >= 1";
|
||||
+
|
||||
+ udev_settle ();
|
||||
+ let out =
|
||||
+ command "sfdisk" ["--part-type"; device; string_of_int partnum] in
|
||||
+ udev_settle ();
|
||||
+
|
||||
+ (* It's printed in hex, possibly with a leading space. *)
|
||||
+ sscanf out " %x" identity
|
||||
+
|
||||
+let part_get_gpt_type device partnum =
|
||||
+ if partnum <= 0 then
|
||||
+ failwith "partition number must be >= 1";
|
||||
+
|
||||
+ udev_settle ();
|
||||
+ let out =
|
||||
+ command "sfdisk" ["--part-type"; device; string_of_int partnum] in
|
||||
+ udev_settle ();
|
||||
+
|
||||
+ String.trimr out
|
||||
+
|
||||
+let part_set_gpt_type device partnum typ =
|
||||
+ if partnum <= 0 then
|
||||
+ failwith "partition number must be >= 1";
|
||||
+
|
||||
+ udev_settle ();
|
||||
+ let cmd =
|
||||
+ sprintf "sfdisk --part-type %s %d %s"
|
||||
+ (quote device) partnum (quote typ) in
|
||||
+ if verbose () then eprintf "%s\n%!" cmd;
|
||||
+ if Sys.command cmd <> 0 then failwith "sfdisk --part-type failed";
|
||||
+ udev_settle ()
|
||||
+
|
||||
+let part_get_gpt_guid device partnum =
|
||||
+ if partnum <= 0 then
|
||||
+ failwith "partition number must be >= 1";
|
||||
+
|
||||
+ udev_settle ();
|
||||
+ let out =
|
||||
+ command "sfdisk" ["--part-uuid"; device; string_of_int partnum] in
|
||||
+ udev_settle ();
|
||||
+
|
||||
+ String.trimr out
|
||||
+
|
||||
+let part_set_gpt_guid device partnum guid =
|
||||
+ if partnum <= 0 then
|
||||
+ failwith "partition number must be >= 1";
|
||||
+
|
||||
+ udev_settle ();
|
||||
+ let cmd =
|
||||
+ sprintf "sfdisk --part-uuid %s %d %s"
|
||||
+ (quote device) partnum (quote guid) in
|
||||
+ if verbose () then eprintf "%s\n%!" cmd;
|
||||
+ if Sys.command cmd <> 0 then failwith "sfdisk --part-uuid failed";
|
||||
+ udev_settle ()
|
||||
+
|
||||
+let part_get_disk_guid device =
|
||||
+ udev_settle ();
|
||||
+ let out =
|
||||
+ command "sfdisk" ["--disk-id"; device] in
|
||||
+ udev_settle ();
|
||||
+
|
||||
+ String.trimr out
|
||||
+
|
||||
+let part_set_disk_guid device guid =
|
||||
+ udev_settle ();
|
||||
+ let cmd =
|
||||
+ sprintf "sfdisk --disk-id %s %s"
|
||||
+ (quote device) (quote guid) in
|
||||
+ if verbose () then eprintf "%s\n%!" cmd;
|
||||
+ if Sys.command cmd <> 0 then failwith "sfdisk --disk-id failed";
|
||||
+ udev_settle ()
|
||||
+
|
||||
+let part_set_disk_guid_random device =
|
||||
+ let random_uuid = Utils.get_random_uuid () in
|
||||
+ let random_uuid = String.trimr random_uuid in
|
||||
+ part_set_disk_guid device random_uuid
|
||||
+
|
||||
+let part_get_gpt_attributes device partnum =
|
||||
+ if partnum <= 0 then
|
||||
+ failwith "partition number must be >= 1";
|
||||
+
|
||||
+ udev_settle ();
|
||||
+ let out =
|
||||
+ command "sfdisk" ["--part-attrs"; device; string_of_int partnum] in
|
||||
+ udev_settle ();
|
||||
+
|
||||
+ (* The output is a whitespace-separated list of:
|
||||
+ * "RequiredPartition" (equivalent to bit 0)
|
||||
+ * "NoBlockIOProtocol" (equivalent to bit 1)
|
||||
+ * "LegacyBIOSBootable" (equivalent to bit 2)
|
||||
+ * "48", "49", ..., "63"
|
||||
+ *)
|
||||
+ let out = String.trimr out in
|
||||
+ let attrs = String.nsplit " " out in
|
||||
+ List.fold_left (
|
||||
+ fun bits attr ->
|
||||
+ let bit =
|
||||
+ match attr with
|
||||
+ | "" -> -1
|
||||
+ | "RequiredPartition" -> 0
|
||||
+ | "NoBlockIOProtocol" -> 1
|
||||
+ | "LegacyBIOSBootable" -> 2
|
||||
+ | n -> int_of_string n in
|
||||
+ if bit >= 0 then
|
||||
+ Int64.logor bits (Int64.shift_left 1_L bit)
|
||||
+ else
|
||||
+ bits
|
||||
+ ) 0_L attrs
|
||||
+
|
||||
+let part_set_gpt_attributes device partnum attrs =
|
||||
+ if partnum <= 0 then
|
||||
+ failwith "partition number must be >= 1";
|
||||
+
|
||||
+ (* The input to sfdisk --part-attrs is a comma-separated list of
|
||||
+ * attribute names or bit positions. Note you have to use the
|
||||
+ * names, you can't use "0", "1" or "2".
|
||||
+ *)
|
||||
+ let s = ref [] in
|
||||
+ let rec loop i =
|
||||
+ let b = Int64.logand attrs (Int64.shift_left 1_L i) <> Int64.zero in
|
||||
+ (match i with
|
||||
+ | 0 -> if b then List.push_front "RequiredPartition" s
|
||||
+ | 1 -> if b then List.push_front "NoBlockIOProtocol" s
|
||||
+ | 2 -> if b then List.push_front "LegacyBIOSBootable" s
|
||||
+ | i when i >= 3 && i <= 47 ->
|
||||
+ if b then
|
||||
+ failwith "bits 3..47 are reserved and cannot be set"
|
||||
+ | i when i >= 48 && i <= 63 ->
|
||||
+ if b then List.push_front (string_of_int i) s
|
||||
+ | _ -> assert false
|
||||
+ );
|
||||
+ if i < 63 then loop (i+1)
|
||||
+ in
|
||||
+ loop 0;
|
||||
+
|
||||
+ udev_settle ();
|
||||
+ let cmd =
|
||||
+ sprintf "sfdisk --part-attrs %s %d %s"
|
||||
+ (quote device) partnum (quote (String.concat "," !s)) in
|
||||
+ if verbose () then eprintf "%s\n%!" cmd;
|
||||
+ if Sys.command cmd <> 0 then failwith "sfdisk --part-attrs failed";
|
||||
+ udev_settle ()
|
||||
diff --git a/generator/actions_core.ml b/generator/actions_core.ml
|
||||
index 68627078f..46ef1422f 100644
|
||||
--- a/generator/actions_core.ml
|
||||
+++ b/generator/actions_core.ml
|
||||
@@ -5302,7 +5302,7 @@ See also C<guestfs_part_set_bootable>." };
|
||||
{ defaults with
|
||||
name = "part_get_mbr_id"; added = (1, 3, 2);
|
||||
style = RInt "idbyte", [String (Device, "device"); Int "partnum"], [];
|
||||
- impl = OCaml "Parted.part_get_mbr_id";
|
||||
+ impl = OCaml "Sfdisk.part_get_mbr_id";
|
||||
fish_output = Some FishOutputHexadecimal;
|
||||
tests = [
|
||||
InitEmpty, Always, TestResult (
|
||||
@@ -8128,7 +8128,7 @@ group with GUID C<diskgroup>." };
|
||||
{ defaults with
|
||||
name = "part_set_gpt_type"; added = (1, 21, 1);
|
||||
style = RErr, [String (Device, "device"); Int "partnum"; String (GUID, "guid")], [];
|
||||
- optional = Some "gdisk";
|
||||
+ impl = OCaml "Sfdisk.part_set_gpt_type";
|
||||
tests = [
|
||||
InitGPT, Always, TestLastFail (
|
||||
[["part_set_gpt_type"; "/dev/sda"; "1"; "f"]]), [];
|
||||
@@ -8150,8 +8150,7 @@ for a useful list of type GUIDs." };
|
||||
{ defaults with
|
||||
name = "part_get_gpt_type"; added = (1, 21, 1);
|
||||
style = RString (RPlainString, "guid"), [String (Device, "device"); Int "partnum"], [];
|
||||
- impl = OCaml "Parted.part_get_gpt_type";
|
||||
- optional = Some "gdisk";
|
||||
+ impl = OCaml "Sfdisk.part_get_gpt_type";
|
||||
tests = [
|
||||
InitGPT, Always, TestResultString (
|
||||
[["part_set_gpt_type"; "/dev/sda"; "1";
|
||||
@@ -8166,8 +8165,7 @@ Return the type GUID of numbered GPT partition C<partnum>." };
|
||||
{ defaults with
|
||||
name = "part_set_gpt_attributes"; added = (1, 21, 1);
|
||||
style = RErr, [String (Device, "device"); Int "partnum"; Int64 "attributes"], [];
|
||||
- impl = OCaml "Parted.part_set_gpt_attributes";
|
||||
- optional = Some "gdisk";
|
||||
+ impl = OCaml "Sfdisk.part_set_gpt_attributes";
|
||||
tests = [
|
||||
InitGPT, Always, TestResult (
|
||||
[["part_set_gpt_attributes"; "/dev/sda"; "1";
|
||||
@@ -8186,8 +8184,7 @@ for a useful list of partition attributes." };
|
||||
{ defaults with
|
||||
name = "part_get_gpt_attributes"; added = (1, 21, 1);
|
||||
style = RInt64 "attributes", [String (Device, "device"); Int "partnum"], [];
|
||||
- impl = OCaml "Parted.part_get_gpt_attributes";
|
||||
- optional = Some "gdisk";
|
||||
+ impl = OCaml "Sfdisk.part_get_gpt_attributes";
|
||||
tests = [
|
||||
InitGPT, Always, TestResult (
|
||||
[["part_set_gpt_attributes"; "/dev/sda"; "1";
|
||||
@@ -8987,7 +8984,7 @@ Recover bad superblocks from good copies." };
|
||||
{ defaults with
|
||||
name = "part_set_gpt_guid"; added = (1, 29, 25);
|
||||
style = RErr, [String (Device, "device"); Int "partnum"; String (GUID, "guid")], [];
|
||||
- optional = Some "gdisk";
|
||||
+ impl = OCaml "Sfdisk.part_set_gpt_guid";
|
||||
tests = [
|
||||
InitGPT, Always, TestLastFail (
|
||||
[["part_set_gpt_guid"; "/dev/sda"; "1"; "f"]]), [];
|
||||
@@ -9006,8 +9003,7 @@ valid GUID." };
|
||||
{ defaults with
|
||||
name = "part_get_gpt_guid"; added = (1, 29, 25);
|
||||
style = RString (RPlainString, "guid"), [String (Device, "device"); Int "partnum"], [];
|
||||
- impl = OCaml "Parted.part_get_gpt_guid";
|
||||
- optional = Some "gdisk";
|
||||
+ impl = OCaml "Sfdisk.part_get_gpt_guid";
|
||||
tests = [
|
||||
InitGPT, Always, TestResultString (
|
||||
[["part_set_gpt_guid"; "/dev/sda"; "1";
|
||||
@@ -9206,7 +9202,7 @@ This is the internal call which implements C<guestfs_feature_available>." };
|
||||
{ defaults with
|
||||
name = "part_set_disk_guid"; added = (1, 33, 2);
|
||||
style = RErr, [String (Device, "device"); String (GUID, "guid")], [];
|
||||
- optional = Some "gdisk";
|
||||
+ impl = OCaml "Sfdisk.part_set_disk_guid";
|
||||
tests = [
|
||||
InitGPT, Always, TestLastFail (
|
||||
[["part_set_disk_guid"; "/dev/sda"; "f"]]), [];
|
||||
@@ -9225,7 +9221,7 @@ or if C<guid> is not a valid GUID." };
|
||||
{ defaults with
|
||||
name = "part_get_disk_guid"; added = (1, 33, 2);
|
||||
style = RString (RPlainString, "guid"), [String (Device, "device")], [];
|
||||
- optional = Some "gdisk";
|
||||
+ impl = OCaml "Sfdisk.part_get_disk_guid";
|
||||
tests = [
|
||||
InitGPT, Always, TestResultString (
|
||||
[["part_set_disk_guid"; "/dev/sda";
|
||||
@@ -9241,7 +9237,7 @@ Behaviour is undefined for other partition types." };
|
||||
{ defaults with
|
||||
name = "part_set_disk_guid_random"; added = (1, 33, 2);
|
||||
style = RErr, [String (Device, "device")], [];
|
||||
- optional = Some "gdisk";
|
||||
+ impl = OCaml "Sfdisk.part_set_disk_guid_random";
|
||||
tests = [
|
||||
InitGPT, Always, TestRun (
|
||||
[["part_set_disk_guid_random"; "/dev/sda"]]), [];
|
||||
--
|
||||
2.43.0
|
||||
|
@ -0,0 +1,28 @@
|
||||
From 0edaea8f91bf08025651eeff32f53b9335003842 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 8 Oct 2024 14:53:38 +0100
|
||||
Subject: [PATCH] website: Add links for 1.54 and 1.55 download locations
|
||||
|
||||
---
|
||||
website/index.html.in | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/website/index.html.in b/website/index.html.in
|
||||
index a61fca924..2a0d32217 100644
|
||||
--- a/website/index.html.in
|
||||
+++ b/website/index.html.in
|
||||
@@ -186,9 +186,10 @@ git clone <a href="https://github.com/libguestfs/libguestfs">https://github.com/
|
||||
LATEST-URL: http://libguestfs.org/download/1.53-development/libguestfs-@PACKAGE_VERSION@.tar.gz
|
||||
LATEST-VERSION: @PACKAGE_VERSION@
|
||||
-->
|
||||
- <a href="download/1.53-development/">Latest development version: <strong>@PACKAGE_VERSION@</strong></a> (released <strong>@RELEASE_DATE@</strong>).<br/>
|
||||
+ <a href="download/1.55-development/">Latest development version: <strong>@PACKAGE_VERSION@</strong></a> (released <strong>@RELEASE_DATE@</strong>).<br/>
|
||||
Stable branch:
|
||||
<strong>
|
||||
+ <a href="download/1.54-stable/">1.54.x</a>,
|
||||
<a href="download/1.52-stable/">1.52.x</a>,
|
||||
<a href="download/1.50-stable/">1.50.x</a>,
|
||||
<a href="download/1.48-stable/">1.48.x</a>
|
||||
--
|
||||
2.43.0
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 75cdb13260f79a34a8b65059feb098f32738c8a4 Mon Sep 17 00:00:00 2001
|
||||
From 2f798c87910e0fe65247a0695855ba7c6338bb71 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Mon, 29 Jul 2013 14:47:56 +0100
|
||||
Subject: [PATCH] RHEL: Disable unsupported remote drive protocols
|
||||
@ -10,27 +10,20 @@ This disables support for unsupported remote drive protocols:
|
||||
* ftps
|
||||
* http
|
||||
* https
|
||||
* tftp
|
||||
* gluster
|
||||
* iscsi
|
||||
* sheepdog
|
||||
* ssh
|
||||
|
||||
Note 'nbd' is not disabled, and of course 'file' works.
|
||||
|
||||
We hope to gradually add some of these back over the lifetime of RHEL.
|
||||
|
||||
(cherry picked from commit 66b9338e3d786db28fbd853d397741c3ceb19352)
|
||||
---
|
||||
docs/guestfs-testing.pod | 20 -----
|
||||
fish/guestfish.pod | 66 ++--------------
|
||||
fish/test-add-uri.sh | 32 --------
|
||||
generator/actions_core.ml | 50 +------------
|
||||
lib/drives.c | 8 ++
|
||||
lib/guestfs.pod | 100 -------------------------
|
||||
tests/disks/test-qemu-drive-libvirt.sh | 28 -------
|
||||
tests/disks/test-qemu-drive.sh | 60 ---------------
|
||||
8 files changed, 16 insertions(+), 348 deletions(-)
|
||||
fish/guestfish.pod | 42 ++-------
|
||||
fish/test-add-uri.sh | 21 -----
|
||||
generator/actions_core.ml | 34 +-------
|
||||
lib/drives.c | 113 -------------------------
|
||||
lib/guestfs.pod | 67 ---------------
|
||||
tests/disks/test-qemu-drive-libvirt.sh | 7 --
|
||||
tests/disks/test-qemu-drive.sh | 40 ---------
|
||||
8 files changed, 8 insertions(+), 336 deletions(-)
|
||||
|
||||
diff --git a/docs/guestfs-testing.pod b/docs/guestfs-testing.pod
|
||||
index f5c09df6e..ee4b26d6b 100644
|
||||
@ -64,7 +57,7 @@ index f5c09df6e..ee4b26d6b 100644
|
||||
|
||||
Run L<virt-alignment-scan(1)> on guests or disk images:
|
||||
diff --git a/fish/guestfish.pod b/fish/guestfish.pod
|
||||
index 492aa7163..33fc8b2c8 100644
|
||||
index da47c86d6..33fc8b2c8 100644
|
||||
--- a/fish/guestfish.pod
|
||||
+++ b/fish/guestfish.pod
|
||||
@@ -131,9 +131,9 @@ To list what is available do:
|
||||
@ -94,7 +87,7 @@ index 492aa7163..33fc8b2c8 100644
|
||||
|
||||
The possible I<-a URI> formats are described below.
|
||||
|
||||
@@ -1144,40 +1144,6 @@ The possible I<-a URI> formats are described below.
|
||||
@@ -1144,28 +1144,6 @@ The possible I<-a URI> formats are described below.
|
||||
|
||||
Add the local disk image (or device) called F<disk.img>.
|
||||
|
||||
@ -106,24 +99,12 @@ index 492aa7163..33fc8b2c8 100644
|
||||
-
|
||||
-=head2 B<-a https://[user@]example.com[:port]/disk.img>
|
||||
-
|
||||
-=head2 B<-a tftp://[user@]example.com[:port]/disk.img>
|
||||
-
|
||||
-Add a disk located on a remote FTP, HTTP or TFTP server.
|
||||
-Add a disk located on a remote FTP or HTTP server.
|
||||
-
|
||||
-The equivalent API command would be:
|
||||
-
|
||||
- ><fs> add /disk.img protocol:(ftp|...) server:tcp:example.com
|
||||
-
|
||||
-=head2 B<-a gluster://example.com[:port]/volname/image>
|
||||
-
|
||||
-Add a disk image located on GlusterFS storage.
|
||||
-
|
||||
-The server is the one running C<glusterd>, and may be C<localhost>.
|
||||
-
|
||||
-The equivalent API command would be:
|
||||
-
|
||||
- ><fs> add volname/image protocol:gluster server:tcp:example.com
|
||||
-
|
||||
-=head2 B<-a iscsi://example.com[:port]/target-iqn-name[/lun]>
|
||||
-
|
||||
-Add a disk located on an iSCSI server.
|
||||
@ -135,22 +116,10 @@ index 492aa7163..33fc8b2c8 100644
|
||||
=head2 B<-a nbd://example.com[:port]>
|
||||
|
||||
=head2 B<-a nbd://example.com[:port]/exportname>
|
||||
@@ -1212,35 +1178,13 @@ The equivalent API command would be:
|
||||
@@ -1200,23 +1178,13 @@ The equivalent API command would be:
|
||||
|
||||
><fs> add pool/disk protocol:rbd server:tcp:example.com:port
|
||||
|
||||
-=head2 B<-a sheepdog://[example.com[:port]]/volume/image>
|
||||
-
|
||||
-Add a disk image located on a Sheepdog volume.
|
||||
-
|
||||
-The server name is optional. Although libguestfs and Sheepdog
|
||||
-supports multiple servers, only at most one server can be specified
|
||||
-when using this URI syntax.
|
||||
-
|
||||
-The equivalent API command would be:
|
||||
-
|
||||
- ><fs> add volume protocol:sheepdog [server:tcp:example.com]
|
||||
-
|
||||
-=head2 B<-a ssh://[user@]example.com[:port]/disk.img>
|
||||
-
|
||||
-Add a disk image located on a remote server, accessed using the Secure
|
||||
@ -173,35 +142,24 @@ index 492aa7163..33fc8b2c8 100644
|
||||
In this case, the password is C<pass@word>.
|
||||
|
||||
diff --git a/fish/test-add-uri.sh b/fish/test-add-uri.sh
|
||||
index 21d424984..ddabeb639 100755
|
||||
index 533a3ce0c..ddabeb639 100755
|
||||
--- a/fish/test-add-uri.sh
|
||||
+++ b/fish/test-add-uri.sh
|
||||
@@ -40,14 +40,6 @@ function fail ()
|
||||
@@ -40,10 +40,6 @@ function fail ()
|
||||
$VG guestfish -x -a file://$abs_builddir/test-add-uri.img </dev/null >test-add-uri.out 2>&1
|
||||
grep -sq 'add_drive ".*/test-add-uri.img"' test-add-uri.out || fail
|
||||
|
||||
-# curl
|
||||
-$VG guestfish -x -a ftp://user@example.com/disk.img </dev/null >test-add-uri.out 2>&1
|
||||
-grep -sq 'add_drive "/disk.img" "protocol:ftp" "server:tcp:example.com" "username:user"' test-add-uri.out || fail
|
||||
-
|
||||
-# gluster
|
||||
-$VG guestfish -x -a gluster://example.com/disk </dev/null >test-add-uri.out 2>&1
|
||||
-grep -sq 'add_drive "disk" "protocol:gluster" "server:tcp:example.com"' test-add-uri.out || fail
|
||||
-
|
||||
# NBD
|
||||
$VG guestfish -x -a nbd://example.com </dev/null >test-add-uri.out 2>&1
|
||||
grep -sq 'add_drive "" "protocol:nbd" "server:tcp:example.com"' test-add-uri.out || fail
|
||||
@@ -67,29 +59,5 @@ grep -sq 'add_drive "pool/disk" "protocol:rbd" "server:tcp:example.com:6789"' te
|
||||
@@ -63,22 +59,5 @@ grep -sq 'add_drive "pool/disk" "protocol:rbd" "server:tcp:example.com:6789"' te
|
||||
$VG guestfish -x -a rbd:///pool/disk </dev/null >test-add-uri.out 2>&1
|
||||
grep -sq 'add_drive "pool/disk" "protocol:rbd"' test-add-uri.out || fail
|
||||
|
||||
-# sheepdog
|
||||
-$VG guestfish -x -a sheepdog:///volume/image </dev/null >test-add-uri.out 2>&1
|
||||
-grep -sq 'add_drive "volume/image" "protocol:sheepdog"' test-add-uri.out || fail
|
||||
-
|
||||
-$VG guestfish -x -a sheepdog://example.com:3000/volume/image </dev/null >test-add-uri.out 2>&1
|
||||
-grep -sq 'add_drive "volume/image" "protocol:sheepdog" "server:tcp:example.com:3000"' test-add-uri.out || fail
|
||||
-
|
||||
-# ssh
|
||||
-$VG guestfish -x -a ssh://example.com/disk.img </dev/null >test-add-uri.out 2>&1
|
||||
-grep -sq 'add_drive "/disk.img" "protocol:ssh" "server:tcp:example.com"' test-add-uri.out || fail
|
||||
@ -222,26 +180,19 @@ index 21d424984..ddabeb639 100755
|
||||
rm test-add-uri.out
|
||||
rm test-add-uri.img
|
||||
diff --git a/generator/actions_core.ml b/generator/actions_core.ml
|
||||
index ef9096772..4a4a8e4c9 100644
|
||||
index 20f6e8436..768f58433 100644
|
||||
--- a/generator/actions_core.ml
|
||||
+++ b/generator/actions_core.ml
|
||||
@@ -350,29 +350,6 @@ F<filename> is interpreted as a local file or device.
|
||||
@@ -350,22 +350,6 @@ F<filename> is interpreted as a local file or device.
|
||||
This is the default if the optional protocol parameter
|
||||
is omitted.
|
||||
|
||||
-=item C<protocol = \"ftp\"|\"ftps\"|\"http\"|\"https\"|\"tftp\">
|
||||
-=item C<protocol = \"ftp\"|\"ftps\"|\"http\"|\"https\">
|
||||
-
|
||||
-Connect to a remote FTP, HTTP or TFTP server.
|
||||
-Connect to a remote FTP or HTTP server.
|
||||
-The C<server> parameter must also be supplied - see below.
|
||||
-
|
||||
-See also: L<guestfs(3)/FTP, HTTP AND TFTP>
|
||||
-
|
||||
-=item C<protocol = \"gluster\">
|
||||
-
|
||||
-Connect to the GlusterFS server.
|
||||
-The C<server> parameter must also be supplied - see below.
|
||||
-
|
||||
-See also: L<guestfs(3)/GLUSTER>
|
||||
-See also: L<guestfs(3)/FTP AND HTTP>
|
||||
-
|
||||
-=item C<protocol = \"iscsi\">
|
||||
-
|
||||
@ -255,17 +206,10 @@ index ef9096772..4a4a8e4c9 100644
|
||||
=item C<protocol = \"nbd\">
|
||||
|
||||
Connect to the Network Block Device server.
|
||||
@@ -389,22 +366,6 @@ The C<secret> parameter may be supplied. See below.
|
||||
@@ -382,15 +366,6 @@ The C<secret> parameter may be supplied. See below.
|
||||
|
||||
See also: L<guestfs(3)/CEPH>.
|
||||
|
||||
-=item C<protocol = \"sheepdog\">
|
||||
-
|
||||
-Connect to the Sheepdog server.
|
||||
-The C<server> parameter may also be supplied - see below.
|
||||
-
|
||||
-See also: L<guestfs(3)/SHEEPDOG>.
|
||||
-
|
||||
-=item C<protocol = \"ssh\">
|
||||
-
|
||||
-Connect to the Secure Shell (ssh) server.
|
||||
@ -278,26 +222,24 @@ index ef9096772..4a4a8e4c9 100644
|
||||
=back
|
||||
|
||||
=item C<server>
|
||||
@@ -415,13 +376,8 @@ is a list of server(s).
|
||||
@@ -401,11 +376,8 @@ is a list of server(s).
|
||||
Protocol Number of servers required
|
||||
-------- --------------------------
|
||||
file List must be empty or param not used at all
|
||||
- ftp|ftps|http|https|tftp Exactly one
|
||||
- gluster Exactly one
|
||||
- ftp|ftps|http|https Exactly one
|
||||
- iscsi Exactly one
|
||||
nbd Exactly one
|
||||
rbd Zero or more
|
||||
- sheepdog Zero or more
|
||||
- ssh Exactly one
|
||||
|
||||
Each list element is a string specifying a server. The string must be
|
||||
in one of the following formats:
|
||||
@@ -437,10 +393,10 @@ for the protocol is used (see F</etc/services>).
|
||||
@@ -421,10 +393,10 @@ for the protocol is used (see F</etc/services>).
|
||||
|
||||
=item C<username>
|
||||
|
||||
-For the C<ftp>, C<ftps>, C<http>, C<https>, C<iscsi>, C<rbd>, C<ssh>
|
||||
-and C<tftp> protocols, this specifies the remote username.
|
||||
-For the C<ftp>, C<ftps>, C<http>, C<https>, C<iscsi>, C<rbd> and C<ssh>
|
||||
-protocols, this specifies the remote username.
|
||||
+For the C<rbd>
|
||||
+protocol, this specifies the remote username.
|
||||
|
||||
@ -307,85 +249,162 @@ index ef9096772..4a4a8e4c9 100644
|
||||
example if using the libvirt backend and if the libvirt backend is configured to
|
||||
start the qemu appliance as a special user such as C<qemu.qemu>. If in doubt,
|
||||
diff --git a/lib/drives.c b/lib/drives.c
|
||||
index c5a208468..efb289254 100644
|
||||
index c068b8ecb..6e4453ce5 100644
|
||||
--- a/lib/drives.c
|
||||
+++ b/lib/drives.c
|
||||
@@ -166,6 +166,7 @@ create_drive_non_file (guestfs_h *g,
|
||||
@@ -166,34 +166,6 @@ create_drive_non_file (guestfs_h *g,
|
||||
return drv;
|
||||
}
|
||||
|
||||
+#if 0 /* DISABLED IN RHEL 8 */
|
||||
static struct drive *
|
||||
create_drive_curl (guestfs_h *g,
|
||||
const struct drive_create_data *data)
|
||||
@@ -224,6 +225,7 @@ create_drive_gluster (guestfs_h *g,
|
||||
|
||||
return create_drive_non_file (g, data);
|
||||
}
|
||||
+#endif /* DISABLED IN RHEL 8 */
|
||||
|
||||
-static struct drive *
|
||||
-create_drive_curl (guestfs_h *g,
|
||||
- const struct drive_create_data *data)
|
||||
-{
|
||||
- if (data->nr_servers != 1) {
|
||||
- error (g, _("curl: you must specify exactly one server"));
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- if (data->servers[0].transport != drive_transport_none &&
|
||||
- data->servers[0].transport != drive_transport_tcp) {
|
||||
- error (g, _("curl: only tcp transport is supported"));
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- if (STREQ (data->exportname, "")) {
|
||||
- error (g, _("curl: pathname should not be an empty string"));
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- if (data->exportname[0] != '/') {
|
||||
- error (g, _("curl: pathname must begin with a '/'"));
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- return create_drive_non_file (g, data);
|
||||
-}
|
||||
-
|
||||
static int
|
||||
nbd_port (void)
|
||||
@@ -292,6 +294,7 @@ create_drive_rbd (guestfs_h *g,
|
||||
{
|
||||
@@ -261,67 +233,6 @@ create_drive_rbd (guestfs_h *g,
|
||||
return create_drive_non_file (g, data);
|
||||
}
|
||||
|
||||
+#if 0 /* DISABLED IN RHEL 8 */
|
||||
static struct drive *
|
||||
create_drive_sheepdog (guestfs_h *g,
|
||||
const struct drive_create_data *data)
|
||||
@@ -392,6 +395,7 @@ create_drive_iscsi (guestfs_h *g,
|
||||
|
||||
return create_drive_non_file (g, data);
|
||||
}
|
||||
+#endif /* DISABLED IN RHEL 8 */
|
||||
|
||||
-static struct drive *
|
||||
-create_drive_ssh (guestfs_h *g,
|
||||
- const struct drive_create_data *data)
|
||||
-{
|
||||
- if (data->nr_servers != 1) {
|
||||
- error (g, _("ssh: you must specify exactly one server"));
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- if (data->servers[0].transport != drive_transport_none &&
|
||||
- data->servers[0].transport != drive_transport_tcp) {
|
||||
- error (g, _("ssh: only tcp transport is supported"));
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- if (STREQ (data->exportname, "")) {
|
||||
- error (g, _("ssh: pathname should not be an empty string"));
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- if (data->exportname[0] != '/') {
|
||||
- error (g, _("ssh: pathname must begin with a '/'"));
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- if (data->username && STREQ (data->username, "")) {
|
||||
- error (g, _("ssh: username should not be an empty string"));
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- return create_drive_non_file (g, data);
|
||||
-}
|
||||
-
|
||||
-static struct drive *
|
||||
-create_drive_iscsi (guestfs_h *g,
|
||||
- const struct drive_create_data *data)
|
||||
-{
|
||||
- if (data->nr_servers != 1) {
|
||||
- error (g, _("iscsi: you must specify exactly one server"));
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- if (data->servers[0].transport != drive_transport_none &&
|
||||
- data->servers[0].transport != drive_transport_tcp) {
|
||||
- error (g, _("iscsi: only tcp transport is supported"));
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- if (STREQ (data->exportname, "")) {
|
||||
- error (g, _("iscsi: target name should not be an empty string"));
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- if (data->exportname[0] == '/') {
|
||||
- error (g, _("iscsi: target string must not begin with a '/'"));
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- return create_drive_non_file (g, data);
|
||||
-}
|
||||
-
|
||||
/**
|
||||
* Create the special F</dev/null> drive.
|
||||
@@ -842,6 +846,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
|
||||
*
|
||||
@@ -768,26 +679,6 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
|
||||
drv = create_drive_file (g, &data);
|
||||
}
|
||||
}
|
||||
+#if 0 /* DISABLED IN RHEL 8 */
|
||||
else if (STREQ (protocol, "ftp")) {
|
||||
data.protocol = drive_protocol_ftp;
|
||||
drv = create_drive_curl (g, &data);
|
||||
@@ -866,6 +871,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
|
||||
data.protocol = drive_protocol_iscsi;
|
||||
drv = create_drive_iscsi (g, &data);
|
||||
}
|
||||
+#endif /* DISABLED IN RHEL 8 */
|
||||
- else if (STREQ (protocol, "ftp")) {
|
||||
- data.protocol = drive_protocol_ftp;
|
||||
- drv = create_drive_curl (g, &data);
|
||||
- }
|
||||
- else if (STREQ (protocol, "ftps")) {
|
||||
- data.protocol = drive_protocol_ftps;
|
||||
- drv = create_drive_curl (g, &data);
|
||||
- }
|
||||
- else if (STREQ (protocol, "http")) {
|
||||
- data.protocol = drive_protocol_http;
|
||||
- drv = create_drive_curl (g, &data);
|
||||
- }
|
||||
- else if (STREQ (protocol, "https")) {
|
||||
- data.protocol = drive_protocol_https;
|
||||
- drv = create_drive_curl (g, &data);
|
||||
- }
|
||||
- else if (STREQ (protocol, "iscsi")) {
|
||||
- data.protocol = drive_protocol_iscsi;
|
||||
- drv = create_drive_iscsi (g, &data);
|
||||
- }
|
||||
else if (STREQ (protocol, "nbd")) {
|
||||
data.protocol = drive_protocol_nbd;
|
||||
drv = create_drive_nbd (g, &data);
|
||||
@@ -874,6 +880,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
|
||||
@@ -796,10 +687,6 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
|
||||
data.protocol = drive_protocol_rbd;
|
||||
drv = create_drive_rbd (g, &data);
|
||||
}
|
||||
+#if 0 /* DISABLED IN RHEL 8 */
|
||||
else if (STREQ (protocol, "sheepdog")) {
|
||||
data.protocol = drive_protocol_sheepdog;
|
||||
drv = create_drive_sheepdog (g, &data);
|
||||
@@ -886,6 +893,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
|
||||
data.protocol = drive_protocol_tftp;
|
||||
drv = create_drive_curl (g, &data);
|
||||
}
|
||||
+#endif /* DISABLED IN RHEL 8 */
|
||||
- else if (STREQ (protocol, "ssh")) {
|
||||
- data.protocol = drive_protocol_ssh;
|
||||
- drv = create_drive_ssh (g, &data);
|
||||
- }
|
||||
else {
|
||||
error (g, _("unknown protocol ‘%s’"), protocol);
|
||||
drv = NULL; /*FALLTHROUGH*/
|
||||
diff --git a/lib/guestfs.pod b/lib/guestfs.pod
|
||||
index e46dd81f9..dff32cc9e 100644
|
||||
index ecab0e1f3..dff32cc9e 100644
|
||||
--- a/lib/guestfs.pod
|
||||
+++ b/lib/guestfs.pod
|
||||
@@ -723,70 +723,6 @@ a qcow2 backing file specification, libvirt does not construct an
|
||||
@@ -723,51 +723,6 @@ a qcow2 backing file specification, libvirt does not construct an
|
||||
ephemeral secret object from those, for Ceph authentication. Refer to
|
||||
L<https://bugzilla.redhat.com/2033247>.
|
||||
|
||||
-=head3 FTP, HTTP AND TFTP
|
||||
-=head3 FTP AND HTTP
|
||||
-
|
||||
-Libguestfs can access remote disks over FTP, FTPS, HTTP, HTTPS
|
||||
-or TFTP protocols.
|
||||
-Libguestfs can access remote disks over FTP, FTPS, HTTP or HTTPS
|
||||
-protocols.
|
||||
-
|
||||
-To do this, set the optional C<protocol> and C<server> parameters of
|
||||
-L</guestfs_add_drive_opts> like this:
|
||||
@ -398,35 +417,16 @@ index e46dd81f9..dff32cc9e 100644
|
||||
- -1);
|
||||
-
|
||||
-The C<protocol> can be one of C<"ftp">, C<"ftps">, C<"http">,
|
||||
-C<"https"> or C<"tftp">.
|
||||
-or C<"https">.
|
||||
-
|
||||
-C<servers> (the C<server> parameter) is a list which must have a
|
||||
-single element. The single element is a string defining the web,
|
||||
-FTP or TFTP server. The format of this string is documented in
|
||||
-single element. The single element is a string defining the web
|
||||
-or FTP server. The format of this string is documented in
|
||||
-L</guestfs_add_drive_opts>.
|
||||
-
|
||||
-=head3 GLUSTER
|
||||
-
|
||||
-Libguestfs can access Gluster disks.
|
||||
-
|
||||
-To do this, set the optional C<protocol> and C<server> parameters of
|
||||
-L</guestfs_add_drive_opts> like this:
|
||||
-
|
||||
- char **servers = { "gluster.example.org:24007", NULL };
|
||||
- guestfs_add_drive_opts (g, "volname/image",
|
||||
- GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
|
||||
- GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "gluster",
|
||||
- GUESTFS_ADD_DRIVE_OPTS_SERVER, servers,
|
||||
- -1);
|
||||
-
|
||||
-C<servers> (the C<server> parameter) is a list which must have a
|
||||
-single element. The single element is a string defining the Gluster
|
||||
-server. The format of this string is documented in
|
||||
-L</guestfs_add_drive_opts>.
|
||||
-
|
||||
-Note that gluster usually requires the client process (ie. libguestfs)
|
||||
-to run as B<root> and will give unfathomable errors if it is not
|
||||
-(eg. "No data available").
|
||||
-Glusterfs support was removed in libguestfs 1.54 (2024).
|
||||
-
|
||||
-=head3 ISCSI
|
||||
-
|
||||
@ -449,27 +449,13 @@ index e46dd81f9..dff32cc9e 100644
|
||||
=head3 NETWORK BLOCK DEVICE
|
||||
|
||||
Libguestfs can access Network Block Device (NBD) disks remotely.
|
||||
@@ -849,42 +785,6 @@ L<https://bugs.launchpad.net/qemu/+bug/1155677>
|
||||
@@ -830,28 +785,6 @@ L<https://bugs.launchpad.net/qemu/+bug/1155677>
|
||||
|
||||
=back
|
||||
|
||||
-=head3 SHEEPDOG
|
||||
-
|
||||
-Libguestfs can access Sheepdog disks.
|
||||
-
|
||||
-To do this, set the optional C<protocol> and C<server> parameters of
|
||||
-L</guestfs_add_drive_opts> like this:
|
||||
-
|
||||
- char **servers = { /* optional servers ... */ NULL };
|
||||
- guestfs_add_drive_opts (g, "volume",
|
||||
- GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
|
||||
- GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "sheepdog",
|
||||
- GUESTFS_ADD_DRIVE_OPTS_SERVER, servers,
|
||||
- -1);
|
||||
-
|
||||
-The optional list of C<servers> may be zero or more server addresses
|
||||
-(C<"hostname:port">). The format of the server strings is documented
|
||||
-in L</guestfs_add_drive_opts>.
|
||||
-Sheepdog support was removed in libguestfs 1.54 (2024).
|
||||
-
|
||||
-=head3 SSH
|
||||
-
|
||||
@ -493,20 +479,13 @@ index e46dd81f9..dff32cc9e 100644
|
||||
|
||||
Libguestfs has APIs for inspecting an unknown disk image to find out
|
||||
diff --git a/tests/disks/test-qemu-drive-libvirt.sh b/tests/disks/test-qemu-drive-libvirt.sh
|
||||
index d86a1ecd0..cf7d2a0c9 100755
|
||||
index afbeddec6..93df4be0a 100755
|
||||
--- a/tests/disks/test-qemu-drive-libvirt.sh
|
||||
+++ b/tests/disks/test-qemu-drive-libvirt.sh
|
||||
@@ -65,34 +65,6 @@ check_output
|
||||
@@ -65,13 +65,6 @@ check_output
|
||||
grep -sq -- '-drive file=rbd:abc-def/ghi-jkl:auth_supported=none,' "$DEBUG_QEMU_FILE" || fail ceph2
|
||||
rm "$DEBUG_QEMU_FILE"
|
||||
|
||||
-# Gluster.
|
||||
-
|
||||
-$guestfish -d gluster run ||:
|
||||
-check_output
|
||||
-grep -sq -- '-drive file=gluster://1.2.3.4:1234/volname/image,' "$DEBUG_QEMU_FILE" || fail gluster
|
||||
-rm "$DEBUG_QEMU_FILE"
|
||||
-
|
||||
-# iSCSI.
|
||||
-
|
||||
-$guestfish -d iscsi run ||:
|
||||
@ -514,28 +493,14 @@ index d86a1ecd0..cf7d2a0c9 100755
|
||||
-grep -sq -- '-drive file=iscsi://1.2.3.4:1234/iqn.2003-01.org.linux-iscsi.fedora' "$DEBUG_QEMU_FILE" || fail iscsi
|
||||
-rm "$DEBUG_QEMU_FILE"
|
||||
-
|
||||
-# NBD.
|
||||
-
|
||||
-$guestfish -d nbd run ||:
|
||||
-check_output
|
||||
-grep -sq -- '-drive file=nbd:1.2.3.4:1234,' "$DEBUG_QEMU_FILE" || fail nbd
|
||||
-rm "$DEBUG_QEMU_FILE"
|
||||
-
|
||||
-# Sheepdog.
|
||||
-
|
||||
-$guestfish -d sheepdog run ||:
|
||||
-check_output
|
||||
-grep -sq -- '-drive file=sheepdog:volume,' "$DEBUG_QEMU_FILE" || fail sheepdog
|
||||
-rm "$DEBUG_QEMU_FILE"
|
||||
-
|
||||
# Local, stored in a pool.
|
||||
# NBD.
|
||||
|
||||
$guestfish -d pool1 run ||:
|
||||
$guestfish -d nbd run ||:
|
||||
diff --git a/tests/disks/test-qemu-drive.sh b/tests/disks/test-qemu-drive.sh
|
||||
index 12937fb30..b3e4f9903 100755
|
||||
index 9ee7df389..b3e4f9903 100755
|
||||
--- a/tests/disks/test-qemu-drive.sh
|
||||
+++ b/tests/disks/test-qemu-drive.sh
|
||||
@@ -62,45 +62,6 @@ check_output
|
||||
@@ -62,35 +62,6 @@ check_output
|
||||
grep -sq -- '-drive file=rbd:abc-def/ghi-jkl:auth_supported=none,' "$DEBUG_QEMU_FILE" || fail
|
||||
rm "$DEBUG_QEMU_FILE"
|
||||
|
||||
@ -549,16 +514,6 @@ index 12937fb30..b3e4f9903 100755
|
||||
-grep -sq -- '-drive file=http://www.example.com/disk.img,' "$DEBUG_QEMU_FILE" || fail
|
||||
-rm "$DEBUG_QEMU_FILE"
|
||||
-
|
||||
-# Gluster.
|
||||
-
|
||||
-guestfish <<EOF ||:
|
||||
- add "volname/image" "format:raw" "protocol:gluster" "server:www.example.com:24007"
|
||||
- run
|
||||
-EOF
|
||||
-check_output
|
||||
-grep -sq -- '-drive file=gluster://www.example.com:24007/volname/image,' "$DEBUG_QEMU_FILE" || fail
|
||||
-rm "$DEBUG_QEMU_FILE"
|
||||
-
|
||||
-# iSCSI.
|
||||
-
|
||||
-guestfish <<EOF ||:
|
||||
@ -581,21 +536,11 @@ index 12937fb30..b3e4f9903 100755
|
||||
# NBD.
|
||||
|
||||
guestfish <<EOF ||:
|
||||
@@ -118,24 +79,3 @@ EOF
|
||||
@@ -108,14 +79,3 @@ EOF
|
||||
check_output
|
||||
grep -sq -- '-drive file=nbd:unix:/socket,' "$DEBUG_QEMU_FILE" || fail
|
||||
rm "$DEBUG_QEMU_FILE"
|
||||
-
|
||||
-# Sheepdog.
|
||||
-
|
||||
-guestfish <<EOF ||:
|
||||
- add "volume" "format:raw" "protocol:sheepdog"
|
||||
- run
|
||||
-EOF
|
||||
-check_output
|
||||
-grep -sq -- '-drive file=sheepdog:volume,' "$DEBUG_QEMU_FILE" || fail
|
||||
-rm "$DEBUG_QEMU_FILE"
|
||||
-
|
||||
-# SSH.
|
||||
-
|
||||
-guestfish <<EOF ||:
|
@ -1,134 +0,0 @@
|
||||
From 8539b763639cbe80e4b248455c0c28bd8ced9cbe Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Fri, 28 Jun 2024 09:42:20 +0100
|
||||
Subject: [PATCH] daemon: Fix parsing in part_get_gpt_attributes
|
||||
|
||||
The actual output of sfdisk --part-attrs is bizarre and doesn't match
|
||||
the documentation. After looking at the source from util-linux, fix
|
||||
the parsing to match what sfdisk produces.
|
||||
|
||||
Reported-by: Yongkui Guo
|
||||
Fixes: commit c6c266a85d76dc2db90460202415790c585ac625
|
||||
Fixes: https://issues.redhat.com/browse/RHEL-35998
|
||||
(cherry picked from commit 24c1f7b03aab6343e6c826250269e98a6060d762)
|
||||
---
|
||||
daemon/sfdisk.ml | 80 +++++++++++++++++++++++++++++++--------
|
||||
generator/actions_core.ml | 4 +-
|
||||
2 files changed, 66 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/daemon/sfdisk.ml b/daemon/sfdisk.ml
|
||||
index 2aea399aa..8c8ed2305 100644
|
||||
--- a/daemon/sfdisk.ml
|
||||
+++ b/daemon/sfdisk.ml
|
||||
@@ -114,28 +114,76 @@ let part_get_gpt_attributes device partnum =
|
||||
command "sfdisk" ["--part-attrs"; device; string_of_int partnum] in
|
||||
udev_settle ();
|
||||
|
||||
+ let out = String.trimr out in
|
||||
+
|
||||
(* The output is a whitespace-separated list of:
|
||||
+ *
|
||||
* "RequiredPartition" (equivalent to bit 0)
|
||||
* "NoBlockIOProtocol" (equivalent to bit 1)
|
||||
* "LegacyBIOSBootable" (equivalent to bit 2)
|
||||
- * "48", "49", ..., "63"
|
||||
+ * "GUID:" followed by a comma-separated list of bit numbers
|
||||
+ *
|
||||
+ * eg: "LegacyBIOSBootable RequiredPartition GUID:48,49"
|
||||
+ *
|
||||
+ * So this is a massive PITA to parse.
|
||||
*)
|
||||
- let out = String.trimr out in
|
||||
- let attrs = String.nsplit " " out in
|
||||
- List.fold_left (
|
||||
- fun bits attr ->
|
||||
+ let rec loop out acc =
|
||||
+ let len = String.length out in
|
||||
+ eprintf "part_get_gpt_attributes: %S [%s]\n%!"
|
||||
+ out (String.concat "," (List.map string_of_int acc));
|
||||
+ if len = 0 then (
|
||||
+ acc
|
||||
+ )
|
||||
+ else if Char.isspace out.[0] then (
|
||||
+ let out = String.triml out in
|
||||
+ loop out acc
|
||||
+ )
|
||||
+ else if out.[0] = ',' then (
|
||||
+ let out = String.sub out 1 (len-1) in
|
||||
+ loop out acc
|
||||
+ )
|
||||
+ else if String.is_prefix out "RequiredPartition" then (
|
||||
+ let acc = 0 :: acc in
|
||||
+ let out = String.sub out 17 (len-17) in
|
||||
+ loop out acc
|
||||
+ )
|
||||
+ else if String.is_prefix out "NoBlockIOProtocol" then (
|
||||
+ let acc = 1 :: acc in
|
||||
+ let out = String.sub out 17 (len-17) in
|
||||
+ loop out acc
|
||||
+ )
|
||||
+ else if String.is_prefix out "LegacyBIOSBootable" then (
|
||||
+ let acc = 2 :: acc in
|
||||
+ let out = String.sub out 18 (len-18) in
|
||||
+ loop out acc
|
||||
+ )
|
||||
+ else if String.is_prefix out "GUID:" then (
|
||||
+ let out = String.sub out 5 (len-5) in
|
||||
+ loop out acc
|
||||
+ )
|
||||
+ else if Char.isdigit out.[0] then (
|
||||
+ let n = String.span out "0123456789" in
|
||||
+ let num, out = String.break n out in
|
||||
let bit =
|
||||
- match attr with
|
||||
- | "" -> -1
|
||||
- | "RequiredPartition" -> 0
|
||||
- | "NoBlockIOProtocol" -> 1
|
||||
- | "LegacyBIOSBootable" -> 2
|
||||
- | n -> int_of_string n in
|
||||
- if bit >= 0 then
|
||||
- Int64.logor bits (Int64.shift_left 1_L bit)
|
||||
- else
|
||||
- bits
|
||||
- ) 0_L attrs
|
||||
+ try int_of_string num
|
||||
+ with Failure _ ->
|
||||
+ failwithf "part_get_gpt_attributes: cannot parse number %S" num in
|
||||
+ let acc = bit :: acc in
|
||||
+ loop out acc
|
||||
+ )
|
||||
+ else (
|
||||
+ failwithf "part_get_gpt_attributes: cannot parse %S" out
|
||||
+ )
|
||||
+ in
|
||||
+ let attrs = loop out [] in
|
||||
+
|
||||
+ let bits =
|
||||
+ List.fold_left (
|
||||
+ fun bits bit -> Int64.logor bits (Int64.shift_left 1_L bit)
|
||||
+ ) 0_L attrs in
|
||||
+ eprintf "part_get_gpt_attributes: [%s] -> %Ld\n%!"
|
||||
+ (String.concat "," (List.map string_of_int attrs)) bits;
|
||||
+ bits
|
||||
|
||||
let part_set_gpt_attributes device partnum attrs =
|
||||
if partnum <= 0 then
|
||||
diff --git a/generator/actions_core.ml b/generator/actions_core.ml
|
||||
index 46ef1422f..ef9096772 100644
|
||||
--- a/generator/actions_core.ml
|
||||
+++ b/generator/actions_core.ml
|
||||
@@ -8188,9 +8188,9 @@ for a useful list of partition attributes." };
|
||||
tests = [
|
||||
InitGPT, Always, TestResult (
|
||||
[["part_set_gpt_attributes"; "/dev/sda"; "1";
|
||||
- "0"];
|
||||
+ (* bits 0, 2, 48 and 49 set *) "844424930131973"];
|
||||
["part_get_gpt_attributes"; "/dev/sda"; "1"]],
|
||||
- "ret == 0"), [];
|
||||
+ "ret == 844424930131973"), [];
|
||||
];
|
||||
shortdesc = "get the attribute flags of a GPT partition";
|
||||
longdesc = "\
|
||||
--
|
||||
2.43.0
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 25ff96e2c465766960cbc5ca3918026442dfcc32 Mon Sep 17 00:00:00 2001
|
||||
From e9a4e3efb7c86bf732c35f2582bec671b3604c83 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 7 Jul 2015 09:28:03 -0400
|
||||
Subject: [PATCH] RHEL: Reject use of libguestfs-winsupport features except for
|
||||
@ -6,8 +6,6 @@ Subject: [PATCH] RHEL: Reject use of libguestfs-winsupport features except for
|
||||
|
||||
Fix the tests: it doesn't let us use guestfish for arbitrary Windows
|
||||
edits.
|
||||
|
||||
(cherry picked from commit b875668bfa9f596aba2e84999c7c9921f8dcb55e)
|
||||
---
|
||||
generator/c.ml | 16 ++++++++++++++++
|
||||
test-data/phony-guests/make-windows-img.sh | 1 +
|
||||
@ -15,14 +13,14 @@ edits.
|
||||
3 files changed, 19 insertions(+)
|
||||
|
||||
diff --git a/generator/c.ml b/generator/c.ml
|
||||
index 447059b8a..0391dd3dd 100644
|
||||
index 447059b8a..a32d959d7 100644
|
||||
--- a/generator/c.ml
|
||||
+++ b/generator/c.ml
|
||||
@@ -1846,6 +1846,22 @@ and generate_client_actions actions () =
|
||||
check_args_validity c_name style;
|
||||
trace_call name c_name style;
|
||||
|
||||
+ (* RHEL 8 *)
|
||||
+ (* RHEL *)
|
||||
+ if name = "mount" || name = "mount_ro" || name = "mount_options" ||
|
||||
+ name = "mount_vfs" then (
|
||||
+ pr " if (g->program && !STRPREFIX (g->program, \"virt-\")) {\n";
|
@ -1,90 +0,0 @@
|
||||
From 8aa0958faabcf6d1755a8dcda3bcbb3bc63f6c1f Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Mon, 8 Jul 2024 14:37:22 +0100
|
||||
Subject: [PATCH] New APIs: findfs_partuuid and findfs_partlabel
|
||||
|
||||
These search for partitions by UUID or label (name). They only work
|
||||
for GPT.
|
||||
|
||||
(cherry picked from commit 1816651f3c138600ad2e5ba0d6437b4753333818)
|
||||
(cherry picked from commit 04a45af93d21880e54a386386313100a04b91ca7)
|
||||
---
|
||||
daemon/findfs.ml | 4 ++++
|
||||
generator/actions_core.ml | 24 ++++++++++++++++++++++++
|
||||
generator/proc_nr.ml | 2 ++
|
||||
lib/MAX_PROC_NR | 2 +-
|
||||
4 files changed, 31 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/daemon/findfs.ml b/daemon/findfs.ml
|
||||
index cf2ba4a84..a94e0ce7b 100644
|
||||
--- a/daemon/findfs.ml
|
||||
+++ b/daemon/findfs.ml
|
||||
@@ -27,6 +27,10 @@ let rec findfs_uuid uuid =
|
||||
findfs "UUID" uuid
|
||||
and findfs_label label =
|
||||
findfs "LABEL" label
|
||||
+and findfs_partuuid uuid =
|
||||
+ findfs "PARTUUID" uuid
|
||||
+and findfs_partlabel label =
|
||||
+ findfs "PARTLABEL" label
|
||||
|
||||
and findfs tag str =
|
||||
(* Kill the cache file, forcing blkid to reread values from the
|
||||
diff --git a/generator/actions_core.ml b/generator/actions_core.ml
|
||||
index 4a4a8e4c9..15cdd09ff 100644
|
||||
--- a/generator/actions_core.ml
|
||||
+++ b/generator/actions_core.ml
|
||||
@@ -5688,6 +5688,30 @@ filesystem can be found.
|
||||
|
||||
To find the label of a filesystem, use C<guestfs_vfs_label>." };
|
||||
|
||||
+ { defaults with
|
||||
+ name = "findfs_partuuid"; added = (1, 5, 3);
|
||||
+ style = RString (RDevice, "device"), [String (PlainString, "uuid")], [];
|
||||
+ impl = OCaml "Findfs.findfs_partuuid";
|
||||
+ shortdesc = "find a partition by UUID";
|
||||
+ longdesc = "\
|
||||
+This command searches the partitions and returns the one
|
||||
+which has the given partition UUID. An error is returned if no such
|
||||
+partition can be found.
|
||||
+
|
||||
+To find the UUID of a partition, use C<guestfs_blkid> (C<PART_ENTRY_UUID>)." };
|
||||
+
|
||||
+ { defaults with
|
||||
+ name = "findfs_partlabel"; added = (1, 5, 3);
|
||||
+ style = RString (RDevice, "device"), [String (PlainString, "label")], [];
|
||||
+ impl = OCaml "Findfs.findfs_partlabel";
|
||||
+ shortdesc = "find a partition by label";
|
||||
+ longdesc = "\
|
||||
+This command searches the partitions and returns the one
|
||||
+which has the given label. An error is returned if no such
|
||||
+partition can be found.
|
||||
+
|
||||
+To find the label of a partition, use C<guestfs_blkid> (C<PART_ENTRY_NAME>)." };
|
||||
+
|
||||
{ defaults with
|
||||
name = "is_chardev"; added = (1, 5, 10);
|
||||
style = RBool "flag", [String (Pathname, "path")], [OBool "followsymlinks"];
|
||||
diff --git a/generator/proc_nr.ml b/generator/proc_nr.ml
|
||||
index f71a849c9..56cd97a9f 100644
|
||||
--- a/generator/proc_nr.ml
|
||||
+++ b/generator/proc_nr.ml
|
||||
@@ -516,6 +516,8 @@ let proc_nr = [
|
||||
511, "internal_readdir";
|
||||
512, "clevis_luks_unlock";
|
||||
513, "inspect_get_build_id";
|
||||
+514, "findfs_partuuid";
|
||||
+515, "findfs_partlabel";
|
||||
]
|
||||
|
||||
(* 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..3cda32fc2 100644
|
||||
--- a/lib/MAX_PROC_NR
|
||||
+++ b/lib/MAX_PROC_NR
|
||||
@@ -1 +1 @@
|
||||
-513
|
||||
+515
|
||||
--
|
||||
2.43.0
|
||||
|
@ -1,45 +0,0 @@
|
||||
From 5733e5268fe0b7a99f20b23ea30ab13632cc9d95 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Mon, 8 Jul 2024 14:39:16 +0100
|
||||
Subject: [PATCH] inspection: Resolve PARTUUID= and PARTLABEL= in /etc/fstab
|
||||
|
||||
Fixes: https://issues.redhat.com/browse/RHEL-46596
|
||||
(cherry picked from commit e616c8f286ddacf401d7c356724ae874ed883262)
|
||||
(cherry picked from commit ebce03824a3ce75823037003ca2311d7b8d61565)
|
||||
---
|
||||
daemon/inspect_fs_unix_fstab.ml | 19 +++++++++++++++++++
|
||||
1 file changed, 19 insertions(+)
|
||||
|
||||
diff --git a/daemon/inspect_fs_unix_fstab.ml b/daemon/inspect_fs_unix_fstab.ml
|
||||
index 837c8c620..f5817a318 100644
|
||||
--- a/daemon/inspect_fs_unix_fstab.ml
|
||||
+++ b/daemon/inspect_fs_unix_fstab.ml
|
||||
@@ -131,6 +131,25 @@ and check_fstab_entry md_map root_mountable os_type aug entry =
|
||||
with
|
||||
Failure _ -> return None
|
||||
)
|
||||
+ (* EFI partition UUIDs and labels. *)
|
||||
+ else if String.is_prefix spec "PARTUUID=" then (
|
||||
+ let uuid = String.sub spec 9 (String.length spec - 9) in
|
||||
+ let uuid = shell_unquote uuid in
|
||||
+ (* Just ignore the device if the UUID cannot be resolved. *)
|
||||
+ try
|
||||
+ Mountable.of_device (Findfs.findfs_partuuid uuid)
|
||||
+ with
|
||||
+ Failure _ -> return None
|
||||
+ )
|
||||
+ else if String.is_prefix spec "PARTLABEL=" then (
|
||||
+ let label = String.sub spec 10 (String.length spec - 10) in
|
||||
+ let label = shell_unquote label in
|
||||
+ (* Just ignore the device if the label cannot be resolved. *)
|
||||
+ try
|
||||
+ Mountable.of_device (Findfs.findfs_partlabel label)
|
||||
+ with
|
||||
+ Failure _ -> return None
|
||||
+ )
|
||||
(* Resolve /dev/root to the current device.
|
||||
* Do the same for the / partition of the *BSD
|
||||
* systems, since the BSD -> Linux device
|
||||
--
|
||||
2.43.0
|
||||
|
@ -1,109 +0,0 @@
|
||||
From 533d39a6862638f587b231ecf541ab1f5c8e85f9 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Fri, 16 Aug 2024 08:26:34 +0100
|
||||
Subject: [PATCH] appliance/init: Don't set impossible "noop" disk scheduler
|
||||
|
||||
Since RHEL 7.4, the noop scheduler is no longer a thing. Trying to
|
||||
set it results in the error:
|
||||
|
||||
+ echo noop
|
||||
/init: line 108: echo: write error: Invalid argument
|
||||
|
||||
The current recommendation (https://access.redhat.com/solutions/5427)
|
||||
is to use mq-deadline, but that's also the default so we don't have to
|
||||
do anything.
|
||||
|
||||
A bigger reason to remove these lines is that kernel 6.11.0 has
|
||||
introduced a hang where -- rarely -- the ext4 filesystem hangs if you
|
||||
try to change the scheduler while handing a page fault, even if you're
|
||||
setting a scheduler that doesn't exist. I couldn't get much detail
|
||||
except for a couple of stack traces from different VMs:
|
||||
|
||||
crash> set 234
|
||||
PID: 234
|
||||
COMMAND: "modprobe"
|
||||
TASK: ffff9f5ec3a22f40 [THREAD_INFO: ffff9f5ec3a22f40]
|
||||
CPU: 0
|
||||
STATE: TASK_UNINTERRUPTIBLE
|
||||
crash> bt
|
||||
PID: 234 TASK: ffff9f5ec3a22f40 CPU: 0 COMMAND: "modprobe"
|
||||
#0 [ffffb21e002e7840] __schedule at ffffffffa718f6d0
|
||||
#1 [ffffb21e002e78f8] schedule at ffffffffa7190a27
|
||||
#2 [ffffb21e002e7908] __bio_queue_enter at ffffffffa67e121c
|
||||
#3 [ffffb21e002e7968] blk_mq_submit_bio at ffffffffa67f358c
|
||||
#4 [ffffb21e002e79f0] __submit_bio at ffffffffa67e1e3c
|
||||
#5 [ffffb21e002e7a58] submit_bio_noacct_nocheck at ffffffffa67e2326
|
||||
#6 [ffffb21e002e7ac0] ext4_mpage_readpages at ffffffffa65ceafc
|
||||
#7 [ffffb21e002e7be0] read_pages at ffffffffa6381d17
|
||||
#8 [ffffb21e002e7c40] page_cache_ra_unbounded at ffffffffa6381ff5
|
||||
#9 [ffffb21e002e7ca8] filemap_fault at ffffffffa63761b5
|
||||
#10 [ffffb21e002e7d48] __do_fault at ffffffffa63d1892
|
||||
#11 [ffffb21e002e7d70] do_fault at ffffffffa63d2425
|
||||
#12 [ffffb21e002e7da0] __handle_mm_fault at ffffffffa63d8c6b
|
||||
#13 [ffffb21e002e7e88] handle_mm_fault at ffffffffa63d95c2
|
||||
#14 [ffffb21e002e7ec8] do_user_addr_fault at ffffffffa60b34ea
|
||||
#15 [ffffb21e002e7f28] exc_page_fault at ffffffffa7186e4e
|
||||
#16 [ffffb21e002e7f50] asm_exc_page_fault at ffffffffa72012a6
|
||||
RIP: 000055d16159f8d8 RSP: 00007ffdd4c1f340 RFLAGS: 00010206
|
||||
RAX: 00000000000bec82 RBX: 00007ff2fd00dc82 RCX: 000055d1615b492a
|
||||
RDX: 00007ffdd4c216b0 RSI: 00000000200bec82 RDI: 000055d185725960
|
||||
RBP: 00007ffdd4c1f5a0 R8: 0000000000000000 R9: 0000000000000000
|
||||
R10: 0000000000000000 R11: 0000000000000202 R12: 00000000200bec82
|
||||
R13: 000055d185725960 R14: 00007ffdd4c216b0 R15: 000055d1615b9708
|
||||
ORIG_RAX: ffffffffffffffff CS: 0033 SS: 002b
|
||||
|
||||
crash> set 230
|
||||
PID: 230
|
||||
COMMAND: "modprobe"
|
||||
TASK: ffff98ce03ca3040 [THREAD_INFO: ffff98ce03ca3040]
|
||||
CPU: 0
|
||||
STATE: TASK_UNINTERRUPTIBLE
|
||||
crash> bt
|
||||
PID: 230 TASK: ffff98ce03ca3040 CPU: 0 COMMAND: "modprobe"
|
||||
#0 [ffffaf9940307840] __schedule at ffffffff9618f6d0
|
||||
#1 [ffffaf99403078f8] schedule at ffffffff96190a27
|
||||
#2 [ffffaf9940307908] __bio_queue_enter at ffffffff957e121c
|
||||
#3 [ffffaf9940307968] blk_mq_submit_bio at ffffffff957f358c
|
||||
#4 [ffffaf99403079f0] __submit_bio at ffffffff957e1e3c
|
||||
#5 [ffffaf9940307a58] submit_bio_noacct_nocheck at ffffffff957e2326
|
||||
#6 [ffffaf9940307ac0] ext4_mpage_readpages at ffffffff955ceafc
|
||||
#7 [ffffaf9940307be0] read_pages at ffffffff95381d1a
|
||||
#8 [ffffaf9940307c40] page_cache_ra_unbounded at ffffffff95381ff5
|
||||
#9 [ffffaf9940307ca8] filemap_fault at ffffffff953761b5
|
||||
#10 [ffffaf9940307d48] __do_fault at ffffffff953d1895
|
||||
#11 [ffffaf9940307d70] do_fault at ffffffff953d2425
|
||||
#12 [ffffaf9940307da0] __handle_mm_fault at ffffffff953d8c6b
|
||||
#13 [ffffaf9940307e88] handle_mm_fault at ffffffff953d95c2
|
||||
#14 [ffffaf9940307ec8] do_user_addr_fault at ffffffff950b34ea
|
||||
#15 [ffffaf9940307f28] exc_page_fault at ffffffff96186e4e
|
||||
#16 [ffffaf9940307f50] asm_exc_page_fault at ffffffff962012a6
|
||||
RIP: 0000556b7a7468d8 RSP: 00007ffde2ffb560 RFLAGS: 00000206
|
||||
RAX: 00000000000bec82 RBX: 00007f5331a0dc82 RCX: 0000556b7a75b92a
|
||||
RDX: 00007ffde2ffd8d0 RSI: 00000000200bec82 RDI: 0000556ba8edf960
|
||||
RBP: 00007ffde2ffb7c0 R8: 0000000000000000 R9: 0000000000000000
|
||||
R10: 0000000000000000 R11: 0000000000000202 R12: 00000000200bec82
|
||||
R13: 0000556ba8edf960 R14: 00007ffde2ffd8d0 R15: 0000556b7a760708
|
||||
ORIG_RAX: ffffffffffffffff CS: 0033 SS: 002b
|
||||
|
||||
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2303267
|
||||
(cherry picked from commit b2d682a4730ead8b4ae07e5aaf6fa230c5eec305)
|
||||
---
|
||||
appliance/init | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/appliance/init b/appliance/init
|
||||
index 128a3c20e..dae06dbbe 100755
|
||||
--- a/appliance/init
|
||||
+++ b/appliance/init
|
||||
@@ -104,8 +104,6 @@ udevadm settle --timeout=600
|
||||
# Increase the SCSI timeout so we can read remote images.
|
||||
shopt -s nullglob
|
||||
for f in /sys/block/sd*/device/timeout; do echo 300 > $f; done
|
||||
-# https://access.redhat.com/site/solutions/5427
|
||||
-for f in /sys/block/{h,s,ub,v}d*/queue/scheduler; do echo noop > $f; done
|
||||
shopt -u nullglob
|
||||
|
||||
# Set up the network.
|
||||
--
|
||||
2.43.0
|
||||
|
@ -30,7 +30,7 @@ ExcludeArch: %{ix86}
|
||||
%global verify_tarball_signature 1
|
||||
|
||||
# The source directory.
|
||||
%global source_directory 1.52-stable
|
||||
%global source_directory 1.54-stable
|
||||
|
||||
# Filter perl provides.
|
||||
%{?perl_default_filter}
|
||||
@ -41,8 +41,8 @@ ExcludeArch: %{ix86}
|
||||
Summary: Access and modify virtual machine disk images
|
||||
Name: libguestfs
|
||||
Epoch: 1
|
||||
Version: 1.52.2
|
||||
Release: 4%{?dist}
|
||||
Version: 1.54.0
|
||||
Release: 1%{?dist}
|
||||
License: LGPL-2.1-or-later
|
||||
|
||||
# Build only for architectures that have a kernel
|
||||
@ -80,13 +80,9 @@ Source8: copy-patches.sh
|
||||
# https://github.com/libguestfs/libguestfs/commits/rhel-10.0
|
||||
|
||||
# Patches.
|
||||
Patch0001: 0001-daemon-Reimplement-partition-GPT-functions-using-sfd.patch
|
||||
Patch0002: 0002-daemon-Fix-parsing-in-part_get_gpt_attributes.patch
|
||||
Patch0003: 0003-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch
|
||||
Patch0004: 0004-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch
|
||||
Patch0005: 0005-New-APIs-findfs_partuuid-and-findfs_partlabel.patch
|
||||
Patch0006: 0006-inspection-Resolve-PARTUUID-and-PARTLABEL-in-etc-fst.patch
|
||||
Patch0007: 0007-appliance-init-Don-t-set-impossible-noop-disk-schedu.patch
|
||||
Patch0001: 0001-website-Add-links-for-1.54-and-1.55-download-locatio.patch
|
||||
Patch0002: 0002-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch
|
||||
Patch0003: 0003-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch
|
||||
|
||||
BuildRequires: autoconf, automake, libtool, gettext-devel
|
||||
|
||||
@ -322,7 +318,6 @@ Requires: xz
|
||||
Requires: qemu-kvm-core
|
||||
%if !0%{?rhel}
|
||||
Suggests: qemu-block-curl
|
||||
Suggests: qemu-block-gluster
|
||||
Suggests: qemu-block-iscsi
|
||||
%endif
|
||||
Suggests: qemu-block-rbd
|
||||
@ -1113,6 +1108,10 @@ rm ocaml/html/.gitignore
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Oct 09 2024 Richard W.M. Jones <rjones@redhat.com> - 1:1.54.0-1
|
||||
- Rebase to libguestfs 1.54.0
|
||||
resolves: RHEL-56810
|
||||
|
||||
* Wed Aug 28 2024 Richard W.M. Jones <rjones@redhat.com> - 1:1.52.2-4
|
||||
- Synchronize patches with RHEL 9.5
|
||||
resolves: RHEL-56325
|
||||
|
4
sources
4
sources
@ -1,2 +1,2 @@
|
||||
SHA512 (libguestfs-1.52.2.tar.gz) = 5eb4fbcc8e8879932a212c38c515598cd229e0e10b3e86d5655a10f30f5cc8c3df4e6f4b60095ccdaddbd493114ea84d9c0cdb9db7496dc83283fc4d369ece71
|
||||
SHA512 (libguestfs-1.52.2.tar.gz.sig) = d43128be62848372e6c52a39ef8dd5e898e8b8005df5ba2b4269c9757d6f480b21bfd60b16df165b8b4bcadefa71aa8daaae8755789f48b6736f4a5475aa1c59
|
||||
SHA512 (libguestfs-1.54.0.tar.gz) = 45fd91a36384c15737820c9157d4a8a670c94177ab917a2600fef04ecbc8d6531ef04a4a86bea6540e04a550de7dfacbef9645f2869e7c5eab6cb63058ff2d86
|
||||
SHA512 (libguestfs-1.54.0.tar.gz.sig) = 97c27a5cafa533587ae2e22a54fed16d37c5366cca2a4c40cb098a8dacf62ee8b1bcee9d28f63b01e7034f0f211e8a8c71368ae418f1bfba4970ca1942bf40f3
|
||||
|
Loading…
Reference in New Issue
Block a user