diff --git a/SOURCES/0039-RHEL-7-Emphasize-libguestfs-winsupport-package-RHBZ-.patch b/SOURCES/0039-RHEL-7-Emphasize-libguestfs-winsupport-package-RHBZ-.patch
deleted file mode 100644
index 2aa449f..0000000
--- a/SOURCES/0039-RHEL-7-Emphasize-libguestfs-winsupport-package-RHBZ-.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-From 66eb6b8c3a5b851035d5f24fb60e7045e15a4b4d Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones" <rjones@redhat.com>
-Date: Mon, 10 Jan 2011 16:07:12 +0000
-Subject: [PATCH] RHEL 7: Emphasize libguestfs-winsupport package
- (RHBZ#627468).
-
-This RHEL-only patch changes the error messages when the
-inspection code cannot find an operating system inside the guest
-image.  For a Windows guest this may happen because the user has not
-installed the separate 'libguestfs-winsupport' package.  Therefore we
-emphasize that the user may need to install this package.
-
-Notes:
-
-(1) In RHEL there are two pieces of inspection code, the old Perl code
-(deprecated upstream) and the new C core inspection API.  Therefore
-this patch has to touch two places with essentially the same change.
-
-(2) This patch doesn't try to be clever and detect if it was a Windows
-guest.  This should reduce the chance of failure.
-
-Output from (Perl) virt-inspector now looks like this:
-
- $ virt-inspector disk.img
- No operating system could be detected inside this disk image.
-
- This may be because the file is not a disk image, or is not a virtual machine
- image, or because the OS type is not understood by virt-inspector.
-
- If you feel this is an error, please file a bug report including as much
- information about the disk image as possible.
-
- RHEL notice
- -------------
- libguestfs will return this error for Microsoft Windows guests if the
- separate 'libguestfs-winsupport' package is not installed. If the
- guest is running Microsoft Windows, please try again after installing
- 'libguestfs-winsupport'.
-
-Output from guestfish (ie. C core inspection API) now looks like this:
-
- $ guestfish -i disk.img
- guestfish: no operating system was found on this disk
-
- RHEL notice
- -------------
- libguestfs will return this error for Microsoft Windows guests if the
- separate 'libguestfs-winsupport' package is not installed. If the
- guest is running Microsoft Windows, please try again after installing
- 'libguestfs-winsupport'.
----
- fish/inspect.c | 14 ++++++++++++++
- 1 file changed, 14 insertions(+)
-
-diff --git a/fish/inspect.c b/fish/inspect.c
-index 801d867..8858fcd 100644
---- a/fish/inspect.c
-+++ b/fish/inspect.c
-@@ -22,6 +22,7 @@
- #include <stdlib.h>
- #include <string.h>
- #include <errno.h>
-+#include <unistd.h>
- #include <libintl.h>
- 
- #include "c-ctype.h"
-@@ -68,6 +69,10 @@ inspect_mount (void)
-     exit (EXIT_FAILURE);
- 
-   if (roots[0] == NULL) {
-+    int libguestfs_winsupport_installed =
-+      access ("/usr/lib/guestfs/supermin.d/ntfs.img", F_OK) == 0 ||
-+      access ("/usr/lib64/guestfs/supermin.d/ntfs.img", F_OK) == 0;
-+
-     fprintf (stderr,
-       _("%s: no operating system was found on this disk\n"
-         "\n"
-@@ -84,6 +89,15 @@ inspect_mount (void)
-         "with these tools.  Use the guestfish equivalent commands\n"
-         "(see the virt tool manual page).\n"),
-              program_name);
-+    if (!libguestfs_winsupport_installed)
-+      fprintf (stderr,
-+    _("\nRHEL notice\n"
-+      "-------------\n"
-+      "libguestfs will return this error for Microsoft Windows guests if the\n"
-+      "separate 'libguestfs-winsupport' package is not installed. If the\n"
-+      "guest is running Microsoft Windows, please try again after installing\n"
-+      "'libguestfs-winsupport'.\n"));
-+
-     guestfs___free_string_list (roots);
-     exit (EXIT_FAILURE);
-   }
--- 
-1.8.3.1
-
diff --git a/SOURCES/0039-perl-Give-error-instead-of-crashing-if-optarg-is-not.patch b/SOURCES/0039-perl-Give-error-instead-of-crashing-if-optarg-is-not.patch
new file mode 100644
index 0000000..3b34492
--- /dev/null
+++ b/SOURCES/0039-perl-Give-error-instead-of-crashing-if-optarg-is-not.patch
@@ -0,0 +1,39 @@
+From 87b8584d6acc50751dffd81d8bb187d3ad73462c Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones@redhat.com>
+Date: Thu, 14 Nov 2013 15:45:23 +0000
+Subject: [PATCH] perl: Give error instead of crashing if optarg is not an
+ array reference.
+
+  $g->add_drive ("", server => 1);
+
+would segfault.  Now it gives a nice error instead:
+
+  array reference expected for 'server' argument at [line]
+
+(cherry picked from commit c032130226bdca539b8ac34ce622e5cd9a71c152)
+---
+ generator/perl.ml | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/generator/perl.ml b/generator/perl.ml
+index 1acd782..9b7c25a 100644
+--- a/generator/perl.ml
++++ b/generator/perl.ml
+@@ -464,10 +464,13 @@ PREINIT:
+              | OStringList _ ->
+                pr "          size_t i, len;\n";
+                pr "          char **r;\n";
++               pr "          SV *arg;\n";
+                pr "          AV *av;\n";
+                pr "          SV **svp;\n";
+                pr "\n";
+-               pr "          /* XXX More checking required here. */\n";
++               pr "          arg = ST (items_i+1);\n";
++               pr "          if (!SvROK (arg) || SvTYPE (SvRV (arg)) != SVt_PVAV)\n";
++               pr "            croak (\"array reference expected for '%%s' argument\", \"%s\");\n" n;
+                pr "          av = (AV *) SvRV (ST (items_i+1));\n";
+                pr "\n";
+                pr "          /* Note av_len returns index of final element. */\n";
+-- 
+1.8.3.1
+
diff --git a/SOURCES/0040-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch b/SOURCES/0040-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch
deleted file mode 100644
index 0941689..0000000
--- a/SOURCES/0040-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From c80606c691abda13cc0f76381fe9bf6af3e52a1a Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones" <rjones@redhat.com>
-Date: Fri, 21 Dec 2012 15:50:11 +0000
-Subject: [PATCH] RHEL 7: Remove libguestfs live (RHBZ#798980).
-
-This isn't supported in RHEL 7.
----
- src/launch-unix.c | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/src/launch-unix.c b/src/launch-unix.c
-index ed71ab4..6eafd25 100644
---- a/src/launch-unix.c
-+++ b/src/launch-unix.c
-@@ -36,6 +36,12 @@
- static int
- launch_unix (guestfs_h *g, const char *sockpath)
- {
-+  error (g,
-+	 "launch: In RHEL, only the 'libvirt' or 'appliance' method is supported.\n"
-+	 "In particular, \"libguestfs live\" is not supported.");
-+  return -1;
-+
-+#if 0
-   int r, daemon_sock = -1;
-   struct sockaddr_un addr;
-   uint32_t size;
-@@ -101,6 +107,7 @@ launch_unix (guestfs_h *g, const char *sockpath)
-     g->conn = NULL;
-   }
-   return -1;
-+#endif
- }
- 
- static int
--- 
-1.8.3.1
-
diff --git a/SOURCES/0040-virt-win-reg-Allow-URIs-RHBZ-912193.patch b/SOURCES/0040-virt-win-reg-Allow-URIs-RHBZ-912193.patch
new file mode 100644
index 0000000..caef48c
--- /dev/null
+++ b/SOURCES/0040-virt-win-reg-Allow-URIs-RHBZ-912193.patch
@@ -0,0 +1,59 @@
+From 612294872852be2f34f683c2a97e24adcfab288d Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones@redhat.com>
+Date: Thu, 14 Nov 2013 15:50:03 +0000
+Subject: [PATCH] virt-win-reg: Allow URIs (RHBZ#912193).
+
+(cherry picked from commit 793a5677cbd6f80ae0f4fbc3cdf478e7f84edadb)
+---
+ tools/virt-win-reg | 33 ++++++++++++++++++++++++++++++++-
+ 1 file changed, 32 insertions(+), 1 deletion(-)
+
+diff --git a/tools/virt-win-reg b/tools/virt-win-reg
+index a302857..bcd836c 100755
+--- a/tools/virt-win-reg
++++ b/tools/virt-win-reg
+@@ -252,9 +252,40 @@ push @lib_args, format => $format if defined $format;
+ 
+ my $g = Sys::Guestfs->new ();
+ 
+-if (-e $domname_or_image) {
++# If the parameter looks like a URI, try parsing it using guestfish.
++# This is a massive hack, but we'll fix it when virt-win-reg gets
++# rewritten in C ...
++if ($domname_or_image =~ m|://|) {
++    # Whitelist the characters permitted in the URI.
++    die "$0: $domname_or_image: URI parameter contains invalid characters"
++        unless $domname_or_image =~ m|^[A-Za-z0-9/:#%&*+,-.=?@_~]+$|;
++
++    my $cmd = "LANG=C guestfish -a '$domname_or_image' -x exit 2>&1 | grep 'trace: add_drive [^=]'";
++    open CMD, "$cmd|" or die "open: $cmd: $!";
++    $_ = <CMD>;
++    close CMD or die "close: $cmd: $!";
++    chomp;
++    die "$0: could not parse '$_'"
++        unless m/^libguestfs: trace: add_drive "(.*?)"(.*)/;
++    my @args = ($1, @lib_args);
++    $_ = $2;
++    while (/\S/) {
++        die "$0: cound not parse remainder from '$_'"
++            unless $_ =~ /^\s*"([a-z]+):(.*?)"(.*)/;
++        if ($1 ne "server") {
++            push @args, $1, $2;
++        } else {
++            push @args, $1, [$2];
++        }
++        $_ = $3;
++    }
++    $g->add_drive (@args);
++}
++# If the parameter looks like a local file:
++elsif (-e $domname_or_image) {
+     $g->add_drive ($domname_or_image, @lib_args);
+ }
++# Try a libvirt domain name:
+ else {
+     push @lib_args, libvirturi => $uri if defined $uri;
+     $g->add_domain ($domname_or_image, @lib_args);
+-- 
+1.8.3.1
+
diff --git a/SOURCES/0041-RHEL-7-Exclude-iptables-from-the-appliance-RHBZ-8586.patch b/SOURCES/0041-RHEL-7-Exclude-iptables-from-the-appliance-RHBZ-8586.patch
deleted file mode 100644
index 34c28fa..0000000
--- a/SOURCES/0041-RHEL-7-Exclude-iptables-from-the-appliance-RHBZ-8586.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 4b7cf0b65705f7b570ebd2fcdd3873d058113b4c Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones" <rjones@redhat.com>
-Date: Wed, 19 Sep 2012 15:02:27 +0100
-Subject: [PATCH] RHEL 7: Exclude iptables from the appliance (RHBZ#858648).
-
----
- appliance/excludelist.in | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/appliance/excludelist.in b/appliance/excludelist.in
-index aa4c406..c43006e 100644
---- a/appliance/excludelist.in
-+++ b/appliance/excludelist.in
-@@ -50,6 +50,9 @@
- ^redhat-logos
- ^dracut
- 
-+/* RHBZ#858648 */
-+^iptables
-+
- #endif
- 
- #ifdef DEBIAN
--- 
-1.8.3.1
-
diff --git a/SOURCES/0041-Remove-bogus-license-file-from-daemon-subdirectory.patch b/SOURCES/0041-Remove-bogus-license-file-from-daemon-subdirectory.patch
new file mode 100644
index 0000000..058b84f
--- /dev/null
+++ b/SOURCES/0041-Remove-bogus-license-file-from-daemon-subdirectory.patch
@@ -0,0 +1,698 @@
+From 7be678d7f7d6ac990543ff005d2fb16c92d6e9bc Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones@redhat.com>
+Date: Mon, 3 Feb 2014 13:56:13 +0000
+Subject: [PATCH] Remove bogus license file from daemon subdirectory.
+
+It was left over from when the daemon was a separate autoconf
+directory, and in any case the daemon has never been GPLv3 (it is
+GPLv2+).
+
+(cherry picked from commit d5b540153fa91230524133c09c879199b8e2d902)
+---
+ daemon/COPYING | 674 ---------------------------------------------------------
+ 1 file changed, 674 deletions(-)
+ delete mode 100644 daemon/COPYING
+
+diff --git a/daemon/COPYING b/daemon/COPYING
+deleted file mode 100644
+index 94a9ed0..0000000
+--- a/daemon/COPYING
++++ /dev/null
+@@ -1,674 +0,0 @@
+-                    GNU GENERAL PUBLIC LICENSE
+-                       Version 3, 29 June 2007
+-
+- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+- Everyone is permitted to copy and distribute verbatim copies
+- of this license document, but changing it is not allowed.
+-
+-                            Preamble
+-
+-  The GNU General Public License is a free, copyleft license for
+-software and other kinds of works.
+-
+-  The licenses for most software and other practical works are designed
+-to take away your freedom to share and change the works.  By contrast,
+-the GNU General Public License is intended to guarantee your freedom to
+-share and change all versions of a program--to make sure it remains free
+-software for all its users.  We, the Free Software Foundation, use the
+-GNU General Public License for most of our software; it applies also to
+-any other work released this way by its authors.  You can apply it to
+-your programs, too.
+-
+-  When we speak of free software, we are referring to freedom, not
+-price.  Our General Public Licenses are designed to make sure that you
+-have the freedom to distribute copies of free software (and charge for
+-them if you wish), that you receive source code or can get it if you
+-want it, that you can change the software or use pieces of it in new
+-free programs, and that you know you can do these things.
+-
+-  To protect your rights, we need to prevent others from denying you
+-these rights or asking you to surrender the rights.  Therefore, you have
+-certain responsibilities if you distribute copies of the software, or if
+-you modify it: responsibilities to respect the freedom of others.
+-
+-  For example, if you distribute copies of such a program, whether
+-gratis or for a fee, you must pass on to the recipients the same
+-freedoms that you received.  You must make sure that they, too, receive
+-or can get the source code.  And you must show them these terms so they
+-know their rights.
+-
+-  Developers that use the GNU GPL protect your rights with two steps:
+-(1) assert copyright on the software, and (2) offer you this License
+-giving you legal permission to copy, distribute and/or modify it.
+-
+-  For the developers' and authors' protection, the GPL clearly explains
+-that there is no warranty for this free software.  For both users' and
+-authors' sake, the GPL requires that modified versions be marked as
+-changed, so that their problems will not be attributed erroneously to
+-authors of previous versions.
+-
+-  Some devices are designed to deny users access to install or run
+-modified versions of the software inside them, although the manufacturer
+-can do so.  This is fundamentally incompatible with the aim of
+-protecting users' freedom to change the software.  The systematic
+-pattern of such abuse occurs in the area of products for individuals to
+-use, which is precisely where it is most unacceptable.  Therefore, we
+-have designed this version of the GPL to prohibit the practice for those
+-products.  If such problems arise substantially in other domains, we
+-stand ready to extend this provision to those domains in future versions
+-of the GPL, as needed to protect the freedom of users.
+-
+-  Finally, every program is threatened constantly by software patents.
+-States should not allow patents to restrict development and use of
+-software on general-purpose computers, but in those that do, we wish to
+-avoid the special danger that patents applied to a free program could
+-make it effectively proprietary.  To prevent this, the GPL assures that
+-patents cannot be used to render the program non-free.
+-
+-  The precise terms and conditions for copying, distribution and
+-modification follow.
+-
+-                       TERMS AND CONDITIONS
+-
+-  0. Definitions.
+-
+-  "This License" refers to version 3 of the GNU General Public License.
+-
+-  "Copyright" also means copyright-like laws that apply to other kinds of
+-works, such as semiconductor masks.
+-
+-  "The Program" refers to any copyrightable work licensed under this
+-License.  Each licensee is addressed as "you".  "Licensees" and
+-"recipients" may be individuals or organizations.
+-
+-  To "modify" a work means to copy from or adapt all or part of the work
+-in a fashion requiring copyright permission, other than the making of an
+-exact copy.  The resulting work is called a "modified version" of the
+-earlier work or a work "based on" the earlier work.
+-
+-  A "covered work" means either the unmodified Program or a work based
+-on the Program.
+-
+-  To "propagate" a work means to do anything with it that, without
+-permission, would make you directly or secondarily liable for
+-infringement under applicable copyright law, except executing it on a
+-computer or modifying a private copy.  Propagation includes copying,
+-distribution (with or without modification), making available to the
+-public, and in some countries other activities as well.
+-
+-  To "convey" a work means any kind of propagation that enables other
+-parties to make or receive copies.  Mere interaction with a user through
+-a computer network, with no transfer of a copy, is not conveying.
+-
+-  An interactive user interface displays "Appropriate Legal Notices"
+-to the extent that it includes a convenient and prominently visible
+-feature that (1) displays an appropriate copyright notice, and (2)
+-tells the user that there is no warranty for the work (except to the
+-extent that warranties are provided), that licensees may convey the
+-work under this License, and how to view a copy of this License.  If
+-the interface presents a list of user commands or options, such as a
+-menu, a prominent item in the list meets this criterion.
+-
+-  1. Source Code.
+-
+-  The "source code" for a work means the preferred form of the work
+-for making modifications to it.  "Object code" means any non-source
+-form of a work.
+-
+-  A "Standard Interface" means an interface that either is an official
+-standard defined by a recognized standards body, or, in the case of
+-interfaces specified for a particular programming language, one that
+-is widely used among developers working in that language.
+-
+-  The "System Libraries" of an executable work include anything, other
+-than the work as a whole, that (a) is included in the normal form of
+-packaging a Major Component, but which is not part of that Major
+-Component, and (b) serves only to enable use of the work with that
+-Major Component, or to implement a Standard Interface for which an
+-implementation is available to the public in source code form.  A
+-"Major Component", in this context, means a major essential component
+-(kernel, window system, and so on) of the specific operating system
+-(if any) on which the executable work runs, or a compiler used to
+-produce the work, or an object code interpreter used to run it.
+-
+-  The "Corresponding Source" for a work in object code form means all
+-the source code needed to generate, install, and (for an executable
+-work) run the object code and to modify the work, including scripts to
+-control those activities.  However, it does not include the work's
+-System Libraries, or general-purpose tools or generally available free
+-programs which are used unmodified in performing those activities but
+-which are not part of the work.  For example, Corresponding Source
+-includes interface definition files associated with source files for
+-the work, and the source code for shared libraries and dynamically
+-linked subprograms that the work is specifically designed to require,
+-such as by intimate data communication or control flow between those
+-subprograms and other parts of the work.
+-
+-  The Corresponding Source need not include anything that users
+-can regenerate automatically from other parts of the Corresponding
+-Source.
+-
+-  The Corresponding Source for a work in source code form is that
+-same work.
+-
+-  2. Basic Permissions.
+-
+-  All rights granted under this License are granted for the term of
+-copyright on the Program, and are irrevocable provided the stated
+-conditions are met.  This License explicitly affirms your unlimited
+-permission to run the unmodified Program.  The output from running a
+-covered work is covered by this License only if the output, given its
+-content, constitutes a covered work.  This License acknowledges your
+-rights of fair use or other equivalent, as provided by copyright law.
+-
+-  You may make, run and propagate covered works that you do not
+-convey, without conditions so long as your license otherwise remains
+-in force.  You may convey covered works to others for the sole purpose
+-of having them make modifications exclusively for you, or provide you
+-with facilities for running those works, provided that you comply with
+-the terms of this License in conveying all material for which you do
+-not control copyright.  Those thus making or running the covered works
+-for you must do so exclusively on your behalf, under your direction
+-and control, on terms that prohibit them from making any copies of
+-your copyrighted material outside their relationship with you.
+-
+-  Conveying under any other circumstances is permitted solely under
+-the conditions stated below.  Sublicensing is not allowed; section 10
+-makes it unnecessary.
+-
+-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+-
+-  No covered work shall be deemed part of an effective technological
+-measure under any applicable law fulfilling obligations under article
+-11 of the WIPO copyright treaty adopted on 20 December 1996, or
+-similar laws prohibiting or restricting circumvention of such
+-measures.
+-
+-  When you convey a covered work, you waive any legal power to forbid
+-circumvention of technological measures to the extent such circumvention
+-is effected by exercising rights under this License with respect to
+-the covered work, and you disclaim any intention to limit operation or
+-modification of the work as a means of enforcing, against the work's
+-users, your or third parties' legal rights to forbid circumvention of
+-technological measures.
+-
+-  4. Conveying Verbatim Copies.
+-
+-  You may convey verbatim copies of the Program's source code as you
+-receive it, in any medium, provided that you conspicuously and
+-appropriately publish on each copy an appropriate copyright notice;
+-keep intact all notices stating that this License and any
+-non-permissive terms added in accord with section 7 apply to the code;
+-keep intact all notices of the absence of any warranty; and give all
+-recipients a copy of this License along with the Program.
+-
+-  You may charge any price or no price for each copy that you convey,
+-and you may offer support or warranty protection for a fee.
+-
+-  5. Conveying Modified Source Versions.
+-
+-  You may convey a work based on the Program, or the modifications to
+-produce it from the Program, in the form of source code under the
+-terms of section 4, provided that you also meet all of these conditions:
+-
+-    a) The work must carry prominent notices stating that you modified
+-    it, and giving a relevant date.
+-
+-    b) The work must carry prominent notices stating that it is
+-    released under this License and any conditions added under section
+-    7.  This requirement modifies the requirement in section 4 to
+-    "keep intact all notices".
+-
+-    c) You must license the entire work, as a whole, under this
+-    License to anyone who comes into possession of a copy.  This
+-    License will therefore apply, along with any applicable section 7
+-    additional terms, to the whole of the work, and all its parts,
+-    regardless of how they are packaged.  This License gives no
+-    permission to license the work in any other way, but it does not
+-    invalidate such permission if you have separately received it.
+-
+-    d) If the work has interactive user interfaces, each must display
+-    Appropriate Legal Notices; however, if the Program has interactive
+-    interfaces that do not display Appropriate Legal Notices, your
+-    work need not make them do so.
+-
+-  A compilation of a covered work with other separate and independent
+-works, which are not by their nature extensions of the covered work,
+-and which are not combined with it such as to form a larger program,
+-in or on a volume of a storage or distribution medium, is called an
+-"aggregate" if the compilation and its resulting copyright are not
+-used to limit the access or legal rights of the compilation's users
+-beyond what the individual works permit.  Inclusion of a covered work
+-in an aggregate does not cause this License to apply to the other
+-parts of the aggregate.
+-
+-  6. Conveying Non-Source Forms.
+-
+-  You may convey a covered work in object code form under the terms
+-of sections 4 and 5, provided that you also convey the
+-machine-readable Corresponding Source under the terms of this License,
+-in one of these ways:
+-
+-    a) Convey the object code in, or embodied in, a physical product
+-    (including a physical distribution medium), accompanied by the
+-    Corresponding Source fixed on a durable physical medium
+-    customarily used for software interchange.
+-
+-    b) Convey the object code in, or embodied in, a physical product
+-    (including a physical distribution medium), accompanied by a
+-    written offer, valid for at least three years and valid for as
+-    long as you offer spare parts or customer support for that product
+-    model, to give anyone who possesses the object code either (1) a
+-    copy of the Corresponding Source for all the software in the
+-    product that is covered by this License, on a durable physical
+-    medium customarily used for software interchange, for a price no
+-    more than your reasonable cost of physically performing this
+-    conveying of source, or (2) access to copy the
+-    Corresponding Source from a network server at no charge.
+-
+-    c) Convey individual copies of the object code with a copy of the
+-    written offer to provide the Corresponding Source.  This
+-    alternative is allowed only occasionally and noncommercially, and
+-    only if you received the object code with such an offer, in accord
+-    with subsection 6b.
+-
+-    d) Convey the object code by offering access from a designated
+-    place (gratis or for a charge), and offer equivalent access to the
+-    Corresponding Source in the same way through the same place at no
+-    further charge.  You need not require recipients to copy the
+-    Corresponding Source along with the object code.  If the place to
+-    copy the object code is a network server, the Corresponding Source
+-    may be on a different server (operated by you or a third party)
+-    that supports equivalent copying facilities, provided you maintain
+-    clear directions next to the object code saying where to find the
+-    Corresponding Source.  Regardless of what server hosts the
+-    Corresponding Source, you remain obligated to ensure that it is
+-    available for as long as needed to satisfy these requirements.
+-
+-    e) Convey the object code using peer-to-peer transmission, provided
+-    you inform other peers where the object code and Corresponding
+-    Source of the work are being offered to the general public at no
+-    charge under subsection 6d.
+-
+-  A separable portion of the object code, whose source code is excluded
+-from the Corresponding Source as a System Library, need not be
+-included in conveying the object code work.
+-
+-  A "User Product" is either (1) a "consumer product", which means any
+-tangible personal property which is normally used for personal, family,
+-or household purposes, or (2) anything designed or sold for incorporation
+-into a dwelling.  In determining whether a product is a consumer product,
+-doubtful cases shall be resolved in favor of coverage.  For a particular
+-product received by a particular user, "normally used" refers to a
+-typical or common use of that class of product, regardless of the status
+-of the particular user or of the way in which the particular user
+-actually uses, or expects or is expected to use, the product.  A product
+-is a consumer product regardless of whether the product has substantial
+-commercial, industrial or non-consumer uses, unless such uses represent
+-the only significant mode of use of the product.
+-
+-  "Installation Information" for a User Product means any methods,
+-procedures, authorization keys, or other information required to install
+-and execute modified versions of a covered work in that User Product from
+-a modified version of its Corresponding Source.  The information must
+-suffice to ensure that the continued functioning of the modified object
+-code is in no case prevented or interfered with solely because
+-modification has been made.
+-
+-  If you convey an object code work under this section in, or with, or
+-specifically for use in, a User Product, and the conveying occurs as
+-part of a transaction in which the right of possession and use of the
+-User Product is transferred to the recipient in perpetuity or for a
+-fixed term (regardless of how the transaction is characterized), the
+-Corresponding Source conveyed under this section must be accompanied
+-by the Installation Information.  But this requirement does not apply
+-if neither you nor any third party retains the ability to install
+-modified object code on the User Product (for example, the work has
+-been installed in ROM).
+-
+-  The requirement to provide Installation Information does not include a
+-requirement to continue to provide support service, warranty, or updates
+-for a work that has been modified or installed by the recipient, or for
+-the User Product in which it has been modified or installed.  Access to a
+-network may be denied when the modification itself materially and
+-adversely affects the operation of the network or violates the rules and
+-protocols for communication across the network.
+-
+-  Corresponding Source conveyed, and Installation Information provided,
+-in accord with this section must be in a format that is publicly
+-documented (and with an implementation available to the public in
+-source code form), and must require no special password or key for
+-unpacking, reading or copying.
+-
+-  7. Additional Terms.
+-
+-  "Additional permissions" are terms that supplement the terms of this
+-License by making exceptions from one or more of its conditions.
+-Additional permissions that are applicable to the entire Program shall
+-be treated as though they were included in this License, to the extent
+-that they are valid under applicable law.  If additional permissions
+-apply only to part of the Program, that part may be used separately
+-under those permissions, but the entire Program remains governed by
+-this License without regard to the additional permissions.
+-
+-  When you convey a copy of a covered work, you may at your option
+-remove any additional permissions from that copy, or from any part of
+-it.  (Additional permissions may be written to require their own
+-removal in certain cases when you modify the work.)  You may place
+-additional permissions on material, added by you to a covered work,
+-for which you have or can give appropriate copyright permission.
+-
+-  Notwithstanding any other provision of this License, for material you
+-add to a covered work, you may (if authorized by the copyright holders of
+-that material) supplement the terms of this License with terms:
+-
+-    a) Disclaiming warranty or limiting liability differently from the
+-    terms of sections 15 and 16 of this License; or
+-
+-    b) Requiring preservation of specified reasonable legal notices or
+-    author attributions in that material or in the Appropriate Legal
+-    Notices displayed by works containing it; or
+-
+-    c) Prohibiting misrepresentation of the origin of that material, or
+-    requiring that modified versions of such material be marked in
+-    reasonable ways as different from the original version; or
+-
+-    d) Limiting the use for publicity purposes of names of licensors or
+-    authors of the material; or
+-
+-    e) Declining to grant rights under trademark law for use of some
+-    trade names, trademarks, or service marks; or
+-
+-    f) Requiring indemnification of licensors and authors of that
+-    material by anyone who conveys the material (or modified versions of
+-    it) with contractual assumptions of liability to the recipient, for
+-    any liability that these contractual assumptions directly impose on
+-    those licensors and authors.
+-
+-  All other non-permissive additional terms are considered "further
+-restrictions" within the meaning of section 10.  If the Program as you
+-received it, or any part of it, contains a notice stating that it is
+-governed by this License along with a term that is a further
+-restriction, you may remove that term.  If a license document contains
+-a further restriction but permits relicensing or conveying under this
+-License, you may add to a covered work material governed by the terms
+-of that license document, provided that the further restriction does
+-not survive such relicensing or conveying.
+-
+-  If you add terms to a covered work in accord with this section, you
+-must place, in the relevant source files, a statement of the
+-additional terms that apply to those files, or a notice indicating
+-where to find the applicable terms.
+-
+-  Additional terms, permissive or non-permissive, may be stated in the
+-form of a separately written license, or stated as exceptions;
+-the above requirements apply either way.
+-
+-  8. Termination.
+-
+-  You may not propagate or modify a covered work except as expressly
+-provided under this License.  Any attempt otherwise to propagate or
+-modify it is void, and will automatically terminate your rights under
+-this License (including any patent licenses granted under the third
+-paragraph of section 11).
+-
+-  However, if you cease all violation of this License, then your
+-license from a particular copyright holder is reinstated (a)
+-provisionally, unless and until the copyright holder explicitly and
+-finally terminates your license, and (b) permanently, if the copyright
+-holder fails to notify you of the violation by some reasonable means
+-prior to 60 days after the cessation.
+-
+-  Moreover, your license from a particular copyright holder is
+-reinstated permanently if the copyright holder notifies you of the
+-violation by some reasonable means, this is the first time you have
+-received notice of violation of this License (for any work) from that
+-copyright holder, and you cure the violation prior to 30 days after
+-your receipt of the notice.
+-
+-  Termination of your rights under this section does not terminate the
+-licenses of parties who have received copies or rights from you under
+-this License.  If your rights have been terminated and not permanently
+-reinstated, you do not qualify to receive new licenses for the same
+-material under section 10.
+-
+-  9. Acceptance Not Required for Having Copies.
+-
+-  You are not required to accept this License in order to receive or
+-run a copy of the Program.  Ancillary propagation of a covered work
+-occurring solely as a consequence of using peer-to-peer transmission
+-to receive a copy likewise does not require acceptance.  However,
+-nothing other than this License grants you permission to propagate or
+-modify any covered work.  These actions infringe copyright if you do
+-not accept this License.  Therefore, by modifying or propagating a
+-covered work, you indicate your acceptance of this License to do so.
+-
+-  10. Automatic Licensing of Downstream Recipients.
+-
+-  Each time you convey a covered work, the recipient automatically
+-receives a license from the original licensors, to run, modify and
+-propagate that work, subject to this License.  You are not responsible
+-for enforcing compliance by third parties with this License.
+-
+-  An "entity transaction" is a transaction transferring control of an
+-organization, or substantially all assets of one, or subdividing an
+-organization, or merging organizations.  If propagation of a covered
+-work results from an entity transaction, each party to that
+-transaction who receives a copy of the work also receives whatever
+-licenses to the work the party's predecessor in interest had or could
+-give under the previous paragraph, plus a right to possession of the
+-Corresponding Source of the work from the predecessor in interest, if
+-the predecessor has it or can get it with reasonable efforts.
+-
+-  You may not impose any further restrictions on the exercise of the
+-rights granted or affirmed under this License.  For example, you may
+-not impose a license fee, royalty, or other charge for exercise of
+-rights granted under this License, and you may not initiate litigation
+-(including a cross-claim or counterclaim in a lawsuit) alleging that
+-any patent claim is infringed by making, using, selling, offering for
+-sale, or importing the Program or any portion of it.
+-
+-  11. Patents.
+-
+-  A "contributor" is a copyright holder who authorizes use under this
+-License of the Program or a work on which the Program is based.  The
+-work thus licensed is called the contributor's "contributor version".
+-
+-  A contributor's "essential patent claims" are all patent claims
+-owned or controlled by the contributor, whether already acquired or
+-hereafter acquired, that would be infringed by some manner, permitted
+-by this License, of making, using, or selling its contributor version,
+-but do not include claims that would be infringed only as a
+-consequence of further modification of the contributor version.  For
+-purposes of this definition, "control" includes the right to grant
+-patent sublicenses in a manner consistent with the requirements of
+-this License.
+-
+-  Each contributor grants you a non-exclusive, worldwide, royalty-free
+-patent license under the contributor's essential patent claims, to
+-make, use, sell, offer for sale, import and otherwise run, modify and
+-propagate the contents of its contributor version.
+-
+-  In the following three paragraphs, a "patent license" is any express
+-agreement or commitment, however denominated, not to enforce a patent
+-(such as an express permission to practice a patent or covenant not to
+-sue for patent infringement).  To "grant" such a patent license to a
+-party means to make such an agreement or commitment not to enforce a
+-patent against the party.
+-
+-  If you convey a covered work, knowingly relying on a patent license,
+-and the Corresponding Source of the work is not available for anyone
+-to copy, free of charge and under the terms of this License, through a
+-publicly available network server or other readily accessible means,
+-then you must either (1) cause the Corresponding Source to be so
+-available, or (2) arrange to deprive yourself of the benefit of the
+-patent license for this particular work, or (3) arrange, in a manner
+-consistent with the requirements of this License, to extend the patent
+-license to downstream recipients.  "Knowingly relying" means you have
+-actual knowledge that, but for the patent license, your conveying the
+-covered work in a country, or your recipient's use of the covered work
+-in a country, would infringe one or more identifiable patents in that
+-country that you have reason to believe are valid.
+-
+-  If, pursuant to or in connection with a single transaction or
+-arrangement, you convey, or propagate by procuring conveyance of, a
+-covered work, and grant a patent license to some of the parties
+-receiving the covered work authorizing them to use, propagate, modify
+-or convey a specific copy of the covered work, then the patent license
+-you grant is automatically extended to all recipients of the covered
+-work and works based on it.
+-
+-  A patent license is "discriminatory" if it does not include within
+-the scope of its coverage, prohibits the exercise of, or is
+-conditioned on the non-exercise of one or more of the rights that are
+-specifically granted under this License.  You may not convey a covered
+-work if you are a party to an arrangement with a third party that is
+-in the business of distributing software, under which you make payment
+-to the third party based on the extent of your activity of conveying
+-the work, and under which the third party grants, to any of the
+-parties who would receive the covered work from you, a discriminatory
+-patent license (a) in connection with copies of the covered work
+-conveyed by you (or copies made from those copies), or (b) primarily
+-for and in connection with specific products or compilations that
+-contain the covered work, unless you entered into that arrangement,
+-or that patent license was granted, prior to 28 March 2007.
+-
+-  Nothing in this License shall be construed as excluding or limiting
+-any implied license or other defenses to infringement that may
+-otherwise be available to you under applicable patent law.
+-
+-  12. No Surrender of Others' Freedom.
+-
+-  If conditions are imposed on you (whether by court order, agreement or
+-otherwise) that contradict the conditions of this License, they do not
+-excuse you from the conditions of this License.  If you cannot convey a
+-covered work so as to satisfy simultaneously your obligations under this
+-License and any other pertinent obligations, then as a consequence you may
+-not convey it at all.  For example, if you agree to terms that obligate you
+-to collect a royalty for further conveying from those to whom you convey
+-the Program, the only way you could satisfy both those terms and this
+-License would be to refrain entirely from conveying the Program.
+-
+-  13. Use with the GNU Affero General Public License.
+-
+-  Notwithstanding any other provision of this License, you have
+-permission to link or combine any covered work with a work licensed
+-under version 3 of the GNU Affero General Public License into a single
+-combined work, and to convey the resulting work.  The terms of this
+-License will continue to apply to the part which is the covered work,
+-but the special requirements of the GNU Affero General Public License,
+-section 13, concerning interaction through a network will apply to the
+-combination as such.
+-
+-  14. Revised Versions of this License.
+-
+-  The Free Software Foundation may publish revised and/or new versions of
+-the GNU General Public License from time to time.  Such new versions will
+-be similar in spirit to the present version, but may differ in detail to
+-address new problems or concerns.
+-
+-  Each version is given a distinguishing version number.  If the
+-Program specifies that a certain numbered version of the GNU General
+-Public License "or any later version" applies to it, you have the
+-option of following the terms and conditions either of that numbered
+-version or of any later version published by the Free Software
+-Foundation.  If the Program does not specify a version number of the
+-GNU General Public License, you may choose any version ever published
+-by the Free Software Foundation.
+-
+-  If the Program specifies that a proxy can decide which future
+-versions of the GNU General Public License can be used, that proxy's
+-public statement of acceptance of a version permanently authorizes you
+-to choose that version for the Program.
+-
+-  Later license versions may give you additional or different
+-permissions.  However, no additional obligations are imposed on any
+-author or copyright holder as a result of your choosing to follow a
+-later version.
+-
+-  15. Disclaimer of Warranty.
+-
+-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+-IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+-
+-  16. Limitation of Liability.
+-
+-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+-SUCH DAMAGES.
+-
+-  17. Interpretation of Sections 15 and 16.
+-
+-  If the disclaimer of warranty and limitation of liability provided
+-above cannot be given local legal effect according to their terms,
+-reviewing courts shall apply local law that most closely approximates
+-an absolute waiver of all civil liability in connection with the
+-Program, unless a warranty or assumption of liability accompanies a
+-copy of the Program in return for a fee.
+-
+-                     END OF TERMS AND CONDITIONS
+-
+-            How to Apply These Terms to Your New Programs
+-
+-  If you develop a new program, and you want it to be of the greatest
+-possible use to the public, the best way to achieve this is to make it
+-free software which everyone can redistribute and change under these terms.
+-
+-  To do so, attach the following notices to the program.  It is safest
+-to attach them to the start of each source file to most effectively
+-state the exclusion of warranty; and each file should have at least
+-the "copyright" line and a pointer to where the full notice is found.
+-
+-    <one line to give the program's name and a brief idea of what it does.>
+-    Copyright (C) <year>  <name of author>
+-
+-    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 3 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, see <http://www.gnu.org/licenses/>.
+-
+-Also add information on how to contact you by electronic and paper mail.
+-
+-  If the program does terminal interaction, make it output a short
+-notice like this when it starts in an interactive mode:
+-
+-    <program>  Copyright (C) <year>  <name of author>
+-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+-    This is free software, and you are welcome to redistribute it
+-    under certain conditions; type `show c' for details.
+-
+-The hypothetical commands `show w' and `show c' should show the appropriate
+-parts of the General Public License.  Of course, your program's commands
+-might be different; for a GUI interface, you would use an "about box".
+-
+-  You should also get your employer (if you work as a programmer) or school,
+-if any, to sign a "copyright disclaimer" for the program, if necessary.
+-For more information on this, and how to apply and follow the GNU GPL, see
+-<http://www.gnu.org/licenses/>.
+-
+-  The GNU General Public License does not permit incorporating your program
+-into proprietary programs.  If your program is a subroutine library, you
+-may consider it more useful to permit linking proprietary applications with
+-the library.  If this is what you want to do, use the GNU Lesser General
+-Public License instead of this License.  But first, please read
+-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+-- 
+1.8.3.1
+
diff --git a/SOURCES/0042-RHEL-7-Ignore-etc-release-if-etc-redhat-release-exis.patch b/SOURCES/0042-RHEL-7-Ignore-etc-release-if-etc-redhat-release-exis.patch
deleted file mode 100644
index 4aed775..0000000
--- a/SOURCES/0042-RHEL-7-Ignore-etc-release-if-etc-redhat-release-exis.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From e053a58f7881df8372ff0d6d849d193b7778e1d8 Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones" <rjones@redhat.com>
-Date: Mon, 5 Nov 2012 11:19:19 +0000
-Subject: [PATCH] RHEL 7: Ignore /etc/release if /etc/redhat-release exists
- (RHBZ#873219).
-
-If the user has created /etc/release on a RHEL machine, don't
-mis-detect the OS as NetBSD.
----
- src/inspect-fs.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/src/inspect-fs.c b/src/inspect-fs.c
-index 0473e92..4ad294b 100644
---- a/src/inspect-fs.c
-+++ b/src/inspect-fs.c
-@@ -223,7 +223,8 @@ check_filesystem (guestfs_h *g, const char *mountable,
-   else if (is_dir_etc &&
-            is_dir_bin &&
-            guestfs_is_file (g, "/etc/fstab") > 0 &&
--           guestfs_is_file (g, "/etc/release") > 0) {
-+           guestfs_is_file (g, "/etc/release") > 0 &&
-+           guestfs_is_file (g, "/etc/redhat-release") == 0) {
-     /* Ignore /dev/sda1 which is a shadow of the real root filesystem
-      * that is probably /dev/sda5 (see:
-      * http://www.freebsd.org/doc/handbook/disk-organization.html)
--- 
-1.8.3.1
-
diff --git a/SOURCES/0042-sparsify-Prevent-overwriting-block-or-char-output-de.patch b/SOURCES/0042-sparsify-Prevent-overwriting-block-or-char-output-de.patch
new file mode 100644
index 0000000..ced693a
--- /dev/null
+++ b/SOURCES/0042-sparsify-Prevent-overwriting-block-or-char-output-de.patch
@@ -0,0 +1,49 @@
+From 05d53de9cdc06a5c822b13aed9cae6ce9a278e09 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones@redhat.com>
+Date: Wed, 22 Jan 2014 13:10:08 +0000
+Subject: [PATCH] sparsify: Prevent overwriting block or char output devices
+ (RHBZ#1056290).
+
+virt-sparsify doesn't work if the output is a block device, and cannot
+possibly work if the output is a char device.  Currently if you try
+this it actually overwrites (deletes) the output device which is not
+exactly desirable.  Therefore throw an error and exit.
+
+Cherry picked from commit 13bca32e4ec9213e69ea55e837dea846719fb67e.
+Added additional supporting functions is_block_device and
+is_char_device from upstream.
+---
+ sparsify/sparsify.ml | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+diff --git a/sparsify/sparsify.ml b/sparsify/sparsify.ml
+index 659d46f..d2f5347 100644
+--- a/sparsify/sparsify.ml
++++ b/sparsify/sparsify.ml
+@@ -151,6 +151,23 @@ read the man page virt-sparsify(1).
+   if contains_colon outdisk then
+     error (f_"output filename '%s' contains a colon (':'); qemu-img command line syntax prevents us from using such an image") outdisk;
+ 
++  (* Check the output is not a block or char special (RHBZ#1056290). *)
++  let is_block_device file =
++    try (Unix.stat file).Unix.st_kind = Unix.S_BLK
++    with Unix.Unix_error _ -> false
++  and is_char_device file =
++    try (Unix.stat file).Unix.st_kind = Unix.S_CHR
++    with Unix.Unix_error _ -> false
++  in
++
++  if is_block_device outdisk then
++    error (f_"output '%s' cannot be a block device, it must be a regular file")
++      outdisk;
++
++  if is_char_device outdisk then
++    error (f_"output '%s' cannot be a character device, it must be a regular file")
++      outdisk;
++
+   indisk, outdisk, compress, convert,
+     debug_gc, format, ignores, machine_readable,
+     option, quiet, verbose, trace, zeroes
+-- 
+1.8.3.1
+
diff --git a/SOURCES/0043-RHEL-7-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch b/SOURCES/0043-RHEL-7-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch
deleted file mode 100644
index 18bbe13..0000000
--- a/SOURCES/0043-RHEL-7-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch
+++ /dev/null
@@ -1,344 +0,0 @@
-From 3001eccab8e8907128ffd73745fdfeb82493809c Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones" <rjones@redhat.com>
-Date: Thu, 18 Jul 2013 18:31:53 +0100
-Subject: [PATCH] RHEL 7: Remove 9p APIs from RHEL (RHBZ#921710).
-
----
- Makefile.am          |   2 +-
- daemon/9p.c          | 221 ---------------------------------------------------
- daemon/Makefile.am   |   1 -
- generator/actions.ml |  23 ------
- gobject/Makefile.inc |   2 -
- po/POTFILES          |   2 -
- 6 files changed, 1 insertion(+), 250 deletions(-)
- delete mode 100644 daemon/9p.c
-
-diff --git a/Makefile.am b/Makefile.am
-index c36f028..a09bd82 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -53,7 +53,7 @@ SUBDIRS += tests/xfs
- SUBDIRS += tests/charsets
- SUBDIRS += tests/xml
- SUBDIRS += tests/mount-local
--SUBDIRS += tests/9p
-+#SUBDIRS += tests/9p
- SUBDIRS += tests/rsync
- SUBDIRS += tests/bigdirs
- SUBDIRS += tests/disk-labels
-diff --git a/daemon/9p.c b/daemon/9p.c
-deleted file mode 100644
-index 024ac24..0000000
---- a/daemon/9p.c
-+++ /dev/null
-@@ -1,221 +0,0 @@
--/* libguestfs - the guestfsd daemon
-- * Copyright (C) 2011 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.
-- */
--
--#include <config.h>
--
--#include <stdio.h>
--#include <stdlib.h>
--#include <string.h>
--#include <unistd.h>
--#include <limits.h>
--#include <errno.h>
--#include <sys/types.h>
--#include <sys/stat.h>
--#include <dirent.h>
--#include <fcntl.h>
--
--#include "daemon.h"
--#include "actions.h"
--
--#define BUS_PATH "/sys/bus/virtio/drivers/9pnet_virtio"
--GUESTFSD_EXT_CMD(str_mount, mount);
--
--static char *read_whole_file (const char *filename);
--
--/* https://bugzilla.redhat.com/show_bug.cgi?id=714981#c1 */
--char **
--do_list_9p (void)
--{
--  DECLARE_STRINGSBUF (r);
--
--  DIR *dir;
--
--  dir = opendir (BUS_PATH);
--  if (!dir) {
--    perror ("opendir: " BUS_PATH);
--    if (errno != ENOENT) {
--      reply_with_perror ("opendir: " BUS_PATH);
--      return NULL;
--    }
--
--    /* If this directory doesn't exist, it probably means that
--     * the virtio driver isn't loaded.  Don't return an error
--     * in this case, but return an empty list.
--     */
--    if (end_stringsbuf (&r) == -1)
--      return NULL;
--
--    return r.argv;
--  }
--
--  while (1) {
--    errno = 0;
--    struct dirent *d = readdir (dir);
--    if (d == NULL) break;
--
--    if (STRPREFIX (d->d_name, "virtio")) {
--      char mount_tag_path[256];
--      snprintf (mount_tag_path, sizeof mount_tag_path,
--                BUS_PATH "/%s/mount_tag", d->d_name);
--
--      /* A bit unclear, but it looks like the virtio transport allows
--       * the mount tag length to be unlimited (or up to 65536 bytes).
--       * See: linux/include/linux/virtio_9p.h
--       */
--      CLEANUP_FREE char *mount_tag = read_whole_file (mount_tag_path);
--      if (mount_tag == 0)
--        continue;
--
--      if (add_string (&r, mount_tag) == -1) {
--        closedir (dir);
--        return NULL;
--      }
--    }
--  }
--
--  /* Check readdir didn't fail */
--  if (errno != 0) {
--    reply_with_perror ("readdir: /sys/block");
--    free_stringslen (r.argv, r.size);
--    closedir (dir);
--    return NULL;
--  }
--
--  /* Close the directory handle */
--  if (closedir (dir) == -1) {
--    reply_with_perror ("closedir: /sys/block");
--    free_stringslen (r.argv, r.size);
--    return NULL;
--  }
--
--  /* Sort the tags. */
--  if (r.size > 0)
--    sort_strings (r.argv, r.size);
--
--  /* NULL terminate the list */
--  if (end_stringsbuf (&r) == -1)
--    return NULL;
--
--  return r.argv;
--}
--
--/* Read whole file into dynamically allocated array.  If there is an
-- * error, DON'T call reply_with_perror, just return NULL.  Returns a
-- * \0-terminated string.
-- */
--static char *
--read_whole_file (const char *filename)
--{
--  char *r = NULL;
--  size_t alloc = 0, size = 0;
--  int fd;
--
--  fd = open (filename, O_RDONLY|O_CLOEXEC);
--  if (fd == -1) {
--    perror (filename);
--    return NULL;
--  }
--
--  while (1) {
--    alloc += 256;
--    char *r2 = realloc (r, alloc);
--    if (r2 == NULL) {
--      perror ("realloc");
--      free (r);
--      close (fd);
--      return NULL;
--    }
--    r = r2;
--
--    /* The '- 1' in the size calculation ensures there is space below
--     * to add \0 to the end of the input.
--     */
--    ssize_t n = read (fd, r + size, alloc - size - 1);
--    if (n == -1) {
--      fprintf (stderr, "read: %s: %m\n", filename);
--      free (r);
--      close (fd);
--      return NULL;
--    }
--    if (n == 0)
--      break;
--    size += n;
--  }
--
--  if (close (fd) == -1) {
--    fprintf (stderr, "close: %s: %m\n", filename);
--    free (r);
--    return NULL;
--  }
--
--  r[size] = '\0';
--
--  return r;
--}
--
--/* Takes optional arguments, consult optargs_bitmask. */
--int
--do_mount_9p (const char *mount_tag, const char *mountpoint, const char *options)
--{
--  CLEANUP_FREE char *mp = NULL, *opts = NULL, *err = NULL;
--  struct stat statbuf;
--  int r;
--
--  ABS_PATH (mountpoint, , return -1);
--
--  mp = sysroot_path (mountpoint);
--  if (!mp) {
--    reply_with_perror ("malloc");
--    return -1;
--  }
--
--  /* Check the mountpoint exists and is a directory. */
--  if (stat (mp, &statbuf) == -1) {
--    reply_with_perror ("%s", mountpoint);
--    return -1;
--  }
--  if (!S_ISDIR (statbuf.st_mode)) {
--    reply_with_perror ("%s: mount point is not a directory", mountpoint);
--    return -1;
--  }
--
--  /* Add trans=virtio to the options. */
--  if ((optargs_bitmask & GUESTFS_MOUNT_9P_OPTIONS_BITMASK) &&
--      STRNEQ (options, "")) {
--    if (asprintf (&opts, "trans=virtio,%s", options) == -1) {
--      reply_with_perror ("asprintf");
--      return -1;
--    }
--  }
--  else {
--    opts = strdup ("trans=virtio");
--    if (opts == NULL) {
--      reply_with_perror ("strdup");
--      return -1;
--    }
--  }
--
--  r = command (NULL, &err,
--               str_mount, "-o", opts, "-t", "9p", mount_tag, mp, NULL);
--  if (r == -1) {
--    reply_with_error ("%s on %s: %s", mount_tag, mountpoint, err);
--    return -1;
--  }
--
--  return 0;
--}
-diff --git a/daemon/Makefile.am b/daemon/Makefile.am
-index d077dab..13a04ac 100644
---- a/daemon/Makefile.am
-+++ b/daemon/Makefile.am
-@@ -77,7 +77,6 @@ noinst_PROGRAMS = guestfsd
- endif
- 
- guestfsd_SOURCES = \
--	9p.c \
- 	acl.c \
- 	actions.h \
- 	available.c \
-diff --git a/generator/actions.ml b/generator/actions.ml
-index 24f4468..ccd9e95 100644
---- a/generator/actions.ml
-+++ b/generator/actions.ml
-@@ -8886,29 +8886,6 @@ This returns true iff the device exists and contains all zero bytes.
- Note that for large devices this can take a long time to run." };
- 
-   { defaults with
--    name = "list_9p";
--    style = RStringList "mounttags", [], [];
--    proc_nr = Some 285;
--    shortdesc = "list 9p filesystems";
--    longdesc = "\
--List all 9p filesystems attached to the guest.  A list of
--mount tags is returned." };
--
--  { defaults with
--    name = "mount_9p";
--    style = RErr, [String "mounttag"; String "mountpoint"], [OString "options"];
--    proc_nr = Some 286;
--    camel_name = "Mount9P";
--    shortdesc = "mount 9p filesystem";
--    longdesc = "\
--Mount the virtio-9p filesystem with the tag C<mounttag> on the
--directory C<mountpoint>.
--
--If required, C<trans=virtio> will be automatically added to the options.
--Any other options required can be passed in the optional C<options>
--parameter." };
--
--  { defaults with
-     name = "list_dm_devices";
-     style = RStringList "devices", [], [];
-     proc_nr = Some 287;
-diff --git a/gobject/Makefile.inc b/gobject/Makefile.inc
-index 19c771f..47360cb 100644
---- a/gobject/Makefile.inc
-+++ b/gobject/Makefile.inc
-@@ -64,7 +64,6 @@ guestfs_gobject_headers= \
-   include/guestfs-gobject/optargs-is_fifo.h \
-   include/guestfs-gobject/optargs-is_socket.h \
-   include/guestfs-gobject/optargs-mkfs.h \
--  include/guestfs-gobject/optargs-mount_9p.h \
-   include/guestfs-gobject/optargs-ntfsresize.h \
-   include/guestfs-gobject/optargs-btrfs_filesystem_resize.h \
-   include/guestfs-gobject/optargs-compress_out.h \
-@@ -138,7 +137,6 @@ guestfs_gobject_sources= \
-   src/optargs-is_fifo.c \
-   src/optargs-is_socket.c \
-   src/optargs-mkfs.c \
--  src/optargs-mount_9p.c \
-   src/optargs-ntfsresize.c \
-   src/optargs-btrfs_filesystem_resize.c \
-   src/optargs-compress_out.c \
-diff --git a/po/POTFILES b/po/POTFILES
-index 53b660d..cc4e917 100644
---- a/po/POTFILES
-+++ b/po/POTFILES
-@@ -2,7 +2,6 @@ align/scan.c
- cat/virt-cat.c
- cat/virt-filesystems.c
- cat/virt-ls.c
--daemon/9p.c
- daemon/acl.c
- daemon/augeas.c
- daemon/available.c
-@@ -180,7 +179,6 @@ gobject/src/optargs-mkfs.c
- gobject/src/optargs-mkfs_btrfs.c
- gobject/src/optargs-mkswap.c
- gobject/src/optargs-mktemp.c
--gobject/src/optargs-mount_9p.c
- gobject/src/optargs-mount_local.c
- gobject/src/optargs-ntfsclone_out.c
- gobject/src/optargs-ntfsfix.c
--- 
-1.8.3.1
-
diff --git a/SOURCES/0043-fuse-In-mount-local-run-test-if-root-filesystem-has-.patch b/SOURCES/0043-fuse-In-mount-local-run-test-if-root-filesystem-has-.patch
new file mode 100644
index 0000000..f058311
--- /dev/null
+++ b/SOURCES/0043-fuse-In-mount-local-run-test-if-root-filesystem-has-.patch
@@ -0,0 +1,57 @@
+From bcd31e216bdefd61dbc8eafebcfa36953928597c Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones@redhat.com>
+Date: Fri, 24 Jan 2014 10:20:14 +0000
+Subject: [PATCH] fuse: In mount-local-run, test if root filesystem has been
+ mounted (RHBZ#1057504).
+
+It is never normally valid to use the mount-local* APIs when you
+haven't mounted some filesystems in the libguestfs namespace.
+
+If you try it, it results in some odd errors.  The mount-local-run
+call is successful, but subsequent operations fail:
+
+$ mkdir -p /tmp/mnt
+$ guestfish -x -N fs mount-local /tmp/mnt : mount-local-run
+libguestfs: error: lstat: lstat_stub: you must call 'mount' first to mount the root filesystem
+libguestfs: error: lstat: lstat_stub: you must call 'mount' first to mount the root filesystem
+
+With this commit, the mount-local-run call gives an error:
+
+libguestfs: error: you must call 'guestfs_mount' first to mount a filesystem on '/'.
+Note: '/tmp/mnt' is still mounted.  Use 'guestunmount /tmp/mnt' to clean up.
+
+The error is implemented by calling guestfs_exists (g, "/") which has
+the side effect of running the NEED_ROOT macro in the daemon.  (There
+is no simple equivalent of NEED_ROOT on the library side.)
+
+(cherry picked from commit 0e2489974b91e4728d544fe2aa08c2a1c9deb365)
+---
+ src/fuse.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/src/fuse.c b/src/fuse.c
+index 967a744..e84ea84 100644
+--- a/src/fuse.c
++++ b/src/fuse.c
+@@ -1011,6 +1011,18 @@ guestfs__mount_local_run (guestfs_h *g)
+     return -1;
+   }
+ 
++  /* Test if root is mounted.  We do this by using a side-effect of
++   * guestfs_exists (which is that it calls NEED_ROOT).
++   */
++  guestfs_push_error_handler (g, NULL, NULL);
++  r = guestfs_exists (g, "/");
++  guestfs_pop_error_handler (g);
++  if (r == -1) {
++    error (g, _("you must call 'guestfs_mount' first to mount a filesystem on '/'.\nNote: '%s' is still mounted.  Use 'guestunmount %s' to clean up."),
++           g->localmountpoint, g->localmountpoint);
++    return -1;
++  }
++
+   debug (g, "%s: entering fuse_loop", __func__);
+ 
+   /* Enter the main loop. */
+-- 
+1.8.3.1
+
diff --git a/SOURCES/0044-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch b/SOURCES/0044-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch
deleted file mode 100644
index bf0dd2e..0000000
--- a/SOURCES/0044-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch
+++ /dev/null
@@ -1,475 +0,0 @@
-From c1bb594927f8fbc8df2c608f804249611893f06c 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 7: Disable unsupported remote drive protocols
- (RHBZ#962113).
-
-This disables support for unsupported remote drive protocols:
-
- * ftp
- * ftps
- * http
- * https
- * tftp
- * gluster
- * iscsi
- * rbd
- * 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 7.
----
- fish/guestfish.pod   |  67 ----------------------------
- fish/test-add-uri.sh |  29 ------------
- generator/actions.ml |  72 ------------------------------
- src/drives.c         |   8 ++++
- src/guestfs.pod      | 121 ---------------------------------------------------
- 5 files changed, 8 insertions(+), 289 deletions(-)
-
-diff --git a/fish/guestfish.pod b/fish/guestfish.pod
-index c19fe6c..a240280 100644
---- a/fish/guestfish.pod
-+++ b/fish/guestfish.pod
-@@ -1138,40 +1138,6 @@ The possible I<-a URI> formats are described below.
- 
- Add the local disk image (or device) called C<disk.img>.
- 
--=head2 B<-a ftp://[user@]example.com[:port]/disk.img>
--
--=head2 B<-a ftps://[user@]example.com[:port]/disk.img>
--
--=head2 B<-a http://[user@]example.com[:port]/disk.img>
--
--=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.
--
--The equivalent API command would be:
--
-- ><fs> add /disk.img protocol:(ftp|...) server:tcp:example.com
--
--=head2 B<-a gluster://example.com[:port]/disk>
--
--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 /disk 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.
--
--The equivalent API command would be:
--
-- ><fs> add /target-iqn-name/lun protocol:iscsi server:tcp:example.com
--
- =head2 B<-a nbd://example.com[:port]>
- 
- =head2 B<-a nbd://example.com[:port]/exportname>
-@@ -1193,39 +1159,6 @@ The equivalent API command would be (no export name):
- 
-  ><fs> add "" protocol:nbd server:[tcp:example.com|unix:/socket]
- 
--=head2 B<-a rbd://example.com[:port]/disk>
--
--Add a disk image located on a Ceph (RBD/librbd) storage volume.
--
--Although libguestfs and Ceph supports multiple servers, only a single
--server can be specified when using this URI syntax.
--
--The equivalent API command would be:
--
-- ><fs> add /disk protocol:rbd server:tcp:example.com
--
--=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 /disk 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
--Shell (ssh) SFTP protocol.  SFTP is supported out of the box by all
--major SSH servers.
--
--The equivalent API command would be:
--
-- ><fs> add /disk protocol:ssh server:tcp:example.com [username:user]
--
- =head1 PROGRESS BARS
- 
- Some (not all) long-running commands send progress notification
-diff --git a/fish/test-add-uri.sh b/fish/test-add-uri.sh
-index dfeccf7..c481e88 100755
---- a/fish/test-add-uri.sh
-+++ b/fish/test-add-uri.sh
-@@ -37,14 +37,6 @@ function fail ()
- $VG ./guestfish -x -a file://$(pwd)/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
-@@ -58,26 +50,5 @@ grep -sq 'add_drive "" "protocol:nbd" "server:unix:/sk"' test-add-uri.out || fai
- $VG ./guestfish -x -a 'nbd:///export?socket=/sk' </dev/null >test-add-uri.out 2>&1
- grep -sq 'add_drive "/export" "protocol:nbd" "server:unix:/sk"' test-add-uri.out || fail
- 
--# rbd
--$VG ./guestfish -x -a rbd://example.com:3000/disk </dev/null >test-add-uri.out 2>&1
--grep -sq 'add_drive "/disk" "protocol:rbd" "server:tcp:example.com:3000"' 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
--
--$VG ./guestfish -x -a ssh://user@example.com/disk.img </dev/null >test-add-uri.out 2>&1
--grep -sq 'add_drive "/disk.img" "protocol:ssh" "server:tcp:example.com" "username:user"' test-add-uri.out || fail
--
--$VG ./guestfish -x -a ssh://user@example.com:2000/disk.img </dev/null >test-add-uri.out 2>&1
--grep -sq 'add_drive "/disk.img" "protocol:ssh" "server:tcp:example.com:2000" "username:user"' test-add-uri.out || fail
--
- rm test-add-uri.out
- rm test-add-uri.img
-diff --git a/generator/actions.ml b/generator/actions.ml
-index ccd9e95..7d0eae6 100644
---- a/generator/actions.ml
-+++ b/generator/actions.ml
-@@ -1333,27 +1333,6 @@ C<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\">
--
--Connect to a remote FTP, HTTP or TFTP 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>
--
--=item C<protocol = \"iscsi\">
--
--Connect to the iSCSI server.
--The C<server> parameter must also be supplied - see below.
--
--See also: L<guestfs(3)/ISCSI>.
--
- =item C<protocol = \"nbd\">
- 
- Connect to the Network Block Device server.
-@@ -1361,31 +1340,6 @@ The C<server> parameter must also be supplied - see below.
- 
- See also: L<guestfs(3)/NETWORK BLOCK DEVICE>.
- 
--=item C<protocol = \"rbd\">
--
--Connect to the Ceph (librbd/RBD) server.
--The C<server> parameter must also be supplied - see below.
--The C<username> parameter may be supplied.  See below.
--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.
--
--The C<server> parameter must be supplied.
--The C<username> parameter may be supplied.  See below.
--
--See also: L<guestfs(3)/SSH>.
--
- =back
- 
- =item C<server>
-@@ -1396,13 +1350,7 @@ 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
-- iscsi          Exactly one
-  nbd            Exactly one
-- rbd            One 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:
-@@ -1416,26 +1364,6 @@ in one of the following formats:
- If the port number is omitted, then the standard port number
- for the protocol is used (see C</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.
--
--If not given, then the local username is used for C<ssh>, and no authentication
--is attempted for ceph.  But note this sometimes may give unexpected results, for
--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,
--specify the remote username you want.
--
--=item C<secret>
--
--For the C<rbd> protocol only, this specifies the 'secret' to use when
--connecting to the remote device.
--
--If not given, then a secret matching the given username will be looked up in the
--default keychain locations, or if no username is given, then no authentication
--will be used.
--
- =item C<cachemode>
- 
- Choose whether or not libguestfs will obey sync operations (safe but slow)
-diff --git a/src/drives.c b/src/drives.c
-index f310b06..7abd952 100644
---- a/src/drives.c
-+++ b/src/drives.c
-@@ -136,6 +136,7 @@ create_drive_non_file (guestfs_h *g,
-   return drv;
- }
- 
-+#if 0 /* DISABLED IN RHEL 7 */
- static struct drive *
- create_drive_curl (guestfs_h *g,
-                    enum drive_protocol protocol,
-@@ -218,6 +219,7 @@ create_drive_gluster (guestfs_h *g,
-                                 readonly, format, iface, name, disk_label,
-                                 cachemode);
- }
-+#endif /* DISABLED IN RHEL 7 */
- 
- static int
- nbd_port (void)
-@@ -264,6 +266,7 @@ create_drive_nbd (guestfs_h *g,
-                                 cachemode);
- }
- 
-+#if 0 /* DISABLED IN RHEL 7 */
- static struct drive *
- create_drive_rbd (guestfs_h *g,
-                   struct drive_server *servers, size_t nr_servers,
-@@ -451,6 +454,7 @@ create_drive_iscsi (guestfs_h *g,
-                                 readonly, format, iface, name, disk_label,
-                                 cachemode);
- }
-+#endif /* DISABLED IN RHEL 7 */
- 
- /* Traditionally you have been able to use /dev/null as a filename, as
-  * many times as you like.  Ancient KVM (RHEL 5) cannot handle adding
-@@ -865,6 +869,7 @@ guestfs__add_drive_opts (guestfs_h *g, const char *filename,
-                                disk_label, cachemode);
-     }
-   }
-+#if 0 /* DISABLED IN RHEL 7 */
-   else if (STREQ (protocol, "ftp")) {
-     drv = create_drive_curl (g, drive_protocol_ftp,
-                              servers, nr_servers, filename,
-@@ -905,12 +910,14 @@ guestfs__add_drive_opts (guestfs_h *g, const char *filename,
-                               readonly, format, iface, name,
-                               disk_label, cachemode);
-   }
-+#endif /* DISABLED IN RHEL 7 */
-   else if (STREQ (protocol, "nbd")) {
-     drv = create_drive_nbd (g, servers, nr_servers, filename,
-                             username, secret,
-                             readonly, format, iface, name,
-                             disk_label, cachemode);
-   }
-+#if 0 /* DISABLED IN RHEL 7 */
-   else if (STREQ (protocol, "rbd")) {
-     drv = create_drive_rbd (g, servers, nr_servers, filename,
-                             username, secret,
-@@ -936,6 +943,7 @@ guestfs__add_drive_opts (guestfs_h *g, const char *filename,
-                              readonly, format, iface, name,
-                              disk_label, cachemode);
-   }
-+#endif /* DISABLED IN RHEL 7 */
-   else {
-     error (g, _("unknown protocol '%s'"), protocol);
-     drv = NULL; /*FALLTHROUGH*/
-diff --git a/src/guestfs.pod b/src/guestfs.pod
-index eedea94..87e8882 100644
---- a/src/guestfs.pod
-+++ b/src/guestfs.pod
-@@ -668,91 +668,6 @@ you don't need to add any disks.
- 
- =head2 REMOTE STORAGE
- 
--=head3 CEPH
--
--Libguestfs can access Ceph (librbd/RBD) disks.
--
--To do this, set the optional C<protocol> and C<server> parameters of
--L</guestfs_add_drive_opts> like this:
--
-- char **servers = { "ceph1.example.org:3000", /* ... */, NULL };
-- guestfs_add_drive_opts (g, "/pool/image",
--                         GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
--                         GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "rbd",
--                         GUESTFS_ADD_DRIVE_OPTS_SERVER, servers,
--                         GUESTFS_ADD_DRIVE_OPTS_USERNAME, "rbduser",
--                         GUESTFS_ADD_DRIVE_OPTS_SECRET, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
--                         -1);
--
--C<servers> (the C<server> parameter) is a list of one or more Ceph
--servers.  The server string is documented in
--L</guestfs_add_drive_opts>. The C<username> and C<secret> parameters are
--also optional, and if not given, then no authentication will be used.
--
--=head3 FTP, HTTP AND TFTP
--
--Libguestfs can access remote disks over FTP, FTPS, HTTP, HTTPS
--or TFTP protocols.
--
--To do this, set the optional C<protocol> and C<server> parameters of
--L</guestfs_add_drive_opts> like this:
--
-- char **servers = { "www.example.org", NULL };
-- guestfs_add_drive_opts (g, "/disk.img",
--                         GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
--                         GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "http",
--                         GUESTFS_ADD_DRIVE_OPTS_SERVER, servers,
--                         -1);
--
--The C<protocol> can be one of C<"ftp">, C<"ftps">, C<"http">,
--C<"https"> or C<"tftp">.
--
--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
--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").
--
--=head3 ISCSI
--
--Libguestfs can access iSCSI disks remotely.
--
--To do this, set the optional C<protocol> and C<server> parameters like
--this:
--
-- char **server = { "iscsi.example.org:3000", NULL };
-- guestfs_add_drive_opts (g, "/target-iqn-name/lun",
--                         GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
--                         GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "iscsi",
--                         GUESTFS_ADD_DRIVE_OPTS_SERVER, server,
--                         -1);
--
--The C<server> parameter is a list which must have a single element.
--The single element is a string defining the iSCSI server.  The format
--of this string is documented in L</guestfs_add_drive_opts>.
--
- =head3 NETWORK BLOCK DEVICE
- 
- Libguestfs can access Network Block Device (NBD) disks remotely.
-@@ -815,42 +730,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>.
--
--=head3 SSH
--
--Libguestfs can access disks over a Secure Shell (SSH) connection.
--
--To do this, set the C<protocol> and C<server> and (optionally)
--C<username> parameters of L</guestfs_add_drive_opts> like this:
--
-- char **server = { "remote.example.com", NULL };
-- guestfs_add_drive_opts (g, "/path/to/disk.img",
--                         GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
--                         GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "ssh",
--                         GUESTFS_ADD_DRIVE_OPTS_SERVER, server,
--                         GUESTFS_ADD_DRIVE_OPTS_USERNAME, "remoteuser",
--                         -1);
--
--The format of the server string is documented in
--L</guestfs_add_drive_opts>.
--
- =head2 INSPECTION
- 
- Libguestfs has APIs for inspecting an unknown disk image to find out
--- 
-1.8.3.1
-
diff --git a/SOURCES/0044-utils-add-a-function-to-validate-a-GUID-string.patch b/SOURCES/0044-utils-add-a-function-to-validate-a-GUID-string.patch
new file mode 100644
index 0000000..cf5f884
--- /dev/null
+++ b/SOURCES/0044-utils-add-a-function-to-validate-a-GUID-string.patch
@@ -0,0 +1,86 @@
+From daa8a0670ae2bf577718dd15cccfd7b389d94be6 Mon Sep 17 00:00:00 2001
+From: Pino Toscano <ptoscano@redhat.com>
+Date: Thu, 6 Feb 2014 15:57:09 +0100
+Subject: [PATCH] utils: add a function to validate a GUID string
+
+(cherry picked from commit beef77403cd9d634b6ff6daa9f33d292e2d320a7)
+---
+ src/guestfs-internal.h |  3 +++
+ src/utils.c            | 44 ++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 47 insertions(+)
+
+diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
+index d789dcc..61236eb 100644
+--- a/src/guestfs-internal.h
++++ b/src/guestfs-internal.h
+@@ -767,4 +767,7 @@ extern void guestfs___cmd_close (struct command *);
+ #endif
+ extern void guestfs___cleanup_cmd_close (struct command **);
+ 
++/* utils.c */
++extern int guestfs___validate_guid (const char *);
++
+ #endif /* GUESTFS_INTERNAL_H_ */
+diff --git a/src/utils.c b/src/utils.c
+index f8d2509..3d0eb8e 100644
+--- a/src/utils.c
++++ b/src/utils.c
+@@ -28,7 +28,10 @@
+ #include <sys/wait.h>
+ #include <libintl.h>
+ 
++#include "c-ctype.h"
++
+ #include "guestfs.h"
++#include "guestfs-internal.h"
+ #include "guestfs-internal-frontend.h"
+ 
+ /* Note that functions in libutils are used by the tools and language
+@@ -187,3 +190,44 @@ guestfs___drive_name (size_t index, char *ret)
+   *ret = '\0';
+   return ret;
+ }
++
++/* Check whether a string supposed to contain a GUID actually contains it.
++ * It can recognize strings either as '{21EC2020-3AEA-1069-A2DD-08002B30309D}'
++ * or '21EC2020-3AEA-1069-A2DD-08002B30309D'.
++ */
++int
++guestfs___validate_guid (const char *str)
++{
++  int len = strlen (str);
++  switch (len) {
++  case 36:
++    break;
++  case 38:
++    if (str[0] == '{' && str[len -1] == '}') {
++      ++str;
++      len -= 2;
++      break;
++    }
++    return 0;
++  default:
++    return 0;
++  }
++
++  for (int i = 0; i < len; ++i) {
++    switch (i) {
++    case 8:
++    case 13:
++    case 18:
++    case 23:
++      if (str[i] != '-')
++        return 0;
++      break;
++    default:
++      if (!c_isalnum (str[i]))
++        return 0;
++      break;
++    }
++  }
++
++  return 1;
++}
+-- 
+1.8.3.1
+
diff --git a/SOURCES/0045-generator-add-a-GUID-parameter-type.patch b/SOURCES/0045-generator-add-a-GUID-parameter-type.patch
new file mode 100644
index 0000000..5cb0e43
--- /dev/null
+++ b/SOURCES/0045-generator-add-a-GUID-parameter-type.patch
@@ -0,0 +1,626 @@
+From 6eee7b8d22296d21f1363ff69bb365648d74271e Mon Sep 17 00:00:00 2001
+From: Pino Toscano <ptoscano@redhat.com>
+Date: Thu, 6 Feb 2014 17:43:04 +0100
+Subject: [PATCH] generator: add a GUID parameter type
+
+At the moment it is basically the change as String, and it is mapped as
+if it was such.
+
+(cherry picked from commit b10dd601fb07eb3d8bf76b5f9fcac1c7fe59d4d5)
+---
+ generator/bindtests.ml   |  3 ++-
+ generator/c.ml           | 11 +++++++----
+ generator/csharp.ml      |  6 ++++--
+ generator/daemon.ml      |  5 +++--
+ generator/erlang.ml      |  3 ++-
+ generator/fish.ml        | 11 +++++++----
+ generator/gobject.ml     |  8 +++++---
+ generator/haskell.ml     |  8 ++++----
+ generator/java.ml        | 15 ++++++++++-----
+ generator/lua.ml         |  6 +++---
+ generator/ocaml.ml       |  9 ++++++---
+ generator/perl.ml        |  8 ++++----
+ generator/php.ml         | 12 +++++++-----
+ generator/python.ml      | 12 ++++++------
+ generator/ruby.ml        |  4 ++--
+ generator/tests_c_api.ml |  6 ++++--
+ generator/types.ml       |  6 ++++++
+ generator/utils.ml       |  3 ++-
+ generator/xdr.ml         |  2 +-
+ 19 files changed, 85 insertions(+), 53 deletions(-)
+
+diff --git a/generator/bindtests.ml b/generator/bindtests.ml
+index 4f99021..55b6a81 100644
+--- a/generator/bindtests.ml
++++ b/generator/bindtests.ml
+@@ -131,7 +131,8 @@ print_strings (guestfs_h *g, char *const *argv)
+         | String n
+         | FileIn n
+         | FileOut n
+-        | Key n -> pr "  fprintf (fp, \"%%s\\n\", %s);\n" n
++        | Key n
++        | GUID n -> pr "  fprintf (fp, \"%%s\\n\", %s);\n" n
+         | BufferIn n ->
+           pr "  {\n";
+           pr "    size_t i;\n";
+diff --git a/generator/c.ml b/generator/c.ml
+index 451c28d..1ce9e9f 100644
+--- a/generator/c.ml
++++ b/generator/c.ml
+@@ -124,7 +124,8 @@ let rec generate_prototype ?(extern = true) ?(static = false)
+       | Device n | Dev_or_Path n
+       | String n
+       | OptString n
+-      | Key n ->
++      | Key n
++      | GUID n ->
+           next ();
+           pr "const char *%s" n
+       | Mountable n | Mountable_or_Path n ->
+@@ -962,7 +963,8 @@ and generate_client_actions hash () =
+       | StringList n
+       | DeviceList n
+       | Key n
+-      | Pointer (_, n) ->
++      | Pointer (_, n)
++      | GUID n ->
+           pr "  if (%s == NULL) {\n" n;
+           pr "    error (g, \"%%s: %%s: parameter cannot be NULL\",\n";
+           pr "           \"%s\", \"%s\");\n" c_name n;
+@@ -1075,7 +1077,8 @@ and generate_client_actions hash () =
+       | Pathname n
+       | Dev_or_Path n | Mountable_or_Path n
+       | FileIn n
+-      | FileOut n ->
++      | FileOut n
++      | GUID n ->
+           (* guestfish doesn't support string escaping, so neither do we *)
+           pr "    fprintf (trace_buffer.fp, \" \\\"%%s\\\"\", %s);\n" n
+       | Key n ->
+@@ -1397,7 +1400,7 @@ and generate_client_actions hash () =
+         function
+         | Pathname n | Device n | Mountable n | Dev_or_Path n 
+         | Mountable_or_Path n | String n
+-        | Key n ->
++        | Key n | GUID n ->
+           pr "  args.%s = (char *) %s;\n" n n
+         | OptString n ->
+           pr "  args.%s = %s ? (char **) &%s : NULL;\n" n n n
+diff --git a/generator/csharp.ml b/generator/csharp.ml
+index 04ef94c..0facbde 100644
+--- a/generator/csharp.ml
++++ b/generator/csharp.ml
+@@ -192,7 +192,8 @@ namespace Guestfs
+           | OptString n
+           | FileIn n | FileOut n
+           | Key n
+-          | BufferIn n ->
++          | BufferIn n
++          | GUID n ->
+               pr ", [In] string %s" n
+           | StringList n | DeviceList n ->
+               pr ", [In] string[] %s" n
+@@ -220,7 +221,8 @@ namespace Guestfs
+           | OptString n
+           | FileIn n | FileOut n
+           | Key n
+-          | BufferIn n ->
++          | BufferIn n
++          | GUID n ->
+               next (); pr "string %s" n
+           | StringList n | DeviceList n ->
+               next (); pr "string[] %s" n
+diff --git a/generator/daemon.ml b/generator/daemon.ml
+index b08a9c2..2e39783 100644
+--- a/generator/daemon.ml
++++ b/generator/daemon.ml
+@@ -219,7 +219,8 @@ and generate_daemon_actions () =
+         List.iter (
+           function
+           | Device n | Dev_or_Path n
+-          | Pathname n | String n | Key n | OptString n -> pr "  char *%s;\n" n
++          | Pathname n | String n | Key n | OptString n | GUID n ->
++            pr "  char *%s;\n" n
+           | Mountable n | Mountable_or_Path n -> pr "  mountable_t %s;\n" n
+           | StringList n | DeviceList n -> pr "  char **%s;\n" n
+           | Bool n -> pr "  int %s;\n" n
+@@ -323,7 +324,7 @@ and generate_daemon_actions () =
+           | Mountable_or_Path n ->
+               pr "  REQUIRE_ROOT_OR_RESOLVE_MOUNTABLE(args.%s, %s, %s, goto done);\n"
+                 n n (if is_filein then "cancel_receive ()" else "");
+-          | String n | Key n -> pr_args n
++          | String n | Key n | GUID n -> pr_args n
+           | OptString n -> pr "  %s = args.%s ? *args.%s : NULL;\n" n n n
+           | StringList n ->
+               pr_list_handling_code n;
+diff --git a/generator/erlang.ml b/generator/erlang.ml
+index b52cf1f..f0c9c6a 100644
+--- a/generator/erlang.ml
++++ b/generator/erlang.ml
+@@ -297,7 +297,8 @@ extern int64_t get_int64 (ETERM *term);
+           | String n
+           | FileIn n
+           | FileOut n
+-          | Key n ->
++          | Key n
++          | GUID n ->
+             pr "  CLEANUP_FREE char *%s = erl_iolist_to_string (ARG (%d));\n" n i
+           | OptString n ->
+             pr "  CLEANUP_FREE char *%s;\n" n;
+diff --git a/generator/fish.ml b/generator/fish.ml
+index db4b39d..29923db 100644
+--- a/generator/fish.ml
++++ b/generator/fish.ml
+@@ -326,7 +326,8 @@ Guestfish will prompt for these separately."
+         function
+         | Device n | Mountable n
+         | String n
+-        | OptString n -> pr "  const char *%s;\n" n
++        | OptString n
++        | GUID n -> pr "  const char *%s;\n" n
+         | Pathname n
+         | Dev_or_Path n | Mountable_or_Path n
+         | FileIn n
+@@ -408,7 +409,7 @@ Guestfish will prompt for these separately."
+       List.iter (
+         function
+         | Device name | Mountable name
+-        | String name ->
++        | String name | GUID name ->
+             pr "  %s = argv[i++];\n" name
+         | Pathname name
+         | Dev_or_Path name | Mountable_or_Path name ->
+@@ -621,7 +622,8 @@ Guestfish will prompt for these separately."
+         function
+         | Device _ | Mountable _ | String _
+         | OptString _
+-        | BufferIn _ -> ()
++        | BufferIn _
++        | GUID _ -> ()
+         | Bool name
+         | Int name | Int64 name ->
+             pr " out_%s:\n" name
+@@ -853,7 +855,8 @@ and generate_fish_actions_pod () =
+       List.iter (
+         function
+         | Pathname n | Device n | Mountable n
+-        | Dev_or_Path n | Mountable_or_Path n | String n ->
++        | Dev_or_Path n | Mountable_or_Path n | String n
++        | GUID n ->
+             pr " %s" n
+         | OptString n -> pr " %s" n
+         | StringList n | DeviceList n -> pr " '%s ...'" n
+diff --git a/generator/gobject.ml b/generator/gobject.ml
+index 4159c1e..3cbc9c0 100644
+--- a/generator/gobject.ml
++++ b/generator/gobject.ml
+@@ -81,7 +81,8 @@ let generate_gobject_proto name ?(single_line = true)
+       | OptString n
+       | Key n
+       | FileIn n
+-      | FileOut n ->
++      | FileOut n
++      | GUID n ->
+         pr "const gchar *%s" n
+       | StringList n
+       | DeviceList n ->
+@@ -1031,7 +1032,7 @@ guestfs_session_close(GuestfsSession *session, GError **err)
+             pr " (type gint32):"
+           | Int64 _ ->
+             pr " (type gint64):"
+-          | String _ | Key _ ->
++          | String _ | Key _ | GUID _ ->
+             pr " (transfer none) (type utf8):"
+           | OptString _ ->
+             pr " (transfer none) (type utf8) (allow-none):"
+@@ -1190,7 +1191,8 @@ guestfs_session_close(GuestfsSession *session, GError **err)
+           | Bool n | Int n | Int64 n | String n | Device n | Mountable n
+           | Pathname n | Dev_or_Path n | Mountable_or_Path n
+           | OptString n | StringList n
+-          | DeviceList n | Key n | FileIn n | FileOut n ->
++          | DeviceList n | Key n | FileIn n | FileOut n
++          | GUID n ->
+             pr "%s" n
+           | Pointer _ ->
+             failwith "gobject bindings do not support Pointer arguments"
+diff --git a/generator/haskell.ml b/generator/haskell.ml
+index 0bf8551..2bd7625 100644
+--- a/generator/haskell.ml
++++ b/generator/haskell.ml
+@@ -142,7 +142,7 @@ assocListOfHashtable (a:b:rest) = (a,b) : assocListOfHashtable rest
+           | FileOut n
+           | Pathname n | Device n | Mountable n
+           | Dev_or_Path n | Mountable_or_Path n | String n
+-          | Key n ->
++          | Key n | GUID n ->
+               pr "withCString %s $ \\%s -> " n n
+           | BufferIn n ->
+               pr "withCStringLen %s $ \\(%s, %s_size) -> " n n n
+@@ -162,7 +162,7 @@ assocListOfHashtable (a:b:rest) = (a,b) : assocListOfHashtable rest
+             | Dev_or_Path n | Mountable_or_Path n
+             | String n | OptString n
+             | StringList n | DeviceList n
+-            | Key n -> n
++            | Key n | GUID n -> n
+             | BufferIn n -> sprintf "%s (fromIntegral %s_size)" n n
+           ) args in
+         pr "withForeignPtr h (\\p -> c_%s %s)\n" name
+@@ -218,7 +218,7 @@ and generate_haskell_prototype ~handle ?(hs = false) (ret, args, optargs) =
+         (match arg with
+         | Pathname _ | Device _ | Mountable _
+         | Dev_or_Path _ | Mountable_or_Path _ | String _
+-        | Key _ ->
++        | Key _ | GUID _ ->
+           pr "CString"
+         | BufferIn _ ->
+           pr "CString -> CInt"
+@@ -261,7 +261,7 @@ and generate_haskell_prototype ~handle ?(hs = false) (ret, args, optargs) =
+         (match arg with
+         | Pathname _ | Device _ | Mountable _
+         | Dev_or_Path _ | Mountable_or_Path _ | String _
+-        | Key _ ->
++        | Key _ | GUID _ ->
+           pr "String"
+         | BufferIn _ ->
+           pr "String"
+diff --git a/generator/java.ml b/generator/java.ml
+index 98896e0..29d2641 100644
+--- a/generator/java.ml
++++ b/generator/java.ml
+@@ -452,7 +452,8 @@ and generate_java_prototype ?(public=false) ?(privat=false) ?(native=false)
+       | OptString n
+       | FileIn n
+       | FileOut n
+-      | Key n ->
++      | Key n
++      | GUID n ->
+           pr "String %s" n
+       | BufferIn n ->
+           pr "byte[] %s" n
+@@ -812,7 +813,8 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
+         | OptString n
+         | FileIn n
+         | FileOut n
+-        | Key n ->
++        | Key n
++        | GUID n ->
+             pr ", jstring j%s" n
+         | BufferIn n ->
+             pr ", jbyteArray j%s" n
+@@ -881,7 +883,8 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
+         | OptString n
+         | FileIn n
+         | FileOut n
+-        | Key n ->
++        | Key n
++        | GUID n ->
+             pr "  const char *%s;\n" n
+         | BufferIn n ->
+             pr "  char *%s;\n" n;
+@@ -937,7 +940,8 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
+         | String n
+         | FileIn n
+         | FileOut n
+-        | Key n ->
++        | Key n
++        | GUID n ->
+             pr "  %s = (*env)->GetStringUTFChars (env, j%s, NULL);\n" n n
+         | OptString n ->
+             (* This is completely undocumented, but Java null becomes
+@@ -1004,7 +1008,8 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
+         | String n
+         | FileIn n
+         | FileOut n
+-        | Key n ->
++        | Key n
++        | GUID n ->
+             pr "  (*env)->ReleaseStringUTFChars (env, j%s, %s);\n" n n
+         | OptString n ->
+             pr "  if (j%s)\n" n;
+diff --git a/generator/lua.ml b/generator/lua.ml
+index f44c027..c8375af 100644
+--- a/generator/lua.ml
++++ b/generator/lua.ml
+@@ -459,7 +459,7 @@ guestfs_lua_delete_event_callback (lua_State *L)
+         function
+         | Pathname n | Device n | Mountable n
+         | Dev_or_Path n | Mountable_or_Path n | String n
+-        | FileIn n | FileOut n | Key n ->
++        | FileIn n | FileOut n | Key n | GUID n ->
+           pr "  const char *%s;\n" n
+         | BufferIn n ->
+           pr "  const char *%s;\n" n;
+@@ -490,7 +490,7 @@ guestfs_lua_delete_event_callback (lua_State *L)
+           function
+           | Pathname n | Device n | Mountable n
+           | Dev_or_Path n | Mountable_or_Path n | String n
+-          | FileIn n | FileOut n | Key n ->
++          | FileIn n | FileOut n | Key n | GUID n ->
+             pr "  %s = luaL_checkstring (L, %d);\n" n i
+           | BufferIn n ->
+             pr "  %s = luaL_checklstring (L, %d, &%s_size);\n" n i n
+@@ -554,7 +554,7 @@ guestfs_lua_delete_event_callback (lua_State *L)
+         | FileIn _ | FileOut _ | Key _
+         | BufferIn _ | OptString _
+         | Bool _ | Int _ | Int64 _
+-        | Pointer _ -> ()
++        | Pointer _ | GUID _ -> ()
+         | StringList n | DeviceList n ->
+           pr "  free (%s);\n" n
+       ) args;
+diff --git a/generator/ocaml.ml b/generator/ocaml.ml
+index 760e754..7af6d3f 100644
+--- a/generator/ocaml.ml
++++ b/generator/ocaml.ml
+@@ -501,7 +501,8 @@ copy_table (char * const * argv)
+         | String n
+         | FileIn n
+         | FileOut n
+-        | Key n ->
++        | Key n
++        | GUID n ->
+             (* Copy strings in case the GC moves them: RHBZ#604691 *)
+             pr "  char *%s = guestfs___safe_strdup (g, String_val (%sv));\n" n n
+         | OptString n ->
+@@ -585,7 +586,8 @@ copy_table (char * const * argv)
+         function
+         | Pathname n | Device n | Mountable n
+         | Dev_or_Path n | Mountable_or_Path n | String n
+-        | OptString n | FileIn n | FileOut n | BufferIn n | Key n ->
++        | OptString n | FileIn n | FileOut n | BufferIn n
++        | Key n | GUID n ->
+             pr "  free (%s);\n" n
+         | StringList n | DeviceList n ->
+             pr "  guestfs___free_string_list (%s);\n" n;
+@@ -715,7 +717,8 @@ and generate_ocaml_function_type ?(extra_unit = false) (ret, args, optargs) =
+     function
+     | Pathname _ | Device _ | Mountable _
+     | Dev_or_Path _ | Mountable_or_Path _ | String _
+-    | FileIn _ | FileOut _ | BufferIn _ | Key _ -> pr "string -> "
++    | FileIn _ | FileOut _ | BufferIn _ | Key _
++    | GUID _ -> pr "string -> "
+     | OptString _ -> pr "string option -> "
+     | StringList _ | DeviceList _ -> pr "string array -> "
+     | Bool _ -> pr "bool -> "
+diff --git a/generator/perl.ml b/generator/perl.ml
+index 9b7c25a..312268c 100644
+--- a/generator/perl.ml
++++ b/generator/perl.ml
+@@ -354,7 +354,7 @@ PREINIT:
+           function
+           | Pathname n | Device n | Mountable n
+           | Dev_or_Path n | Mountable_or_Path n | String n
+-          | FileIn n | FileOut n | Key n ->
++          | FileIn n | FileOut n | Key n | GUID n ->
+               pr "      char *%s;\n" n
+           | BufferIn n ->
+               pr "      char *%s;\n" n;
+@@ -509,7 +509,7 @@ PREINIT:
+         | Dev_or_Path _ | Mountable_or_Path _ | String _
+         | OptString _ | Bool _ | Int _ | Int64 _
+         | FileIn _ | FileOut _
+-        | BufferIn _ | Key _ | Pointer _ -> ()
++        | BufferIn _ | Key _ | Pointer _ | GUID _ -> ()
+         | StringList n | DeviceList n -> pr "      free (%s);\n" n
+       ) args;
+ 
+@@ -937,7 +937,7 @@ errnos:
+         | Dev_or_Path n -> pr "[ '%s', 'string(dev_or_path)', %d ]" n i
+         | Mountable_or_Path n ->
+           pr "[ '%s', 'string(mountable_or_path)', %d ]" n i
+-        | String n -> pr "[ '%s', 'string', %d ]" n i
++        | String n | GUID n -> pr "[ '%s', 'string', %d ]" n i
+         | FileIn n -> pr "[ '%s', 'string(filename)', %d ]" n i
+         | FileOut n -> pr "[ '%s', 'string(filename)', %d ]" n i
+         | Key n -> pr "[ '%s', 'string(key)', %d ]" n i
+@@ -1105,7 +1105,7 @@ and generate_perl_prototype name (ret, args, optargs) =
+       | Pathname n | Device n | Mountable n
+       | Dev_or_Path n | Mountable_or_Path n | String n
+       | OptString n | Bool n | Int n | Int64 n | FileIn n | FileOut n
+-      | BufferIn n | Key n | Pointer (_, n) ->
++      | BufferIn n | Key n | Pointer (_, n) | GUID n ->
+           pr "$%s" n
+       | StringList n | DeviceList n ->
+           pr "\\@%s" n
+diff --git a/generator/php.ml b/generator/php.ml
+index f27c5f4..650e10e 100644
+--- a/generator/php.ml
++++ b/generator/php.ml
+@@ -192,7 +192,8 @@ PHP_FUNCTION (guestfs_last_error)
+         | Dev_or_Path n | Mountable_or_Path n
+         | FileIn n | FileOut n | Key n
+         | OptString n
+-        | BufferIn n ->
++        | BufferIn n
++        | GUID n ->
+             pr "  char *%s;\n" n;
+             pr "  int %s_size;\n" n
+         | StringList n
+@@ -235,7 +236,8 @@ PHP_FUNCTION (guestfs_last_error)
+           function
+           | String n | Device n | Mountable n | Pathname n
+           | Dev_or_Path n | Mountable_or_Path n
+-          | FileIn n | FileOut n | BufferIn n | Key n -> "s"
++          | FileIn n | FileOut n | BufferIn n | Key n
++          | GUID n -> "s"
+           | OptString n -> "s!"
+           | StringList n | DeviceList n -> "a"
+           | Bool n -> "b"
+@@ -269,7 +271,7 @@ PHP_FUNCTION (guestfs_last_error)
+         | String n | Device n | Mountable n | Pathname n
+         | Dev_or_Path n | Mountable_or_Path n
+         | FileIn n | FileOut n | BufferIn n | Key n
+-        | OptString n ->
++        | OptString n | GUID n ->
+             pr ", &%s, &%s_size" n n
+         | StringList n | DeviceList n ->
+             pr ", &z_%s" n
+@@ -303,7 +305,7 @@ PHP_FUNCTION (guestfs_last_error)
+         | String n | Device n | Mountable n | Pathname n
+         | Dev_or_Path n | Mountable_or_Path n
+         | FileIn n | FileOut n | Key n
+-        | OptString n ->
++        | OptString n | GUID n ->
+             (* Just need to check the string doesn't contain any ASCII
+              * NUL characters, which won't be supported by the C API.
+              *)
+@@ -434,7 +436,7 @@ PHP_FUNCTION (guestfs_last_error)
+         | String n | Device n | Mountable n | Pathname n
+         | Dev_or_Path n | Mountable_or_Path n
+         | FileIn n | FileOut n | Key n
+-        | OptString n -> ()
++        | OptString n | GUID n -> ()
+         | BufferIn n -> ()
+         | StringList n
+         | DeviceList n ->
+diff --git a/generator/python.ml b/generator/python.ml
+index a3e2271..b0a5a2b 100644
+--- a/generator/python.ml
++++ b/generator/python.ml
+@@ -281,7 +281,7 @@ put_table (char * const * const argv)
+         function
+         | Pathname n | Device n | Mountable n
+         | Dev_or_Path n | Mountable_or_Path n | String n | Key n
+-        | FileIn n | FileOut n ->
++        | FileIn n | FileOut n | GUID n ->
+             pr "  const char *%s;\n" n
+         | OptString n -> pr "  const char *%s;\n" n
+         | BufferIn n ->
+@@ -319,7 +319,7 @@ put_table (char * const * const argv)
+         function
+         | Pathname _ | Device _ | Mountable _
+         | Dev_or_Path _ | Mountable_or_Path _ | String _ | Key _
+-        | FileIn _ | FileOut _ -> pr "s"
++        | FileIn _ | FileOut _ | GUID _ -> pr "s"
+         | OptString _ -> pr "z"
+         | StringList _ | DeviceList _ -> pr "O"
+         | Bool _ -> pr "i" (* XXX Python has booleans? *)
+@@ -341,7 +341,7 @@ put_table (char * const * const argv)
+         function
+         | Pathname n | Device n | Mountable n
+         | Dev_or_Path n | Mountable_or_Path n | String n | Key n
+-        | FileIn n | FileOut n -> pr ", &%s" n
++        | FileIn n | FileOut n | GUID n -> pr ", &%s" n
+         | OptString n -> pr ", &%s" n
+         | StringList n | DeviceList n -> pr ", &py_%s" n
+         | Bool n -> pr ", &%s" n
+@@ -365,7 +365,7 @@ put_table (char * const * const argv)
+         | Pathname _ | Device _ | Mountable _
+         | Dev_or_Path _ | Mountable_or_Path _ | String _ | Key _
+         | FileIn _ | FileOut _ | OptString _ | Bool _ | Int _ | Int64 _
+-        | BufferIn _ -> ()
++        | BufferIn _ | GUID _ -> ()
+         | StringList n | DeviceList n ->
+             pr "  %s = get_string_list (py_%s);\n" n n;
+             pr "  if (!%s) goto out;\n" n
+@@ -502,7 +502,7 @@ put_table (char * const * const argv)
+         | Pathname _ | Device _ | Mountable _
+         | Dev_or_Path _ | Mountable_or_Path _ | String _ | Key _
+         | FileIn _ | FileOut _ | OptString _ | Bool _ | Int _ | Int64 _
+-        | BufferIn _ | Pointer _ -> ()
++        | BufferIn _ | Pointer _ | GUID _ -> ()
+         | StringList n | DeviceList n ->
+             pr "  free (%s);\n" n
+       ) args;
+@@ -796,7 +796,7 @@ class GuestFS(object):
+         | Pathname _ | Device _ | Mountable _
+         | Dev_or_Path _ | Mountable_or_Path _ | String _ | Key _
+         | FileIn _ | FileOut _ | OptString _ | Bool _ | Int _ | Int64 _
+-        | BufferIn _ | Pointer _ -> ()
++        | BufferIn _ | Pointer _ | GUID _ -> ()
+         | StringList n | DeviceList n ->
+             pr "        %s = list (%s)\n" n n
+       ) args;
+diff --git a/generator/ruby.ml b/generator/ruby.ml
+index d6ca430..3a7d05d 100644
+--- a/generator/ruby.ml
++++ b/generator/ruby.ml
+@@ -518,7 +518,7 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
+         function
+         | Pathname n | Device n | Mountable n
+         | Dev_or_Path n | Mountable_or_Path n | String n | Key n
+-        | FileIn n | FileOut n ->
++        | FileIn n | FileOut n | GUID n ->
+           pr "  const char *%s = StringValueCStr (%sv);\n" n n;
+         | BufferIn n ->
+           pr "  Check_Type (%sv, T_STRING);\n" n;
+@@ -622,7 +622,7 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
+         | Pathname _ | Device _ | Mountable _
+         | Dev_or_Path _ | Mountable_or_Path _ | String _ | Key _
+         | FileIn _ | FileOut _ | OptString _ | Bool _ | Int _ | Int64 _
+-        | BufferIn _ | Pointer _ -> ()
++        | BufferIn _ | Pointer _ | GUID _ -> ()
+         | StringList n | DeviceList n ->
+             pr "  free (%s);\n" n
+       ) args;
+diff --git a/generator/tests_c_api.ml b/generator/tests_c_api.ml
+index 1c85db8..e6a5d22 100644
+--- a/generator/tests_c_api.ml
++++ b/generator/tests_c_api.ml
+@@ -384,7 +384,8 @@ and generate_test_command_call ?(expect_error = false) ?test ?ret test_name cmd=
+     | Mountable_or_Path _, arg, sym
+     | String _, arg, sym
+     | OptString _, arg, sym
+-    | Key _, arg, sym ->
++    | Key _, arg, sym
++    | GUID _, arg, sym ->
+       pr "  const char *%s = \"%s\";\n" sym (c_quote arg);
+     | BufferIn _, arg, sym ->
+       pr "  const char *%s = \"%s\";\n" sym (c_quote arg);
+@@ -504,7 +505,8 @@ and generate_test_command_call ?(expect_error = false) ?test ?ret test_name cmd=
+     | String _, _, sym
+     | OptString _, _, sym
+     | Key _, _, sym
+-    | FileIn _, _, sym -> pr ", %s" sym
++    | FileIn _, _, sym
++    | GUID _, _, sym -> pr ", %s" sym
+     | BufferIn _, _, sym -> pr ", %s, %s_size" sym sym
+     | FileOut _, arg, _ -> pr ", \"%s\"" (c_quote arg)
+     | StringList _, _, sym | DeviceList _, _, sym -> pr ", (char **) %s" sym
+diff --git a/generator/types.ml b/generator/types.ml
+index 9827395..963fd83 100644
+--- a/generator/types.ml
++++ b/generator/types.ml
+@@ -184,6 +184,12 @@ and argt =
+      * tests, although we should fix this in future.
+      *)
+   | Pointer of (string * string)
++    (* const char * which represents a GUID string.
++     *
++     * It cannot be NULL, and it will be validated using
++     * guestfs___validate_guid.
++     *)
++  | GUID of string
+ 
+ and optargs = optargt list
+ 
+diff --git a/generator/utils.ml b/generator/utils.ml
+index 21a47a3..1540a6b 100644
+--- a/generator/utils.ml
++++ b/generator/utils.ml
+@@ -253,7 +253,8 @@ let name_of_argt = function
+   | Pathname n | Device n | Mountable n | Dev_or_Path n
+   | Mountable_or_Path n | String n | OptString n
+   | StringList n | DeviceList n | Bool n | Int n | Int64 n
+-  | FileIn n | FileOut n | BufferIn n | Key n | Pointer (_, n) -> n
++  | FileIn n | FileOut n | BufferIn n | Key n | Pointer (_, n)
++  | GUID n -> n
+ 
+ let name_of_optargt = function
+   | OBool n | OInt n | OInt64 n | OString n | OStringList n -> n
+diff --git a/generator/xdr.ml b/generator/xdr.ml
+index 0d1b4e3..432389a 100644
+--- a/generator/xdr.ml
++++ b/generator/xdr.ml
+@@ -112,7 +112,7 @@ let generate_xdr () =
+           function
+           | Pathname n | Device n | Mountable n | Dev_or_Path n
+           | Mountable_or_Path n | String n
+-          | Key n ->
++          | Key n | GUID n ->
+             pr "  string %s<>;\n" n
+           | OptString n -> pr "  guestfs_str *%s;\n" n
+           | StringList n | DeviceList n -> pr "  guestfs_str %s<>;\n" n
+-- 
+1.8.3.1
+
diff --git a/SOURCES/0046-generator-generate-code-for-parameter-validation.patch b/SOURCES/0046-generator-generate-code-for-parameter-validation.patch
new file mode 100644
index 0000000..8d88a0b
--- /dev/null
+++ b/SOURCES/0046-generator-generate-code-for-parameter-validation.patch
@@ -0,0 +1,84 @@
+From d1758344fa7e87002de857328af2963ff6fab7e1 Mon Sep 17 00:00:00 2001
+From: Pino Toscano <ptoscano@redhat.com>
+Date: Thu, 6 Feb 2014 20:02:51 +0100
+Subject: [PATCH] generator: generate code for parameter validation
+
+Implemented only in the C output, since every binding uses it anyway,
+and just for the "GUID" type (since its format is well-known).
+
+(cherry picked from commit 775cad63a3f2156b38e7d8360b88ed11615779e8)
+---
+ generator/c.ml | 43 +++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 43 insertions(+)
+
+diff --git a/generator/c.ml b/generator/c.ml
+index 1ce9e9f..2137c7e 100644
+--- a/generator/c.ml
++++ b/generator/c.ml
+@@ -1048,6 +1048,47 @@ and generate_client_actions hash () =
+         pr "\n";
+   in
+ 
++  (* Generate code to check for parameter validation (where supported
++   * for the type).
++   *)
++  let check_args_validity c_name (ret, args, optargs) =
++    let pr_newline = ref false in
++    List.iter (
++      function
++      | GUID n ->
++          pr "  if (!guestfs___validate_guid (%s)) {\n" n;
++          pr "    error (g, \"%%s: %%s: parameter is not a valid GUID\",\n";
++          pr "           \"%s\", \"%s\");\n" c_name n;
++          let errcode =
++            match errcode_of_ret ret with
++            | `CannotReturnError -> assert false
++            | (`ErrorIsMinusOne |`ErrorIsNULL) as e -> e in
++          pr "    return %s;\n" (string_of_errcode errcode);
++          pr "  }\n";
++          pr_newline := true
++
++      (* not applicable *)
++      | String _
++      | Device _
++      | Mountable _
++      | Pathname _
++      | Dev_or_Path _ | Mountable_or_Path _
++      | FileIn _
++      | FileOut _
++      | BufferIn _
++      | StringList _
++      | DeviceList _
++      | Key _
++      | Pointer (_, _)
++      | OptString _
++      | Bool _
++      | Int _
++      | Int64 _ -> ()
++    ) args;
++
++    if !pr_newline then pr "\n";
++  in
++
+   (* Generate code to generate guestfish call traces. *)
+   let trace_call name c_name (ret, args, optargs) =
+     pr "  if (trace_flag) {\n";
+@@ -1266,6 +1307,7 @@ and generate_client_actions hash () =
+     enter_event name;
+     check_null_strings c_name style;
+     reject_unknown_optargs c_name style;
++    check_args_validity c_name style;
+     trace_call name c_name style;
+     pr "  r = guestfs__%s " c_name;
+     generate_c_call_args ~handle:"g" ~implicit_size_ptr:"size_r" style;
+@@ -1368,6 +1410,7 @@ and generate_client_actions hash () =
+     enter_event name;
+     check_null_strings c_name style;
+     reject_unknown_optargs c_name style;
++    check_args_validity c_name style;
+     trace_call name c_name style;
+ 
+     (* Calculate the total size of all FileIn arguments to pass
+-- 
+1.8.3.1
+
diff --git a/SOURCES/0047-actions-part_set_gpt_type-set-type-of-guid-parameter.patch b/SOURCES/0047-actions-part_set_gpt_type-set-type-of-guid-parameter.patch
new file mode 100644
index 0000000..a7f6c9e
--- /dev/null
+++ b/SOURCES/0047-actions-part_set_gpt_type-set-type-of-guid-parameter.patch
@@ -0,0 +1,46 @@
+From b9db39d4e0906dab143a42d41a027c24687c755d Mon Sep 17 00:00:00 2001
+From: Pino Toscano <ptoscano@redhat.com>
+Date: Mon, 10 Feb 2014 11:00:09 +0100
+Subject: [PATCH] actions/part_set_gpt_type: set type of "guid" parameter as
+ "GUID" (RHBZ#1008417).
+
+Switch the type of the "guid" parameter from "String" to "GUID"; this
+adds the validation of the GUID as such, rejecting straight away invalid
+GUIDs which otherwise could be handled badly by low-level tools (such as
+sgdisk).
+
+Add a couple of easy tests (taken from RHBZ#1008417) to
+part_set_gpt_type about this.
+
+(cherry picked from commit a948389ce9c76bf7e8997bb27f3daac06cb20c50)
+---
+ generator/actions.ml | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/generator/actions.ml b/generator/actions.ml
+index 24f4468..379e63e 100644
+--- a/generator/actions.ml
++++ b/generator/actions.ml
+@@ -11158,9 +11158,18 @@ group with GUID C<diskgroup>." };
+ 
+   { defaults with
+     name = "part_set_gpt_type";
+-    style = RErr, [Device "device"; Int "partnum"; String "guid"], [];
++    style = RErr, [Device "device"; Int "partnum"; GUID "guid"], [];
+     proc_nr = Some 392;
+     optional = Some "gdisk";
++    tests = [
++      InitGPT, Always, TestLastFail (
++        [["part_set_gpt_type"; "/dev/sda"; "1"; "f"]]), [];
++      InitGPT, Always, TestResultString (
++        [["part_set_gpt_type"; "/dev/sda"; "1";
++          "01234567-89AB-CDEF-0123-456789ABCDEF"];
++         ["part_get_gpt_type"; "/dev/sda"; "1"]],
++        "01234567-89AB-CDEF-0123-456789ABCDEF"), [];
++    ];
+     shortdesc = "set the type GUID of a GPT partition";
+     longdesc = "\
+ Set the type GUID of numbered GPT partition C<partnum> to C<guid>. Return an
+-- 
+1.8.3.1
+
diff --git a/SOURCES/0048-list-filesystems-Do-not-segfault-if-guestfs_btrfs_su.patch b/SOURCES/0048-list-filesystems-Do-not-segfault-if-guestfs_btrfs_su.patch
new file mode 100644
index 0000000..b563e70
--- /dev/null
+++ b/SOURCES/0048-list-filesystems-Do-not-segfault-if-guestfs_btrfs_su.patch
@@ -0,0 +1,133 @@
+From 2ddd59f9e8a566227a8b5306c7fd5f0d641410b9 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones@redhat.com>
+Date: Tue, 11 Feb 2014 20:08:43 +0000
+Subject: [PATCH] list-filesystems: Do not segfault if
+ guestfs_btrfs_subvolume_list returns an error (RHBZ#1064008).
+
+If calling guestfs_list_filesystems with a disk image containing a
+corrupt btrfs volume, the library would segfault.  There was a missing
+check for a NULL return from guestfs_btrfs_subvolume_list.
+
+This adds a check, returning the real error up through the stack and
+out of guestfs_list_filesystems.
+
+This is potentially a denial of service if processing disk images from
+untrusted sources, but is not exploitable.
+
+Thanks: Jeff Bastian for reporting the bug.
+(cherry picked from commit d70ceb4cbea165c960710576efac5a5716055486)
+---
+ src/listfs.c | 34 +++++++++++++++++++++++-----------
+ 1 file changed, 23 insertions(+), 11 deletions(-)
+
+diff --git a/src/listfs.c b/src/listfs.c
+index 9102c55..bbdb0a2 100644
+--- a/src/listfs.c
++++ b/src/listfs.c
+@@ -39,7 +39,7 @@
+  */
+ 
+ static void remove_from_list (char **list, const char *item);
+-static void check_with_vfs_type (guestfs_h *g, const char *dev, struct stringsbuf *sb);
++static int check_with_vfs_type (guestfs_h *g, const char *dev, struct stringsbuf *sb);
+ static int is_mbr_partition_type_42 (guestfs_h *g, const char *partition);
+ 
+ char **
+@@ -78,17 +78,21 @@ guestfs__list_filesystems (guestfs_h *g)
+ 
+   /* Use vfs-type to check for filesystems on devices. */
+   for (i = 0; devices[i] != NULL; ++i)
+-    check_with_vfs_type (g, devices[i], &ret);
++    if (check_with_vfs_type (g, devices[i], &ret) == -1)
++      goto error;
+ 
+   /* Use vfs-type to check for filesystems on partitions. */
+   for (i = 0; partitions[i] != NULL; ++i) {
+-    if (! is_mbr_partition_type_42 (g, partitions[i]))
+-      check_with_vfs_type (g, partitions[i], &ret);
++    if (! is_mbr_partition_type_42 (g, partitions[i])) {
++      if (check_with_vfs_type (g, partitions[i], &ret) == -1)
++        goto error;
++    }
+   }
+ 
+   /* Use vfs-type to check for filesystems on md devices. */
+   for (i = 0; mds[i] != NULL; ++i)
+-    check_with_vfs_type (g, mds[i], &ret);
++    if (check_with_vfs_type (g, mds[i], &ret) == -1)
++      goto error;
+ 
+   if (guestfs_feature_available (g, (char **) lvm2)) {
+     /* Use vfs-type to check for filesystems on LVs. */
+@@ -96,7 +100,8 @@ guestfs__list_filesystems (guestfs_h *g)
+     if (lvs == NULL) goto error;
+ 
+     for (i = 0; lvs[i] != NULL; ++i)
+-      check_with_vfs_type (g, lvs[i], &ret);
++      if (check_with_vfs_type (g, lvs[i], &ret) == -1)
++        goto error;
+   }
+ 
+   if (guestfs_feature_available (g, (char **) ldm)) {
+@@ -105,13 +110,15 @@ guestfs__list_filesystems (guestfs_h *g)
+     if (ldmvols == NULL) goto error;
+ 
+     for (i = 0; ldmvols[i] != NULL; ++i)
+-      check_with_vfs_type (g, ldmvols[i], &ret);
++      if (check_with_vfs_type (g, ldmvols[i], &ret) == -1)
++        goto error;
+ 
+     ldmparts = guestfs_list_ldm_partitions (g);
+     if (ldmparts == NULL) goto error;
+ 
+     for (i = 0; ldmparts[i] != NULL; ++i)
+-      check_with_vfs_type (g, ldmparts[i], &ret);
++      if (check_with_vfs_type (g, ldmparts[i], &ret) == -1)
++        goto error;
+   }
+ 
+   /* Finish off the list and return it. */
+@@ -143,7 +150,7 @@ remove_from_list (char **list, const char *item)
+  * Apart from some types which we ignore, add the result to the
+  * 'ret' string list.
+  */
+-static void
++static int
+ check_with_vfs_type (guestfs_h *g, const char *device, struct stringsbuf *sb)
+ {
+   const char *v;
+@@ -161,6 +168,9 @@ check_with_vfs_type (guestfs_h *g, const char *device, struct stringsbuf *sb)
+     CLEANUP_FREE_BTRFSSUBVOLUME_LIST struct guestfs_btrfssubvolume_list *vols =
+       guestfs_btrfs_subvolume_list (g, device);
+ 
++    if (vols == NULL)
++      return -1;
++
+     for (size_t i = 0; i < vols->len; i++) {
+       struct guestfs_btrfssubvolume *this = &vols->val[i];
+       guestfs___add_sprintf (g, sb,
+@@ -178,17 +188,19 @@ check_with_vfs_type (guestfs_h *g, const char *device, struct stringsbuf *sb)
+      */
+     size_t n = strlen (vfs_type);
+     if (n >= 7 && STREQ (&vfs_type[n-7], "_member"))
+-      return;
++      return 0;
+ 
+     /* Ignore LUKS-encrypted partitions.  These are also containers. */
+     if (STREQ (vfs_type, "crypto_LUKS"))
+-      return;
++      return 0;
+ 
+     v = vfs_type;
+   }
+ 
+   guestfs___add_string (g, sb, device);
+   guestfs___add_string (g, sb, v);
++
++  return 0;
+ }
+ 
+ /* We should ignore partitions that have MBR type byte 0x42, because
+-- 
+1.8.3.1
+
diff --git a/SOURCES/0049-ruby-Fix-.new-method-RHBZ-1046509.patch b/SOURCES/0049-ruby-Fix-.new-method-RHBZ-1046509.patch
new file mode 100644
index 0000000..519f543
--- /dev/null
+++ b/SOURCES/0049-ruby-Fix-.new-method-RHBZ-1046509.patch
@@ -0,0 +1,504 @@
+From d299014ef6b766c23db2f2a11fb21d5df7123e51 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones@redhat.com>
+Date: Fri, 27 Dec 2013 09:45:49 +0000
+Subject: [PATCH] ruby: Fix .new method (RHBZ#1046509).
+
+The .new method was unintentionally broken in
+commit 9466060201600db47016133d80af22eb38091a49.
+
+This fixes the .new method and allows it to be called with multiple
+parameters, so you can use:
+
+  Guestfs::Guestfs.new
+  Guestfs::Guestfs.new()
+  Guestfs::Guestfs.new(:close_on_exit => false)
+  etc.
+
+For backwards compatibility, Guestfs::create may still be used.
+
+This commit also adds regression tests:
+
+ - Use .new method in regular tests.  (Because this was not done
+   before, we didn't catch the breakage.)
+
+ - Test that ::create still works.
+
+ - Test that args can be passed to .new method.
+
+(cherry picked from commit ee4ce2a0298d012bd8c500c35dc50e1f53e88c8b)
+---
+ generator/bindtests.ml             |  2 +-
+ generator/ruby.ml                  | 92 +++++++++++++++++++++++++++++++-------
+ ruby/t/tc_020_create.rb            |  2 +-
+ ruby/t/tc_030_create_flags.rb      | 29 ++++++++++++
+ ruby/t/tc_040_create_multiple.rb   | 32 +++++++++++++
+ ruby/t/tc_050_handle_properties.rb | 36 +++++++++++++++
+ ruby/t/tc_060_explicit_close.rb    | 29 ++++++++++++
+ ruby/t/tc_070_optargs.rb           |  2 +-
+ ruby/t/tc_100_launch.rb            |  2 +-
+ ruby/t/tc_410_close_event.rb       |  2 +-
+ ruby/t/tc_420_log_messages.rb      |  2 +-
+ ruby/t/tc_800_rhbz507346.rb        |  2 +-
+ ruby/t/tc_810_rhbz664558c6.rb      |  2 +-
+ ruby/t/tc_820_rhbz1046509.rb       | 42 +++++++++++++++++
+ 14 files changed, 251 insertions(+), 25 deletions(-)
+ create mode 100644 ruby/t/tc_030_create_flags.rb
+ create mode 100644 ruby/t/tc_040_create_multiple.rb
+ create mode 100644 ruby/t/tc_050_handle_properties.rb
+ create mode 100644 ruby/t/tc_060_explicit_close.rb
+ create mode 100644 ruby/t/tc_820_rhbz1046509.rb
+
+diff --git a/generator/bindtests.ml b/generator/bindtests.ml
+index 55b6a81..e18b9be 100644
+--- a/generator/bindtests.ml
++++ b/generator/bindtests.ml
+@@ -452,7 +452,7 @@ and generate_ruby_bindtests () =
+   pr "\
+ require 'guestfs'
+ 
+-g = Guestfs::create()
++g = Guestfs::Guestfs.new()
+ ";
+ 
+   let mkargs args optargs =
+diff --git a/generator/ruby.ml b/generator/ruby.ml
+index 3a7d05d..eb176ab 100644
+--- a/generator/ruby.ml
++++ b/generator/ruby.ml
+@@ -42,6 +42,7 @@ let rec generate_ruby_c () =
+ #include <stdint.h>
+ #include <string.h>
+ #include <errno.h>
++#include <assert.h>
+ 
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
+@@ -135,34 +136,89 @@ ruby_guestfs_free (void *gvp)
+   }
+ }
+ 
++/* This is the ruby internal alloc function for the class.  We do nothing
++ * here except allocate an object containing a NULL guestfs handle.
++ * Note we cannot call guestfs_create here because we need the extra
++ * parameters, which ruby passes via the initialize method (see next
++ * function).
++ */
++static VALUE
++ruby_guestfs_alloc (VALUE klass)
++{
++  guestfs_h *g = NULL;
++
++  /* Wrap it, and make sure the close function is called when the
++   * handle goes away.
++   */
++  return Data_Wrap_Struct (c_guestfs, NULL, ruby_guestfs_free, g);
++}
++
++static unsigned
++parse_flags (int argc, VALUE *argv)
++{
++  volatile VALUE optargsv;
++  unsigned flags = 0;
++  volatile VALUE v;
++
++  optargsv = argc == 1 ? argv[0] : rb_hash_new ();
++  Check_Type (optargsv, T_HASH);
++
++  v = rb_hash_lookup (optargsv, ID2SYM (rb_intern (\"environment\")));
++  if (v != Qnil && !RTEST (v))
++    flags |= GUESTFS_CREATE_NO_ENVIRONMENT;
++  v = rb_hash_lookup (optargsv, ID2SYM (rb_intern (\"close_on_exit\")));
++  if (v != Qnil && !RTEST (v))
++    flags |= GUESTFS_CREATE_NO_CLOSE_ON_EXIT;
++
++  return flags;
++}
++
+ /*
+  * call-seq:
+  *   Guestfs::Guestfs.new([{:environment => false, :close_on_exit => false}]) -> Guestfs::Guestfs
+  *
+  * Call
+- * +guestfs_create+[http://libguestfs.org/guestfs.3.html#guestfs_create]
++ * +guestfs_create_flags+[http://libguestfs.org/guestfs.3.html#guestfs_create_flags]
+  * to create a new libguestfs handle.  The handle is represented in
+  * Ruby as an instance of the Guestfs::Guestfs class.
+  */
+ static VALUE
+-ruby_guestfs_create (int argc, VALUE *argv, VALUE m)
++ruby_guestfs_initialize (int argc, VALUE *argv, VALUE m)
+ {
+   guestfs_h *g;
++  unsigned flags;
+ 
+   if (argc > 1)
+     rb_raise (rb_eArgError, \"expecting 0 or 1 arguments\");
+ 
+-  volatile VALUE optargsv = argc == 1 ? argv[0] : rb_hash_new ();
+-  Check_Type (optargsv, T_HASH);
++  /* Should have been set to NULL by prior call to alloc function. */
++  assert (DATA_PTR (m) == NULL);
+ 
+-  unsigned flags = 0;
+-  volatile VALUE v;
+-  v = rb_hash_lookup (optargsv, ID2SYM (rb_intern (\"environment\")));
+-  if (v != Qnil && !RTEST (v))
+-    flags |= GUESTFS_CREATE_NO_ENVIRONMENT;
+-  v = rb_hash_lookup (optargsv, ID2SYM (rb_intern (\"close_on_exit\")));
+-  if (v != Qnil && !RTEST (v))
+-    flags |= GUESTFS_CREATE_NO_CLOSE_ON_EXIT;
++  flags = parse_flags (argc, argv);
++
++  g = guestfs_create_flags (flags);
++  if (!g)
++    rb_raise (e_Error, \"failed to create guestfs handle\");
++
++  DATA_PTR (m) = g;
++
++  /* Don't print error messages to stderr by default. */
++  guestfs_set_error_handler (g, NULL, NULL);
++
++  return m;
++}
++
++/* For backwards compatibility. */
++static VALUE
++ruby_guestfs_create (int argc, VALUE *argv, VALUE module)
++{
++  guestfs_h *g;
++  unsigned flags;
++
++  if (argc > 1)
++    rb_raise (rb_eArgError, \"expecting 0 or 1 arguments\");
++
++  flags = parse_flags (argc, argv);
+ 
+   g = guestfs_create_flags (flags);
+   if (!g)
+@@ -171,9 +227,6 @@ ruby_guestfs_create (int argc, VALUE *argv, VALUE m)
+   /* Don't print error messages to stderr by default. */
+   guestfs_set_error_handler (g, NULL, NULL);
+ 
+-  /* Wrap it, and make sure the close function is called when the
+-   * handle goes away.
+-   */
+   return Data_Wrap_Struct (c_guestfs, NULL, ruby_guestfs_free, g);
+ }
+ 
+@@ -707,10 +760,10 @@ Init__guestfs (void)
+ #ifndef HAVE_TYPE_RB_ALLOC_FUNC_T
+ #define rb_alloc_func_t void*
+ #endif
+-  rb_define_alloc_func (c_guestfs, (rb_alloc_func_t) ruby_guestfs_create);
++  rb_define_alloc_func (c_guestfs, (rb_alloc_func_t) ruby_guestfs_alloc);
+ #endif
+ 
+-  rb_define_module_function (m_guestfs, \"create\", ruby_guestfs_create, -1);
++  rb_define_method (c_guestfs, \"initialize\", ruby_guestfs_initialize, -1);
+   rb_define_method (c_guestfs, \"close\", ruby_guestfs_close, 0);
+   rb_define_method (c_guestfs, \"set_event_callback\",
+                     ruby_set_event_callback, 2);
+@@ -719,6 +772,11 @@ Init__guestfs (void)
+   rb_define_module_function (m_guestfs, \"event_to_string\",
+                     ruby_event_to_string, 1);
+ 
++  /* For backwards compatibility with older code, define a ::create
++   * module function.
++   */
++  rb_define_module_function (m_guestfs, \"create\", ruby_guestfs_create, -1);
++
+ ";
+ 
+   (* Constants. *)
+diff --git a/ruby/t/tc_020_create.rb b/ruby/t/tc_020_create.rb
+index 2b57ba1..4a04e97 100644
+--- a/ruby/t/tc_020_create.rb
++++ b/ruby/t/tc_020_create.rb
+@@ -22,7 +22,7 @@ require 'guestfs'
+ 
+ class TestLoad < Test::Unit::TestCase
+   def test_create
+-    g = Guestfs::create()
++    g = Guestfs::Guestfs.new()
+     assert_not_nil (g)
+   end
+ end
+diff --git a/ruby/t/tc_030_create_flags.rb b/ruby/t/tc_030_create_flags.rb
+new file mode 100644
+index 0000000..7ec2ce9
+--- /dev/null
++++ b/ruby/t/tc_030_create_flags.rb
+@@ -0,0 +1,29 @@
++# libguestfs Ruby bindings -*- ruby -*-
++# Copyright (C) 2013 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.
++
++require 'test/unit'
++$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
++$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
++require 'guestfs'
++
++class TestLoad < Test::Unit::TestCase
++  def test_create_flags
++    g = Guestfs::Guestfs.new(:environment => false, :close_on_exit => true)
++    assert_not_nil (g)
++    g.parse_environment()
++  end
++end
+diff --git a/ruby/t/tc_040_create_multiple.rb b/ruby/t/tc_040_create_multiple.rb
+new file mode 100644
+index 0000000..339b699
+--- /dev/null
++++ b/ruby/t/tc_040_create_multiple.rb
+@@ -0,0 +1,32 @@
++# libguestfs Ruby bindings -*- ruby -*-
++# Copyright (C) 2013 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.
++
++require 'test/unit'
++$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
++$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
++require 'guestfs'
++
++class TestLoad < Test::Unit::TestCase
++  def test_create_multiple
++    g1 = Guestfs::Guestfs.new()
++    g2 = Guestfs::Guestfs.new()
++    g3 = Guestfs::Guestfs.new()
++    assert_not_nil (g1)
++    assert_not_nil (g2)
++    assert_not_nil (g3)
++  end
++end
+diff --git a/ruby/t/tc_050_handle_properties.rb b/ruby/t/tc_050_handle_properties.rb
+new file mode 100644
+index 0000000..cf4a7a7
+--- /dev/null
++++ b/ruby/t/tc_050_handle_properties.rb
+@@ -0,0 +1,36 @@
++# libguestfs Ruby bindings -*- ruby -*-
++# Copyright (C) 2013 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.
++
++require 'test/unit'
++$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
++$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
++require 'guestfs'
++
++class TestLoad < Test::Unit::TestCase
++  def test_handle_properties
++    g = Guestfs::Guestfs.new()
++    assert_not_nil (g)
++    v = g.get_verbose()
++    g.set_verbose(v)
++    v = g.get_trace()
++    g.set_trace(v)
++    v = g.get_memsize()
++    g.set_memsize(v)
++    v = g.get_path()
++    g.set_path(v)
++  end
++end
+diff --git a/ruby/t/tc_060_explicit_close.rb b/ruby/t/tc_060_explicit_close.rb
+new file mode 100644
+index 0000000..74456e4
+--- /dev/null
++++ b/ruby/t/tc_060_explicit_close.rb
+@@ -0,0 +1,29 @@
++# libguestfs Ruby bindings -*- ruby -*-
++# Copyright (C) 2013 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.
++
++require 'test/unit'
++$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
++$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
++require 'guestfs'
++
++class TestLoad < Test::Unit::TestCase
++  def test_explicit_close
++    g = Guestfs::Guestfs.new()
++    assert_not_nil (g)
++    g.close()
++  end
++end
+diff --git a/ruby/t/tc_070_optargs.rb b/ruby/t/tc_070_optargs.rb
+index 4506466..e28f944 100644
+--- a/ruby/t/tc_070_optargs.rb
++++ b/ruby/t/tc_070_optargs.rb
+@@ -22,7 +22,7 @@ require 'guestfs'
+ 
+ class TestLoad < Test::Unit::TestCase
+   def test_optargs
+-    g = Guestfs::create()
++    g = Guestfs::Guestfs.new()
+ 
+     g.add_drive("/dev/null", {})
+     g.add_drive("/dev/null", :readonly => 1)
+diff --git a/ruby/t/tc_100_launch.rb b/ruby/t/tc_100_launch.rb
+index 4bd8187..f318ae8 100644
+--- a/ruby/t/tc_100_launch.rb
++++ b/ruby/t/tc_100_launch.rb
+@@ -22,7 +22,7 @@ require 'guestfs'
+ 
+ class TestLoad < Test::Unit::TestCase
+   def test_launch
+-    g = Guestfs::create()
++    g = Guestfs::Guestfs.new()
+ 
+     File.open("test.img", "w") {
+       |f| f.seek(500*1024*1024); f.write("\0")
+diff --git a/ruby/t/tc_410_close_event.rb b/ruby/t/tc_410_close_event.rb
+index ebf4bbc..d7e53d4 100644
+--- a/ruby/t/tc_410_close_event.rb
++++ b/ruby/t/tc_410_close_event.rb
+@@ -22,7 +22,7 @@ require 'guestfs'
+ 
+ class TestLoad < Test::Unit::TestCase
+   def test_events
+-    g = Guestfs::create()
++    g = Guestfs::Guestfs.new()
+ 
+     close_invoked = 0
+     close = Proc.new {| event, event_handle, buf, array |
+diff --git a/ruby/t/tc_420_log_messages.rb b/ruby/t/tc_420_log_messages.rb
+index d23a0fb..0c3bd4d 100644
+--- a/ruby/t/tc_420_log_messages.rb
++++ b/ruby/t/tc_420_log_messages.rb
+@@ -22,7 +22,7 @@ require 'guestfs'
+ 
+ class TestLoad < Test::Unit::TestCase
+   def test_events
+-    g = Guestfs::create()
++    g = Guestfs::Guestfs.new()
+ 
+     log_invoked = 0
+     log = Proc.new {| event, event_handle, buf, array |
+diff --git a/ruby/t/tc_800_rhbz507346.rb b/ruby/t/tc_800_rhbz507346.rb
+index 6082201..7b8d526 100644
+--- a/ruby/t/tc_800_rhbz507346.rb
++++ b/ruby/t/tc_800_rhbz507346.rb
+@@ -22,7 +22,7 @@ require 'guestfs'
+ 
+ class TestLoad < Test::Unit::TestCase
+   def test_rhbz507346
+-    g = Guestfs::create()
++    g = Guestfs::Guestfs.new()
+ 
+     File.open("test.img", "w") {
+       |f| f.seek(10*1024*1024); f.write("\0")
+diff --git a/ruby/t/tc_810_rhbz664558c6.rb b/ruby/t/tc_810_rhbz664558c6.rb
+index 290deac..5eb373e 100644
+--- a/ruby/t/tc_810_rhbz664558c6.rb
++++ b/ruby/t/tc_810_rhbz664558c6.rb
+@@ -26,7 +26,7 @@ require 'guestfs'
+ 
+ class TestLoad < Test::Unit::TestCase
+   def test_rhbz664558c6
+-    g = Guestfs::create()
++    g = Guestfs::Guestfs.new()
+ 
+     close_invoked = 0
+     close = Proc.new {| event, event_handle, buf, array |
+diff --git a/ruby/t/tc_820_rhbz1046509.rb b/ruby/t/tc_820_rhbz1046509.rb
+new file mode 100644
+index 0000000..978decd
+--- /dev/null
++++ b/ruby/t/tc_820_rhbz1046509.rb
+@@ -0,0 +1,42 @@
++# libguestfs Ruby bindings -*- ruby -*-
++# Copyright (C) 2013 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.
++
++# Test that we don't break the old ::create module function while
++# fixing https://bugzilla.redhat.com/show_bug.cgi?id=1046509
++
++require 'test/unit'
++$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
++$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
++require 'guestfs'
++
++class TestLoad < Test::Unit::TestCase
++  def _handleok(g)
++    g.add_drive("/dev/null")
++    g.close()
++  end
++
++  def test_rhbz1046509
++    g = Guestfs::create()
++    _handleok(g)
++
++    g = Guestfs::create(:close_on_exit => true)
++    _handleok(g)
++
++    g = Guestfs::create(:close_on_exit => true, :environment => true)
++    _handleok(g)
++  end
++end
+-- 
+1.8.3.1
+
diff --git a/SOURCES/0050-run-Use-timeout-foreground-option.patch b/SOURCES/0050-run-Use-timeout-foreground-option.patch
new file mode 100644
index 0000000..39436f8
--- /dev/null
+++ b/SOURCES/0050-run-Use-timeout-foreground-option.patch
@@ -0,0 +1,41 @@
+From 2944df76a60d447cb81d47d3fb4d4952bc024c68 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones@redhat.com>
+Date: Thu, 19 Dec 2013 08:21:53 +0000
+Subject: [PATCH] run: Use timeout --foreground option.
+
+If timeout doesn't have this option (RHEL 6) don't use timeout at all.
+
+Attempt to fix RHBZ#1025269.
+
+(cherry picked from commit 681488877456b83f039dc518861f29ab4e1857f0)
+---
+ run.in | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/run.in b/run.in
+index 5ab008b..5a45888 100755
+--- a/run.in
++++ b/run.in
+@@ -208,13 +208,13 @@ timeout_kill=30s
+ 
+ # Do we have Padraig's timeout utility (from coreutils)?
+ if timeout --help >/dev/null 2>&1; then
+-    # Does this version of timeout have the -k option?  (Not on RHEL 6)
+-    if timeout -k 10s 10s true >/dev/null 2>&1; then
+-        timeout_k_opt="-k $timeout_kill"
++    # Must use the --foreground option (RHBZ#1025269).
++    if timeout --foreground 2 sleep 0 >/dev/null 2>&1; then
++        # Does this version of timeout have the -k option?  (Not on RHEL 6)
++        if timeout -k 10s 10s true >/dev/null 2>&1; then
++            timeout="timeout -k $timeout_kill $timeout_period"
++        fi
+     fi
+-    # Timeout (SIGTERM) after $timeout_period.
+-    # Then send a second SIGKILL $timeout_kill seconds later.
+-    timeout="timeout $timeout_k_opt $timeout_period"
+ fi
+ 
+ pid=$$
+-- 
+1.8.3.1
+
diff --git a/SOURCES/0051-run-Actually-use-timeout-foreground-option-RHBZ-1025.patch b/SOURCES/0051-run-Actually-use-timeout-foreground-option-RHBZ-1025.patch
new file mode 100644
index 0000000..f5e75a9
--- /dev/null
+++ b/SOURCES/0051-run-Actually-use-timeout-foreground-option-RHBZ-1025.patch
@@ -0,0 +1,39 @@
+From 753df24b8f796d9cd35c64fc2725e322ef998327 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones@redhat.com>
+Date: Mon, 27 Jan 2014 21:58:42 +0000
+Subject: [PATCH] run: Actually use timeout --foreground option (RHBZ#1025269).
+
+The following commit managed to not actually add the --foreground
+option to the timeout command, just test for it.  Add it this time.
+
+  commit 681488877456b83f039dc518861f29ab4e1857f0
+  Author: Richard W.M. Jones <rjones@redhat.com>
+  Date:   Thu Dec 19 08:21:53 2013 +0000
+
+    run: Use timeout --foreground option.
+
+    If timeout doesn't have this option (RHEL 6) don't use timeout at all.
+
+    Attempt to fix RHBZ#1025269.
+
+(cherry picked from commit e3f72805d108c601280b889692c47d7d825e6079)
+---
+ run.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/run.in b/run.in
+index 5a45888..b0ad905 100755
+--- a/run.in
++++ b/run.in
+@@ -212,7 +212,7 @@ if timeout --help >/dev/null 2>&1; then
+     if timeout --foreground 2 sleep 0 >/dev/null 2>&1; then
+         # Does this version of timeout have the -k option?  (Not on RHEL 6)
+         if timeout -k 10s 10s true >/dev/null 2>&1; then
+-            timeout="timeout -k $timeout_kill $timeout_period"
++            timeout="timeout --foreground -k $timeout_kill $timeout_period"
+         fi
+     fi
+ fi
+-- 
+1.8.3.1
+
diff --git a/SOURCES/0052-RHEL-7-Emphasize-libguestfs-winsupport-package-RHBZ-.patch b/SOURCES/0052-RHEL-7-Emphasize-libguestfs-winsupport-package-RHBZ-.patch
new file mode 100644
index 0000000..0476250
--- /dev/null
+++ b/SOURCES/0052-RHEL-7-Emphasize-libguestfs-winsupport-package-RHBZ-.patch
@@ -0,0 +1,96 @@
+From d8ce3805e2d5162ec882031f03c7bf80e3df7573 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones@redhat.com>
+Date: Mon, 10 Jan 2011 16:07:12 +0000
+Subject: [PATCH] RHEL 7: Emphasize libguestfs-winsupport package
+ (RHBZ#627468).
+
+This RHEL-only patch changes the error messages when the
+inspection code cannot find an operating system inside the guest
+image.  For a Windows guest this may happen because the user has not
+installed the separate 'libguestfs-winsupport' package.  Therefore we
+emphasize that the user may need to install this package.
+
+Notes:
+
+(1) In RHEL there are two pieces of inspection code, the old Perl code
+(deprecated upstream) and the new C core inspection API.  Therefore
+this patch has to touch two places with essentially the same change.
+
+(2) This patch doesn't try to be clever and detect if it was a Windows
+guest.  This should reduce the chance of failure.
+
+Output from (Perl) virt-inspector now looks like this:
+
+ $ virt-inspector disk.img
+ No operating system could be detected inside this disk image.
+
+ This may be because the file is not a disk image, or is not a virtual machine
+ image, or because the OS type is not understood by virt-inspector.
+
+ If you feel this is an error, please file a bug report including as much
+ information about the disk image as possible.
+
+ RHEL notice
+ -------------
+ libguestfs will return this error for Microsoft Windows guests if the
+ separate 'libguestfs-winsupport' package is not installed. If the
+ guest is running Microsoft Windows, please try again after installing
+ 'libguestfs-winsupport'.
+
+Output from guestfish (ie. C core inspection API) now looks like this:
+
+ $ guestfish -i disk.img
+ guestfish: no operating system was found on this disk
+
+ RHEL notice
+ -------------
+ libguestfs will return this error for Microsoft Windows guests if the
+ separate 'libguestfs-winsupport' package is not installed. If the
+ guest is running Microsoft Windows, please try again after installing
+ 'libguestfs-winsupport'.
+---
+ fish/inspect.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/fish/inspect.c b/fish/inspect.c
+index 801d867..8858fcd 100644
+--- a/fish/inspect.c
++++ b/fish/inspect.c
+@@ -22,6 +22,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <errno.h>
++#include <unistd.h>
+ #include <libintl.h>
+ 
+ #include "c-ctype.h"
+@@ -68,6 +69,10 @@ inspect_mount (void)
+     exit (EXIT_FAILURE);
+ 
+   if (roots[0] == NULL) {
++    int libguestfs_winsupport_installed =
++      access ("/usr/lib/guestfs/supermin.d/ntfs.img", F_OK) == 0 ||
++      access ("/usr/lib64/guestfs/supermin.d/ntfs.img", F_OK) == 0;
++
+     fprintf (stderr,
+       _("%s: no operating system was found on this disk\n"
+         "\n"
+@@ -84,6 +89,15 @@ inspect_mount (void)
+         "with these tools.  Use the guestfish equivalent commands\n"
+         "(see the virt tool manual page).\n"),
+              program_name);
++    if (!libguestfs_winsupport_installed)
++      fprintf (stderr,
++    _("\nRHEL notice\n"
++      "-------------\n"
++      "libguestfs will return this error for Microsoft Windows guests if the\n"
++      "separate 'libguestfs-winsupport' package is not installed. If the\n"
++      "guest is running Microsoft Windows, please try again after installing\n"
++      "'libguestfs-winsupport'.\n"));
++
+     guestfs___free_string_list (roots);
+     exit (EXIT_FAILURE);
+   }
+-- 
+1.8.3.1
+
diff --git a/SOURCES/0053-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch b/SOURCES/0053-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch
new file mode 100644
index 0000000..679db4a
--- /dev/null
+++ b/SOURCES/0053-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch
@@ -0,0 +1,38 @@
+From 342085c40d94b9870d75a4160e74cf047439de99 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones@redhat.com>
+Date: Fri, 21 Dec 2012 15:50:11 +0000
+Subject: [PATCH] RHEL 7: Remove libguestfs live (RHBZ#798980).
+
+This isn't supported in RHEL 7.
+---
+ src/launch-unix.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/src/launch-unix.c b/src/launch-unix.c
+index ed71ab4..6eafd25 100644
+--- a/src/launch-unix.c
++++ b/src/launch-unix.c
+@@ -36,6 +36,12 @@
+ static int
+ launch_unix (guestfs_h *g, const char *sockpath)
+ {
++  error (g,
++	 "launch: In RHEL, only the 'libvirt' or 'appliance' method is supported.\n"
++	 "In particular, \"libguestfs live\" is not supported.");
++  return -1;
++
++#if 0
+   int r, daemon_sock = -1;
+   struct sockaddr_un addr;
+   uint32_t size;
+@@ -101,6 +107,7 @@ launch_unix (guestfs_h *g, const char *sockpath)
+     g->conn = NULL;
+   }
+   return -1;
++#endif
+ }
+ 
+ static int
+-- 
+1.8.3.1
+
diff --git a/SOURCES/0054-RHEL-7-Exclude-iptables-from-the-appliance-RHBZ-8586.patch b/SOURCES/0054-RHEL-7-Exclude-iptables-from-the-appliance-RHBZ-8586.patch
new file mode 100644
index 0000000..6c13b29
--- /dev/null
+++ b/SOURCES/0054-RHEL-7-Exclude-iptables-from-the-appliance-RHBZ-8586.patch
@@ -0,0 +1,26 @@
+From de83e11ee8ed5507cdbbb4de2d092d33e4f99b2b Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones@redhat.com>
+Date: Wed, 19 Sep 2012 15:02:27 +0100
+Subject: [PATCH] RHEL 7: Exclude iptables from the appliance (RHBZ#858648).
+
+---
+ appliance/excludelist.in | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/appliance/excludelist.in b/appliance/excludelist.in
+index aa4c406..c43006e 100644
+--- a/appliance/excludelist.in
++++ b/appliance/excludelist.in
+@@ -50,6 +50,9 @@
+ ^redhat-logos
+ ^dracut
+ 
++/* RHBZ#858648 */
++^iptables
++
+ #endif
+ 
+ #ifdef DEBIAN
+-- 
+1.8.3.1
+
diff --git a/SOURCES/0055-RHEL-7-Ignore-etc-release-if-etc-redhat-release-exis.patch b/SOURCES/0055-RHEL-7-Ignore-etc-release-if-etc-redhat-release-exis.patch
new file mode 100644
index 0000000..43dca0a
--- /dev/null
+++ b/SOURCES/0055-RHEL-7-Ignore-etc-release-if-etc-redhat-release-exis.patch
@@ -0,0 +1,29 @@
+From 0094bc09666f03b5c2ab955213dab79b19410cb7 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones@redhat.com>
+Date: Mon, 5 Nov 2012 11:19:19 +0000
+Subject: [PATCH] RHEL 7: Ignore /etc/release if /etc/redhat-release exists
+ (RHBZ#873219).
+
+If the user has created /etc/release on a RHEL machine, don't
+mis-detect the OS as NetBSD.
+---
+ src/inspect-fs.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/inspect-fs.c b/src/inspect-fs.c
+index 0473e92..4ad294b 100644
+--- a/src/inspect-fs.c
++++ b/src/inspect-fs.c
+@@ -223,7 +223,8 @@ check_filesystem (guestfs_h *g, const char *mountable,
+   else if (is_dir_etc &&
+            is_dir_bin &&
+            guestfs_is_file (g, "/etc/fstab") > 0 &&
+-           guestfs_is_file (g, "/etc/release") > 0) {
++           guestfs_is_file (g, "/etc/release") > 0 &&
++           guestfs_is_file (g, "/etc/redhat-release") == 0) {
+     /* Ignore /dev/sda1 which is a shadow of the real root filesystem
+      * that is probably /dev/sda5 (see:
+      * http://www.freebsd.org/doc/handbook/disk-organization.html)
+-- 
+1.8.3.1
+
diff --git a/SOURCES/0056-RHEL-7-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch b/SOURCES/0056-RHEL-7-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch
new file mode 100644
index 0000000..5324f7b
--- /dev/null
+++ b/SOURCES/0056-RHEL-7-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch
@@ -0,0 +1,344 @@
+From ca68dc5dcd245605ccb85b715fc43ca8c54bd2d9 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones@redhat.com>
+Date: Thu, 18 Jul 2013 18:31:53 +0100
+Subject: [PATCH] RHEL 7: Remove 9p APIs from RHEL (RHBZ#921710).
+
+---
+ Makefile.am          |   2 +-
+ daemon/9p.c          | 221 ---------------------------------------------------
+ daemon/Makefile.am   |   1 -
+ generator/actions.ml |  23 ------
+ gobject/Makefile.inc |   2 -
+ po/POTFILES          |   2 -
+ 6 files changed, 1 insertion(+), 250 deletions(-)
+ delete mode 100644 daemon/9p.c
+
+diff --git a/Makefile.am b/Makefile.am
+index c36f028..a09bd82 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -53,7 +53,7 @@ SUBDIRS += tests/xfs
+ SUBDIRS += tests/charsets
+ SUBDIRS += tests/xml
+ SUBDIRS += tests/mount-local
+-SUBDIRS += tests/9p
++#SUBDIRS += tests/9p
+ SUBDIRS += tests/rsync
+ SUBDIRS += tests/bigdirs
+ SUBDIRS += tests/disk-labels
+diff --git a/daemon/9p.c b/daemon/9p.c
+deleted file mode 100644
+index 024ac24..0000000
+--- a/daemon/9p.c
++++ /dev/null
+@@ -1,221 +0,0 @@
+-/* libguestfs - the guestfsd daemon
+- * Copyright (C) 2011 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.
+- */
+-
+-#include <config.h>
+-
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <string.h>
+-#include <unistd.h>
+-#include <limits.h>
+-#include <errno.h>
+-#include <sys/types.h>
+-#include <sys/stat.h>
+-#include <dirent.h>
+-#include <fcntl.h>
+-
+-#include "daemon.h"
+-#include "actions.h"
+-
+-#define BUS_PATH "/sys/bus/virtio/drivers/9pnet_virtio"
+-GUESTFSD_EXT_CMD(str_mount, mount);
+-
+-static char *read_whole_file (const char *filename);
+-
+-/* https://bugzilla.redhat.com/show_bug.cgi?id=714981#c1 */
+-char **
+-do_list_9p (void)
+-{
+-  DECLARE_STRINGSBUF (r);
+-
+-  DIR *dir;
+-
+-  dir = opendir (BUS_PATH);
+-  if (!dir) {
+-    perror ("opendir: " BUS_PATH);
+-    if (errno != ENOENT) {
+-      reply_with_perror ("opendir: " BUS_PATH);
+-      return NULL;
+-    }
+-
+-    /* If this directory doesn't exist, it probably means that
+-     * the virtio driver isn't loaded.  Don't return an error
+-     * in this case, but return an empty list.
+-     */
+-    if (end_stringsbuf (&r) == -1)
+-      return NULL;
+-
+-    return r.argv;
+-  }
+-
+-  while (1) {
+-    errno = 0;
+-    struct dirent *d = readdir (dir);
+-    if (d == NULL) break;
+-
+-    if (STRPREFIX (d->d_name, "virtio")) {
+-      char mount_tag_path[256];
+-      snprintf (mount_tag_path, sizeof mount_tag_path,
+-                BUS_PATH "/%s/mount_tag", d->d_name);
+-
+-      /* A bit unclear, but it looks like the virtio transport allows
+-       * the mount tag length to be unlimited (or up to 65536 bytes).
+-       * See: linux/include/linux/virtio_9p.h
+-       */
+-      CLEANUP_FREE char *mount_tag = read_whole_file (mount_tag_path);
+-      if (mount_tag == 0)
+-        continue;
+-
+-      if (add_string (&r, mount_tag) == -1) {
+-        closedir (dir);
+-        return NULL;
+-      }
+-    }
+-  }
+-
+-  /* Check readdir didn't fail */
+-  if (errno != 0) {
+-    reply_with_perror ("readdir: /sys/block");
+-    free_stringslen (r.argv, r.size);
+-    closedir (dir);
+-    return NULL;
+-  }
+-
+-  /* Close the directory handle */
+-  if (closedir (dir) == -1) {
+-    reply_with_perror ("closedir: /sys/block");
+-    free_stringslen (r.argv, r.size);
+-    return NULL;
+-  }
+-
+-  /* Sort the tags. */
+-  if (r.size > 0)
+-    sort_strings (r.argv, r.size);
+-
+-  /* NULL terminate the list */
+-  if (end_stringsbuf (&r) == -1)
+-    return NULL;
+-
+-  return r.argv;
+-}
+-
+-/* Read whole file into dynamically allocated array.  If there is an
+- * error, DON'T call reply_with_perror, just return NULL.  Returns a
+- * \0-terminated string.
+- */
+-static char *
+-read_whole_file (const char *filename)
+-{
+-  char *r = NULL;
+-  size_t alloc = 0, size = 0;
+-  int fd;
+-
+-  fd = open (filename, O_RDONLY|O_CLOEXEC);
+-  if (fd == -1) {
+-    perror (filename);
+-    return NULL;
+-  }
+-
+-  while (1) {
+-    alloc += 256;
+-    char *r2 = realloc (r, alloc);
+-    if (r2 == NULL) {
+-      perror ("realloc");
+-      free (r);
+-      close (fd);
+-      return NULL;
+-    }
+-    r = r2;
+-
+-    /* The '- 1' in the size calculation ensures there is space below
+-     * to add \0 to the end of the input.
+-     */
+-    ssize_t n = read (fd, r + size, alloc - size - 1);
+-    if (n == -1) {
+-      fprintf (stderr, "read: %s: %m\n", filename);
+-      free (r);
+-      close (fd);
+-      return NULL;
+-    }
+-    if (n == 0)
+-      break;
+-    size += n;
+-  }
+-
+-  if (close (fd) == -1) {
+-    fprintf (stderr, "close: %s: %m\n", filename);
+-    free (r);
+-    return NULL;
+-  }
+-
+-  r[size] = '\0';
+-
+-  return r;
+-}
+-
+-/* Takes optional arguments, consult optargs_bitmask. */
+-int
+-do_mount_9p (const char *mount_tag, const char *mountpoint, const char *options)
+-{
+-  CLEANUP_FREE char *mp = NULL, *opts = NULL, *err = NULL;
+-  struct stat statbuf;
+-  int r;
+-
+-  ABS_PATH (mountpoint, , return -1);
+-
+-  mp = sysroot_path (mountpoint);
+-  if (!mp) {
+-    reply_with_perror ("malloc");
+-    return -1;
+-  }
+-
+-  /* Check the mountpoint exists and is a directory. */
+-  if (stat (mp, &statbuf) == -1) {
+-    reply_with_perror ("%s", mountpoint);
+-    return -1;
+-  }
+-  if (!S_ISDIR (statbuf.st_mode)) {
+-    reply_with_perror ("%s: mount point is not a directory", mountpoint);
+-    return -1;
+-  }
+-
+-  /* Add trans=virtio to the options. */
+-  if ((optargs_bitmask & GUESTFS_MOUNT_9P_OPTIONS_BITMASK) &&
+-      STRNEQ (options, "")) {
+-    if (asprintf (&opts, "trans=virtio,%s", options) == -1) {
+-      reply_with_perror ("asprintf");
+-      return -1;
+-    }
+-  }
+-  else {
+-    opts = strdup ("trans=virtio");
+-    if (opts == NULL) {
+-      reply_with_perror ("strdup");
+-      return -1;
+-    }
+-  }
+-
+-  r = command (NULL, &err,
+-               str_mount, "-o", opts, "-t", "9p", mount_tag, mp, NULL);
+-  if (r == -1) {
+-    reply_with_error ("%s on %s: %s", mount_tag, mountpoint, err);
+-    return -1;
+-  }
+-
+-  return 0;
+-}
+diff --git a/daemon/Makefile.am b/daemon/Makefile.am
+index d077dab..13a04ac 100644
+--- a/daemon/Makefile.am
++++ b/daemon/Makefile.am
+@@ -77,7 +77,6 @@ noinst_PROGRAMS = guestfsd
+ endif
+ 
+ guestfsd_SOURCES = \
+-	9p.c \
+ 	acl.c \
+ 	actions.h \
+ 	available.c \
+diff --git a/generator/actions.ml b/generator/actions.ml
+index 379e63e..e3b57ff 100644
+--- a/generator/actions.ml
++++ b/generator/actions.ml
+@@ -8886,29 +8886,6 @@ This returns true iff the device exists and contains all zero bytes.
+ Note that for large devices this can take a long time to run." };
+ 
+   { defaults with
+-    name = "list_9p";
+-    style = RStringList "mounttags", [], [];
+-    proc_nr = Some 285;
+-    shortdesc = "list 9p filesystems";
+-    longdesc = "\
+-List all 9p filesystems attached to the guest.  A list of
+-mount tags is returned." };
+-
+-  { defaults with
+-    name = "mount_9p";
+-    style = RErr, [String "mounttag"; String "mountpoint"], [OString "options"];
+-    proc_nr = Some 286;
+-    camel_name = "Mount9P";
+-    shortdesc = "mount 9p filesystem";
+-    longdesc = "\
+-Mount the virtio-9p filesystem with the tag C<mounttag> on the
+-directory C<mountpoint>.
+-
+-If required, C<trans=virtio> will be automatically added to the options.
+-Any other options required can be passed in the optional C<options>
+-parameter." };
+-
+-  { defaults with
+     name = "list_dm_devices";
+     style = RStringList "devices", [], [];
+     proc_nr = Some 287;
+diff --git a/gobject/Makefile.inc b/gobject/Makefile.inc
+index 19c771f..47360cb 100644
+--- a/gobject/Makefile.inc
++++ b/gobject/Makefile.inc
+@@ -64,7 +64,6 @@ guestfs_gobject_headers= \
+   include/guestfs-gobject/optargs-is_fifo.h \
+   include/guestfs-gobject/optargs-is_socket.h \
+   include/guestfs-gobject/optargs-mkfs.h \
+-  include/guestfs-gobject/optargs-mount_9p.h \
+   include/guestfs-gobject/optargs-ntfsresize.h \
+   include/guestfs-gobject/optargs-btrfs_filesystem_resize.h \
+   include/guestfs-gobject/optargs-compress_out.h \
+@@ -138,7 +137,6 @@ guestfs_gobject_sources= \
+   src/optargs-is_fifo.c \
+   src/optargs-is_socket.c \
+   src/optargs-mkfs.c \
+-  src/optargs-mount_9p.c \
+   src/optargs-ntfsresize.c \
+   src/optargs-btrfs_filesystem_resize.c \
+   src/optargs-compress_out.c \
+diff --git a/po/POTFILES b/po/POTFILES
+index 53b660d..cc4e917 100644
+--- a/po/POTFILES
++++ b/po/POTFILES
+@@ -2,7 +2,6 @@ align/scan.c
+ cat/virt-cat.c
+ cat/virt-filesystems.c
+ cat/virt-ls.c
+-daemon/9p.c
+ daemon/acl.c
+ daemon/augeas.c
+ daemon/available.c
+@@ -180,7 +179,6 @@ gobject/src/optargs-mkfs.c
+ gobject/src/optargs-mkfs_btrfs.c
+ gobject/src/optargs-mkswap.c
+ gobject/src/optargs-mktemp.c
+-gobject/src/optargs-mount_9p.c
+ gobject/src/optargs-mount_local.c
+ gobject/src/optargs-ntfsclone_out.c
+ gobject/src/optargs-ntfsfix.c
+-- 
+1.8.3.1
+
diff --git a/SOURCES/0057-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch b/SOURCES/0057-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch
new file mode 100644
index 0000000..a056941
--- /dev/null
+++ b/SOURCES/0057-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch
@@ -0,0 +1,475 @@
+From 64c53898702fa6ae8bfbd1f0f2ec9fc09d96c66b 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 7: Disable unsupported remote drive protocols
+ (RHBZ#962113).
+
+This disables support for unsupported remote drive protocols:
+
+ * ftp
+ * ftps
+ * http
+ * https
+ * tftp
+ * gluster
+ * iscsi
+ * rbd
+ * 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 7.
+---
+ fish/guestfish.pod   |  67 ----------------------------
+ fish/test-add-uri.sh |  29 ------------
+ generator/actions.ml |  72 ------------------------------
+ src/drives.c         |   8 ++++
+ src/guestfs.pod      | 121 ---------------------------------------------------
+ 5 files changed, 8 insertions(+), 289 deletions(-)
+
+diff --git a/fish/guestfish.pod b/fish/guestfish.pod
+index c19fe6c..a240280 100644
+--- a/fish/guestfish.pod
++++ b/fish/guestfish.pod
+@@ -1138,40 +1138,6 @@ The possible I<-a URI> formats are described below.
+ 
+ Add the local disk image (or device) called C<disk.img>.
+ 
+-=head2 B<-a ftp://[user@]example.com[:port]/disk.img>
+-
+-=head2 B<-a ftps://[user@]example.com[:port]/disk.img>
+-
+-=head2 B<-a http://[user@]example.com[:port]/disk.img>
+-
+-=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.
+-
+-The equivalent API command would be:
+-
+- ><fs> add /disk.img protocol:(ftp|...) server:tcp:example.com
+-
+-=head2 B<-a gluster://example.com[:port]/disk>
+-
+-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 /disk 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.
+-
+-The equivalent API command would be:
+-
+- ><fs> add /target-iqn-name/lun protocol:iscsi server:tcp:example.com
+-
+ =head2 B<-a nbd://example.com[:port]>
+ 
+ =head2 B<-a nbd://example.com[:port]/exportname>
+@@ -1193,39 +1159,6 @@ The equivalent API command would be (no export name):
+ 
+  ><fs> add "" protocol:nbd server:[tcp:example.com|unix:/socket]
+ 
+-=head2 B<-a rbd://example.com[:port]/disk>
+-
+-Add a disk image located on a Ceph (RBD/librbd) storage volume.
+-
+-Although libguestfs and Ceph supports multiple servers, only a single
+-server can be specified when using this URI syntax.
+-
+-The equivalent API command would be:
+-
+- ><fs> add /disk protocol:rbd server:tcp:example.com
+-
+-=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 /disk 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
+-Shell (ssh) SFTP protocol.  SFTP is supported out of the box by all
+-major SSH servers.
+-
+-The equivalent API command would be:
+-
+- ><fs> add /disk protocol:ssh server:tcp:example.com [username:user]
+-
+ =head1 PROGRESS BARS
+ 
+ Some (not all) long-running commands send progress notification
+diff --git a/fish/test-add-uri.sh b/fish/test-add-uri.sh
+index dfeccf7..c481e88 100755
+--- a/fish/test-add-uri.sh
++++ b/fish/test-add-uri.sh
+@@ -37,14 +37,6 @@ function fail ()
+ $VG ./guestfish -x -a file://$(pwd)/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
+@@ -58,26 +50,5 @@ grep -sq 'add_drive "" "protocol:nbd" "server:unix:/sk"' test-add-uri.out || fai
+ $VG ./guestfish -x -a 'nbd:///export?socket=/sk' </dev/null >test-add-uri.out 2>&1
+ grep -sq 'add_drive "/export" "protocol:nbd" "server:unix:/sk"' test-add-uri.out || fail
+ 
+-# rbd
+-$VG ./guestfish -x -a rbd://example.com:3000/disk </dev/null >test-add-uri.out 2>&1
+-grep -sq 'add_drive "/disk" "protocol:rbd" "server:tcp:example.com:3000"' 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
+-
+-$VG ./guestfish -x -a ssh://user@example.com/disk.img </dev/null >test-add-uri.out 2>&1
+-grep -sq 'add_drive "/disk.img" "protocol:ssh" "server:tcp:example.com" "username:user"' test-add-uri.out || fail
+-
+-$VG ./guestfish -x -a ssh://user@example.com:2000/disk.img </dev/null >test-add-uri.out 2>&1
+-grep -sq 'add_drive "/disk.img" "protocol:ssh" "server:tcp:example.com:2000" "username:user"' test-add-uri.out || fail
+-
+ rm test-add-uri.out
+ rm test-add-uri.img
+diff --git a/generator/actions.ml b/generator/actions.ml
+index e3b57ff..879080f 100644
+--- a/generator/actions.ml
++++ b/generator/actions.ml
+@@ -1333,27 +1333,6 @@ C<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\">
+-
+-Connect to a remote FTP, HTTP or TFTP 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>
+-
+-=item C<protocol = \"iscsi\">
+-
+-Connect to the iSCSI server.
+-The C<server> parameter must also be supplied - see below.
+-
+-See also: L<guestfs(3)/ISCSI>.
+-
+ =item C<protocol = \"nbd\">
+ 
+ Connect to the Network Block Device server.
+@@ -1361,31 +1340,6 @@ The C<server> parameter must also be supplied - see below.
+ 
+ See also: L<guestfs(3)/NETWORK BLOCK DEVICE>.
+ 
+-=item C<protocol = \"rbd\">
+-
+-Connect to the Ceph (librbd/RBD) server.
+-The C<server> parameter must also be supplied - see below.
+-The C<username> parameter may be supplied.  See below.
+-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.
+-
+-The C<server> parameter must be supplied.
+-The C<username> parameter may be supplied.  See below.
+-
+-See also: L<guestfs(3)/SSH>.
+-
+ =back
+ 
+ =item C<server>
+@@ -1396,13 +1350,7 @@ 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
+- iscsi          Exactly one
+  nbd            Exactly one
+- rbd            One 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:
+@@ -1416,26 +1364,6 @@ in one of the following formats:
+ If the port number is omitted, then the standard port number
+ for the protocol is used (see C</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.
+-
+-If not given, then the local username is used for C<ssh>, and no authentication
+-is attempted for ceph.  But note this sometimes may give unexpected results, for
+-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,
+-specify the remote username you want.
+-
+-=item C<secret>
+-
+-For the C<rbd> protocol only, this specifies the 'secret' to use when
+-connecting to the remote device.
+-
+-If not given, then a secret matching the given username will be looked up in the
+-default keychain locations, or if no username is given, then no authentication
+-will be used.
+-
+ =item C<cachemode>
+ 
+ Choose whether or not libguestfs will obey sync operations (safe but slow)
+diff --git a/src/drives.c b/src/drives.c
+index f310b06..7abd952 100644
+--- a/src/drives.c
++++ b/src/drives.c
+@@ -136,6 +136,7 @@ create_drive_non_file (guestfs_h *g,
+   return drv;
+ }
+ 
++#if 0 /* DISABLED IN RHEL 7 */
+ static struct drive *
+ create_drive_curl (guestfs_h *g,
+                    enum drive_protocol protocol,
+@@ -218,6 +219,7 @@ create_drive_gluster (guestfs_h *g,
+                                 readonly, format, iface, name, disk_label,
+                                 cachemode);
+ }
++#endif /* DISABLED IN RHEL 7 */
+ 
+ static int
+ nbd_port (void)
+@@ -264,6 +266,7 @@ create_drive_nbd (guestfs_h *g,
+                                 cachemode);
+ }
+ 
++#if 0 /* DISABLED IN RHEL 7 */
+ static struct drive *
+ create_drive_rbd (guestfs_h *g,
+                   struct drive_server *servers, size_t nr_servers,
+@@ -451,6 +454,7 @@ create_drive_iscsi (guestfs_h *g,
+                                 readonly, format, iface, name, disk_label,
+                                 cachemode);
+ }
++#endif /* DISABLED IN RHEL 7 */
+ 
+ /* Traditionally you have been able to use /dev/null as a filename, as
+  * many times as you like.  Ancient KVM (RHEL 5) cannot handle adding
+@@ -865,6 +869,7 @@ guestfs__add_drive_opts (guestfs_h *g, const char *filename,
+                                disk_label, cachemode);
+     }
+   }
++#if 0 /* DISABLED IN RHEL 7 */
+   else if (STREQ (protocol, "ftp")) {
+     drv = create_drive_curl (g, drive_protocol_ftp,
+                              servers, nr_servers, filename,
+@@ -905,12 +910,14 @@ guestfs__add_drive_opts (guestfs_h *g, const char *filename,
+                               readonly, format, iface, name,
+                               disk_label, cachemode);
+   }
++#endif /* DISABLED IN RHEL 7 */
+   else if (STREQ (protocol, "nbd")) {
+     drv = create_drive_nbd (g, servers, nr_servers, filename,
+                             username, secret,
+                             readonly, format, iface, name,
+                             disk_label, cachemode);
+   }
++#if 0 /* DISABLED IN RHEL 7 */
+   else if (STREQ (protocol, "rbd")) {
+     drv = create_drive_rbd (g, servers, nr_servers, filename,
+                             username, secret,
+@@ -936,6 +943,7 @@ guestfs__add_drive_opts (guestfs_h *g, const char *filename,
+                              readonly, format, iface, name,
+                              disk_label, cachemode);
+   }
++#endif /* DISABLED IN RHEL 7 */
+   else {
+     error (g, _("unknown protocol '%s'"), protocol);
+     drv = NULL; /*FALLTHROUGH*/
+diff --git a/src/guestfs.pod b/src/guestfs.pod
+index eedea94..87e8882 100644
+--- a/src/guestfs.pod
++++ b/src/guestfs.pod
+@@ -668,91 +668,6 @@ you don't need to add any disks.
+ 
+ =head2 REMOTE STORAGE
+ 
+-=head3 CEPH
+-
+-Libguestfs can access Ceph (librbd/RBD) disks.
+-
+-To do this, set the optional C<protocol> and C<server> parameters of
+-L</guestfs_add_drive_opts> like this:
+-
+- char **servers = { "ceph1.example.org:3000", /* ... */, NULL };
+- guestfs_add_drive_opts (g, "/pool/image",
+-                         GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
+-                         GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "rbd",
+-                         GUESTFS_ADD_DRIVE_OPTS_SERVER, servers,
+-                         GUESTFS_ADD_DRIVE_OPTS_USERNAME, "rbduser",
+-                         GUESTFS_ADD_DRIVE_OPTS_SECRET, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
+-                         -1);
+-
+-C<servers> (the C<server> parameter) is a list of one or more Ceph
+-servers.  The server string is documented in
+-L</guestfs_add_drive_opts>. The C<username> and C<secret> parameters are
+-also optional, and if not given, then no authentication will be used.
+-
+-=head3 FTP, HTTP AND TFTP
+-
+-Libguestfs can access remote disks over FTP, FTPS, HTTP, HTTPS
+-or TFTP protocols.
+-
+-To do this, set the optional C<protocol> and C<server> parameters of
+-L</guestfs_add_drive_opts> like this:
+-
+- char **servers = { "www.example.org", NULL };
+- guestfs_add_drive_opts (g, "/disk.img",
+-                         GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
+-                         GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "http",
+-                         GUESTFS_ADD_DRIVE_OPTS_SERVER, servers,
+-                         -1);
+-
+-The C<protocol> can be one of C<"ftp">, C<"ftps">, C<"http">,
+-C<"https"> or C<"tftp">.
+-
+-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
+-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").
+-
+-=head3 ISCSI
+-
+-Libguestfs can access iSCSI disks remotely.
+-
+-To do this, set the optional C<protocol> and C<server> parameters like
+-this:
+-
+- char **server = { "iscsi.example.org:3000", NULL };
+- guestfs_add_drive_opts (g, "/target-iqn-name/lun",
+-                         GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
+-                         GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "iscsi",
+-                         GUESTFS_ADD_DRIVE_OPTS_SERVER, server,
+-                         -1);
+-
+-The C<server> parameter is a list which must have a single element.
+-The single element is a string defining the iSCSI server.  The format
+-of this string is documented in L</guestfs_add_drive_opts>.
+-
+ =head3 NETWORK BLOCK DEVICE
+ 
+ Libguestfs can access Network Block Device (NBD) disks remotely.
+@@ -815,42 +730,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>.
+-
+-=head3 SSH
+-
+-Libguestfs can access disks over a Secure Shell (SSH) connection.
+-
+-To do this, set the C<protocol> and C<server> and (optionally)
+-C<username> parameters of L</guestfs_add_drive_opts> like this:
+-
+- char **server = { "remote.example.com", NULL };
+- guestfs_add_drive_opts (g, "/path/to/disk.img",
+-                         GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
+-                         GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "ssh",
+-                         GUESTFS_ADD_DRIVE_OPTS_SERVER, server,
+-                         GUESTFS_ADD_DRIVE_OPTS_USERNAME, "remoteuser",
+-                         -1);
+-
+-The format of the server string is documented in
+-L</guestfs_add_drive_opts>.
+-
+ =head2 INSPECTION
+ 
+ Libguestfs has APIs for inspecting an unknown disk image to find out
+-- 
+1.8.3.1
+
diff --git a/SPECS/libguestfs.spec b/SPECS/libguestfs.spec
index f7dce22..79a7efe 100644
--- a/SPECS/libguestfs.spec
+++ b/SPECS/libguestfs.spec
@@ -12,7 +12,7 @@ Summary:       Access and modify virtual machine disk images
 Name:          libguestfs
 Epoch:         1
 Version:       1.22.6
-Release:       15%{?dist}
+Release:       22%{?dist}
 License:       LGPLv2+
 URL:           http://libguestfs.org/
 Source0:       http://libguestfs.org/download/1.22-stable/%{name}-%{version}.tar.gz
@@ -63,14 +63,27 @@ Patch0035:     0035-launch-libvirt-Set-attribute-present-yes-to-enable-k.patch
 Patch0036:     0036-blockdev-Deprecate-blockdev_setbsz-and-make-it-do-no.patch
 Patch0037:     0037-daemon-Fix-xfs_info-parser-because-of-new-format.patch
 Patch0038:     0038-Add-man-page-for-etc-libguestfs-tools.conf-RHBZ-1019.patch
+Patch0039:     0039-perl-Give-error-instead-of-crashing-if-optarg-is-not.patch
+Patch0040:     0040-virt-win-reg-Allow-URIs-RHBZ-912193.patch
+Patch0041:     0041-Remove-bogus-license-file-from-daemon-subdirectory.patch
+Patch0042:     0042-sparsify-Prevent-overwriting-block-or-char-output-de.patch
+Patch0043:     0043-fuse-In-mount-local-run-test-if-root-filesystem-has-.patch
+Patch0044:     0044-utils-add-a-function-to-validate-a-GUID-string.patch
+Patch0045:     0045-generator-add-a-GUID-parameter-type.patch
+Patch0046:     0046-generator-generate-code-for-parameter-validation.patch
+Patch0047:     0047-actions-part_set_gpt_type-set-type-of-guid-parameter.patch
+Patch0048:     0048-list-filesystems-Do-not-segfault-if-guestfs_btrfs_su.patch
+Patch0049:     0049-ruby-Fix-.new-method-RHBZ-1046509.patch
+Patch0050:     0050-run-Use-timeout-foreground-option.patch
+Patch0051:     0051-run-Actually-use-timeout-foreground-option-RHBZ-1025.patch
 
 # RHEL 7 specific patches.
-Patch0039:     0039-RHEL-7-Emphasize-libguestfs-winsupport-package-RHBZ-.patch
-Patch0040:     0040-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch
-Patch0041:     0041-RHEL-7-Exclude-iptables-from-the-appliance-RHBZ-8586.patch
-Patch0042:     0042-RHEL-7-Ignore-etc-release-if-etc-redhat-release-exis.patch
-Patch0043:     0043-RHEL-7-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch
-Patch0044:     0044-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch
+Patch0052:     0052-RHEL-7-Emphasize-libguestfs-winsupport-package-RHBZ-.patch
+Patch0053:     0053-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch
+Patch0054:     0054-RHEL-7-Exclude-iptables-from-the-appliance-RHBZ-8586.patch
+Patch0055:     0055-RHEL-7-Ignore-etc-release-if-etc-redhat-release-exis.patch
+Patch0056:     0056-RHEL-7-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch
+Patch0057:     0057-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch
 
 # Use git for patch management.
 BuildRequires: git
@@ -156,6 +169,9 @@ Requires:      %{appliance_buildreqs}
 # Hack to work around missing dependency (RHBZ#901542).
 BuildRequires: seabios-bin
 
+# Requires fix for RHBZ#1062533.  Can remove this in RHEL 7.1.
+BuildRequires: libnl3 >= 3.2.21-6.el7
+
 # For building the appliance.
 Requires:      supermin-helper >= 4.1.4
 
@@ -620,6 +636,9 @@ gzip -9 ChangeLog
 
 
 %check
+
+%if %{runtests}
+
 # Enable debugging - very useful if a test does fail, although
 # it produces masses of output in the build.log.
 export LIBGUESTFS_DEBUG=1
@@ -676,8 +695,15 @@ for f in test-getaddrinfo test-utimens ; do
 done
 popd
 
-%if %{runtests}
+# Do make quickcheck first, to fail early if the appliance is
+# obviously broken.  Also dump libvirt log files if this happens.
+if ! make quickcheck LIBVIRT_DEBUG=1; then
+    cat $HOME/.cache/libvirt/qemu/log/*
+    exit 1
+fi
+
 make check -k
+
 %endif
 
 
@@ -698,13 +724,6 @@ find $RPM_BUILD_ROOT -name .packlist -delete
 find $RPM_BUILD_ROOT -name '*.bs' -delete
 find $RPM_BUILD_ROOT -name 'bindtests.pl' -delete
 
-# Move Python libraries to sitelib.
-if [ "$RPM_BUILD_ROOT%{python_sitearch}" != "$RPM_BUILD_ROOT%{python_sitelib}" ]; then
-   mkdir -p $RPM_BUILD_ROOT%{python_sitelib}
-   mv $RPM_BUILD_ROOT%{python_sitearch}/guestfs.py* \
-     $RPM_BUILD_ROOT%{python_sitelib}/
-fi
-
 # Remove obsolete binaries (RHBZ#947438).
 rm $RPM_BUILD_ROOT%{_bindir}/virt-list-filesystems
 rm $RPM_BUILD_ROOT%{_bindir}/virt-list-partitions
@@ -849,10 +868,10 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/libguestfs
 
 %files -n python-%{name}
 %doc python/examples/*.py
-%{python_sitearch}/*
-%{python_sitelib}/*.py
-%{python_sitelib}/*.pyc
-%{python_sitelib}/*.pyo
+%{python_sitearch}/libguestfsmod.so
+%{python_sitearch}/guestfs.py
+%{python_sitearch}/guestfs.pyc
+%{python_sitearch}/guestfs.pyo
 %{_mandir}/man3/guestfs-python.3*
 
 
@@ -917,9 +936,43 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/libguestfs
 
 
 %changelog
+* Mon Mar  3 2014 Richard W.M. Jones <rjones@redhat.com> - 1:1.22.6-22
+- Fix Ruby bindings
+  resolves: rhbz#1072079
+
+* Wed Feb 12 2014 Richard W.M. Jones <rjones@redhat.com> - 1:1.22.6-21
+- Fix segfault in guestfs_list_filesystems when presented with a
+  corrupt btrfs filesystem
+  resolves: rhbz#1064008
+
+* Tue Feb 11 2014 Richard W.M. Jones <rjones@redhat.com> - 1:1.22.6-20
+- Valid GUIDs when used as parameter to part-set-gpt-type
+  resolves: rhbz#1008417
+
+* Wed Feb 05 2014 Richard W.M. Jones <rjones@redhat.com> - 1:1.22.6-19
+- Fix placement of *.py[co] files
+  resolves: rhbz#1061155
+- Remove bogus license file from daemon
+  resolves: rhbz#1061160
+- Prevent virt-sparsify from overwriting block or char devices
+  resolves: rhbz#1056556
+- mount-local should give a clearer error if root is not mounted
+  resolves: rhbz#1057492
+
+* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 1:1.22.6-18
+- Mass rebuild 2013-12-27
+
+* Thu Dec 05 2013 Richard W.M. Jones <rjones@redhat.com> - 1:1.22.6-17
+- Rebuild for updated procps SONAME.
+  resolves: rhbz#1037795
+
+* Wed Nov 20 2013 Richard W.M. Jones <rjones@redhat.com> - 1:1.22.6-16
+- Allow virt-win-reg command to work with URIs
+  resolves: rhbz#912193
+
 * Thu Oct 31 2013 Richard W.M. Jones <rjones@redhat.com> - 1:1.22.6-15
 - Add libguestfs-tools.conf(5) man page
-  resovles: rhbz#1019891
+  resolves: rhbz#1019891
 - Drop PHP bindings
   resolves: rhbz#1020021
 - Disable Haskell & Erlang (in case someone has these dependencies