New upstream version 1.40.1.
Remove patch which is now upstream.
This commit is contained in:
		
							parent
							
								
									90a710c93d
								
							
						
					
					
						commit
						6f261cafba
					
				| @ -1,103 +0,0 @@ | ||||
| From f00f920ad3b15ab8e9e8f201c16e7628b6b7b109 Mon Sep 17 00:00:00 2001 | ||||
| From: "Richard W.M. Jones" <rjones@redhat.com> | ||||
| Date: Wed, 12 Sep 2018 17:16:20 +0100 | ||||
| Subject: [PATCH] lib: Use qemu-img info -U option to avoid locking error. | ||||
| 
 | ||||
| https://bugs.launchpad.net/qemu/+bug/1740364 | ||||
| ---
 | ||||
|  lib/guestfs-internal.h |  3 +++ | ||||
|  lib/handle.c           |  2 ++ | ||||
|  lib/info.c             | 39 +++++++++++++++++++++++++++++++++++++++ | ||||
|  3 files changed, 44 insertions(+) | ||||
| 
 | ||||
| diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h
 | ||||
| index 471244264..6c339ae81 100644
 | ||||
| --- a/lib/guestfs-internal.h
 | ||||
| +++ b/lib/guestfs-internal.h
 | ||||
| @@ -510,6 +510,9 @@ struct guestfs_h {
 | ||||
|    /* Cached features. */ | ||||
|    struct cached_feature *features; | ||||
|    size_t nr_features; | ||||
| +
 | ||||
| +  /* Used by lib/info.c.  -1 = not tested or error; else 0 or 1. */
 | ||||
| +  int qemu_img_supports_U_option;
 | ||||
|  }; | ||||
|   | ||||
|  /** | ||||
| diff --git a/lib/handle.c b/lib/handle.c
 | ||||
| index a47aaafab..297ff6d67 100644
 | ||||
| --- a/lib/handle.c
 | ||||
| +++ b/lib/handle.c
 | ||||
| @@ -101,6 +101,8 @@ guestfs_create_flags (unsigned flags, ...)
 | ||||
|   | ||||
|    g->memsize = DEFAULT_MEMSIZE; | ||||
|   | ||||
| +  g->qemu_img_supports_U_option = -1; /* not tested, see lib/info.c */
 | ||||
| +
 | ||||
|    /* Start with large serial numbers so they are easy to spot | ||||
|     * inside the protocol. | ||||
|     */ | ||||
| diff --git a/lib/info.c b/lib/info.c
 | ||||
| index 2eadc1c11..4dee7a26a 100644
 | ||||
| --- a/lib/info.c
 | ||||
| +++ b/lib/info.c
 | ||||
| @@ -57,6 +57,7 @@ cleanup_json_t_decref (void *ptr)
 | ||||
|  #endif | ||||
|   | ||||
|  static json_t *get_json_output (guestfs_h *g, const char *filename); | ||||
| +static int qemu_img_supports_U_option (guestfs_h *g);
 | ||||
|  static void set_child_rlimits (struct command *); | ||||
|   | ||||
|  char * | ||||
| @@ -149,6 +150,11 @@ get_json_output (guestfs_h *g, const char *filename)
 | ||||
|   | ||||
|    guestfs_int_cmd_add_arg (cmd, "qemu-img"); | ||||
|    guestfs_int_cmd_add_arg (cmd, "info"); | ||||
| +  switch (qemu_img_supports_U_option (g)) {
 | ||||
| +  case -1: return NULL;
 | ||||
| +  case 0:  break;
 | ||||
| +  default: guestfs_int_cmd_add_arg (cmd, "-U");
 | ||||
| +  }
 | ||||
|    guestfs_int_cmd_add_arg (cmd, "--output"); | ||||
|    guestfs_int_cmd_add_arg (cmd, "json"); | ||||
|    if (filename[0] == '/') | ||||
| @@ -218,3 +224,36 @@ set_child_rlimits (struct command *cmd)
 | ||||
|    guestfs_int_cmd_set_child_rlimit (cmd, RLIMIT_CPU, 10 /* seconds */); | ||||
|  #endif | ||||
|  } | ||||
| +
 | ||||
| +/**
 | ||||
| + * Test if the qemu-img info command supports the C<-U> option to
 | ||||
| + * disable locking.  The result is memoized in the handle.
 | ||||
| + *
 | ||||
| + * Note this option was added in qemu 2.11.  We can remove this test
 | ||||
| + * when we can assume everyone is using qemu >= 2.11.
 | ||||
| + */
 | ||||
| +static int
 | ||||
| +qemu_img_supports_U_option (guestfs_h *g)
 | ||||
| +{
 | ||||
| +  if (g->qemu_img_supports_U_option >= 0)
 | ||||
| +    return g->qemu_img_supports_U_option;
 | ||||
| +
 | ||||
| +  CLEANUP_CMD_CLOSE struct command *cmd = guestfs_int_new_command (g);
 | ||||
| +  int r;
 | ||||
| +
 | ||||
| +  guestfs_int_cmd_add_string_unquoted (cmd,
 | ||||
| +                                       "qemu-img --help | "
 | ||||
| +                                       "grep -sqE -- '\\binfo\\b.*-U\\b'");
 | ||||
| +  r = guestfs_int_cmd_run (cmd);
 | ||||
| +  if (r == -1)
 | ||||
| +    return -1;
 | ||||
| +  if (!WIFEXITED (r)) {
 | ||||
| +    guestfs_int_external_command_failed (g, r,
 | ||||
| +                                         "qemu-img info -U option test",
 | ||||
| +                                         NULL);
 | ||||
| +    return -1;
 | ||||
| +  }
 | ||||
| +
 | ||||
| +  g->qemu_img_supports_U_option = WEXITSTATUS (r) == 0;
 | ||||
| +  return g->qemu_img_supports_U_option;
 | ||||
| +}
 | ||||
| -- 
 | ||||
| 2.19.2 | ||||
| 
 | ||||
| @ -50,9 +50,6 @@ Source0:       http://libguestfs.org/download/1.38-stable/%{name}-%{version}.tar | ||||
| Source1:       http://libguestfs.org/download/1.38-stable/%{name}-%{version}.tar.gz.sig | ||||
| %endif | ||||
| 
 | ||||
| # https://bugzilla.redhat.com/show_bug.cgi?id=1664318 | ||||
| Patch1:        0001-lib-Use-qemu-img-info-U-option-to-avoid-locking-erro.patch | ||||
| 
 | ||||
| # Replacement README file for Fedora users. | ||||
| Source4:       README-replacement.in | ||||
| 
 | ||||
| @ -1409,6 +1406,7 @@ install -m 0644 utils/boot-benchmark/boot-benchmark.1 $RPM_BUILD_ROOT%{_mandir}/ | ||||
| %changelog | ||||
| * Thu Jan 17 2019 Richard W.M. Jones <rjones@redhat.com> - 1:1.40.1-1 | ||||
| - New upstream version 1.40.1. | ||||
| - Remove patch which is now upstream. | ||||
| 
 | ||||
| * Mon Jan 14 2019 Björn Esser <besser82@fedoraproject.org> - 1:1.39.11-4 | ||||
| - Rebuilt for libcrypt.so.2 (#1666033) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user