diff --git a/.gitignore b/.gitignore
index 47ec0aa..6d71182 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,3 @@
-SOURCES/RHEV-Application_Provisioning_Tool_46267.exe
+SOURCES/RHEV-Application-Provisioning-Tool.exe_4.12
SOURCES/libguestfs-1.28.1.tar.gz
SOURCES/rhsrvany.exe
diff --git a/.libguestfs.metadata b/.libguestfs.metadata
index 867d2c9..f4542a4 100644
--- a/.libguestfs.metadata
+++ b/.libguestfs.metadata
@@ -1,3 +1,3 @@
-c96e9afc69abd384172c20b97a490b7a25684b8a SOURCES/RHEV-Application_Provisioning_Tool_46267.exe
+8fec32284530ce6d485629fcbd1f7f3e005ae8a0 SOURCES/RHEV-Application-Provisioning-Tool.exe_4.12
49b32fe74f1e856c9397213a25f2440375574514 SOURCES/libguestfs-1.28.1.tar.gz
-4dc7732d691049ea9a936a0d6c415ed9e29b4b1e SOURCES/rhsrvany.exe
+2bd96e478fc004cd323b5bd754c856641877dac6 SOURCES/rhsrvany.exe
diff --git a/SOURCES/0013-v2v-i-libvirt-Refactor-map_source-functions.patch b/SOURCES/0013-v2v-i-libvirt-Refactor-map_source-functions.patch
index 44bd092..42b1743 100644
--- a/SOURCES/0013-v2v-i-libvirt-Refactor-map_source-functions.patch
+++ b/SOURCES/0013-v2v-i-libvirt-Refactor-map_source-functions.patch
@@ -12,10 +12,10 @@ tests are done, this should be equivalent to the previous code.
(cherry picked from commit 3596165282ccf2c5896894ec4e9a71c6da788463)
---
- v2v/input_libvirt.ml | 32 +++++++++++++++++++++++---------
+ v2v/input_libvirt.ml | 36 +++++++++++++++++++++++++-----------
v2v/input_libvirtxml.ml | 31 ++++++++++++-------------------
v2v/input_libvirtxml.mli | 11 +----------
- 3 files changed, 36 insertions(+), 38 deletions(-)
+ 3 files changed, 38 insertions(+), 40 deletions(-)
diff --git a/v2v/input_libvirt.ml b/v2v/input_libvirt.ml
index e8b1345..9d2869f 100644
@@ -53,19 +53,21 @@ index e8b1345..9d2869f 100644
method source () =
if verbose then printf "input_libvirt_xen_ssh: source()\n%!";
-+ error_if_libvirt_backend ();
-+ error_if_no_ssh_agent ();
-+
- (* Get the libvirt XML. This also checks (as a side-effect)
- * that the domain is not running. (RHBZ#1138586)
- *)
- let xml = Domainxml.dumpxml ?conn:libvirt_uri guest in
+- (* Get the libvirt XML. This also checks (as a side-effect)
+- * that the domain is not running. (RHBZ#1138586)
+- *)
+- let xml = Domainxml.dumpxml ?conn:libvirt_uri guest in
-
-- error_if_libvirt_backend ();
-- error_if_no_ssh_agent ();
+ error_if_libvirt_backend ();
+ error_if_no_ssh_agent ();
+
++ (* Get the libvirt XML. This also checks (as a side-effect)
++ * that the domain is not running. (RHBZ#1138586)
++ *)
++ let xml = Domainxml.dumpxml ?conn:libvirt_uri guest in
+ let { s_disks = disks } as source =
+ Input_libvirtxml.parse_libvirt_xml ~verbose xml in
-
++
let mapf = Xen.map_path_to_uri verbose parsed_uri scheme server in
- Input_libvirtxml.parse_libvirt_xml ~verbose
- ~map_source_file:mapf ~map_source_dev:mapf xml
diff --git a/SOURCES/0018-v2v-Inline-and-simplify-Xen-and-vCenter-input-method.patch b/SOURCES/0018-v2v-Inline-and-simplify-Xen-and-vCenter-input-method.patch
index af085e1..ec99ec3 100644
--- a/SOURCES/0018-v2v-Inline-and-simplify-Xen-and-vCenter-input-method.patch
+++ b/SOURCES/0018-v2v-Inline-and-simplify-Xen-and-vCenter-input-method.patch
@@ -39,12 +39,14 @@ index 7dde9be..5d98a86 100644
+ (match uri.uri_user with Some user -> " " ^ quote user | None -> "")
+ (quote url) in
+ let lines = external_command ~prog cmd in
-+
+
+-let session_cookie = ref ""
+ let dump_response chan =
+ fprintf chan "%s\n" cmd;
+ List.iter (fun x -> fprintf chan "%s\n" x) lines
+ in
-+
+
+-(* Map an ESX to a qemu URI using the cURL driver
+ if verbose then dump_response stdout;
+
+ (* Look for the last HTTP/x.y NNN status code in the output. *)
@@ -98,8 +100,7 @@ index 7dde9be..5d98a86 100644
+ else
+ Some !session_cookie
+ )
-
--let session_cookie = ref ""
++
+(* Helper function to extract the datacenter from a URI. *)
+let get_datacenter uri scheme =
+ let default_dc = "ha-datacenter" in
@@ -123,8 +124,7 @@ index 7dde9be..5d98a86 100644
+ default_dc
+ | _ -> (* Don't know, so guess. *)
+ default_dc
-
--(* Map an ESX to a qemu URI using the cURL driver
++
+(* Map the string to a qemu URI using the cURL driver
* in qemu. The 'path' will be something like
*
diff --git a/SOURCES/0021-v2v-i-libvirtxml-Fix-handling-of-nbd-sources-RHBZ-11.patch b/SOURCES/0021-v2v-i-libvirtxml-Fix-handling-of-nbd-sources-RHBZ-11.patch
index e5d8fc0..08a46bc 100644
--- a/SOURCES/0021-v2v-i-libvirtxml-Fix-handling-of-nbd-sources-RHBZ-11.patch
+++ b/SOURCES/0021-v2v-i-libvirtxml-Fix-handling-of-nbd-sources-RHBZ-11.patch
@@ -20,11 +20,11 @@ This fixes commit 3596165282ccf2c5896894ec4e9a71c6da788463.
(cherry picked from commit ad78d1492b02eaf5d810e2f9d012a5fed4f4124b)
---
v2v/input_libvirt_other.ml | 5 ++++-
- v2v/input_libvirt_vcenter_https.ml | 46 ++++++++++++++++++++++++--------------
+ v2v/input_libvirt_vcenter_https.ml | 44 ++++++++++++++++++++++++--------------
v2v/input_libvirt_xen_ssh.ml | 10 ++++++---
- v2v/input_libvirtxml.ml | 38 +++++++++++++++++++++----------
- v2v/input_libvirtxml.mli | 17 ++++++++++++--
- 5 files changed, 81 insertions(+), 35 deletions(-)
+ v2v/input_libvirtxml.ml | 38 +++++++++++++++++++++-----------
+ v2v/input_libvirtxml.mli | 17 +++++++++++++--
+ 5 files changed, 80 insertions(+), 34 deletions(-)
diff --git a/v2v/input_libvirt_other.ml b/v2v/input_libvirt_other.ml
index a771aa1..9f3eedb 100644
@@ -100,7 +100,10 @@ index 71c2edd..56097e0 100644
let readahead = readahead_for_copying in
- map_source_to_uri ?readahead
- verbose parsed_uri scheme server orig_path in
--
++ let backing_qemu_uri =
++ map_source_to_uri ?readahead
++ verbose parsed_uri scheme server orig_path in
+
- (* Rebase the qcow2 overlay to adjust the readahead parameter. *)
- let cmd =
- sprintf "qemu-img rebase -u -b %s %s"
@@ -108,10 +111,6 @@ index 71c2edd..56097e0 100644
- if verbose then printf "%s\n%!" cmd;
- if Sys.command cmd <> 0 then
- warning ~prog (f_"qemu-img rebase failed (ignored)")
-+ let backing_qemu_uri =
-+ map_source_to_uri ?readahead
-+ verbose parsed_uri scheme server orig_path in
-+
+ (* Rebase the qcow2 overlay to adjust the readahead parameter. *)
+ let cmd =
+ sprintf "qemu-img rebase -u -b %s %s"
diff --git a/SOURCES/0044-inspection-Get-icons-from-RHEL-and-CentOS-7-RHBZ-116.patch b/SOURCES/0044-inspection-Get-icons-from-RHEL-and-CentOS-7-RHBZ-116.patch
index 8727cf4..787226b 100644
--- a/SOURCES/0044-inspection-Get-icons-from-RHEL-and-CentOS-7-RHBZ-116.patch
+++ b/SOURCES/0044-inspection-Get-icons-from-RHEL-and-CentOS-7-RHBZ-116.patch
@@ -39,13 +39,13 @@ index 0ffca72..4f10dfb 100644
+ max_size = 17000;
+ else
+ max_size = 66000;
-+
+
+- return get_png (g, fs, SHADOWMAN_ICON, size_r, max_size);
+ if (fs->major_version <= 6)
+ shadowman = "/usr/share/pixmaps/redhat/shadowman-transparent.png";
+ else
+ shadowman = "/usr/share/pixmaps/fedora-logo-sprite.png";
-
-- return get_png (g, fs, SHADOWMAN_ICON, size_r, max_size);
++
+ return get_png (g, fs, shadowman, size_r, max_size);
}
diff --git a/SOURCES/0050-v2v-Don-t-use-target-dev-attribute-use-target-bus-in.patch b/SOURCES/0050-v2v-Don-t-use-target-dev-attribute-use-target-bus-in.patch
index e1393c8..8543aae 100644
--- a/SOURCES/0050-v2v-Don-t-use-target-dev-attribute-use-target-bus-in.patch
+++ b/SOURCES/0050-v2v-Don-t-use-target-dev-attribute-use-target-bus-in.patch
@@ -247,7 +247,11 @@ index 836b24e..fe71039 100644
- let address = xpath_to_int "rasd:AddressOnParent/text()" 0 in
let parent_id = xpath_to_int "rasd:Parent/text()" 0 in
-- (* Find the parent controller. *)
++ (* XXX We assume the OVF lists these in order.
++ let address = xpath_to_int "rasd:AddressOnParent/text()" 0 in
++ *)
++
+ (* Find the parent controller. *)
- let expr = sprintf "/ovf:Envelope/ovf:VirtualSystem/ovf:VirtualHardwareSection/ovf:Item[rasd:InstanceID/text()=%d]/rasd:ResourceType/text()" parent_id in
- let controller = xpath_to_int expr 0 in
-
@@ -256,12 +260,8 @@ index 836b24e..fe71039 100644
- match controller with
- | 6 -> "sd"
- | 0 | 5 | _ (* XXX floppy should be 'fd'? *) -> "hd" in
-+ (* XXX We assume the OVF lists these in order.
-+ let address = xpath_to_int "rasd:AddressOnParent/text()" 0 in
-+ *)
-
+-
- let target_dev = target_dev ^ drive_name address in
-+ (* Find the parent controller. *)
+ let controller = parent_controller parent_id in
Xml.xpathctx_set_current_context xpathctx n;
@@ -282,7 +282,11 @@ index 836b24e..fe71039 100644
- let address = xpath_to_int "rasd:AddressOnParent/text()" 0 in
let parent_id = xpath_to_int "rasd:Parent/text()" 0 in
-- (* Find the parent controller. *)
++ (* XXX We assume the OVF lists these in order.
++ let address = xpath_to_int "rasd:AddressOnParent/text()" 0 in
++ *)
++
+ (* Find the parent controller. *)
- let expr = sprintf "/ovf:Envelope/ovf:VirtualSystem/ovf:VirtualHardwareSection/ovf:Item[rasd:InstanceID/text()=%d]/rasd:ResourceType/text()" parent_id in
- let controller = xpath_to_int expr 0 in
-
@@ -291,12 +295,8 @@ index 836b24e..fe71039 100644
- match controller with
- | 6 -> "sd"
- | 0 | 5 | _ (* XXX floppy should be 'fd'? *) -> "hd" in
-+ (* XXX We assume the OVF lists these in order.
-+ let address = xpath_to_int "rasd:AddressOnParent/text()" 0 in
-+ *)
-
+-
- let target_dev = target_dev ^ drive_name address in
-+ (* Find the parent controller. *)
+ let controller = parent_controller parent_id in
let typ =
diff --git a/SOURCES/0089-RHEL-7-Emphasize-libguestfs-winsupport-package-RHBZ-.patch b/SOURCES/0089-RHEL-7-Emphasize-libguestfs-winsupport-package-RHBZ-.patch
deleted file mode 100644
index 02c6aff..0000000
--- a/SOURCES/0089-RHEL-7-Emphasize-libguestfs-winsupport-package-RHBZ-.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-From c3fd9d491a043a1b2be7755c4ef8335a4525e185 Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones"
-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 841f1da..9b37d87 100644
---- a/fish/inspect.c
-+++ b/fish/inspect.c
-@@ -22,6 +22,7 @@
- #include
- #include
- #include
-+#include
- #include
-
- #include "c-ctype.h"
-@@ -71,6 +72,10 @@ inspect_mount_handle (guestfs_h *g)
- exit (EXIT_FAILURE);
-
- if (roots[0] == NULL) {
-+ int libguestfs_winsupport_installed =
-+ access ("/usr/lib/guestfs/supermin.d/zz-winsupport", F_OK) == 0 ||
-+ access ("/usr/lib64/guestfs/supermin.d/zz-winsupport", F_OK) == 0;
-+
- fprintf (stderr,
- _("%s: no operating system was found on this disk\n"
- "\n"
-@@ -87,6 +92,15 @@ inspect_mount_handle (guestfs_h *g)
- "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/0089-aarch64-appliance-Use-AAVMF-UEFI-if-available-for-ru.patch b/SOURCES/0089-aarch64-appliance-Use-AAVMF-UEFI-if-available-for-ru.patch
new file mode 100644
index 0000000..3485d97
--- /dev/null
+++ b/SOURCES/0089-aarch64-appliance-Use-AAVMF-UEFI-if-available-for-ru.patch
@@ -0,0 +1,208 @@
+From eb3c98e28ad33606f70602834e455d7e0789153e Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+Date: Wed, 21 Jan 2015 05:10:37 -0500
+Subject: [PATCH] aarch64: appliance: Use AAVMF (UEFI) if available for running
+ the appliance.
+
+AAVMF is an open source UEFI implementation for aarch64 based on OVMF.
+As aarch64 is heading for requiring UEFI even inside guests, if the
+AAVMF firmware is installed on the host, use it as a hint that we
+should boot the guest using AAVMF instead of the default "empty
+machine".
+
+Note this requires very recent AAVMF, libvirt, qemu. However that's
+OK since it's only applicable to aarch64. On non-aarch64, this patch
+does nothing.
+
+Thanks: Laszlo Ersek for a lot of help getting this right.
+(cherry picked from commit 7dc837c7be84936690f4f613fea82dba4787ceec)
+---
+ src/appliance.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++-
+ src/guestfs-internal.h | 1 +
+ src/launch-direct.c | 14 +++++++++++
+ src/launch-libvirt.c | 25 +++++++++++++++++++
+ 4 files changed, 105 insertions(+), 1 deletion(-)
+
+diff --git a/src/appliance.c b/src/appliance.c
+index d7aa6b1..5fa47f2 100644
+--- a/src/appliance.c
++++ b/src/appliance.c
+@@ -1,5 +1,5 @@
+ /* libguestfs
+- * Copyright (C) 2010-2012 Red Hat Inc.
++ * Copyright (C) 2010-2014 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+@@ -459,3 +459,67 @@ dir_contains_files (const char *dir, ...)
+ va_end (args);
+ return 1;
+ }
++
++#ifdef __aarch64__
++
++#define AAVMF_DIR "/usr/share/AAVMF"
++
++/* Return the location of firmware needed to boot the appliance. This
++ * is aarch64 only currently, since that's the only architecture where
++ * UEFI is mandatory (and that only for RHEL).
++ *
++ * '*code' is initialized with the path to the read-only UEFI code
++ * file. '*vars' is initialized with the path to a copy of the UEFI
++ * vars file (which is cleaned up automatically on exit).
++ *
++ * If *code == *vars == NULL then no UEFI firmware is available.
++ *
++ * '*code' and '*vars' should be freed by the caller.
++ *
++ * If the function returns -1 then there was a real error which should
++ * cause appliance building to fail (no UEFI firmware is not an
++ * error).
++ */
++int
++guestfs___get_uefi (guestfs_h *g, char **code, char **vars)
++{
++ if (access (AAVMF_DIR "/AAVMF_CODE.fd", R_OK) == 0 &&
++ access (AAVMF_DIR "/AAVMF_VARS.fd", R_OK) == 0) {
++ CLEANUP_CMD_CLOSE struct command *copycmd = guestfs___new_command (g);
++ char *varst;
++ int r;
++
++ /* Make a copy of AAVMF_VARS.fd. You can't just map it into the
++ * address space read-only as that triggers a different path
++ * inside UEFI.
++ */
++ varst = safe_asprintf (g, "%s/AAVMF_VARS.fd.%d", g->tmpdir, ++g->unique);
++ guestfs___cmd_add_arg (copycmd, "cp");
++ guestfs___cmd_add_arg (copycmd, AAVMF_DIR "/AAVMF_VARS.fd");
++ guestfs___cmd_add_arg (copycmd, varst);
++ r = guestfs___cmd_run (copycmd);
++ if (r == -1 || !WIFEXITED (r) || WEXITSTATUS (r) != 0) {
++ free (varst);
++ return -1;
++ }
++
++ /* Caller frees. */
++ *code = safe_strdup (g, AAVMF_DIR "/AAVMF_CODE.fd");
++ *vars = varst;
++ return 0;
++ }
++
++ *code = *vars = NULL;
++ return 0;
++}
++
++#else /* !__aarch64__ */
++
++int
++guestfs___get_uefi (guestfs_h *g, char **code, char **vars)
++{
++ *code = *vars = NULL;
++ return 0;
++}
++
++#endif /* !__aarch64__ */
+diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
+index fd0c4a1..d5de345 100644
+--- a/src/guestfs-internal.h
++++ b/src/guestfs-internal.h
+@@ -725,6 +725,7 @@ extern const char *guestfs___drive_protocol_to_string (enum drive_protocol proto
+
+ /* appliance.c */
+ extern int guestfs___build_appliance (guestfs_h *g, char **kernel, char **dtb, char **initrd, char **appliance);
++extern int guestfs___get_uefi (guestfs_h *g, char **code, char **vars);
+
+ /* launch.c */
+ extern int64_t guestfs___timeval_diff (const struct timeval *x, const struct timeval *y);
+diff --git a/src/launch-direct.c b/src/launch-direct.c
+index 5301176..2834967 100644
+--- a/src/launch-direct.c
++++ b/src/launch-direct.c
+@@ -267,6 +267,7 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
+ int sv[2];
+ char guestfsd_sock[256];
+ struct sockaddr_un addr;
++ CLEANUP_FREE char *uefi_code = NULL, *uefi_vars = NULL;
+ CLEANUP_FREE char *kernel = NULL, *dtb = NULL,
+ *initrd = NULL, *appliance = NULL;
+ int has_appliance_drive;
+@@ -474,6 +475,19 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
+ ADD_CMDLINE ("kvm-pit.lost_tick_policy=discard");
+ }
+
++ /* UEFI (firmware) if required. */
++ if (guestfs___get_uefi (g, &uefi_code, &uefi_vars) == -1)
++ goto cleanup0;
++ if (uefi_code) {
++ ADD_CMDLINE ("-drive");
++ ADD_CMDLINE_PRINTF ("if=pflash,format=raw,file=%s,readonly", uefi_code);
++ if (uefi_vars) {
++ ADD_CMDLINE ("-drive");
++ ADD_CMDLINE_PRINTF ("if=pflash,format=raw,file=%s", uefi_vars);
++ }
++ }
++
++ /* Kernel, DTB and initrd. */
+ ADD_CMDLINE ("-kernel");
+ ADD_CMDLINE (kernel);
+ if (dtb) {
+diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
+index f8f818a..e6899ac 100644
+--- a/src/launch-libvirt.c
++++ b/src/launch-libvirt.c
+@@ -109,6 +109,8 @@ struct backend_libvirt_data {
+ char name[DOMAIN_NAME_LEN]; /* random name */
+ bool is_kvm; /* false = qemu, true = kvm (from capabilities)*/
+ unsigned long qemu_version; /* qemu version (from libvirt) */
++ char *uefi_code; /* UEFI (firmware) code and variables. */
++ char *uefi_vars;
+ };
+
+ /* Parameters passed to construct_libvirt_xml and subfunctions. We
+@@ -318,6 +320,10 @@ launch_libvirt (guestfs_h *g, void *datav, const char *libvirt_uri)
+ if (parse_capabilities (g, capabilities_xml, data) == -1)
+ goto cleanup;
+
++ /* UEFI code and variables, on architectures where that is required. */
++ if (guestfs___get_uefi (g, &data->uefi_code, &data->uefi_vars) == -1)
++ goto cleanup;
++
+ /* Misc backend settings. */
+ guestfs_push_error_handler (g, NULL, NULL);
+ data->selinux_label =
+@@ -1095,6 +1101,20 @@ construct_libvirt_xml_boot (guestfs_h *g,
+ string ("hvm");
+ } end_element ();
+
++ if (params->data->uefi_code) {
++ start_element ("loader") {
++ attribute ("readonly", "yes");
++ attribute ("type", "pflash");
++ string (params->data->uefi_code);
++ } end_element ();
++
++ if (params->data->uefi_vars) {
++ start_element ("nvram") {
++ string (params->data->uefi_vars);
++ } end_element ();
++ }
++ }
++
+ start_element ("kernel") {
+ string (params->kernel);
+ } end_element ();
+@@ -1709,6 +1729,11 @@ shutdown_libvirt (guestfs_h *g, void *datav, int check_for_errors)
+ free (data->network_bridge);
+ data->network_bridge = NULL;
+
++ free (data->uefi_code);
++ data->uefi_code = NULL;
++ free (data->uefi_vars);
++ data->uefi_vars = NULL;
++
+ return ret;
+ }
+
+--
+1.8.3.1
+
diff --git a/SOURCES/0090-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch b/SOURCES/0090-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch
deleted file mode 100644
index f0762d4..0000000
--- a/SOURCES/0090-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From c126bb91d103e8e192f118cd07ec584827479e44 Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones"
-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 489a046..7956bed 100644
---- a/src/launch-unix.c
-+++ b/src/launch-unix.c
-@@ -37,6 +37,12 @@
- static int
- launch_unix (guestfs_h *g, void *datav, const char *sockpath)
- {
-+ error (g,
-+ "launch: In RHEL, only the 'libvirt' or 'direct' 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;
-@@ -102,6 +108,7 @@ launch_unix (guestfs_h *g, void *datav, const char *sockpath)
- g->conn = NULL;
- }
- return -1;
-+#endif
- }
-
- static int
---
-1.8.3.1
-
diff --git a/SOURCES/0090-aarch64-launch-libvirt-As-a-workaround-pass-cpu-para.patch b/SOURCES/0090-aarch64-launch-libvirt-As-a-workaround-pass-cpu-para.patch
new file mode 100644
index 0000000..a98c75d
--- /dev/null
+++ b/SOURCES/0090-aarch64-launch-libvirt-As-a-workaround-pass-cpu-para.patch
@@ -0,0 +1,71 @@
+From 240cd5f90c83bcd0441d8ea079c3e5f6508d1202 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+Date: Wed, 21 Jan 2015 05:37:56 -0500
+Subject: [PATCH] aarch64: launch: libvirt: As a workaround, pass -cpu
+ parameter to qemu.
+
+When libguestfs is running using TCG on aarch64, we need to pass the
+-cpu cortex-a57 parameter to qemu. Libvirt doesn't let us do this,
+complaining "Unable to find CPU definition".
+
+As a temporary workaround only, use to pass this
+argument directly to qemu. When libvirt is fixed we can remove this
+hack.
+
+This is a workaround for libvirt bug RHBZ#1184411.
+
+See:
+https://www.redhat.com/archives/libvirt-users/2014-August/msg00043.html
+https://bugzilla.redhat.com/show_bug.cgi?id=1184411
+(cherry picked from commit 7e4b7a346a4558a02aeb58f82d518509ce6e5d03)
+---
+ src/launch-libvirt.c | 21 ++++++++++++++++++++-
+ 1 file changed, 20 insertions(+), 1 deletion(-)
+
+diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
+index e6899ac..79bc6fd 100644
+--- a/src/launch-libvirt.c
++++ b/src/launch-libvirt.c
+@@ -1035,12 +1035,16 @@ construct_libvirt_xml_cpu (guestfs_h *g,
+ } end_element ();
+ }
+ else {
+- /* XXX This does not work, see:
++ /* XXX This does not work on aarch64, see:
+ * https://www.redhat.com/archives/libvirt-users/2014-August/msg00043.html
++ * https://bugzilla.redhat.com/show_bug.cgi?id=1184411
++ * Instead we hack around it using below.
+ */
++#ifndef __aarch64__
+ start_element ("model") {
+ string (cpu_model);
+ } end_element ();
++#endif
+ }
+ } end_element ();
+ }
+@@ -1670,6 +1674,21 @@ construct_libvirt_xml_qemu_cmdline (guestfs_h *g,
+ }
+ }
+
++#ifdef __aarch64__
++ /* This is a temporary hack until RHBZ#1184411 is resolved.
++ * See comments above about cpu model and aarch64.
++ */
++ const char *cpu_model = guestfs___get_cpu_model (params->data->is_kvm);
++ if (STRNEQ (cpu_model, "host")) {
++ start_element ("qemu:arg") {
++ attribute ("value", "-cpu");
++ } end_element ();
++ start_element ("qemu:arg") {
++ attribute ("value", cpu_model);
++ } end_element ();
++ }
++#endif
++
+ } end_element (); /* */
+
+ return 0;
+--
+1.8.3.1
+
diff --git a/SOURCES/0091-RHEL-7-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch b/SOURCES/0091-RHEL-7-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch
deleted file mode 100644
index 4afc84b..0000000
--- a/SOURCES/0091-RHEL-7-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch
+++ /dev/null
@@ -1,346 +0,0 @@
-From 2d902f917506177885481b17172ef7e297300a74 Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones"
-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 | 223 ---------------------------------------------------
- daemon/Makefile.am | 1 -
- generator/actions.ml | 23 ------
- gobject/Makefile.inc | 2 -
- po/POTFILES | 2 -
- 6 files changed, 1 insertion(+), 252 deletions(-)
- delete mode 100644 daemon/9p.c
-
-diff --git a/Makefile.am b/Makefile.am
-index d55d8d6..207bcb1 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -59,7 +59,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 fefbb71..0000000
---- a/daemon/9p.c
-+++ /dev/null
-@@ -1,223 +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
--
--#include
--#include
--#include
--#include
--#include
--#include
--#include
--#include
--#include
--#include
--
--#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) {
-- struct dirent *d;
--
-- errno = 0;
-- 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 8ccf322..ec6fc6f 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 593e51b..20e9774 100644
---- a/generator/actions.ml
-+++ b/generator/actions.ml
-@@ -9150,29 +9150,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 on the
--directory C.
--
--If required, C will be automatically added to the options.
--Any other options required can be passed in the optional C
--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 c93dace..f2152f2 100644
---- a/gobject/Makefile.inc
-+++ b/gobject/Makefile.inc
-@@ -78,7 +78,6 @@ guestfs_gobject_headers= \
- include/guestfs-gobject/optargs-mkfs_btrfs.h \
- include/guestfs-gobject/optargs-mkswap.h \
- include/guestfs-gobject/optargs-mktemp.h \
-- include/guestfs-gobject/optargs-mount_9p.h \
- include/guestfs-gobject/optargs-mount_local.h \
- include/guestfs-gobject/optargs-ntfsclone_out.h \
- include/guestfs-gobject/optargs-ntfsfix.h \
-@@ -156,7 +155,6 @@ guestfs_gobject_sources= \
- src/optargs-mkfs_btrfs.c \
- src/optargs-mkswap.c \
- src/optargs-mktemp.c \
-- src/optargs-mount_9p.c \
- src/optargs-mount_local.c \
- src/optargs-ntfsclone_out.c \
- src/optargs-ntfsfix.c \
-diff --git a/po/POTFILES b/po/POTFILES
-index 1a088f5..7f3365c 100644
---- a/po/POTFILES
-+++ b/po/POTFILES
-@@ -14,7 +14,6 @@ cat/ls.c
- cat/visit.c
- customize/crypt-c.c
- customize/perl_edit-c.c
--daemon/9p.c
- daemon/acl.c
- daemon/augeas.c
- daemon/available.c
-@@ -203,7 +202,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/0091-aarch64-Increase-default-appliance-memory-size-on-aa.patch b/SOURCES/0091-aarch64-Increase-default-appliance-memory-size-on-aa.patch
new file mode 100644
index 0000000..cfe6713
--- /dev/null
+++ b/SOURCES/0091-aarch64-Increase-default-appliance-memory-size-on-aa.patch
@@ -0,0 +1,41 @@
+From 28ca86d12286aad430378cbf416c966cdfddfbdf Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+Date: Sat, 24 Jan 2015 15:40:05 +0000
+Subject: [PATCH] aarch64: Increase default appliance memory size on aarch64.
+
+Kernel 3.19 has problems uncompressing the RAM disk with <= 500 MB.
+(This is likely to be a kernel bug)
+
+64 KB pages are common on aarch64, so treat this case the same as ppc,
+and use a larger default appliance memory size.
+
+Thanks: Laszlo Ersek for help and reproducing the bug.
+(cherry picked from commit c24f242521e882380c28d0952007d8462040d998)
+---
+ src/guestfs-internal.h | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
+index d5de345..d9ccf5f 100644
+--- a/src/guestfs-internal.h
++++ b/src/guestfs-internal.h
+@@ -68,6 +68,16 @@
+ # define MIN_MEMSIZE 256
+ #endif
+
++/* Kernel 3.19 is unable to uncompress the initramfs on aarch64 unless
++ * we have > 500 MB of space. This looks like a kernel bug (earlier
++ * kernels have no problems). However since 64 KB pages are also
++ * common on aarch64, treat this like the ppc case above.
++ */
++#ifdef __aarch64__
++# define DEFAULT_MEMSIZE 768
++# define MIN_MEMSIZE 256
++#endif
++
+ /* Valgrind has a fairly hefty memory overhead. Using the defaults
+ * caused the C API tests to fail.
+ */
+--
+1.8.3.1
+
diff --git a/SOURCES/0092-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch b/SOURCES/0092-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch
deleted file mode 100644
index 4ea09c8..0000000
--- a/SOURCES/0092-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch
+++ /dev/null
@@ -1,615 +0,0 @@
-From b8877c3a02da7eeef62690f7f829be80c5502241 Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones"
-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 | 69 -------------------
- fish/test-add-uri.sh | 31 ---------
- generator/actions.ml | 72 --------------------
- src/drives.c | 8 +++
- src/guestfs.pod | 121 ---------------------------------
- tests/disks/test-qemu-drive-libvirt.sh | 40 -----------
- tests/disks/test-qemu-drive.sh | 70 -------------------
- 7 files changed, 8 insertions(+), 403 deletions(-)
-
-diff --git a/fish/guestfish.pod b/fish/guestfish.pod
-index 12bf243..d95cd77 100644
---- a/fish/guestfish.pod
-+++ b/fish/guestfish.pod
-@@ -1140,40 +1140,6 @@ The possible I<-a URI> formats are described below.
-
- Add the local disk image (or device) called C.
-
--=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:
--
-- > add /disk.img protocol:(ftp|...) server:tcp:example.com
--
--=head2 B<-a gluster://example.com[:port]/volname/image>
--
--Add a disk image located on GlusterFS storage.
--
--The server is the one running C, and may be C.
--
--The equivalent API command would be:
--
-- > add volname/image protocol:gluster server:tcp:example.com
--
--=head2 B<-a iscsi://example.com[:port]/target-iqn-name[/lun]>
--
--Add a disk located on an iSCSI server.
--
--The equivalent API command would be:
--
-- > 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>
-@@ -1195,41 +1161,6 @@ The equivalent API command would be (no export name):
-
- > add "" protocol:nbd server:[tcp:example.com|unix:/socket]
-
--=head2 B<-a rbd:///pool/disk>
--
--=head2 B<-a rbd://example.com[:port]/pool/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:
--
-- > add pool/disk protocol:rbd server:tcp:example.com:port
--
--=head2 B<-a sheepdog://[example.com[:port]]/volume/image>
--
--Add a disk image located on a Sheepdog volume.
--
--The server name is optional. Although libguestfs and Sheepdog
--supports multiple servers, only at most one server can be specified
--when using this URI syntax.
--
--The equivalent API command would be:
--
-- > add volume protocol:sheepdog [server:tcp:example.com]
--
--=head2 B<-a ssh://[user@]example.com[:port]/disk.img>
--
--Add a disk image located on a remote server, accessed using the Secure
--Shell (ssh) SFTP protocol. SFTP is supported out of the box by all
--major SSH servers.
--
--The equivalent API command would be:
--
-- > 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 2f83754..5ace327 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 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 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 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 test-add-uri.out 2>&1
- grep -sq 'add_drive "" "protocol:nbd" "server:tcp:example.com"' test-add-uri.out || fail
-@@ -58,28 +50,5 @@ grep -sq 'add_drive "" "protocol:nbd" "server:unix:/sk"' test-add-uri.out || fai
- $VG guestfish -x -a 'nbd:///export?socket=/sk' 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:6789/pool/disk test-add-uri.out 2>&1
--grep -sq 'add_drive "pool/disk" "protocol:rbd" "server:tcp:example.com:6789"' test-add-uri.out || fail
--$VG guestfish -x -a rbd:///pool/disk test-add-uri.out 2>&1
--grep -sq 'add_drive "pool/disk" "protocol:rbd"' test-add-uri.out || fail
--
--# sheepdog
--$VG guestfish -x -a sheepdog:///volume/image 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 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 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 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 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 20e9774..88405d0 100644
---- a/generator/actions.ml
-+++ b/generator/actions.ml
-@@ -1397,27 +1397,6 @@ C is interpreted as a local file or device.
- This is the default if the optional protocol parameter
- is omitted.
-
--=item C
--
--Connect to a remote FTP, HTTP or TFTP server.
--The C parameter must also be supplied - see below.
--
--See also: L
--
--=item C
--
--Connect to the GlusterFS server.
--The C parameter must also be supplied - see below.
--
--See also: L
--
--=item C
--
--Connect to the iSCSI server.
--The C parameter must also be supplied - see below.
--
--See also: L.
--
- =item C
-
- Connect to the Network Block Device server.
-@@ -1425,31 +1404,6 @@ The C parameter must also be supplied - see below.
-
- See also: L.
-
--=item C
--
--Connect to the Ceph (librbd/RBD) server.
--The C parameter must also be supplied - see below.
--The C parameter may be supplied. See below.
--The C parameter may be supplied. See below.
--
--See also: L.
--
--=item C
--
--Connect to the Sheepdog server.
--The C parameter may also be supplied - see below.
--
--See also: L.
--
--=item C
--
--Connect to the Secure Shell (ssh) server.
--
--The C parameter must be supplied.
--The C parameter may be supplied. See below.
--
--See also: L.
--
- =back
-
- =item C
-@@ -1460,13 +1414,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 Zero or more
-- sheepdog Zero or more
-- ssh Exactly one
-
- Each list element is a string specifying a server. The string must be
- in one of the following formats:
-@@ -1480,26 +1428,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).
-
--=item C
--
--For the C, C, C, C, C, C, C
--and C protocols, this specifies the remote username.
--
--If not given, then the local username is used for C, 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. If in doubt,
--specify the remote username you want.
--
--=item C
--
--For the C 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
-
- Choose whether or not libguestfs will obey sync operations (safe but slow)
-diff --git a/src/drives.c b/src/drives.c
-index 307f267..b80af78 100644
---- a/src/drives.c
-+++ b/src/drives.c
-@@ -199,6 +199,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,
- const struct drive_create_data *data)
-@@ -257,6 +258,7 @@ create_drive_gluster (guestfs_h *g,
-
- return create_drive_non_file (g, data);
- }
-+#endif /* DISABLED IN RHEL 7 */
-
- static int
- nbd_port (void)
-@@ -294,6 +296,7 @@ create_drive_nbd (guestfs_h *g,
- return create_drive_non_file (g, data);
- }
-
-+#if 0 /* DISABLED IN RHEL 7 */
- static struct drive *
- create_drive_rbd (guestfs_h *g,
- const struct drive_create_data *data)
-@@ -435,6 +438,7 @@ create_drive_iscsi (guestfs_h *g,
-
- return create_drive_non_file (g, data);
- }
-+#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
-@@ -882,6 +886,7 @@ guestfs__add_drive_opts (guestfs_h *g, const char *filename,
- drv = create_drive_file (g, &data);
- }
- }
-+#if 0 /* DISABLED IN RHEL 7 */
- else if (STREQ (protocol, "ftp")) {
- data.protocol = drive_protocol_ftp;
- drv = create_drive_curl (g, &data);
-@@ -906,10 +911,12 @@ guestfs__add_drive_opts (guestfs_h *g, const char *filename,
- data.protocol = drive_protocol_iscsi;
- drv = create_drive_iscsi (g, &data);
- }
-+#endif /* DISABLED IN RHEL 7 */
- else if (STREQ (protocol, "nbd")) {
- data.protocol = drive_protocol_nbd;
- drv = create_drive_nbd (g, &data);
- }
-+#if 0 /* DISABLED IN RHEL 7 */
- else if (STREQ (protocol, "rbd")) {
- data.protocol = drive_protocol_rbd;
- drv = create_drive_rbd (g, &data);
-@@ -926,6 +933,7 @@ guestfs__add_drive_opts (guestfs_h *g, const char *filename,
- data.protocol = drive_protocol_tftp;
- drv = create_drive_curl (g, &data);
- }
-+#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 c9ac1fa..5792f15 100644
---- a/src/guestfs.pod
-+++ b/src/guestfs.pod
-@@ -674,91 +674,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 and C parameters of
--L 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 (the C parameter) is a list of one or more Ceph
--servers. The server string is documented in
--L. The C and C 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 and C parameters of
--L 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 can be one of C<"ftp">, C<"ftps">, C<"http">,
--C<"https"> or C<"tftp">.
--
--C (the C 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.
--
--=head3 GLUSTER
--
--Libguestfs can access Gluster disks.
--
--To do this, set the optional C and C parameters of
--L 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 (the C 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.
--
--Note that gluster usually requires the client process (ie. libguestfs)
--to run as B 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 and C 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 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.
--
- =head3 NETWORK BLOCK DEVICE
-
- Libguestfs can access Network Block Device (NBD) disks remotely.
-@@ -821,42 +736,6 @@ L
-
- =back
-
--=head3 SHEEPDOG
--
--Libguestfs can access Sheepdog disks.
--
--To do this, set the optional C and C parameters of
--L 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 may be zero or more server addresses
--(C<"hostname:port">). The format of the server strings is documented
--in L.
--
--=head3 SSH
--
--Libguestfs can access disks over a Secure Shell (SSH) connection.
--
--To do this, set the C and C and (optionally)
--C parameters of L 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.
--
- =head2 INSPECTION
-
- Libguestfs has APIs for inspecting an unknown disk image to find out
-diff --git a/tests/disks/test-qemu-drive-libvirt.sh b/tests/disks/test-qemu-drive-libvirt.sh
-index 9930865..31d4838 100755
---- a/tests/disks/test-qemu-drive-libvirt.sh
-+++ b/tests/disks/test-qemu-drive-libvirt.sh
-@@ -64,46 +64,6 @@ function fail ()
-
- rm -f "$DEBUG_QEMU_FILE"
-
--# Ceph (RBD).
--
--$guestfish -d ceph1 run ||:
--check_output
--grep -sq -- '-drive file=rbd:abc-def/ghi-jkl:mon_host=1.2.3.4\\:1234\\;1.2.3.5\\:1235\\;1.2.3.6\\:1236:auth_supported=none,' "$DEBUG_QEMU_FILE" || fail
--rm "$DEBUG_QEMU_FILE"
--
--$guestfish -d ceph2 run ||:
--check_output
--grep -sq -- '-drive file=rbd:abc-def/ghi-jkl:auth_supported=none,' "$DEBUG_QEMU_FILE" || fail
--rm "$DEBUG_QEMU_FILE"
--
--# Gluster.
--
--$guestfish -d gluster run ||:
--check_output
--grep -sq -- '-drive file=gluster://1.2.3.4:1234/volname/image,' "$DEBUG_QEMU_FILE" || fail
--rm "$DEBUG_QEMU_FILE"
--
--# iSCSI.
--
--$guestfish -d iscsi run ||:
--check_output
--grep -sq -- '-drive file=iscsi://1.2.3.4:1234/iqn.2003-01.org.linux-iscsi.fedora,' "$DEBUG_QEMU_FILE" || fail
--rm "$DEBUG_QEMU_FILE"
--
--# NBD.
--
--$guestfish -d nbd run ||:
--check_output
--grep -sq -- '-drive file=nbd:1.2.3.4:1234,' "$DEBUG_QEMU_FILE" || fail
--rm "$DEBUG_QEMU_FILE"
--
--# Sheepdog.
--
--$guestfish -d sheepdog run ||:
--check_output
--grep -sq -- '-drive file=sheepdog:volume,' "$DEBUG_QEMU_FILE" || fail
--rm "$DEBUG_QEMU_FILE"
--
- # To do:
-
- # HTTP - curl not yet supported by libvirt
-diff --git a/tests/disks/test-qemu-drive.sh b/tests/disks/test-qemu-drive.sh
-index b530e7d..f4e718a 100755
---- a/tests/disks/test-qemu-drive.sh
-+++ b/tests/disks/test-qemu-drive.sh
-@@ -42,55 +42,6 @@ function fail ()
-
- rm -f "$DEBUG_QEMU_FILE"
-
--# Ceph (RBD).
--
--guestfish <
+Date: Tue, 9 Dec 2014 14:06:18 +0000
+Subject: [PATCH] inspection: Not an installer if there are multiple partitions
+ (RHBZ#1171666).
+
+Regular EFI disks have /EFI on the first (VFAT) partition, but they
+are not installers.
+
+Fix this by only considering something to be an installer if it has a
+single partition (or whole disks like ISOs).
+
+Implementing this is quite complex since when checking a filesystem,
+we don't have information about whether we are even looking at a
+partition, nor about whether it's the first partition out of how many.
+The majority of the commit is changing the code to collect that
+information.
+
+(cherry picked from commit bdf772db3286487adefa56b966435f2dd638e0a8)
+---
+ src/guestfs-internal.h | 1 +
+ src/inspect-fs-unix.c | 31 ++++---------------------------
+ src/inspect-fs.c | 44 ++++++++++++++++++++++++++++++++++++++------
+ src/inspect.c | 22 ++++++++++++++++++++++
+ 4 files changed, 65 insertions(+), 33 deletions(-)
+
+diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
+index d9ccf5f..65f3388 100644
+--- a/src/guestfs-internal.h
++++ b/src/guestfs-internal.h
+@@ -751,6 +751,7 @@ extern int guestfs___set_backend (guestfs_h *g, const char *method);
+ extern void guestfs___free_inspect_info (guestfs_h *g);
+ extern char *guestfs___download_to_tmp (guestfs_h *g, struct inspect_fs *fs, const char *filename, const char *basename, uint64_t max_size);
+ extern struct inspect_fs *guestfs___search_for_root (guestfs_h *g, const char *root);
++extern int guestfs___is_partition (guestfs_h *g, const char *partition);
+
+ /* inspect-fs.c */
+ extern int guestfs___is_file_nocase (guestfs_h *g, const char *);
+diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
+index fb5cc1a..8778e92 100644
+--- a/src/inspect-fs-unix.c
++++ b/src/inspect-fs-unix.c
+@@ -185,7 +185,6 @@ static int add_fstab_entry (guestfs_h *g, struct inspect_fs *fs,
+ static char *resolve_fstab_device (guestfs_h *g, const char *spec,
+ Hash_table *md_map);
+ static int inspect_with_augeas (guestfs_h *g, struct inspect_fs *fs, const char **configfiles, int (*f) (guestfs_h *, struct inspect_fs *));
+-static int is_partition (guestfs_h *g, const char *partition);
+
+ /* Hash structure for uuid->path lookups */
+ typedef struct md_uuid {
+@@ -1436,7 +1435,7 @@ resolve_fstab_device_xdev (guestfs_h *g, const char *type, const char *disk,
+ ITER_DRIVES (g, i, drv) {
+ if (drv->name && STREQ (drv->name, name)) {
+ device = safe_asprintf (g, "%s%s", devices[i], part);
+- if (!is_partition (g, device)) {
++ if (!guestfs___is_partition (g, device)) {
+ free (device);
+ return 0;
+ }
+@@ -1463,7 +1462,7 @@ resolve_fstab_device_xdev (guestfs_h *g, const char *type, const char *disk,
+ */
+ if (i < count) {
+ device = safe_asprintf (g, "%s%s", devices[i], part);
+- if (!is_partition (g, device)) {
++ if (!guestfs___is_partition (g, device)) {
+ free (device);
+ return 0;
+ }
+@@ -1496,7 +1495,7 @@ resolve_fstab_device_cciss (guestfs_h *g, const char *disk, const char *part,
+ if (drv->name && STREQ (drv->name, disk)) {
+ if (part) {
+ device = safe_asprintf (g, "%s%s", devices[i], part);
+- if (!is_partition (g, device)) {
++ if (!guestfs___is_partition (g, device)) {
+ free (device);
+ return 0;
+ }
+@@ -1541,7 +1540,7 @@ resolve_fstab_device_diskbyid (guestfs_h *g, const char *part,
+
+ /* Make the partition name and check it exists. */
+ device = safe_asprintf (g, "/dev/sda%s", part);
+- if (!is_partition (g, device)) {
++ if (!guestfs___is_partition (g, device)) {
+ free (device);
+ return 0;
+ }
+@@ -1753,25 +1752,3 @@ make_augeas_path_expression (guestfs_h *g, const char **configfiles)
+ debug (g, "augeas pathexpr = %s", ret);
+ return ret;
+ }
+-
+-static int
+-is_partition (guestfs_h *g, const char *partition)
+-{
+- CLEANUP_FREE char *device = NULL;
+-
+- guestfs_push_error_handler (g, NULL, NULL);
+-
+- if ((device = guestfs_part_to_dev (g, partition)) == NULL) {
+- guestfs_pop_error_handler (g);
+- return 0;
+- }
+-
+- if (guestfs_device_index (g, device) == -1) {
+- guestfs_pop_error_handler (g);
+- return 0;
+- }
+-
+- guestfs_pop_error_handler (g);
+-
+- return 1;
+-}
+diff --git a/src/inspect-fs.c b/src/inspect-fs.c
+index 539d814..686d1ae 100644
+--- a/src/inspect-fs.c
++++ b/src/inspect-fs.c
+@@ -83,6 +83,7 @@ static int check_filesystem (guestfs_h *g, const char *mountable,
+ const struct guestfs_internal_mountable *m,
+ int whole_device);
+ static int extend_fses (guestfs_h *g);
++static int get_partition_context (guestfs_h *g, const char *partition, int *partnum_ret, int *nr_partitions_ret);
+
+ /* Find out if 'device' contains a filesystem. If it does, add
+ * another entry in g->fses.
+@@ -175,17 +176,18 @@ check_filesystem (guestfs_h *g, const char *mountable,
+ const struct guestfs_internal_mountable *m,
+ int whole_device)
+ {
++ int partnum = -1, nr_partitions = -1;
+ /* Not CLEANUP_FREE, as it will be cleaned up with inspection info */
+ char *windows_systemroot = NULL;
+
+ if (extend_fses (g) == -1)
+ return -1;
+
+- int partnum = -1;
+- if (!whole_device && m->im_type == MOUNTABLE_DEVICE) {
+- guestfs_push_error_handler (g, NULL, NULL);
+- partnum = guestfs_part_to_partnum (g, m->im_device);
+- guestfs_pop_error_handler (g);
++ if (!whole_device && m->im_type == MOUNTABLE_DEVICE &&
++ guestfs___is_partition (g, m->im_device)) {
++ if (get_partition_context (g, m->im_device,
++ &partnum, &nr_partitions) == -1)
++ return -1;
+ }
+
+ struct inspect_fs *fs = &g->fses[g->nr_fses-1];
+@@ -324,7 +326,7 @@ check_filesystem (guestfs_h *g, const char *mountable,
+ * Skip these checks if it's not a whole device (eg. CD) or the
+ * first partition (eg. bootable USB key).
+ */
+- else if ((whole_device || partnum == 1) &&
++ else if ((whole_device || (partnum == 1 && nr_partitions == 1)) &&
+ (guestfs_is_file (g, "/isolinux/isolinux.cfg") > 0 ||
+ guestfs_is_dir (g, "/EFI/BOOT") > 0 ||
+ guestfs_is_file (g, "/images/install.img") > 0 ||
+@@ -369,6 +371,36 @@ extend_fses (guestfs_h *g)
+ return 0;
+ }
+
++/* Given a partition (eg. /dev/sda2) then return the partition number
++ * (eg. 2) and the total number of other partitions.
++ */
++static int
++get_partition_context (guestfs_h *g, const char *partition,
++ int *partnum_ret, int *nr_partitions_ret)
++{
++ int partnum, nr_partitions;
++ CLEANUP_FREE char *device = NULL;
++ CLEANUP_FREE_PARTITION_LIST struct guestfs_partition_list *partitions = NULL;
++
++ partnum = guestfs_part_to_partnum (g, partition);
++ if (partnum == -1)
++ return -1;
++
++ device = guestfs_part_to_dev (g, partition);
++ if (device == NULL)
++ return -1;
++
++ partitions = guestfs_part_list (g, device);
++ if (partitions == NULL)
++ return -1;
++
++ nr_partitions = partitions->len;
++
++ *partnum_ret = partnum;
++ *nr_partitions_ret = nr_partitions;
++ return 0;
++}
++
+ int
+ guestfs___is_file_nocase (guestfs_h *g, const char *path)
+ {
+diff --git a/src/inspect.c b/src/inspect.c
+index 9248b06..03d870f 100644
+--- a/src/inspect.c
++++ b/src/inspect.c
+@@ -590,3 +590,25 @@ guestfs___search_for_root (guestfs_h *g, const char *root)
+ root);
+ return NULL;
+ }
++
++int
++guestfs___is_partition (guestfs_h *g, const char *partition)
++{
++ CLEANUP_FREE char *device = NULL;
++
++ guestfs_push_error_handler (g, NULL, NULL);
++
++ if ((device = guestfs_part_to_dev (g, partition)) == NULL) {
++ guestfs_pop_error_handler (g);
++ return 0;
++ }
++
++ if (guestfs_device_index (g, device) == -1) {
++ guestfs_pop_error_handler (g);
++ return 0;
++ }
++
++ guestfs_pop_error_handler (g);
++
++ return 1;
++}
+--
+1.8.3.1
+
diff --git a/SOURCES/0093-RHEL-7-Remove-User-Mode-Linux-RHBZ-1144197.patch b/SOURCES/0093-RHEL-7-Remove-User-Mode-Linux-RHBZ-1144197.patch
deleted file mode 100644
index 9092e5d..0000000
--- a/SOURCES/0093-RHEL-7-Remove-User-Mode-Linux-RHBZ-1144197.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 30c0036372d20d065579ce2a1148fd526320fc89 Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones"
-Date: Fri, 19 Sep 2014 13:38:20 +0100
-Subject: [PATCH] RHEL 7: Remove User-Mode Linux (RHBZ#1144197).
-
-This isn't supported in RHEL 7.
----
- src/launch-uml.c | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/src/launch-uml.c b/src/launch-uml.c
-index 21525e3..b631389 100644
---- a/src/launch-uml.c
-+++ b/src/launch-uml.c
-@@ -136,6 +136,12 @@ uml_supported (guestfs_h *g)
- static int
- launch_uml (guestfs_h *g, void *datav, const char *arg)
- {
-+ error (g,
-+ "launch: In RHEL, only the 'libvirt' or 'direct' method is supported.\n"
-+ "In particular, User-Mode Linux (UML) is not supported.");
-+ return -1;
-+
-+#if 0
- struct backend_uml_data *data = datav;
- CLEANUP_FREE_STRINGSBUF DECLARE_STRINGSBUF (cmdline);
- int console_sock = -1, daemon_sock = -1;
-@@ -503,6 +509,7 @@ launch_uml (guestfs_h *g, void *datav, const char *arg)
- }
- g->state = CONFIG;
- return -1;
-+#endif
- }
-
- /* This is called from the forked subprocess just before vmlinux runs,
---
-1.8.3.1
-
diff --git a/SOURCES/0093-daemon-Fix-whitespace.patch b/SOURCES/0093-daemon-Fix-whitespace.patch
new file mode 100644
index 0000000..1f20159
--- /dev/null
+++ b/SOURCES/0093-daemon-Fix-whitespace.patch
@@ -0,0 +1,26 @@
+From db9bfb914f0510baadea3752b3b0faee6d1ce46a Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+Date: Thu, 5 Feb 2015 08:01:48 +0000
+Subject: [PATCH] daemon: Fix whitespace.
+
+(cherry picked from commit b3e3750b13a96fb6d1b79f7c0dabb4eeb37de5ef)
+---
+ daemon/parted.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/daemon/parted.c b/daemon/parted.c
+index a730477..76c0ce9 100644
+--- a/daemon/parted.c
++++ b/daemon/parted.c
+@@ -759,7 +759,7 @@ optgroup_gdisk_available (void)
+ }
+
+ int
+-do_part_set_gpt_type(const char *device, int partnum, const char *guid)
++do_part_set_gpt_type (const char *device, int partnum, const char *guid)
+ {
+ if (partnum <= 0) {
+ reply_with_error ("partition number must be >= 1");
+--
+1.8.3.1
+
diff --git a/SOURCES/0094-New-APIs-part-set-gpt-guid-and-part-get-gpt-guid.patch b/SOURCES/0094-New-APIs-part-set-gpt-guid-and-part-get-gpt-guid.patch
new file mode 100644
index 0000000..37bba84
--- /dev/null
+++ b/SOURCES/0094-New-APIs-part-set-gpt-guid-and-part-get-gpt-guid.patch
@@ -0,0 +1,126 @@
+From 3aab860529f7d13b00b3689fa79c72b12d2f9770 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+Date: Thu, 5 Feb 2015 08:08:06 +0000
+Subject: [PATCH] New APIs: part-set-gpt-guid and part-get-gpt-guid
+
+In GPT, each partition has a GUID assigned randomly. Allow this GUID
+to be written and read.
+
+Note this is different from the GUID type code which is used to
+identify the type of the partition.
+
+(cherry picked from commit 40c133b2c81666f6dde43704e66bf59206d5c111)
+---
+ daemon/parted.c | 33 +++++++++++++++++++++++++++++++++
+ generator/actions.ml | 36 ++++++++++++++++++++++++++++++++++++
+ src/MAX_PROC_NR | 2 +-
+ 3 files changed, 70 insertions(+), 1 deletion(-)
+
+diff --git a/daemon/parted.c b/daemon/parted.c
+index 76c0ce9..36844b8 100644
+--- a/daemon/parted.c
++++ b/daemon/parted.c
+@@ -784,6 +784,32 @@ do_part_set_gpt_type (const char *device, int partnum, const char *guid)
+ return 0;
+ }
+
++int
++do_part_set_gpt_guid (const char *device, int partnum, const char *guid)
++{
++ if (partnum <= 0) {
++ reply_with_error ("partition number must be >= 1");
++ return -1;
++ }
++
++ CLEANUP_FREE char *typecode = NULL;
++ if (asprintf (&typecode, "%i:%s", partnum, guid) == -1) {
++ reply_with_perror ("asprintf");
++ return -1;
++ }
++
++ CLEANUP_FREE char *err = NULL;
++ int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
++ str_sgdisk, device, "-u", typecode, NULL);
++
++ if (r == -1) {
++ reply_with_error ("%s %s -u %s: %s", str_sgdisk, device, typecode, err);
++ return -1;
++ }
++
++ return 0;
++}
++
+ static char *
+ sgdisk_info_extract_field (const char *device, int partnum, const char *field,
+ char *(*extract) (const char *path))
+@@ -894,6 +920,13 @@ do_part_get_gpt_type (const char *device, int partnum)
+ }
+
+ char *
++do_part_get_gpt_guid (const char *device, int partnum)
++{
++ return sgdisk_info_extract_field (device, partnum,
++ "Partition unique GUID", extract_uuid);
++}
++
++char *
+ do_part_get_name (const char *device, int partnum)
+ {
+ CLEANUP_FREE char *parttype;
+diff --git a/generator/actions.ml b/generator/actions.ml
+index 593e51b..825acf9 100644
+--- a/generator/actions.ml
++++ b/generator/actions.ml
+@@ -11995,6 +11995,42 @@ This is the same as the C system call." };
+ longdesc = "\
+ This is the internal call which implements C." };
+
++ { defaults with
++ name = "part_set_gpt_guid";
++ style = RErr, [Device "device"; Int "partnum"; GUID "guid"], [];
++ proc_nr = Some 446;
++ optional = Some "gdisk";
++ tests = [
++ InitGPT, Always, TestLastFail (
++ [["part_set_gpt_guid"; "/dev/sda"; "1"; "f"]]), [];
++ InitGPT, Always, TestResultString (
++ [["part_set_gpt_guid"; "/dev/sda"; "1";
++ "01234567-89AB-CDEF-0123-456789ABCDEF"];
++ ["part_get_gpt_guid"; "/dev/sda"; "1"]],
++ "01234567-89AB-CDEF-0123-456789ABCDEF"), [];
++ ];
++ shortdesc = "set the GUID of a GPT partition";
++ longdesc = "\
++Set the GUID of numbered GPT partition C to C. Return an
++error if the partition table of C isn't GPT, or if C is not a
++valid GUID." };
++
++ { defaults with
++ name = "part_get_gpt_guid";
++ style = RString "guid", [Device "device"; Int "partnum"], [];
++ proc_nr = Some 447;
++ optional = Some "gdisk";
++ tests = [
++ InitGPT, Always, TestResultString (
++ [["part_set_gpt_guid"; "/dev/sda"; "1";
++ "01234567-89AB-CDEF-0123-456789ABCDEF"];
++ ["part_get_gpt_guid"; "/dev/sda"; "1"]],
++ "01234567-89AB-CDEF-0123-456789ABCDEF"), [];
++ ];
++ shortdesc = "get the GUID of a GPT partition";
++ longdesc = "\
++Return the GUID of numbered GPT partition C." };
++
+ ]
+
+ (* Non-API meta-commands available only in guestfish.
+diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR
+index 5721413..e9b7520 100644
+--- a/src/MAX_PROC_NR
++++ b/src/MAX_PROC_NR
+@@ -1 +1 @@
+-423
++447
+--
+1.8.3.1
+
diff --git a/SOURCES/0094-RHEL-7-v2v-Select-correct-qemu-binary-for-o-qemu-mod.patch b/SOURCES/0094-RHEL-7-v2v-Select-correct-qemu-binary-for-o-qemu-mod.patch
deleted file mode 100644
index 8c3e970..0000000
--- a/SOURCES/0094-RHEL-7-v2v-Select-correct-qemu-binary-for-o-qemu-mod.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From f69232041b0fa3e35ca62aa5d09ad35af517af06 Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones"
-Date: Sun, 28 Sep 2014 19:14:43 +0100
-Subject: [PATCH] RHEL 7: v2v: Select correct qemu binary for -o qemu mode
- (RHBZ#1147313).
-
-RHEL 7 does not have qemu-system-x86_64 (etc), and in addition the
-qemu binary is located in /usr/libexec. Encode the path to this
-binary directly in the script.
-
-Note that we don't support people running qemu directly like this.
-It's just for quick testing of converted VMs, and to help us with
-support cases.
----
- v2v/output_qemu.ml | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/v2v/output_qemu.ml b/v2v/output_qemu.ml
-index 75644c2..9c17121 100644
---- a/v2v/output_qemu.ml
-+++ b/v2v/output_qemu.ml
-@@ -48,7 +48,7 @@ object
- let nl = " \\\n\t" in
- fpf "#!/bin/sh -\n";
- fpf "\n";
-- fpf "qemu-system-%s" guestcaps.gcaps_arch;
-+ fpf "/usr/libexec/qemu-kvm";
- fpf "%s-no-user-config -nodefaults" nl;
- fpf "%s-name %s" nl (quote source.s_name);
- fpf "%s-machine accel=kvm:tcg" nl;
---
-1.8.3.1
-
diff --git a/SOURCES/0095-RHEL-7-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch b/SOURCES/0095-RHEL-7-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch
deleted file mode 100644
index 03b076a..0000000
--- a/SOURCES/0095-RHEL-7-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-From 508fe3be891f0967577bdf6621564443f3c2309c Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones"
-Date: Tue, 30 Sep 2014 10:50:27 +0100
-Subject: [PATCH] RHEL 7: v2v: Disable the --qemu-boot option (RHBZ#1147313).
-
-This cannot work because there is no Gtk or SDL output mode
-in RHEL 7's qemu-kvm.
-
-In addition you will have to edit the -display option in the
-qemu script.
----
- v2v/cmdline.ml | 4 +++-
- v2v/virt-v2v.pod | 13 -------------
- 2 files changed, 3 insertions(+), 14 deletions(-)
-
-diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
-index 01f3335..14c3fb9 100644
---- a/v2v/cmdline.ml
-+++ b/v2v/cmdline.ml
-@@ -168,7 +168,7 @@ let parse_cmdline () =
- "-os", Arg.Set_string output_storage, "storage " ^ s_"Set output storage location";
- "--password-file", Arg.Set_string password_file, "file " ^ s_"Use password from file";
- "--print-source", Arg.Set print_source, " " ^ s_"Print source and stop";
-- "--qemu-boot", Arg.Set qemu_boot, " " ^ s_"Boot in qemu (-o qemu only)";
-+ "--qemu-boot", Arg.Set qemu_boot, " " ^ s_"This option cannot be used in RHEL";
- "-q", Arg.Set quiet, " " ^ s_"Quiet output";
- "--quiet", Arg.Set quiet, ditto;
- "--root", Arg.String set_root_choice,"ask|... " ^ s_"How to choose root filesystem";
-@@ -364,6 +364,8 @@ read the man page virt-v2v(1).
- if not (is_directory output_storage) then
- error (f_"-os %s: output directory does not exist or is not a directory")
- output_storage;
-+ if qemu_boot then
-+ error (f_"-o qemu: the --qemu-boot option cannot be used in RHEL");
- Output_qemu.output_qemu verbose output_storage qemu_boot
-
- | `RHEV ->
-diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
-index 5f4d42e..9edb2ca 100644
---- a/v2v/virt-v2v.pod
-+++ b/v2v/virt-v2v.pod
-@@ -139,11 +139,6 @@ Since C contains the path(s) to the guest disk
- image(s) you do not need to specify the name of the disk image on the
- command line.
-
--To convert a local disk image and immediately boot it in local
--qemu, do:
--
-- virt-v2v -i disk disk.img -o qemu -os /var/tmp --qemu-boot
--
- =head1 OPTIONS
-
- =over 4
-@@ -350,9 +345,6 @@ This is similar to I<-o local>, except that a shell script is written
- which you can use to boot the guest in qemu. The converted disks and
- shell script are written to the directory specified by I<-os>.
-
--When using this output mode, you can also specify the I<--qemu-boot>
--option which boots the guest under qemu immediately.
--
- =item B<-o rhev>
-
- Set the output method to I.
-@@ -436,11 +428,6 @@ Print information about the source guest and stop. This option is
- useful when you are setting up network and bridge maps.
- See L.
-
--=item B<--qemu-boot>
--
--When using I<-o qemu> only, this boots the guest immediately after
--virt-v2v finishes.
--
- =item B<-q>
-
- =item B<--quiet>
---
-1.8.3.1
-
diff --git a/SOURCES/0095-resize-Preserve-GPT-GUID-so-we-don-t-break-EFI-bootl.patch b/SOURCES/0095-resize-Preserve-GPT-GUID-so-we-don-t-break-EFI-bootl.patch
new file mode 100644
index 0000000..66e31ff
--- /dev/null
+++ b/SOURCES/0095-resize-Preserve-GPT-GUID-so-we-don-t-break-EFI-bootl.patch
@@ -0,0 +1,82 @@
+From 2149aa86bc0b0484e2144c9c441926eab52bd102 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+Date: Thu, 5 Feb 2015 08:13:05 +0000
+Subject: [PATCH] resize: Preserve GPT GUID so we don't break EFI bootloaders
+ (RHBZ#1189284).
+
+When copying disks that use EFI, we created a new partition table,
+randomizing the GPT GUID of the first partition. Since EFI may store
+the GUID in its NVRAM variables, this could make the guest unbootable.
+
+(cherry picked from commit f630677c14c7d5528e1ab39e4f805e0957b2ee3e)
+---
+ resize/resize.ml | 22 ++++++++++++++++++++--
+ 1 file changed, 20 insertions(+), 2 deletions(-)
+
+diff --git a/resize/resize.ml b/resize/resize.ml
+index 2090675..b581b39 100644
+--- a/resize/resize.ml
++++ b/resize/resize.ml
+@@ -50,6 +50,7 @@ type partition = {
+ p_id : partition_id; (* Partition (MBR/GPT) ID. *)
+ p_type : partition_content; (* Content type and content size. *)
+ p_label : string option; (* Label/name. *)
++ p_guid : string option; (* Partition GUID (GPT only). *)
+
+ (* What we're going to do: *)
+ mutable p_operation : partition_operation;
+@@ -93,6 +94,11 @@ let rec debug_partition p =
+ (match p.p_label with
+ | Some label -> label
+ | None -> "(none)"
++ );
++ printf "\tGUID: %s\n"
++ (match p.p_guid with
++ | Some guid -> guid
++ | None -> "(none)"
+ )
+ and string_of_partition_content = function
+ | ContentUnknown -> "unknown data"
+@@ -478,10 +484,16 @@ read the man page virt-resize(1).
+ let label =
+ try Some (g#part_get_name "/dev/sda" part_num)
+ with G.Error _ -> None in
++ let guid =
++ match parttype with
++ | MBR -> None
++ | GPT ->
++ try Some (g#part_get_gpt_guid "/dev/sda" part_num)
++ with G.Error _ -> None in
+
+ { p_name = name; p_part = part;
+ p_bootable = bootable; p_id = id; p_type = typ;
+- p_label = label;
++ p_label = label; p_guid = guid;
+ p_operation = OpCopy; p_target_partnum = 0;
+ p_target_start = 0L; p_target_end = 0L }
+ ) parts in
+@@ -1068,7 +1080,7 @@ read the man page virt-resize(1).
+ p_part = { G.part_num = 0l; part_start = 0L; part_end = 0L;
+ part_size = 0L };
+ p_bootable = false; p_id = No_ID; p_type = ContentUnknown;
+- p_label = None;
++ p_label = None; p_guid = None;
+
+ (* Target information is meaningful. *)
+ p_operation = OpIgnore;
+@@ -1162,6 +1174,12 @@ read the man page virt-resize(1).
+ | None -> ()
+ );
+
++ (match p.p_guid with
++ | Some guid ->
++ g#part_set_gpt_guid "/dev/sdb" p.p_target_partnum guid;
++ | None -> ()
++ );
++
+ match parttype, p.p_id with
+ | GPT, GPT_Type gpt_type ->
+ g#part_set_gpt_type "/dev/sdb" p.p_target_partnum gpt_type
+--
+1.8.3.1
+
diff --git a/SOURCES/0096-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch b/SOURCES/0096-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch
new file mode 100644
index 0000000..d434ece
--- /dev/null
+++ b/SOURCES/0096-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch
@@ -0,0 +1,38 @@
+From db9af482e1afb7b776de08084c3e6c491ca6937f Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+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 489a046..7956bed 100644
+--- a/src/launch-unix.c
++++ b/src/launch-unix.c
+@@ -37,6 +37,12 @@
+ static int
+ launch_unix (guestfs_h *g, void *datav, const char *sockpath)
+ {
++ error (g,
++ "launch: In RHEL, only the 'libvirt' or 'direct' 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;
+@@ -102,6 +108,7 @@ launch_unix (guestfs_h *g, void *datav, const char *sockpath)
+ g->conn = NULL;
+ }
+ return -1;
++#endif
+ }
+
+ static int
+--
+1.8.3.1
+
diff --git a/SOURCES/0096-RHEL-7-Revert-tests-rsync-Skip-this-test-when-the-ba.patch b/SOURCES/0096-RHEL-7-Revert-tests-rsync-Skip-this-test-when-the-ba.patch
deleted file mode 100644
index 5ba8fbb..0000000
--- a/SOURCES/0096-RHEL-7-Revert-tests-rsync-Skip-this-test-when-the-ba.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From 0511f916e395ba7f20324c999be60daf7c3463d2 Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones"
-Date: Thu, 2 Oct 2014 16:44:00 +0100
-Subject: [PATCH] RHEL 7: Revert "tests: rsync: Skip this test when the backend
- is libvirt."
-
-This reverts commit 765dc6237ce7b93dd2f33d99be53eae92e048a7a.
----
- tests/rsync/test-rsync.sh | 35 +++++++----------------------------
- 1 file changed, 7 insertions(+), 28 deletions(-)
-
-diff --git a/tests/rsync/test-rsync.sh b/tests/rsync/test-rsync.sh
-index 53fcab8..793d59d 100755
---- a/tests/rsync/test-rsync.sh
-+++ b/tests/rsync/test-rsync.sh
-@@ -33,33 +33,10 @@ if ! rsync --help >/dev/null 2>&1; then
- exit 77
- fi
-
--# Get host IP address. XXX Bit of a hack.
--backend="$(guestfish get-backend)"
--case "$backend" in
-- direct)
-- ip=169.254.2.2
-- listen_address=localhost
-- ;;
-- libvirt|libvirt:*)
-- # This would work, except that the host firewall is effective
-- # on virbr0, and that is likely to block the non-standard port
-- # number that we listen on.
--# ip="$(ip -4 -o address show virbr0 |
--# awk '{print $4}' |
--# awk -F/ '{print $1}')"
--# listen_address="$ip"
-- echo "$0: skipping test because host firewall will probably prevent this test from working"
-- exit 77
-- ;;
-- uml)
-- echo "$0: skipping test because networking is not available in the UML backend"
-- exit 77
-- ;;
-- *)
-- echo "$0: don't know how to get IP address of backend $backend"
-- exit 77
-- ;;
--esac
-+if [ "$(guestfish get-backend)" = "uml" ]; then
-+ echo "$0: skipping test because networking is not available in the UML backend"
-+ exit 77
-+fi
-
- # If rsync is not available, bail.
- if ! guestfish -a /dev/null run : available rsync; then
-@@ -79,7 +56,7 @@ port="$(awk 'BEGIN{srand(); print 65000+int(500*rand())}' rsyncd.conf <
+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 | 223 ---------------------------------------------------
+ daemon/Makefile.am | 1 -
+ generator/actions.ml | 23 ------
+ gobject/Makefile.inc | 2 -
+ po/POTFILES | 2 -
+ 6 files changed, 1 insertion(+), 252 deletions(-)
+ delete mode 100644 daemon/9p.c
+
+diff --git a/Makefile.am b/Makefile.am
+index d55d8d6..207bcb1 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -59,7 +59,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 fefbb71..0000000
+--- a/daemon/9p.c
++++ /dev/null
+@@ -1,223 +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
+-
+-#include
+-#include
+-#include
+-#include
+-#include
+-#include
+-#include
+-#include
+-#include
+-#include
+-
+-#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) {
+- struct dirent *d;
+-
+- errno = 0;
+- 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 8ccf322..ec6fc6f 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 825acf9..2f2ab66 100644
+--- a/generator/actions.ml
++++ b/generator/actions.ml
+@@ -9150,29 +9150,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 on the
+-directory C.
+-
+-If required, C will be automatically added to the options.
+-Any other options required can be passed in the optional C
+-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 c93dace..f2152f2 100644
+--- a/gobject/Makefile.inc
++++ b/gobject/Makefile.inc
+@@ -78,7 +78,6 @@ guestfs_gobject_headers= \
+ include/guestfs-gobject/optargs-mkfs_btrfs.h \
+ include/guestfs-gobject/optargs-mkswap.h \
+ include/guestfs-gobject/optargs-mktemp.h \
+- include/guestfs-gobject/optargs-mount_9p.h \
+ include/guestfs-gobject/optargs-mount_local.h \
+ include/guestfs-gobject/optargs-ntfsclone_out.h \
+ include/guestfs-gobject/optargs-ntfsfix.h \
+@@ -156,7 +155,6 @@ guestfs_gobject_sources= \
+ src/optargs-mkfs_btrfs.c \
+ src/optargs-mkswap.c \
+ src/optargs-mktemp.c \
+- src/optargs-mount_9p.c \
+ src/optargs-mount_local.c \
+ src/optargs-ntfsclone_out.c \
+ src/optargs-ntfsfix.c \
+diff --git a/po/POTFILES b/po/POTFILES
+index 1a088f5..7f3365c 100644
+--- a/po/POTFILES
++++ b/po/POTFILES
+@@ -14,7 +14,6 @@ cat/ls.c
+ cat/visit.c
+ customize/crypt-c.c
+ customize/perl_edit-c.c
+-daemon/9p.c
+ daemon/acl.c
+ daemon/augeas.c
+ daemon/available.c
+@@ -203,7 +202,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/0097-RHEL-7-Revert-appliance-Change-example-ping-lines-to.patch b/SOURCES/0097-RHEL-7-Revert-appliance-Change-example-ping-lines-to.patch
deleted file mode 100644
index 5acb7a3..0000000
--- a/SOURCES/0097-RHEL-7-Revert-appliance-Change-example-ping-lines-to.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 80523b94c4b14b30f75ae7f14785c8f50831f713 Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones"
-Date: Thu, 2 Oct 2014 16:44:04 +0100
-Subject: [PATCH] RHEL 7: Revert "appliance: Change example ping lines to ping
- 8.8.8.8."
-
-This reverts commit 07c0926b588db5c86214917b609c2f477c817c0e.
----
- appliance/init | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/appliance/init b/appliance/init
-index 3d704ba..f719a72 100755
---- a/appliance/init
-+++ b/appliance/init
-@@ -114,7 +114,8 @@ if grep -sq guestfs_verbose=1 /proc/cmdline; then
- date
- echo -n "clocksource: "
- cat /sys/devices/system/clocksource/clocksource0/current_clocksource
-- #ping -n -v -c 5 8.8.8.8
-+ #ping -n -v -c 5 10.0.2.2
-+ #ping -n -v -c 5 10.0.2.4
-
- echo -n "uptime: "; cat /proc/uptime
- fi
---
-1.8.3.1
-
diff --git a/SOURCES/0098-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch b/SOURCES/0098-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch
new file mode 100644
index 0000000..5e3dfc6
--- /dev/null
+++ b/SOURCES/0098-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch
@@ -0,0 +1,586 @@
+From f55cbd578c873ad815bd3f8915a49be430b35b72 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+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
+ * 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.
+
+In RHEL 7.2: rbd (Ceph) support was enabled.
+---
+ examples/guestfs-testing.pod | 21 -------
+ fish/guestfish.pod | 64 ++-------------------
+ fish/test-add-uri.sh | 25 ---------
+ generator/actions.ml | 48 +---------------
+ src/drives.c | 8 +++
+ src/guestfs.pod | 100 ---------------------------------
+ tests/disks/test-qemu-drive-libvirt.sh | 28 ---------
+ tests/disks/test-qemu-drive.sh | 51 -----------------
+ 8 files changed, 15 insertions(+), 330 deletions(-)
+
+diff --git a/examples/guestfs-testing.pod b/examples/guestfs-testing.pod
+index 2186ed3..ae23b59 100644
+--- a/examples/guestfs-testing.pod
++++ b/examples/guestfs-testing.pod
+@@ -117,27 +117,6 @@ image. To exit, type C.
+ If you get an error, try enabling debugging (add C<-v> to the command
+ line). Also make sure that L succeeds.
+
+-=head2 Try to open a remote guest image with guestfish.
+-
+-B this test requires S 1.22> and S 1.5>.
+-You may also have to disable libvirt by setting this:
+-
+- export LIBGUESTFS_BACKEND=direct
+-
+-If you have a disk image available over HTTP/FTP, try to open it.
+-
+- guestfish --ro -i --format=raw -a http://www.example.com/disk.img
+-
+-For SSH you will need to make sure that ssh-agent is set up so you
+-don't need a password to log in to the remote machine. Then a command
+-similar to this should work:
+-
+- guestfish --ro -i --format=raw \
+- -a ssh://remote.example.com/path/to/disk.img
+-
+-If you get an error, try enabling debugging (add C<-v> to the command
+-line). Also make sure that L succeeds.
+-
+ =head2 Run virt-alignment-scan on all your guests.
+
+ Run L on guests or disk images:
+diff --git a/fish/guestfish.pod b/fish/guestfish.pod
+index 12bf243..e7423a6 100644
+--- a/fish/guestfish.pod
++++ b/fish/guestfish.pod
+@@ -138,9 +138,9 @@ To list what is available do:
+
+ =head2 Remote drives
+
+-Access a remote disk using ssh:
++Access a remote disk using NBD:
+
+- guestfish -a ssh://example.com/path/to/disk.img
++ guestfish -a nbd://example.com
+
+ =head2 Remote control
+
+@@ -1125,12 +1125,12 @@ L>.
+ On the command line, you can use the I<-a> option to add network
+ block devices using a URI-style format, for example:
+
+- guestfish -a ssh://root@example.com/disk.img
++ guestfish -a nbd://example.com
+
+ URIs I be used with the L command. The equivalent
+ command using the API directly is:
+
+- > add /disk.img protocol:ssh server:tcp:example.com username:root
++ > add /disk.img protocol:nbd server:tcp:example.com
+
+ The possible I<-a URI> formats are described below.
+
+@@ -1140,40 +1140,6 @@ The possible I<-a URI> formats are described below.
+
+ Add the local disk image (or device) called C.
+
+-=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:
+-
+- > add /disk.img protocol:(ftp|...) server:tcp:example.com
+-
+-=head2 B<-a gluster://example.com[:port]/volname/image>
+-
+-Add a disk image located on GlusterFS storage.
+-
+-The server is the one running C, and may be C.
+-
+-The equivalent API command would be:
+-
+- > add volname/image protocol:gluster server:tcp:example.com
+-
+-=head2 B<-a iscsi://example.com[:port]/target-iqn-name[/lun]>
+-
+-Add a disk located on an iSCSI server.
+-
+-The equivalent API command would be:
+-
+- > 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>
+@@ -1208,28 +1174,6 @@ The equivalent API command would be:
+
+ > add pool/disk protocol:rbd server:tcp:example.com:port
+
+-=head2 B<-a sheepdog://[example.com[:port]]/volume/image>
+-
+-Add a disk image located on a Sheepdog volume.
+-
+-The server name is optional. Although libguestfs and Sheepdog
+-supports multiple servers, only at most one server can be specified
+-when using this URI syntax.
+-
+-The equivalent API command would be:
+-
+- > add volume protocol:sheepdog [server:tcp:example.com]
+-
+-=head2 B<-a ssh://[user@]example.com[:port]/disk.img>
+-
+-Add a disk image located on a remote server, accessed using the Secure
+-Shell (ssh) SFTP protocol. SFTP is supported out of the box by all
+-major SSH servers.
+-
+-The equivalent API command would be:
+-
+- > 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 2f83754..48c12b8 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 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 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 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 test-add-uri.out 2>&1
+ grep -sq 'add_drive "" "protocol:nbd" "server:tcp:example.com"' test-add-uri.out || fail
+@@ -64,22 +56,5 @@ grep -sq 'add_drive "pool/disk" "protocol:rbd" "server:tcp:example.com:6789"' te
+ $VG guestfish -x -a rbd:///pool/disk test-add-uri.out 2>&1
+ grep -sq 'add_drive "pool/disk" "protocol:rbd"' test-add-uri.out || fail
+
+-# sheepdog
+-$VG guestfish -x -a sheepdog:///volume/image 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 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 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 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 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 2f2ab66..ea715d0 100644
+--- a/generator/actions.ml
++++ b/generator/actions.ml
+@@ -1397,27 +1397,6 @@ C is interpreted as a local file or device.
+ This is the default if the optional protocol parameter
+ is omitted.
+
+-=item C
+-
+-Connect to a remote FTP, HTTP or TFTP server.
+-The C parameter must also be supplied - see below.
+-
+-See also: L
+-
+-=item C
+-
+-Connect to the GlusterFS server.
+-The C parameter must also be supplied - see below.
+-
+-See also: L
+-
+-=item C
+-
+-Connect to the iSCSI server.
+-The C parameter must also be supplied - see below.
+-
+-See also: L.
+-
+ =item C
+
+ Connect to the Network Block Device server.
+@@ -1434,22 +1413,6 @@ The C parameter may be supplied. See below.
+
+ See also: L.
+
+-=item C
+-
+-Connect to the Sheepdog server.
+-The C parameter may also be supplied - see below.
+-
+-See also: L.
+-
+-=item C
+-
+-Connect to the Secure Shell (ssh) server.
+-
+-The C parameter must be supplied.
+-The C parameter may be supplied. See below.
+-
+-See also: L.
+-
+ =back
+
+ =item C
+@@ -1460,13 +1423,8 @@ is a list of server(s).
+ Protocol Number of servers required
+ -------- --------------------------
+ file List must be empty or param not used at all
+- ftp|ftps|http|https|tftp Exactly one
+- gluster Exactly one
+- iscsi Exactly one
+ nbd Exactly one
+ rbd Zero or more
+- sheepdog Zero or more
+- ssh Exactly one
+
+ Each list element is a string specifying a server. The string must be
+ in one of the following formats:
+@@ -1482,10 +1440,10 @@ for the protocol is used (see C).
+
+ =item C
+
+-For the C, C, C, C, C, C, C
+-and C protocols, this specifies the remote username.
++For the C
++protocol, this specifies the remote username.
+
+-If not given, then the local username is used for C, and no authentication
++If not given, then 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. If in doubt,
+diff --git a/src/drives.c b/src/drives.c
+index 307f267..34cf07a 100644
+--- a/src/drives.c
++++ b/src/drives.c
+@@ -199,6 +199,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,
+ const struct drive_create_data *data)
+@@ -257,6 +258,7 @@ create_drive_gluster (guestfs_h *g,
+
+ return create_drive_non_file (g, data);
+ }
++#endif /* DISABLED IN RHEL 7 */
+
+ static int
+ nbd_port (void)
+@@ -325,6 +327,7 @@ create_drive_rbd (guestfs_h *g,
+ return create_drive_non_file (g, data);
+ }
+
++#if 0 /* DISABLED IN RHEL 7 */
+ static struct drive *
+ create_drive_sheepdog (guestfs_h *g,
+ const struct drive_create_data *data)
+@@ -435,6 +438,7 @@ create_drive_iscsi (guestfs_h *g,
+
+ return create_drive_non_file (g, data);
+ }
++#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
+@@ -882,6 +886,7 @@ guestfs__add_drive_opts (guestfs_h *g, const char *filename,
+ drv = create_drive_file (g, &data);
+ }
+ }
++#if 0 /* DISABLED IN RHEL 7 */
+ else if (STREQ (protocol, "ftp")) {
+ data.protocol = drive_protocol_ftp;
+ drv = create_drive_curl (g, &data);
+@@ -906,6 +911,7 @@ guestfs__add_drive_opts (guestfs_h *g, const char *filename,
+ data.protocol = drive_protocol_iscsi;
+ drv = create_drive_iscsi (g, &data);
+ }
++#endif /* DISABLED IN RHEL 7 */
+ else if (STREQ (protocol, "nbd")) {
+ data.protocol = drive_protocol_nbd;
+ drv = create_drive_nbd (g, &data);
+@@ -914,6 +920,7 @@ guestfs__add_drive_opts (guestfs_h *g, const char *filename,
+ data.protocol = drive_protocol_rbd;
+ drv = create_drive_rbd (g, &data);
+ }
++#if 0 /* DISABLED IN RHEL 7 */
+ else if (STREQ (protocol, "sheepdog")) {
+ data.protocol = drive_protocol_sheepdog;
+ drv = create_drive_sheepdog (g, &data);
+@@ -926,6 +933,7 @@ guestfs__add_drive_opts (guestfs_h *g, const char *filename,
+ data.protocol = drive_protocol_tftp;
+ drv = create_drive_curl (g, &data);
+ }
++#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 c9ac1fa..3c1ad46 100644
+--- a/src/guestfs.pod
++++ b/src/guestfs.pod
+@@ -695,70 +695,6 @@ servers. The server string is documented in
+ L. The C and C 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 and C parameters of
+-L 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 can be one of C<"ftp">, C<"ftps">, C<"http">,
+-C<"https"> or C<"tftp">.
+-
+-C (the C 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.
+-
+-=head3 GLUSTER
+-
+-Libguestfs can access Gluster disks.
+-
+-To do this, set the optional C and C parameters of
+-L 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 (the C 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.
+-
+-Note that gluster usually requires the client process (ie. libguestfs)
+-to run as B 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 and C 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 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.
+-
+ =head3 NETWORK BLOCK DEVICE
+
+ Libguestfs can access Network Block Device (NBD) disks remotely.
+@@ -821,42 +757,6 @@ L
+
+ =back
+
+-=head3 SHEEPDOG
+-
+-Libguestfs can access Sheepdog disks.
+-
+-To do this, set the optional C and C parameters of
+-L 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 may be zero or more server addresses
+-(C<"hostname:port">). The format of the server strings is documented
+-in L.
+-
+-=head3 SSH
+-
+-Libguestfs can access disks over a Secure Shell (SSH) connection.
+-
+-To do this, set the C and C and (optionally)
+-C parameters of L 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.
+-
+ =head2 INSPECTION
+
+ Libguestfs has APIs for inspecting an unknown disk image to find out
+diff --git a/tests/disks/test-qemu-drive-libvirt.sh b/tests/disks/test-qemu-drive-libvirt.sh
+index 9930865..1367079 100755
+--- a/tests/disks/test-qemu-drive-libvirt.sh
++++ b/tests/disks/test-qemu-drive-libvirt.sh
+@@ -76,34 +76,6 @@ check_output
+ grep -sq -- '-drive file=rbd:abc-def/ghi-jkl:auth_supported=none,' "$DEBUG_QEMU_FILE" || fail
+ rm "$DEBUG_QEMU_FILE"
+
+-# Gluster.
+-
+-$guestfish -d gluster run ||:
+-check_output
+-grep -sq -- '-drive file=gluster://1.2.3.4:1234/volname/image,' "$DEBUG_QEMU_FILE" || fail
+-rm "$DEBUG_QEMU_FILE"
+-
+-# iSCSI.
+-
+-$guestfish -d iscsi run ||:
+-check_output
+-grep -sq -- '-drive file=iscsi://1.2.3.4:1234/iqn.2003-01.org.linux-iscsi.fedora,' "$DEBUG_QEMU_FILE" || fail
+-rm "$DEBUG_QEMU_FILE"
+-
+-# NBD.
+-
+-$guestfish -d nbd run ||:
+-check_output
+-grep -sq -- '-drive file=nbd:1.2.3.4:1234,' "$DEBUG_QEMU_FILE" || fail
+-rm "$DEBUG_QEMU_FILE"
+-
+-# Sheepdog.
+-
+-$guestfish -d sheepdog run ||:
+-check_output
+-grep -sq -- '-drive file=sheepdog:volume,' "$DEBUG_QEMU_FILE" || fail
+-rm "$DEBUG_QEMU_FILE"
+-
+ # To do:
+
+ # HTTP - curl not yet supported by libvirt
+diff --git a/tests/disks/test-qemu-drive.sh b/tests/disks/test-qemu-drive.sh
+index b530e7d..c0239ff 100755
+--- a/tests/disks/test-qemu-drive.sh
++++ b/tests/disks/test-qemu-drive.sh
+@@ -61,36 +61,6 @@ check_output
+ grep -sq -- '-drive file=rbd:abc-def/ghi-jkl:auth_supported=none,' "$DEBUG_QEMU_FILE" || fail
+ rm "$DEBUG_QEMU_FILE"
+
+-# HTTP.
+-
+-guestfish <
-Date: Thu, 2 Oct 2014 16:44:07 +0100
-Subject: [PATCH] RHEL 7: Revert "launch: libvirt: Use qemu-bridge-helper to
- implement a full network (RHBZ#1148012)."
-
-This reverts commit 224de20b9a8d5ea56f6337f19b4ca237bb88eca0.
----
- src/guestfs.pod | 10 ----------
- src/launch-libvirt.c | 44 +++++++++++++++++++++-----------------------
- 2 files changed, 21 insertions(+), 33 deletions(-)
-
-diff --git a/src/guestfs.pod b/src/guestfs.pod
-index 5792f15..25991ec 100644
---- a/src/guestfs.pod
-+++ b/src/guestfs.pod
-@@ -1398,16 +1398,6 @@ On Fedora, install C for the C file
- (containing symbols). Make sure the symbols precisely match the
- kernel being used.
-
--=head3 network_bridge
--
--The libvirt backend supports:
--
-- export LIBGUESTFS_BACKEND_SETTINGS=network_bridge=virbrX
--
--This allows you to override the bridge that is connected to when the
--network is enabled. The default is C. See also
--L.
--
- =head2 ATTACHING TO RUNNING DAEMONS
-
- I This is B and has a tendency to eat
-diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
-index f8f818a..706ae38 100644
---- a/src/launch-libvirt.c
-+++ b/src/launch-libvirt.c
-@@ -105,7 +105,6 @@ struct backend_libvirt_data {
- char *selinux_label;
- char *selinux_imagelabel;
- bool selinux_norelabel_disks;
-- char *network_bridge;
- char name[DOMAIN_NAME_LEN]; /* random name */
- bool is_kvm; /* false = qemu, true = kvm (from capabilities)*/
- unsigned long qemu_version; /* qemu version (from libvirt) */
-@@ -326,12 +325,6 @@ launch_libvirt (guestfs_h *g, void *datav, const char *libvirt_uri)
- guestfs_get_backend_setting (g, "internal_libvirt_imagelabel");
- data->selinux_norelabel_disks =
- guestfs___get_backend_setting_bool (g, "internal_libvirt_norelabel_disks");
-- if (g->enable_network) {
-- data->network_bridge =
-- guestfs_get_backend_setting (g, "network_bridge");
-- if (!data->network_bridge)
-- data->network_bridge = safe_strdup (g, "virbr0");
-- }
- guestfs_pop_error_handler (g);
-
- /* Locate and/or build the appliance. */
-@@ -1243,19 +1236,6 @@ construct_libvirt_xml_devices (guestfs_h *g,
- } end_element ();
- } end_element ();
-
-- /* Connect to libvirt bridge (see: RHBZ#1148012). */
-- if (g->enable_network) {
-- start_element ("interface") {
-- attribute ("type", "bridge");
-- start_element ("source") {
-- attribute ("bridge", params->data->network_bridge);
-- } end_element ();
-- start_element ("model") {
-- attribute ("type", "virtio");
-- } end_element ();
-- } end_element ();
-- }
--
- } end_element (); /* */
-
- return 0;
-@@ -1637,6 +1617,27 @@ construct_libvirt_xml_qemu_cmdline (guestfs_h *g,
- attribute ("value", tmpdir);
- } end_element ();
-
-+ /* Workaround because libvirt user networking cannot specify "net="
-+ * parameter.
-+ */
-+ if (g->enable_network) {
-+ start_element ("qemu:arg") {
-+ attribute ("value", "-netdev");
-+ } end_element ();
-+
-+ start_element ("qemu:arg") {
-+ attribute ("value", "user,id=usernet,net=169.254.0.0/16");
-+ } end_element ();
-+
-+ start_element ("qemu:arg") {
-+ attribute ("value", "-device");
-+ } end_element ();
-+
-+ start_element ("qemu:arg") {
-+ attribute ("value", VIRTIO_NET ",netdev=usernet");
-+ } end_element ();
-+ }
-+
- /* The qemu command line arguments requested by the caller. */
- for (hp = g->hv_params; hp; hp = hp->next) {
- start_element ("qemu:arg") {
-@@ -1706,9 +1707,6 @@ shutdown_libvirt (guestfs_h *g, void *datav, int check_for_errors)
- free (data->selinux_imagelabel);
- data->selinux_imagelabel = NULL;
-
-- free (data->network_bridge);
-- data->network_bridge = NULL;
--
- return ret;
- }
-
---
-1.8.3.1
-
diff --git a/SOURCES/0099-RHEL-7-Remove-User-Mode-Linux-RHBZ-1144197.patch b/SOURCES/0099-RHEL-7-Remove-User-Mode-Linux-RHBZ-1144197.patch
new file mode 100644
index 0000000..6252d84
--- /dev/null
+++ b/SOURCES/0099-RHEL-7-Remove-User-Mode-Linux-RHBZ-1144197.patch
@@ -0,0 +1,72 @@
+From 4727bbbc937f819570ee9dca1d1bfcaff14ee73a Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+Date: Fri, 19 Sep 2014 13:38:20 +0100
+Subject: [PATCH] RHEL 7: Remove User-Mode Linux (RHBZ#1144197).
+
+This isn't supported in RHEL 7.
+---
+ src/launch-uml.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/src/launch-uml.c b/src/launch-uml.c
+index 21525e3..8643ea8 100644
+--- a/src/launch-uml.c
++++ b/src/launch-uml.c
+@@ -47,7 +47,9 @@ struct backend_uml_data {
+ char umid[UML_UMID_LEN+1]; /* umid=<...> unique ID. */
+ };
+
++#if 0
+ static void print_vmlinux_command_line (guestfs_h *g, char **argv);
++#endif
+
+ /* Run uml_mkcow to create a COW overlay. */
+ static char *
+@@ -85,6 +87,7 @@ create_cow_overlay_uml (guestfs_h *g, void *datav, struct drive *drv)
+ return make_cow_overlay (g, drv->src.u.path);
+ }
+
++#if 0
+ /* Test for features which are not supported by the UML backend.
+ * Possibly some of these should just be warnings, not errors.
+ */
+@@ -132,10 +135,17 @@ uml_supported (guestfs_h *g)
+
+ return true;
+ }
++#endif
+
+ static int
+ launch_uml (guestfs_h *g, void *datav, const char *arg)
+ {
++ error (g,
++ "launch: In RHEL, only the 'libvirt' or 'direct' method is supported.\n"
++ "In particular, User-Mode Linux (UML) is not supported.");
++ return -1;
++
++#if 0
+ struct backend_uml_data *data = datav;
+ CLEANUP_FREE_STRINGSBUF DECLARE_STRINGSBUF (cmdline);
+ int console_sock = -1, daemon_sock = -1;
+@@ -503,8 +513,10 @@ launch_uml (guestfs_h *g, void *datav, const char *arg)
+ }
+ g->state = CONFIG;
+ return -1;
++#endif
+ }
+
++#if 0
+ /* This is called from the forked subprocess just before vmlinux runs,
+ * so it can just print the message straight to stderr, where it will
+ * be picked up and funnelled through the usual appliance event API.
+@@ -534,6 +546,7 @@ print_vmlinux_command_line (guestfs_h *g, char **argv)
+
+ fputc ('\n', stderr);
+ }
++#endif
+
+ static int
+ shutdown_uml (guestfs_h *g, void *datav, int check_for_errors)
+--
+1.8.3.1
+
diff --git a/SOURCES/0099-RHEL-7-Revert-appliance-add-dhcp-client-on-Mageia.patch b/SOURCES/0099-RHEL-7-Revert-appliance-add-dhcp-client-on-Mageia.patch
deleted file mode 100644
index 9bc39d3..0000000
--- a/SOURCES/0099-RHEL-7-Revert-appliance-add-dhcp-client-on-Mageia.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From f7eb90e75b98d95a84cce7a11a4bb5f2993ff98b Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones"
-Date: Fri, 10 Oct 2014 17:45:39 +0100
-Subject: [PATCH] RHEL 7: Revert "appliance: add dhcp-client on Mageia"
-
-This reverts commit 8f3a2ca5358d5601be7a9247b6d08193c4e2da46.
----
- appliance/packagelist.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/appliance/packagelist.in b/appliance/packagelist.in
-index e546eb3..a60e532 100644
---- a/appliance/packagelist.in
-+++ b/appliance/packagelist.in
-@@ -183,7 +183,7 @@ ifelse(MAGEIA,1,
- chkconfig /* for /etc/init.d */
- cdrkit-genisoimage
- cdrkit-isotools
-- dhcp-client
-+ dhclient
- extlinux
- gfs2-utils
- grub
---
-1.8.3.1
-
diff --git a/SOURCES/0100-RHEL-7-Revert-appliance-add-dhcpcd-and-gptfdisk-on-A.patch b/SOURCES/0100-RHEL-7-Revert-appliance-add-dhcpcd-and-gptfdisk-on-A.patch
deleted file mode 100644
index 79910ca..0000000
--- a/SOURCES/0100-RHEL-7-Revert-appliance-add-dhcpcd-and-gptfdisk-on-A.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 38e02668ae697dfeca82e0825ff84d2a647797ac Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones"
-Date: Fri, 10 Oct 2014 17:45:48 +0100
-Subject: [PATCH] RHEL 7: Revert "appliance: add dhcpcd and gptfdisk on
- Archlinux"
-
-This reverts commit 979e7a49147f4ef1387337db262bf7ea12f627e3.
----
- appliance/packagelist.in | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/appliance/packagelist.in b/appliance/packagelist.in
-index a60e532..9032d7d 100644
---- a/appliance/packagelist.in
-+++ b/appliance/packagelist.in
-@@ -104,8 +104,7 @@ ifelse(ARCHLINUX,1,
- btrfs-progs
- cdrkit
- cryptsetup
-- dhcpcd
-- gptfdisk
-+ dhclient
- grub
- hivex
- iproute2
---
-1.8.3.1
-
diff --git a/SOURCES/0100-RHEL-7-v2v-Select-correct-qemu-binary-for-o-qemu-mod.patch b/SOURCES/0100-RHEL-7-v2v-Select-correct-qemu-binary-for-o-qemu-mod.patch
new file mode 100644
index 0000000..2e43fb7
--- /dev/null
+++ b/SOURCES/0100-RHEL-7-v2v-Select-correct-qemu-binary-for-o-qemu-mod.patch
@@ -0,0 +1,33 @@
+From 04f1f9879843e6e3005cfe13805856621aca6bcd Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+Date: Sun, 28 Sep 2014 19:14:43 +0100
+Subject: [PATCH] RHEL 7: v2v: Select correct qemu binary for -o qemu mode
+ (RHBZ#1147313).
+
+RHEL 7 does not have qemu-system-x86_64 (etc), and in addition the
+qemu binary is located in /usr/libexec. Encode the path to this
+binary directly in the script.
+
+Note that we don't support people running qemu directly like this.
+It's just for quick testing of converted VMs, and to help us with
+support cases.
+---
+ v2v/output_qemu.ml | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/v2v/output_qemu.ml b/v2v/output_qemu.ml
+index 75644c2..9c17121 100644
+--- a/v2v/output_qemu.ml
++++ b/v2v/output_qemu.ml
+@@ -48,7 +48,7 @@ object
+ let nl = " \\\n\t" in
+ fpf "#!/bin/sh -\n";
+ fpf "\n";
+- fpf "qemu-system-%s" guestcaps.gcaps_arch;
++ fpf "/usr/libexec/qemu-kvm";
+ fpf "%s-no-user-config -nodefaults" nl;
+ fpf "%s-name %s" nl (quote source.s_name);
+ fpf "%s-machine accel=kvm:tcg" nl;
+--
+1.8.3.1
+
diff --git a/SOURCES/0101-RHEL-7-Revert-appliance-Use-dhclient-or-dhcpcd-inste.patch b/SOURCES/0101-RHEL-7-Revert-appliance-Use-dhclient-or-dhcpcd-inste.patch
deleted file mode 100644
index c57a49c..0000000
--- a/SOURCES/0101-RHEL-7-Revert-appliance-Use-dhclient-or-dhcpcd-inste.patch
+++ /dev/null
@@ -1,91 +0,0 @@
-From 85e7fcbe46ab46bafb1124cf449ec2173e2aeb51 Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones"
-Date: Fri, 10 Oct 2014 17:46:02 +0100
-Subject: [PATCH] RHEL 7: Revert "appliance: Use dhclient or dhcpcd instead of
- hard-coding IP address of appliance."
-
-This reverts commit 67e6f32a240c7c234e6af637c1cd324b36a82cd3.
----
- appliance/init | 13 ++++++-------
- appliance/packagelist.in | 6 ------
- 2 files changed, 6 insertions(+), 13 deletions(-)
-
-diff --git a/appliance/init b/appliance/init
-index f719a72..6d62338 100755
---- a/appliance/init
-+++ b/appliance/init
-@@ -79,13 +79,12 @@ hwclock -u -s
- ip addr add 127.0.0.1/8 brd + dev lo scope host
- ip link set dev lo up
-
--if grep -sq guestfs_network=1 /proc/cmdline; then
-- if dhclient --version >/dev/null 2>&1; then
-- dhclient
-- else
-- dhcpcd
-- fi
--fi
-+ip addr add 169.254.2.10/16 brd + dev eth0 scope global
-+ip link set dev eth0 up
-+
-+ip route add default via 169.254.2.2
-+
-+echo nameserver 169.254.2.3 > /etc/resolv.conf
-
- # Scan for MDs.
- mdadm -As --auto=yes --run
-diff --git a/appliance/packagelist.in b/appliance/packagelist.in
-index 9032d7d..8fb6eca 100644
---- a/appliance/packagelist.in
-+++ b/appliance/packagelist.in
-@@ -27,7 +27,6 @@ ifelse(REDHAT,1,
- btrfs-progs
- cryptsetup
- cryptsetup-luks dnl old name used before Fedora 17
-- dhclient
- dnl e4fsprogs only exists on RHEL 5, will be ignored everywhere else.
- e4fsprogs
- genisoimage
-@@ -74,7 +73,6 @@ dnl iproute has been renamed to iproute2
- iputils-ping
- iputils-arping
- iputils-tracepath
-- isc-dhcp-client
- libaugeas0
- libc-bin
- libcap2
-@@ -104,7 +102,6 @@ ifelse(ARCHLINUX,1,
- btrfs-progs
- cdrkit
- cryptsetup
-- dhclient
- grub
- hivex
- iproute2
-@@ -133,7 +130,6 @@ ifelse(SUSE,1,
- augeas-lenses
- btrfsprogs
- cryptsetup
-- dhcpcd
- genisoimage
- glibc-locale
- gptfdisk
-@@ -154,7 +150,6 @@ ifelse(FRUGALWARE,1,
- btrfs-progs
- cryptsetup-luks
- cdrkit
-- dhclient
- grub2
- hfsplus
- iproute2
-@@ -182,7 +177,6 @@ ifelse(MAGEIA,1,
- chkconfig /* for /etc/init.d */
- cdrkit-genisoimage
- cdrkit-isotools
-- dhclient
- extlinux
- gfs2-utils
- grub
---
-1.8.3.1
-
diff --git a/SOURCES/0101-RHEL-7-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch b/SOURCES/0101-RHEL-7-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch
new file mode 100644
index 0000000..9e7f474
--- /dev/null
+++ b/SOURCES/0101-RHEL-7-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch
@@ -0,0 +1,78 @@
+From c8eca5fd761f8eb7822ccb765d3e9138d9bcb738 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+Date: Tue, 30 Sep 2014 10:50:27 +0100
+Subject: [PATCH] RHEL 7: v2v: Disable the --qemu-boot option (RHBZ#1147313).
+
+This cannot work because there is no Gtk or SDL output mode
+in RHEL 7's qemu-kvm.
+
+In addition you will have to edit the -display option in the
+qemu script.
+---
+ v2v/cmdline.ml | 4 +++-
+ v2v/virt-v2v.pod | 13 -------------
+ 2 files changed, 3 insertions(+), 14 deletions(-)
+
+diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
+index 01f3335..14c3fb9 100644
+--- a/v2v/cmdline.ml
++++ b/v2v/cmdline.ml
+@@ -168,7 +168,7 @@ let parse_cmdline () =
+ "-os", Arg.Set_string output_storage, "storage " ^ s_"Set output storage location";
+ "--password-file", Arg.Set_string password_file, "file " ^ s_"Use password from file";
+ "--print-source", Arg.Set print_source, " " ^ s_"Print source and stop";
+- "--qemu-boot", Arg.Set qemu_boot, " " ^ s_"Boot in qemu (-o qemu only)";
++ "--qemu-boot", Arg.Set qemu_boot, " " ^ s_"This option cannot be used in RHEL";
+ "-q", Arg.Set quiet, " " ^ s_"Quiet output";
+ "--quiet", Arg.Set quiet, ditto;
+ "--root", Arg.String set_root_choice,"ask|... " ^ s_"How to choose root filesystem";
+@@ -364,6 +364,8 @@ read the man page virt-v2v(1).
+ if not (is_directory output_storage) then
+ error (f_"-os %s: output directory does not exist or is not a directory")
+ output_storage;
++ if qemu_boot then
++ error (f_"-o qemu: the --qemu-boot option cannot be used in RHEL");
+ Output_qemu.output_qemu verbose output_storage qemu_boot
+
+ | `RHEV ->
+diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
+index 5f4d42e..9edb2ca 100644
+--- a/v2v/virt-v2v.pod
++++ b/v2v/virt-v2v.pod
+@@ -139,11 +139,6 @@ Since C contains the path(s) to the guest disk
+ image(s) you do not need to specify the name of the disk image on the
+ command line.
+
+-To convert a local disk image and immediately boot it in local
+-qemu, do:
+-
+- virt-v2v -i disk disk.img -o qemu -os /var/tmp --qemu-boot
+-
+ =head1 OPTIONS
+
+ =over 4
+@@ -350,9 +345,6 @@ This is similar to I<-o local>, except that a shell script is written
+ which you can use to boot the guest in qemu. The converted disks and
+ shell script are written to the directory specified by I<-os>.
+
+-When using this output mode, you can also specify the I<--qemu-boot>
+-option which boots the guest under qemu immediately.
+-
+ =item B<-o rhev>
+
+ Set the output method to I.
+@@ -436,11 +428,6 @@ Print information about the source guest and stop. This option is
+ useful when you are setting up network and bridge maps.
+ See L.
+
+-=item B<--qemu-boot>
+-
+-When using I<-o qemu> only, this boots the guest immediately after
+-virt-v2v finishes.
+-
+ =item B<-q>
+
+ =item B<--quiet>
+--
+1.8.3.1
+
diff --git a/SOURCES/0102-RHEL-7-Revert-tests-rsync-Skip-this-test-when-the-ba.patch b/SOURCES/0102-RHEL-7-Revert-tests-rsync-Skip-this-test-when-the-ba.patch
new file mode 100644
index 0000000..489126a
--- /dev/null
+++ b/SOURCES/0102-RHEL-7-Revert-tests-rsync-Skip-this-test-when-the-ba.patch
@@ -0,0 +1,74 @@
+From dd3263f82d6ee73808c31896136b795643cd24c4 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+Date: Thu, 2 Oct 2014 16:44:00 +0100
+Subject: [PATCH] RHEL 7: Revert "tests: rsync: Skip this test when the backend
+ is libvirt."
+
+This reverts commit 765dc6237ce7b93dd2f33d99be53eae92e048a7a.
+---
+ tests/rsync/test-rsync.sh | 35 +++++++----------------------------
+ 1 file changed, 7 insertions(+), 28 deletions(-)
+
+diff --git a/tests/rsync/test-rsync.sh b/tests/rsync/test-rsync.sh
+index 53fcab8..793d59d 100755
+--- a/tests/rsync/test-rsync.sh
++++ b/tests/rsync/test-rsync.sh
+@@ -33,33 +33,10 @@ if ! rsync --help >/dev/null 2>&1; then
+ exit 77
+ fi
+
+-# Get host IP address. XXX Bit of a hack.
+-backend="$(guestfish get-backend)"
+-case "$backend" in
+- direct)
+- ip=169.254.2.2
+- listen_address=localhost
+- ;;
+- libvirt|libvirt:*)
+- # This would work, except that the host firewall is effective
+- # on virbr0, and that is likely to block the non-standard port
+- # number that we listen on.
+-# ip="$(ip -4 -o address show virbr0 |
+-# awk '{print $4}' |
+-# awk -F/ '{print $1}')"
+-# listen_address="$ip"
+- echo "$0: skipping test because host firewall will probably prevent this test from working"
+- exit 77
+- ;;
+- uml)
+- echo "$0: skipping test because networking is not available in the UML backend"
+- exit 77
+- ;;
+- *)
+- echo "$0: don't know how to get IP address of backend $backend"
+- exit 77
+- ;;
+-esac
++if [ "$(guestfish get-backend)" = "uml" ]; then
++ echo "$0: skipping test because networking is not available in the UML backend"
++ exit 77
++fi
+
+ # If rsync is not available, bail.
+ if ! guestfish -a /dev/null run : available rsync; then
+@@ -79,7 +56,7 @@ port="$(awk 'BEGIN{srand(); print 65000+int(500*rand())}' rsyncd.conf <
-Date: Thu, 23 Oct 2014 08:41:56 +0100
-Subject: [PATCH] RHEL 7: v2v: Disable unconfiguration of VMware drivers on
- Linux (RHBZ#1155610).
-
-This is currently broken and breaks conversions. For details see:
-https://bugzilla.redhat.com/show_bug.cgi?id=1155610
----
- v2v/convert_linux.ml | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
-index 709b4b9..67de2b1 100644
---- a/v2v/convert_linux.ml
-+++ b/v2v/convert_linux.ml
-@@ -537,6 +537,7 @@ let rec convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source =
- msg
- )
-
-+(* Disabled in RHEL 7.1: see https://bugzilla.redhat.com/show_bug.cgi?id=1155610
- and unconfigure_vmware () =
- (* Look for any configured VMware yum repos and disable them. *)
- let repos =
-@@ -627,6 +628,7 @@ let rec convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source =
- warning ~prog (f_"VMware tools was detected, but uninstallation failed. The error message was: %s (ignored)")
- msg
- )
-+*)
-
- and unconfigure_citrix () =
- let pkgs =
-@@ -1417,7 +1419,7 @@ let rec convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source =
-
- unconfigure_xen ();
- unconfigure_vbox ();
-- unconfigure_vmware ();
-+ (*unconfigure_vmware ();*)
- unconfigure_citrix ();
- unconfigure_efi ();
- unconfigure_kudzu ();
---
-1.8.3.1
-
diff --git a/SOURCES/0103-RHEL-7-Disable-alternate-Augeas-lenses.patch b/SOURCES/0103-RHEL-7-Disable-alternate-Augeas-lenses.patch
deleted file mode 100644
index d056aec..0000000
--- a/SOURCES/0103-RHEL-7-Disable-alternate-Augeas-lenses.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-From cd10f6e4067591c0f6926746eaaa2330e034e66d Mon Sep 17 00:00:00 2001
-From: Pino Toscano
-Date: Fri, 24 Oct 2014 16:33:50 +0100
-Subject: [PATCH] RHEL 7: Disable alternate Augeas lenses.
-
-These are included in the RHEL 7.1 augeas package, and therefore
-not required in RHEL.
-
-See:
-https://www.redhat.com/archives/libguestfs/2014-October/msg00220.html
----
- appliance/Makefile.am | 2 --
- daemon/augeas.c | 5 ++++-
- daemon/lvm-filter.c | 4 ++--
- 3 files changed, 6 insertions(+), 5 deletions(-)
-
-diff --git a/appliance/Makefile.am b/appliance/Makefile.am
-index 7b30bbe..c7eca20 100644
---- a/appliance/Makefile.am
-+++ b/appliance/Makefile.am
-@@ -82,8 +82,6 @@ supermin.d/daemon.tar.gz: ../daemon/guestfsd guestfsd.suppressions guestfs_lvm_c
- mkdir -p tmp-d$(DAEMON_SUPERMIN_DIR) tmp-d/etc tmp-d/usr/share/guestfs
- ln ../daemon/guestfsd tmp-d$(DAEMON_SUPERMIN_DIR)/guestfsd
- ln $(srcdir)/guestfsd.suppressions tmp-d/etc/guestfsd.suppressions
-- ln $(srcdir)/guestfs_lvm_conf.aug tmp-d/usr/share/guestfs/guestfs_lvm_conf.aug
-- ln $(srcdir)/guestfs_shadow.aug tmp-d/usr/share/guestfs/guestfs_shadow.aug
- ( cd tmp-d && tar zcf - * ) > $@-t
- rm -r tmp-d
- mv $@-t $@
-diff --git a/daemon/augeas.c b/daemon/augeas.c
-index ce49726..7753e67 100644
---- a/daemon/augeas.c
-+++ b/daemon/augeas.c
-@@ -134,7 +134,7 @@ do_aug_init (const char *root, int flags)
- }
-
- /* Pass AUG_NO_ERR_CLOSE so we can display detailed errors. */
-- aug = aug_init (buf, "/usr/share/guestfs/", flags | AUG_NO_ERR_CLOSE);
-+ aug = aug_init (buf, NULL, flags | AUG_NO_ERR_CLOSE);
-
- if (!aug) {
- reply_with_error ("augeas initialization failed");
-@@ -148,6 +148,8 @@ do_aug_init (const char *root, int flags)
- return -1;
- }
-
-+ /* We already have the needed lenses in RHEL 7 */
-+#if 0
- if (!augeas_is_version (1, 2, 1)) {
- int r = aug_transform (aug, "guestfs_shadow", "/etc/shadow",
- 0 /* = included */);
-@@ -166,6 +168,7 @@ do_aug_init (const char *root, int flags)
- }
- }
- }
-+#endif
-
- return 0;
- }
-diff --git a/daemon/lvm-filter.c b/daemon/lvm-filter.c
-index d82fde0..9e0f570 100644
---- a/daemon/lvm-filter.c
-+++ b/daemon/lvm-filter.c
-@@ -121,7 +121,7 @@ set_filter (char *const *filters)
- * but do that only after having applied the transformation.
- */
- const int flags = AUG_NO_ERR_CLOSE | AUG_NO_LOAD;
-- aug = aug_init (lvm_system_dir, "/usr/share/guestfs/", flags);
-+ aug = aug_init (lvm_system_dir, NULL, flags);
- if (!aug) {
- reply_with_error ("augeas initialization failed");
- return -1;
-@@ -132,7 +132,7 @@ set_filter (char *const *filters)
- return -1;
- }
-
-- r = aug_transform (aug, "guestfs_lvm_conf", "/lvm/lvm.conf",
-+ r = aug_transform (aug, "lvm", "/lvm/lvm.conf",
- 0 /* = included */);
- if (r == -1) {
- AUGEAS_ERROR ("aug_transform");
---
-1.8.3.1
-
diff --git a/SOURCES/0103-RHEL-7-Revert-appliance-Change-example-ping-lines-to.patch b/SOURCES/0103-RHEL-7-Revert-appliance-Change-example-ping-lines-to.patch
new file mode 100644
index 0000000..b398375
--- /dev/null
+++ b/SOURCES/0103-RHEL-7-Revert-appliance-Change-example-ping-lines-to.patch
@@ -0,0 +1,28 @@
+From 2bbaa881d67ddaafb7c111ef8ad1f93c9879c52d Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+Date: Thu, 2 Oct 2014 16:44:04 +0100
+Subject: [PATCH] RHEL 7: Revert "appliance: Change example ping lines to ping
+ 8.8.8.8."
+
+This reverts commit 07c0926b588db5c86214917b609c2f477c817c0e.
+---
+ appliance/init | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/appliance/init b/appliance/init
+index 3d704ba..f719a72 100755
+--- a/appliance/init
++++ b/appliance/init
+@@ -114,7 +114,8 @@ if grep -sq guestfs_verbose=1 /proc/cmdline; then
+ date
+ echo -n "clocksource: "
+ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
+- #ping -n -v -c 5 8.8.8.8
++ #ping -n -v -c 5 10.0.2.2
++ #ping -n -v -c 5 10.0.2.4
+
+ echo -n "uptime: "; cat /proc/uptime
+ fi
+--
+1.8.3.1
+
diff --git a/SOURCES/0104-RHEL-7-Revert-launch-libvirt-Use-qemu-bridge-helper-.patch b/SOURCES/0104-RHEL-7-Revert-launch-libvirt-Use-qemu-bridge-helper-.patch
new file mode 100644
index 0000000..74c059d
--- /dev/null
+++ b/SOURCES/0104-RHEL-7-Revert-launch-libvirt-Use-qemu-bridge-helper-.patch
@@ -0,0 +1,119 @@
+From 2392578b6774594eb33188606fd64c415055be63 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+Date: Thu, 2 Oct 2014 16:44:07 +0100
+Subject: [PATCH] RHEL 7: Revert "launch: libvirt: Use qemu-bridge-helper to
+ implement a full network (RHBZ#1148012)."
+
+This reverts commit 224de20b9a8d5ea56f6337f19b4ca237bb88eca0.
+---
+ src/guestfs.pod | 10 ----------
+ src/launch-libvirt.c | 44 +++++++++++++++++++++-----------------------
+ 2 files changed, 21 insertions(+), 33 deletions(-)
+
+diff --git a/src/guestfs.pod b/src/guestfs.pod
+index 3c1ad46..81347f3 100644
+--- a/src/guestfs.pod
++++ b/src/guestfs.pod
+@@ -1419,16 +1419,6 @@ On Fedora, install C for the C file
+ (containing symbols). Make sure the symbols precisely match the
+ kernel being used.
+
+-=head3 network_bridge
+-
+-The libvirt backend supports:
+-
+- export LIBGUESTFS_BACKEND_SETTINGS=network_bridge=virbrX
+-
+-This allows you to override the bridge that is connected to when the
+-network is enabled. The default is C. See also
+-L.
+-
+ =head2 ATTACHING TO RUNNING DAEMONS
+
+ I This is B and has a tendency to eat
+diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
+index 79bc6fd..026fd5a 100644
+--- a/src/launch-libvirt.c
++++ b/src/launch-libvirt.c
+@@ -105,7 +105,6 @@ struct backend_libvirt_data {
+ char *selinux_label;
+ char *selinux_imagelabel;
+ bool selinux_norelabel_disks;
+- char *network_bridge;
+ char name[DOMAIN_NAME_LEN]; /* random name */
+ bool is_kvm; /* false = qemu, true = kvm (from capabilities)*/
+ unsigned long qemu_version; /* qemu version (from libvirt) */
+@@ -332,12 +331,6 @@ launch_libvirt (guestfs_h *g, void *datav, const char *libvirt_uri)
+ guestfs_get_backend_setting (g, "internal_libvirt_imagelabel");
+ data->selinux_norelabel_disks =
+ guestfs___get_backend_setting_bool (g, "internal_libvirt_norelabel_disks");
+- if (g->enable_network) {
+- data->network_bridge =
+- guestfs_get_backend_setting (g, "network_bridge");
+- if (!data->network_bridge)
+- data->network_bridge = safe_strdup (g, "virbr0");
+- }
+ guestfs_pop_error_handler (g);
+
+ /* Locate and/or build the appliance. */
+@@ -1267,19 +1260,6 @@ construct_libvirt_xml_devices (guestfs_h *g,
+ } end_element ();
+ } end_element ();
+
+- /* Connect to libvirt bridge (see: RHBZ#1148012). */
+- if (g->enable_network) {
+- start_element ("interface") {
+- attribute ("type", "bridge");
+- start_element ("source") {
+- attribute ("bridge", params->data->network_bridge);
+- } end_element ();
+- start_element ("model") {
+- attribute ("type", "virtio");
+- } end_element ();
+- } end_element ();
+- }
+-
+ } end_element (); /* */
+
+ return 0;
+@@ -1661,6 +1641,27 @@ construct_libvirt_xml_qemu_cmdline (guestfs_h *g,
+ attribute ("value", tmpdir);
+ } end_element ();
+
++ /* Workaround because libvirt user networking cannot specify "net="
++ * parameter.
++ */
++ if (g->enable_network) {
++ start_element ("qemu:arg") {
++ attribute ("value", "-netdev");
++ } end_element ();
++
++ start_element ("qemu:arg") {
++ attribute ("value", "user,id=usernet,net=169.254.0.0/16");
++ } end_element ();
++
++ start_element ("qemu:arg") {
++ attribute ("value", "-device");
++ } end_element ();
++
++ start_element ("qemu:arg") {
++ attribute ("value", VIRTIO_NET ",netdev=usernet");
++ } end_element ();
++ }
++
+ /* The qemu command line arguments requested by the caller. */
+ for (hp = g->hv_params; hp; hp = hp->next) {
+ start_element ("qemu:arg") {
+@@ -1745,9 +1746,6 @@ shutdown_libvirt (guestfs_h *g, void *datav, int check_for_errors)
+ free (data->selinux_imagelabel);
+ data->selinux_imagelabel = NULL;
+
+- free (data->network_bridge);
+- data->network_bridge = NULL;
+-
+ free (data->uefi_code);
+ data->uefi_code = NULL;
+ free (data->uefi_vars);
+--
+1.8.3.1
+
diff --git a/SOURCES/0105-RHEL-7-Revert-appliance-add-dhcp-client-on-Mageia.patch b/SOURCES/0105-RHEL-7-Revert-appliance-add-dhcp-client-on-Mageia.patch
new file mode 100644
index 0000000..a19ac90
--- /dev/null
+++ b/SOURCES/0105-RHEL-7-Revert-appliance-add-dhcp-client-on-Mageia.patch
@@ -0,0 +1,26 @@
+From 774e8f155f7f9dc369e3fd0e1838a1f309cda235 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+Date: Fri, 10 Oct 2014 17:45:39 +0100
+Subject: [PATCH] RHEL 7: Revert "appliance: add dhcp-client on Mageia"
+
+This reverts commit 8f3a2ca5358d5601be7a9247b6d08193c4e2da46.
+---
+ appliance/packagelist.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/appliance/packagelist.in b/appliance/packagelist.in
+index e546eb3..a60e532 100644
+--- a/appliance/packagelist.in
++++ b/appliance/packagelist.in
+@@ -183,7 +183,7 @@ ifelse(MAGEIA,1,
+ chkconfig /* for /etc/init.d */
+ cdrkit-genisoimage
+ cdrkit-isotools
+- dhcp-client
++ dhclient
+ extlinux
+ gfs2-utils
+ grub
+--
+1.8.3.1
+
diff --git a/SOURCES/0106-RHEL-7-Revert-appliance-add-dhcpcd-and-gptfdisk-on-A.patch b/SOURCES/0106-RHEL-7-Revert-appliance-add-dhcpcd-and-gptfdisk-on-A.patch
new file mode 100644
index 0000000..e2317bf
--- /dev/null
+++ b/SOURCES/0106-RHEL-7-Revert-appliance-add-dhcpcd-and-gptfdisk-on-A.patch
@@ -0,0 +1,28 @@
+From 3abf69d23cd95082daedb7cb1a1c98049f310368 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+Date: Fri, 10 Oct 2014 17:45:48 +0100
+Subject: [PATCH] RHEL 7: Revert "appliance: add dhcpcd and gptfdisk on
+ Archlinux"
+
+This reverts commit 979e7a49147f4ef1387337db262bf7ea12f627e3.
+---
+ appliance/packagelist.in | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/appliance/packagelist.in b/appliance/packagelist.in
+index a60e532..9032d7d 100644
+--- a/appliance/packagelist.in
++++ b/appliance/packagelist.in
+@@ -104,8 +104,7 @@ ifelse(ARCHLINUX,1,
+ btrfs-progs
+ cdrkit
+ cryptsetup
+- dhcpcd
+- gptfdisk
++ dhclient
+ grub
+ hivex
+ iproute2
+--
+1.8.3.1
+
diff --git a/SOURCES/0107-RHEL-7-Revert-appliance-Use-dhclient-or-dhcpcd-inste.patch b/SOURCES/0107-RHEL-7-Revert-appliance-Use-dhclient-or-dhcpcd-inste.patch
new file mode 100644
index 0000000..0ad308e
--- /dev/null
+++ b/SOURCES/0107-RHEL-7-Revert-appliance-Use-dhclient-or-dhcpcd-inste.patch
@@ -0,0 +1,91 @@
+From 8b61f836790e57690852b41bdc0856df42a58867 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+Date: Fri, 10 Oct 2014 17:46:02 +0100
+Subject: [PATCH] RHEL 7: Revert "appliance: Use dhclient or dhcpcd instead of
+ hard-coding IP address of appliance."
+
+This reverts commit 67e6f32a240c7c234e6af637c1cd324b36a82cd3.
+---
+ appliance/init | 13 ++++++-------
+ appliance/packagelist.in | 6 ------
+ 2 files changed, 6 insertions(+), 13 deletions(-)
+
+diff --git a/appliance/init b/appliance/init
+index f719a72..6d62338 100755
+--- a/appliance/init
++++ b/appliance/init
+@@ -79,13 +79,12 @@ hwclock -u -s
+ ip addr add 127.0.0.1/8 brd + dev lo scope host
+ ip link set dev lo up
+
+-if grep -sq guestfs_network=1 /proc/cmdline; then
+- if dhclient --version >/dev/null 2>&1; then
+- dhclient
+- else
+- dhcpcd
+- fi
+-fi
++ip addr add 169.254.2.10/16 brd + dev eth0 scope global
++ip link set dev eth0 up
++
++ip route add default via 169.254.2.2
++
++echo nameserver 169.254.2.3 > /etc/resolv.conf
+
+ # Scan for MDs.
+ mdadm -As --auto=yes --run
+diff --git a/appliance/packagelist.in b/appliance/packagelist.in
+index 9032d7d..8fb6eca 100644
+--- a/appliance/packagelist.in
++++ b/appliance/packagelist.in
+@@ -27,7 +27,6 @@ ifelse(REDHAT,1,
+ btrfs-progs
+ cryptsetup
+ cryptsetup-luks dnl old name used before Fedora 17
+- dhclient
+ dnl e4fsprogs only exists on RHEL 5, will be ignored everywhere else.
+ e4fsprogs
+ genisoimage
+@@ -74,7 +73,6 @@ dnl iproute has been renamed to iproute2
+ iputils-ping
+ iputils-arping
+ iputils-tracepath
+- isc-dhcp-client
+ libaugeas0
+ libc-bin
+ libcap2
+@@ -104,7 +102,6 @@ ifelse(ARCHLINUX,1,
+ btrfs-progs
+ cdrkit
+ cryptsetup
+- dhclient
+ grub
+ hivex
+ iproute2
+@@ -133,7 +130,6 @@ ifelse(SUSE,1,
+ augeas-lenses
+ btrfsprogs
+ cryptsetup
+- dhcpcd
+ genisoimage
+ glibc-locale
+ gptfdisk
+@@ -154,7 +150,6 @@ ifelse(FRUGALWARE,1,
+ btrfs-progs
+ cryptsetup-luks
+ cdrkit
+- dhclient
+ grub2
+ hfsplus
+ iproute2
+@@ -182,7 +177,6 @@ ifelse(MAGEIA,1,
+ chkconfig /* for /etc/init.d */
+ cdrkit-genisoimage
+ cdrkit-isotools
+- dhclient
+ extlinux
+ gfs2-utils
+ grub
+--
+1.8.3.1
+
diff --git a/SOURCES/0108-RHEL-7-v2v-Disable-unconfiguration-of-VMware-drivers.patch b/SOURCES/0108-RHEL-7-v2v-Disable-unconfiguration-of-VMware-drivers.patch
new file mode 100644
index 0000000..c642f83
--- /dev/null
+++ b/SOURCES/0108-RHEL-7-v2v-Disable-unconfiguration-of-VMware-drivers.patch
@@ -0,0 +1,44 @@
+From 67d28ac629e96912bb7152bbb172217d0f1c70c0 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+Date: Thu, 23 Oct 2014 08:41:56 +0100
+Subject: [PATCH] RHEL 7: v2v: Disable unconfiguration of VMware drivers on
+ Linux (RHBZ#1155610).
+
+This is currently broken and breaks conversions. For details see:
+https://bugzilla.redhat.com/show_bug.cgi?id=1155610
+---
+ v2v/convert_linux.ml | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
+index 709b4b9..67de2b1 100644
+--- a/v2v/convert_linux.ml
++++ b/v2v/convert_linux.ml
+@@ -537,6 +537,7 @@ let rec convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source =
+ msg
+ )
+
++(* Disabled in RHEL 7.1: see https://bugzilla.redhat.com/show_bug.cgi?id=1155610
+ and unconfigure_vmware () =
+ (* Look for any configured VMware yum repos and disable them. *)
+ let repos =
+@@ -627,6 +628,7 @@ let rec convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source =
+ warning ~prog (f_"VMware tools was detected, but uninstallation failed. The error message was: %s (ignored)")
+ msg
+ )
++*)
+
+ and unconfigure_citrix () =
+ let pkgs =
+@@ -1417,7 +1419,7 @@ let rec convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source =
+
+ unconfigure_xen ();
+ unconfigure_vbox ();
+- unconfigure_vmware ();
++ (*unconfigure_vmware ();*)
+ unconfigure_citrix ();
+ unconfigure_efi ();
+ unconfigure_kudzu ();
+--
+1.8.3.1
+
diff --git a/SOURCES/0109-RHEL-7-Disable-alternate-Augeas-lenses.patch b/SOURCES/0109-RHEL-7-Disable-alternate-Augeas-lenses.patch
new file mode 100644
index 0000000..c11e480
--- /dev/null
+++ b/SOURCES/0109-RHEL-7-Disable-alternate-Augeas-lenses.patch
@@ -0,0 +1,84 @@
+From 1156f17878c25ba3221105b339ab9ff298bd123d Mon Sep 17 00:00:00 2001
+From: Pino Toscano
+Date: Fri, 24 Oct 2014 16:33:50 +0100
+Subject: [PATCH] RHEL 7: Disable alternate Augeas lenses.
+
+These are included in the RHEL 7.1 augeas package, and therefore
+not required in RHEL.
+
+See:
+https://www.redhat.com/archives/libguestfs/2014-October/msg00220.html
+---
+ appliance/Makefile.am | 2 --
+ daemon/augeas.c | 5 ++++-
+ daemon/lvm-filter.c | 4 ++--
+ 3 files changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/appliance/Makefile.am b/appliance/Makefile.am
+index 7b30bbe..c7eca20 100644
+--- a/appliance/Makefile.am
++++ b/appliance/Makefile.am
+@@ -82,8 +82,6 @@ supermin.d/daemon.tar.gz: ../daemon/guestfsd guestfsd.suppressions guestfs_lvm_c
+ mkdir -p tmp-d$(DAEMON_SUPERMIN_DIR) tmp-d/etc tmp-d/usr/share/guestfs
+ ln ../daemon/guestfsd tmp-d$(DAEMON_SUPERMIN_DIR)/guestfsd
+ ln $(srcdir)/guestfsd.suppressions tmp-d/etc/guestfsd.suppressions
+- ln $(srcdir)/guestfs_lvm_conf.aug tmp-d/usr/share/guestfs/guestfs_lvm_conf.aug
+- ln $(srcdir)/guestfs_shadow.aug tmp-d/usr/share/guestfs/guestfs_shadow.aug
+ ( cd tmp-d && tar zcf - * ) > $@-t
+ rm -r tmp-d
+ mv $@-t $@
+diff --git a/daemon/augeas.c b/daemon/augeas.c
+index ce49726..7753e67 100644
+--- a/daemon/augeas.c
++++ b/daemon/augeas.c
+@@ -134,7 +134,7 @@ do_aug_init (const char *root, int flags)
+ }
+
+ /* Pass AUG_NO_ERR_CLOSE so we can display detailed errors. */
+- aug = aug_init (buf, "/usr/share/guestfs/", flags | AUG_NO_ERR_CLOSE);
++ aug = aug_init (buf, NULL, flags | AUG_NO_ERR_CLOSE);
+
+ if (!aug) {
+ reply_with_error ("augeas initialization failed");
+@@ -148,6 +148,8 @@ do_aug_init (const char *root, int flags)
+ return -1;
+ }
+
++ /* We already have the needed lenses in RHEL 7 */
++#if 0
+ if (!augeas_is_version (1, 2, 1)) {
+ int r = aug_transform (aug, "guestfs_shadow", "/etc/shadow",
+ 0 /* = included */);
+@@ -166,6 +168,7 @@ do_aug_init (const char *root, int flags)
+ }
+ }
+ }
++#endif
+
+ return 0;
+ }
+diff --git a/daemon/lvm-filter.c b/daemon/lvm-filter.c
+index d82fde0..9e0f570 100644
+--- a/daemon/lvm-filter.c
++++ b/daemon/lvm-filter.c
+@@ -121,7 +121,7 @@ set_filter (char *const *filters)
+ * but do that only after having applied the transformation.
+ */
+ const int flags = AUG_NO_ERR_CLOSE | AUG_NO_LOAD;
+- aug = aug_init (lvm_system_dir, "/usr/share/guestfs/", flags);
++ aug = aug_init (lvm_system_dir, NULL, flags);
+ if (!aug) {
+ reply_with_error ("augeas initialization failed");
+ return -1;
+@@ -132,7 +132,7 @@ set_filter (char *const *filters)
+ return -1;
+ }
+
+- r = aug_transform (aug, "guestfs_lvm_conf", "/lvm/lvm.conf",
++ r = aug_transform (aug, "lvm", "/lvm/lvm.conf",
+ 0 /* = included */);
+ if (r == -1) {
+ AUGEAS_ERROR ("aug_transform");
+--
+1.8.3.1
+
diff --git a/SOURCES/0110-v2v-Add-a-note-about-escaping-username-like-DOMAIN-u.patch b/SOURCES/0110-v2v-Add-a-note-about-escaping-username-like-DOMAIN-u.patch
new file mode 100644
index 0000000..99c562a
--- /dev/null
+++ b/SOURCES/0110-v2v-Add-a-note-about-escaping-username-like-DOMAIN-u.patch
@@ -0,0 +1,32 @@
+From 7222c6d14b7d2c9eb5edb43da8ba83dbb002af71 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+Date: Tue, 23 Dec 2014 15:29:26 +0000
+Subject: [PATCH] v2v: Add a note about escaping username like DOMAIN\user.
+
+Thanks: Ben Hooper.
+(cherry picked from commit 29df51d9bc24eaae9e42c3794b7dac9c78d8b3bd)
+---
+ v2v/virt-v2v.pod | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
+index 9edb2ca..933955a 100644
+--- a/v2v/virt-v2v.pod
++++ b/v2v/virt-v2v.pod
+@@ -744,7 +744,12 @@ where:
+
+ =item C
+
+-is the (optional, but recommended) user to connect as
++is the (optional, but recommended) user to connect as.
++
++If the username contains a backslash (eg. C) then you
++will need to URI-escape that character using C<%5c>: C
++(5c is the hexadecimal ASCII code for backslash.) Other punctuation
++may also have to be escaped.
+
+ =item C
+
+--
+1.8.3.1
+
diff --git a/SOURCES/0111-v2v-adding-vdsm-ovf-output-option.patch b/SOURCES/0111-v2v-adding-vdsm-ovf-output-option.patch
new file mode 100644
index 0000000..f6bc5ee
--- /dev/null
+++ b/SOURCES/0111-v2v-adding-vdsm-ovf-output-option.patch
@@ -0,0 +1,172 @@
+From 93c2eb23dacc9ffa226c92777c498792d7f5a6cf Mon Sep 17 00:00:00 2001
+From: Shahar Havivi
+Date: Thu, 25 Dec 2014 11:57:12 +0200
+Subject: [PATCH] v2v: adding --vdsm-ovf-output option
+
+This option is needed by vdsm for writing the ovf to a specific directory.
+The default is current directory.
+
+Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1176598
+Signed-off-by: Shahar Havivi
+(cherry picked from commit 14d11916faf68afb672d1626348931f2b90afd08)
+---
+ v2v/cmdline.ml | 5 +++++
+ v2v/output_vdsm.ml | 16 +++++++---------
+ v2v/output_vdsm.mli | 1 +
+ v2v/test-v2v-o-vdsm-options.sh | 1 +
+ v2v/virt-v2v.pod | 8 +++++++-
+ 5 files changed, 21 insertions(+), 10 deletions(-)
+
+diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
+index 14c3fb9..97167b4 100644
+--- a/v2v/cmdline.ml
++++ b/v2v/cmdline.ml
+@@ -47,6 +47,7 @@ let parse_cmdline () =
+ let qemu_boot = ref false in
+ let quiet = ref false in
+ let vdsm_vm_uuid = ref "" in
++ let vdsm_ovf_output = ref "." in
+ let verbose = ref false in
+ let trace = ref false in
+ let vmtype = ref "" in
+@@ -178,6 +179,8 @@ let parse_cmdline () =
+ Arg.String add_vdsm_vol_uuid, "uuid " ^ s_"Output vol UUID(s)";
+ "--vdsm-vm-uuid",
+ Arg.Set_string vdsm_vm_uuid, "uuid " ^ s_"Output VM UUID";
++ "--vdsm-ovf-output",
++ Arg.Set_string vdsm_ovf_output, " " ^ s_"Output OVF file";
+ "-v", Arg.Set verbose, " " ^ s_"Enable debugging messages";
+ "--verbose", Arg.Set verbose, ditto;
+ "-V", Arg.Unit display_version, " " ^ s_"Display version and exit";
+@@ -237,6 +240,7 @@ read the man page virt-v2v(1).
+ let vdsm_image_uuids = List.rev !vdsm_image_uuids in
+ let vdsm_vol_uuids = List.rev !vdsm_vol_uuids in
+ let vdsm_vm_uuid = !vdsm_vm_uuid in
++ let vdsm_ovf_output = !vdsm_ovf_output in
+ let verbose = !verbose in
+ let trace = !trace in
+ let vmtype =
+@@ -386,6 +390,7 @@ read the man page virt-v2v(1).
+ Output_vdsm.image_uuids = vdsm_image_uuids;
+ vol_uuids = vdsm_vol_uuids;
+ vm_uuid = vdsm_vm_uuid;
++ ovf_output = vdsm_ovf_output;
+ } in
+ Output_vdsm.output_vdsm verbose output_storage vdsm_params
+ vmtype output_alloc in
+diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml
+index 293f57f..492f586 100644
+--- a/v2v/output_vdsm.ml
++++ b/v2v/output_vdsm.ml
+@@ -30,6 +30,7 @@ type vdsm_params = {
+ image_uuids : string list;
+ vol_uuids : string list;
+ vm_uuid : string;
++ ovf_output : string;
+ }
+
+ class output_vdsm verbose os vdsm_params vmtype output_alloc =
+@@ -37,12 +38,13 @@ object
+ inherit output verbose
+
+ method as_options =
+- sprintf "-o vdsm -os %s%s%s --vdsm-vm-uuid %s%s" os
++ sprintf "-o vdsm -os %s%s%s --vdsm-vm-uuid %s --vdsm-ovf-output %s%s" os
+ (String.concat ""
+ (List.map (sprintf " --vdsm-image-uuid %s") vdsm_params.image_uuids))
+ (String.concat ""
+ (List.map (sprintf " --vdsm-vol-uuid %s") vdsm_params.vol_uuids))
+ vdsm_params.vm_uuid
++ vdsm_params.ovf_output
+ (match vmtype with
+ | None -> ""
+ | Some `Server -> " --vmtype server"
+@@ -57,9 +59,6 @@ object
+ val mutable dd_mp = ""
+ val mutable dd_uuid = ""
+
+- (* Target metadata directory. *)
+- val mutable ovf_dir = ""
+-
+ (* This is called early on in the conversion and lets us choose the
+ * name of the target files that eventually get written by the main
+ * code.
+@@ -98,13 +97,12 @@ object
+ ) vdsm_params.image_uuids;
+
+ (* Note that VDSM has to create this directory too. *)
+- ovf_dir <- dd_mp // dd_uuid // "master" // "vms" // vdsm_params.vm_uuid;
+- if not (is_directory ovf_dir) then
++ if not (is_directory vdsm_params.ovf_output) then
+ error (f_"OVF (metadata) directory (%s) does not exist or is not a directory")
+- ovf_dir;
++ vdsm_params.ovf_output;
+
+ if verbose then
+- eprintf "VDSM: OVF (metadata) directory: %s\n%!" ovf_dir;
++ eprintf "VDSM: OVF (metadata) directory: %s\n%!" vdsm_params.ovf_output;
+
+ (* The final directory structure should look like this:
+ * ///images/
+@@ -164,7 +162,7 @@ object
+ vdsm_params.vm_uuid in
+
+ (* Write it to the metadata file. *)
+- let file = ovf_dir // vdsm_params.vm_uuid ^ ".ovf" in
++ let file = vdsm_params.ovf_output // vdsm_params.vm_uuid ^ ".ovf" in
+ let chan = open_out file in
+ doc_to_chan chan ovf;
+ close_out chan
+diff --git a/v2v/output_vdsm.mli b/v2v/output_vdsm.mli
+index 3ee5425..26ac15d 100644
+--- a/v2v/output_vdsm.mli
++++ b/v2v/output_vdsm.mli
+@@ -22,6 +22,7 @@ type vdsm_params = {
+ image_uuids : string list; (* --vdsm-image-uuid (multiple) *)
+ vol_uuids : string list; (* --vdsm-vol-uuid (multiple) *)
+ vm_uuid : string; (* --vdsm-vm-uuid *)
++ ovf_output : string; (* --vdsm-ovf-output *)
+ }
+ (** Miscellaneous extra command line parameters used by VDSM. *)
+
+diff --git a/v2v/test-v2v-o-vdsm-options.sh b/v2v/test-v2v-o-vdsm-options.sh
+index 8747d8a..e2098fa 100755
+--- a/v2v/test-v2v-o-vdsm-options.sh
++++ b/v2v/test-v2v-o-vdsm-options.sh
+@@ -69,6 +69,7 @@ $VG virt-v2v --debug-gc \
+ --vdsm-image-uuid IMAGE \
+ --vdsm-vol-uuid VOL \
+ --vdsm-vm-uuid VM \
++ --vdsm-ovf-output $d/12345678-1234-1234-1234-123456789abc/master/vms/VM \
+
+ # Test the OVF metadata was created.
+ test -f $d/12345678-1234-1234-1234-123456789abc/master/vms/VM/VM.ovf
+diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
+index 933955a..7ed2dda 100644
+--- a/v2v/virt-v2v.pod
++++ b/v2v/virt-v2v.pod
+@@ -483,6 +483,8 @@ OS which is not in the first VirtIO disk.
+
+ =item B<--vdsm-vm-uuid> UUID
+
++=item B<--vdsm-ovf-output>
++
+ Normally the RHEV output mode chooses random UUIDs for the target
+ guest. However VDSM needs to control the UUIDs and passes these
+ parameters when virt-v2v runs under VDSM control. The parameters
+@@ -502,7 +504,11 @@ is passed once for each guest disk)
+
+ =item *
+
+-the VM and OVF file (I<--vdsm-vm-uuid>).
++the OVF file name (I<--vdsm-vm-uuid>).
++
++=item *
++
++the OVF output directory (default current directory) (I<--vdsm-ovf-output>).
+
+ =back
+
+--
+1.8.3.1
+
diff --git a/SOURCES/0112-v2v-o-vdsm-should-assume-data-domain-at-os-path.patch b/SOURCES/0112-v2v-o-vdsm-should-assume-data-domain-at-os-path.patch
new file mode 100644
index 0000000..aac1f2b
--- /dev/null
+++ b/SOURCES/0112-v2v-o-vdsm-should-assume-data-domain-at-os-path.patch
@@ -0,0 +1,89 @@
+From 766c53d1d28006cbefa2837f6f3bd9fd2bee64b8 Mon Sep 17 00:00:00 2001
+From: Shahar Havivi
+Date: Mon, 26 Jan 2015 12:13:49 +0200
+Subject: [PATCH] v2v: -o vdsm should assume data domain at -os path
+
+Unlike -o rhev which have only one data domin, -o vdsm can and usually
+does have multiple data domain.
+The path to vdsm is pre mounted so no need to assume nfs path with -os
+Example:
+-o vdsm -os /rhev/data-center/