From e9553216a2d37c464f5eeb7bec0d4285581485b0 Mon Sep 17 00:00:00 2001 From: Richard W.M. Jones Date: Feb 11 2015 15:18:15 +0000 Subject: Remove patches, upstream in 1.29.25. --- diff --git a/0001-builder-Fix-large-performance-regression-in-pxzcat-R.patch b/0001-builder-Fix-large-performance-regression-in-pxzcat-R.patch deleted file mode 100644 index 18e436f..0000000 --- a/0001-builder-Fix-large-performance-regression-in-pxzcat-R.patch +++ /dev/null @@ -1,63 +0,0 @@ -From ff1cf989fd49cfb82db428e66034c7b2d6bebe8a Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Wed, 4 Feb 2015 13:17:40 +0000 -Subject: [PATCH] builder: Fix large performance regression in pxzcat - (RHBZ#1188866). - -Commit 9135129b0f6e8eb171131ea0f7d729a960b74cb3 changed -two stack buffers to pointers: - -- uint8_t buf[BUFFER_SIZE]; -- unsigned char outbuf[BUFFER_SIZE]; -+ CLEANUP_FREE uint8_t *buf = NULL; -+ CLEANUP_FREE uint8_t *outbuf = NULL; - -but we were still using sizeof buf to calculate the size of the -buffer. sizeof buf == 8 so the original code which used large buffers -for reading/writing the file changed to using 8 byte buffers. ---- - builder/pxzcat-c.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/builder/pxzcat-c.c b/builder/pxzcat-c.c -index bd4c0a8..0bbd296 100644 ---- a/builder/pxzcat-c.c -+++ b/builder/pxzcat-c.c -@@ -640,14 +640,14 @@ worker_thread (void *vp) - strm.next_in = NULL; - strm.avail_in = 0; - strm.next_out = outbuf; -- strm.avail_out = sizeof outbuf; -+ strm.avail_out = BUFFER_SIZE; - - for (;;) { - lzma_action action = LZMA_RUN; - - if (strm.avail_in == 0) { - strm.next_in = buf; -- n = pread (global->fd, buf, sizeof buf, position); -+ n = pread (global->fd, buf, BUFFER_SIZE, position); - if (n == -1) { - perror (global->filename); - return &state->status; -@@ -661,7 +661,7 @@ worker_thread (void *vp) - r = lzma_code (&strm, action); - - if (strm.avail_out == 0 || r == LZMA_STREAM_END) { -- size_t wsz = sizeof outbuf - strm.avail_out; -+ size_t wsz = BUFFER_SIZE - strm.avail_out; - - /* Don't write if the block is all zero, to preserve output file - * sparseness. However we have to update oposition. -@@ -675,7 +675,7 @@ worker_thread (void *vp) - oposition += wsz; - - strm.next_out = outbuf; -- strm.avail_out = sizeof outbuf; -+ strm.avail_out = BUFFER_SIZE; - } - - if (r == LZMA_STREAM_END) --- -2.1.0 - diff --git a/0001-daemon-Fix-whitespace.patch b/0001-daemon-Fix-whitespace.patch deleted file mode 100644 index 47abe36..0000000 --- a/0001-daemon-Fix-whitespace.patch +++ /dev/null @@ -1,25 +0,0 @@ -From b3e3750b13a96fb6d1b79f7c0dabb4eeb37de5ef Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 5 Feb 2015 08:01:48 +0000 -Subject: [PATCH 1/3] daemon: Fix whitespace. - ---- - daemon/parted.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/daemon/parted.c b/daemon/parted.c -index 2f10144..877ef10 100644 ---- a/daemon/parted.c -+++ b/daemon/parted.c -@@ -787,7 +787,7 @@ optgroup_gdisk_available (void) - } - - int --do_part_set_gpt_type(const char *device, int partnum, const char *guid) -+do_part_set_gpt_type (const char *device, int partnum, const char *guid) - { - if (partnum <= 0) { - reply_with_error ("partition number must be >= 1"); --- -2.1.0 - diff --git a/0002-New-APIs-part-set-gpt-guid-and-part-get-gpt-guid.patch b/0002-New-APIs-part-set-gpt-guid-and-part-get-gpt-guid.patch deleted file mode 100644 index 6b3c97a..0000000 --- a/0002-New-APIs-part-set-gpt-guid-and-part-get-gpt-guid.patch +++ /dev/null @@ -1,124 +0,0 @@ -From 40c133b2c81666f6dde43704e66bf59206d5c111 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 5 Feb 2015 08:08:06 +0000 -Subject: [PATCH 2/3] New APIs: part-set-gpt-guid and part-get-gpt-guid - -In GPT, each partition has a GUID assigned randomly. Allow this GUID -to be written and read. - -Note this is different from the GUID type code which is used to -identify the type of the partition. ---- - daemon/parted.c | 33 +++++++++++++++++++++++++++++++++ - generator/actions.ml | 36 ++++++++++++++++++++++++++++++++++++ - src/MAX_PROC_NR | 2 +- - 3 files changed, 70 insertions(+), 1 deletion(-) - -diff --git a/daemon/parted.c b/daemon/parted.c -index 877ef10..a7bcb99 100644 ---- a/daemon/parted.c -+++ b/daemon/parted.c -@@ -812,6 +812,32 @@ do_part_set_gpt_type (const char *device, int partnum, const char *guid) - 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, -+ str_sgdisk, device, "-u", typecode, NULL); -+ -+ if (r == -1) { -+ reply_with_error ("%s %s -u %s: %s", str_sgdisk, device, typecode, err); -+ return -1; -+ } -+ -+ return 0; -+} -+ - static char * - sgdisk_info_extract_field (const char *device, int partnum, const char *field, - char *(*extract) (const char *path)) -@@ -922,6 +948,13 @@ do_part_get_gpt_type (const char *device, int partnum) - } - - char * -+do_part_get_gpt_guid (const char *device, int partnum) -+{ -+ return sgdisk_info_extract_field (device, partnum, -+ "Partition unique GUID", extract_uuid); -+} -+ -+char * - do_part_get_name (const char *device, int partnum) - { - CLEANUP_FREE char *parttype; -diff --git a/generator/actions.ml b/generator/actions.ml -index 985bb81..6b37712 100644 ---- a/generator/actions.ml -+++ b/generator/actions.ml -@@ -12413,6 +12413,42 @@ Recover the chunk tree of btrfs filesystem by scannning the devices one by one." - longdesc = "\ - Recover bad superblocks from good copies." }; - -+ { defaults with -+ name = "part_set_gpt_guid"; -+ style = RErr, [Device "device"; Int "partnum"; GUID "guid"], []; -+ proc_nr = Some 446; -+ optional = Some "gdisk"; -+ tests = [ -+ InitGPT, Always, TestLastFail ( -+ [["part_set_gpt_guid"; "/dev/sda"; "1"; "f"]]), []; -+ InitGPT, Always, TestResultString ( -+ [["part_set_gpt_guid"; "/dev/sda"; "1"; -+ "01234567-89AB-CDEF-0123-456789ABCDEF"]; -+ ["part_get_gpt_guid"; "/dev/sda"; "1"]], -+ "01234567-89AB-CDEF-0123-456789ABCDEF"), []; -+ ]; -+ shortdesc = "set the GUID of a GPT partition"; -+ longdesc = "\ -+Set the GUID of numbered GPT partition C to C. Return an -+error if the partition table of C isn't GPT, or if C is not a -+valid GUID." }; -+ -+ { defaults with -+ name = "part_get_gpt_guid"; -+ style = RString "guid", [Device "device"; Int "partnum"], []; -+ proc_nr = Some 447; -+ optional = Some "gdisk"; -+ tests = [ -+ InitGPT, Always, TestResultString ( -+ [["part_set_gpt_guid"; "/dev/sda"; "1"; -+ "01234567-89AB-CDEF-0123-456789ABCDEF"]; -+ ["part_get_gpt_guid"; "/dev/sda"; "1"]], -+ "01234567-89AB-CDEF-0123-456789ABCDEF"), []; -+ ]; -+ shortdesc = "get the GUID of a GPT partition"; -+ longdesc = "\ -+Return the GUID of numbered GPT partition C." }; -+ - ] - - (* Non-API meta-commands available only in guestfish. -diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR -index e5a135a..e9b7520 100644 ---- a/src/MAX_PROC_NR -+++ b/src/MAX_PROC_NR -@@ -1 +1 @@ --445 -+447 --- -2.1.0 - diff --git a/0003-resize-Preserve-GPT-GUID-so-we-don-t-break-EFI-bootl.patch b/0003-resize-Preserve-GPT-GUID-so-we-don-t-break-EFI-bootl.patch deleted file mode 100644 index a54c4ee..0000000 --- a/0003-resize-Preserve-GPT-GUID-so-we-don-t-break-EFI-bootl.patch +++ /dev/null @@ -1,80 +0,0 @@ -From f630677c14c7d5528e1ab39e4f805e0957b2ee3e Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 5 Feb 2015 08:13:05 +0000 -Subject: [PATCH 3/3] resize: Preserve GPT GUID so we don't break EFI - bootloaders (RHBZ#1189284). - -When copying disks that use EFI, we created a new partition table, -randomizing the GPT GUID of the first partition. Since EFI may store -the GUID in its NVRAM variables, this could make the guest unbootable. ---- - resize/resize.ml | 22 ++++++++++++++++++++-- - 1 file changed, 20 insertions(+), 2 deletions(-) - -diff --git a/resize/resize.ml b/resize/resize.ml -index 871c6a4..84fd6d4 100644 ---- a/resize/resize.ml -+++ b/resize/resize.ml -@@ -50,6 +50,7 @@ type partition = { - p_id : partition_id; (* Partition (MBR/GPT) ID. *) - p_type : partition_content; (* Content type and content size. *) - p_label : string option; (* Label/name. *) -+ p_guid : string option; (* Partition GUID (GPT only). *) - - (* What we're going to do: *) - mutable p_operation : partition_operation; -@@ -93,6 +94,11 @@ let rec debug_partition p = - (match p.p_label with - | Some label -> label - | None -> "(none)" -+ ); -+ printf "\tGUID: %s\n" -+ (match p.p_guid with -+ | Some guid -> guid -+ | None -> "(none)" - ) - and string_of_partition_content = function - | ContentUnknown -> "unknown data" -@@ -479,10 +485,16 @@ read the man page virt-resize(1). - let label = - try Some (g#part_get_name "/dev/sda" part_num) - with G.Error _ -> None in -+ let guid = -+ match parttype with -+ | MBR -> None -+ | GPT -> -+ try Some (g#part_get_gpt_guid "/dev/sda" part_num) -+ with G.Error _ -> None in - - { p_name = name; p_part = part; - p_bootable = bootable; p_id = id; p_type = typ; -- p_label = label; -+ p_label = label; p_guid = guid; - p_operation = OpCopy; p_target_partnum = 0; - p_target_start = 0L; p_target_end = 0L } - ) parts in -@@ -1068,7 +1080,7 @@ read the man page virt-resize(1). - p_part = { G.part_num = 0l; part_start = 0L; part_end = 0L; - part_size = 0L }; - p_bootable = false; p_id = No_ID; p_type = ContentUnknown; -- p_label = None; -+ p_label = None; p_guid = None; - - (* Target information is meaningful. *) - p_operation = OpIgnore; -@@ -1167,6 +1179,12 @@ read the man page virt-resize(1). - | None -> () - ); - -+ (match p.p_guid with -+ | Some guid -> -+ g#part_set_gpt_guid "/dev/sdb" p.p_target_partnum guid; -+ | None -> () -+ ); -+ - match parttype, p.p_id with - | GPT, GPT_Type gpt_type -> - g#part_set_gpt_type "/dev/sdb" p.p_target_partnum gpt_type --- -2.1.0 - diff --git a/libguestfs.spec b/libguestfs.spec index b04e1de..0e50bb4 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -32,14 +32,6 @@ License: LGPLv2+ URL: http://libguestfs.org/ Source0: http://libguestfs.org/download/1.29-development/%{name}-%{version}.tar.gz -# Upstream patch to fix performance regression in virt-builder (RHBZ#1188866). -Patch1: 0001-builder-Fix-large-performance-regression-in-pxzcat-R.patch - -# Upstream patch to fix virt-resize/virt-builder on aarch64 (RHBZ#1189284). -Patch2: 0001-daemon-Fix-whitespace.patch -Patch3: 0002-New-APIs-part-set-gpt-guid-and-part-get-gpt-guid.patch -Patch4: 0003-resize-Preserve-GPT-GUID-so-we-don-t-break-EFI-bootl.patch - # Basic build requirements: BuildRequires: perl(Pod::Simple) BuildRequires: perl(Pod::Man) @@ -756,11 +748,6 @@ for %{name}. %prep %setup -q -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 - # For Python 3 we must build libguestfs twice. This creates: # %{name}-%{version}/ # %{name}-%{version}/python3/