diff --git a/.gitignore b/.gitignore index 811e356..479aabe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -SOURCES/RHEV-Application-Provisioning-Tool.exe_4.42 -SOURCES/libguestfs-1.38.2.tar.gz +SOURCES/RHEV-Application-Provisioning-Tool.exe_4.43-3 +SOURCES/libguestfs-1.40.2.tar.gz SOURCES/libguestfs.keyring SOURCES/rhsrvany.exe diff --git a/.libguestfs.metadata b/.libguestfs.metadata index d3282a9..b63e4dd 100644 --- a/.libguestfs.metadata +++ b/.libguestfs.metadata @@ -1,4 +1,4 @@ -c44dcbd8c9b390e151c16821ff093e4dc408be66 SOURCES/RHEV-Application-Provisioning-Tool.exe_4.42 -34567b42feff61b56e0e44bb9c52a70a96950c53 SOURCES/libguestfs-1.38.2.tar.gz +ac8722917cc31c36836e241bd7a4beb5f8a8b0c8 SOURCES/RHEV-Application-Provisioning-Tool.exe_4.43-3 +45755f0f73b503790974484053ff482f32665b13 SOURCES/libguestfs-1.40.2.tar.gz 1bbc40f501a7fef9eef2a39b701a71aee2fea7c4 SOURCES/libguestfs.keyring 2bd96e478fc004cd323b5bd754c856641877dac6 SOURCES/rhsrvany.exe diff --git a/SOURCES/0001-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch b/SOURCES/0001-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch deleted file mode 100644 index 85bbdf4..0000000 --- a/SOURCES/0001-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 54fdf8cea3fce1171e30a2c30ebbadbd9df5adaf 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. ---- - lib/launch-unix.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/lib/launch-unix.c b/lib/launch-unix.c -index 9af481fd9..974336ccd 100644 ---- a/lib/launch-unix.c -+++ b/lib/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; -@@ -106,6 +112,7 @@ launch_unix (guestfs_h *g, void *datav, const char *sockpath) - g->conn = NULL; - } - return -1; -+#endif - } - - static int --- -2.20.1 - diff --git a/SOURCES/0001-inspect-fix-icon-of-RHEL.patch b/SOURCES/0001-inspect-fix-icon-of-RHEL.patch new file mode 100644 index 0000000..af8d73b --- /dev/null +++ b/SOURCES/0001-inspect-fix-icon-of-RHEL.patch @@ -0,0 +1,32 @@ +From 880efbac3fced5f07f93b04d8a200d7f41ed3215 Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Mon, 11 Feb 2019 19:28:00 +0100 +Subject: [PATCH] inspect: fix icon of RHEL + +Use a better icon for RHEL guests, still provided by redhat-logos (or +equivalent in downstream distributions), and which fits a better +definition of logo for the distribution. + +Thanks to Ray Strode for the hints. + +(cherry picked from commit c648052690a4a07a59c741308e0e8497d6f18057) +--- + lib/inspect-icon.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/inspect-icon.c b/lib/inspect-icon.c +index 623591aa6..19f3f87af 100644 +--- a/lib/inspect-icon.c ++++ b/lib/inspect-icon.c +@@ -317,7 +317,7 @@ icon_rhel (guestfs_h *g, int major, size_t *size_r) + if (major < 7) + shadowman = "/usr/share/pixmaps/redhat/shadowman-transparent.png"; + else +- shadowman = "/usr/share/pixmaps/fedora-logo-sprite.png"; ++ shadowman = "/usr/share/icons/hicolor/96x96/apps/system-logo-icon.png"; + + return get_png (g, shadowman, size_r, 102400); + } +-- +2.21.0 + diff --git a/SOURCES/0002-RHEL-7-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch b/SOURCES/0002-RHEL-7-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch deleted file mode 100644 index 95c2edc..0000000 --- a/SOURCES/0002-RHEL-7-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch +++ /dev/null @@ -1,372 +0,0 @@ -From 98c7c205306eb27e63b3eccc930ceab88e15be25 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 | 224 -------------------------------------- - daemon/Makefile.am | 1 - - docs/C_SOURCE_FILES | 1 - - generator/actions_core.ml | 21 ---- - generator/proc_nr.ml | 2 - - gobject/Makefile.inc | 2 - - po/POTFILES | 2 - - 8 files changed, 1 insertion(+), 254 deletions(-) - delete mode 100644 daemon/9p.c - -diff --git a/Makefile.am b/Makefile.am -index cc363341f..8fb25a57c 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -78,7 +78,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 55644249d..000000000 ---- a/daemon/9p.c -+++ /dev/null -@@ -1,224 +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" -- --static char *read_whole_file (const char *filename); -- --/* https://bugzilla.redhat.com/show_bug.cgi?id=714981#c1 */ --char ** --do_list_9p (void) --{ -- CLEANUP_FREE_STRINGSBUF 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 take_stringsbuf (&r); -- } -- -- while (1) { -- struct dirent *d; -- -- errno = 0; -- d = readdir (dir); -- if (d == NULL) break; -- -- if (STRPREFIX (d->d_name, "virtio")) { -- CLEANUP_FREE char *mount_tag_path = NULL; -- if (asprintf (&mount_tag_path, BUS_PATH "/%s/mount_tag", -- d->d_name) == -1) { -- reply_with_perror ("asprintf"); -- closedir (dir); -- return NULL; -- } -- -- /* 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"); -- closedir (dir); -- return NULL; -- } -- -- /* Close the directory handle */ -- if (closedir (dir) == -1) { -- reply_with_perror ("closedir: /sys/block"); -- 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 take_stringsbuf (&r); --} -- --/* 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, 0, 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, -- "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 6240f517d..29f3aa6df 100644 ---- a/daemon/Makefile.am -+++ b/daemon/Makefile.am -@@ -76,7 +76,6 @@ guestfsd_SOURCES = \ - ../common/protocol/guestfs_protocol.h \ - ../common/utils/cleanups.h \ - ../common/utils/guestfs-utils.h \ -- 9p.c \ - acl.c \ - actions.h \ - available.c \ -diff --git a/docs/C_SOURCE_FILES b/docs/C_SOURCE_FILES -index f3ee61e0d..e8b1d5283 100644 ---- a/docs/C_SOURCE_FILES -+++ b/docs/C_SOURCE_FILES -@@ -70,7 +70,6 @@ common/windows/windows.h - customize/crypt-c.c - customize/dummy.c - customize/perl_edit-c.c --daemon/9p.c - daemon/acl.c - daemon/actions.h - daemon/augeas.c -diff --git a/generator/actions_core.ml b/generator/actions_core.ml -index 2ae3ec1d9..237edafce 100644 ---- a/generator/actions_core.ml -+++ b/generator/actions_core.ml -@@ -6179,27 +6179,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"; added = (1, 11, 12); -- style = RStringList (RPlainString, "mounttags"), [], []; -- 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"; added = (1, 11, 12); -- style = RErr, [String (PlainString, "mounttag"); String (PlainString, "mountpoint")], [OString "options"]; -- 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"; added = (1, 11, 15); - style = RStringList (RDevice, "devices"), [], []; -diff --git a/generator/proc_nr.ml b/generator/proc_nr.ml -index 9e16ab14a..e6b018c62 100644 ---- a/generator/proc_nr.ml -+++ b/generator/proc_nr.ml -@@ -295,8 +295,6 @@ let proc_nr = [ - 282, "internal_autosync"; - 283, "is_zero"; - 284, "is_zero_device"; --285, "list_9p"; --286, "mount_9p"; - 287, "list_dm_devices"; - 288, "ntfsresize"; - 289, "btrfs_filesystem_resize"; -diff --git a/gobject/Makefile.inc b/gobject/Makefile.inc -index 5aa2dcafe..b8f8e9226 100644 ---- a/gobject/Makefile.inc -+++ b/gobject/Makefile.inc -@@ -93,7 +93,6 @@ guestfs_gobject_headers= \ - include/guestfs-gobject/optargs-mksquashfs.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 \ -@@ -186,7 +185,6 @@ guestfs_gobject_sources= \ - src/optargs-mksquashfs.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 a049d66fe..5daec8a89 100644 ---- a/po/POTFILES -+++ b/po/POTFILES -@@ -58,7 +58,6 @@ customize/crypt-c.c - customize/dummy.c - customize/perl_edit-c.c - customize/test-password.pl --daemon/9p.c - daemon/acl.c - daemon/augeas.c - daemon/available.c -@@ -290,7 +289,6 @@ gobject/src/optargs-mkfs_btrfs.c - gobject/src/optargs-mksquashfs.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 --- -2.20.1 - diff --git a/SOURCES/0002-v2v-linux-do-not-uninstall-open-vm-tools-w-ubuntu-se.patch b/SOURCES/0002-v2v-linux-do-not-uninstall-open-vm-tools-w-ubuntu-se.patch new file mode 100644 index 0000000..12b1c9b --- /dev/null +++ b/SOURCES/0002-v2v-linux-do-not-uninstall-open-vm-tools-w-ubuntu-se.patch @@ -0,0 +1,57 @@ +From dc4ea25b46861b5cd18dc432b3f39692a25ce441 Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Wed, 27 Feb 2019 17:51:59 +0100 +Subject: [PATCH] v2v: linux: do not uninstall open-vm-tools w/ ubuntu-server + +ubuntu-server depends on open-vm-tools on Ubuntu, so if v2v tries to +uninstall open-vm-tools then dpkg will (rightfully) fail with a +dependency issue. + +Since open-vm-tools is harmless after the conversion anyway (it will +not even run), then do not attempt to uninstall it if ubuntu-server is +installed too. + +Followup of commit 2bebacf8bf611f0f80a66915f78653ce30b38129. + +Thanks to: Ming Xie. + +(cherry picked from commit 1a4fd822ef057764f809cddce642b3223756629e) +--- + v2v/convert_linux.ml | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml +index 3d61400b5..b4b2f24c4 100644 +--- a/v2v/convert_linux.ml ++++ b/v2v/convert_linux.ml +@@ -289,6 +289,18 @@ let convert (g : G.guestfs) inspect source output rcaps = + + (* Uninstall VMware Tools. *) + let remove = ref [] and libraries = ref [] in ++ (* On Ubuntu, the ubuntu-server metapackage depends on ++ * open-vm-tools, and thus any attempt to remove it will cause ++ * dependency issues. Hence, special case this situation, and ++ * leave open-vm-tools installed in this case. ++ *) ++ let has_ubuntu_server = ++ if family = `Debian_family then ++ List.exists ( ++ fun { G.app2_name = name } -> ++ name = "ubuntu-server" ++ ) inspect.i_apps ++ else false in + List.iter ( + fun { G.app2_name = name } -> + if String.is_prefix name "vmware-tools-libraries-" then +@@ -301,7 +313,7 @@ let convert (g : G.guestfs) inspect source output rcaps = + List.push_front name remove + else if String.is_prefix name "open-vm-tools-" then + List.push_front name remove +- else if name = "open-vm-tools" then ++ else if name = "open-vm-tools" && not has_ubuntu_server then + List.push_front name remove + ) inspect.i_apps; + let libraries = !libraries in +-- +2.21.0 + diff --git a/SOURCES/0003-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch b/SOURCES/0003-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch deleted file mode 100644 index 0877e03..0000000 --- a/SOURCES/0003-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch +++ /dev/null @@ -1,611 +0,0 @@ -From a3b29ff1114ffe50a09e9505b377697999751a84 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. ---- - docs/guestfs-testing.pod | 20 ----- - fish/guestfish.pod | 66 ++-------------- - fish/test-add-uri.sh | 32 -------- - generator/actions_core.ml | 50 +------------ - lib/drives.c | 8 ++ - lib/guestfs.pod | 100 ------------------------- - tests/disks/test-qemu-drive-libvirt.sh | 28 ------- - tests/disks/test-qemu-drive.sh | 60 --------------- - 8 files changed, 16 insertions(+), 348 deletions(-) - -diff --git a/docs/guestfs-testing.pod b/docs/guestfs-testing.pod -index f558964bf..8f264ed17 100644 ---- a/docs/guestfs-testing.pod -+++ b/docs/guestfs-testing.pod -@@ -109,26 +109,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. -- --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 bbf43aad5..f4762f929 100644 ---- a/fish/guestfish.pod -+++ b/fish/guestfish.pod -@@ -131,9 +131,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 - -@@ -1127,12 +1127,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. - -@@ -1142,40 +1142,6 @@ The possible I<-a URI> formats are described below. - - Add the local disk image (or device) called F. - --=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> -@@ -1210,35 +1176,13 @@ 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] -- - Note that the URIs follow the syntax of - L: in particular, there - are restrictions on the allowed characters for the various components - of the URI. Characters such as C<:>, C<@>, and C B be - percent-encoded: - -- $ guestfish -a ssh://user:pass%40word@example.com/disk.img -+ $ guestfish -a rbd://user:pass%40word@example.com[:port]/pool/disk - - In this case, the password is C. - -diff --git a/fish/test-add-uri.sh b/fish/test-add-uri.sh -index 756df997b..8f84fd31b 100755 ---- a/fish/test-add-uri.sh -+++ b/fish/test-add-uri.sh -@@ -40,14 +40,6 @@ function fail () - $VG guestfish -x -a file://$abs_builddir/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 -@@ -67,29 +59,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 -- --# iSCSI --$VG guestfish -x -a iscsi://example.com/iqn.2015-12.com.libguestfs:test1/0 test-add-uri.out 2>&1 --grep -sq 'add_drive "iqn.2015-12.com.libguestfs:test1/0" "protocol:iscsi" "server:tcp:example.com"' test-add-uri.out || fail -- --$VG guestfish -x -a iscsi://user:password@example.com/iqn.2015-12.com.libguestfs:test2/0 test-add-uri.out 2>&1 --grep -sq 'add_drive "iqn.2015-12.com.libguestfs:test2/0" "protocol:iscsi" "server:tcp:example.com" "username:user" "secret:password"' test-add-uri.out || fail -- - rm test-add-uri.out - rm test-add-uri.img -diff --git a/generator/actions_core.ml b/generator/actions_core.ml -index 237edafce..aca5b1f43 100644 ---- a/generator/actions_core.ml -+++ b/generator/actions_core.ml -@@ -297,29 +297,6 @@ F 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. --The C parameter may be supplied. See below. --The C parameter may be supplied. See below. -- --See also: L. -- - =item C - - Connect to the Network Block Device server. -@@ -336,22 +313,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 -@@ -362,13 +323,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: -@@ -384,10 +340,10 @@ for the protocol is used (see F). - - =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/lib/drives.c b/lib/drives.c -index 82ef30093..ba5d07ed0 100644 ---- a/lib/drives.c -+++ b/lib/drives.c -@@ -165,6 +165,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) -@@ -223,6 +224,7 @@ create_drive_gluster (guestfs_h *g, - - return create_drive_non_file (g, data); - } -+#endif /* DISABLED IN RHEL 7 */ - - static int - nbd_port (void) -@@ -291,6 +293,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) -@@ -391,6 +394,7 @@ create_drive_iscsi (guestfs_h *g, - - return create_drive_non_file (g, data); - } -+#endif /* DISABLED IN RHEL 7 */ - - /** - * Create the special F drive. -@@ -826,6 +830,7 @@ guestfs_impl_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); -@@ -850,6 +855,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename, - data.protocol = drive_protocol_iscsi; - drv = create_drive_iscsi (g, &data); - } -+#endif /* DISABLED IN RHEL 7 */ - else if (STREQ (protocol, "nbd")) { - data.protocol = drive_protocol_nbd; - drv = create_drive_nbd (g, &data); -@@ -858,6 +864,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename, - data.protocol = drive_protocol_rbd; - drv = create_drive_rbd (g, &data); - } -+#if 0 /* DISABLED IN RHEL 7 */ - else if (STREQ (protocol, "sheepdog")) { - data.protocol = drive_protocol_sheepdog; - drv = create_drive_sheepdog (g, &data); -@@ -870,6 +877,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename, - data.protocol = drive_protocol_tftp; - drv = create_drive_curl (g, &data); - } -+#endif /* DISABLED IN RHEL 7 */ - else { - error (g, _("unknown protocol ‘%s’"), protocol); - drv = NULL; /*FALLTHROUGH*/ -diff --git a/lib/guestfs.pod b/lib/guestfs.pod -index d5a0e81e7..684f8dc6c 100644 ---- a/lib/guestfs.pod -+++ b/lib/guestfs.pod -@@ -714,70 +714,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. -@@ -840,42 +776,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 ab8052de1..ad22b2fbb 100755 ---- a/tests/disks/test-qemu-drive-libvirt.sh -+++ b/tests/disks/test-qemu-drive-libvirt.sh -@@ -64,34 +64,6 @@ check_output - grep -sq -- '-drive file=rbd:abc-def/ghi-jkl:auth_supported=none,' "$DEBUG_QEMU_FILE" || fail ceph2 - rm "$DEBUG_QEMU_FILE" - --# Gluster. -- --$guestfish -d gluster run ||: --check_output --grep -sq -- '-drive file=gluster://1.2.3.4:1234/volname/image,' "$DEBUG_QEMU_FILE" || fail gluster --rm "$DEBUG_QEMU_FILE" -- --# iSCSI. -- --$guestfish -d iscsi run ||: --check_output --grep -sq -- '-drive file=iscsi://1.2.3.4:1234/iqn.2003-01.org.linux-iscsi.fedora' "$DEBUG_QEMU_FILE" || fail iscsi --rm "$DEBUG_QEMU_FILE" -- --# NBD. -- --$guestfish -d nbd run ||: --check_output --grep -sq -- '-drive file=nbd:1.2.3.4:1234,' "$DEBUG_QEMU_FILE" || fail nbd --rm "$DEBUG_QEMU_FILE" -- --# Sheepdog. -- --$guestfish -d sheepdog run ||: --check_output --grep -sq -- '-drive file=sheepdog:volume,' "$DEBUG_QEMU_FILE" || fail sheepdog --rm "$DEBUG_QEMU_FILE" -- - # Local, stored in a pool. - - $guestfish -d pool1 run ||: -diff --git a/tests/disks/test-qemu-drive.sh b/tests/disks/test-qemu-drive.sh -index 19dd60a2f..583e031bd 100755 ---- a/tests/disks/test-qemu-drive.sh -+++ b/tests/disks/test-qemu-drive.sh -@@ -62,45 +62,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: Wed, 20 Mar 2019 16:55:05 +0100 +Subject: [PATCH] v2v: linux: canonicalize module path for arch detection + (RHBZ#1690574) + +Kernel modules can be also symlinks to files available outside the +"canonical" module directory; the "file" API, used by the +"file-architecture" API, return the actual type of a file (so symlinks, +block devices, etc), and thus "file-architecture" fails on symlinks. + +To prevent this situation, canonicalize the path of the module picked +for architecture detection: this way, "file-architecture" will act on a +real file. + +(cherry picked from commit 0a093035d485b3c2e66d56541ebe159f1b632ba6) +--- + v2v/linux_kernels.ml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/v2v/linux_kernels.ml b/v2v/linux_kernels.ml +index 3313aabc7..889ec2f2a 100644 +--- a/v2v/linux_kernels.ml ++++ b/v2v/linux_kernels.ml +@@ -189,7 +189,7 @@ let detect_kernels (g : G.guestfs) inspect family bootloader = + *) + let arch = + let any_module = modpath ^ List.hd modules in +- g#file_architecture any_module in ++ g#file_architecture (g#realpath any_module) in + + (* Just return the module names, without path or extension. *) + let modules = List.filter_map ( +-- +2.21.0 + diff --git a/SOURCES/0004-RHEL-7-Remove-User-Mode-Linux-RHBZ-1144197.patch b/SOURCES/0004-RHEL-7-Remove-User-Mode-Linux-RHBZ-1144197.patch deleted file mode 100644 index 638708a..0000000 --- a/SOURCES/0004-RHEL-7-Remove-User-Mode-Linux-RHBZ-1144197.patch +++ /dev/null @@ -1,72 +0,0 @@ -From adeeafce7f7ada1c8b98120745388d5a51b27ca3 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. ---- - lib/launch-uml.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -diff --git a/lib/launch-uml.c b/lib/launch-uml.c -index b8825cf56..1acf8db27 100644 ---- a/lib/launch-uml.c -+++ b/lib/launch-uml.c -@@ -44,7 +44,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 * -@@ -81,6 +83,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. - */ -@@ -128,10 +131,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; -@@ -491,8 +501,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. -@@ -522,6 +534,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) --- -2.20.1 - diff --git a/SOURCES/0004-v2v-linux-improve-arch-detection-from-modules-RHBZ-1.patch b/SOURCES/0004-v2v-linux-improve-arch-detection-from-modules-RHBZ-1.patch new file mode 100644 index 0000000..6bcb0b7 --- /dev/null +++ b/SOURCES/0004-v2v-linux-improve-arch-detection-from-modules-RHBZ-1.patch @@ -0,0 +1,61 @@ +From a0e44877a4ba2df153ec5334b24eb254f9c2aeb3 Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Wed, 20 Mar 2019 12:32:02 +0100 +Subject: [PATCH] v2v: linux: improve arch detection from modules + (RHBZ#1690574) + +Try to look for a well known kernel module (so far only virtio, or kvm) +to use for detecting the architecture of a kernel. This way, we can +avoid picking 3rd party modules that cause troubles. + +(cherry picked from commit 363b5e0b4ecebe861a9aafe8bce5a8390b54571c) +--- + v2v/linux_kernels.ml | 30 +++++++++++++++++++++++++++--- + 1 file changed, 27 insertions(+), 3 deletions(-) + +diff --git a/v2v/linux_kernels.ml b/v2v/linux_kernels.ml +index 889ec2f2a..30160f0da 100644 +--- a/v2v/linux_kernels.ml ++++ b/v2v/linux_kernels.ml +@@ -185,11 +185,35 @@ let detect_kernels (g : G.guestfs) inspect family bootloader = + assert (List.length modules > 0); + + (* Determine the kernel architecture by looking at the +- * architecture of an arbitrary kernel module. ++ * architecture of a kernel module. ++ * ++ * To avoid architecture detection issues with 3rd party ++ * modules (RHBZ#1690574), try to pick one of the well ++ * known modules, if available. Otherwise, an arbitrary ++ * module is used. + *) + let arch = +- let any_module = modpath ^ List.hd modules in +- g#file_architecture (g#realpath any_module) in ++ (* Well known kernel modules. *) ++ let candidates = [ "virtio"; "kvm" ] in ++ let all_candidates = List.flatten ( ++ List.map ( ++ fun f -> ++ [ "/" ^ f ^ ".o"; "/" ^ f ^ ".ko"; "/" ^ f ^ ".ko.xz" ] ++ ) candidates ++ ) in ++ let candidate = ++ try ++ List.find ( ++ fun m -> ++ List.exists (String.is_suffix m) all_candidates ++ ) modules ++ with Not_found -> ++ (* No known module found, pick an arbitrary one ++ * (the first). ++ *) ++ List.hd modules in ++ let candidate = modpath ^ candidate in ++ g#file_architecture (g#realpath candidate) in + + (* Just return the module names, without path or extension. *) + let modules = List.filter_map ( +-- +2.21.0 + diff --git a/SOURCES/0005-RHEL-7-v2v-Select-correct-qemu-binary-for-o-qemu-mod.patch b/SOURCES/0005-RHEL-7-v2v-Select-correct-qemu-binary-for-o-qemu-mod.patch deleted file mode 100644 index df40a29..0000000 --- a/SOURCES/0005-RHEL-7-v2v-Select-correct-qemu-binary-for-o-qemu-mod.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 03d534fcb1d7ab336d9c7de6b791b42797c35aeb 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 952660de2..72a4ec9b6 100644 ---- a/v2v/output_qemu.ml -+++ b/v2v/output_qemu.ml -@@ -71,7 +71,7 @@ object - * module deals with shell and qemu comma quoting. - *) - let cmd = Qemuopts.create () in -- Qemuopts.set_binary_by_arch cmd (Some guestcaps.gcaps_arch); -+ Qemuopts.set_binary cmd "/usr/libexec/qemu-kvm"; - - let flag = Qemuopts.flag cmd - and arg = Qemuopts.arg cmd --- -2.20.1 - diff --git a/SOURCES/0005-v2v-o-libvirt-write-win2k19-osinfo-ID.patch b/SOURCES/0005-v2v-o-libvirt-write-win2k19-osinfo-ID.patch new file mode 100644 index 0000000..36bf42c --- /dev/null +++ b/SOURCES/0005-v2v-o-libvirt-write-win2k19-osinfo-ID.patch @@ -0,0 +1,34 @@ +From 5686e157c90ccbe65d7c719f53d36028b6364b11 Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Thu, 28 Feb 2019 11:00:27 +0100 +Subject: [PATCH] v2v: -o libvirt: write win2k19 osinfo ID + +When writing the libosinfo metadata in the libvirt XML, use the newly +added (in osinfo-db) ID for Windows Server 2019; sadly, this version of +Windows has the same version as Windows Server 2016, so distinguish it +by looking at its product name. + +(cherry picked from commit bb11507fff8c65275afc0f29806d3b3de387c7f9) +--- + v2v/create_libvirt_xml.ml | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/v2v/create_libvirt_xml.ml b/v2v/create_libvirt_xml.ml +index a8dc1f2f0..dbc24315f 100644 +--- a/v2v/create_libvirt_xml.ml ++++ b/v2v/create_libvirt_xml.ml +@@ -124,6 +124,11 @@ let get_osinfo_id = function + | { i_type = "windows"; i_major_version = 6; i_minor_version = 3 } -> + Some "http://microsoft.com/win/8.1" + ++ | { i_type = "windows"; i_major_version = 10; i_minor_version = 0; ++ i_product_variant = "Server"; i_product_name = product } ++ when String.find product "2019" >= 0 -> ++ Some "http://microsoft.com/win/2k19" ++ + | { i_type = "windows"; i_major_version = 10; i_minor_version = 0; + i_product_variant = "Server" } -> + Some "http://microsoft.com/win/2k16" +-- +2.21.0 + diff --git a/SOURCES/0006-RHEL-7-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch b/SOURCES/0006-RHEL-7-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch deleted file mode 100644 index d2627a3..0000000 --- a/SOURCES/0006-RHEL-7-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 49da490111d1d1ef839c914da2bce9a234d22dcf 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 | 3 ++- - v2v/virt-v2v.pod | 13 ------------- - 2 files changed, 2 insertions(+), 14 deletions(-) - -diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml -index d88d0a579..d6f99fa00 100644 ---- a/v2v/cmdline.ml -+++ b/v2v/cmdline.ml -@@ -220,7 +220,6 @@ let parse_cmdline () = - s_"Use password from file"; - [ L"print-source" ], Getopt.Set print_source, - s_"Print source and stop"; -- [ L"qemu-boot" ], Getopt.Set qemu_boot, s_"Boot in qemu (-o qemu only)"; - [ L"root" ], Getopt.String ("ask|... ", set_root_choice), - s_"How to choose root filesystem"; - [ L"vddk-config" ], Getopt.String ("filename", set_string_option_once "--vddk-config" vddk_config), -@@ -507,6 +506,8 @@ read the man page virt-v2v(1). - | Some d when not (is_directory d) -> - error (f_"-os %s: output directory does not exist or is not a directory") d - | Some d -> d in -+ if qemu_boot then -+ error (f_"-o qemu: the --qemu-boot option cannot be used in RHEL"); - Output_qemu.output_qemu os qemu_boot, - output_format, output_alloc - -diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod -index 484e14747..1c06502ec 100644 ---- a/v2v/virt-v2v.pod -+++ b/v2v/virt-v2v.pod -@@ -114,11 +114,6 @@ Since F 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 INPUT AND OUTPUT MODES - - ┌────────────┐ ┌─────────▶ -o null -@@ -517,9 +512,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> B - - This is the same as I<-o rhv>. -@@ -609,11 +601,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> --- -2.20.1 - diff --git a/SOURCES/0006-v2v-update-documentation-on-nbdkit-RHBZ-1605242.patch b/SOURCES/0006-v2v-update-documentation-on-nbdkit-RHBZ-1605242.patch new file mode 100644 index 0000000..9deb351 --- /dev/null +++ b/SOURCES/0006-v2v-update-documentation-on-nbdkit-RHBZ-1605242.patch @@ -0,0 +1,55 @@ +From 6bb859d7992908aa09619b8afd487464724c72a5 Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Fri, 12 Apr 2019 16:19:43 +0200 +Subject: [PATCH] v2v: update documentation on nbdkit (RHBZ#1605242) + +nbdkit >= 1.6 ships a VDDK plugin always built, so recommend that +version instead of recommending to build nbdkit from sources. + +(cherry picked from commit 0704d8eb0bcc8139886eb4291f75a3ca49a91e58) +--- + v2v/virt-v2v-input-vmware.pod | 28 ++-------------------------- + 1 file changed, 2 insertions(+), 26 deletions(-) + +diff --git a/v2v/virt-v2v-input-vmware.pod b/v2v/virt-v2v-input-vmware.pod +index 2b6dbaeec..b3ebda182 100644 +--- a/v2v/virt-v2v-input-vmware.pod ++++ b/v2v/virt-v2v-input-vmware.pod +@@ -197,32 +197,8 @@ library is permitted by the license. + + =item 2. + +-You must also compile nbdkit, enabling the VDDK plugin. nbdkit E +-1.1.25 is recommended, but it is usually best to compile from the git +-tree. +- +-=over 4 +- +-=item * +- +-L +- +-=item * +- +-L +- +-=back +- +-Compile nbdkit as described in the sources (see link above). +- +-You do B need to run C because you can run nbdkit +-from its source directory. The source directory has a shell script +-called F which runs the locally built copy of nbdkit and its +-plugins. So set C<$PATH> to point to the nbdkit top build directory +-(that is, the directory containing the shell script called F), +-eg: +- +- export PATH=/path/to/nbdkit-1.1.x:$PATH ++nbdkit E 1.6 is recommended, as it ships with the VDDK plugin ++enabled unconditionally. + + =item 3. + +-- +2.21.0 + diff --git a/SOURCES/0007-RHEL-7-move-VIRTIO_DEVICE_NAME-macro-to-guestfs-inte.patch b/SOURCES/0007-RHEL-7-move-VIRTIO_DEVICE_NAME-macro-to-guestfs-inte.patch deleted file mode 100644 index 66df5bb..0000000 --- a/SOURCES/0007-RHEL-7-move-VIRTIO_DEVICE_NAME-macro-to-guestfs-inte.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 0595e70eaf58a80095db24f4d119148cde577ae7 Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Fri, 2 Mar 2018 16:22:35 +0100 -Subject: [PATCH] RHEL 7: move VIRTIO_DEVICE_NAME() macro to guestfs-internal.h - -This way it can be used also in other places than launch-direct.c. ---- - lib/guestfs-internal.h | 11 +++++++++++ - lib/launch-direct.c | 11 ----------- - 2 files changed, 11 insertions(+), 11 deletions(-) - -diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h -index adeb9478a..8e4e30a20 100644 ---- a/lib/guestfs-internal.h -+++ b/lib/guestfs-internal.h -@@ -136,6 +136,17 @@ - /* Maximum size of Windows explorer.exe. 2.6MB on Windows 7. */ - #define MAX_WINDOWS_EXPLORER_SIZE (4 * 1000 * 1000) - -+/* Differences in qemu device names on ARMv7 (virtio-mmio), s/390x -+ * (CCW) vs normal hardware with PCI. -+ */ -+#if defined(__arm__) -+#define VIRTIO_DEVICE_NAME(type) type "-device" -+#elif defined(__s390x__) -+#define VIRTIO_DEVICE_NAME(type) type "-ccw" -+#else -+#define VIRTIO_DEVICE_NAME(type) type "-pci" -+#endif -+ - /* Machine types. */ - #ifdef __arm__ - #define MACHINE_TYPE "virt" -diff --git a/lib/launch-direct.c b/lib/launch-direct.c -index 47e8f37de..f6c494d69 100644 ---- a/lib/launch-direct.c -+++ b/lib/launch-direct.c -@@ -49,17 +49,6 @@ - #include "guestfs_protocol.h" - #include "qemuopts.h" - --/* Differences in qemu device names on ARMv7 (virtio-mmio), s/390x -- * (CCW) vs normal hardware with PCI. -- */ --#if defined(__arm__) --#define VIRTIO_DEVICE_NAME(type) type "-device" --#elif defined(__s390x__) --#define VIRTIO_DEVICE_NAME(type) type "-ccw" --#else --#define VIRTIO_DEVICE_NAME(type) type "-pci" --#endif -- - /* Per-handle data. */ - struct backend_direct_data { - pid_t pid; /* Qemu PID. */ --- -2.20.1 - diff --git a/SOURCES/0007-v2v-linux-add-helper-functions-for-pkg-arch-and-exte.patch b/SOURCES/0007-v2v-linux-add-helper-functions-for-pkg-arch-and-exte.patch new file mode 100644 index 0000000..a175019 --- /dev/null +++ b/SOURCES/0007-v2v-linux-add-helper-functions-for-pkg-arch-and-exte.patch @@ -0,0 +1,62 @@ +From f3574733eeda9952aa13f36e4ae40a8c5c0a5479 Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Tue, 26 Mar 2019 17:02:02 +0100 +Subject: [PATCH] v2v: linux: add helper functions for pkg arch and extension + +Add helper functions to get the typical extension of binary packages +for a package manager, and the string for an architecture. + +(cherry picked from commit 13ef175a7b3a010175d57d60b2c4c51bc0efb171) +--- + v2v/linux.ml | 21 +++++++++++++++++++++ + v2v/linux.mli | 8 ++++++++ + 2 files changed, 29 insertions(+) + +diff --git a/v2v/linux.ml b/v2v/linux.ml +index 99b0e0e7b..4949c8e16 100644 +--- a/v2v/linux.ml ++++ b/v2v/linux.ml +@@ -179,3 +179,24 @@ let is_package_manager_save_file filename = + (* Recognized suffixes of package managers. *) + let suffixes = [ ".dpkg-old"; ".dpkg-new"; ".rpmsave"; ".rpmnew"; ] in + List.exists (Filename.check_suffix filename) suffixes ++ ++let binary_package_extension { i_package_format = package_format } = ++ match package_format with ++ | "deb" -> "deb" ++ | "rpm" -> "rpm" ++ | format -> ++ error (f_"don’t know what is the extension of binary packages using %s") ++ format ++ ++let architecture_string { i_package_format = package_format; i_arch = arch; ++ i_distro = distro } = ++ match package_format, distro, arch with ++ | "deb", _, "x86_64" -> "amd64" ++ | "deb", _, a -> a ++ | "rpm", ("sles"|"suse-based"|"opensuse"), "i386" -> "i586" ++ | "rpm", ("sles"|"suse-based"|"opensuse"), a -> a ++ | "rpm", _, "i386" -> "i686" ++ | "rpm", _, a -> a ++ | format, distro, arch -> ++ error (f_"don’t know what is the architecture string of %s using %s on %s") ++ arch format distro +diff --git a/v2v/linux.mli b/v2v/linux.mli +index 0a5991d12..30099745c 100644 +--- a/v2v/linux.mli ++++ b/v2v/linux.mli +@@ -38,3 +38,11 @@ val is_file_owned : Guestfs.guestfs -> Types.inspect -> string -> bool + val is_package_manager_save_file : string -> bool + (** Return true if the filename is something like [*.rpmsave], ie. + a package manager save-file. *) ++ ++val binary_package_extension : Types.inspect -> string ++(** Return the extension typically used for binary packages in the ++ specified package format. *) ++ ++val architecture_string : Types.inspect -> string ++(** Return the architecture string typically used for binary packages ++ in the specified package format, and for the specified distro. *) +-- +2.21.0 + diff --git a/SOURCES/0008-RHEL-7-Revert-tests-rsync-Skip-this-test-when-the-ba.patch b/SOURCES/0008-RHEL-7-Revert-tests-rsync-Skip-this-test-when-the-ba.patch deleted file mode 100644 index 7881f58..0000000 --- a/SOURCES/0008-RHEL-7-Revert-tests-rsync-Skip-this-test-when-the-ba.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 2f258581f9c706c5c92d0986e7bae8583ce145dd 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 c6d98cfd1..246396276 100755 ---- a/tests/rsync/test-rsync.sh -+++ b/tests/rsync/test-rsync.sh -@@ -26,33 +26,10 @@ skip_if_skipped - skip_unless rsync --help - skip_unless_feature_available rsync - --# 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 - - pwd="$(pwd)" - datadir="$(cd ../../test-data/files && pwd)" -@@ -66,7 +43,7 @@ port="$(awk 'BEGIN{srand(); print 65000+int(500*rand())}' rsyncd.conf < +Date: Tue, 26 Mar 2019 17:10:38 +0100 +Subject: [PATCH] v2v: try to pick the right arch for qemu-ga pkgs + +Right now the code copies, and then tries to install, all the files +found for the directory of a distro. This does not take into account +differences in the architectures of the packages available, so a x86_64 +package must be installed only on x86_64 guests. + +As solution, filter the packages using the typical suffix used by +packages (so architecture + file extension), to pick only packages +compatible with the current guest. + +(cherry picked from commit 78f08a15faca826d4f3320834eb06309ccf3ec94) +--- + v2v/windows_virtio.ml | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/v2v/windows_virtio.ml b/v2v/windows_virtio.ml +index 92bf3ec60..a499fcf8a 100644 +--- a/v2v/windows_virtio.ml ++++ b/v2v/windows_virtio.ml +@@ -203,10 +203,19 @@ and install_linux_tools g inspect = + | Some os -> + let src_path = "linux" // os in + let dst_path = "/var/tmp" in ++ let pkg_arch = Linux.architecture_string inspect in ++ let pkg_ext = Linux.binary_package_extension inspect in ++ let package_suffixes = [ ++ sprintf ".%s.%s" pkg_arch pkg_ext; ++ sprintf "_%s.%s" pkg_arch pkg_ext; ++ ] in ++ let package_filter path _ = ++ List.exists (String.is_suffix path) package_suffixes ++ in + debug "locating packages in %s" src_path; + let packages = + copy_from_virtio_win g inspect src_path dst_path +- (fun _ _ -> true) ++ package_filter + (fun () -> + warning (f_"guest tools directory ‘%s’ is missing from the virtio-win directory or ISO.\n\nGuest tools are only provided in the RHV Guest Tools ISO, so this can happen if you are using the version of virtio-win which contains just the virtio drivers. In this case only virtio drivers can be installed in the guest, and installation of Guest Tools will be skipped.") + src_path) in +-- +2.21.0 + diff --git a/SOURCES/0009-RHEL-7-Revert-appliance-Change-example-ping-lines-to.patch b/SOURCES/0009-RHEL-7-Revert-appliance-Change-example-ping-lines-to.patch deleted file mode 100644 index 6adb338..0000000 --- a/SOURCES/0009-RHEL-7-Revert-appliance-Change-example-ping-lines-to.patch +++ /dev/null @@ -1,28 +0,0 @@ -From b96e9847b5644b0449ee1824eed5d9eb22d221f1 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 6a61a8d6e..f530ad3d5 100755 ---- a/appliance/init -+++ b/appliance/init -@@ -160,7 +160,8 @@ if test "$guestfs_verbose" = 1 && test "$guestfs_boot_analysis" != 1; 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 --- -2.20.1 - diff --git a/SOURCES/0009-v2v-change-the-reporting-of-RHV-Tools-messages-warni.patch b/SOURCES/0009-v2v-change-the-reporting-of-RHV-Tools-messages-warni.patch new file mode 100644 index 0000000..3e1ce93 --- /dev/null +++ b/SOURCES/0009-v2v-change-the-reporting-of-RHV-Tools-messages-warni.patch @@ -0,0 +1,56 @@ +From 4bb9affd19b7312af3c48cf141d695b4ec8f5656 Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Tue, 26 Mar 2019 17:37:56 +0100 +Subject: [PATCH] v2v: change the reporting of RHV Tools + messages/warnings/error + +The RHV Tools ISO is provided as Red Hat only product, and thus not +available for all the virt-v2v users. Hence, change the way we report +the status of the installation of the qemu guest agent from the RHV +Tools ISO: +- do not warn if virt-v2v does not know how to install the package for + the current guest +- do not warn if the ISO does not contain packages for the current guest +- on successful installations, show an info message + +Related: RHBZ#1691659 +(cherry picked from commit cbf887ed90e0ecb5c52fd2c663acb5b9b2e3e14a) +--- + v2v/windows_virtio.ml | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) + +diff --git a/v2v/windows_virtio.ml b/v2v/windows_virtio.ml +index a499fcf8a..f3302aed6 100644 +--- a/v2v/windows_virtio.ml ++++ b/v2v/windows_virtio.ml +@@ -197,9 +197,7 @@ and install_linux_tools g inspect = + | _ -> None in + + match os with +- | None -> +- warning (f_"don't know how to install guest tools on %s-%d") +- inspect.i_distro inspect.i_major_version ++ | None -> () + | Some os -> + let src_path = "linux" // os in + let dst_path = "/var/tmp" in +@@ -216,13 +214,13 @@ and install_linux_tools g inspect = + let packages = + copy_from_virtio_win g inspect src_path dst_path + package_filter +- (fun () -> +- warning (f_"guest tools directory ‘%s’ is missing from the virtio-win directory or ISO.\n\nGuest tools are only provided in the RHV Guest Tools ISO, so this can happen if you are using the version of virtio-win which contains just the virtio drivers. In this case only virtio drivers can be installed in the guest, and installation of Guest Tools will be skipped.") +- src_path) in ++ (fun () -> ()) in + debug "done copying %d files" (List.length packages); + let packages = List.map ((//) dst_path) packages in + try + Linux.install_local g inspect packages; ++ if packages <> [] then ++ info (f_"QEMU Guest Agent installed for this guest."); + with G.Error msg -> + warning (f_"failed to install QEMU Guest Agent: %s") msg + +-- +2.21.0 + diff --git a/SOURCES/0010-RHEL-7-Revert-launch-libvirt-Use-qemu-bridge-helper-.patch b/SOURCES/0010-RHEL-7-Revert-launch-libvirt-Use-qemu-bridge-helper-.patch deleted file mode 100644 index 8d78f46..0000000 --- a/SOURCES/0010-RHEL-7-Revert-launch-libvirt-Use-qemu-bridge-helper-.patch +++ /dev/null @@ -1,119 +0,0 @@ -From af775f107327930e5d81bd63b5c682bb6925ba21 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. ---- - lib/guestfs.pod | 10 ---------- - lib/launch-libvirt.c | 44 +++++++++++++++++++++----------------------- - 2 files changed, 21 insertions(+), 33 deletions(-) - -diff --git a/lib/guestfs.pod b/lib/guestfs.pod -index 684f8dc6c..0b8c9f7d2 100644 ---- a/lib/guestfs.pod -+++ b/lib/guestfs.pod -@@ -1451,16 +1451,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/lib/launch-libvirt.c b/lib/launch-libvirt.c -index 844023b80..f0f52fba0 100644 ---- a/lib/launch-libvirt.c -+++ b/lib/launch-libvirt.c -@@ -115,7 +115,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)*/ - struct version libvirt_version; /* libvirt version */ -@@ -437,12 +436,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_int_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); - - if (g->enable_network && check_bridge_exists (g, data->network_bridge) == -1) -@@ -1402,19 +1395,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 (); -- } -- - /* Libvirt adds some devices by default. Indicate to libvirt - * that we don't want them. - */ -@@ -1810,6 +1790,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_DEVICE_NAME ("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") { -@@ -2135,9 +2136,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; -- - for (i = 0; i < data->nr_secrets; ++i) - free (data->secrets[i].secret); - free (data->secrets); --- -2.20.1 - diff --git a/SOURCES/0010-v2v-fix-path-to-source-when-copying-files-from-guest.patch b/SOURCES/0010-v2v-fix-path-to-source-when-copying-files-from-guest.patch new file mode 100644 index 0000000..e60d9e1 --- /dev/null +++ b/SOURCES/0010-v2v-fix-path-to-source-when-copying-files-from-guest.patch @@ -0,0 +1,41 @@ +From 1fc6b5a843dce740fd766c3a65ae378730fc9126 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= +Date: Fri, 8 Feb 2019 11:44:41 +0100 +Subject: [PATCH] v2v: fix path to source when copying files from guest tools + directory +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The debug message was slightly changed too to better match the similar +message for ISO case. It refers to the root directory instead of the +specific subdirectory inside guest tools. + +Signed-off-by: Tomáš Golembiovský +(cherry picked from commit f4bda5571a36da42bdc800c10f2c85cf20bf5c85) +--- + v2v/windows_virtio.ml | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/v2v/windows_virtio.ml b/v2v/windows_virtio.ml +index f3302aed6..59b0bf493 100644 +--- a/v2v/windows_virtio.ml ++++ b/v2v/windows_virtio.ml +@@ -315,10 +315,11 @@ and copy_drivers g inspect driverdir = + and copy_from_virtio_win g inspect srcdir destdir filter missing = + let ret = ref [] in + if is_directory virtio_win then ( ++ debug "windows: copy_from_virtio_win: guest tools source directory %s" ++ virtio_win; ++ + let dir = virtio_win // srcdir in +- debug "windows: copy_from_virtio_win: guest tools source directory %s" dir; +- +- if not (is_directory srcdir) then missing () ++ if not (is_directory dir) then missing () + else ( + let cmd = sprintf "cd %s && find -L -type f" (quote dir) in + let paths = external_command cmd in +-- +2.21.0 + diff --git a/SOURCES/0011-RHEL-7-Revert-launch-libvirt-Better-error-when-bridg.patch b/SOURCES/0011-RHEL-7-Revert-launch-libvirt-Better-error-when-bridg.patch deleted file mode 100644 index d0c9baf..0000000 --- a/SOURCES/0011-RHEL-7-Revert-launch-libvirt-Better-error-when-bridg.patch +++ /dev/null @@ -1,86 +0,0 @@ -From cdc0aab726f8fc9145c264fb7277f622ae8b7956 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Mon, 21 Sep 2015 12:38:50 -0400 -Subject: [PATCH] RHEL 7: Revert "launch: libvirt: Better error when bridge / - virbr0 doesn't exist (RHBZ#1262127)." - -This reverts commit edcd02a965ae6675c0ee9ecd8d98a1a641c6ef60. ---- - lib/launch-libvirt.c | 47 -------------------------------------------- - 1 file changed, 47 deletions(-) - -diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c -index f0f52fba0..c709c4fe2 100644 ---- a/lib/launch-libvirt.c -+++ b/lib/launch-libvirt.c -@@ -155,7 +155,6 @@ static int is_blk (const char *path); - static void ignore_errors (void *ignore, virErrorPtr ignore2); - static void set_socket_create_context (guestfs_h *g); - static void clear_socket_create_context (guestfs_h *g); --static int check_bridge_exists (guestfs_h *g, const char *brname); - - #if HAVE_LIBSELINUX - static void selinux_warning (guestfs_h *g, const char *func, const char *selinux_op, const char *data); -@@ -438,9 +437,6 @@ launch_libvirt (guestfs_h *g, void *datav, const char *libvirt_uri) - guestfs_int_get_backend_setting_bool (g, "internal_libvirt_norelabel_disks"); - guestfs_pop_error_handler (g); - -- if (g->enable_network && check_bridge_exists (g, data->network_bridge) == -1) -- goto cleanup; -- - /* Locate and/or build the appliance. */ - TRACE0 (launch_build_libvirt_appliance_start); - -@@ -2048,49 +2044,6 @@ is_blk (const char *path) - return S_ISBLK (statbuf.st_mode); - } - --static int --is_dir (const char *path) --{ -- struct stat statbuf; -- -- if (stat (path, &statbuf) == -1) -- return 0; -- return S_ISDIR (statbuf.st_mode); --} -- --/* Used to check the network_bridge exists, or give a useful error -- * message. -- */ --static int --check_bridge_exists (guestfs_h *g, const char *brname) --{ -- CLEANUP_FREE char *path = NULL; -- -- /* If this doesn't look like Linux, give up. */ -- if (!is_dir ("/sys/class/net")) -- return 0; -- -- /* Does the interface exist and is it a bridge? */ -- path = safe_asprintf (g, "/sys/class/net/%s/bridge", brname); -- if (is_dir (path)) -- return 0; -- -- error (g, -- _("bridge ‘%s’ not found. Try running:\n" -- "\n" -- " brctl show\n" -- "\n" -- "to get a list of bridges on the host, and then selecting the\n" -- "bridge you wish the appliance network to connect to using:\n" -- "\n" -- " export LIBGUESTFS_BACKEND_SETTINGS=network_bridge=\n" -- "\n" -- "You may also need to allow the bridge in /etc/qemu/bridge.conf.\n" -- "For further information see guestfs(3)."), -- brname); -- return -1; --} -- - static void - ignore_errors (void *ignore, virErrorPtr ignore2) - { --- -2.20.1 - diff --git a/SOURCES/0011-v2v-warn-when-the-guest-has-direct-network-interface.patch b/SOURCES/0011-v2v-warn-when-the-guest-has-direct-network-interface.patch new file mode 100644 index 0000000..ab082c0 --- /dev/null +++ b/SOURCES/0011-v2v-warn-when-the-guest-has-direct-network-interface.patch @@ -0,0 +1,48 @@ +From 6a89d52b408885a8151939798ab5dfb57fac3fda Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Fri, 12 Apr 2019 17:28:12 +0200 +Subject: [PATCH] v2v: warn when the guest has direct network interfaces + (RHBZ#1518539) + +virt-v2v obviously cannot convert this kind of devices, since they are +specific to the host of the hypervisor. Thus, emit a warning about the +presence of direct network interfaces, so at least this can be noticed +when converting a guest. + +(cherry picked from commit 1629ec6a5639cf5e226e80bcee749ae8851b1fae) +--- + v2v/parse_libvirt_xml.ml | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml +index d5d78d367..b9970cee8 100644 +--- a/v2v/parse_libvirt_xml.ml ++++ b/v2v/parse_libvirt_xml.ml +@@ -492,6 +492,24 @@ let parse_libvirt_xml ?conn xml = + ) + in + ++ (* Check for direct attachments to physical network interfaces. ++ * (RHBZ#1518539) ++ *) ++ let () = ++ let obj = Xml.xpath_eval_expression xpathctx "/domain/devices/interface[@type='direct']" in ++ let nr_nodes = Xml.xpathobj_nr_nodes obj in ++ if nr_nodes > 0 then ( ++ (* Sadly fn_ in ocaml-gettext seems broken, and always returns the ++ * singular string no matter what. Work around this by using a simple ++ * string with sn_ (which works), and outputting it as a whole. ++ *) ++ let msg = sn_ "this guest has a direct network interface which will be ignored" ++ "this guest has direct network interfaces which will be ignored" ++ nr_nodes in ++ warning "%s" msg ++ ) ++ in ++ + ({ + s_hypervisor = hypervisor; + s_name = name; s_orig_name = name; +-- +2.21.0 + diff --git a/SOURCES/0012-RHEL-7-Revert-appliance-add-dhcp-client-on-Mageia.patch b/SOURCES/0012-RHEL-7-Revert-appliance-add-dhcp-client-on-Mageia.patch deleted file mode 100644 index e1cea31..0000000 --- a/SOURCES/0012-RHEL-7-Revert-appliance-add-dhcp-client-on-Mageia.patch +++ /dev/null @@ -1,26 +0,0 @@ -From cfa7f9277cfafb5e461c03c2734c08d97b4a5d06 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 8ded2588a..d70451309 100644 ---- a/appliance/packagelist.in -+++ b/appliance/packagelist.in -@@ -200,7 +200,7 @@ ifelse(MAGEIA,1, - chkconfig /* for /etc/init.d */ - cdrkit-genisoimage - cdrkit-isotools -- dhcp-client -+ dhclient - extlinux - gfs2-utils - grub --- -2.20.1 - diff --git a/SOURCES/0012-Use-proper-label-for-nbdkit-sockets.patch b/SOURCES/0012-Use-proper-label-for-nbdkit-sockets.patch new file mode 100644 index 0000000..20e3da6 --- /dev/null +++ b/SOURCES/0012-Use-proper-label-for-nbdkit-sockets.patch @@ -0,0 +1,63 @@ +From d161370dbc97786e05d476ccaed219fa14d7bf1b Mon Sep 17 00:00:00 2001 +From: Martin Kletzander +Date: Mon, 27 May 2019 13:30:05 +0200 +Subject: [PATCH] Use proper label for nbdkit sockets + +While svirt_t can be used for sockets it does not always guarantee that it will +be accessible from a virtual machine. The VM might be running under svirt_tcg_t +context which will need a svirt_tcg_t label on the socket in order to access it. + +There is, however, another label, svirt_socket_t, which is accessible from +virt_domain: + + # sesearch -A -s svirt_t -c unix_stream_socket -p connectto + ... + allow virt_domain svirt_socket_t:unix_stream_socket { ... connectto ... }; + ... + +And virt_domain is a type attribute of both svirt_t and svirt_tcg_t: + + # seinfo -x -a virt_domain + Type Attributes: 1 + attribute virt_domain; + svirt_t + svirt_tcg_t + +Resolves: https://bugzilla.redhat.com/1698437 + +Signed-off-by: Martin Kletzander +(cherry picked from commit c2918b8b74506523a723b804d452816a059c5e50) +--- + v2v/input_libvirt_vddk.ml | 2 +- + v2v/output_rhv_upload.ml | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/v2v/input_libvirt_vddk.ml b/v2v/input_libvirt_vddk.ml +index 97c7cb532..567233d58 100644 +--- a/v2v/input_libvirt_vddk.ml ++++ b/v2v/input_libvirt_vddk.ml +@@ -290,7 +290,7 @@ object + add_arg "--newstyle"; (* use newstyle NBD protocol *) + add_arg "--exportname"; add_arg "/"; + if have_selinux then ( (* label the socket so qemu can open it *) +- add_arg "--selinux-label"; add_arg "system_u:object_r:svirt_t:s0" ++ add_arg "--selinux-label"; add_arg "system_u:object_r:svirt_socket_t:s0" + ); + + (* Name of the plugin. Everything following is a plugin parameter. *) +diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml +index 77c39107e..c2a5c72c7 100644 +--- a/v2v/output_rhv_upload.ml ++++ b/v2v/output_rhv_upload.ml +@@ -217,7 +217,7 @@ See also the virt-v2v-output-rhv(1) manual.") + let args = + (* label the socket so qemu can open it *) + if have_selinux then +- args @ ["--selinux-label"; "system_u:object_r:svirt_t:s0"] ++ args @ ["--selinux-label"; "system_u:object_r:svirt_socket_t:s0"] + else args in + args in + +-- +2.21.0 + diff --git a/SOURCES/0013-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch b/SOURCES/0013-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch new file mode 100644 index 0000000..088a285 --- /dev/null +++ b/SOURCES/0013-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch @@ -0,0 +1,38 @@ +From f85ba4df62aee865fcb986125b2f6b6ae4f82b06 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. +--- + lib/launch-unix.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/lib/launch-unix.c b/lib/launch-unix.c +index 4794a7b13..993b83601 100644 +--- a/lib/launch-unix.c ++++ b/lib/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; +@@ -106,6 +112,7 @@ launch_unix (guestfs_h *g, void *datav, const char *sockpath) + g->conn = NULL; + } + return -1; ++#endif + } + + static int +-- +2.21.0 + diff --git a/SOURCES/0013-RHEL-7-Revert-appliance-add-dhcpcd-and-gptfdisk-on-A.patch b/SOURCES/0013-RHEL-7-Revert-appliance-add-dhcpcd-and-gptfdisk-on-A.patch deleted file mode 100644 index c83cd3d..0000000 --- a/SOURCES/0013-RHEL-7-Revert-appliance-add-dhcpcd-and-gptfdisk-on-A.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 612d0ee8454f6fb51779b3cc96e6414605f2c112 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 d70451309..81a8f0dba 100644 ---- a/appliance/packagelist.in -+++ b/appliance/packagelist.in -@@ -110,8 +110,7 @@ ifelse(ARCHLINUX,1, - cdrkit - cdrtools - cryptsetup -- dhcpcd -- gptfdisk -+ dhclient - grub - hivex - iproute2 --- -2.20.1 - diff --git a/SOURCES/0014-RHEL-7-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch b/SOURCES/0014-RHEL-7-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch new file mode 100644 index 0000000..8baf8c1 --- /dev/null +++ b/SOURCES/0014-RHEL-7-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch @@ -0,0 +1,372 @@ +From 8ab4bf975c58806c56a3689df3f1757f5738b1c8 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 | 224 -------------------------------------- + daemon/Makefile.am | 1 - + docs/C_SOURCE_FILES | 1 - + generator/actions_core.ml | 21 ---- + generator/proc_nr.ml | 2 - + gobject/Makefile.inc | 2 - + po/POTFILES | 2 - + 8 files changed, 1 insertion(+), 254 deletions(-) + delete mode 100644 daemon/9p.c + +diff --git a/Makefile.am b/Makefile.am +index 0067d7b7b..e9351eadc 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -78,7 +78,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 55644249d..000000000 +--- a/daemon/9p.c ++++ /dev/null +@@ -1,224 +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" +- +-static char *read_whole_file (const char *filename); +- +-/* https://bugzilla.redhat.com/show_bug.cgi?id=714981#c1 */ +-char ** +-do_list_9p (void) +-{ +- CLEANUP_FREE_STRINGSBUF 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 take_stringsbuf (&r); +- } +- +- while (1) { +- struct dirent *d; +- +- errno = 0; +- d = readdir (dir); +- if (d == NULL) break; +- +- if (STRPREFIX (d->d_name, "virtio")) { +- CLEANUP_FREE char *mount_tag_path = NULL; +- if (asprintf (&mount_tag_path, BUS_PATH "/%s/mount_tag", +- d->d_name) == -1) { +- reply_with_perror ("asprintf"); +- closedir (dir); +- return NULL; +- } +- +- /* 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"); +- closedir (dir); +- return NULL; +- } +- +- /* Close the directory handle */ +- if (closedir (dir) == -1) { +- reply_with_perror ("closedir: /sys/block"); +- 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 take_stringsbuf (&r); +-} +- +-/* 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, 0, 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, +- "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 5d1c222db..a9b40be25 100644 +--- a/daemon/Makefile.am ++++ b/daemon/Makefile.am +@@ -76,7 +76,6 @@ guestfsd_SOURCES = \ + ../common/protocol/guestfs_protocol.h \ + ../common/utils/cleanups.h \ + ../common/utils/guestfs-utils.h \ +- 9p.c \ + acl.c \ + actions.h \ + available.c \ +diff --git a/docs/C_SOURCE_FILES b/docs/C_SOURCE_FILES +index 7f1c60b30..f45e7124d 100644 +--- a/docs/C_SOURCE_FILES ++++ b/docs/C_SOURCE_FILES +@@ -71,7 +71,6 @@ common/windows/windows.h + customize/crypt-c.c + customize/dummy.c + customize/perl_edit-c.c +-daemon/9p.c + daemon/acl.c + daemon/actions.h + daemon/augeas.c +diff --git a/generator/actions_core.ml b/generator/actions_core.ml +index 7b6568b90..f4f0d0ab6 100644 +--- a/generator/actions_core.ml ++++ b/generator/actions_core.ml +@@ -6167,27 +6167,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"; added = (1, 11, 12); +- style = RStringList (RPlainString, "mounttags"), [], []; +- 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"; added = (1, 11, 12); +- style = RErr, [String (PlainString, "mounttag"); String (PlainString, "mountpoint")], [OString "options"]; +- 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"; added = (1, 11, 15); + style = RStringList (RDevice, "devices"), [], []; +diff --git a/generator/proc_nr.ml b/generator/proc_nr.ml +index efa8c5d21..3fd365d28 100644 +--- a/generator/proc_nr.ml ++++ b/generator/proc_nr.ml +@@ -295,8 +295,6 @@ let proc_nr = [ + 282, "internal_autosync"; + 283, "is_zero"; + 284, "is_zero_device"; +-285, "list_9p"; +-286, "mount_9p"; + 287, "list_dm_devices"; + 288, "ntfsresize"; + 289, "btrfs_filesystem_resize"; +diff --git a/gobject/Makefile.inc b/gobject/Makefile.inc +index 067f861a9..7afe83c59 100644 +--- a/gobject/Makefile.inc ++++ b/gobject/Makefile.inc +@@ -93,7 +93,6 @@ guestfs_gobject_headers= \ + include/guestfs-gobject/optargs-mksquashfs.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 \ +@@ -186,7 +185,6 @@ guestfs_gobject_sources= \ + src/optargs-mksquashfs.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 79f4b8c56..b99333d0d 100644 +--- a/po/POTFILES ++++ b/po/POTFILES +@@ -58,7 +58,6 @@ customize/crypt-c.c + customize/dummy.c + customize/perl_edit-c.c + customize/test-password.pl +-daemon/9p.c + daemon/acl.c + daemon/augeas.c + daemon/available.c +@@ -291,7 +290,6 @@ gobject/src/optargs-mkfs_btrfs.c + gobject/src/optargs-mksquashfs.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 +-- +2.21.0 + diff --git a/SOURCES/0014-RHEL-7-Revert-appliance-Use-dhclient-or-dhcpcd-inste.patch b/SOURCES/0014-RHEL-7-Revert-appliance-Use-dhclient-or-dhcpcd-inste.patch deleted file mode 100644 index e623b9f..0000000 --- a/SOURCES/0014-RHEL-7-Revert-appliance-Use-dhclient-or-dhcpcd-inste.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 88ccab22e0af7ffe4c2ffa9a01e39e5f6f693722 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 | 15 ++++++--------- - appliance/packagelist.in | 7 ------- - 2 files changed, 6 insertions(+), 16 deletions(-) - -diff --git a/appliance/init b/appliance/init -index f530ad3d5..1cd264e08 100755 ---- a/appliance/init -+++ b/appliance/init -@@ -120,15 +120,12 @@ shopt -u nullglob - ip addr add 127.0.0.1/8 brd + dev lo scope host - ip link set dev lo up - --if test "$guestfs_network" = 1; then -- iface=$(ls -I all -I default -I lo /proc/sys/net/ipv4/conf) -- touch /etc/fstab # Workaround for Ubuntu. -- if dhclient --version >/dev/null 2>&1; then -- dhclient $iface -- else -- dhcpcd $iface -- 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 but don't run arrays unless all expected drives are present - mdadm -As --auto=yes --no-degraded -diff --git a/appliance/packagelist.in b/appliance/packagelist.in -index 81a8f0dba..1e7d53481 100644 ---- a/appliance/packagelist.in -+++ b/appliance/packagelist.in -@@ -26,7 +26,6 @@ ifelse(REDHAT,1, - augeas-libs - cryptsetup - cryptsetup-luks dnl old name used before Fedora 17 -- dhclient - genisoimage - gfs-utils - gfs2-utils -@@ -76,7 +75,6 @@ dnl iproute has been renamed to iproute2 - iputils-ping - iputils-arping - iputils-tracepath -- isc-dhcp-client - ldmtool - libaugeas0 - libc-bin -@@ -110,7 +108,6 @@ ifelse(ARCHLINUX,1, - cdrkit - cdrtools - cryptsetup -- dhclient - grub - hivex - iproute2 -@@ -141,8 +138,6 @@ ifelse(SUSE,1, - btrfsprogs - cdrkit-cdrtools-compat - cryptsetup -- dhcpcd -- dhcp-client - genisoimage - glibc-locale - gptfdisk -@@ -171,7 +166,6 @@ ifelse(FRUGALWARE,1, - augeas - cryptsetup-luks - cdrkit -- dhclient - grub2 - hfsplus - iproute2 -@@ -199,7 +193,6 @@ ifelse(MAGEIA,1, - chkconfig /* for /etc/init.d */ - cdrkit-genisoimage - cdrkit-isotools -- dhclient - extlinux - gfs2-utils - grub --- -2.20.1 - diff --git a/SOURCES/0015-RHEL-7-Disable-alternate-Augeas-lenses.patch b/SOURCES/0015-RHEL-7-Disable-alternate-Augeas-lenses.patch deleted file mode 100644 index 90e6c2e..0000000 --- a/SOURCES/0015-RHEL-7-Disable-alternate-Augeas-lenses.patch +++ /dev/null @@ -1,60 +0,0 @@ -From d7174bcc5290e4ef4996541bed93f0df7e680578 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 | 1 - - daemon/augeas.c | 5 ++++- - 2 files changed, 4 insertions(+), 2 deletions(-) - -diff --git a/appliance/Makefile.am b/appliance/Makefile.am -index 6cba8d158..16714b197 100644 ---- a/appliance/Makefile.am -+++ b/appliance/Makefile.am -@@ -91,7 +91,6 @@ supermin.d/daemon.tar.gz: ../daemon/guestfsd guestfs_shadow.aug - rm -rf tmp-d - 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)/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 453251337..003fcd313 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; - } --- -2.20.1 - diff --git a/SOURCES/0015-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch b/SOURCES/0015-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch new file mode 100644 index 0000000..75786de --- /dev/null +++ b/SOURCES/0015-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch @@ -0,0 +1,611 @@ +From 160af2de6f4eaa49c1717ecd52547826d24b78e3 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. +--- + docs/guestfs-testing.pod | 20 ----- + fish/guestfish.pod | 66 ++-------------- + fish/test-add-uri.sh | 32 -------- + generator/actions_core.ml | 50 +------------ + lib/drives.c | 8 ++ + lib/guestfs.pod | 100 ------------------------- + tests/disks/test-qemu-drive-libvirt.sh | 28 ------- + tests/disks/test-qemu-drive.sh | 60 --------------- + 8 files changed, 16 insertions(+), 348 deletions(-) + +diff --git a/docs/guestfs-testing.pod b/docs/guestfs-testing.pod +index f558964bf..8f264ed17 100644 +--- a/docs/guestfs-testing.pod ++++ b/docs/guestfs-testing.pod +@@ -109,26 +109,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. +- +-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 06644c5b8..15e20c427 100644 +--- a/fish/guestfish.pod ++++ b/fish/guestfish.pod +@@ -131,9 +131,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 + +@@ -1144,12 +1144,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. + +@@ -1159,40 +1159,6 @@ The possible I<-a URI> formats are described below. + + Add the local disk image (or device) called F. + +-=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> +@@ -1227,35 +1193,13 @@ 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] +- + Note that the URIs follow the syntax of + L: in particular, there + are restrictions on the allowed characters for the various components + of the URI. Characters such as C<:>, C<@>, and C B be + percent-encoded: + +- $ guestfish -a ssh://user:pass%40word@example.com/disk.img ++ $ guestfish -a rbd://user:pass%40word@example.com[:port]/pool/disk + + In this case, the password is C. + +diff --git a/fish/test-add-uri.sh b/fish/test-add-uri.sh +index 756df997b..8f84fd31b 100755 +--- a/fish/test-add-uri.sh ++++ b/fish/test-add-uri.sh +@@ -40,14 +40,6 @@ function fail () + $VG guestfish -x -a file://$abs_builddir/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 +@@ -67,29 +59,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 +- +-# iSCSI +-$VG guestfish -x -a iscsi://example.com/iqn.2015-12.com.libguestfs:test1/0 test-add-uri.out 2>&1 +-grep -sq 'add_drive "iqn.2015-12.com.libguestfs:test1/0" "protocol:iscsi" "server:tcp:example.com"' test-add-uri.out || fail +- +-$VG guestfish -x -a iscsi://user:password@example.com/iqn.2015-12.com.libguestfs:test2/0 test-add-uri.out 2>&1 +-grep -sq 'add_drive "iqn.2015-12.com.libguestfs:test2/0" "protocol:iscsi" "server:tcp:example.com" "username:user" "secret:password"' test-add-uri.out || fail +- + rm test-add-uri.out + rm test-add-uri.img +diff --git a/generator/actions_core.ml b/generator/actions_core.ml +index f4f0d0ab6..eb82c21b0 100644 +--- a/generator/actions_core.ml ++++ b/generator/actions_core.ml +@@ -297,29 +297,6 @@ F 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. +-The C parameter may be supplied. See below. +-The C parameter may be supplied. See below. +- +-See also: L. +- + =item C + + Connect to the Network Block Device server. +@@ -336,22 +313,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 +@@ -362,13 +323,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: +@@ -384,10 +340,10 @@ for the protocol is used (see F). + + =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/lib/drives.c b/lib/drives.c +index 82ef30093..ba5d07ed0 100644 +--- a/lib/drives.c ++++ b/lib/drives.c +@@ -165,6 +165,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) +@@ -223,6 +224,7 @@ create_drive_gluster (guestfs_h *g, + + return create_drive_non_file (g, data); + } ++#endif /* DISABLED IN RHEL 7 */ + + static int + nbd_port (void) +@@ -291,6 +293,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) +@@ -391,6 +394,7 @@ create_drive_iscsi (guestfs_h *g, + + return create_drive_non_file (g, data); + } ++#endif /* DISABLED IN RHEL 7 */ + + /** + * Create the special F drive. +@@ -826,6 +830,7 @@ guestfs_impl_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); +@@ -850,6 +855,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename, + data.protocol = drive_protocol_iscsi; + drv = create_drive_iscsi (g, &data); + } ++#endif /* DISABLED IN RHEL 7 */ + else if (STREQ (protocol, "nbd")) { + data.protocol = drive_protocol_nbd; + drv = create_drive_nbd (g, &data); +@@ -858,6 +864,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename, + data.protocol = drive_protocol_rbd; + drv = create_drive_rbd (g, &data); + } ++#if 0 /* DISABLED IN RHEL 7 */ + else if (STREQ (protocol, "sheepdog")) { + data.protocol = drive_protocol_sheepdog; + drv = create_drive_sheepdog (g, &data); +@@ -870,6 +877,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename, + data.protocol = drive_protocol_tftp; + drv = create_drive_curl (g, &data); + } ++#endif /* DISABLED IN RHEL 7 */ + else { + error (g, _("unknown protocol ‘%s’"), protocol); + drv = NULL; /*FALLTHROUGH*/ +diff --git a/lib/guestfs.pod b/lib/guestfs.pod +index 53cece2da..6d61759c0 100644 +--- a/lib/guestfs.pod ++++ b/lib/guestfs.pod +@@ -714,70 +714,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. +@@ -840,42 +776,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 e49c69b43..9b1abc4ec 100755 +--- a/tests/disks/test-qemu-drive-libvirt.sh ++++ b/tests/disks/test-qemu-drive-libvirt.sh +@@ -64,34 +64,6 @@ check_output + grep -sq -- '-drive file=rbd:abc-def/ghi-jkl:auth_supported=none,' "$DEBUG_QEMU_FILE" || fail ceph2 + rm "$DEBUG_QEMU_FILE" + +-# Gluster. +- +-$guestfish -d gluster run ||: +-check_output +-grep -sq -- '-drive file=gluster://1.2.3.4:1234/volname/image,' "$DEBUG_QEMU_FILE" || fail gluster +-rm "$DEBUG_QEMU_FILE" +- +-# iSCSI. +- +-$guestfish -d iscsi run ||: +-check_output +-grep -sq -- '-drive file=iscsi://1.2.3.4:1234/iqn.2003-01.org.linux-iscsi.fedora' "$DEBUG_QEMU_FILE" || fail iscsi +-rm "$DEBUG_QEMU_FILE" +- +-# NBD. +- +-$guestfish -d nbd run ||: +-check_output +-grep -sq -- '-drive file=nbd:1.2.3.4:1234,' "$DEBUG_QEMU_FILE" || fail nbd +-rm "$DEBUG_QEMU_FILE" +- +-# Sheepdog. +- +-$guestfish -d sheepdog run ||: +-check_output +-grep -sq -- '-drive file=sheepdog:volume,' "$DEBUG_QEMU_FILE" || fail sheepdog +-rm "$DEBUG_QEMU_FILE" +- + # Local, stored in a pool. + + $guestfish -d pool1 run ||: +diff --git a/tests/disks/test-qemu-drive.sh b/tests/disks/test-qemu-drive.sh +index 19dd60a2f..583e031bd 100755 +--- a/tests/disks/test-qemu-drive.sh ++++ b/tests/disks/test-qemu-drive.sh +@@ -62,45 +62,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: Fri, 24 Apr 2015 09:45:41 -0400 -Subject: [PATCH] RHEL 7: Fix list of supported sound cards to match RHEL qemu - (RHBZ#1176493). - ---- - v2v/utils.ml | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/v2v/utils.ml b/v2v/utils.ml -index e880001eb..812d339e0 100644 ---- a/v2v/utils.ml -+++ b/v2v/utils.ml -@@ -51,13 +51,14 @@ let kvm_arch = function - (* Does qemu support the given sound card? *) - let qemu_supports_sound_card = function - | Types.AC97 -- | Types.ES1370 - | Types.ICH6 - | Types.ICH9 - | Types.PCSpeaker -+ -> true -+ | Types.ES1370 - | Types.SB16 - | Types.USBAudio -- -> true -+ -> false - - (* Find the UEFI firmware. *) - let find_uefi_firmware guest_arch = --- -2.20.1 - diff --git a/SOURCES/0016-RHEL-7-Remove-User-Mode-Linux-RHBZ-1144197.patch b/SOURCES/0016-RHEL-7-Remove-User-Mode-Linux-RHBZ-1144197.patch new file mode 100644 index 0000000..4db30ed --- /dev/null +++ b/SOURCES/0016-RHEL-7-Remove-User-Mode-Linux-RHBZ-1144197.patch @@ -0,0 +1,72 @@ +From 374d1cb44e7a47a646b7e84d635489625189729c 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. +--- + lib/launch-uml.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/lib/launch-uml.c b/lib/launch-uml.c +index da20c17d9..a5e0e8179 100644 +--- a/lib/launch-uml.c ++++ b/lib/launch-uml.c +@@ -44,7 +44,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 * +@@ -81,6 +83,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. + */ +@@ -128,10 +131,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; +@@ -491,8 +501,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. +@@ -522,6 +534,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) +-- +2.21.0 + diff --git a/SOURCES/0017-RHEL-7-v2v-Select-correct-qemu-binary-for-o-qemu-mod.patch b/SOURCES/0017-RHEL-7-v2v-Select-correct-qemu-binary-for-o-qemu-mod.patch new file mode 100644 index 0000000..ebdb92d --- /dev/null +++ b/SOURCES/0017-RHEL-7-v2v-Select-correct-qemu-binary-for-o-qemu-mod.patch @@ -0,0 +1,33 @@ +From 723e73b2d3174bc7e83561cd014fbfdf9f16f619 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 1f6798aaf..8665d7b5c 100644 +--- a/v2v/output_qemu.ml ++++ b/v2v/output_qemu.ml +@@ -81,7 +81,7 @@ object + * module deals with shell and qemu comma quoting. + *) + let cmd = Qemuopts.create () in +- Qemuopts.set_binary_by_arch cmd (Some guestcaps.gcaps_arch); ++ Qemuopts.set_binary cmd "/usr/libexec/qemu-kvm"; + + let flag = Qemuopts.flag cmd + and arg = Qemuopts.arg cmd +-- +2.21.0 + diff --git a/SOURCES/0017-RHEL-7-v2v-efi-Remove-references-to-Fedora-kraxel-s-.patch b/SOURCES/0017-RHEL-7-v2v-efi-Remove-references-to-Fedora-kraxel-s-.patch deleted file mode 100644 index b67cddf..0000000 --- a/SOURCES/0017-RHEL-7-v2v-efi-Remove-references-to-Fedora-kraxel-s-.patch +++ /dev/null @@ -1,43 +0,0 @@ -From ff8c65944b77224f6e3faa7e8f92f6300be075f2 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 30 Apr 2015 17:20:26 -0400 -Subject: [PATCH] RHEL 7: v2v: efi: Remove references to Fedora / kraxel's OVMF - packages. - ---- - generator/UEFI.ml | 6 ------ - v2v/utils.ml | 1 - - 2 files changed, 7 deletions(-) - -diff --git a/generator/UEFI.ml b/generator/UEFI.ml -index 5161e28ee..1ff3f84d2 100644 ---- a/generator/UEFI.ml -+++ b/generator/UEFI.ml -@@ -30,12 +30,6 @@ open Docstrings - - (* Order is significant *within architectures only*. *) - let firmware = [ -- "i386", -- "/usr/share/edk2.git/ovmf-ia32/OVMF_CODE-pure-efi.fd", -- None, -- "/usr/share/edk2.git/ovmf-ia32/OVMF_VARS-pure-efi.fd", -- []; -- - "x86_64", - "/usr/share/OVMF/OVMF_CODE.fd", - None, -diff --git a/v2v/utils.ml b/v2v/utils.ml -index 812d339e0..436acb5f1 100644 ---- a/v2v/utils.ml -+++ b/v2v/utils.ml -@@ -65,7 +65,6 @@ let find_uefi_firmware guest_arch = - let files = - (* The lists of firmware are actually defined in common/utils/uefi.c. *) - match guest_arch with -- | "i386" | "i486" | "i586" | "i686" -> Uefi.uefi_i386_firmware - | "x86_64" -> Uefi.uefi_x86_64_firmware - | "aarch64" -> Uefi.uefi_aarch64_firmware - | arch -> --- -2.20.1 - diff --git a/SOURCES/0018-RHEL-7-Reject-use-of-libguestfs-winsupport-features-.patch b/SOURCES/0018-RHEL-7-Reject-use-of-libguestfs-winsupport-features-.patch deleted file mode 100644 index bd758d9..0000000 --- a/SOURCES/0018-RHEL-7-Reject-use-of-libguestfs-winsupport-features-.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 72f59ab23727b2b83bb9109d9ea2ea555c727321 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 7 Jul 2015 09:28:03 -0400 -Subject: [PATCH] RHEL 7: Reject use of libguestfs-winsupport features except - for virt-* tools (RHBZ#1240276). - ---- - generator/c.ml | 17 +++++++++++++++++ - 1 file changed, 17 insertions(+) - -diff --git a/generator/c.ml b/generator/c.ml -index 0366866e2..8ecc63d0b 100644 ---- a/generator/c.ml -+++ b/generator/c.ml -@@ -1826,12 +1826,29 @@ and generate_client_actions actions () = - pr " const uint64_t progress_hint = 0;\n"; - - pr "\n"; -+ - enter_event name; - check_null_strings c_name style; - reject_unknown_optargs c_name style; - check_args_validity c_name style; - trace_call name c_name style; - -+ (* RHEL 7 *) -+ if name = "mount" || name = "mount_ro" || name = "mount_options" || -+ name = "mount_vfs" then ( -+ pr " if (g->program && !STRPREFIX (g->program, \"virt-\")) {\n"; -+ pr " CLEANUP_FREE char *vfs_type = guestfs_vfs_type (g, mountable);\n"; -+ pr " if (vfs_type && STREQ (vfs_type, \"ntfs\")) {\n"; -+ pr " error (g, \"mount: unsupported filesystem type\");\n"; -+ pr " if (trace_flag)\n"; -+ pr " guestfs_int_trace (g, \"%%s = %%s (error)\",\n"; -+ pr " \"%s\", \"-1\");\n" name; -+ pr " return %s;\n" (string_of_errcode errcode); -+ pr " }\n"; -+ pr " }\n"; -+ pr "\n"; -+ ); -+ - (* Calculate the total size of all FileIn arguments to pass - * as a progress bar hint. - *) --- -2.20.1 - diff --git a/SOURCES/0018-RHEL-7-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch b/SOURCES/0018-RHEL-7-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch new file mode 100644 index 0000000..075c84f --- /dev/null +++ b/SOURCES/0018-RHEL-7-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch @@ -0,0 +1,105 @@ +From 625701598f958502623738a9a7b93d1807e98706 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 | 3 ++- + v2v/virt-v2v-output-local.pod | 6 ++---- + v2v/virt-v2v.pod | 13 ------------- + 3 files changed, 4 insertions(+), 18 deletions(-) + +diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml +index 46f6910d0..aa89428c5 100644 +--- a/v2v/cmdline.ml ++++ b/v2v/cmdline.ml +@@ -240,7 +240,6 @@ let parse_cmdline () = + s_"Estimate size of source and stop"; + [ L"print-source" ], Getopt.Set print_source, + s_"Print source and stop"; +- [ L"qemu-boot" ], Getopt.Set qemu_boot, s_"Boot in qemu (-o qemu only)"; + [ L"root" ], Getopt.String ("ask|... ", set_root_choice), + s_"How to choose root filesystem"; + [ L"vddk-config" ], Getopt.String ("filename", set_input_option_compat "vddk-config"), +@@ -588,6 +587,8 @@ read the man page virt-v2v(1). + | Some d when not (is_directory d) -> + error (f_"-os %s: output directory does not exist or is not a directory") d + | Some d -> d in ++ if qemu_boot then ++ error (f_"-o qemu: the --qemu-boot option cannot be used in RHEL"); + Output_qemu.output_qemu os qemu_boot, + output_format, output_alloc + +diff --git a/v2v/virt-v2v-output-local.pod b/v2v/virt-v2v-output-local.pod +index 7427b1ed7..455d51fba 100644 +--- a/v2v/virt-v2v-output-local.pod ++++ b/v2v/virt-v2v-output-local.pod +@@ -9,7 +9,7 @@ or libvirt + + virt-v2v [-i* options] -o local -os DIRECTORY + +- virt-v2v [-i* options] -o qemu -os DIRECTORY [--qemu-boot] ++ virt-v2v [-i* options] -o qemu -os DIRECTORY + + virt-v2v [-i* options] -o null + +@@ -47,12 +47,10 @@ where C is the guest name. + + =item B<-o qemu -os> C + +-=item B<-o qemu -os> C B<--qemu-boot> +- + This converts the guest to files in C. Unlike I<-o local> + above, a shell script is created which contains the raw qemu command + you would need to boot the guest. However the shell script is not +-run, I you also add the I<--qemu-boot> option. ++run. + + =item B<-o null> + +diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod +index cf9464834..0e9627829 100644 +--- a/v2v/virt-v2v.pod ++++ b/v2v/virt-v2v.pod +@@ -142,11 +142,6 @@ Since F 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 +@@ -480,9 +475,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> B + + This is the same as I<-o rhv>. +@@ -758,11 +750,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> +-- +2.21.0 + diff --git a/SOURCES/0019-RHEL-7-Disable-alternate-Augeas-lenses.patch b/SOURCES/0019-RHEL-7-Disable-alternate-Augeas-lenses.patch new file mode 100644 index 0000000..6d2f7d2 --- /dev/null +++ b/SOURCES/0019-RHEL-7-Disable-alternate-Augeas-lenses.patch @@ -0,0 +1,60 @@ +From e7a123793726b1e56121f59fe39fe40c1154b5bf 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 | 1 - + daemon/augeas.c | 5 ++++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/appliance/Makefile.am b/appliance/Makefile.am +index fc424b1d0..5efc5c036 100644 +--- a/appliance/Makefile.am ++++ b/appliance/Makefile.am +@@ -91,7 +91,6 @@ supermin.d/daemon.tar.gz: ../daemon/guestfsd guestfs_shadow.aug + rm -rf tmp-d + 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)/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 453251337..003fcd313 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; + } +-- +2.21.0 + diff --git a/SOURCES/0019-RHEL-7-daemon-umount-all-Hack-to-avoid-umount-sysroo.patch b/SOURCES/0019-RHEL-7-daemon-umount-all-Hack-to-avoid-umount-sysroo.patch deleted file mode 100644 index 19a9c45..0000000 --- a/SOURCES/0019-RHEL-7-daemon-umount-all-Hack-to-avoid-umount-sysroo.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 585cde451b1b6ba28765022f67731fafca3e1be5 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 23 Jul 2015 18:15:36 -0400 -Subject: [PATCH] RHEL 7: daemon: umount-all: Hack to avoid umount: /sysroot: - target is busy (RHBZ#1246032). - -This bug is not properly understood (although readily reproducible). -However this hack makes it go away for now. - -https://bugzilla.redhat.com/show_bug.cgi?id=1246032 ---- - daemon/mount.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/daemon/mount.c b/daemon/mount.c -index 61ce64449..b038a89c3 100644 ---- a/daemon/mount.c -+++ b/daemon/mount.c -@@ -28,6 +28,8 @@ - #include - #include - -+#include "ignore-value.h" -+ - #include "daemon.h" - #include "actions.h" - -@@ -306,6 +308,9 @@ do_umount_all (void) - if (mounts.size > 0) - qsort (mounts.argv, mounts.size, sizeof (char *), compare_longest_first); - -+ /* Hack to work around RHBZ#1246032. */ -+ ignore_value (system ("lsof /sysroot")); -+ - /* Unmount them. */ - for (i = 0; i < mounts.size; ++i) { - CLEANUP_FREE char *err = NULL; --- -2.20.1 - diff --git a/SOURCES/0020-RHEL-7-Fix-list-of-supported-sound-cards-to-match-RH.patch b/SOURCES/0020-RHEL-7-Fix-list-of-supported-sound-cards-to-match-RH.patch new file mode 100644 index 0000000..783cb58 --- /dev/null +++ b/SOURCES/0020-RHEL-7-Fix-list-of-supported-sound-cards-to-match-RH.patch @@ -0,0 +1,34 @@ +From f9c81290cb5a3fc59067ba3f1ea53196dcb6eec8 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Fri, 24 Apr 2015 09:45:41 -0400 +Subject: [PATCH] RHEL 7: Fix list of supported sound cards to match RHEL qemu + (RHBZ#1176493). + +--- + v2v/utils.ml | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/v2v/utils.ml b/v2v/utils.ml +index 74b501f81..21e9c9c15 100644 +--- a/v2v/utils.ml ++++ b/v2v/utils.ml +@@ -51,13 +51,14 @@ let kvm_arch = function + (* Does qemu support the given sound card? *) + let qemu_supports_sound_card = function + | Types.AC97 +- | Types.ES1370 + | Types.ICH6 + | Types.ICH9 + | Types.PCSpeaker ++ -> true ++ | Types.ES1370 + | Types.SB16 + | Types.USBAudio +- -> true ++ -> false + + (* Find the UEFI firmware. *) + let find_uefi_firmware guest_arch = +-- +2.21.0 + diff --git a/SOURCES/0020-RHEL-7-Fix-tests-for-libguestfs-winsupport-7.2.patch b/SOURCES/0020-RHEL-7-Fix-tests-for-libguestfs-winsupport-7.2.patch deleted file mode 100644 index 540e05b..0000000 --- a/SOURCES/0020-RHEL-7-Fix-tests-for-libguestfs-winsupport-7.2.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 22230a37e8120a267567db8d74c7994b98aecdde Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Sun, 30 Aug 2015 03:21:57 -0400 -Subject: [PATCH] RHEL 7: Fix tests for libguestfs-winsupport 7.2. - -It doesn't let us use guestfish for arbitrary Windows edits. ---- - test-data/phony-guests/make-windows-img.sh | 1 + - tests/charsets/test-charset-fidelity.c | 2 ++ - v2v/test-v2v-virtio-win-iso.sh | 8 +++++++- - v2v/test-v2v-windows-conversion.sh | 8 +++++++- - 4 files changed, 17 insertions(+), 2 deletions(-) - -diff --git a/test-data/phony-guests/make-windows-img.sh b/test-data/phony-guests/make-windows-img.sh -index d7c3ec9cf..9e556215a 100755 ---- a/test-data/phony-guests/make-windows-img.sh -+++ b/test-data/phony-guests/make-windows-img.sh -@@ -37,6 +37,7 @@ fi - - # Create a disk image. - guestfish < "$script" - :> "$expected" - -+cat >> "$script" < "$response" -+guestfish --ro -a "$d/windows-sda" < "$script" > "$response" - diff -u "$expected" "$response" - - rm -r $d -diff --git a/v2v/test-v2v-windows-conversion.sh b/v2v/test-v2v-windows-conversion.sh -index f1da222a9..ff94fe39b 100755 ---- a/v2v/test-v2v-windows-conversion.sh -+++ b/v2v/test-v2v-windows-conversion.sh -@@ -73,6 +73,12 @@ mktest () - :> "$script" - :> "$expected" - -+cat >> "$script" < "$response" -+guestfish --ro -a "$d/windows-sda" < "$script" > "$response" - diff -u "$expected" "$response" - - # We also update the Registry several times, for firstboot, and (ONLY --- -2.20.1 - diff --git a/SOURCES/0021-RHEL-7-Reject-use-of-libguestfs-winsupport-features-.patch b/SOURCES/0021-RHEL-7-Reject-use-of-libguestfs-winsupport-features-.patch new file mode 100644 index 0000000..eece123 --- /dev/null +++ b/SOURCES/0021-RHEL-7-Reject-use-of-libguestfs-winsupport-features-.patch @@ -0,0 +1,47 @@ +From 9d69c62fac004dd8e9fd4947e0f74b040705d231 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Tue, 7 Jul 2015 09:28:03 -0400 +Subject: [PATCH] RHEL 7: Reject use of libguestfs-winsupport features except + for virt-* tools (RHBZ#1240276). + +--- + generator/c.ml | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/generator/c.ml b/generator/c.ml +index 86f7d89a3..9d7c491c2 100644 +--- a/generator/c.ml ++++ b/generator/c.ml +@@ -1826,12 +1826,29 @@ and generate_client_actions actions () = + pr " const uint64_t progress_hint = 0;\n"; + + pr "\n"; ++ + enter_event name; + check_null_strings c_name style; + reject_unknown_optargs c_name style; + check_args_validity c_name style; + trace_call name c_name style; + ++ (* RHEL 7 *) ++ if name = "mount" || name = "mount_ro" || name = "mount_options" || ++ name = "mount_vfs" then ( ++ pr " if (g->program && !STRPREFIX (g->program, \"virt-\")) {\n"; ++ pr " CLEANUP_FREE char *vfs_type = guestfs_vfs_type (g, mountable);\n"; ++ pr " if (vfs_type && STREQ (vfs_type, \"ntfs\")) {\n"; ++ pr " error (g, \"mount: unsupported filesystem type\");\n"; ++ pr " if (trace_flag)\n"; ++ pr " guestfs_int_trace (g, \"%%s = %%s (error)\",\n"; ++ pr " \"%s\", \"-1\");\n" name; ++ pr " return %s;\n" (string_of_errcode errcode); ++ pr " }\n"; ++ pr " }\n"; ++ pr "\n"; ++ ); ++ + (* Calculate the total size of all FileIn arguments to pass + * as a progress bar hint. + *) +-- +2.21.0 + diff --git a/SOURCES/0021-RHEL-7-Revert-v2v-Add-a-support-matrix-to-the-manual.patch b/SOURCES/0021-RHEL-7-Revert-v2v-Add-a-support-matrix-to-the-manual.patch deleted file mode 100644 index f639a16..0000000 --- a/SOURCES/0021-RHEL-7-Revert-v2v-Add-a-support-matrix-to-the-manual.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 35f39fff27089d79c9f42d304b033b1aa14db430 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Mon, 21 Sep 2015 15:49:17 +0100 -Subject: [PATCH] RHEL 7: Revert "v2v: Add a support matrix to the manual - page." - -This reverts commit a03bffa15a5357d5d0244595caf99607be1ec3ab. ---- - v2v/virt-v2v.pod | 100 ----------------------------------------------- - 1 file changed, 100 deletions(-) - -diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod -index 1c06502ec..f33f9bf62 100644 ---- a/v2v/virt-v2v.pod -+++ b/v2v/virt-v2v.pod -@@ -165,106 +165,6 @@ is only used when virt-v2v runs under VDSM control. - I<--in-place> instructs virt-v2v to customize the guest OS in the input - virtual machine, instead of creating a new VM in the target hypervisor. - --=head1 SUPPORT MATRIX -- --=head2 Hypervisors (Input) -- --=over 4 -- --=item VMware ESXi -- --Must be managed by VMware vCenter E 5.0 unless VDDK is available. -- --=item OVA exported from VMware -- --OVAs from other hypervisors will not work. -- --=item VMX from VMware -- --VMX files generated by other hypervisors will not work. -- --=item RHEL 5 Xen -- --=item SUSE Xen -- --=item Citrix Xen -- --Citrix Xen has not been recently tested. -- --=item Hyper-V -- --Not recently tested. Requires that you export the disk or use --L on Hyper-V. -- --=item Direct from disk images -- --Only disk images exported from supported hypervisors, and using --container formats supported by qemu. -- --=item Physical machines -- --Using the L tool. -- --=back -- --=head2 Hypervisors (Output) -- --QEMU and KVM only. -- --=head2 Virtualization management systems (Output) -- --=over 4 -- --=item OpenStack Glance -- --=item Red Hat Virtualization (RHV) 4.1 and up -- --=item Local libvirt -- --And hence L, L, and similar tools. -- --=item Local disk -- --=back -- --=head2 Guests -- --=over 4 -- --=item Red Hat Enterprise Linux 3, 4, 5, 6, 7 -- --=item CentOS 3, 4, 5, 6, 7 -- --=item Scientific Linux 3, 4, 5, 6, 7 -- --=item Oracle Linux -- --=item Fedora -- --=item SLES 10 and up -- --=item OpenSUSE 10 and up -- --=item Debian 6 and up -- --=item Ubuntu 10.04, 12.04, 14.04, 16.04, and up -- --=item Windows XP to Windows 10 / Windows Server 2016 -- --We use Windows internal version numbers, see --L -- --Currently NT 5.2 to NT 6.3 are supported. -- --See L below for additional notes on converting Windows --guests. -- --=back -- --=head2 Guest firmware -- --BIOS or UEFI for all guest types (but see L below). -- - =head1 OPTIONS - - =over 4 --- -2.20.1 - diff --git a/SOURCES/0022-RHEL-7-All-qemu-kvm-in-RHEL-7-supports-discard-of-qc.patch b/SOURCES/0022-RHEL-7-All-qemu-kvm-in-RHEL-7-supports-discard-of-qc.patch deleted file mode 100644 index 038f057..0000000 --- a/SOURCES/0022-RHEL-7-All-qemu-kvm-in-RHEL-7-supports-discard-of-qc.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 22aa6ba208a06138fb482231877992c1cd31eb4f Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Wed, 27 May 2015 10:03:00 -0400 -Subject: [PATCH] RHEL 7: All qemu-kvm in RHEL 7 supports discard of qcow2 - (RHBZ#1225467). - -For rationale behind this, see: - - https://bugzilla.redhat.com/show_bug.cgi?id=1225467#c2 ---- - lib/qemu.c | 12 ++---------- - 1 file changed, 2 insertions(+), 10 deletions(-) - -diff --git a/lib/qemu.c b/lib/qemu.c -index 6159b5a52..1e52cf75b 100644 ---- a/lib/qemu.c -+++ b/lib/qemu.c -@@ -916,10 +916,6 @@ guestfs_int_discard_possible (guestfs_h *g, struct drive *drv, - * discard option on -drive at all. - */ - bool qemu15 = guestfs_int_version_ge (qemu_version, 1, 5, 0); -- /* qemu >= 1.6. This was the first version that supported unmap on -- * qcow2 backing files. -- */ -- bool qemu16 = guestfs_int_version_ge (qemu_version, 1, 6, 0); - - if (!qemu15) - NOT_SUPPORTED (g, false, -@@ -944,12 +940,8 @@ guestfs_int_discard_possible (guestfs_h *g, struct drive *drv, - } - else if (STREQ (drv->src.format, "raw")) - /* OK */ ; -- else if (STREQ (drv->src.format, "qcow2")) { -- if (!qemu16) -- NOT_SUPPORTED (g, false, -- _("discard cannot be enabled on this drive: " -- "qemu < 1.6 cannot do discard on qcow2 files")); -- } -+ else if (STREQ (drv->src.format, "qcow2")) -+ /* OK */ ; - else { - /* It's possible in future other formats will support discard, but - * currently (qemu 1.7) none of them do. --- -2.20.1 - diff --git a/SOURCES/0022-RHEL-7-daemon-umount-all-Hack-to-avoid-umount-sysroo.patch b/SOURCES/0022-RHEL-7-daemon-umount-all-Hack-to-avoid-umount-sysroo.patch new file mode 100644 index 0000000..40097c5 --- /dev/null +++ b/SOURCES/0022-RHEL-7-daemon-umount-all-Hack-to-avoid-umount-sysroo.patch @@ -0,0 +1,40 @@ +From 6e6a24eee5335a0909d1bdf488ed4ff28b876b7c Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 23 Jul 2015 18:15:36 -0400 +Subject: [PATCH] RHEL 7: daemon: umount-all: Hack to avoid umount: /sysroot: + target is busy (RHBZ#1246032). + +This bug is not properly understood (although readily reproducible). +However this hack makes it go away for now. + +https://bugzilla.redhat.com/show_bug.cgi?id=1246032 +--- + daemon/mount.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/daemon/mount.c b/daemon/mount.c +index 61ce64449..b038a89c3 100644 +--- a/daemon/mount.c ++++ b/daemon/mount.c +@@ -28,6 +28,8 @@ + #include + #include + ++#include "ignore-value.h" ++ + #include "daemon.h" + #include "actions.h" + +@@ -306,6 +308,9 @@ do_umount_all (void) + if (mounts.size > 0) + qsort (mounts.argv, mounts.size, sizeof (char *), compare_longest_first); + ++ /* Hack to work around RHBZ#1246032. */ ++ ignore_value (system ("lsof /sysroot")); ++ + /* Unmount them. */ + for (i = 0; i < mounts.size; ++i) { + CLEANUP_FREE char *err = NULL; +-- +2.21.0 + diff --git a/SOURCES/0023-RHEL-7-Fix-tests-for-libguestfs-winsupport-7.2.patch b/SOURCES/0023-RHEL-7-Fix-tests-for-libguestfs-winsupport-7.2.patch new file mode 100644 index 0000000..122bb6a --- /dev/null +++ b/SOURCES/0023-RHEL-7-Fix-tests-for-libguestfs-winsupport-7.2.patch @@ -0,0 +1,93 @@ +From 8c73e56b0de14c53b056fb7b90f0070aff2b41cd Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Sun, 30 Aug 2015 03:21:57 -0400 +Subject: [PATCH] RHEL 7: Fix tests for libguestfs-winsupport 7.2. + +It doesn't let us use guestfish for arbitrary Windows edits. +--- + test-data/phony-guests/make-windows-img.sh | 1 + + tests/charsets/test-charset-fidelity.c | 2 ++ + v2v/test-v2v-virtio-win-iso.sh | 8 +++++++- + v2v/test-v2v-windows-conversion.sh | 8 +++++++- + 4 files changed, 17 insertions(+), 2 deletions(-) + +diff --git a/test-data/phony-guests/make-windows-img.sh b/test-data/phony-guests/make-windows-img.sh +index 8676b5ac0..1a88d9fc9 100755 +--- a/test-data/phony-guests/make-windows-img.sh ++++ b/test-data/phony-guests/make-windows-img.sh +@@ -37,6 +37,7 @@ fi + + # Create a disk image. + guestfish < "$script" + :> "$expected" + ++cat >> "$script" < "$response" ++guestfish --ro -a "$d/windows-sda" < "$script" > "$response" + diff -u "$expected" "$response" + + rm -r $d +diff --git a/v2v/test-v2v-windows-conversion.sh b/v2v/test-v2v-windows-conversion.sh +index f1da222a9..ff94fe39b 100755 +--- a/v2v/test-v2v-windows-conversion.sh ++++ b/v2v/test-v2v-windows-conversion.sh +@@ -73,6 +73,12 @@ mktest () + :> "$script" + :> "$expected" + ++cat >> "$script" < "$response" ++guestfish --ro -a "$d/windows-sda" < "$script" > "$response" + diff -u "$expected" "$response" + + # We also update the Registry several times, for firstboot, and (ONLY +-- +2.21.0 + diff --git a/SOURCES/0023-RHEL-7-tests-Disable-daemon-tests-that-require-the-u.patch b/SOURCES/0023-RHEL-7-tests-Disable-daemon-tests-that-require-the-u.patch deleted file mode 100644 index 468d9f9..0000000 --- a/SOURCES/0023-RHEL-7-tests-Disable-daemon-tests-that-require-the-u.patch +++ /dev/null @@ -1,28 +0,0 @@ -From b2d12237ae3b1ffeb343cf40ef528a2c0caa97da Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Mon, 21 Sep 2015 13:12:43 -0400 -Subject: [PATCH] RHEL 7: tests: Disable daemon tests that require the 'unix' - backend. - ---- - tests/daemon/Makefile.am | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/tests/daemon/Makefile.am b/tests/daemon/Makefile.am -index 053cad3e1..0d723fee4 100644 ---- a/tests/daemon/Makefile.am -+++ b/tests/daemon/Makefile.am -@@ -23,9 +23,7 @@ include $(top_srcdir)/subdir-rules.mk - - check_DATA = captive-daemon.pm - --TESTS = \ -- test-daemon-start.pl \ -- test-btrfs.pl -+TESTS = - - TESTS_ENVIRONMENT = $(top_builddir)/run --test - --- -2.20.1 - diff --git a/SOURCES/0024-RHEL-7-All-qemu-kvm-in-RHEL-7-supports-discard-of-qc.patch b/SOURCES/0024-RHEL-7-All-qemu-kvm-in-RHEL-7-supports-discard-of-qc.patch new file mode 100644 index 0000000..71c8d95 --- /dev/null +++ b/SOURCES/0024-RHEL-7-All-qemu-kvm-in-RHEL-7-supports-discard-of-qc.patch @@ -0,0 +1,46 @@ +From 94f599ab3f423af768c9b32a689450c64e8876bc Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Wed, 27 May 2015 10:03:00 -0400 +Subject: [PATCH] RHEL 7: All qemu-kvm in RHEL 7 supports discard of qcow2 + (RHBZ#1225467). + +For rationale behind this, see: + + https://bugzilla.redhat.com/show_bug.cgi?id=1225467#c2 +--- + lib/qemu.c | 12 ++---------- + 1 file changed, 2 insertions(+), 10 deletions(-) + +diff --git a/lib/qemu.c b/lib/qemu.c +index 10bb83105..26b63c3b6 100644 +--- a/lib/qemu.c ++++ b/lib/qemu.c +@@ -988,10 +988,6 @@ guestfs_int_discard_possible (guestfs_h *g, struct drive *drv, + * discard option on -drive at all. + */ + bool qemu15 = guestfs_int_version_ge (qemu_version, 1, 5, 0); +- /* qemu >= 1.6. This was the first version that supported unmap on +- * qcow2 backing files. +- */ +- bool qemu16 = guestfs_int_version_ge (qemu_version, 1, 6, 0); + + if (!qemu15) + NOT_SUPPORTED (g, false, +@@ -1016,12 +1012,8 @@ guestfs_int_discard_possible (guestfs_h *g, struct drive *drv, + } + else if (STREQ (drv->src.format, "raw")) + /* OK */ ; +- else if (STREQ (drv->src.format, "qcow2")) { +- if (!qemu16) +- NOT_SUPPORTED (g, false, +- _("discard cannot be enabled on this drive: " +- "qemu < 1.6 cannot do discard on qcow2 files")); +- } ++ else if (STREQ (drv->src.format, "qcow2")) ++ /* OK */ ; + else { + /* It's possible in future other formats will support discard, but + * currently (qemu 1.7) none of them do. +-- +2.21.0 + diff --git a/SOURCES/0024-RHEL-7-v2v-Disable-the-virt-v2v-in-place-option.patch b/SOURCES/0024-RHEL-7-v2v-Disable-the-virt-v2v-in-place-option.patch deleted file mode 100644 index 1511b8e..0000000 --- a/SOURCES/0024-RHEL-7-v2v-Disable-the-virt-v2v-in-place-option.patch +++ /dev/null @@ -1,282 +0,0 @@ -From fb3e89b0fb2d0de3c12a668c00d07c5cfcac9ec0 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 14 Jan 2016 11:53:42 -0500 -Subject: [PATCH] RHEL 7: v2v: Disable the virt-v2v --in-place option. - -This disables the virt-v2v --in-place option which we do not -wish to support in RHEL. -(See commit d0069559a939e47e5f29973ed9a69a13f0b58301). ---- - v2v/Makefile.am | 2 - - v2v/cmdline.ml | 8 +-- - v2v/test-v2v-docs.sh | 2 +- - v2v/test-v2v-in-place.sh | 108 --------------------------------------- - v2v/virt-v2v.pod | 46 +---------------- - 5 files changed, 7 insertions(+), 159 deletions(-) - delete mode 100755 v2v/test-v2v-in-place.sh - -diff --git a/v2v/Makefile.am b/v2v/Makefile.am -index 0c3224b24..424530b1d 100644 ---- a/v2v/Makefile.am -+++ b/v2v/Makefile.am -@@ -330,7 +330,6 @@ if HAVE_LIBVIRT - TESTS += \ - test-v2v-cdrom.sh \ - test-v2v-floppy.sh \ -- test-v2v-in-place.sh \ - test-v2v-networks-and-bridges.sh \ - test-v2v-no-copy.sh \ - test-v2v-o-glance.sh \ -@@ -469,7 +468,6 @@ EXTRA_DIST += \ - test-v2v-i-vmx-3.vmx \ - test-v2v-i-vmx-4.vmx \ - test-v2v-i-vmx-5.vmx \ -- test-v2v-in-place.sh \ - test-v2v-machine-readable.sh \ - test-v2v-networks-and-bridges-expected.xml \ - test-v2v-networks-and-bridges.sh \ -diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml -index d6f99fa00..0bc5e9055 100644 ---- a/v2v/cmdline.ml -+++ b/v2v/cmdline.ml -@@ -194,8 +194,7 @@ let parse_cmdline () = - s_"Input format (for -i disk)"; - [ M"it" ], Getopt.String ("transport", set_string_option_once "-it" input_transport), - s_"Input transport"; -- [ L"in-place" ], Getopt.Set in_place, -- s_"Only tune the guest in the input VM"; -+ [ L"in-place" ], Getopt.Set in_place, Getopt.hidden_option_description; - [ L"machine-readable" ], Getopt.Set machine_readable, - s_"Make output machine readable"; - [ S 'n'; L"network" ], Getopt.String ("in:out", add_network), -@@ -338,7 +337,6 @@ read the man page virt-v2v(1). - printf "vddk\n"; - printf "colours-option\n"; - printf "vdsm-compat-option\n"; -- printf "in-place\n"; - List.iter (printf "input:%s\n") (Modules_list.input_modules ()); - List.iter (printf "output:%s\n") (Modules_list.output_modules ()); - List.iter (printf "convert:%s\n") (Modules_list.convert_modules ()); -@@ -438,6 +436,10 @@ read the man page virt-v2v(1). - error (f_"only ‘-it ssh’ can be used here") in - Input_vmx.input_vmx input_transport arg in - -+ (* Prevent use of --in-place option in RHEL. *) -+ if in_place then -+ error (f_"--in-place cannot be used in RHEL 7"); -+ - (* Common error message. *) - let error_option_cannot_be_used_in_output_mode mode opt = - error (f_"-o %s: %s option cannot be used in this output mode") mode opt -diff --git a/v2v/test-v2v-docs.sh b/v2v/test-v2v-docs.sh -index 5d034c465..c8ca193eb 100755 ---- a/v2v/test-v2v-docs.sh -+++ b/v2v/test-v2v-docs.sh -@@ -22,4 +22,4 @@ $TEST_FUNCTIONS - skip_if_skipped - - $top_srcdir/podcheck.pl virt-v2v.pod virt-v2v \ -- --ignore=--debug-overlay,--ic,--if,--it,--no-trim,--oa,--oc,--of,--on,--os,--vmtype -+ --ignore=--debug-overlay,--ic,--if,--in-place,--it,--no-trim,--oa,--oc,--of,--on,--os,--vmtype -diff --git a/v2v/test-v2v-in-place.sh b/v2v/test-v2v-in-place.sh -deleted file mode 100755 -index 6f7d78f39..000000000 ---- a/v2v/test-v2v-in-place.sh -+++ /dev/null -@@ -1,108 +0,0 @@ --#!/bin/bash - --# libguestfs virt-v2v test script --# Copyright (C) 2014 Red Hat Inc. --# Copyright (C) 2015 Parallels IP Holdings GmbH. --# --# This program is free software; you can redistribute it and/or modify --# it under the terms of the GNU General Public License as published by --# the Free Software Foundation; either version 2 of the License, or --# (at your option) any later version. --# --# This program is distributed in the hope that it will be useful, --# but WITHOUT ANY WARRANTY; without even the implied warranty of --# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --# GNU General Public License for more details. --# --# You should have received a copy of the GNU General Public License --# along with this program; if not, write to the Free Software --# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -- --# Test --in-place. -- --unset CDPATH --export LANG=C --set -e -- --$TEST_FUNCTIONS --skip_if_skipped --skip_if_backend uml --skip_unless_phony_guest windows.img -- --img_base="$abs_top_builddir/test-data/phony-guests/windows.img" -- --export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools" --export VIRTIO_WIN="$top_srcdir/test-data/fake-virtio-win" -- --d=$PWD/test-v2v-in-place.d --rm -rf $d --mkdir $d -- --img="$d/test.qcow2" --rm -f $img --qemu-img create -f qcow2 -b $img_base -o compat=1.1,backing_fmt=raw $img --md5="$(do_md5 $img_base)" -- --libvirt_xml="$d/test.xml" --rm -f $libvirt_xml --n=windows-overlay --cat > $libvirt_xml < -- -- $n -- 1048576 -- -- hvm -- -- -- -- -- -- -- -- -- -- -- --EOF -- --$VG virt-v2v --debug-gc -i libvirt -ic "test://$libvirt_xml" $n --in-place -- --# Test that the drivers have been copied over into the guest --script="$d/test.fish" --expected="$d/expected" --response="$d/response" -- --mktest () --{ -- local cmd="$1" exp="$2" -- -- echo "echo '$cmd'" >> "$script" -- echo "$cmd" >> "$expected" -- -- echo "$cmd" >> "$script" -- echo "$exp" >> "$expected" --} -- --:> "$script" --:> "$expected" -- --firstboot_dir="/Program Files/Guestfs/Firstboot" --mktest "is-dir \"$firstboot_dir\"" true --mktest "is-file \"$firstboot_dir/firstboot.bat\"" true --mktest "is-dir \"$firstboot_dir/scripts\"" true --virtio_dir="/Windows/Drivers/VirtIO" --mktest "is-dir \"$virtio_dir\"" true --for drv in netkvm qxl vioscsi viostor; do -- for sfx in cat inf sys; do -- mktest "is-file \"$virtio_dir/$drv.$sfx\"" true -- done --done -- --guestfish --ro -a "$img" -i < "$script" > "$response" --diff -u "$expected" "$response" -- --# Test the base image remained untouched --test "$md5" = "$(do_md5 $img_base)" -- --# Clean up. --rm -r $d -diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod -index f33f9bf62..0e0fa0f64 100644 ---- a/v2v/virt-v2v.pod -+++ b/v2v/virt-v2v.pod -@@ -15,8 +15,6 @@ virt-v2v - Convert a guest to use KVM - - virt-v2v -i disk disk.img -o glance - -- virt-v2v -ic qemu:///system qemu_guest --in-place -- - =head1 DESCRIPTION - - Virt-v2v converts guests from a foreign hypervisor to run on KVM. It -@@ -162,9 +160,6 @@ booting the guest directly in qemu (mainly for testing). - I<-o rhv> is used to write to a RHV / oVirt target. I<-o vdsm> - is only used when virt-v2v runs under VDSM control. - --I<--in-place> instructs virt-v2v to customize the guest OS in the input --virtual machine, instead of creating a new VM in the target hypervisor. -- - =head1 OPTIONS - - =over 4 -@@ -278,20 +273,6 @@ For I<-i disk> only, this specifies the format of the input disk - image. For other input methods you should specify the input - format in the metadata. - --=item B<--in-place> -- --Do not create an output virtual machine in the target hypervisor. --Instead, adjust the guest OS in the source VM to run in the input --hypervisor. -- --This mode is meant for integration with other toolsets, which take the --responsibility of converting the VM configuration, providing for --rollback in case of errors, transforming the storage, etc. -- --See L below. -- --Conflicts with all I<-o *> options. -- - =item B<-it> B - - When using I<-i vmx>, this enables the ssh transport. -@@ -1979,7 +1960,7 @@ Minimum free space: 10 MB - =head2 Minimum free space check in the host - - You must have sufficient free space in the host directory used to --store temporary overlays (except in I<--in-place> mode). To find out -+store temporary overlays. To find out - which directory this is, use: - - $ df -h "`guestfish get-cachedir`" -@@ -2111,31 +2092,6 @@ that instead. - - - --=head1 IN PLACE CONVERSION -- --It is also possible to use virt-v2v in scenarios where a foreign VM --has already been imported into a KVM-based hypervisor, but still needs --adjustments in the guest to make it run in the new virtual hardware. -- --In that case it is assumed that a third-party tool has created the --target VM in the supported KVM-based hypervisor based on the source VM --configuration and contents, but using virtual devices more appropriate --for KVM (e.g. virtio storage and network, etc.). -- --Then, to make the guest OS boot and run in the changed environment, --one can use: -- -- virt-v2v -ic qemu:///system converted_vm --in-place -- --Virt-v2v will analyze the configuration of C in the --C libvirt instance, and apply various fixups to the --guest OS configuration to make it match the VM configuration. This --may include installing virtio drivers, configuring the bootloader, the --mountpoints, the network interfaces, and so on. -- --Should an error occur during the operation, virt-v2v exits with an --error code leaving the VM in an undefined state. -- - =head1 MACHINE READABLE OUTPUT - - The I<--machine-readable> option can be used to make the output more --- -2.20.1 - diff --git a/SOURCES/0025-RHEL-7-tests-Disable-daemon-tests-that-require-the-u.patch b/SOURCES/0025-RHEL-7-tests-Disable-daemon-tests-that-require-the-u.patch new file mode 100644 index 0000000..0ae95df --- /dev/null +++ b/SOURCES/0025-RHEL-7-tests-Disable-daemon-tests-that-require-the-u.patch @@ -0,0 +1,28 @@ +From 8b147944f3df99a1836384aa4d10fb906e7c6991 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Mon, 21 Sep 2015 13:12:43 -0400 +Subject: [PATCH] RHEL 7: tests: Disable daemon tests that require the 'unix' + backend. + +--- + tests/daemon/Makefile.am | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/tests/daemon/Makefile.am b/tests/daemon/Makefile.am +index 053cad3e1..0d723fee4 100644 +--- a/tests/daemon/Makefile.am ++++ b/tests/daemon/Makefile.am +@@ -23,9 +23,7 @@ include $(top_srcdir)/subdir-rules.mk + + check_DATA = captive-daemon.pm + +-TESTS = \ +- test-daemon-start.pl \ +- test-btrfs.pl ++TESTS = + + TESTS_ENVIRONMENT = $(top_builddir)/run --test + +-- +2.21.0 + diff --git a/SOURCES/0025-RHEL-7-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch b/SOURCES/0025-RHEL-7-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch deleted file mode 100644 index ad803c7..0000000 --- a/SOURCES/0025-RHEL-7-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 595de95272d40f7ddb47c22c187a4bf19982de35 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 2 Mar 2017 14:21:37 +0100 -Subject: [PATCH] RHEL 7: v2v: -i disk: force VNC as display (RHBZ#1372671) - -The SDL output mode is not supported in RHEL 7's qemu-kvm. ---- - v2v/input_disk.ml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/v2v/input_disk.ml b/v2v/input_disk.ml -index 7ecd19fd3..e2b16cf70 100644 ---- a/v2v/input_disk.ml -+++ b/v2v/input_disk.ml -@@ -87,7 +87,7 @@ class input_disk input_format disk = object - s_features = [ "acpi"; "apic"; "pae" ]; - s_firmware = UnknownFirmware; (* causes virt-v2v to autodetect *) - s_display = -- Some { s_display_type = Window; s_keymap = None; s_password = None; -+ Some { s_display_type = VNC; s_keymap = None; s_password = None; - s_listen = LNoListen; s_port = None }; - s_video = None; - s_sound = None; --- -2.20.1 - diff --git a/SOURCES/0026-RHEL-7-v2v-Disable-the-virt-v2v-in-place-option.patch b/SOURCES/0026-RHEL-7-v2v-Disable-the-virt-v2v-in-place-option.patch new file mode 100644 index 0000000..2403cc2 --- /dev/null +++ b/SOURCES/0026-RHEL-7-v2v-Disable-the-virt-v2v-in-place-option.patch @@ -0,0 +1,286 @@ +From 1b36358ede519a700208b95951c2263bde699ad3 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 14 Jan 2016 11:53:42 -0500 +Subject: [PATCH] RHEL 7: v2v: Disable the virt-v2v --in-place option. + +This disables the virt-v2v --in-place option which we do not +wish to support in RHEL. +(See commit d0069559a939e47e5f29973ed9a69a13f0b58301). +--- + v2v/Makefile.am | 2 - + v2v/cmdline.ml | 8 +-- + v2v/test-v2v-docs.sh | 1 + + v2v/test-v2v-in-place.sh | 108 --------------------------------------- + v2v/virt-v2v.pod | 48 +---------------- + 5 files changed, 7 insertions(+), 160 deletions(-) + delete mode 100755 v2v/test-v2v-in-place.sh + +diff --git a/v2v/Makefile.am b/v2v/Makefile.am +index 2312812fb..946170b5d 100644 +--- a/v2v/Makefile.am ++++ b/v2v/Makefile.am +@@ -457,7 +457,6 @@ if HAVE_LIBVIRT + TESTS += \ + test-v2v-cdrom.sh \ + test-v2v-floppy.sh \ +- test-v2v-in-place.sh \ + test-v2v-mac.sh \ + test-v2v-networks-and-bridges.sh \ + test-v2v-no-copy.sh \ +@@ -609,7 +608,6 @@ EXTRA_DIST += \ + test-v2v-i-vmx-3.vmx \ + test-v2v-i-vmx-4.vmx \ + test-v2v-i-vmx-5.vmx \ +- test-v2v-in-place.sh \ + test-v2v-it-vddk-io-query.sh \ + test-v2v-machine-readable.sh \ + test-v2v-mac-expected.xml \ +diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml +index aa89428c5..b7a7f9ad8 100644 +--- a/v2v/cmdline.ml ++++ b/v2v/cmdline.ml +@@ -208,8 +208,7 @@ let parse_cmdline () = + s_"Use password from file to connect to input hypervisor"; + [ M"it" ], Getopt.String ("transport", set_string_option_once "-it" input_transport), + s_"Input transport"; +- [ L"in-place" ], Getopt.Set in_place, +- s_"Only tune the guest in the input VM"; ++ [ L"in-place" ], Getopt.Set in_place, Getopt.hidden_option_description; + [ L"mac" ], Getopt.String ("mac:network|bridge:out", add_mac), + s_"Map NIC to network or bridge"; + [ S 'n'; L"network" ], Getopt.String ("in:out", add_network), +@@ -346,7 +345,6 @@ read the man page virt-v2v(1). + pr "vddk\n"; + pr "colours-option\n"; + pr "vdsm-compat-option\n"; +- pr "in-place\n"; + pr "io/oo\n"; + pr "mac-option\n"; + List.iter (pr "input:%s\n") (Modules_list.input_modules ()); +@@ -509,6 +507,10 @@ read the man page virt-v2v(1). + error (f_"only ‘-it ssh’ can be used here") in + Input_vmx.input_vmx input_transport arg in + ++ (* Prevent use of --in-place option in RHEL. *) ++ if in_place then ++ error (f_"--in-place cannot be used in RHEL 7"); ++ + (* Common error message. *) + let error_option_cannot_be_used_in_output_mode mode opt = + error (f_"-o %s: %s option cannot be used in this output mode") mode opt +diff --git a/v2v/test-v2v-docs.sh b/v2v/test-v2v-docs.sh +index dfb12bb14..2e45705a3 100755 +--- a/v2v/test-v2v-docs.sh ++++ b/v2v/test-v2v-docs.sh +@@ -26,6 +26,7 @@ $top_srcdir/podcheck.pl virt-v2v.pod virt-v2v \ + --debug-overlay,\ + --ic,\ + --if,\ ++--in-place,\ + --io,\ + --ip,\ + --it,\ +diff --git a/v2v/test-v2v-in-place.sh b/v2v/test-v2v-in-place.sh +deleted file mode 100755 +index 6f7d78f39..000000000 +--- a/v2v/test-v2v-in-place.sh ++++ /dev/null +@@ -1,108 +0,0 @@ +-#!/bin/bash - +-# libguestfs virt-v2v test script +-# Copyright (C) 2014 Red Hat Inc. +-# Copyright (C) 2015 Parallels IP Holdings GmbH. +-# +-# This program is free software; you can redistribute it and/or modify +-# it under the terms of the GNU General Public License as published by +-# the Free Software Foundation; either version 2 of the License, or +-# (at your option) any later version. +-# +-# This program is distributed in the hope that it will be useful, +-# but WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-# GNU General Public License for more details. +-# +-# You should have received a copy of the GNU General Public License +-# along with this program; if not, write to the Free Software +-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +- +-# Test --in-place. +- +-unset CDPATH +-export LANG=C +-set -e +- +-$TEST_FUNCTIONS +-skip_if_skipped +-skip_if_backend uml +-skip_unless_phony_guest windows.img +- +-img_base="$abs_top_builddir/test-data/phony-guests/windows.img" +- +-export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools" +-export VIRTIO_WIN="$top_srcdir/test-data/fake-virtio-win" +- +-d=$PWD/test-v2v-in-place.d +-rm -rf $d +-mkdir $d +- +-img="$d/test.qcow2" +-rm -f $img +-qemu-img create -f qcow2 -b $img_base -o compat=1.1,backing_fmt=raw $img +-md5="$(do_md5 $img_base)" +- +-libvirt_xml="$d/test.xml" +-rm -f $libvirt_xml +-n=windows-overlay +-cat > $libvirt_xml < +- +- $n +- 1048576 +- +- hvm +- +- +- +- +- +- +- +- +- +- +- +-EOF +- +-$VG virt-v2v --debug-gc -i libvirt -ic "test://$libvirt_xml" $n --in-place +- +-# Test that the drivers have been copied over into the guest +-script="$d/test.fish" +-expected="$d/expected" +-response="$d/response" +- +-mktest () +-{ +- local cmd="$1" exp="$2" +- +- echo "echo '$cmd'" >> "$script" +- echo "$cmd" >> "$expected" +- +- echo "$cmd" >> "$script" +- echo "$exp" >> "$expected" +-} +- +-:> "$script" +-:> "$expected" +- +-firstboot_dir="/Program Files/Guestfs/Firstboot" +-mktest "is-dir \"$firstboot_dir\"" true +-mktest "is-file \"$firstboot_dir/firstboot.bat\"" true +-mktest "is-dir \"$firstboot_dir/scripts\"" true +-virtio_dir="/Windows/Drivers/VirtIO" +-mktest "is-dir \"$virtio_dir\"" true +-for drv in netkvm qxl vioscsi viostor; do +- for sfx in cat inf sys; do +- mktest "is-file \"$virtio_dir/$drv.$sfx\"" true +- done +-done +- +-guestfish --ro -a "$img" -i < "$script" > "$response" +-diff -u "$expected" "$response" +- +-# Test the base image remained untouched +-test "$md5" = "$(do_md5 $img_base)" +- +-# Clean up. +-rm -r $d +diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod +index 0e9627829..fdaaecfc5 100644 +--- a/v2v/virt-v2v.pod ++++ b/v2v/virt-v2v.pod +@@ -8,10 +8,6 @@ virt-v2v - Convert a guest to use KVM + [-o mode] [other -o* options] + [guest|filename] + +- virt-v2v --in-place +- [-i mode] [other -i* options] +- [guest|filename] +- + =head1 DESCRIPTION + + Virt-v2v converts a single guest from a foreign hypervisor to run on +@@ -39,9 +35,6 @@ these sides of virt-v2v are documented separately in this manual. + + Virt-v2v normally copies from the input to the output, called "copying + mode". In this case the source guest is always left unchanged. +-In-place conversion (I<--in-place>) only uses the I<-i*> options and +-modifies the source guest in-place. (See L +-below.) + + =head2 Other virt-v2v topics + +@@ -255,20 +248,6 @@ For I<-i disk> only, this specifies the format of the input disk + image. For other input methods you should specify the input + format in the metadata. + +-=item B<--in-place> +- +-Do not create an output virtual machine in the target hypervisor. +-Instead, adjust the guest OS in the source VM to run in the input +-hypervisor. +- +-This mode is meant for integration with other toolsets, which take the +-responsibility of converting the VM configuration, providing for +-rollback in case of errors, transforming the storage, etc. +- +-See L below. +- +-Conflicts with all I<-o *> options. +- + =item B<-io> OPTION=VALUE + + Set input option(s) related to the current input mode or transport. +@@ -1270,7 +1249,7 @@ Minimum free space: 10 MB + =head3 Minimum free space check in the host + + You must have sufficient free space in the host directory used to +-store temporary overlays (except in I<--in-place> mode). To find out ++store temporary overlays. To find out + which directory this is, use: + + $ df -h "`guestfish get-cachedir`" +@@ -1373,31 +1352,6 @@ that instead. + + + +-=head2 In-place conversion +- +-It is also possible to use virt-v2v in scenarios where a foreign VM +-has already been imported into a KVM-based hypervisor, but still needs +-adjustments in the guest to make it run in the new virtual hardware. +- +-In that case it is assumed that a third-party tool has created the +-target VM in the supported KVM-based hypervisor based on the source VM +-configuration and contents, but using virtual devices more appropriate +-for KVM (e.g. virtio storage and network, etc.). +- +-Then, to make the guest OS boot and run in the changed environment, +-one can use: +- +- virt-v2v -ic qemu:///system converted_vm --in-place +- +-Virt-v2v will analyze the configuration of C in the +-C libvirt instance, and apply various fixups to the +-guest OS configuration to make it match the VM configuration. This +-may include installing virtio drivers, configuring the bootloader, the +-mountpoints, the network interfaces, and so on. +- +-Should an error occur during the operation, virt-v2v exits with an +-error code leaving the VM in an undefined state. +- + =head2 Machine readable output + + The I<--machine-readable> option can be used to make the output more +-- +2.21.0 + diff --git a/SOURCES/0026-RHEL-7-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-143020.patch b/SOURCES/0026-RHEL-7-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-143020.patch deleted file mode 100644 index f6c49f9..0000000 --- a/SOURCES/0026-RHEL-7-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-143020.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 353671bd139f52b55e9527ff6b3303463e421d81 Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Wed, 8 Mar 2017 11:03:40 +0100 -Subject: [PATCH] RHEL 7: v2v: do not mention SUSE Xen hosts (RHBZ#1430203) - -They are not supported in RHEL 7. ---- - v2v/virt-v2v.pod | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod -index 0e0fa0f64..f8a937960 100644 ---- a/v2v/virt-v2v.pod -+++ b/v2v/virt-v2v.pod -@@ -1520,8 +1520,7 @@ verbose messages. - - =head1 INPUT FROM XEN - --Virt-v2v is able to import Xen guests from RHEL 5 Xen or SLES and --openSUSE Xen hosts. -+Virt-v2v is able to import Xen guests from RHEL 5 Xen hosts. - - Virt-v2v uses libvirt for access to the remote Xen host, and therefore - the input mode should be I<-i libvirt>. As this is the default, you --- -2.20.1 - diff --git a/SOURCES/0027-RHEL-7-v2v-disable-unconfig-of-manually-installed-VM.patch b/SOURCES/0027-RHEL-7-v2v-disable-unconfig-of-manually-installed-VM.patch deleted file mode 100644 index e262228..0000000 --- a/SOURCES/0027-RHEL-7-v2v-disable-unconfig-of-manually-installed-VM.patch +++ /dev/null @@ -1,36 +0,0 @@ -From e4983bad21c2d188d1fb7d7e4cd4d58df1df74ae Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Mon, 14 Aug 2017 10:02:13 +0200 -Subject: [PATCH] RHEL 7: v2v: disable unconfig of manually installed VMware - tools (RHBZ#1477905) - -It looks like they may require connection to the VMware servers, which -is not always available during conversion. ---- - v2v/convert_linux.ml | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml -index 4a7447fe1..7588fbf8e 100644 ---- a/v2v/convert_linux.ml -+++ b/v2v/convert_linux.ml -@@ -352,6 +352,7 @@ let convert (g : G.guestfs) inspect source output rcaps = - let remove = !remove in - Linux.remove g inspect remove; - -+(* - (* VMware Tools may have been installed from a tarball, so the - * above code won't remove it. Look for the uninstall tool and run - * if present. -@@ -373,6 +374,8 @@ let convert (g : G.guestfs) inspect source output rcaps = - warning (f_"VMware tools was detected, but uninstallation failed. The error message was: %s (ignored)") - msg - ) -+*) -+ () - - and unconfigure_citrix () = - let pkgs = --- -2.20.1 - diff --git a/SOURCES/0027-RHEL-7-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch b/SOURCES/0027-RHEL-7-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch new file mode 100644 index 0000000..559d577 --- /dev/null +++ b/SOURCES/0027-RHEL-7-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch @@ -0,0 +1,26 @@ +From e5d78e69ac9629c4a6caeab2547ba9694b9467a2 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 2 Mar 2017 14:21:37 +0100 +Subject: [PATCH] RHEL 7: v2v: -i disk: force VNC as display (RHBZ#1372671) + +The SDL output mode is not supported in RHEL 7's qemu-kvm. +--- + v2v/input_disk.ml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/v2v/input_disk.ml b/v2v/input_disk.ml +index 8321a2a8c..6bd9f43f8 100644 +--- a/v2v/input_disk.ml ++++ b/v2v/input_disk.ml +@@ -89,7 +89,7 @@ class input_disk input_format disk = object + s_features = [ "acpi"; "apic"; "pae" ]; + s_firmware = UnknownFirmware; (* causes virt-v2v to autodetect *) + s_display = +- Some { s_display_type = Window; s_keymap = None; s_password = None; ++ Some { s_display_type = VNC; s_keymap = None; s_password = None; + s_listen = LNoListen; s_port = None }; + s_video = None; + s_sound = None; +-- +2.21.0 + diff --git a/SOURCES/0028-RHEL-7-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-143020.patch b/SOURCES/0028-RHEL-7-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-143020.patch new file mode 100644 index 0000000..22f4337 --- /dev/null +++ b/SOURCES/0028-RHEL-7-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-143020.patch @@ -0,0 +1,26 @@ +From 58d2e8178f649ecb6751534c884b932bd3e4a0e2 Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Wed, 8 Mar 2017 11:03:40 +0100 +Subject: [PATCH] RHEL 7: v2v: do not mention SUSE Xen hosts (RHBZ#1430203) + +They are not supported in RHEL 7. +--- + v2v/virt-v2v-input-xen.pod | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/v2v/virt-v2v-input-xen.pod b/v2v/virt-v2v-input-xen.pod +index 4bb5d2dc2..4cd8e86b4 100644 +--- a/v2v/virt-v2v-input-xen.pod ++++ b/v2v/virt-v2v-input-xen.pod +@@ -10,7 +10,7 @@ virt-v2v-input-xen - Using virt-v2v to convert guests from Xen + =head1 DESCRIPTION + + This page documents how to use L to convert guests from +-RHEL 5 Xen, or SLES and OpenSUSE Xen hosts. ++RHEL 5 Xen hosts. + + =head1 INPUT FROM XEN + +-- +2.21.0 + diff --git a/SOURCES/0028-v2v-Use-Std_utils.qemu_input_filename-instead-of-pre.patch b/SOURCES/0028-v2v-Use-Std_utils.qemu_input_filename-instead-of-pre.patch deleted file mode 100644 index caaae88..0000000 --- a/SOURCES/0028-v2v-Use-Std_utils.qemu_input_filename-instead-of-pre.patch +++ /dev/null @@ -1,33 +0,0 @@ -From d3fd52a8e1241bace8d149ef31f6404dd61f89df Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 22 May 2018 08:09:28 +0100 -Subject: [PATCH] v2v: Use Std_utils.qemu_input_filename instead of prefixing - "file:" to filename (RHBZ#1580292). - -This also allows us to use virt-v2v with the old version of qemu in -RHEL 7. - -Fixes commit e29296cfa20dd691995832940a30fe2e6b98149a. - -Thanks: Pino Toscano for suggesting the fix. -(cherry picked from commit 0c934144eb8ea0ee1e1f68d4975415c001a62556) ---- - v2v/v2v.ml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/v2v/v2v.ml b/v2v/v2v.ml -index 90173b018..6b9bdadf6 100644 ---- a/v2v/v2v.ml -+++ b/v2v/v2v.ml -@@ -726,7 +726,7 @@ and copy_targets cmdline targets input output = - let cmd = - let filename = - match t.target_file with -- | TargetFile filename -> "file:" ^ filename -+ | TargetFile filename -> qemu_input_filename filename - | TargetURI uri -> uri in - [ "qemu-img"; "convert" ] @ - (if not (quiet ()) then [ "-p" ] else []) @ --- -2.20.1 - diff --git a/SOURCES/0029-RHEL-7-v2v-rhv-upload-Remove-restriction-on-oa-spars.patch b/SOURCES/0029-RHEL-7-v2v-rhv-upload-Remove-restriction-on-oa-spars.patch new file mode 100644 index 0000000..dba783d --- /dev/null +++ b/SOURCES/0029-RHEL-7-v2v-rhv-upload-Remove-restriction-on-oa-spars.patch @@ -0,0 +1,91 @@ +From bcc63ea8b4a2d7851f5026d03f2cc41f5dcb98d7 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Mon, 14 May 2018 10:16:58 +0100 +Subject: [PATCH] RHEL 7: v2v: rhv-upload: Remove restriction on -oa sparse. + +See: https://bugzilla.redhat.com/show_bug.cgi?id=1565681 +and the v2v-devel private thread "Do we already support migration using FC?" +--- + v2v/output_rhv_upload.ml | 11 +---------- + v2v/rhv-upload-plugin.py | 4 +--- + v2v/virt-v2v-output-rhv.pod | 8 +------- + 3 files changed, 3 insertions(+), 20 deletions(-) + +diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml +index c2a5c72c7..3d6d99008 100644 +--- a/v2v/output_rhv_upload.ml ++++ b/v2v/output_rhv_upload.ml +@@ -164,19 +164,11 @@ See also the virt-v2v-output-rhv(1) manual.") + error (f_"nbdkit was compiled without SELinux support. You will have to recompile nbdkit with libselinux-devel installed, or else set SELinux to Permissive mode while doing the conversion.") + in + +- (* Output format/sparse must be raw/sparse. We may be able to +- * lift this limitation in future, but it requires changes on the +- * RHV side. See TODO file for details. XXX +- *) ++ (* Output format must be raw. *) + let error_current_limitation required_param = + error (f_"rhv-upload: currently you must use ‘%s’. This restriction will be loosened in a future version.") required_param + in + +- let error_unless_output_alloc_sparse () = +- if output_alloc <> Sparse then +- error_current_limitation "-oa sparse" +- in +- + (* JSON parameters which are invariant between disks. *) + let json_params = [ + "verbose", JSON.Bool (verbose ()); +@@ -229,7 +221,6 @@ object + error_unless_ovirtsdk4_module_available (); + error_unless_nbdkit_working (); + error_unless_nbdkit_python_plugin_working (); +- error_unless_output_alloc_sparse (); + if have_selinux then + error_unless_nbdkit_compiled_with_selinux () + +diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py +index 2a950c5ed..b63d127f5 100644 +--- a/v2v/rhv-upload-plugin.py ++++ b/v2v/rhv-upload-plugin.py +@@ -140,10 +140,8 @@ def open(readonly): + format = disk_format, + initial_size = params['disk_size'], + provisioned_size = params['disk_size'], +- # XXX Ignores params['output_sparse']. +- # Handling this properly will be complex, see: + # https://www.redhat.com/archives/libguestfs/2018-March/msg00177.html +- sparse = True, ++ sparse = params['output_sparse'], + storage_domains = [ + types.StorageDomain( + name = params['output_storage'], +diff --git a/v2v/virt-v2v-output-rhv.pod b/v2v/virt-v2v-output-rhv.pod +index 651f61dae..4608cac45 100644 +--- a/v2v/virt-v2v-output-rhv.pod ++++ b/v2v/virt-v2v-output-rhv.pod +@@ -5,7 +5,7 @@ virt-v2v-output-rhv - Using virt-v2v to convert guests to oVirt or RHV + =head1 SYNOPSIS + + virt-v2v [-i* options] -o rhv-upload [-oc ENGINE_URL] -os STORAGE +- [-op PASSWORD] [-of raw] ++ [-op PASSWORD] + [-oo rhv-cafile=FILE] + [-oo rhv-cluster=CLUSTER] + [-oo rhv-direct] +@@ -78,12 +78,6 @@ username is not specified then virt-v2v defaults to using + C which is the typical superuser account for oVirt + instances. + +-=item I<-of raw> +- +-Currently you must use I<-of raw> and you cannot use I<-oa preallocated>. +- +-These restrictions will be loosened in a future version. +- + =item I<-op> F + + A file containing a password to be used when connecting to the oVirt +-- +2.21.0 + diff --git a/SOURCES/0029-v2v-o-null-support-older-qemu-img-RHBZ-1580309.patch b/SOURCES/0029-v2v-o-null-support-older-qemu-img-RHBZ-1580309.patch deleted file mode 100644 index fa1398f..0000000 --- a/SOURCES/0029-v2v-o-null-support-older-qemu-img-RHBZ-1580309.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 62dce61f73b9f0ea9e75a65713a21f4f8368381e Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Mon, 21 May 2018 17:19:25 +0200 -Subject: [PATCH] v2v: -o null: support older qemu-img (RHBZ#1580309) - -Commit 4699c7b6e126e07c95b67fb95df58aed87a680dd converted the null -output to use the null-co qemu driver with a JSON URL syntax -- -especially the latter is only available in newer versions of qemu. - -Even if this output mode is mostly for testing, check at runtime whether -the null-co + JSON way is possible, falling back to the creation of -thrown-away temporary files as before. - -(cherry picked from commit 1b6a2b221d04e455bdd31cff09015f74487882c1) ---- - v2v/output_null.ml | 66 ++++++++++++++++++++++++++++++++++++++-------- - 1 file changed, 55 insertions(+), 11 deletions(-) - -diff --git a/v2v/output_null.ml b/v2v/output_null.ml -index b93d53dc5..228c0b631 100644 ---- a/v2v/output_null.ml -+++ b/v2v/output_null.ml -@@ -40,9 +40,45 @@ open Utils - * too small, so we have to set the size. We could set it to - * match the input size but it's easier to set it to some huge - * size instead. -+ * -+ * In case neither the null-co driver nor the JSON syntax for URLs -+ * is supported, fall back by writing the disks to a temporary -+ * directory removed at exit. - *) - -+let can_use_qemu_null_co_device () = -+ (* We actually attempt to convert a raw file to the null-co device -+ * using a JSON URL. -+ *) -+ let tmp = Filename.temp_file "v2vqemunullcotst" ".img" in -+ Unix.truncate tmp 1024; -+ -+ let json = [ -+ "file.driver", JSON.String "null-co"; -+ "file.size", JSON.String "1E"; -+ ] in -+ -+ let cmd = -+ sprintf "qemu-img convert -n -f raw -O raw %s json:%s >/dev/null%s" -+ (quote tmp) -+ (quote (JSON.string_of_doc ~fmt:JSON.Compact json)) -+ (if verbose () then "" else " 2>&1") in -+ debug "%s" cmd; -+ let r = 0 = Sys.command cmd in -+ Unix.unlink tmp; -+ debug "qemu-img supports the null-co device: %b" r; -+ r -+ - class output_null = -+ (* Create a temporary directory which is always deleted at exit, -+ * so we can put the drives there in case qemu does not support -+ * the null-co device w/ a JSON URL. -+ *) -+ let tmpdir = -+ let base_dir = (open_guestfs ())#get_cachedir () in -+ let t = Mkdtemp.temp_dir ~base_dir "null." in -+ rmdir_on_exit t; -+ t in - object - inherit output - -@@ -51,19 +87,27 @@ object - method supported_firmware = [ TargetBIOS; TargetUEFI ] - - method prepare_targets source targets = -- let json_params = [ -- "file.driver", JSON.String "null-co"; -- "file.size", JSON.String "1E"; -- ] in -- let target_file = TargetURI ("json:" ^ JSON.string_of_doc json_params) in -+ if can_use_qemu_null_co_device () then ( -+ let json_params = [ -+ "file.driver", JSON.String "null-co"; -+ "file.size", JSON.String "1E"; -+ ] in -+ let target_file = TargetURI ("json:" ^ JSON.string_of_doc json_params) in - -- (* While it's not intended that output drivers can set the -- * target_format field (thus overriding the -of option), in -- * this special case of -o null it is reasonable. -- *) -- let target_format = "raw" in -+ (* While it's not intended that output drivers can set the -+ * target_format field (thus overriding the -of option), in -+ * this special case of -o null it is reasonable. -+ *) -+ let target_format = "raw" in - -- List.map (fun t -> { t with target_file; target_format }) targets -+ List.map (fun t -> { t with target_file; target_format }) targets -+ ) else ( -+ List.map ( -+ fun t -> -+ let target_file = tmpdir // t.target_overlay.ov_sd in -+ { t with target_file = TargetFile target_file } -+ ) targets -+ ) - - method create_metadata _ _ _ _ _ _ = () - end --- -2.20.1 - diff --git a/SOURCES/0030-RHEL-7-o-rhv-upload-Use-Python-2-instead-of-Python-3.patch b/SOURCES/0030-RHEL-7-o-rhv-upload-Use-Python-2-instead-of-Python-3.patch new file mode 100644 index 0000000..c9b9945 --- /dev/null +++ b/SOURCES/0030-RHEL-7-o-rhv-upload-Use-Python-2-instead-of-Python-3.patch @@ -0,0 +1,257 @@ +From 6ac10b37563221ca9974439a80b3b02329b60e8d Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Fri, 9 Mar 2018 12:15:44 +0000 +Subject: [PATCH] RHEL 7: -o rhv-upload: Use Python 2 instead of Python 3. + +--- + v2v/output_rhv_upload.ml | 2 +- + v2v/python_script.ml | 2 +- + v2v/rhv-upload-createvm.py | 20 ++++++++++++++++---- + v2v/rhv-upload-plugin.py | 35 ++++++++++++++++++++++++----------- + v2v/rhv-upload-precheck.py | 22 +++++++++++++++++----- + v2v/test-v2v-python-syntax.sh | 2 +- + 6 files changed, 60 insertions(+), 23 deletions(-) + +diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml +index 3d6d99008..051ce086f 100644 +--- a/v2v/output_rhv_upload.ml ++++ b/v2v/output_rhv_upload.ml +@@ -135,7 +135,7 @@ class output_rhv_upload output_alloc output_conn + error (f_"nbdkit is not new enough, you need to upgrade to nbdkit ≥ 1.1.16") + in + +- (* Check that the python3 plugin is installed and working ++ (* Check that the python plugin is installed and working + * and can load the plugin script. + *) + let error_unless_nbdkit_python_plugin_working () = +diff --git a/v2v/python_script.ml b/v2v/python_script.ml +index 3159373a1..fa052d697 100644 +--- a/v2v/python_script.ml ++++ b/v2v/python_script.ml +@@ -24,7 +24,7 @@ open Unix_utils + + open Common_gettext.Gettext + +-let python = "python3" (* Defined by PEP 394 *) ++let python = "python" + + type script = { + tmpdir : string; (* Temporary directory. *) +diff --git a/v2v/rhv-upload-createvm.py b/v2v/rhv-upload-createvm.py +index 1d0e8c95d..3f2fae4c6 100644 +--- a/v2v/rhv-upload-createvm.py ++++ b/v2v/rhv-upload-createvm.py +@@ -1,5 +1,6 @@ + # -*- python -*- +-# oVirt or RHV upload create VM used by ‘virt-v2v -o rhv-upload’ ++# coding: utf-8 ++# oVirt or RHV upload create VM used by 'virt-v2v -o rhv-upload' + # Copyright (C) 2018 Red Hat Inc. + # + # This program is free software; you can redistribute it and/or modify +@@ -21,8 +22,8 @@ import logging + import sys + import time + +-from http.client import HTTPSConnection +-from urllib.parse import urlparse ++from httplib import HTTPSConnection ++from urlparse import urlparse + + import ovirtsdk4 as sdk + import ovirtsdk4.types as types +@@ -37,8 +38,19 @@ if len(sys.argv) != 3: + raise RuntimeError("incorrect number of parameters") + + # Parameters are passed in via a JSON document. ++# https://stackoverflow.com/a/13105359 ++def byteify(input): ++ if isinstance(input, dict): ++ return {byteify(key): byteify(value) ++ for key, value in input.iteritems()} ++ elif isinstance(input, list): ++ return [byteify(element) for element in input] ++ elif isinstance(input, unicode): ++ return input.encode('utf-8') ++ else: ++ return input + with open(sys.argv[1], 'r') as fp: +- params = json.load(fp) ++ params = byteify(json.load(fp)) + + # What is passed in is a password file, read the actual password. + with open(params['output_password'], 'r') as fp: +diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py +index b63d127f5..a7fb88dd3 100644 +--- a/v2v/rhv-upload-plugin.py ++++ b/v2v/rhv-upload-plugin.py +@@ -1,5 +1,6 @@ + # -*- python -*- +-# oVirt or RHV upload nbdkit plugin used by ‘virt-v2v -o rhv-upload’ ++# coding: utf-8 ++# oVirt or RHV upload nbdkit plugin used by 'virt-v2v -o rhv-upload' + # Copyright (C) 2018 Red Hat Inc. + # + # This program is free software; you can redistribute it and/or modify +@@ -16,7 +17,7 @@ + # with this program; if not, write to the Free Software Foundation, Inc., + # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +-import builtins ++from __builtin__ import open as builtin_open + import json + import logging + import socket +@@ -24,8 +25,8 @@ import ssl + import sys + import time + +-from http.client import HTTPSConnection, HTTPConnection +-from urllib.parse import urlparse ++from httplib import HTTPSConnection, HTTPConnection ++from urlparse import urlparse + + import ovirtsdk4 as sdk + import ovirtsdk4.types as types +@@ -37,14 +38,25 @@ timeout = 5*60 + # Parameters are passed in via a JSON doc from the OCaml code. + # Because this Python code ships embedded inside virt-v2v there + # is no formal API here. ++# https://stackoverflow.com/a/13105359 ++def byteify(input): ++ if isinstance(input, dict): ++ return {byteify(key): byteify(value) ++ for key, value in input.iteritems()} ++ elif isinstance(input, list): ++ return [byteify(element) for element in input] ++ elif isinstance(input, unicode): ++ return input.encode('utf-8') ++ else: ++ return input + params = None + + def config(key, value): + global params + + if key == "params": +- with builtins.open(value, 'r') as fp: +- params = json.load(fp) ++ with builtin_open(value, 'r') as fp: ++ params = byteify(json.load(fp)) + else: + raise RuntimeError("unknown configuration key '%s'" % key) + +@@ -54,13 +66,14 @@ def config_complete(): + + def debug(s): + if params['verbose']: +- print(s, file=sys.stderr) ++ sys.stderr.write(s) ++ sys.stderr.write("\n") + sys.stderr.flush() + + def find_host(connection): + """Return the current host object or None.""" + try: +- with builtins.open("/etc/vdsm/vdsm.id") as f: ++ with builtin_open("/etc/vdsm/vdsm.id") as f: + vdsm_id = f.readline().strip() + except Exception as e: + # This is most likely not an oVirt host. +@@ -111,7 +124,7 @@ def open(readonly): + username = parsed.username or "admin@internal" + + # Read the password from file. +- with builtins.open(params['output_password'], 'r') as fp: ++ with builtin_open(params['output_password'], 'r') as fp: + password = fp.read() + password = password.rstrip() + +@@ -244,7 +257,7 @@ def open(readonly): + # New imageio never needs authentication. + needs_auth = False + +- j = json.loads(data) ++ j = byteify(json.loads(data)) + can_flush = "flush" in j['features'] + can_trim = "trim" in j['features'] + can_zero = "zero" in j['features'] +@@ -533,7 +546,7 @@ def close(h): + pass + + # Write the disk ID file. Only do this on successful completion. +- with builtins.open(params['diskid_file'], 'w') as fp: ++ with builtin_open(params['diskid_file'], 'w') as fp: + fp.write(disk.id) + + except: +diff --git a/v2v/rhv-upload-precheck.py b/v2v/rhv-upload-precheck.py +index 2798a29dd..5b650899f 100644 +--- a/v2v/rhv-upload-precheck.py ++++ b/v2v/rhv-upload-precheck.py +@@ -1,5 +1,6 @@ + # -*- python -*- +-# oVirt or RHV pre-upload checks used by ‘virt-v2v -o rhv-upload’ ++# coding: utf-8 ++# oVirt or RHV pre-upload checks used by 'virt-v2v -o rhv-upload' + # Copyright (C) 2018 Red Hat Inc. + # + # This program is free software; you can redistribute it and/or modify +@@ -21,8 +22,8 @@ import logging + import sys + import time + +-from http.client import HTTPSConnection +-from urllib.parse import urlparse ++from httplib import HTTPSConnection ++from urlparse import urlparse + + import ovirtsdk4 as sdk + import ovirtsdk4.types as types +@@ -36,8 +37,19 @@ if len(sys.argv) != 2: + raise RuntimeError("incorrect number of parameters") + + # Parameters are passed in via a JSON document. ++# https://stackoverflow.com/a/13105359 ++def byteify(input): ++ if isinstance(input, dict): ++ return {byteify(key): byteify(value) ++ for key, value in input.iteritems()} ++ elif isinstance(input, list): ++ return [byteify(element) for element in input] ++ elif isinstance(input, unicode): ++ return input.encode('utf-8') ++ else: ++ return input + with open(sys.argv[1], 'r') as fp: +- params = json.load(fp) ++ params = byteify(json.load(fp)) + + # What is passed in is a password file, read the actual password. + with open(params['output_password'], 'r') as fp: +@@ -67,7 +79,7 @@ vms = vms_service.list( + ) + if len(vms) > 0: + vm = vms[0] +- raise RuntimeError("VM already exists with name ‘%s’, id ‘%s’" % ++ raise RuntimeError("VM already exists with name '%s', id '%s'" % + (params['output_name'], vm.id)) + + # Otherwise everything is OK, exit with no error. +diff --git a/v2v/test-v2v-python-syntax.sh b/v2v/test-v2v-python-syntax.sh +index b167f4610..8d5924e3c 100755 +--- a/v2v/test-v2v-python-syntax.sh ++++ b/v2v/test-v2v-python-syntax.sh +@@ -25,7 +25,7 @@ skip_if_skipped + files="rhv-upload-createvm.py rhv-upload-plugin.py rhv-upload-precheck.py" + + # Base version of Python. +-python=python3 ++python=python + + # Checks the files are syntactically correct, but not very much else. + for f in $files; do +-- +2.21.0 + diff --git a/SOURCES/0030-v2v-ovf-Create-OVF-more-aligned-with-the-standard.patch b/SOURCES/0030-v2v-ovf-Create-OVF-more-aligned-with-the-standard.patch deleted file mode 100644 index 81e4a92..0000000 --- a/SOURCES/0030-v2v-ovf-Create-OVF-more-aligned-with-the-standard.patch +++ /dev/null @@ -1,342 +0,0 @@ -From 02a7daa696bcfd0d7e1999718324d0c1e32873b9 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= -Date: Thu, 22 Feb 2018 11:41:07 +0100 -Subject: [PATCH] v2v: ovf: Create OVF more aligned with the standard -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -For historical reasons the OVF used in RHV export domain contains some -deviations from the OVF standard. The format used in -o rhv has to -remain fixed but for -o vdsm and we could produce much nicer OVF. This -patch serves as a preparatory step to this. - -The main reason for creating different OVF is that it can be used to -create VM by oVirt REST API. The RHV export domain flavor cannot be used -that way. - -For now the virt-v2v behavior is unchanged. The modified output will be -enabled in some later patch. - -Signed-off-by: Tomáš Golembiovský -(cherry picked from commit a52ed4b4454396eb13d2cdf5762292bff3104f66) ---- - v2v/create_ovf.ml | 152 ++++++++++++++++++++++++++++++++------------- - v2v/create_ovf.mli | 12 +++- - v2v/output_rhv.ml | 3 +- - v2v/output_vdsm.ml | 3 +- - 4 files changed, 121 insertions(+), 49 deletions(-) - -diff --git a/v2v/create_ovf.ml b/v2v/create_ovf.ml -index 18956fed1..b9858ff93 100644 ---- a/v2v/create_ovf.ml -+++ b/v2v/create_ovf.ml -@@ -29,6 +29,10 @@ open Types - open Utils - open DOM - -+type ovf_flavour = -+ | OVirt -+ | RHVExportStorageDomain -+ - (* We set the creation time to be the same for all dates in - * all metadata files. All dates in OVF are UTC. - *) -@@ -295,7 +299,7 @@ let create_meta_files output_alloc sd_uuid image_uuids targets = - - (* Create the OVF file. *) - let rec create_ovf source targets guestcaps inspect -- output_alloc sd_uuid image_uuids vol_uuids vm_uuid = -+ output_alloc sd_uuid image_uuids vol_uuids vm_uuid ovf_flavour = - assert (List.length targets = List.length vol_uuids); - - let memsize_mb = source.s_memory /^ 1024L /^ 1024L in -@@ -314,12 +318,26 @@ let rec create_ovf source targets guestcaps inspect - ] [ - Comment generated_by; - e "References" [] []; -- e "Section" ["xsi:type", "ovf:NetworkSection_Type"] [ -- e "Info" [] [PCData "List of networks"] -- ]; -- e "Section" ["xsi:type", "ovf:DiskSection_Type"] [ -- e "Info" [] [PCData "List of Virtual Disks"] -- ]; -+ (match ovf_flavour with -+ | OVirt -> -+ e "NetworkSection" [] [ -+ e "Info" [] [PCData "List of networks"] -+ ] -+ | RHVExportStorageDomain -> -+ e "Section" ["xsi:type", "ovf:NetworkSection_Type"] [ -+ e "Info" [] [PCData "List of networks"] -+ ] -+ ); -+ (match ovf_flavour with -+ | OVirt -> -+ e "DiskSection" [] [ -+ e "Info" [] [PCData "List of Virtual Disks"] -+ ] -+ | RHVExportStorageDomain -> -+ e "Section" ["xsi:type", "ovf:DiskSection_Type"] [ -+ e "Info" [] [PCData "List of Virtual Disks"] -+ ] -+ ); - - let content_subnodes = ref [ - e "Name" [] [PCData source.s_name]; -@@ -352,11 +370,20 @@ let rec create_ovf source targets guestcaps inspect - ); - - List.push_back content_subnodes ( -- e "Section" ["ovf:id", vm_uuid; "ovf:required", "false"; -- "xsi:type", "ovf:OperatingSystemSection_Type"] [ -+ let osinfo_subnodes = [ - e "Info" [] [PCData inspect.i_product_name]; - e "Description" [] [PCData ostype]; -- ] -+ ] in -+ (match ovf_flavour with -+ | OVirt -> -+ e "OperatingSystemSection" ["ovf:id", vm_uuid; -+ "ovf:required", "false"] -+ osinfo_subnodes -+ | RHVExportStorageDomain -> -+ e "Section" ["ovf:id", vm_uuid; "ovf:required", "false"; -+ "xsi:type", "ovf:OperatingSystemSection_Type"] -+ osinfo_subnodes -+ ) - ); - - let virtual_hardware_section_items = ref [ -@@ -444,24 +471,34 @@ let rec create_ovf source targets guestcaps inspect - ); - - List.push_back content_subnodes ( -- e "Section" ["xsi:type", "ovf:VirtualHardwareSection_Type"] -- !virtual_hardware_section_items -+ match ovf_flavour with -+ | OVirt -> -+ e "VirtualHardwareSection" [] !virtual_hardware_section_items -+ | RHVExportStorageDomain -> -+ e "Section" ["xsi:type", "ovf:VirtualHardwareSection_Type"] -+ !virtual_hardware_section_items - ); - -- e "Content" ["ovf:id", "out"; "xsi:type", "ovf:VirtualSystem_Type"] -- !content_subnodes -+ (match ovf_flavour with -+ | OVirt -> -+ e "VirtualSystem" ["ovf:id", "out"] !content_subnodes -+ | RHVExportStorageDomain -> -+ e "Content" ["ovf:id", "out"; "xsi:type", "ovf:VirtualSystem_Type"] -+ !content_subnodes -+ ) - ] in - - (* Add disks to the OVF XML. *) -- add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids ovf; -+ add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids -+ ovf_flavour ovf; - - (* Old virt-v2v ignored removable media. XXX *) - - (* Add networks to the OVF XML. *) -- add_networks source.s_nics guestcaps ovf; -+ add_networks source.s_nics guestcaps ovf_flavour ovf; - - (* Add sound card to the OVF XML. *) -- add_sound_card source.s_sound ovf; -+ add_sound_card source.s_sound ovf_flavour ovf; - - (* Old virt-v2v didn't really look at the video and display - * metadata, instead just adding a single standard display (see -@@ -481,21 +518,42 @@ let rec create_ovf source targets guestcaps inspect - (* Return the OVF document. *) - ovf - -+(* Find appropriate section depending on the OVF flavour being generated. -+ * -+ * For example normal disk section is in node whereas in case of -+ * RHV export storage domain it is
. -+ *) -+and get_flavoured_section ovf ovf_flavour ovirt_path rhv_path rhv_path_attr = -+ let nodes = -+ match ovf_flavour with -+ | OVirt -> -+ let nodes = path_to_nodes ovf ovirt_path in -+ (match nodes with -+ | [node] -> node -+ | [] | _::_::_ -> assert false) -+ | RHVExportStorageDomain -> -+ let nodes = path_to_nodes ovf rhv_path in -+ try find_node_by_attr nodes rhv_path_attr -+ with Not_found -> assert false -+ in -+ nodes -+ - (* This modifies the OVF DOM, adding a section for each disk. *) --and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids ovf = -+and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids -+ ovf_flavour ovf = - let references = - let nodes = path_to_nodes ovf ["ovf:Envelope"; "References"] in - match nodes with - | [] | _::_::_ -> assert false - | [node] -> node in -- let disk_section = -- let sections = path_to_nodes ovf ["ovf:Envelope"; "Section"] in -- try find_node_by_attr sections ("xsi:type", "ovf:DiskSection_Type") -- with Not_found -> assert false in -- let virtualhardware_section = -- let sections = path_to_nodes ovf ["ovf:Envelope"; "Content"; "Section"] in -- try find_node_by_attr sections ("xsi:type", "ovf:VirtualHardwareSection_Type") -- with Not_found -> assert false in -+ let disk_section = get_flavoured_section ovf ovf_flavour -+ ["ovf:Envelope"; "DiskSection"] -+ ["ovf:Envelope"; "Section"] -+ ("xsi:type", "ovf:DiskSection_Type") in -+ let virtualhardware_section = get_flavoured_section ovf ovf_flavour -+ ["ovf:Envelope"; "VirtualSystem"; "VirtualHardwareSection"] -+ ["ovf:Envelope"; "Content"; "Section"] -+ ("xsi:type", "ovf:VirtualHardwareSection_Type") in - - (* Iterate over the disks, adding them to the OVF document. *) - List.iteri ( -@@ -509,7 +567,12 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids ovf = - let is_bootable_drive = i == 0 in - let boot_order = i+1 in - -- let fileref = sprintf "%s/%s" image_uuid vol_uuid in -+ let fileref = -+ match ovf_flavour with -+ | OVirt -> -+ vol_uuid -+ | RHVExportStorageDomain -> -+ sprintf "%s/%s" image_uuid vol_uuid in - - (* ovf:size and ovf:actual_size fields are integer GBs. If you - * use floating point numbers then RHV will fail to parse them. -@@ -555,7 +618,10 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids ovf = - (* Add disk to DiskSection. *) - let disk = - let attrs = ref [ -- "ovf:diskId", vol_uuid; -+ "ovf:diskId", -+ (match ovf_flavour with -+ | OVirt -> image_uuid -+ | RHVExportStorageDomain -> vol_uuid); - "ovf:size", Int64.to_string size_gb; - "ovf:fileRef", fileref; - "ovf:parentRef", ""; -@@ -613,15 +679,15 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids ovf = - ) (List.combine3 targets image_uuids vol_uuids) - - (* This modifies the OVF DOM, adding a section for each NIC. *) --and add_networks nics guestcaps ovf = -- let network_section = -- let sections = path_to_nodes ovf ["ovf:Envelope"; "Section"] in -- try find_node_by_attr sections ("xsi:type", "ovf:NetworkSection_Type") -- with Not_found -> assert false in -- let virtualhardware_section = -- let sections = path_to_nodes ovf ["ovf:Envelope"; "Content"; "Section"] in -- try find_node_by_attr sections ("xsi:type", "ovf:VirtualHardwareSection_Type") -- with Not_found -> assert false in -+and add_networks nics guestcaps ovf_flavour ovf = -+ let network_section = get_flavoured_section ovf ovf_flavour -+ ["ovf:Envelope"; "NetworkSection"] -+ ["ovf:Envelope"; "Section"] -+ ("xsi:type", "ovf:NetworkSection_Type") in -+ let virtualhardware_section = get_flavoured_section ovf ovf_flavour -+ ["ovf:Envelope"; "VirtualSystem"; "VirtualHardwareSection"] -+ ["ovf:Envelope"; "Content"; "Section"] -+ ("xsi:type", "ovf:VirtualHardwareSection_Type") in - - (* Iterate over the NICs, adding them to the OVF document. *) - List.iteri ( -@@ -669,7 +735,7 @@ and add_networks nics guestcaps ovf = - ) nics - - (* This modifies the OVF DOM, adding a sound card, if oVirt can emulate it. *) --and add_sound_card sound ovf = -+and add_sound_card sound ovf_flavour ovf = - let device = - match sound with - | None -> None -@@ -682,12 +748,10 @@ and add_sound_card sound ovf = - - match device with - | Some device -> -- let virtualhardware_section = -- let sections = -- path_to_nodes ovf ["ovf:Envelope"; "Content"; "Section"] in -- try find_node_by_attr sections -- ("xsi:type", "ovf:VirtualHardwareSection_Type") -- with Not_found -> assert false in -+ let virtualhardware_section = get_flavoured_section ovf ovf_flavour -+ ["ovf:Envelope"; "VirtualSystem"; "VirtualHardwareSection"] -+ ["ovf:Envelope"; "Content"; "Section"] -+ ("xsi:type", "ovf:VirtualHardwareSection_Type") in - - let item = - e "Item" [] [ -diff --git a/v2v/create_ovf.mli b/v2v/create_ovf.mli -index 07e8af6a0..8a8c7dd12 100644 ---- a/v2v/create_ovf.mli -+++ b/v2v/create_ovf.mli -@@ -16,16 +16,22 @@ - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - *) - -+type ovf_flavour = -+ | OVirt -+ | RHVExportStorageDomain -+ - (** Create OVF and related files for RHV. - -- The format is described in -- http://www.ovirt.org/images/8/86/Ovirt_ovf_format.odt -+ The format for RHV export storage domain is described in: -+ http://resources.ovirt.org/old-site-files/Ovirt_ovf_format.odt -+ -+ The format understood by oVirt has no known documentation. - - OVF isn't a real standard, so it's likely that if we ever had to - create OVF for another target management system then we would need - to heavily modify or even duplicate this code. *) - --val create_ovf : Types.source -> Types.target list -> Types.guestcaps -> Types.inspect -> Types.output_allocation -> string -> string list -> string list -> string -> DOM.doc -+val create_ovf : Types.source -> Types.target list -> Types.guestcaps -> Types.inspect -> Types.output_allocation -> string -> string list -> string list -> string -> ovf_flavour -> DOM.doc - (** Create the OVF file. - - Actually a {!DOM} document is created, not a file. It can be written -diff --git a/v2v/output_rhv.ml b/v2v/output_rhv.ml -index 0b732e4cf..5260ab030 100644 ---- a/v2v/output_rhv.ml -+++ b/v2v/output_rhv.ml -@@ -275,7 +275,8 @@ object - - (* Create the metadata. *) - let ovf = Create_ovf.create_ovf source targets guestcaps inspect -- output_alloc esd_uuid image_uuids vol_uuids vm_uuid in -+ output_alloc esd_uuid image_uuids vol_uuids vm_uuid -+ Create_ovf.RHVExportStorageDomain in - - (* Write it to the metadata file. *) - let dir = esd_mp // esd_uuid // "master" // "vms" // vm_uuid in -diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml -index c5e904ba1..ce286d327 100644 ---- a/v2v/output_vdsm.ml -+++ b/v2v/output_vdsm.ml -@@ -175,7 +175,8 @@ object - output_alloc dd_uuid - vdsm_options.image_uuids - vdsm_options.vol_uuids -- vdsm_options.vm_uuid in -+ vdsm_options.vm_uuid -+ Create_ovf.RHVExportStorageDomain in - - (* Write it to the metadata file. *) - let file = vdsm_options.ovf_output // vdsm_options.vm_uuid ^ ".ovf" in --- -2.20.1 - diff --git a/SOURCES/0031-RHEL-7-v2v-rhv-upload-Disable-Nagle-algorithm.patch b/SOURCES/0031-RHEL-7-v2v-rhv-upload-Disable-Nagle-algorithm.patch new file mode 100644 index 0000000..2edab1e --- /dev/null +++ b/SOURCES/0031-RHEL-7-v2v-rhv-upload-Disable-Nagle-algorithm.patch @@ -0,0 +1,75 @@ +From 171a127e9b67baa841462875ec2f37f0bec0132e Mon Sep 17 00:00:00 2001 +From: Nir Soffer +Date: Fri, 15 Jun 2018 22:57:32 +0300 +Subject: [PATCH] RHEL 7: v2v: rhv-upload: Disable Nagle algorithm + +When sending a PUT request, the http header may be sent in the first +packet when calling con.endheaders(). When we send the first chunk, the +kernel may delay the send because the header packet was not acked yet. + +We have seen PUT requests delayed by 40 milliseconds on the server side +during virt-v2v upload to ovirt. Here is example log from current RHEL +virt-v2v version, uploading to RHV 4.2.3: + +2018-06-12 17:04:01,750 INFO (Thread-2) [images] Writing 52736 bytes +at offset 0 flush False to /path/to/image for ticket +374bec27-930d-4097-8e41-e4bc23324eb0 + +2018-06-12 17:04:01,790 INFO (Thread-2) [directio] Operation stats: + + +The server spent 40 milliseconds reading 52736 bytes form +rhv_upload_plugin running on the same host. + +This issue was fixed in python 3.5 by using the TCP_NO_DELAY option +after connecting[1]. I backported this change from python 3.5. + +I tested the same change using imageio example upload script. With this +change and with optimized PATCH requests, upload time of 4G sparse image +was reduced from 7 minutes to 1 minute. + +See this ovirt patch for more details: +https://gerrit.ovirt.org/#/c/92276/ + +This change is needed only for python 2. + +[1] https://bugs.python.org/issue23302 +--- + v2v/rhv-upload-plugin.py | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py +index a7fb88dd3..566b2ba9a 100644 +--- a/v2v/rhv-upload-plugin.py ++++ b/v2v/rhv-upload-plugin.py +@@ -25,7 +25,7 @@ import ssl + import sys + import time + +-from httplib import HTTPSConnection, HTTPConnection ++from httplib import HTTPSConnection as _HTTPSConnection, HTTPConnection + from urlparse import urlparse + + import ovirtsdk4 as sdk +@@ -51,6 +51,18 @@ def byteify(input): + return input + params = None + ++class HTTPSConnection(_HTTPSConnection): ++ def connect(self): ++ """ ++ Using TCP_NO_DELAY avoids delays when sending small payload, such as ++ ovirt PATCH requests. ++ ++ This issue was fixed in python 3.5, see: ++ https://bugs.python.org/issue23302 ++ """ ++ _HTTPSConnection.connect(self) ++ self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) ++ + def config(key, value): + global params + +-- +2.21.0 + diff --git a/SOURCES/0031-v2v-vdsm-add-vdsm-fixed-ovf-option.patch b/SOURCES/0031-v2v-vdsm-add-vdsm-fixed-ovf-option.patch deleted file mode 100644 index 38f5bad..0000000 --- a/SOURCES/0031-v2v-vdsm-add-vdsm-fixed-ovf-option.patch +++ /dev/null @@ -1,213 +0,0 @@ -From 7566786efa4e67b64c4160baccbc5be136e485e1 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= -Date: Thu, 22 Feb 2018 11:41:08 +0100 -Subject: [PATCH] v2v: vdsm: add --vdsm-fixed-ovf option -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add option for -o vdsm that enables output of the modified OVF. oVirt -engine should already be able to consume the OVF, but let's not take any -chances and enable it only by command line argument. It can be made -default later when it receives proper testing. - -Signed-off-by: Tomáš Golembiovský -(cherry picked from commit 285014b290507865fd2020e44ea453af0262b624) ---- - v2v/cmdline.ml | 10 ++++++++++ - v2v/create_ovf.ml | 7 +++++++ - v2v/create_ovf.mli | 9 +++++++++ - v2v/output_vdsm.ml | 9 +++++++-- - v2v/output_vdsm.mli | 1 + - v2v/test-v2v-o-vdsm-options.sh | 3 ++- - v2v/virt-v2v.pod | 20 ++++++++++++++++++++ - 7 files changed, 56 insertions(+), 3 deletions(-) - -diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml -index 0bc5e9055..e80b0689b 100644 ---- a/v2v/cmdline.ml -+++ b/v2v/cmdline.ml -@@ -79,6 +79,11 @@ let parse_cmdline () = - let vdsm_compat = ref "0.10" in - let set_vdsm_compat s = vdsm_compat := s in - -+ let vdsm_ovf_flavour = ref Create_ovf.RHVExportStorageDomain in -+ let ovf_flavours_str = String.concat "|" Create_ovf.ovf_flavours in -+ let set_vdsm_ovf_flavour arg = -+ vdsm_ovf_flavour := Create_ovf.ovf_flavour_of_string arg in -+ - let set_string_option_once optname optref arg = - match !optref with - | Some _ -> -@@ -249,6 +254,8 @@ let parse_cmdline () = - s_"Output VM UUID"; - [ L"vdsm-ovf-output" ], Getopt.String ("-", set_string_option_once "--vdsm-ovf-output" vdsm_ovf_output), - s_"Output OVF file"; -+ [ L"vdsm-ovf-flavour" ], Getopt.Symbol (ovf_flavours_str, Create_ovf.ovf_flavours, set_vdsm_ovf_flavour), -+ s_"Set the type of generated OVF (default rhvexp)"; - [ L"vmtype" ], Getopt.String ("-", vmtype_warning), - s_"Ignored for backwards compatibility"; - ] in -@@ -325,6 +332,7 @@ read the man page virt-v2v(1). - let vdsm_vol_uuids = List.rev !vdsm_vol_uuids in - let vdsm_vm_uuid = !vdsm_vm_uuid in - let vdsm_ovf_output = Option.default "." !vdsm_ovf_output in -+ let vdsm_ovf_flavour = !vdsm_ovf_flavour in - - (* No arguments and machine-readable mode? Print out some facts - * about what this binary supports. -@@ -340,6 +348,7 @@ read the man page virt-v2v(1). - List.iter (printf "input:%s\n") (Modules_list.input_modules ()); - List.iter (printf "output:%s\n") (Modules_list.output_modules ()); - List.iter (printf "convert:%s\n") (Modules_list.convert_modules ()); -+ List.iter (printf "ovf:%s\n") Create_ovf.ovf_flavours; - exit 0 - ); - -@@ -545,6 +554,7 @@ read the man page virt-v2v(1). - vm_uuid = vdsm_vm_uuid; - ovf_output = vdsm_ovf_output; - compat = vdsm_compat; -+ ovf_flavour = vdsm_ovf_flavour; - } in - Output_vdsm.output_vdsm os vdsm_options output_alloc, - output_format, output_alloc in -diff --git a/v2v/create_ovf.ml b/v2v/create_ovf.ml -index b9858ff93..f1985ea86 100644 ---- a/v2v/create_ovf.ml -+++ b/v2v/create_ovf.ml -@@ -33,6 +33,13 @@ type ovf_flavour = - | OVirt - | RHVExportStorageDomain - -+let ovf_flavours = ["ovirt"; "rhvexp"] -+ -+let ovf_flavour_of_string = function -+ | "ovirt" -> OVirt -+ | "rhvexp" -> RHVExportStorageDomain -+ | flav -> invalid_arg flav -+ - (* We set the creation time to be the same for all dates in - * all metadata files. All dates in OVF are UTC. - *) -diff --git a/v2v/create_ovf.mli b/v2v/create_ovf.mli -index 8a8c7dd12..2d80660e3 100644 ---- a/v2v/create_ovf.mli -+++ b/v2v/create_ovf.mli -@@ -20,6 +20,15 @@ type ovf_flavour = - | OVirt - | RHVExportStorageDomain - -+(** The string representation of available OVF flavours. *) -+val ovf_flavours : string list -+ -+(** Convert from a string to the corresponding OVF flavour. -+ -+ Throw [Invalid_argument] if the string does not match any -+ valid flavour. *) -+val ovf_flavour_of_string : string -> ovf_flavour -+ - (** Create OVF and related files for RHV. - - The format for RHV export storage domain is described in: -diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml -index ce286d327..b76a2e930 100644 ---- a/v2v/output_vdsm.ml -+++ b/v2v/output_vdsm.ml -@@ -32,6 +32,7 @@ type vdsm_options = { - vm_uuid : string; - ovf_output : string; - compat : string; -+ ovf_flavour : Create_ovf.ovf_flavour; - } - - class output_vdsm os vdsm_options output_alloc = -@@ -39,7 +40,7 @@ object - inherit output - - method as_options = -- sprintf "-o vdsm -os %s%s%s --vdsm-vm-uuid %s --vdsm-ovf-output %s%s" os -+ sprintf "-o vdsm -os %s%s%s --vdsm-vm-uuid %s --vdsm-ovf-output %s%s%s" os - (String.concat "" - (List.map (sprintf " --vdsm-image-uuid %s") vdsm_options.image_uuids)) - (String.concat "" -@@ -49,6 +50,10 @@ object - (match vdsm_options.compat with - | "0.10" -> "" (* currently this is the default, so don't print it *) - | s -> sprintf " --vdsm-compat=%s" s) -+ (match vdsm_options.ovf_flavour with -+ | Create_ovf.OVirt -> "--vdsm-ovf-flavour=ovf" -+ (* currently this is the default, so don't print it *) -+ | Create_ovf.RHVExportStorageDomain -> "") - - method supported_firmware = [ TargetBIOS ] - -@@ -176,7 +181,7 @@ object - vdsm_options.image_uuids - vdsm_options.vol_uuids - vdsm_options.vm_uuid -- Create_ovf.RHVExportStorageDomain in -+ vdsm_options.ovf_flavour in - - (* Write it to the metadata file. *) - let file = vdsm_options.ovf_output // vdsm_options.vm_uuid ^ ".ovf" in -diff --git a/v2v/output_vdsm.mli b/v2v/output_vdsm.mli -index 401a71ec4..6ed684638 100644 ---- a/v2v/output_vdsm.mli -+++ b/v2v/output_vdsm.mli -@@ -24,6 +24,7 @@ type vdsm_options = { - vm_uuid : string; (* --vdsm-vm-uuid *) - ovf_output : string; (* --vdsm-ovf-output *) - compat : string; (* --vdsm-compat=0.10|1.1 *) -+ ovf_flavour : Create_ovf.ovf_flavour; - } - (** 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 753efc4e7..4ad5d4aad 100755 ---- a/v2v/test-v2v-o-vdsm-options.sh -+++ b/v2v/test-v2v-o-vdsm-options.sh -@@ -55,7 +55,8 @@ $VG virt-v2v --debug-gc \ - --vdsm-vol-uuid VOL \ - --vdsm-vm-uuid VM \ - --vdsm-ovf-output $d/12345678-1234-1234-1234-123456789abc/master/vms/VM \ -- --vdsm-compat=1.1 -+ --vdsm-compat=1.1 \ -+ --vdsm-ovf-flavour=ovirt - - # 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 f8a937960..d81a2339c 100644 ---- a/v2v/virt-v2v.pod -+++ b/v2v/virt-v2v.pod -@@ -627,6 +627,26 @@ hex digit can be C<0-9> or C), conforming to S. - - These options can only be used with I<-o vdsm>. - -+=item B<--vdsm-ovf-flavour> flavour -+ -+This option controls the format of the OVF generated at the end of conversion. -+Currently there are two possible flavours: -+ -+=over 4 -+ -+=item rhevexp -+ -+The OVF format used in RHV export storage domain. -+ -+=item ovirt -+ -+The OVF format understood by oVirt REST API. -+ -+=back -+ -+For backward compatibility the default is I, but this may change in -+the future. -+ - =item B<-v> - - =item B<--verbose> --- -2.20.1 - diff --git a/SOURCES/0032-RHEL-7-p2v-ignore-rhv-upload-driver-RHBZ-1590220.patch b/SOURCES/0032-RHEL-7-p2v-ignore-rhv-upload-driver-RHBZ-1590220.patch new file mode 100644 index 0000000..c773177 --- /dev/null +++ b/SOURCES/0032-RHEL-7-p2v-ignore-rhv-upload-driver-RHBZ-1590220.patch @@ -0,0 +1,33 @@ +From bfc01eca10288a26ecc50f0efd0fb6426322407b Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Thu, 19 Jul 2018 13:30:17 +0200 +Subject: [PATCH] RHEL 7: p2v: ignore 'rhv-upload' driver (RHBZ#1590220) + +The 'rhv-upload' output mode requires few options, and virt-p2v does not +have the GUI bits for specifying them. +--- + p2v/ssh.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/p2v/ssh.c b/p2v/ssh.c +index c8528033d..8aac2685d 100644 +--- a/p2v/ssh.c ++++ b/p2v/ssh.c +@@ -1021,8 +1021,12 @@ add_input_driver (const char *name, size_t len) + static void + add_output_driver (const char *name, size_t len) + { +- /* Ignore the 'vdsm' driver, since that should only be used by VDSM. */ +- if (len != 4 || memcmp (name, "vdsm", 4) != 0) ++ /* Ignore the 'vdsm' driver, since that should only be used by VDSM. ++ * Ignore the 'rhv-upload' driver, since we do not support passing all the ++ * options for it. ++ */ ++ if ((len != 4 || memcmp (name, "vdsm", 4) != 0) && ++ (len != 10 || memcmp (name, "rhv-upload", 10) != 0)) + add_option ("output", &output_drivers, name, len); + } + +-- +2.21.0 + diff --git a/SOURCES/0032-v2v-OVF-Code-formatting.patch b/SOURCES/0032-v2v-OVF-Code-formatting.patch deleted file mode 100644 index 99bf8ae..0000000 --- a/SOURCES/0032-v2v-OVF-Code-formatting.patch +++ /dev/null @@ -1,124 +0,0 @@ -From 84f74f74a398164a8b6d102633b58b690874fa00 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 22 Feb 2018 14:22:12 +0000 -Subject: [PATCH] v2v: OVF: Code formatting. - -Updates commit a52ed4b4454396eb13d2cdf5762292bff3104f66 -("v2v: ovf: Create OVF more aligned with the standard") with some -small code refactoring and formatting. - -(cherry picked from commit 9e83f3a2ccef4e91b0b3275b712df8b16e233cff) ---- - v2v/create_ovf.ml | 73 ++++++++++++++++++++++++++--------------------- - 1 file changed, 41 insertions(+), 32 deletions(-) - -diff --git a/v2v/create_ovf.ml b/v2v/create_ovf.ml -index f1985ea86..bf3741e0f 100644 ---- a/v2v/create_ovf.ml -+++ b/v2v/create_ovf.ml -@@ -530,20 +530,16 @@ let rec create_ovf source targets guestcaps inspect - * For example normal disk section is in node whereas in case of - * RHV export storage domain it is
. - *) --and get_flavoured_section ovf ovf_flavour ovirt_path rhv_path rhv_path_attr = -- let nodes = -- match ovf_flavour with -- | OVirt -> -- let nodes = path_to_nodes ovf ovirt_path in -- (match nodes with -+and get_flavoured_section ovf ovirt_path rhv_path rhv_path_attr = function -+ | OVirt -> -+ let nodes = path_to_nodes ovf ovirt_path in -+ (match nodes with - | [node] -> node - | [] | _::_::_ -> assert false) -- | RHVExportStorageDomain -> -- let nodes = path_to_nodes ovf rhv_path in -- try find_node_by_attr nodes rhv_path_attr -- with Not_found -> assert false -- in -- nodes -+ | RHVExportStorageDomain -> -+ let nodes = path_to_nodes ovf rhv_path in -+ try find_node_by_attr nodes rhv_path_attr -+ with Not_found -> assert false - - (* This modifies the OVF DOM, adding a section for each disk. *) - and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids -@@ -553,14 +549,19 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids - match nodes with - | [] | _::_::_ -> assert false - | [node] -> node in -- let disk_section = get_flavoured_section ovf ovf_flavour -- ["ovf:Envelope"; "DiskSection"] -- ["ovf:Envelope"; "Section"] -- ("xsi:type", "ovf:DiskSection_Type") in -- let virtualhardware_section = get_flavoured_section ovf ovf_flavour -- ["ovf:Envelope"; "VirtualSystem"; "VirtualHardwareSection"] -- ["ovf:Envelope"; "Content"; "Section"] -- ("xsi:type", "ovf:VirtualHardwareSection_Type") in -+ let disk_section = -+ get_flavoured_section ovf -+ ["ovf:Envelope"; "DiskSection"] -+ ["ovf:Envelope"; "Section"] -+ ("xsi:type", "ovf:DiskSection_Type") -+ ovf_flavour in -+ let virtualhardware_section = -+ get_flavoured_section ovf -+ ["ovf:Envelope"; "VirtualSystem"; -+ "VirtualHardwareSection"] -+ ["ovf:Envelope"; "Content"; "Section"] -+ ("xsi:type", "ovf:VirtualHardwareSection_Type") -+ ovf_flavour in - - (* Iterate over the disks, adding them to the OVF document. *) - List.iteri ( -@@ -687,14 +688,19 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids - - (* This modifies the OVF DOM, adding a section for each NIC. *) - and add_networks nics guestcaps ovf_flavour ovf = -- let network_section = get_flavoured_section ovf ovf_flavour -- ["ovf:Envelope"; "NetworkSection"] -- ["ovf:Envelope"; "Section"] -- ("xsi:type", "ovf:NetworkSection_Type") in -- let virtualhardware_section = get_flavoured_section ovf ovf_flavour -- ["ovf:Envelope"; "VirtualSystem"; "VirtualHardwareSection"] -- ["ovf:Envelope"; "Content"; "Section"] -- ("xsi:type", "ovf:VirtualHardwareSection_Type") in -+ let network_section = -+ get_flavoured_section ovf -+ ["ovf:Envelope"; "NetworkSection"] -+ ["ovf:Envelope"; "Section"] -+ ("xsi:type", "ovf:NetworkSection_Type") -+ ovf_flavour in -+ let virtualhardware_section = -+ get_flavoured_section ovf -+ ["ovf:Envelope"; "VirtualSystem"; -+ "VirtualHardwareSection"] -+ ["ovf:Envelope"; "Content"; "Section"] -+ ("xsi:type", "ovf:VirtualHardwareSection_Type") -+ ovf_flavour in - - (* Iterate over the NICs, adding them to the OVF document. *) - List.iteri ( -@@ -755,10 +761,13 @@ and add_sound_card sound ovf_flavour ovf = - - match device with - | Some device -> -- let virtualhardware_section = get_flavoured_section ovf ovf_flavour -- ["ovf:Envelope"; "VirtualSystem"; "VirtualHardwareSection"] -- ["ovf:Envelope"; "Content"; "Section"] -- ("xsi:type", "ovf:VirtualHardwareSection_Type") in -+ let virtualhardware_section = -+ get_flavoured_section ovf -+ ["ovf:Envelope"; "VirtualSystem"; -+ "VirtualHardwareSection"] -+ ["ovf:Envelope"; "Content"; "Section"] -+ ("xsi:type", "ovf:VirtualHardwareSection_Type") -+ ovf_flavour in - - let item = - e "Item" [] [ --- -2.20.1 - diff --git a/SOURCES/0033-RHEL-7-point-to-KB-for-supported-v2v-hypervisors-gue.patch b/SOURCES/0033-RHEL-7-point-to-KB-for-supported-v2v-hypervisors-gue.patch new file mode 100644 index 0000000..6862412 --- /dev/null +++ b/SOURCES/0033-RHEL-7-point-to-KB-for-supported-v2v-hypervisors-gue.patch @@ -0,0 +1,125 @@ +From bcacd972ad9bd4713e5d8f8e32cdca7f28be670e Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Tue, 26 Mar 2019 09:42:25 +0100 +Subject: [PATCH] RHEL 7: point to KB for supported v2v hypervisors/guests + +--- + v2v/virt-v2v-support.pod | 102 ++------------------------------------- + 1 file changed, 4 insertions(+), 98 deletions(-) + +diff --git a/v2v/virt-v2v-support.pod b/v2v/virt-v2v-support.pod +index a22506068..4ec1a07c1 100644 +--- a/v2v/virt-v2v-support.pod ++++ b/v2v/virt-v2v-support.pod +@@ -8,104 +8,10 @@ systems and guests in virt-v2v + This page documents which foreign hypervisors, virtualization + management systems and guest types that L can support. + +-Note this page applies to upstream virt-v2v from +-L and in downstream distributions of virt-v2v +-sometimes features are intentionally removed, or are present but not +-supported. +- +-=head2 Hypervisors (Input) +- +-=over 4 +- +-=item VMware ESXi +- +-Must be managed by VMware vCenter E 5.0 unless VDDK is available. +- +-=item OVA exported from VMware +- +-OVAs from other hypervisors will not work. +- +-=item VMX from VMware +- +-VMX files generated by other hypervisors will not work. +- +-=item RHEL 5 Xen +- +-=item SUSE Xen +- +-=item Citrix Xen +- +-Citrix Xen has not been recently tested. +- +-=item Hyper-V +- +-Not recently tested. Requires that you export the disk or use +-L on Hyper-V. +- +-=item Direct from disk images +- +-Only disk images exported from supported hypervisors, and using +-container formats supported by qemu. +- +-=item Physical machines +- +-Using the L tool. +- +-=back +- +-=head2 Hypervisors (Output) +- +-QEMU and KVM only. +- +-=head2 Virtualization management systems (Output) +- +-=over 4 +- +-=item OpenStack +- +-=item Red Hat Virtualization (RHV) 4.1 and up +- +-=item Local libvirt +- +-And hence L, L, and similar tools. +- +-=item Local disk +- +-=back +- +-=head2 Guests +- +-=over 4 +- +-=item Red Hat Enterprise Linux 3, 4, 5, 6, 7 +- +-=item CentOS 3, 4, 5, 6, 7 +- +-=item Scientific Linux 3, 4, 5, 6, 7 +- +-=item Oracle Linux +- +-=item Fedora +- +-=item SLES 10 and up +- +-=item OpenSUSE 10 and up +- +-=item Debian 6 and up +- +-=item Ubuntu 10.04, 12.04, 14.04, 16.04, and up +- +-=item Windows XP to Windows 10 / Windows Server 2016 +- +-We use Windows internal version numbers, see +-L +- +-Currently NT 5.2 to NT 6.3 are supported. +- +-See L below for additional notes on converting Windows +-guests. +- +-=back ++For more information on supported hypervisors, and guest types in ++RHEL, please consult the following Knowledgebase article on these ++Red Hat Customer Portal: ++L. + + =head2 Guest firmware + +-- +2.21.0 + diff --git a/SOURCES/0033-v2v-DOM-Add-doc_to_string-function.patch b/SOURCES/0033-v2v-DOM-Add-doc_to_string-function.patch deleted file mode 100644 index 0e3214b..0000000 --- a/SOURCES/0033-v2v-DOM-Add-doc_to_string-function.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 4b5304704a5fa4cad1e5869ce97f27ff64ac492f Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 20 Feb 2018 15:21:48 +0000 -Subject: [PATCH] v2v: DOM: Add doc_to_string function. - -Convert a document to an in-memory string. - -(cherry picked from commit 802c8635cc2537a7d4b7af8981c670e2fdbb2675) ---- - v2v/DOM.ml | 61 +++++++++++++++++++++++++++++++++-------------------- - v2v/DOM.mli | 3 +++ - 2 files changed, 41 insertions(+), 23 deletions(-) - -diff --git a/v2v/DOM.ml b/v2v/DOM.ml -index 7f66e0920..8b106224b 100644 ---- a/v2v/DOM.ml -+++ b/v2v/DOM.ml -@@ -46,43 +46,48 @@ let e name attrs children = - * we will be writing, ie. libvirt XML and OVF metadata, where - * whitespace is generally not significant, but readability is useful. - *) --let rec node_to_chan ?(indent = 0) chan = function -- | PCData str -> output_string chan (xml_quote_pcdata str) -+let rec node_to_buf ?(indent = 0) buf = function -+ | PCData str -> -+ Buffer.add_string buf (xml_quote_pcdata str) - | Comment str -> -- output_spaces chan indent; -- fprintf chan "" (xml_quote_pcdata str) -- | Element e -> element_to_chan ~indent chan e --and element_to_chan ?(indent = 0) chan -+ buffer_add_spaces buf indent; -+ bprintf buf "" (xml_quote_pcdata str) -+ | Element e -> -+ element_to_buf ~indent buf e -+and element_to_buf ?(indent = 0) buf - { e_name = name; e_attrs = attrs; e_children = children } = -- output_spaces chan indent; -- fprintf chan "<%s" name; -- List.iter (fun (n, v) -> fprintf chan " %s='%s'" n (xml_quote_attr v)) attrs; -+ buffer_add_spaces buf indent; -+ bprintf buf "<%s" name; -+ List.iter (fun (n, v) -> bprintf buf " %s='%s'" n (xml_quote_attr v)) attrs; - if children <> [] then ( -- output_string chan ">"; -+ Buffer.add_string buf ">"; - let last_child_was_element = ref false in - List.iter ( - function - | Element _ as child -> - last_child_was_element := true; -- output_char chan '\n'; -- node_to_chan ~indent:(indent+2) chan child; -+ Buffer.add_char buf '\n'; -+ node_to_buf ~indent:(indent+2) buf child; - | PCData _ as child -> - last_child_was_element := false; -- node_to_chan ~indent:(indent+2) chan child; -+ node_to_buf ~indent:(indent+2) buf child; - | Comment _ as child -> - last_child_was_element := true; -- output_char chan '\n'; -- node_to_chan ~indent:(indent+2) chan child; -+ Buffer.add_char buf '\n'; -+ node_to_buf ~indent:(indent+2) buf child; - ) children; - if !last_child_was_element then ( -- output_char chan '\n'; -- output_spaces chan indent -+ Buffer.add_char buf '\n'; -+ buffer_add_spaces buf indent - ); -- fprintf chan "" name -+ bprintf buf "" name - ) else ( -- output_string chan "/>" -+ Buffer.add_string buf "/>" - ) - -+and buffer_add_spaces buf n = -+ Buffer.add_string buf (String.spaces n) -+ - (* Quote XML content. Note you must use single - * quotes around the attribute. - *) -@@ -99,10 +104,20 @@ and xml_quote_pcdata str = - let str = String.replace str ">" ">" in - str - --let doc_to_chan chan (Doc doc) = -- fprintf chan "\n"; -- element_to_chan chan doc; -- fprintf chan "\n" -+let doc_to_buf buf (Doc doc) = -+ bprintf buf "\n"; -+ element_to_buf buf doc; -+ bprintf buf "\n" -+ -+let doc_to_string doc = -+ let buf = Buffer.create 4096 in -+ doc_to_buf buf doc; -+ Buffer.contents buf -+ -+let doc_to_chan chan doc = -+ let buf = Buffer.create 4096 in -+ doc_to_buf buf doc; -+ Buffer.output_buffer chan buf - - let path_to_nodes (Doc doc) path = - match path with -diff --git a/v2v/DOM.mli b/v2v/DOM.mli -index 1aa89b7e7..99223c389 100644 ---- a/v2v/DOM.mli -+++ b/v2v/DOM.mli -@@ -60,6 +60,9 @@ v} - v} - *) - -+val doc_to_string : doc -> string -+(** Convert a document to a string representation. *) -+ - val doc_to_chan : out_channel -> doc -> unit - (** Write the XML document to an output channel. *) - --- -2.20.1 - diff --git a/SOURCES/0034-v2v-Add-op-output-password-file-option.patch b/SOURCES/0034-v2v-Add-op-output-password-file-option.patch deleted file mode 100644 index a214a42..0000000 --- a/SOURCES/0034-v2v-Add-op-output-password-file-option.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 2d80f9e648fc4c7598f77dc0c15faeaacf63137d Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 22 Feb 2018 11:43:33 +0000 -Subject: [PATCH] v2v: Add -op (output password file) option. - -Currently unused, in a future commit this will allow you to pass in a -password to be used when connecting to the target hypervisor. - -(cherry picked from commit a4e181137a38f5767dd1bf05dc482959cb7283be) ---- - v2v/cmdline.ml | 18 ++++++++++++++++++ - v2v/test-v2v-docs.sh | 2 +- - v2v/virt-v2v.pod | 7 +++++++ - 3 files changed, 26 insertions(+), 1 deletion(-) - -diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml -index e80b0689b..bfdc250fc 100644 ---- a/v2v/cmdline.ml -+++ b/v2v/cmdline.ml -@@ -62,6 +62,7 @@ let parse_cmdline () = - let output_conn = ref None in - let output_format = ref None in - let output_name = ref None in -+ let output_password = ref None in - let output_storage = ref None in - let password_file = ref None in - let vddk_config = ref None in -@@ -218,6 +219,8 @@ let parse_cmdline () = - s_"Set output format"; - [ M"on" ], Getopt.String ("name", set_string_option_once "-on" output_name), - s_"Rename guest when converting"; -+ [ M"op" ], Getopt.String ("filename", set_string_option_once "-op" output_password), -+ s_"Use password from file to connect to output hypervisor"; - [ M"os" ], Getopt.String ("storage", set_string_option_once "-os" output_storage), - s_"Set output storage location"; - [ L"password-file" ], Getopt.String ("file", set_string_option_once "--password-file" password_file), -@@ -312,6 +315,7 @@ read the man page virt-v2v(1). - let output_format = !output_format in - let output_mode = !output_mode in - let output_name = !output_name in -+ let output_password = !output_password in - let output_storage = !output_storage in - let password_file = !password_file in - let print_source = !print_source in -@@ -462,6 +466,8 @@ read the man page virt-v2v(1). - | `Glance -> - if output_conn <> None then - error_option_cannot_be_used_in_output_mode "glance" "-oc"; -+ if output_password <> None then -+ error_option_cannot_be_used_in_output_mode "glance" "-op"; - if output_storage <> None then - error_option_cannot_be_used_in_output_mode "glance" "-os"; - if qemu_boot then -@@ -473,6 +479,8 @@ read the man page virt-v2v(1). - - | `Not_set - | `Libvirt -> -+ if output_password <> None then -+ error_option_cannot_be_used_in_output_mode "libvirt" "-op"; - let output_storage = Option.default "default" output_storage in - if qemu_boot then - error_option_cannot_be_used_in_output_mode "libvirt" "--qemu-boot"; -@@ -482,6 +490,8 @@ read the man page virt-v2v(1). - output_format, output_alloc - - | `Local -> -+ if output_password <> None then -+ error_option_cannot_be_used_in_output_mode "local" "-op"; - let os = - match output_storage with - | None -> -@@ -501,6 +511,8 @@ read the man page virt-v2v(1). - error_option_cannot_be_used_in_output_mode "null" "-oc"; - if output_format <> None then - error_option_cannot_be_used_in_output_mode "null" "-of"; -+ if output_password <> None then -+ error_option_cannot_be_used_in_output_mode "null" "-op"; - if output_storage <> None then - error_option_cannot_be_used_in_output_mode "null" "-os"; - if qemu_boot then -@@ -510,6 +522,8 @@ read the man page virt-v2v(1). - Some "raw", Sparse - - | `QEmu -> -+ if output_password <> None then -+ error_option_cannot_be_used_in_output_mode "qemu" "-op"; - let os = - match output_storage with - | None -> -@@ -523,6 +537,8 @@ read the man page virt-v2v(1). - output_format, output_alloc - - | `RHV -> -+ if output_password <> None then -+ error_option_cannot_be_used_in_output_mode "rhv" "-op"; - let os = - match output_storage with - | None -> -@@ -534,6 +550,8 @@ read the man page virt-v2v(1). - output_format, output_alloc - - | `VDSM -> -+ if output_password <> None then -+ error_option_cannot_be_used_in_output_mode "vdsm" "-op"; - let os = - match output_storage with - | None -> -diff --git a/v2v/test-v2v-docs.sh b/v2v/test-v2v-docs.sh -index c8ca193eb..bb1ddefd7 100755 ---- a/v2v/test-v2v-docs.sh -+++ b/v2v/test-v2v-docs.sh -@@ -22,4 +22,4 @@ $TEST_FUNCTIONS - skip_if_skipped - - $top_srcdir/podcheck.pl virt-v2v.pod virt-v2v \ -- --ignore=--debug-overlay,--ic,--if,--in-place,--it,--no-trim,--oa,--oc,--of,--on,--os,--vmtype -+ --ignore=--debug-overlay,--ic,--if,--in-place,--it,--no-trim,--oa,--oc,--of,--on,--op,--os,--vmtype -diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod -index d81a2339c..4df3791a9 100644 ---- a/v2v/virt-v2v.pod -+++ b/v2v/virt-v2v.pod -@@ -442,6 +442,13 @@ If not specified, then the input format is used. - Rename the guest when converting it. If this option is not used then - the output name is the same as the input name. - -+=item B<-op> file -+ -+Supply a file containing a password to be used when connecting to the -+target hypervisor. Note the file should contain the whole password, -+B, and for security the file should have -+mode C<0600> so that others cannot read it. -+ - =item B<-os> storage - - The location of the storage for the converted guest. --- -2.20.1 - diff --git a/SOURCES/0035-v2v-cmdline-Move-definition-to-before-its-only-use.patch b/SOURCES/0035-v2v-cmdline-Move-definition-to-before-its-only-use.patch deleted file mode 100644 index 8e1cdf8..0000000 --- a/SOURCES/0035-v2v-cmdline-Move-definition-to-before-its-only-use.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 128f7736445649001261195b5dfeb0e7d34bbedc Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 22 Mar 2018 10:28:36 +0000 -Subject: [PATCH] v2v: cmdline: Move definition to before its only use. - -(cherry picked from commit 3167ce1f91667de4c4fe1885bb33c06ee6fa38c5) ---- - v2v/cmdline.ml | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml -index bfdc250fc..9bd0e8afc 100644 ---- a/v2v/cmdline.ml -+++ b/v2v/cmdline.ml -@@ -81,7 +81,6 @@ let parse_cmdline () = - let set_vdsm_compat s = vdsm_compat := s in - - let vdsm_ovf_flavour = ref Create_ovf.RHVExportStorageDomain in -- let ovf_flavours_str = String.concat "|" Create_ovf.ovf_flavours in - let set_vdsm_ovf_flavour arg = - vdsm_ovf_flavour := Create_ovf.ovf_flavour_of_string arg in - -@@ -183,7 +182,8 @@ let parse_cmdline () = - let i_options = - String.concat "|" (Modules_list.input_modules ()) - and o_options = -- String.concat "|" (Modules_list.output_modules ()) in -+ String.concat "|" (Modules_list.output_modules ()) -+ and ovf_flavours_str = String.concat "|" Create_ovf.ovf_flavours in - - let argspec = [ - [ S 'b'; L"bridge" ], Getopt.String ("in:out", add_bridge), --- -2.20.1 - diff --git a/SOURCES/0036-v2v-Add-general-mechanism-for-input-and-output-optio.patch b/SOURCES/0036-v2v-Add-general-mechanism-for-input-and-output-optio.patch deleted file mode 100644 index e28a465..0000000 --- a/SOURCES/0036-v2v-Add-general-mechanism-for-input-and-output-optio.patch +++ /dev/null @@ -1,1269 +0,0 @@ -From 390f01ad72c9846a71d721d68ddab4535c77bb4d Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 22 Mar 2018 10:29:23 +0000 -Subject: [PATCH] v2v: Add general mechanism for input and output options - (-io/-oo). - -Currently we have a bunch of ad hoc options like --vddk* and --vdsm* -(and proposed to add --rhv*) to handle extra parameters for input and -output modes/transports. This complicates the command line parsing -and also the clarity of the command line (becauseit's not very obvious -which options apply to which side of the conversion). - -Replace these with a general mechanism for handling input and output -options. - -Thus (for example): - - --vddk-thumbprint=... becomes -io vddk-thumbprint=... - --vdsm-compat=0.10 -oo vdsm-compat=0.10 - -The responsibility for parsing input and output options moves into the -input and output drivers. - -This improves error checking so it's harder now for wrong flags to be -included on the command line when they don't apply to the current mode. - -The old option names are preserved for compatibility. - -(cherry picked from commit 6327e716cdd2f161bc639733f216a3a29d26ad3c) ---- - v2v/Makefile.am | 4 + - v2v/cmdline.ml | 229 ++++++++++++++------------- - v2v/input_libvirt.ml | 4 +- - v2v/input_libvirt.mli | 4 +- - v2v/input_libvirt_vddk.ml | 112 +++++++++----- - v2v/input_libvirt_vddk.mli | 16 +- - v2v/output_vdsm.ml | 79 +++++++++- - v2v/output_vdsm.mli | 13 +- - v2v/test-v2v-docs.sh | 32 +++- - v2v/test-v2v-it-vddk-io-query.sh | 38 +++++ - v2v/test-v2v-o-vdsm-oo-query.sh | 38 +++++ - v2v/test-v2v-o-vdsm-options.sh | 16 +- - v2v/virt-v2v.pod | 258 ++++++++++++++++--------------- - 13 files changed, 531 insertions(+), 312 deletions(-) - create mode 100755 v2v/test-v2v-it-vddk-io-query.sh - create mode 100755 v2v/test-v2v-o-vdsm-oo-query.sh - -diff --git a/v2v/Makefile.am b/v2v/Makefile.am -index 424530b1d..5fcfeadba 100644 ---- a/v2v/Makefile.am -+++ b/v2v/Makefile.am -@@ -307,6 +307,8 @@ TESTS = \ - test-v2v-i-ova-tar.sh \ - test-v2v-i-ova-two-disks.sh \ - test-v2v-i-vmx.sh \ -+ test-v2v-it-vddk-io-query.sh \ -+ test-v2v-o-vdsm-oo-query.sh \ - test-v2v-bad-networks-and-bridges.sh - - if HAVE_LIBVIRT -@@ -468,6 +470,7 @@ EXTRA_DIST += \ - test-v2v-i-vmx-3.vmx \ - test-v2v-i-vmx-4.vmx \ - test-v2v-i-vmx-5.vmx \ -+ test-v2v-it-vddk-io-query.sh \ - test-v2v-machine-readable.sh \ - test-v2v-networks-and-bridges-expected.xml \ - test-v2v-networks-and-bridges.sh \ -@@ -478,6 +481,7 @@ EXTRA_DIST += \ - test-v2v-o-null.sh \ - test-v2v-o-qemu.sh \ - test-v2v-o-rhv.sh \ -+ test-v2v-o-vdsm-oo-query.sh \ - test-v2v-o-vdsm-options.sh \ - test-v2v-oa-option.sh \ - test-v2v-of-option.sh \ -diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml -index 9bd0e8afc..c9b859dd6 100644 ---- a/v2v/cmdline.ml -+++ b/v2v/cmdline.ml -@@ -65,24 +65,6 @@ let parse_cmdline () = - let output_password = ref None in - let output_storage = ref None in - let password_file = ref None in -- let vddk_config = ref None in -- let vddk_cookie = ref None in -- let vddk_libdir = ref None in -- let vddk_nfchostport = ref None in -- let vddk_port = ref None in -- let vddk_snapshot = ref None in -- let vddk_thumbprint = ref None in -- let vddk_transports = ref None in -- let vddk_vimapiver = ref None in -- let vdsm_vm_uuid = ref None in -- let vdsm_ovf_output = ref None in (* default "." *) -- -- let vdsm_compat = ref "0.10" in -- let set_vdsm_compat s = vdsm_compat := s in -- -- let vdsm_ovf_flavour = ref Create_ovf.RHVExportStorageDomain in -- let set_vdsm_ovf_flavour arg = -- vdsm_ovf_flavour := Create_ovf.ovf_flavour_of_string arg in - - let set_string_option_once optname optref arg = - match !optref with -@@ -106,6 +88,15 @@ let parse_cmdline () = - error (f_"unknown -i option: %s") s - in - -+ let input_options = ref [] in -+ let set_input_option_compat k v = -+ input_options := (k, v) :: !input_options -+ in -+ let set_input_option option = -+ let k, v = String.split "=" option in -+ set_input_option_compat k v -+ in -+ - let network_map = ref NetworkMap.empty in - let add_network, add_bridge = - let add flag name t str = -@@ -159,6 +150,15 @@ let parse_cmdline () = - error (f_"unknown -oa option: %s") s - in - -+ let output_options = ref [] in -+ let set_output_option_compat k v = -+ output_options := (k, v) :: !output_options -+ in -+ let set_output_option option = -+ let k, v = String.split "=" option in -+ set_output_option_compat k v -+ in -+ - let root_choice = ref AskRoot in - let set_root_choice = function - | "ask" -> root_choice := AskRoot -@@ -169,12 +169,6 @@ let parse_cmdline () = - error (f_"unknown --root option: %s") s - in - -- let vdsm_image_uuids = ref [] in -- let add_vdsm_image_uuid s = List.push_front s vdsm_image_uuids in -- -- let vdsm_vol_uuids = ref [] in -- let add_vdsm_vol_uuid s = List.push_front s vdsm_vol_uuids in -- - let vmtype_warning _ = - warning (f_"the --vmtype option has been removed and now does nothing") - in -@@ -198,6 +192,8 @@ let parse_cmdline () = - s_"Libvirt URI"; - [ M"if" ], Getopt.String ("format", set_string_option_once "-if" input_format), - s_"Input format (for -i disk)"; -+ [ M"io" ], Getopt.String ("option[=value]", set_input_option), -+ s_"Set option for input mode"; - [ M"it" ], Getopt.String ("transport", set_string_option_once "-it" input_transport), - s_"Input transport"; - [ L"in-place" ], Getopt.Set in_place, Getopt.hidden_option_description; -@@ -219,6 +215,8 @@ let parse_cmdline () = - s_"Set output format"; - [ M"on" ], Getopt.String ("name", set_string_option_once "-on" output_name), - s_"Rename guest when converting"; -+ [ M"oo" ], Getopt.String ("option[=value]", set_output_option), -+ s_"Set option for output mode"; - [ M"op" ], Getopt.String ("filename", set_string_option_once "-op" output_password), - s_"Use password from file to connect to output hypervisor"; - [ M"os" ], Getopt.String ("storage", set_string_option_once "-os" output_storage), -@@ -229,36 +227,36 @@ let parse_cmdline () = - s_"Print source and stop"; - [ L"root" ], Getopt.String ("ask|... ", set_root_choice), - s_"How to choose root filesystem"; -- [ L"vddk-config" ], Getopt.String ("filename", set_string_option_once "--vddk-config" vddk_config), -- s_"Set VDDK config file"; -- [ L"vddk-cookie" ], Getopt.String ("cookie", set_string_option_once "--vddk-cookie" vddk_cookie), -- s_"Set VDDK cookie"; -- [ L"vddk-libdir" ], Getopt.String ("libdir", set_string_option_once "--vddk-libdir" vddk_libdir), -- s_"Set VDDK library parent directory"; -- [ L"vddk-nfchostport" ], Getopt.String ("nfchostport", set_string_option_once "--vddk-nfchostport" vddk_nfchostport), -- s_"Set VDDK nfchostport"; -- [ L"vddk-port" ], Getopt.String ("port", set_string_option_once "--vddk-port" vddk_port), -- s_"Set VDDK port"; -- [ L"vddk-snapshot" ], Getopt.String ("snapshot-moref", set_string_option_once "--vddk-snapshot" vddk_snapshot), -- s_"Set VDDK snapshot"; -- [ L"vddk-thumbprint" ], Getopt.String ("thumbprint", set_string_option_once "--vddk-thumbprint" vddk_thumbprint), -- s_"Set VDDK thumbprint"; -- [ L"vddk-transports" ], Getopt.String ("transports", set_string_option_once "--vddk-transports" vddk_transports), -- s_"Set VDDK transports"; -- [ L"vddk-vimapiver" ], Getopt.String ("apiver", set_string_option_once "--vddk-vimapiver" vddk_vimapiver), -- s_"Set VDDK vimapiver"; -- [ L"vdsm-compat" ], Getopt.Symbol ("0.10|1.1", ["0.10"; "1.1"], set_vdsm_compat), -- s_"Write qcow2 with compat=0.10|1.1"; -- [ L"vdsm-image-uuid" ], Getopt.String ("uuid", add_vdsm_image_uuid), -- s_"Output image UUID(s)"; -- [ L"vdsm-vol-uuid" ], Getopt.String ("uuid", add_vdsm_vol_uuid), -- s_"Output vol UUID(s)"; -- [ L"vdsm-vm-uuid" ], Getopt.String ("uuid", set_string_option_once "--vdsm-vm-uuid" vdsm_vm_uuid), -- s_"Output VM UUID"; -- [ L"vdsm-ovf-output" ], Getopt.String ("-", set_string_option_once "--vdsm-ovf-output" vdsm_ovf_output), -- s_"Output OVF file"; -- [ L"vdsm-ovf-flavour" ], Getopt.Symbol (ovf_flavours_str, Create_ovf.ovf_flavours, set_vdsm_ovf_flavour), -- s_"Set the type of generated OVF (default rhvexp)"; -+ [ L"vddk-config" ], Getopt.String ("filename", set_input_option_compat "vddk-config"), -+ s_"Same as ‘-io vddk-config=filename’"; -+ [ L"vddk-cookie" ], Getopt.String ("cookie", set_input_option_compat "vddk-cookie"), -+ s_"Same as ‘-io vddk-cookie=filename’"; -+ [ L"vddk-libdir" ], Getopt.String ("libdir", set_input_option_compat "vddk-libdir"), -+ s_"Same as ‘-io vddk-libdir=libdir’"; -+ [ L"vddk-nfchostport" ], Getopt.String ("nfchostport", set_input_option_compat "vddk-nfchostport"), -+ s_"Same as ‘-io vddk-nfchostport=nfchostport’"; -+ [ L"vddk-port" ], Getopt.String ("port", set_input_option_compat "vddk-port"), -+ s_"Same as ‘-io vddk-port=port’"; -+ [ L"vddk-snapshot" ], Getopt.String ("snapshot-moref", set_input_option_compat "vddk-snapshot"), -+ s_"Same as ‘-io vddk-snapshot=snapshot-moref’"; -+ [ L"vddk-thumbprint" ], Getopt.String ("thumbprint", set_input_option_compat "vddk-thumbprint"), -+ s_"Same as ‘-io vddk-thumbprint=thumbprint’"; -+ [ L"vddk-transports" ], Getopt.String ("transports", set_input_option_compat "vddk-transports"), -+ s_"Same as ‘-io vddk-transports=transports’"; -+ [ L"vddk-vimapiver" ], Getopt.String ("apiver", set_input_option_compat "vddk-vimapiver"), -+ s_"Same as ‘-io vddk-vimapiver=apiver’"; -+ [ L"vdsm-compat" ], Getopt.String ("0.10|1.1", set_output_option_compat "vdsm-compat"), -+ s_"Same as ‘-oo vdsm-compat=0.10|1.1’"; -+ [ L"vdsm-image-uuid" ], Getopt.String ("uuid", set_output_option_compat "vdsm-image-uuid"), -+ s_"Same as ‘-oo vdsm-image-uuid=uuid’"; -+ [ L"vdsm-vol-uuid" ], Getopt.String ("uuid", set_output_option_compat "vdsm-vol-uuid"), -+ s_"Same as ‘-oo vdsm-vol-uuid=uuid’"; -+ [ L"vdsm-vm-uuid" ], Getopt.String ("uuid", set_output_option_compat "vdsm-vm-uuid"), -+ s_"Same as ‘-oo vdsm-vm-uuid=uuid’"; -+ [ L"vdsm-ovf-output" ], Getopt.String ("dir", set_output_option_compat "vdsm-ovf-output"), -+ s_"Same as ‘-oo vdsm-ovf-output=dir’"; -+ [ L"vdsm-ovf-flavour" ], Getopt.String (ovf_flavours_str, set_output_option_compat "vdsm-ovf-flavour"), -+ s_"Same as ‘-oo vdsm-ovf-flavour=flavour’"; - [ L"vmtype" ], Getopt.String ("-", vmtype_warning), - s_"Ignored for backwards compatibility"; - ] in -@@ -297,6 +295,7 @@ read the man page virt-v2v(1). - let input_conn = !input_conn in - let input_format = !input_format in - let input_mode = !input_mode in -+ let input_options = List.rev !input_options in - let input_transport = - match !input_transport with - | None -> None -@@ -315,28 +314,13 @@ read the man page virt-v2v(1). - let output_format = !output_format in - let output_mode = !output_mode in - let output_name = !output_name in -+ let output_options = List.rev !output_options in - let output_password = !output_password in - let output_storage = !output_storage in - let password_file = !password_file in - let print_source = !print_source in - let qemu_boot = !qemu_boot in - let root_choice = !root_choice in -- let vddk_options = -- { Input_libvirt_vddk.vddk_config = !vddk_config; -- vddk_cookie = !vddk_cookie; -- vddk_libdir = !vddk_libdir; -- vddk_nfchostport = !vddk_nfchostport; -- vddk_port = !vddk_port; -- vddk_snapshot = !vddk_snapshot; -- vddk_thumbprint = !vddk_thumbprint; -- vddk_transports = !vddk_transports; -- vddk_vimapiver = !vddk_vimapiver } in -- let vdsm_compat = !vdsm_compat in -- 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 = Option.default "." !vdsm_ovf_output in -- let vdsm_ovf_flavour = !vdsm_ovf_flavour in - - (* No arguments and machine-readable mode? Print out some facts - * about what this binary supports. -@@ -349,6 +333,7 @@ read the man page virt-v2v(1). - printf "vddk\n"; - printf "colours-option\n"; - printf "vdsm-compat-option\n"; -+ printf "io/oo\n"; - List.iter (printf "input:%s\n") (Modules_list.input_modules ()); - List.iter (printf "output:%s\n") (Modules_list.output_modules ()); - List.iter (printf "convert:%s\n") (Modules_list.convert_modules ()); -@@ -356,6 +341,65 @@ read the man page virt-v2v(1). - exit 0 - ); - -+ (* Input transport affects whether some input options should or -+ * should not be used. -+ *) -+ let input_transport = -+ let is_query = input_options = ["?", ""] in -+ let no_options () = -+ if is_query then ( -+ printf (f_"No -io (input options) are supported with this input transport.\n"); -+ exit 0 -+ ) -+ else if input_options <> [] then -+ error (f_"no -io (input options) are allowed here"); -+ in -+ match input_transport with -+ | None -> no_options (); None -+ | Some `SSH -> no_options (); Some `SSH -+ | Some `VDDK -> -+ if is_query then ( -+ Input_libvirt_vddk.print_input_options (); -+ exit 0 -+ ) -+ else ( -+ let vddk_options = -+ Input_libvirt_vddk.parse_input_options input_options in -+ Some (`VDDK vddk_options) -+ ) in -+ -+ (* Output mode affects whether some output options should or -+ * should not be used. -+ *) -+ let output_mode = -+ let is_query = output_options = ["?", ""] in -+ let no_options () = -+ if is_query then ( -+ printf (f_"No -oo (output options) are supported in this output mode.\n"); -+ exit 0 -+ ) -+ else if output_options <> [] then -+ error (f_"no -oo (output options) are allowed here"); -+ in -+ match output_mode with -+ | `Not_set -> no_options (); `Not_set -+ | `Glance -> no_options (); `Glance -+ | `Libvirt -> no_options (); `Libvirt -+ | `Local -> no_options (); `Local -+ | `Null -> no_options (); `Null -+ | `RHV -> no_options (); `RHV -+ | `QEmu -> no_options (); `QEmu -+ | `VDSM -> -+ if is_query then ( -+ Output_vdsm.print_output_options (); -+ exit 0 -+ ) -+ else ( -+ let vdsm_options = -+ Output_vdsm.parse_output_options output_options in -+ `VDSM vdsm_options -+ ) in -+ - (* Parse out the password from the password file. *) - let password = - match password_file with -@@ -364,27 +408,6 @@ read the man page virt-v2v(1). - let password = read_first_line_from_file filename in - Some password in - -- (* Input transport affects whether some parameters should or -- * should not be used. -- *) -- (match input_transport with -- | None -- | Some `SSH -> -- if !vddk_config <> None || -- !vddk_cookie <> None || -- !vddk_libdir <> None || -- !vddk_nfchostport <> None || -- !vddk_port <> None || -- !vddk_snapshot <> None || -- !vddk_thumbprint <> None || -- !vddk_transports <> None || -- !vddk_vimapiver <> None then -- error (f_"‘--vddk-*’ options should only be used when conversion via the nbdkit VDDK plugin has been enabled, ie. using ‘-it vddk’.") -- | Some `VDDK -> -- if !vddk_thumbprint = None then -- error (f_"‘--vddk-thumbprint’ is required when using ‘-it vddk’.") -- ); -- - (* Parsing of the argument(s) depends on the input mode. *) - let input = - match input_mode with -@@ -410,11 +433,10 @@ read the man page virt-v2v(1). - let input_transport = - match input_transport with - | None -> None -- | Some `VDDK -> Some `VDDK -+ | (Some (`VDDK _) as vddk) -> vddk - | Some `SSH -> - error (f_"only ‘-it vddk’ can be used here") in -- Input_libvirt.input_libvirt vddk_options password -- input_conn input_transport guest -+ Input_libvirt.input_libvirt password input_conn input_transport guest - - | `LibvirtXML -> - (* -i libvirtxml: Expecting a filename (XML file). *) -@@ -445,7 +467,7 @@ read the man page virt-v2v(1). - match input_transport with - | None -> None - | Some `SSH -> Some `SSH -- | Some `VDDK -> -+ | Some (`VDDK _) -> - error (f_"only ‘-it ssh’ can be used here") in - Input_vmx.input_vmx input_transport arg in - -@@ -549,7 +571,7 @@ read the man page virt-v2v(1). - Output_rhv.output_rhv os output_alloc, - output_format, output_alloc - -- | `VDSM -> -+ | `VDSM vdsm_options -> - if output_password <> None then - error_option_cannot_be_used_in_output_mode "vdsm" "-op"; - let os = -@@ -559,21 +581,6 @@ read the man page virt-v2v(1). - | Some d -> d in - if qemu_boot then - error_option_cannot_be_used_in_output_mode "vdsm" "--qemu-boot"; -- let vdsm_vm_uuid = -- match vdsm_vm_uuid with -- | None -> -- error (f_"-o vdsm: --vdsm-image-uuid was not specified") -- | Some s -> s in -- if vdsm_image_uuids = [] || vdsm_vol_uuids = [] then -- error (f_"-o vdsm: either --vdsm-vol-uuid or --vdsm-vm-uuid was not specified"); -- let vdsm_options = { -- Output_vdsm.image_uuids = vdsm_image_uuids; -- vol_uuids = vdsm_vol_uuids; -- vm_uuid = vdsm_vm_uuid; -- ovf_output = vdsm_ovf_output; -- compat = vdsm_compat; -- ovf_flavour = vdsm_ovf_flavour; -- } in - Output_vdsm.output_vdsm os vdsm_options output_alloc, - output_format, output_alloc in - -diff --git a/v2v/input_libvirt.ml b/v2v/input_libvirt.ml -index 25c81b924..377257dc2 100644 ---- a/v2v/input_libvirt.ml -+++ b/v2v/input_libvirt.ml -@@ -27,7 +27,7 @@ open Types - open Utils - - (* Choose the right subclass based on the URI. *) --let input_libvirt vddk_options password libvirt_uri input_transport guest = -+let input_libvirt password libvirt_uri input_transport guest = - match libvirt_uri with - | None -> - Input_libvirt_other.input_libvirt_other password libvirt_uri guest -@@ -53,7 +53,7 @@ let input_libvirt vddk_options password libvirt_uri input_transport guest = - password libvirt_uri parsed_uri server guest - - (* vCenter or ESXi using nbdkit vddk plugin *) -- | Some server, Some ("esx"|"gsx"|"vpx"), Some `VDDK -> -+ | Some server, Some ("esx"|"gsx"|"vpx"), Some (`VDDK vddk_options) -> - Input_libvirt_vddk.input_libvirt_vddk vddk_options password - libvirt_uri parsed_uri guest - -diff --git a/v2v/input_libvirt.mli b/v2v/input_libvirt.mli -index 6f9162482..08824bb67 100644 ---- a/v2v/input_libvirt.mli -+++ b/v2v/input_libvirt.mli -@@ -18,7 +18,7 @@ - - (** [-i libvirt] source. *) - --val input_libvirt : Input_libvirt_vddk.vddk_options -> string option -> string option -> [`VDDK] option -> string -> Types.input --(** [input_libvirt vddk_options password libvirt_uri input_transport guest] -+val input_libvirt : string option -> string option -> [`VDDK of Input_libvirt_vddk.vddk_options] option -> string -> Types.input -+(** [input_libvirt password libvirt_uri input_transport guest] - creates and returns a new {!Types.input} object specialized for reading - input from libvirt sources. *) -diff --git a/v2v/input_libvirt_vddk.ml b/v2v/input_libvirt_vddk.ml -index a53f3e71d..0b3ed7af9 100644 ---- a/v2v/input_libvirt_vddk.ml -+++ b/v2v/input_libvirt_vddk.ml -@@ -33,22 +33,73 @@ open Xpath_helpers - - open Printf - --type vddk_options = { -- vddk_config : string option; -- vddk_cookie : string option; -- vddk_libdir : string option; -- vddk_nfchostport : string option; -- vddk_port : string option; -- vddk_snapshot : string option; -- vddk_thumbprint : string option; -- vddk_transports : string option; -- vddk_vimapiver : string option; --} -+type vddk_options = (string * string) list -+ -+(* List of vddk-* input options. *) -+let vddk_option_keys = -+ [ "config"; -+ "cookie"; -+ "libdir"; -+ "nfchostport"; -+ "port"; -+ "snapshot"; -+ "thumbprint"; -+ "transports"; -+ "vimapiver" ] -+ -+let print_input_options () = -+ printf (f_"Input options (-io) which can be used with -it vddk: -+ -+ -io vddk-thumbprint=xx:xx:xx:... -+ VDDK server thumbprint (required) -+ -+All other settings are optional: -+ -+ -io vddk-config=FILE VDDK configuration file -+ -io vddk-cookie=COOKIE VDDK cookie -+ -io vddk-libdir=LIBDIR VDDK library parent directory -+ -io vddk-nfchostport=PORT VDDK nfchostport -+ -io vddk-port=PORT VDDK port -+ -io vddk-snapshot=SNAPSHOT-MOREF -+ VDDK snapshot moref -+ -io vddk-transports=MODE:MODE:.. -+ VDDK transports -+ -io vddk-vimapiver=APIVER VDDK vimapiver -+ -+Refer to nbdkit-vddk-plugin(1) and the VDDK documentation for further -+information on these settings. -+") -+ -+let parse_input_options options = -+ (* Check there are no options we don't understand. Also removes -+ * the "vddk-" prefix from the internal list. -+ *) -+ let options = -+ List.map ( -+ fun (key, value) -> -+ let error_invalid_key () = -+ error (f_"-it vddk: ‘-io %s’ is not a valid input option") key -+ in -+ if not (String.is_prefix key "vddk-") then error_invalid_key (); -+ let key = String.sub key 5 (String.length key-5) in -+ if not (List.mem key vddk_option_keys) then error_invalid_key (); -+ -+ (key, value) -+ ) options in -+ -+ (* Check no option appears twice. *) -+ let keys = List.map fst options in -+ if List.length keys <> List.length (List.sort_uniq keys) then -+ error (f_"-it vddk: duplicate -io options on the command line"); -+ -+ options - - (* Subclass specialized for handling VMware via nbdkit vddk plugin. *) - class input_libvirt_vddk vddk_options password libvirt_uri parsed_uri guest = - (* The VDDK path. *) -- let libdir = vddk_options.vddk_libdir in -+ let libdir = -+ try Some (List.assoc "libdir" vddk_options) -+ with Not_found -> None in - - (* VDDK libraries are located under lib32/ or lib64/ relative to the - * libdir. Note this is unrelated to Linux multilib or multiarch. -@@ -68,7 +119,7 @@ class input_libvirt_vddk vddk_options password libvirt_uri parsed_uri guest = - | None -> () - | Some libdir -> - if not (is_directory libdir) then -- error (f_"‘--vddk-libdir %s’ does not point to a directory. See \"INPUT FROM VDDK\" in the virt-v2v(1) manual.") libdir -+ error (f_"‘-io vddk-libdir=%s’ does not point to a directory. See \"INPUT FROM VDDK\" in the virt-v2v(1) manual.") libdir - ); - - (match library_path with -@@ -122,15 +173,15 @@ See also \"INPUT FROM VDDK\" in the virt-v2v(1) manual.") - else - error (f_"nbdkit VDDK plugin is not installed or not working. It is required if you want to use VDDK. - --It looks like you did not set the right path in the ‘--vddk-libdir’ option, or your copy of the VDDK directory is incomplete. There should be a library called ’/%s/libvixDiskLib.so.?’. -+It looks like you did not set the right path in the ‘-io vddk-libdir’ option, or your copy of the VDDK directory is incomplete. There should be a library called ’/%s/libvixDiskLib.so.?’. - - See also \"INPUT FROM VDDK\" in the virt-v2v(1) manual.") libNN - ) - in - - let error_unless_thumbprint () = -- if vddk_options.vddk_thumbprint = None then -- error (f_"You must pass the ‘--vddk-thumbprint’ option with the SSL thumbprint of the VMware server. To find the thumbprint, see the nbdkit-vddk-plugin(1) manual. See also \"INPUT FROM VDDK\" in the virt-v2v(1) manual.") -+ if not (List.mem_assoc "thumbprint" vddk_options) then -+ error (f_"You must pass the ‘-io vddk-thumbprint’ option with the SSL thumbprint of the VMware server. To find the thumbprint, see the nbdkit-vddk-plugin(1) manual. See also \"INPUT FROM VDDK\" in the virt-v2v(1) manual.") - in - - (* Check that nbdkit was compiled with SELinux support (for the -@@ -147,18 +198,6 @@ See also \"INPUT FROM VDDK\" in the virt-v2v(1) manual.") libNN - error (f_"nbdkit was compiled without SELinux support. You will have to recompile nbdkit with libselinux-devel installed, or else set SELinux to Permissive mode while doing the conversion.") - in - -- (* List of passthrough parameters. *) -- let vddk_passthrus = -- [ "config", (fun { vddk_config } -> vddk_config); -- "cookie", (fun { vddk_cookie } -> vddk_cookie); -- "libdir", (fun { vddk_libdir } -> vddk_libdir); -- "nfchostport", (fun { vddk_nfchostport } -> vddk_nfchostport); -- "port", (fun { vddk_port } -> vddk_port); -- "snapshot", (fun { vddk_snapshot } -> vddk_snapshot); -- "thumbprint", (fun { vddk_thumbprint } -> vddk_thumbprint); -- "transports", (fun { vddk_transports } -> vddk_transports); -- "vimapiver", (fun { vddk_vimapiver } -> vddk_vimapiver) ] in -- - object - inherit input_libvirt password libvirt_uri guest as super - -@@ -172,14 +211,9 @@ object - - method as_options = - let pt_options = -- String.concat "" ( -- List.map ( -- fun (name, get_field) -> -- match get_field vddk_options with -- | None -> "" -- | Some field -> sprintf " --vddk-%s %s" name field -- ) vddk_passthrus -- ) in -+ String.concat "" -+ (List.map (fun (k, v) -> -+ sprintf " -io vddk-%s=%s" k v) vddk_options) in - sprintf "%s -it vddk %s" - super#as_options (* superclass prints "-i libvirt etc" *) - pt_options -@@ -284,11 +318,7 @@ object - add_arg (sprintf "vm=moref=%s" moref); - - (* The passthrough parameters. *) -- List.iter ( -- fun (name, get_field) -> -- Option.may (fun field -> add_arg (sprintf "%s=%s" name field)) -- (get_field vddk_options) -- ) vddk_passthrus; -+ List.iter (fun (k, v) -> add_arg (sprintf "%s=%s" k v)) vddk_options; - - get_args () in - -diff --git a/v2v/input_libvirt_vddk.mli b/v2v/input_libvirt_vddk.mli -index c8606c72a..1cebba506 100644 ---- a/v2v/input_libvirt_vddk.mli -+++ b/v2v/input_libvirt_vddk.mli -@@ -18,19 +18,13 @@ - - (** [-i libvirt] when the source is VMware via nbdkit vddk plugin *) - --type vddk_options = { -- vddk_config : string option; -- vddk_cookie : string option; -- vddk_libdir : string option; -- vddk_nfchostport : string option; -- vddk_port : string option; -- vddk_snapshot : string option; -- vddk_thumbprint : string option; -- vddk_transports : string option; -- vddk_vimapiver : string option; --} -+type vddk_options - (** Various options passed through to the nbdkit vddk plugin unmodified. *) - -+val print_input_options : unit -> unit -+val parse_input_options : (string * string) list -> vddk_options -+(** Print and parse vddk -io options. *) -+ - val input_libvirt_vddk : vddk_options -> string option -> string option -> Xml.uri -> string -> Types.input - (** [input_libvirt_vddk vddk_options password libvirt_uri parsed_uri guest] - creates and returns a {!Types.input} object specialized for reading -diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml -index b76a2e930..92b3fd122 100644 ---- a/v2v/output_vdsm.ml -+++ b/v2v/output_vdsm.ml -@@ -35,23 +35,90 @@ type vdsm_options = { - ovf_flavour : Create_ovf.ovf_flavour; - } - -+let ovf_flavours_str = String.concat "|" Create_ovf.ovf_flavours -+ -+let print_output_options () = -+ printf (f_"Output options (-oo) which can be used with -o vdsm: -+ -+ -oo vdsm-compat=0.10|1.1 Write qcow2 with compat=0.10|1.1 -+ (default: 0.10) -+ -oo vdsm-vm-uuid=UUID VM UUID (required) -+ -oo vdsm-ovf-output=DIR OVF metadata directory (required) -+ -oo vdsm-ovf-flavour=%s -+ Set the type of generated OVF (default: rhvexp) -+ -+For each disk you must supply one of each of these options: -+ -+ -oo vdsm-image-uuid=UUID Image directory UUID -+ -oo vdsm-vol-uuid=UUID Disk volume UUID -+") ovf_flavours_str -+ -+let parse_output_options options = -+ let vm_uuid = ref None in -+ let ovf_output = ref None in (* default "." *) -+ let compat = ref "0.10" in -+ let ovf_flavour = ref Create_ovf.RHVExportStorageDomain in -+ let image_uuids = ref [] in -+ let vol_uuids = ref [] in -+ -+ List.iter ( -+ function -+ | "vdsm-compat", "0.10" -> compat := "0.10" -+ | "vdsm-compat", "1.1" -> compat := "1.1" -+ | "vdsm-compat", v -> -+ error (f_"-o vdsm: unknown vdsm-compat level ‘%s’") v -+ | "vdsm-vm-uuid", v -> -+ if !vm_uuid <> None then -+ error (f_"-o vdsm: -oo vdsm-vm-uuid set twice"); -+ vm_uuid := Some v; -+ | "vdsm-ovf-output", v -> -+ if !ovf_output <> None then -+ error (f_"-o vdsm: -oo vdsm-ovf-output set twice"); -+ ovf_output := Some v; -+ | "vdsm-ovf-flavour", v -> -+ ovf_flavour := Create_ovf.ovf_flavour_of_string v -+ | "vdsm-image-uuid", v -> -+ List.push_front v image_uuids -+ | "vdsm-vol-uuid", v -> -+ List.push_front v vol_uuids -+ | k, _ -> -+ error (f_"-o vdsm: unknown output option ‘-oo %s’") k -+ ) options; -+ -+ let compat = !compat in -+ let image_uuids = List.rev !image_uuids in -+ let vol_uuids = List.rev !vol_uuids in -+ if image_uuids = [] || vol_uuids = [] then -+ error (f_"-o vdsm: either -oo vdsm-vol-uuid or -oo vdsm-vm-uuid was not specified"); -+ let vm_uuid = -+ match !vm_uuid with -+ | None -> -+ error (f_"-o vdsm: -oo vdsm-image-uuid was not specified") -+ | Some uuid -> uuid in -+ let ovf_output = Option.default "." !ovf_output in -+ let ovf_flavour = !ovf_flavour in -+ -+ { image_uuids; vol_uuids; vm_uuid; ovf_output; compat; ovf_flavour } -+ - class output_vdsm os vdsm_options output_alloc = - object - inherit output - - method as_options = -- sprintf "-o vdsm -os %s%s%s --vdsm-vm-uuid %s --vdsm-ovf-output %s%s%s" os -+ sprintf "-o vdsm -os %s%s%s -oo vdsm-vm-uuid=%s -oo vdsm-ovf-output=%s%s%s" os - (String.concat "" -- (List.map (sprintf " --vdsm-image-uuid %s") vdsm_options.image_uuids)) -+ (List.map (sprintf " -oo vdsm-image-uuid=%s") -+ vdsm_options.image_uuids)) - (String.concat "" -- (List.map (sprintf " --vdsm-vol-uuid %s") vdsm_options.vol_uuids)) -+ (List.map (sprintf " -oo vdsm-vol-uuid=%s") -+ vdsm_options.vol_uuids)) - vdsm_options.vm_uuid - vdsm_options.ovf_output - (match vdsm_options.compat with - | "0.10" -> "" (* currently this is the default, so don't print it *) -- | s -> sprintf " --vdsm-compat=%s" s) -+ | s -> sprintf " -oo vdsm-compat=%s" s) - (match vdsm_options.ovf_flavour with -- | Create_ovf.OVirt -> "--vdsm-ovf-flavour=ovf" -+ | Create_ovf.OVirt -> "-oo vdsm-ovf-flavour=ovf" - (* currently this is the default, so don't print it *) - | Create_ovf.RHVExportStorageDomain -> "") - -@@ -84,7 +151,7 @@ object - method prepare_targets _ targets = - if List.length vdsm_options.image_uuids <> List.length targets || - List.length vdsm_options.vol_uuids <> List.length targets then -- error (f_"the number of ‘--vdsm-image-uuid’ and ‘--vdsm-vol-uuid’ parameters passed on the command line has to match the number of guest disk images (for this guest: %d)") -+ error (f_"the number of ‘-oo vdsm-image-uuid’ and ‘-oo vdsm-vol-uuid’ parameters passed on the command line has to match the number of guest disk images (for this guest: %d)") - (List.length targets); - - let mp, uuid = -diff --git a/v2v/output_vdsm.mli b/v2v/output_vdsm.mli -index 6ed684638..36f327900 100644 ---- a/v2v/output_vdsm.mli -+++ b/v2v/output_vdsm.mli -@@ -18,16 +18,13 @@ - - (** [-o vdsm] target. *) - --type vdsm_options = { -- 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 *) -- compat : string; (* --vdsm-compat=0.10|1.1 *) -- ovf_flavour : Create_ovf.ovf_flavour; --} -+type vdsm_options - (** Miscellaneous extra command line parameters used by VDSM. *) - -+val print_output_options : unit -> unit -+val parse_output_options : (string * string) list -> vdsm_options -+(** Print and parse vdsm -oo options. *) -+ - val output_vdsm : string -> vdsm_options -> Types.output_allocation -> Types.output - (** [output_vdsm os vdsm_options output_alloc] creates and - returns a new {!Types.output} object specialized for writing -diff --git a/v2v/test-v2v-docs.sh b/v2v/test-v2v-docs.sh -index bb1ddefd7..da98050ee 100755 ---- a/v2v/test-v2v-docs.sh -+++ b/v2v/test-v2v-docs.sh -@@ -22,4 +22,34 @@ $TEST_FUNCTIONS - skip_if_skipped - - $top_srcdir/podcheck.pl virt-v2v.pod virt-v2v \ -- --ignore=--debug-overlay,--ic,--if,--in-place,--it,--no-trim,--oa,--oc,--of,--on,--op,--os,--vmtype -+ --ignore=\ -+--debug-overlay,\ -+--ic,\ -+--if,\ -+--in-place,\ -+--io,\ -+--it,\ -+--no-trim,\ -+--oa,\ -+--oc,\ -+--of,\ -+--on,\ -+--oo,\ -+--op,\ -+--os,\ -+--vddk-config,\ -+--vddk-cookie,\ -+--vddk-libdir,\ -+--vddk-nfchostport,\ -+--vddk-port,\ -+--vddk-snapshot,\ -+--vddk-thumbprint,\ -+--vddk-transports,\ -+--vddk-vimapiver,\ -+--vdsm-compat,\ -+--vdsm-image-uuid,\ -+--vdsm-ovf-flavour,\ -+--vdsm-ovf-output,\ -+--vdsm-vm-uuid,\ -+--vdsm-vol-uuid,\ -+--vmtype -diff --git a/v2v/test-v2v-it-vddk-io-query.sh b/v2v/test-v2v-it-vddk-io-query.sh -new file mode 100755 -index 000000000..014e30207 ---- /dev/null -+++ b/v2v/test-v2v-it-vddk-io-query.sh -@@ -0,0 +1,38 @@ -+#!/bin/bash - -+# libguestfs virt-v2v test script -+# Copyright (C) 2018 Red Hat Inc. -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ -+# Test -io "?" option. -+ -+set -e -+ -+$TEST_FUNCTIONS -+skip_if_skipped -+ -+export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools" -+export VIRTIO_WIN="$top_srcdir/test-data/fake-virtio-win" -+ -+f=test-v2v-it-vddk-io-query.actual -+rm -f $f -+ -+$VG virt-v2v --debug-gc \ -+ -it vddk -io "?" > $f -+ -+grep -- "-io vddk-config" $f -+grep -- "-io vddk-thumbprint" $f -+ -+rm $f -diff --git a/v2v/test-v2v-o-vdsm-oo-query.sh b/v2v/test-v2v-o-vdsm-oo-query.sh -new file mode 100755 -index 000000000..5691446ea ---- /dev/null -+++ b/v2v/test-v2v-o-vdsm-oo-query.sh -@@ -0,0 +1,38 @@ -+#!/bin/bash - -+# libguestfs virt-v2v test script -+# Copyright (C) 2018 Red Hat Inc. -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ -+# Test -oo "?" option. -+ -+set -e -+ -+$TEST_FUNCTIONS -+skip_if_skipped -+ -+export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools" -+export VIRTIO_WIN="$top_srcdir/test-data/fake-virtio-win" -+ -+f=test-v2v-o-vdsm-oo-query.actual -+rm -f $f -+ -+$VG virt-v2v --debug-gc \ -+ -o vdsm -oo "?" > $f -+ -+grep -- "-oo vdsm-compat" $f -+grep -- "-oo vdsm-image-uuid" $f -+ -+rm $f -diff --git a/v2v/test-v2v-o-vdsm-options.sh b/v2v/test-v2v-o-vdsm-options.sh -index 4ad5d4aad..65ce1234e 100755 ---- a/v2v/test-v2v-o-vdsm-options.sh -+++ b/v2v/test-v2v-o-vdsm-options.sh -@@ -16,7 +16,7 @@ - # along with this program; if not, write to the Free Software - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - --# Test -o vdsm options --vdsm-*-uuid -+# Test -o vdsm options -oo vdsm-*-uuid - - set -e - set -x -@@ -44,19 +44,19 @@ mkdir $d/12345678-1234-1234-1234-123456789abc/master - mkdir $d/12345678-1234-1234-1234-123456789abc/master/vms - mkdir $d/12345678-1234-1234-1234-123456789abc/master/vms/VM - --# The --vdsm-*-uuid options don't actually check that the -+# The -oo vdsm-*-uuid options don't actually check that the - # parameter is a UUID, which is useful here. - - $VG virt-v2v --debug-gc \ - -i libvirt -ic "$libvirt_uri" windows \ - -o vdsm -os $d/12345678-1234-1234-1234-123456789abc \ - -of qcow2 \ -- --vdsm-image-uuid IMAGE \ -- --vdsm-vol-uuid VOL \ -- --vdsm-vm-uuid VM \ -- --vdsm-ovf-output $d/12345678-1234-1234-1234-123456789abc/master/vms/VM \ -- --vdsm-compat=1.1 \ -- --vdsm-ovf-flavour=ovirt -+ -oo vdsm-image-uuid=IMAGE \ -+ -oo vdsm-vol-uuid=VOL \ -+ -oo vdsm-vm-uuid=VM \ -+ -oo vdsm-ovf-output=$d/12345678-1234-1234-1234-123456789abc/master/vms/VM \ -+ -oo vdsm-compat=1.1 \ -+ -oo vdsm-ovf-flavour=ovirt - - # 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 4df3791a9..5dd888e77 100644 ---- a/v2v/virt-v2v.pod -+++ b/v2v/virt-v2v.pod -@@ -273,6 +273,47 @@ For I<-i disk> only, this specifies the format of the input disk - image. For other input methods you should specify the input - format in the metadata. - -+=item B<-io> OPTION=VALUE -+ -+Set input option(s) related to the current input mode or transport. -+To display short help on what options are available you can use: -+ -+ virt-v2v -it vddk -io "?" -+ -+=item B<-io vddk-libdir=>LIBDIR -+ -+Set the VDDK library directory. This directory should I -+subdirectories called F, F etc., but do not include -+F actually in the parameter. -+ -+In most cases this parameter is required when using the I<-it vddk> -+(VDDK) transport. See L below for details. -+ -+=item B<-io vddk-thumbprint=>xx:xx:xx:... -+ -+Set the thumbprint of the remote VMware server. -+ -+This parameter is required when using the I<-it vddk> (VDDK) transport. -+See L below for details. -+ -+=item B<-io vddk-config=>FILENAME -+ -+=item B<-io vddk-cookie=>COOKIE -+ -+=item B<-io vddk-nfchostport=>PORT -+ -+=item B<-io vddk-port=>PORT -+ -+=item B<-io vddk-snapshot=>SNAPSHOT-MOREF -+ -+=item B<-io vddk-transports=>MODE:MODE:... -+ -+=item B<-io vddk-vimapiver=>APIVER -+ -+When using VDDK mode, these options are passed unmodified to the -+L VDDK plugin. Please refer to L. -+These are all optional. -+ - =item B<-it> B - - When using I<-i vmx>, this enables the ssh transport. -@@ -282,7 +323,7 @@ See L below. - - Use VMware VDDK as a transport to copy the input disks. See - L below. If you use this parameter then you may --need to use other I<--vddk*> options to specify how to connect through -+need to use other I<-io vddk*> options to specify how to connect through - VDDK. - - =item B<--keys-from-stdin> -@@ -442,6 +483,95 @@ If not specified, then the input format is used. - Rename the guest when converting it. If this option is not used then - the output name is the same as the input name. - -+=item B<-oo> OPTION=VALUE -+ -+Set output option(s) related to the current output mode. -+To display short help on what options are available you can use: -+ -+ virt-v2v -o vdsm -oo "?" -+ -+=item B<-oo vdsm-compat=0.10> -+ -+=item B<-oo vdsm-compat=1.1> -+ -+If I<-o vdsm> and the output format is qcow2, then we add the qcow2 -+I option to the output file for compatibility with RHEL 6 -+(see L). -+ -+If I<-oo vdsm-compat=1.1> is used then modern qcow2 (I) -+files are generated instead. -+ -+Currently I<-oo vdsm-compat=0.10> is the default, but this will change -+to I<-oo vdsm-compat=1.1> in a future version of virt-v2v (when we can -+assume that everyone is using a modern version of qemu). -+ -+B output>. All other output -+modes (including I<-o rhv>) generate modern qcow2 I -+files, always. -+ -+If this option is available, then C will appear in -+the I<--machine-readable> output. -+ -+=item B<-oo vdsm-image-uuid=>UUID -+ -+=item B<-oo vdsm-vol-uuid=>UUID -+ -+=item B<-oo vdsm-vm-uuid=>UUID -+ -+=item B<-oo vdsm-ovf-output=>DIR -+ -+Normally the RHV 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 -+control: -+ -+=over 4 -+ -+=item * -+ -+the image directory of each guest disk (I<-oo vdsm-image-uuid>) (this -+option is passed once for each guest disk) -+ -+=item * -+ -+UUIDs for each guest disk (I<-oo vdsm-vol-uuid>) (this option -+is passed once for each guest disk) -+ -+=item * -+ -+the OVF file name (I<-oo vdsm-vm-uuid>). -+ -+=item * -+ -+the OVF output directory (default current directory) (I<-oo vdsm-ovf-output>). -+ -+=back -+ -+The format of UUIDs is: C<12345678-1234-1234-1234-123456789abc> (each -+hex digit can be C<0-9> or C), conforming to S. -+ -+These options can only be used with I<-o vdsm>. -+ -+=item B<-oo vdsm-ovf-flavour=>flavour -+ -+This option controls the format of the OVF generated at the end of conversion. -+Currently there are two possible flavours: -+ -+=over 4 -+ -+=item rhevexp -+ -+The OVF format used in RHV export storage domain. -+ -+=item ovirt -+ -+The OVF format understood by oVirt REST API. -+ -+=back -+ -+For backward compatibility the default is I, but this may change in -+the future. -+ - =item B<-op> file - - Supply a file containing a password to be used when connecting to the -@@ -538,122 +668,6 @@ boot an operating system from the first virtio disk. Specifically, - F must be on the first virtio disk, and it cannot chainload an - OS which is not in the first virtio disk. - --=item B<--vddk-libdir> LIBDIR -- --Set the VDDK library directory. This directory should I --subdirectories called F, F etc., but do not include --F actually in the parameter. -- --In most cases this parameter is required when using the I<-it vddk> --(VDDK) transport. See L below for details. -- --=item B<--vddk-thumbprint> xx:xx:xx:... -- --Set the thumbprint of the remote VMware server. -- --This parameter is required when using the I<-it vddk> (VDDK) transport. --See L below for details. -- --=item B<--vddk-config> FILENAME -- --=item B<--vddk-cookie> COOKIE -- --=item B<--vddk-nfchostport> PORT -- --=item B<--vddk-port> PORT -- --=item B<--vddk-snapshot> SNAPSHOT-MOREF -- --=item B<--vddk-transports> MODE:MODE:... -- --=item B<--vddk-vimapiver> APIVER -- --When using VDDK mode, these options are passed unmodified to the --L VDDK plugin. Please refer to L. --These are all optional. -- --=item B<--vdsm-compat=0.10> -- --=item B<--vdsm-compat=1.1> -- --If I<-o vdsm> and the output format is qcow2, then we add the qcow2 --I option to the output file for compatibility with RHEL 6 --(see L). -- --If I<--vdsm-compat=1.1> is used then modern qcow2 (I) --files are generated instead. -- --Currently I<--vdsm-compat=0.10> is the default, but this will change --to I<--vdsm-compat=1.1> in a future version of virt-v2v (when we can --assume that everyone is using a modern version of qemu). -- --B output>. All other output --modes (including I<-o rhv>) generate modern qcow2 I --files, always. -- --If this option is available, then C will appear in --the I<--machine-readable> output. -- --=item B<--vdsm-image-uuid> UUID -- --=item B<--vdsm-vol-uuid> UUID -- --=item B<--vdsm-vm-uuid> UUID -- --=item B<--vdsm-ovf-output> -- --Normally the RHV 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 --control: -- --=over 4 -- --=item * -- --the image directory of each guest disk (I<--vdsm-image-uuid>) (this --option is passed once for each guest disk) -- --=item * -- --UUIDs for each guest disk (I<--vdsm-vol-uuid>) (this option --is passed once for each guest disk) -- --=item * -- --the OVF file name (I<--vdsm-vm-uuid>). -- --=item * -- --the OVF output directory (default current directory) (I<--vdsm-ovf-output>). -- --=back -- --The format of UUIDs is: C<12345678-1234-1234-1234-123456789abc> (each --hex digit can be C<0-9> or C), conforming to S. -- --These options can only be used with I<-o vdsm>. -- --=item B<--vdsm-ovf-flavour> flavour -- --This option controls the format of the OVF generated at the end of conversion. --Currently there are two possible flavours: -- --=over 4 -- --=item rhevexp -- --The OVF format used in RHV export storage domain. -- --=item ovirt -- --The OVF format understood by oVirt REST API. -- --=back -- --For backward compatibility the default is I, but this may change in --the future. -- - =item B<-v> - - =item B<--verbose> -@@ -1528,15 +1542,15 @@ SSL thumbprint: - $ virt-v2v \ - -ic 'vpx://root@vcenter.example.com/Datacenter/esxi?no_verify=1' \ - -it vddk \ -- --vddk-libdir /path/to/vmware-vix-disklib-distrib \ -- --vddk-thumbprint xx:xx:xx:... \ -+ -io vddk-libdir=/path/to/vmware-vix-disklib-distrib \ -+ -io vddk-thumbprint=xx:xx:xx:... \ - "Windows 2003" \ - -o local -os /var/tmp - - Other options that you might need to add in rare circumstances include --I<--vddk-config>, I<--vddk-cookie>, I<--vddk-nfchostport>, --I<--vddk-port>, I<--vddk-snapshot>, I<--vddk-transports> and --I<--vddk-vimapiver>, which are all explained in the -+I<-io vddk-config>, I<-io vddk-cookie>, I<-io vddk-nfchostport>, -+I<-io vddk-port>, I<-io vddk-snapshot>, I<-io vddk-transports> and -+I<-io vddk-vimapiver>, which are all explained in the - L documentation. - - =head2 VDDK: DEBUGGING VDDK FAILURES --- -2.20.1 - diff --git a/SOURCES/0037-v2v-OVF-write-ovirt-id-attribute-for-the-OS-in-OVirt.patch b/SOURCES/0037-v2v-OVF-write-ovirt-id-attribute-for-the-OS-in-OVirt.patch deleted file mode 100644 index f4f28a7..0000000 --- a/SOURCES/0037-v2v-OVF-write-ovirt-id-attribute-for-the-OS-in-OVirt.patch +++ /dev/null @@ -1,247 +0,0 @@ -From b9b146315156b0debe6902cdcd93f0dbe49370f0 Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Wed, 4 Apr 2018 18:18:32 +0200 -Subject: [PATCH] v2v: OVF: write ovirt:id attribute for the OS in OVirt - flavour - -When writing the OVF in OVirt flavour, add a ovirt:id attribute to the -OperatingSystemSection tag: this attribute represents the numeric value -of the ostype ID, which is ignored by oVirt when parsing OVFs in API -mode. - -(cherry picked from commit 593a19cc86cfa8f24c66518c8ba21222550b066a) ---- - v2v/create_ovf.ml | 202 +++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 201 insertions(+), 1 deletion(-) - -diff --git a/v2v/create_ovf.ml b/v2v/create_ovf.ml -index bf3741e0f..ccde960df 100644 ---- a/v2v/create_ovf.ml -+++ b/v2v/create_ovf.ml -@@ -242,6 +242,203 @@ and get_ostype = function - typ distro major minor arch product; - "Unassigned" - -+(* Determine the ovirt:id attribute from libguestfs inspection. -+ * See ovirt-engine sources, file: -+ * packaging/conf/osinfo-defaults.properties -+ * and also: -+ * https://bugzilla.redhat.com/show_bug.cgi?id=1219857#c9 -+ *) -+and get_ovirt_osid = function -+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 3; -+ i_arch = "i386" } -> -+ 9 -+ -+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 3; -+ i_arch = "x86_64" } -> -+ 15 -+ -+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 4; -+ i_arch = "i386" } -> -+ 8 -+ -+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 4; -+ i_arch = "x86_64" } -> -+ 14 -+ -+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 5; -+ i_arch = "i386" } -> -+ 7 -+ -+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 5; -+ i_arch = "x86_64" } -> -+ 13 -+ -+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 6; -+ i_arch = "i386" } -> -+ 18 -+ -+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 6; -+ i_arch = "x86_64" } -> -+ 19 -+ -+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 6; -+ i_minor_version = min; i_arch = ("ppc64"|"ppc64le") } when min >= 9 -> -+ 1007 -+ -+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 6; -+ i_arch = ("ppc64"|"ppc64le") } -> -+ 1003 -+ -+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 7; -+ i_arch = "x86_64" } -> -+ 24 -+ -+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 7; -+ i_arch = ("ppc64"|"ppc64le") } -> -+ 1006 -+ -+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 7; -+ i_arch = "s390x" } -> -+ 2003 -+ -+ | { i_type = "linux"; i_distro = "sles"; i_major_version = maj; -+ i_arch = "x86_64" } when maj >= 11 -> -+ 1193 -+ -+ | { i_type = "linux"; i_distro = "sles"; i_major_version = maj; -+ i_arch = ("ppc64"|"ppc64le") } when maj >= 11 -> -+ 1004 -+ -+ | { i_type = "linux"; i_distro = "sles"; i_major_version = maj; -+ i_arch = "s390x" } when maj >= 12 -> -+ 2004 -+ -+ (* Only Debian 7 is available, so use it for any 7+ version. *) -+ | { i_type = "linux"; i_distro = "debian"; i_major_version = v } -+ when v >= 7 -> -+ 1300 -+ -+ (* Only Ubuntu 12.04 to 14.04 are available, so use them starting -+ * from 12.04, and 14.04 for anything after it. -+ *) -+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = v; -+ i_arch = ("ppc64"|"ppc64le") } when v >= 14 -> -+ 1005 -+ -+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = v; -+ i_arch = "s390x" } when v >= 16 -> -+ 2005 -+ -+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = v } -+ when v >= 14 -> -+ 1256 -+ -+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = 12; -+ i_minor_version = 4 } -> -+ 1252 -+ -+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = 12; -+ i_minor_version = 10 } -> -+ 1253 -+ -+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = 13; -+ i_minor_version = 4 } -> -+ 1254 -+ -+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = 13; -+ i_minor_version = 10 } -> -+ 1255 -+ -+ | { i_type = "linux"; i_arch = ("ppc64"|"ppc64le") } -> -+ 1002 -+ -+ | { i_type = "linux"; i_arch = "s390x" } -> -+ 2002 -+ -+ | { i_type = "linux" } -> -+ 5 -+ -+ | { i_type = "windows"; i_major_version = 5; i_minor_version = 1 } -> -+ 1 (* no architecture differentiation of XP on RHV *) -+ -+ | { i_type = "windows"; i_major_version = 5; i_minor_version = 2; -+ i_product_name = product } when String.find product "XP" >= 0 -> -+ 1 (* no architecture differentiation of XP on RHV *) -+ -+ | { i_type = "windows"; i_major_version = 5; i_minor_version = 2; -+ i_arch = "i386" } -> -+ 3 -+ -+ | { i_type = "windows"; i_major_version = 5; i_minor_version = 2; -+ i_arch = "x86_64" } -> -+ 10 -+ -+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 0; -+ i_arch = "i386" } -> -+ 4 -+ -+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 0; -+ i_arch = "x86_64" } -> -+ 16 -+ -+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 1; -+ i_arch = "i386" } -> -+ 11 -+ -+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 1; -+ i_arch = "x86_64"; i_product_variant = "Client" } -> -+ 12 -+ -+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 1; -+ i_arch = "x86_64" } -> -+ 17 -+ -+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 2; -+ i_arch = "i386" } -> -+ 20 -+ -+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 2; -+ i_arch = "x86_64"; i_product_variant = "Client" } -> -+ 21 -+ -+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 2; -+ i_arch = "x86_64" } -> -+ 23 -+ -+ (* Treat Windows 8.1 client like Windows 8. See: -+ * https://bugzilla.redhat.com/show_bug.cgi?id=1309580#c4 -+ *) -+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 3; -+ i_arch = "i386"; i_product_variant = "Client" } -> -+ 20 -+ -+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 3; -+ i_arch = "x86_64"; i_product_variant = "Client" } -> -+ 21 -+ -+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 3; -+ i_arch = "x86_64" } -> -+ 23 -+ -+ | { i_type = "windows"; i_major_version = 10; i_minor_version = 0; -+ i_arch = "i386" } -> -+ 26 -+ -+ | { i_type = "windows"; i_major_version = 10; i_minor_version = 0; -+ i_arch = "x86_64"; i_product_variant = "Client" } -> -+ 27 -+ -+ | { i_type = "windows"; i_major_version = 10; i_minor_version = 0; -+ i_arch = "x86_64" } -> -+ 29 -+ -+ | { i_type = typ; i_distro = distro; -+ i_major_version = major; i_minor_version = minor; i_arch = arch; -+ i_product_name = product } -> -+ warning (f_"unknown guest operating system: %s %s %d.%d %s (%s)") -+ typ distro major minor arch product; -+ 0 -+ - (* Set the element based on the source hypervisor. - * https://bugzilla.redhat.com/show_bug.cgi?id=1342398#c6 - * https://gerrit.ovirt.org/#/c/59147/ -@@ -321,6 +518,7 @@ let rec create_ovf source targets guestcaps inspect - "xmlns:vssd", "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"; - "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"; - "xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1/"; -+ "xmlns:ovirt", "http://www.ovirt.org/ovf"; - "ovf:version", "0.9" - ] [ - Comment generated_by; -@@ -383,8 +581,10 @@ let rec create_ovf source targets guestcaps inspect - ] in - (match ovf_flavour with - | OVirt -> -+ let ovirt_osid = get_ovirt_osid inspect in - e "OperatingSystemSection" ["ovf:id", vm_uuid; -- "ovf:required", "false"] -+ "ovf:required", "false"; -+ "ovirt:id", string_of_int ovirt_osid] - osinfo_subnodes - | RHVExportStorageDomain -> - e "Section" ["ovf:id", vm_uuid; "ovf:required", "false"; --- -2.20.1 - diff --git a/SOURCES/0038-v2v-OVF-fix-ovf-id-for-VirtualSystem-in-OVirt-flavou.patch b/SOURCES/0038-v2v-OVF-fix-ovf-id-for-VirtualSystem-in-OVirt-flavou.patch deleted file mode 100644 index c523c35..0000000 --- a/SOURCES/0038-v2v-OVF-fix-ovf-id-for-VirtualSystem-in-OVirt-flavou.patch +++ /dev/null @@ -1,32 +0,0 @@ -From ffd2b553fd9e1037d25122c6b749e6f4d1632df0 Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Thu, 5 Apr 2018 10:28:17 +0200 -Subject: [PATCH] v2v: OVF: fix ovf:id for VirtualSystem in OVirt flavour - -When writing the OVF in OVirt flavour, write the actual UUID of the -VM as ovf:id attribute for , instead of a dummy value. - -Suggested by Arik Hadas in -https://www.redhat.com/archives/libguestfs/2018-April/msg00005.html - -(cherry picked from commit 9dce43931a19510be1b6d21ce67d14a4136ce241) ---- - v2v/create_ovf.ml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/v2v/create_ovf.ml b/v2v/create_ovf.ml -index ccde960df..c29b8421c 100644 ---- a/v2v/create_ovf.ml -+++ b/v2v/create_ovf.ml -@@ -688,7 +688,7 @@ let rec create_ovf source targets guestcaps inspect - - (match ovf_flavour with - | OVirt -> -- e "VirtualSystem" ["ovf:id", "out"] !content_subnodes -+ e "VirtualSystem" ["ovf:id", vm_uuid] !content_subnodes - | RHVExportStorageDomain -> - e "Content" ["ovf:id", "out"; "xsi:type", "ovf:VirtualSystem_Type"] - !content_subnodes --- -2.20.1 - diff --git a/SOURCES/0039-v2v-Add-o-rhv-upload-output-mode-RHBZ-1557273.patch b/SOURCES/0039-v2v-Add-o-rhv-upload-output-mode-RHBZ-1557273.patch deleted file mode 100644 index 1adbdae..0000000 --- a/SOURCES/0039-v2v-Add-o-rhv-upload-output-mode-RHBZ-1557273.patch +++ /dev/null @@ -1,1764 +0,0 @@ -From d7a1c9c0bb074d0e5c1878a38a6b6315d33be89c Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Mon, 12 Feb 2018 16:45:02 +0000 -Subject: [PATCH] v2v: Add -o rhv-upload output mode (RHBZ#1557273). -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This adds a new output mode to virt-v2v. virt-v2v -o rhv-upload -streams images directly to an oVirt or RHV >= 4 Data Domain using the -oVirt SDK v4. It is more efficient than -o rhv because it does not -need to go via the Export Storage Domain, and is possible for humans -to use unlike -o vdsm. - -The implementation uses the Python SDK (‘ovirtsdk4’ module). An -nbdkit Python 3 plugin translates NBD calls from qemu into HTTPS -requests to oVirt via the SDK. - -(cherry picked from commit cc04573927cca97de60d544d37467e67c25867a7) ---- - .gitignore | 3 + - TODO | 27 ++ - v2v/Makefile.am | 30 +- - v2v/cmdline.ml | 41 ++ - v2v/embed.sh | 48 +++ - v2v/output_rhv_upload.ml | 401 +++++++++++++++++++ - v2v/output_rhv_upload.mli | 33 ++ - v2v/output_rhv_upload_createvm_source.mli | 19 + - v2v/output_rhv_upload_plugin_source.mli | 19 + - v2v/output_rhv_upload_precheck_source.mli | 19 + - v2v/rhv-upload-createvm.py | 86 +++++ - v2v/rhv-upload-plugin.py | 445 ++++++++++++++++++++++ - v2v/rhv-upload-precheck.py | 73 ++++ - v2v/test-v2v-o-rhv-upload-oo-query.sh | 38 ++ - v2v/test-v2v-python-syntax.sh | 45 +++ - v2v/virt-v2v.pod | 138 ++++++- - 16 files changed, 1447 insertions(+), 18 deletions(-) - create mode 100755 v2v/embed.sh - create mode 100644 v2v/output_rhv_upload.ml - create mode 100644 v2v/output_rhv_upload.mli - create mode 100644 v2v/output_rhv_upload_createvm_source.mli - create mode 100644 v2v/output_rhv_upload_plugin_source.mli - create mode 100644 v2v/output_rhv_upload_precheck_source.mli - create mode 100644 v2v/rhv-upload-createvm.py - create mode 100644 v2v/rhv-upload-plugin.py - create mode 100644 v2v/rhv-upload-precheck.py - create mode 100755 v2v/test-v2v-o-rhv-upload-oo-query.sh - create mode 100755 v2v/test-v2v-python-syntax.sh - -diff --git a/.gitignore b/.gitignore -index e67013478..ecdac6df3 100644 ---- a/.gitignore -+++ b/.gitignore -@@ -671,6 +671,9 @@ Makefile.in - /utils/qemu-speed-test/qemu-speed-test - /v2v/.depend - /v2v/oUnit-* -+/v2v/output_rhv_upload_createvm_source.ml -+/v2v/output_rhv_upload_plugin_source.ml -+/v2v/output_rhv_upload_precheck_source.ml - /v2v/real-*.d/ - /v2v/real-*.img - /v2v/real-*.xml -diff --git a/TODO b/TODO -index 2e37ce67c..d196a3f6b 100644 ---- a/TODO -+++ b/TODO -@@ -570,3 +570,30 @@ Subsecond handling in virt-diff, virt-ls - - Handle nanoseconds properly. You should be able to specify them on - the command line and display them. -+ -+virt-v2v -o rhv-upload -+---------------------- -+ -+* Set or disable the ticket timeout. The default is going to be -+ increased (from current 60 seconds), so maybe we won't have to -+ set it. See also: -+ https://bugzilla.redhat.com/show_bug.cgi?id=1563278 -+ -+* qcow2 cannot be supported yet because there is not yet any -+ concept in imageio of read+write handles. -+ https://bugzilla.redhat.com/show_bug.cgi?id=1563299 -+ -+* preallocated cannot be supported yet because imageio doesn't -+ know how to zero the image efficiently, instead it runs an -+ fallocate process which writes to every block and that takes -+ many minutes. -+ -+* Really check what insecure/rhv_cafile do and implement it correctly. -+ -+* Measure and resolve performance problems. -+ -+* Allocated image size is unknown for v2v uploads, but imageio needs -+ to know it. We pass initial_size == provisioned_size == virtual size. -+ That can't be fixed from the v2v side. -+ -+* There are unresolved issues about how to clean up disks on failure. -diff --git a/v2v/Makefile.am b/v2v/Makefile.am -index 5fcfeadba..affc00a8b 100644 ---- a/v2v/Makefile.am -+++ b/v2v/Makefile.am -@@ -22,12 +22,19 @@ generator_built = \ - uefi.mli - - BUILT_SOURCES = \ -- $(generator_built) -+ $(generator_built) \ -+ output_rhv_upload_createvm_source.ml \ -+ output_rhv_upload_plugin_source.ml \ -+ output_rhv_upload_precheck_source.ml - - EXTRA_DIST = \ - $(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \ - copy_to_local.ml \ - copy_to_local.mli \ -+ embed-code.sh \ -+ rhv-upload-createvm.py \ -+ rhv-upload-plugin.py \ -+ rhv-upload-precheck.py \ - v2v_unit_tests.ml \ - virt-v2v.pod \ - virt-v2v-copy-to-local.pod -@@ -62,6 +69,10 @@ SOURCES_MLI = \ - output_null.mli \ - output_qemu.mli \ - output_rhv.mli \ -+ output_rhv_upload.mli \ -+ output_rhv_upload_createvm_source.mli \ -+ output_rhv_upload_plugin_source.mli \ -+ output_rhv_upload_precheck_source.mli \ - output_vdsm.mli \ - parse_ova.mli \ - parse_ovf_from_ova.mli \ -@@ -116,6 +127,10 @@ SOURCES_ML = \ - output_local.ml \ - output_qemu.ml \ - output_rhv.ml \ -+ output_rhv_upload_createvm_source.ml \ -+ output_rhv_upload_plugin_source.ml \ -+ output_rhv_upload_precheck_source.ml \ -+ output_rhv_upload.ml \ - output_vdsm.ml \ - inspect_source.ml \ - target_bus_assignment.ml \ -@@ -126,6 +141,15 @@ SOURCES_C = \ - libvirt_utils-c.c \ - qemuopts-c.c - -+# These files are generated and contain rhv-upload-*.py embedded as an -+# OCaml string. -+output_rhv_upload_createvm_source.ml: rhv-upload-createvm.py -+ ./embed.sh code $^ $@ -+output_rhv_upload_plugin_source.ml: rhv-upload-plugin.py -+ ./embed.sh code $^ $@ -+output_rhv_upload_precheck_source.ml: rhv-upload-precheck.py -+ ./embed.sh code $^ $@ -+ - if HAVE_OCAML - - bin_PROGRAMS = virt-v2v virt-v2v-copy-to-local -@@ -295,6 +319,7 @@ TESTS_ENVIRONMENT = $(top_builddir)/run --test - - TESTS = \ - test-v2v-docs.sh \ -+ test-v2v-python-syntax.sh \ - test-v2v-i-ova-bad-sha1.sh \ - test-v2v-i-ova-bad-sha256.sh \ - test-v2v-i-ova-formats.sh \ -@@ -308,6 +333,7 @@ TESTS = \ - test-v2v-i-ova-two-disks.sh \ - test-v2v-i-vmx.sh \ - test-v2v-it-vddk-io-query.sh \ -+ test-v2v-o-rhv-upload-oo-query.sh \ - test-v2v-o-vdsm-oo-query.sh \ - test-v2v-bad-networks-and-bridges.sh - -@@ -481,6 +507,7 @@ EXTRA_DIST += \ - test-v2v-o-null.sh \ - test-v2v-o-qemu.sh \ - test-v2v-o-rhv.sh \ -+ test-v2v-o-rhv-upload-oo-query.sh \ - test-v2v-o-vdsm-oo-query.sh \ - test-v2v-o-vdsm-options.sh \ - test-v2v-oa-option.sh \ -@@ -489,6 +516,7 @@ EXTRA_DIST += \ - test-v2v-print-source.expected \ - test-v2v-print-source.sh \ - test-v2v-print-source.xml \ -+ test-v2v-python-syntax.sh \ - test-v2v-conversion-of.sh \ - test-v2v-sound.sh \ - test-v2v-sound.xml \ -diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml -index c9b859dd6..6321eb656 100644 ---- a/v2v/cmdline.ml -+++ b/v2v/cmdline.ml -@@ -133,6 +133,8 @@ let parse_cmdline () = - | "disk" | "local" -> output_mode := `Local - | "null" -> output_mode := `Null - | "ovirt" | "rhv" | "rhev" -> output_mode := `RHV -+ | "ovirt-upload" | "ovirt_upload" | "rhv-upload" | "rhv_upload" -> -+ output_mode := `RHV_Upload - | "qemu" -> output_mode := `QEmu - | "vdsm" -> output_mode := `VDSM - | s -> -@@ -389,6 +391,16 @@ read the man page virt-v2v(1). - | `Null -> no_options (); `Null - | `RHV -> no_options (); `RHV - | `QEmu -> no_options (); `QEmu -+ | `RHV_Upload -> -+ if is_query then ( -+ Output_rhv_upload.print_output_options (); -+ exit 0 -+ ) -+ else ( -+ let rhv_options = -+ Output_rhv_upload.parse_output_options output_options in -+ `RHV_Upload rhv_options -+ ) - | `VDSM -> - if is_query then ( - Output_vdsm.print_output_options (); -@@ -571,6 +583,35 @@ read the man page virt-v2v(1). - Output_rhv.output_rhv os output_alloc, - output_format, output_alloc - -+ | `RHV_Upload rhv_options -> -+ let output_conn = -+ match output_conn with -+ | None -> -+ error (f_"-o rhv-upload: use ‘-oc’ to point to the oVirt or RHV server REST API URL, which is usually https://servername/ovirt-engine/api") -+ | Some oc -> oc in -+ (* Output format / sparse must currently be raw+sparse. We can -+ * change this in future. See TODO file for details. XXX -+ *) -+ if output_alloc <> Sparse || output_format <> Some "raw" then -+ error (f_"-o rhv-upload: currently you must use ‘-of raw’ and you cannot use ‘-oa preallocated’ with this output mode. These restrictions will be loosened in a future version."); -+ (* In theory we could make the password optional in future. *) -+ let output_password = -+ match output_password with -+ | None -> -+ error (f_"-o rhv-upload: output password file was not specified, use ‘-op’ to point to a file which contains the password used to connect to the oVirt or RHV server") -+ | Some op -> op in -+ let os = -+ match output_storage with -+ | None -> -+ error (f_"-o rhv-upload: output storage was not specified, use ‘-os’"); -+ | Some os -> os in -+ if qemu_boot then -+ error_option_cannot_be_used_in_output_mode "rhv-upload" "--qemu-boot"; -+ Output_rhv_upload.output_rhv_upload output_alloc output_conn -+ output_password os -+ rhv_options, -+ output_format, output_alloc -+ - | `VDSM vdsm_options -> - if output_password <> None then - error_option_cannot_be_used_in_output_mode "vdsm" "-op"; -diff --git a/v2v/embed.sh b/v2v/embed.sh -new file mode 100755 -index 000000000..363d7e2b0 ---- /dev/null -+++ b/v2v/embed.sh -@@ -0,0 +1,48 @@ -+#!/bin/bash - -+# Embed code or other content into an OCaml file. -+# Copyright (C) 2018 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. -+ -+# Embed code or other content into an OCaml file. -+# -+# It is embedded into a string. As OCaml string literals have virtually -+# no restrictions on length or content we only have to escape double -+# quotes for backslash characters. -+ -+if [ $# -ne 3 ]; then -+ echo "embed.sh identifier input output" -+ exit 1 -+fi -+ -+set -e -+set -u -+ -+ident="$1" -+input="$2" -+output="$3" -+ -+rm -f "$output" "$output"-t -+ -+exec >"$output"-t -+ -+echo "(* Generated by embed.sh from $input *)" -+echo -+echo let "$ident" = '"' -+sed -e 's/\(["\]\)/\\\1/g' < "$input" -+echo '"' -+ -+chmod -w "$output"-t -+mv "$output"-t "$output" -diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml -new file mode 100644 -index 000000000..129461242 ---- /dev/null -+++ b/v2v/output_rhv_upload.ml -@@ -0,0 +1,401 @@ -+(* virt-v2v -+ * Copyright (C) 2009-2018 Red Hat Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License along -+ * with this program; if not, write to the Free Software Foundation, Inc., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ *) -+ -+open Printf -+open Unix -+ -+open Std_utils -+open Tools_utils -+open Unix_utils -+open Common_gettext.Gettext -+ -+open Types -+open Utils -+ -+type rhv_options = { -+ rhv_cafile : string; -+ rhv_cluster : string option; -+ rhv_direct : bool; -+ rhv_verifypeer : bool; -+} -+ -+let print_output_options () = -+ printf (f_"Output options (-oo) which can be used with -o rhv-upload: -+ -+ -oo rhv-cafile=CA.PEM Set ‘ca.pem’ certificate bundle filename. -+ -oo rhv-cluster=CLUSTERNAME Set RHV cluster name. -+ -oo rhv-direct[=true|false] Use direct transfer mode (default: false). -+ -oo rhv-verifypeer[=true|false] Verify server identity (default: false). -+") -+ -+let parse_output_options options = -+ let rhv_cafile = ref None in -+ let rhv_cluster = ref None in -+ let rhv_direct = ref false in -+ let rhv_verifypeer = ref false in -+ -+ List.iter ( -+ function -+ | "rhv-cafile", v -> -+ if !rhv_cafile <> None then -+ error (f_"-o rhv-upload: -oo rhv-cafile set twice"); -+ rhv_cafile := Some v -+ | "rhv-cluster", v -> -+ if !rhv_cluster <> None then -+ error (f_"-o rhv-upload: -oo rhv-cluster set twice"); -+ rhv_cluster := Some v -+ | "rhv-direct", "" -> rhv_direct := true -+ | "rhv-direct", v -> rhv_direct := bool_of_string v -+ | "rhv-verifypeer", "" -> rhv_verifypeer := true -+ | "rhv-verifypeer", v -> rhv_verifypeer := bool_of_string v -+ | k, _ -> -+ error (f_"-o rhv-upload: unknown output option ‘-oo %s’") k -+ ) options; -+ -+ let rhv_cafile = -+ match !rhv_cafile with -+ | Some s -> s -+ | None -> -+ error (f_"-o rhv-upload: must use ‘-oo rhv-cafile’ to supply the path to the oVirt or RHV user’s ‘ca.pem’ file") in -+ let rhv_cluster = !rhv_cluster in -+ let rhv_direct = !rhv_direct in -+ let rhv_verifypeer = !rhv_verifypeer in -+ -+ { rhv_cafile; rhv_cluster; rhv_direct; rhv_verifypeer } -+ -+let python3 = "python3" (* Defined by PEP 394 *) -+let pidfile_timeout = 30 -+let finalization_timeout = 5*60 -+ -+class output_rhv_upload output_alloc output_conn -+ output_password output_storage -+ rhv_options = -+ (* Create a temporary directory which will be deleted on exit. *) -+ let tmpdir = -+ let base_dir = (open_guestfs ())#get_cachedir () in -+ let t = Mkdtemp.temp_dir ~base_dir "rhvupload." in -+ rmdir_on_exit t; -+ t in -+ -+ let diskid_file_of_id id = tmpdir // sprintf "diskid.%d" id in -+ -+ (* Write the Python precheck, plugin and create VM to a temporary file. *) -+ let precheck = -+ let precheck = tmpdir // "rhv-upload-precheck.py" in -+ with_open_out -+ precheck -+ (fun chan -> output_string chan Output_rhv_upload_precheck_source.code); -+ precheck in -+ let plugin = -+ let plugin = tmpdir // "rhv-upload-plugin.py" in -+ with_open_out -+ plugin -+ (fun chan -> output_string chan Output_rhv_upload_plugin_source.code); -+ plugin in -+ let createvm = -+ let createvm = tmpdir // "rhv-upload-createvm.py" in -+ with_open_out -+ createvm -+ (fun chan -> output_string chan Output_rhv_upload_createvm_source.code); -+ createvm in -+ -+ (* Is SELinux enabled and enforcing on the host? *) -+ let have_selinux = -+ 0 = Sys.command "getenforce 2>/dev/null | grep -isq Enforcing" in -+ -+ (* Check that the Python binary is available. *) -+ let error_unless_python_binary_on_path () = -+ try ignore (which python3) -+ with Executable_not_found _ -> -+ error (f_"no python binary called ‘%s’ can be found on the $PATH") -+ python3 -+ in -+ -+ (* Check that nbdkit is available and new enough. *) -+ let error_unless_nbdkit_working () = -+ if 0 <> Sys.command "nbdkit --version >/dev/null" then -+ error (f_"nbdkit is not installed or not working. It is required to use ‘-o rhv-upload’. See \"OUTPUT TO RHV\" in the virt-v2v(1) manual."); -+ -+ (* Check it's a new enough version. The latest features we -+ * require are ‘--exit-with-parent’ and ‘--selinux-label’, both -+ * added in 1.1.14. (We use 1.1.16 as the minimum here because -+ * it also adds the selinux=yes|no flag in --dump-config). -+ *) -+ let lines = external_command "nbdkit --help" in -+ let lines = String.concat " " lines in -+ if String.find lines "exit-with-parent" == -1 || -+ String.find lines "selinux-label" == -1 then -+ error (f_"nbdkit is not new enough, you need to upgrade to nbdkit ≥ 1.1.16") -+ in -+ -+ (* Check that the python3 plugin is installed and working -+ * and can load the plugin script. -+ *) -+ let error_unless_nbdkit_python3_working () = -+ let cmd = sprintf "nbdkit %s %s --dump-plugin >/dev/null" -+ python3 (quote plugin) in -+ if Sys.command cmd <> 0 then -+ error (f_"nbdkit Python 3 plugin is not installed or not working. It is required if you want to use ‘-o rhv-upload’. -+ -+See also \"OUTPUT TO RHV\" in the virt-v2v(1) manual.") -+ in -+ -+ (* Check that nbdkit was compiled with SELinux support (for the -+ * --selinux-label option). -+ *) -+ let error_unless_nbdkit_compiled_with_selinux () = -+ let lines = external_command "nbdkit --dump-config" in -+ (* In nbdkit <= 1.1.15 the selinux attribute was not present -+ * at all in --dump-config output so there was no way to tell. -+ * Ignore this case because there will be an error later when -+ * we try to use the --selinux-label parameter. -+ *) -+ if List.mem "selinux=no" (List.map String.trim lines) then -+ error (f_"nbdkit was compiled without SELinux support. You will have to recompile nbdkit with libselinux-devel installed, or else set SELinux to Permissive mode while doing the conversion.") -+ in -+ -+ (* JSON parameters which are invariant between disks. *) -+ let json_params = [ -+ "verbose", JSON.Bool (verbose ()); -+ -+ "output_conn", JSON.String output_conn; -+ "output_password", JSON.String output_password; -+ "output_storage", JSON.String output_storage; -+ "output_sparse", JSON.Bool (match output_alloc with -+ | Sparse -> true -+ | Preallocated -> false); -+ "rhv_cafile", JSON.String rhv_options.rhv_cafile; -+ "rhv_cluster", -+ JSON.String (Option.default "Default" rhv_options.rhv_cluster); -+ "rhv_direct", JSON.Bool rhv_options.rhv_direct; -+ -+ (* The 'Insecure' flag seems to be a number with various possible -+ * meanings, however we just set it to True/False. -+ * -+ * https://github.com/oVirt/ovirt-engine-sdk/blob/19aa7070b80e60a4cfd910448287aecf9083acbe/sdk/lib/ovirtsdk4/__init__.py#L395 -+ *) -+ "insecure", JSON.Bool (not rhv_options.rhv_verifypeer); -+ ] in -+ -+ (* nbdkit command line args which are invariant between disks. *) -+ let nbdkit_args = -+ let args = [ -+ "nbdkit"; -+ -+ "--foreground"; (* run in foreground *) -+ "--exit-with-parent"; (* exit when virt-v2v exits *) -+ "--newstyle"; (* use newstyle NBD protocol *) -+ "--exportname"; "/"; -+ -+ "python3"; (* use the nbdkit Python 3 plugin *) -+ plugin; (* Python plugin script *) -+ ] in -+ let args = if verbose () then args @ ["--verbose"] else args in -+ let args = -+ (* label the socket so qemu can open it *) -+ if have_selinux then -+ args @ ["--selinux-label"; "system_u:object_r:svirt_t:s0"] -+ else args in -+ args in -+ -+object -+ inherit output -+ -+ method precheck () = -+ error_unless_python_binary_on_path (); -+ error_unless_nbdkit_working (); -+ error_unless_nbdkit_python3_working (); -+ if have_selinux then -+ error_unless_nbdkit_compiled_with_selinux () -+ -+ method as_options = -+ "-o rhv-upload" ^ -+ (match output_alloc with -+ | Sparse -> "" (* default, don't need to print it *) -+ | Preallocated -> " -oa preallocated") ^ -+ sprintf " -oc %s -op %s -os %s" -+ output_conn output_password output_storage -+ -+ method supported_firmware = [ TargetBIOS ] -+ -+ method prepare_targets source targets = -+ let output_name = source.s_name in -+ let json_params = -+ ("output_name", JSON.String output_name) :: json_params in -+ -+ (* Python code prechecks. These can't run in #precheck because -+ * we need to know the name of the virtual machine. -+ *) -+ let json_param_file = tmpdir // "params.json" in -+ with_open_out -+ json_param_file -+ (fun chan -> output_string chan (JSON.string_of_doc json_params)); -+ if run_command [ python3; precheck; json_param_file ] <> 0 then -+ error (f_"failed server prechecks, see earlier errors"); -+ -+ (* Create an nbdkit instance for each disk and set the -+ * target URI to point to the NBD socket. -+ *) -+ List.map ( -+ fun t -> -+ let id = t.target_overlay.ov_source.s_disk_id in -+ let disk_name = sprintf "%s-%03d" output_name id in -+ let json_params = -+ ("disk_name", JSON.String disk_name) :: json_params in -+ -+ let disk_format = -+ match t.target_format with -+ | ("raw" | "qcow2") as fmt -> fmt -+ | _ -> -+ error (f_"rhv-upload: -of %s: Only output format ‘raw’ or ‘qcow2’ is supported. If the input is in a different format then force one of these output formats by adding either ‘-of raw’ or ‘-of qcow2’ on the command line.") -+ t.target_format in -+ let json_params = -+ ("disk_format", JSON.String disk_format) :: json_params in -+ -+ let disk_size = t.target_overlay.ov_virtual_size in -+ let json_params = -+ ("disk_size", JSON.Int64 disk_size) :: json_params in -+ -+ (* Ask the plugin to write the disk ID to a special file. *) -+ let diskid_file = diskid_file_of_id id in -+ let json_params = -+ ("diskid_file", JSON.String diskid_file) :: json_params in -+ -+ (* Write the JSON parameters to a file. *) -+ let json_param_file = tmpdir // sprintf "params%d.json" id in -+ with_open_out -+ json_param_file -+ (fun chan -> output_string chan (JSON.string_of_doc json_params)); -+ -+ let sock = tmpdir // sprintf "nbdkit%d.sock" id in -+ let pidfile = tmpdir // sprintf "nbdkit%d.pid" id in -+ -+ (* Add common arguments to per-target arguments. *) -+ let args = -+ nbdkit_args @ [ "--pidfile"; pidfile; -+ "--unix"; sock; -+ sprintf "params=%s" json_param_file ] in -+ -+ (* Print the full command we are about to run when debugging. *) -+ if verbose () then ( -+ eprintf "running nbdkit:\n"; -+ List.iter (fun arg -> eprintf " %s" (quote arg)) args; -+ prerr_newline () -+ ); -+ -+ (* Start an nbdkit instance in the background. By using -+ * --exit-with-parent we don't have to worry about clean-up. -+ *) -+ let args = Array.of_list args in -+ let pid = fork () in -+ if pid = 0 then ( -+ (* Child process (nbdkit). *) -+ execvp "nbdkit" args -+ ); -+ -+ (* Wait for the pidfile to appear so we know that nbdkit -+ * is listening for requests. -+ *) -+ if not (wait_for_file pidfile pidfile_timeout) then ( -+ if verbose () then -+ error (f_"nbdkit did not start up. See previous debugging messages for problems.") -+ else -+ error (f_"nbdkit did not start up. There may be errors printed by nbdkit above. -+ -+If the messages above are not sufficient to diagnose the problem then add the ‘virt-v2v -v -x’ options and examine the debugging output carefully.") -+ ); -+ -+ if have_selinux then ( -+ (* Note that Unix domain sockets have both a file label and -+ * a socket/process label. Using --selinux-label above -+ * only set the socket label, but we must also set the file -+ * label. -+ *) -+ ignore ( -+ run_command ["chcon"; "system_u:object_r:svirt_image_t:s0"; -+ sock] -+ ); -+ ); -+ (* ... and the regular Unix permissions, in case qemu is -+ * running as another user. -+ *) -+ chmod sock 0o777; -+ -+ (* Tell ‘qemu-img convert’ to write to the nbd socket which is -+ * connected to nbdkit. -+ *) -+ let json_params = [ -+ "file.driver", JSON.String "nbd"; -+ "file.path", JSON.String sock; -+ "file.export", JSON.String "/"; -+ ] in -+ let target_file = -+ TargetURI ("json:" ^ JSON.string_of_doc json_params) in -+ { t with target_file } -+ ) targets -+ -+ method create_metadata source targets _ guestcaps inspect target_firmware = -+ (* Get the UUIDs of each disk image. These files are written -+ * out by the nbdkit plugins on successful finalization of the -+ * transfer. -+ *) -+ let nr_disks = List.length targets in -+ let image_uuids = -+ List.map ( -+ fun t -> -+ let id = t.target_overlay.ov_source.s_disk_id in -+ let diskid_file = diskid_file_of_id id in -+ if not (wait_for_file diskid_file finalization_timeout) then -+ error (f_"transfer of disk %d/%d failed, see earlier error messages") -+ (id+1) nr_disks; -+ let diskid = read_whole_file diskid_file in -+ diskid -+ ) targets in -+ -+ (* We don't have the storage domain UUID, but instead we write -+ * in a magic value which the Python code (which can get it) -+ * will substitute. -+ *) -+ let sd_uuid = "@SD_UUID@" in -+ -+ (* The volume and VM UUIDs are made up. *) -+ let vol_uuids = List.map (fun _ -> uuidgen ()) targets -+ and vm_uuid = uuidgen () in -+ -+ (* Create the metadata. *) -+ let ovf = -+ Create_ovf.create_ovf source targets guestcaps inspect -+ output_alloc -+ sd_uuid image_uuids vol_uuids vm_uuid -+ OVirt in -+ let ovf = DOM.doc_to_string ovf in -+ -+ let json_param_file = tmpdir // "params.json" in -+ with_open_out -+ json_param_file -+ (fun chan -> output_string chan (JSON.string_of_doc json_params)); -+ -+ let ovf_file = tmpdir // "vm.ovf" in -+ with_open_out ovf_file (fun chan -> output_string chan ovf); -+ if run_command [ python3; createvm; json_param_file; ovf_file ] <> 0 then -+ error (f_"failed to create virtual machine, see earlier errors") -+ -+end -+ -+let output_rhv_upload = new output_rhv_upload -+let () = Modules_list.register_output_module "rhv-upload" -diff --git a/v2v/output_rhv_upload.mli b/v2v/output_rhv_upload.mli -new file mode 100644 -index 000000000..f6cd69a61 ---- /dev/null -+++ b/v2v/output_rhv_upload.mli -@@ -0,0 +1,33 @@ -+(* virt-v2v -+ * Copyright (C) 2009-2018 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. -+ *) -+ -+(** [-o rhv-upload] target. *) -+ -+type rhv_options -+(** Miscellaneous extra command line parameters used by rhv-upload. *) -+ -+val print_output_options : unit -> unit -+val parse_output_options : (string * string) list -> rhv_options -+(** Print and parse rhv-upload -oo options. *) -+ -+val output_rhv_upload : Types.output_allocation -> string -> string -> -+ string -> rhv_options -> Types.output -+(** [output_rhv_upload output_alloc output_conn output_password output_storage -+ rhv_options] -+ creates and returns a new {!Types.output} object specialized for writing -+ output to oVirt or RHV directly via RHV APIs. *) -diff --git a/v2v/output_rhv_upload_createvm_source.mli b/v2v/output_rhv_upload_createvm_source.mli -new file mode 100644 -index 000000000..c1bafa15b ---- /dev/null -+++ b/v2v/output_rhv_upload_createvm_source.mli -@@ -0,0 +1,19 @@ -+(* virt-v2v -+ * Copyright (C) 2018 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. -+ *) -+ -+val code : string -diff --git a/v2v/output_rhv_upload_plugin_source.mli b/v2v/output_rhv_upload_plugin_source.mli -new file mode 100644 -index 000000000..c1bafa15b ---- /dev/null -+++ b/v2v/output_rhv_upload_plugin_source.mli -@@ -0,0 +1,19 @@ -+(* virt-v2v -+ * Copyright (C) 2018 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. -+ *) -+ -+val code : string -diff --git a/v2v/output_rhv_upload_precheck_source.mli b/v2v/output_rhv_upload_precheck_source.mli -new file mode 100644 -index 000000000..c1bafa15b ---- /dev/null -+++ b/v2v/output_rhv_upload_precheck_source.mli -@@ -0,0 +1,19 @@ -+(* virt-v2v -+ * Copyright (C) 2018 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. -+ *) -+ -+val code : string -diff --git a/v2v/rhv-upload-createvm.py b/v2v/rhv-upload-createvm.py -new file mode 100644 -index 000000000..a34627ec8 ---- /dev/null -+++ b/v2v/rhv-upload-createvm.py -@@ -0,0 +1,86 @@ -+# -*- python -*- -+# oVirt or RHV upload create VM used by ‘virt-v2v -o rhv-upload’ -+# Copyright (C) 2018 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. -+ -+import json -+import logging -+import sys -+import time -+ -+from http.client import HTTPSConnection -+from urllib.parse import urlparse -+ -+import ovirtsdk4 as sdk -+import ovirtsdk4.types as types -+ -+# Parameters are passed in via a JSON doc from the OCaml code. -+# Because this Python code ships embedded inside virt-v2v there -+# is no formal API here. -+params = None -+ovf = None # OVF file -+ -+if len(sys.argv) != 3: -+ raise RuntimeError("incorrect number of parameters") -+ -+# Parameters are passed in via a JSON document. -+with open(sys.argv[1], 'r') as fp: -+ params = json.load(fp) -+ -+# What is passed in is a password file, read the actual password. -+with open(params['output_password'], 'r') as fp: -+ output_password = fp.read() -+output_password = output_password.rstrip() -+ -+# Read the OVF document. -+with open(sys.argv[2], 'r') as fp: -+ ovf = fp.read() -+ -+# Parse out the username from the output_conn URL. -+parsed = urlparse(params['output_conn']) -+username = parsed.username or "admin@internal" -+ -+# Connect to the server. -+connection = sdk.Connection( -+ url = params['output_conn'], -+ username = username, -+ password = output_password, -+ ca_file = params['rhv_cafile'], -+ log = logging.getLogger(), -+ insecure = params['insecure'], -+) -+ -+system_service = connection.system_service() -+ -+# Get the storage domain UUID and substitute it into the OVF doc. -+sds_service = system_service.storage_domains_service() -+sd = sds_service.list(search=("name=%s" % params['output_storage']))[0] -+sd_uuid = sd.id -+ -+ovf.replace("@SD_UUID@", sd_uuid) -+ -+vms_service = system_service.vms_service() -+vm = vms_service.add( -+ types.Vm( -+ cluster=types.Cluster(name = params['rhv_cluster']), -+ initialization=types.Initialization( -+ configuration = types.Configuration( -+ type = types.ConfigurationType.OVA, -+ data = ovf, -+ ) -+ ) -+ ) -+) -diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py -new file mode 100644 -index 000000000..791c9e7d2 ---- /dev/null -+++ b/v2v/rhv-upload-plugin.py -@@ -0,0 +1,445 @@ -+# -*- python -*- -+# oVirt or RHV upload nbdkit plugin used by ‘virt-v2v -o rhv-upload’ -+# Copyright (C) 2018 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. -+ -+import builtins -+import json -+import logging -+import ssl -+import sys -+import time -+ -+from http.client import HTTPSConnection -+from urllib.parse import urlparse -+ -+import ovirtsdk4 as sdk -+import ovirtsdk4.types as types -+ -+# Timeout to wait for oVirt disks to change status, or the transfer -+# object to finish initializing [seconds]. -+timeout = 5*60 -+ -+# Parameters are passed in via a JSON doc from the OCaml code. -+# Because this Python code ships embedded inside virt-v2v there -+# is no formal API here. -+params = None -+ -+def config(key, value): -+ global params -+ -+ if key == "params": -+ with builtins.open(value, 'r') as fp: -+ params = json.load(fp) -+ else: -+ raise RuntimeError("unknown configuration key '%s'" % key) -+ -+def config_complete(): -+ if params is None: -+ raise RuntimeError("missing configuration parameters") -+ -+def debug(s): -+ if params['verbose']: -+ print(s, file=sys.stderr) -+ sys.stderr.flush() -+ -+def open(readonly): -+ # Parse out the username from the output_conn URL. -+ parsed = urlparse(params['output_conn']) -+ username = parsed.username or "admin@internal" -+ -+ # Read the password from file. -+ with builtins.open(params['output_password'], 'r') as fp: -+ password = fp.read() -+ password = password.rstrip() -+ -+ # Connect to the server. -+ connection = sdk.Connection( -+ url = params['output_conn'], -+ username = username, -+ password = password, -+ ca_file = params['rhv_cafile'], -+ log = logging.getLogger(), -+ insecure = params['insecure'], -+ ) -+ -+ system_service = connection.system_service() -+ -+ # Create the disk. -+ disks_service = system_service.disks_service() -+ if params['disk_format'] == "raw": -+ disk_format = types.DiskFormat.RAW -+ else: -+ disk_format = types.DiskFormat.COW -+ disk = disks_service.add( -+ disk = types.Disk( -+ name = params['disk_name'], -+ description = "Uploaded by virt-v2v", -+ format = disk_format, -+ initial_size = params['disk_size'], -+ provisioned_size = params['disk_size'], -+ # XXX Ignores params['output_sparse']. -+ # Handling this properly will be complex, see: -+ # https://www.redhat.com/archives/libguestfs/2018-March/msg00177.html -+ sparse = True, -+ storage_domains = [ -+ types.StorageDomain( -+ name = params['output_storage'], -+ ) -+ ], -+ ) -+ ) -+ -+ # Wait till the disk is up, as the transfer can't start if the -+ # disk is locked: -+ disk_service = disks_service.disk_service(disk.id) -+ debug("disk.id = %r" % disk.id) -+ -+ endt = time.time() + timeout -+ while True: -+ time.sleep(5) -+ disk = disk_service.get() -+ if disk.status == types.DiskStatus.OK: -+ break -+ if time.time() > endt: -+ raise RuntimeError("timed out waiting for disk to become unlocked") -+ -+ # Get a reference to the transfer service. -+ transfers_service = system_service.image_transfers_service() -+ -+ # Create a new image transfer. -+ transfer = transfers_service.add( -+ types.ImageTransfer( -+ image = types.Image( -+ id = disk.id -+ ) -+ ) -+ ) -+ debug("transfer.id = %r" % transfer.id) -+ -+ # Get a reference to the created transfer service. -+ transfer_service = transfers_service.image_transfer_service(transfer.id) -+ -+ # After adding a new transfer for the disk, the transfer's status -+ # will be INITIALIZING. Wait until the init phase is over. The -+ # actual transfer can start when its status is "Transferring". -+ endt = time.time() + timeout -+ while True: -+ time.sleep(5) -+ transfer = transfer_service.get() -+ if transfer.phase != types.ImageTransferPhase.INITIALIZING: -+ break -+ if time.time() > endt: -+ raise RuntimeError("timed out waiting for transfer status " + -+ "!= INITIALIZING") -+ -+ # Now we have permission to start the transfer. -+ if params['rhv_direct']: -+ if transfer.transfer_url is None: -+ raise RuntimeError("direct upload to host not supported, " + -+ "requires ovirt-engine >= 4.2 and only works " + -+ "when virt-v2v is run within the oVirt/RHV " + -+ "environment, eg. on an oVirt node.") -+ destination_url = urlparse(transfer.transfer_url) -+ else: -+ destination_url = urlparse(transfer.proxy_url) -+ -+ context = ssl.create_default_context() -+ context.load_verify_locations(cafile = params['rhv_cafile']) -+ -+ http = HTTPSConnection( -+ destination_url.hostname, -+ destination_url.port, -+ context = context -+ ) -+ -+ # Save everything we need to make requests in the handle. -+ return { -+ 'can_flush': False, -+ 'can_trim': False, -+ 'can_zero': False, -+ 'connection': connection, -+ 'disk': disk, -+ 'disk_service': disk_service, -+ 'failed': False, -+ 'got_options': False, -+ 'highestwrite': 0, -+ 'http': http, -+ 'needs_auth': not params['rhv_direct'], -+ 'path': destination_url.path, -+ 'transfer': transfer, -+ 'transfer_service': transfer_service, -+ } -+ -+# Can we issue zero, trim or flush requests? -+def get_options(h): -+ if h['got_options']: -+ return -+ h['got_options'] = True -+ -+ http = h['http'] -+ transfer = h['transfer'] -+ -+ http.putrequest("OPTIONS", h['path']) -+ http.putheader("Authorization", transfer.signed_ticket) -+ http.endheaders() -+ -+ r = http.getresponse() -+ if r.status == 200: -+ # New imageio never needs authentication. -+ h['needs_auth'] = False -+ -+ j = json.loads(r.read()) -+ h['can_zero'] = "zero" in j['features'] -+ h['can_trim'] = "trim" in j['features'] -+ h['can_flush'] = "flush" in j['features'] -+ -+ # Old imageio servers returned either 405 Method Not Allowed or -+ # 204 No Content (with an empty body). If we see that we leave -+ # all the features as False and they will be emulated. -+ elif r.status == 405 or r.status == 204: -+ pass -+ -+ else: -+ raise RuntimeError("could not use OPTIONS request: %d: %s" % -+ (r.status, r.reason)) -+ -+def can_trim(h): -+ get_options(h) -+ return h['can_trim'] -+ -+def can_flush(h): -+ get_options(h) -+ return h['can_flush'] -+ -+def get_size(h): -+ return params['disk_size'] -+ -+# For documentation see: -+# https://github.com/oVirt/ovirt-imageio/blob/master/docs/random-io.md -+# For examples of working code to read/write from the server, see: -+# https://github.com/oVirt/ovirt-imageio/blob/master/daemon/test/server_test.py -+ -+def pread(h, count, offset): -+ http = h['http'] -+ transfer = h['transfer'] -+ transfer_service = h['transfer_service'] -+ -+ http.putrequest("GET", h['path']) -+ # Authorization is only needed for old imageio. -+ if h['needs_auth']: -+ http.putheader("Authorization", transfer.signed_ticket) -+ http.putheader("Range", "bytes=%d-%d" % (offset, offset+count-1)) -+ http.endheaders() -+ -+ r = http.getresponse() -+ # 206 = HTTP Partial Content. -+ if r.status != 206: -+ h['transfer_service'].pause() -+ h['failed'] = True -+ raise RuntimeError("could not read sector (%d, %d): %d: %s" % -+ (offset, count, r.status, r.reason)) -+ return r.read() -+ -+def pwrite(h, buf, offset): -+ http = h['http'] -+ transfer = h['transfer'] -+ transfer_service = h['transfer_service'] -+ -+ count = len(buf) -+ h['highestwrite'] = max(h['highestwrite'], offset+count) -+ -+ http.putrequest("PUT", h['path'] + "?flush=n") -+ # Authorization is only needed for old imageio. -+ if h['needs_auth']: -+ http.putheader("Authorization", transfer.signed_ticket) -+ # The oVirt server only uses the first part of the range, and the -+ # content-length. -+ http.putheader("Content-Range", "bytes %d-%d/*" % (offset, offset+count-1)) -+ http.putheader("Content-Length", str(count)) -+ http.endheaders() -+ http.send(buf) -+ -+ r = http.getresponse() -+ if r.status != 200: -+ transfer_service.pause() -+ h['failed'] = True -+ raise RuntimeError("could not write sector (%d, %d): %d: %s" % -+ (offset, count, r.status, r.reason)) -+ -+def zero(h, count, offset, may_trim): -+ http = h['http'] -+ transfer = h['transfer'] -+ transfer_service = h['transfer_service'] -+ -+ # Unlike the trim and flush calls, there is no 'can_zero' method -+ # so nbdkit could call this even if the server doesn't support -+ # zeroing. If this is the case we must emulate. -+ if not h['can_zero']: -+ emulate_zero(h, count, offset) -+ return -+ -+ # Construct the JSON request for zeroing. -+ buf = json.dumps({'op': "zero", -+ 'offset': offset, -+ 'size': count, -+ 'flush': False}).encode() -+ -+ http.putrequest("PATCH", h['path']) -+ http.putheader("Content-Type", "application/json") -+ http.putheader("Content-Length", len(buf)) -+ http.endheaders() -+ http.send(buf) -+ -+ r = http.getresponse() -+ if r.status != 200: -+ transfer_service.pause() -+ h['failed'] = True -+ raise RuntimeError("could not zero sector (%d, %d): %d: %s" % -+ (offset, count, r.status, r.reason)) -+ -+def emulate_zero(h, count, offset): -+ # qemu-img convert starts by trying to zero/trim the whole device. -+ # Since we've just created a new disk it's safe to ignore these -+ # requests as long as they are smaller than the highest write seen. -+ # After that we must emulate them with writes. -+ if offset+count < h['highestwrite']: -+ http.putrequest("PUT", h['path']) -+ # Authorization is only needed for old imageio. -+ if h['needs_auth']: -+ http.putheader("Authorization", transfer.signed_ticket) -+ http.putheader("Content-Range", -+ "bytes %d-%d/*" % (offset, offset+count-1)) -+ http.putheader("Content-Length", str(count)) -+ http.endheaders() -+ -+ buf = bytearray(128*1024) -+ while count > len(buf): -+ http.send(buf) -+ count -= len(buf) -+ http.send(buffer(buf, 0, count)) -+ -+ r = http.getresponse() -+ if r.status != 200: -+ transfer_service.pause() -+ h['failed'] = True -+ raise RuntimeError("could not write zeroes (%d, %d): %d: %s" % -+ (offset, count, r.status, r.reason)) -+ -+def trim(h, count, offset): -+ http = h['http'] -+ transfer = h['transfer'] -+ transfer_service = h['transfer_service'] -+ -+ # Construct the JSON request for trimming. -+ buf = json.dumps({'op': "trim", -+ 'offset': offset, -+ 'size': count, -+ 'flush': False}).encode() -+ -+ http.putrequest("PATCH", h['path']) -+ http.putheader("Content-Type", "application/json") -+ http.putheader("Content-Length", len(buf)) -+ http.endheaders() -+ http.send(buf) -+ -+ r = http.getresponse() -+ if r.status != 200: -+ transfer_service.pause() -+ h['failed'] = True -+ raise RuntimeError("could not trim sector (%d, %d): %d: %s" % -+ (offset, count, r.status, r.reason)) -+ -+def flush(h): -+ http = h['http'] -+ transfer = h['transfer'] -+ transfer_service = h['transfer_service'] -+ -+ # Construct the JSON request for flushing. -+ buf = json.dumps({'op': "flush"}).encode() -+ -+ http.putrequest("PATCH", h['path']) -+ http.putheader("Content-Type", "application/json") -+ http.putheader("Content-Length", len(buf)) -+ http.endheaders() -+ http.send(buf) -+ -+ r = http.getresponse() -+ if r.status != 200: -+ transfer_service.pause() -+ h['failed'] = True -+ raise RuntimeError("could not flush: %d: %s" % (r.status, r.reason)) -+ -+def delete_disk_on_failure(h): -+ disk_service = h['disk_service'] -+ disk_service.remove() -+ -+def close(h): -+ http = h['http'] -+ connection = h['connection'] -+ -+ # This is sometimes necessary because python doesn't set up -+ # sys.stderr to be line buffered and so debug, errors or -+ # exceptions printed previously might not be emitted before the -+ # plugin exits. -+ sys.stderr.flush() -+ -+ # If the connection failed earlier ensure we clean up the disk. -+ if h['failed']: -+ delete_disk_on_failure(h) -+ connection.close() -+ return -+ -+ try: -+ # Issue a flush request on close so that the data is written to -+ # persistent store before we create the VM. -+ if h['can_flush']: -+ flush(h) -+ -+ http.close() -+ -+ disk = h['disk'] -+ transfer_service = h['transfer_service'] -+ -+ transfer_service.finalize() -+ -+ # Wait until the transfer disk job is completed since -+ # only then we can be sure the disk is unlocked. As this -+ # code is not very clear, what's happening is that we are -+ # waiting for the transfer object to cease to exist, which -+ # falls through to the exception case and then we can -+ # continue. -+ endt = time.time() + timeout -+ try: -+ while True: -+ time.sleep(1) -+ tmp = transfer_service.get() -+ if time.time() > endt: -+ raise RuntimeError("timed out waiting for transfer " + -+ "to finalize") -+ except sdk.NotFoundError: -+ pass -+ -+ # Write the disk ID file. Only do this on successful completion. -+ with builtins.open(params['diskid_file'], 'w') as fp: -+ fp.write(disk.id) -+ -+ except: -+ # Otherwise on any failure we must clean up the disk. -+ delete_disk_on_failure(h) -+ raise -+ -+ connection.close() -diff --git a/v2v/rhv-upload-precheck.py b/v2v/rhv-upload-precheck.py -new file mode 100644 -index 000000000..2798a29dd ---- /dev/null -+++ b/v2v/rhv-upload-precheck.py -@@ -0,0 +1,73 @@ -+# -*- python -*- -+# oVirt or RHV pre-upload checks used by ‘virt-v2v -o rhv-upload’ -+# Copyright (C) 2018 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. -+ -+import json -+import logging -+import sys -+import time -+ -+from http.client import HTTPSConnection -+from urllib.parse import urlparse -+ -+import ovirtsdk4 as sdk -+import ovirtsdk4.types as types -+ -+# Parameters are passed in via a JSON doc from the OCaml code. -+# Because this Python code ships embedded inside virt-v2v there -+# is no formal API here. -+params = None -+ -+if len(sys.argv) != 2: -+ raise RuntimeError("incorrect number of parameters") -+ -+# Parameters are passed in via a JSON document. -+with open(sys.argv[1], 'r') as fp: -+ params = json.load(fp) -+ -+# What is passed in is a password file, read the actual password. -+with open(params['output_password'], 'r') as fp: -+ output_password = fp.read() -+output_password = output_password.rstrip() -+ -+# Parse out the username from the output_conn URL. -+parsed = urlparse(params['output_conn']) -+username = parsed.username or "admin@internal" -+ -+# Connect to the server. -+connection = sdk.Connection( -+ url = params['output_conn'], -+ username = username, -+ password = output_password, -+ ca_file = params['rhv_cafile'], -+ log = logging.getLogger(), -+ insecure = params['insecure'], -+) -+ -+system_service = connection.system_service() -+ -+# Find if a virtual machine already exists with that name. -+vms_service = system_service.vms_service() -+vms = vms_service.list( -+ search = ("name=%s" % params['output_name']), -+) -+if len(vms) > 0: -+ vm = vms[0] -+ raise RuntimeError("VM already exists with name ‘%s’, id ‘%s’" % -+ (params['output_name'], vm.id)) -+ -+# Otherwise everything is OK, exit with no error. -diff --git a/v2v/test-v2v-o-rhv-upload-oo-query.sh b/v2v/test-v2v-o-rhv-upload-oo-query.sh -new file mode 100755 -index 000000000..29d69e1c1 ---- /dev/null -+++ b/v2v/test-v2v-o-rhv-upload-oo-query.sh -@@ -0,0 +1,38 @@ -+#!/bin/bash - -+# libguestfs virt-v2v test script -+# Copyright (C) 2018 Red Hat Inc. -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ -+# Test -oo "?" option. -+ -+set -e -+ -+$TEST_FUNCTIONS -+skip_if_skipped -+ -+export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools" -+export VIRTIO_WIN="$top_srcdir/test-data/fake-virtio-win" -+ -+f=test-v2v-o-rhv-upload-oo-query.actual -+rm -f $f -+ -+$VG virt-v2v --debug-gc \ -+ -o rhv-upload -oo "?" > $f -+ -+grep -- "-oo rhv-cafile" $f -+grep -- "-oo rhv-verifypeer" $f -+ -+rm $f -diff --git a/v2v/test-v2v-python-syntax.sh b/v2v/test-v2v-python-syntax.sh -new file mode 100755 -index 000000000..b167f4610 ---- /dev/null -+++ b/v2v/test-v2v-python-syntax.sh -@@ -0,0 +1,45 @@ -+#!/bin/bash - -+# libguestfs -+# Copyright (C) 2018 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. -+ -+set -e -+ -+$TEST_FUNCTIONS -+skip_if_skipped -+ -+# Files to check. -+files="rhv-upload-createvm.py rhv-upload-plugin.py rhv-upload-precheck.py" -+ -+# Base version of Python. -+python=python3 -+ -+# Checks the files are syntactically correct, but not very much else. -+for f in $files; do -+ $python -m py_compile $f -+done -+ -+# Checks the files correspond to PEP8 coding style. -+# https://www.python.org/dev/peps/pep-0008/ -+if $python-pep8 --version >/dev/null 2>&1; then -+ for f in $files; do -+ # Ignore: -+ # E226 missing whitespace around arithmetic operator -+ # E251 unexpected spaces around keyword / parameter equals -+ # E302 expected 2 blank lines, found 1 -+ $python-pep8 --ignore=E226,E251,E302 $f -+ done -+fi -diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod -index 5dd888e77..62b726b8f 100644 ---- a/v2v/virt-v2v.pod -+++ b/v2v/virt-v2v.pod -@@ -6,15 +6,18 @@ virt-v2v - Convert a guest to use KVM - - virt-v2v -ic vpx://vcenter.example.com/Datacenter/esxi vmware_guest - -- virt-v2v -ic vpx://vcenter.example.com/Datacenter/esxi vmware_guest \ -- -o rhv -os rhv.nfs:/export_domain --bridge ovirtmgmt -- - virt-v2v -i libvirtxml guest-domain.xml -o local -os /var/tmp - - virt-v2v -i disk disk.img -o local -os /var/tmp - - virt-v2v -i disk disk.img -o glance - -+ virt-v2v -ic vpx://vcenter.example.com/Datacenter/esxi vmware_guest \ -+ -o rhv-upload -oc https://ovirt-engine.example.com/ovirt-engine/api \ -+ -os ovirt-data -op /tmp/ovirt-admin-password -of raw \ -+ -oo rhv-cafile=/tmp/ca.pem -oo rhv-direct \ -+ --bridge ovirtmgmt -+ - =head1 DESCRIPTION - - Virt-v2v converts guests from a foreign hypervisor to run on KVM. It -@@ -50,20 +53,18 @@ For more information see L below. - =head2 Convert from VMware to RHV/oVirt - - This is the same as the previous example, except you want to send the --guest to a RHV-M Export Storage Domain which is located remotely --(over NFS) at C. If you are unclear about --the location of the Export Storage Domain you should check the --settings on your RHV-M management console. Guest network -+guest to a RHV Data Domain using the RHV REST API. Guest network - interface(s) are connected to the target network called C. - - virt-v2v -ic vpx://vcenter.example.com/Datacenter/esxi vmware_guest \ -- -o rhv -os rhv.nfs:/export_domain --bridge ovirtmgmt -+ -o rhv-upload -oc https://ovirt-engine.example.com/ovirt-engine/api \ -+ -os ovirt-data -op /tmp/ovirt-admin-password -of raw \ -+ -oo rhv-cafile=/tmp/ca.pem -oo rhv-direct \ -+ --bridge ovirtmgmt - - In this case the host running virt-v2v acts as a B. - --Note that after conversion, the guest will appear in the RHV-M Export --Storage Domain, from where you will need to import it using the RHV-M --user interface. (See L). -+For more information see L below. - - =head2 Convert from ESXi hypervisor over SSH to local libvirt - -@@ -122,9 +123,9 @@ command line. - Xen ───▶│ -i libvirt ──▶ │ │ │ (default) │ - ... ───▶│ (default) │ │ │ ──┐ └────────────┘ - └────────────┘ │ │ ─┐└──────▶ -o glance -- -i libvirtxml ─────────▶ │ │ ┐└─────────▶ -o rhv -- -i vmx ────────────────▶ │ │ └──────────▶ -o vdsm -- └────────────┘ -+ -i libvirtxml ─────────▶ │ │ ┐├─────────▶ -o rhv -+ -i vmx ────────────────▶ │ │ │└─────────▶ -o vdsm -+ └────────────┘ └──────────▶ -o rhv-upload - - Virt-v2v has a number of possible input and output modes, selected - using the I<-i> and I<-o> options. Only one input and output mode can -@@ -157,8 +158,9 @@ libvirt configuration file (mainly for testing). - I<-o qemu> writes to a local disk image with a shell script for - booting the guest directly in qemu (mainly for testing). - --I<-o rhv> is used to write to a RHV / oVirt target. I<-o vdsm> --is only used when virt-v2v runs under VDSM control. -+I<-o rhv-upload> is used to write to a RHV / oVirt target. I<-o rhv> -+is a legacy method to write to RHV / oVirt E 4.2. I<-o vdsm> is -+only used when virt-v2v runs under VDSM control. - - =head1 OPTIONS - -@@ -426,6 +428,10 @@ written. - - This is the same as I<-o rhv>. - -+=item B<-o> B -+ -+This is the same as I<-o rhv-upload>. -+ - =item B<-o> B - - Set the output method to I. -@@ -447,6 +453,16 @@ I<-os> parameter must also be used to specify the location of the - Export Storage Domain. Note this does not actually import the guest - into RHV. You have to do that manually later using the UI. - -+See L below. -+ -+=item B<-o> B -+ -+Set the output method to I. -+ -+The converted guest is written directly to a RHV Data Domain. -+This is a faster method than I<-o rhv>, but requires oVirt -+or RHV E 4.2. -+ - See L below. - - =item B<-o> B -@@ -488,7 +504,33 @@ the output name is the same as the input name. - Set output option(s) related to the current output mode. - To display short help on what options are available you can use: - -- virt-v2v -o vdsm -oo "?" -+ virt-v2v -o rhv-upload -oo "?" -+ -+=item B<-oo rhv-cafile=>F -+ -+For I<-o rhv-upload> (L) only, the F file -+(Certificate Authority), copied from F -+on the oVirt engine. -+ -+=item B<-oo rhv-cluster=>C -+ -+For I<-o rhv-upload> (L) only, set the RHV Cluster -+Name. If not given it uses C. -+ -+=item B<-oo rhv-direct> -+ -+For I<-o rhv-upload> (L) only, if this option is given -+then virt-v2v will attempt to directly upload the disk to the oVirt -+node, otherwise it will proxy the upload through the oVirt engine. -+Direct upload requires that you have network access to the oVirt -+nodes. Non-direct upload is slightly slower but should work in all -+situations. -+ -+=item B<-oo rhv-verifypeer> -+ -+For I<-o rhv-upload> (L) only, verify the oVirt/RHV -+server’s identity by checking the server‘s certificate against the -+Certificate Authority. - - =item B<-oo vdsm-compat=0.10> - -@@ -1749,6 +1791,68 @@ Define the final guest in libvirt: - - =head1 OUTPUT TO RHV - -+This new method to upload guests to oVirt or RHV directly via the REST -+API requires oVirt/RHV E 4.2. -+ -+You need to specify I<-o rhv-upload> as well as the following extra -+parameters: -+ -+=over 4 -+ -+=item I<-oc> C -+ -+The URL of the REST API which is usually the server name with -+C appended, but might be different if you installed -+oVirt Engine on a different path. -+ -+You can optionally add a username and port number to the URL. If the -+username is not specified then virt-v2v defaults to using -+C which is the typical superuser account for oVirt -+instances. -+ -+=item I<-of raw> -+ -+Currently you must use I<-of raw> and you cannot use I<-oa preallocated>. -+ -+These restrictions will be loosened in a future version. -+ -+=item I<-op> F -+ -+A file containing a password to be used when connecting to the oVirt -+engine. Note the file should contain the whole password, B, and for security the file should have mode -+C<0600> so that others cannot read it. -+ -+=item I<-os> C -+ -+The storage domain. -+ -+=item I<-oo rhv-cafile=>F -+ -+The F file (Certificate Authority), copied from -+F on the oVirt engine. -+ -+=item I<-oo rhv-cluster=>C -+ -+Set the RHV Cluster Name. If not given it uses C. -+ -+=item I<-oo rhv-direct> -+ -+If this option is given then virt-v2v will attempt to directly upload -+the disk to the oVirt node, otherwise it will proxy the upload through -+the oVirt engine. Direct upload requires that you have network access -+to the oVirt nodes. Non-direct upload is slightly slower but should -+work in all situations. -+ -+=item I<-oo rhv-verifypeer> -+ -+Verify the oVirt/RHV server’s identity by checking the server‘s -+certificate against the Certificate Authority. -+ -+=back -+ -+=head1 OUTPUT TO RHV (OLD METHOD) -+ - This section only applies to the I<-o rhv> output mode. If you use - virt-v2v from the RHV-M user interface, then behind the scenes the - import is managed by VDSM using the I<-o vdsm> output mode (which end --- -2.20.1 - diff --git a/SOURCES/0040-v2v-refer-to-the-right-embed-script-in-EXTRA_DIST.patch b/SOURCES/0040-v2v-refer-to-the-right-embed-script-in-EXTRA_DIST.patch deleted file mode 100644 index c48bb1c..0000000 --- a/SOURCES/0040-v2v-refer-to-the-right-embed-script-in-EXTRA_DIST.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 2b18ec6b5680bd557a78f958c8eb75698d0737cc Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Fri, 20 Apr 2018 13:00:56 +0200 -Subject: [PATCH] v2v: refer to the right embed script in EXTRA_DIST - -Fixes commit cc04573927cca97de60d544d37467e67c25867a7. - -(cherry picked from commit cf49fe100338aeac281c7cbcdfe743177ceb0606) ---- - v2v/Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/v2v/Makefile.am b/v2v/Makefile.am -index affc00a8b..0f8c5120b 100644 ---- a/v2v/Makefile.am -+++ b/v2v/Makefile.am -@@ -31,7 +31,7 @@ EXTRA_DIST = \ - $(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \ - copy_to_local.ml \ - copy_to_local.mli \ -- embed-code.sh \ -+ embed.sh \ - rhv-upload-createvm.py \ - rhv-upload-plugin.py \ - rhv-upload-precheck.py \ --- -2.20.1 - diff --git a/SOURCES/0041-v2v-o-rhv-upload-Don-t-require-of-raw-parameter.patch b/SOURCES/0041-v2v-o-rhv-upload-Don-t-require-of-raw-parameter.patch deleted file mode 100644 index 0dc340b..0000000 --- a/SOURCES/0041-v2v-o-rhv-upload-Don-t-require-of-raw-parameter.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 1b7f750e9244c6d0cd184ffa8a64461db70be263 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Fri, 20 Apr 2018 11:48:47 +0100 -Subject: [PATCH] =?UTF-8?q?v2v:=20-o=20rhv-upload:=20Don't=20require=20?= - =?UTF-8?q?=E2=80=98-of=20raw=E2=80=99=20parameter.?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Because we checked the limitation of raw+sparse during command line -processing, it had the effect of forcing you to use ‘-of raw’ even if -the input was already in raw format. Move the checking to the output -mode to avoid this. - -Fixes commit cc04573927cca97de60d544d37467e67c25867a7. - -(cherry picked from commit b3769afaece360b8a2095e3d8a7a934d351c3ade) ---- - v2v/cmdline.ml | 5 ----- - v2v/output_rhv_upload.ml | 18 +++++++++++++++++- - 2 files changed, 17 insertions(+), 6 deletions(-) - -diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml -index 6321eb656..d0be1deb6 100644 ---- a/v2v/cmdline.ml -+++ b/v2v/cmdline.ml -@@ -589,11 +589,6 @@ read the man page virt-v2v(1). - | None -> - error (f_"-o rhv-upload: use ‘-oc’ to point to the oVirt or RHV server REST API URL, which is usually https://servername/ovirt-engine/api") - | Some oc -> oc in -- (* Output format / sparse must currently be raw+sparse. We can -- * change this in future. See TODO file for details. XXX -- *) -- if output_alloc <> Sparse || output_format <> Some "raw" then -- error (f_"-o rhv-upload: currently you must use ‘-of raw’ and you cannot use ‘-oa preallocated’ with this output mode. These restrictions will be loosened in a future version."); - (* In theory we could make the password optional in future. *) - let output_password = - match output_password with -diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml -index 129461242..dc0d96d53 100644 ---- a/v2v/output_rhv_upload.ml -+++ b/v2v/output_rhv_upload.ml -@@ -169,6 +169,19 @@ See also \"OUTPUT TO RHV\" in the virt-v2v(1) manual.") - error (f_"nbdkit was compiled without SELinux support. You will have to recompile nbdkit with libselinux-devel installed, or else set SELinux to Permissive mode while doing the conversion.") - in - -+ (* Output format/sparse must be raw/sparse. We may be able to -+ * lift this limitation in future, but it requires changes on the -+ * RHV side. See TODO file for details. XXX -+ *) -+ let error_current_limitation required_param = -+ error (f_"rhv-upload: currently you must use ‘%s’. This restriction will be loosened in a future version.") required_param -+ in -+ -+ let error_unless_output_alloc_sparse () = -+ if output_alloc <> Sparse then -+ error_current_limitation "-oa sparse" -+ in -+ - (* JSON parameters which are invariant between disks. *) - let json_params = [ - "verbose", JSON.Bool (verbose ()); -@@ -220,6 +233,7 @@ object - error_unless_python_binary_on_path (); - error_unless_nbdkit_working (); - error_unless_nbdkit_python3_working (); -+ error_unless_output_alloc_sparse (); - if have_selinux then - error_unless_nbdkit_compiled_with_selinux () - -@@ -260,7 +274,9 @@ object - - let disk_format = - match t.target_format with -- | ("raw" | "qcow2") as fmt -> fmt -+ | "raw" as fmt -> fmt -+ | "qcow2" -> -+ error_current_limitation "-of raw" - | _ -> - error (f_"rhv-upload: -of %s: Only output format ‘raw’ or ‘qcow2’ is supported. If the input is in a different format then force one of these output formats by adding either ‘-of raw’ or ‘-of qcow2’ on the command line.") - t.target_format in --- -2.20.1 - diff --git a/SOURCES/0042-v2v-o-rhv-upload-install-RHV-tools-RHBZ-1561828.patch b/SOURCES/0042-v2v-o-rhv-upload-install-RHV-tools-RHBZ-1561828.patch deleted file mode 100644 index c8e0dcb..0000000 --- a/SOURCES/0042-v2v-o-rhv-upload-install-RHV-tools-RHBZ-1561828.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 18b5c51228765dbb481cad9db3b9fdc73a7056a2 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= -Date: Sun, 22 Apr 2018 22:57:55 +0200 -Subject: [PATCH] v2v: -o rhv-upload: install RHV tools (RHBZ#1561828). -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Tomáš Golembiovský -(cherry picked from commit f3f00d3f9c6464aa31e3091bdee1191ef15512c6) ---- - v2v/output_rhv_upload.ml | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml -index dc0d96d53..0152b8d5a 100644 ---- a/v2v/output_rhv_upload.ml -+++ b/v2v/output_rhv_upload.ml -@@ -247,6 +247,9 @@ object - - method supported_firmware = [ TargetBIOS ] - -+ (* rhev-apt.exe will be installed (if available). *) -+ method install_rhev_apt = true -+ - method prepare_targets source targets = - let output_name = source.s_name in - let json_params = --- -2.20.1 - diff --git a/SOURCES/0043-v2v-Map-Windows-Server-2012-R2-x86-64-to-ovirt-ID-25.patch b/SOURCES/0043-v2v-Map-Windows-Server-2012-R2-x86-64-to-ovirt-ID-25.patch deleted file mode 100644 index bbedcdb..0000000 --- a/SOURCES/0043-v2v-Map-Windows-Server-2012-R2-x86-64-to-ovirt-ID-25.patch +++ /dev/null @@ -1,30 +0,0 @@ -From c7de26ba87427294bae1d5e597f2c6cb80bd5dd3 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 1 May 2018 11:30:11 +0100 -Subject: [PATCH] v2v: Map Windows Server 2012 R2 x86-64 to ovirt ID 25. - -Thanks: Michal Skrivanek - -Fixes commit 593a19cc86cfa8f24c66518c8ba21222550b066a. - -(cherry picked from commit c6e89299299f1f620437ac3d05a1f0f12de0f208) ---- - v2v/create_ovf.ml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/v2v/create_ovf.ml b/v2v/create_ovf.ml -index c29b8421c..190cf8bed 100644 ---- a/v2v/create_ovf.ml -+++ b/v2v/create_ovf.ml -@@ -418,7 +418,7 @@ and get_ovirt_osid = function - - | { i_type = "windows"; i_major_version = 6; i_minor_version = 3; - i_arch = "x86_64" } -> -- 23 -+ 25 - - | { i_type = "windows"; i_major_version = 10; i_minor_version = 0; - i_arch = "i386" } -> --- -2.20.1 - diff --git a/SOURCES/0044-v2v-fix-build-rules-for-output_rhv_upload_-_source.m.patch b/SOURCES/0044-v2v-fix-build-rules-for-output_rhv_upload_-_source.m.patch deleted file mode 100644 index 20c867f..0000000 --- a/SOURCES/0044-v2v-fix-build-rules-for-output_rhv_upload_-_source.m.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 5510a19932860b170bf6186f0bf5624342d1241a Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Tue, 22 May 2018 17:24:18 +0200 -Subject: [PATCH] v2v: fix build rules for output_rhv_upload_*_source.ml files - -Use the $(srcdir) variable where needed, to make sure it builds also -with srcdir != builddir. - -Furthermore, make sure that the OCaml dependencies calculation depend on -the generated output_rhv_upload_*_source.ml files, otherwise there will -be incomplete OCaml rules for them in the generated .depend. - -Fixes commit cc04573927cca97de60d544d37467e67c25867a7. - -(cherry picked from commit a4e3b7c0598370d8d068b21909da95b6031eb688) ---- - v2v/Makefile.am | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/v2v/Makefile.am b/v2v/Makefile.am -index 0f8c5120b..64bf5235c 100644 ---- a/v2v/Makefile.am -+++ b/v2v/Makefile.am -@@ -143,12 +143,12 @@ SOURCES_C = \ - - # These files are generated and contain rhv-upload-*.py embedded as an - # OCaml string. --output_rhv_upload_createvm_source.ml: rhv-upload-createvm.py -- ./embed.sh code $^ $@ --output_rhv_upload_plugin_source.ml: rhv-upload-plugin.py -- ./embed.sh code $^ $@ --output_rhv_upload_precheck_source.ml: rhv-upload-precheck.py -- ./embed.sh code $^ $@ -+output_rhv_upload_createvm_source.ml: $(srcdir)/rhv-upload-createvm.py -+ $(srcdir)/embed.sh code $^ $@ -+output_rhv_upload_plugin_source.ml: $(srcdir)/rhv-upload-plugin.py -+ $(srcdir)/embed.sh code $^ $@ -+output_rhv_upload_precheck_source.ml: $(srcdir)/rhv-upload-precheck.py -+ $(srcdir)/embed.sh code $^ $@ - - if HAVE_OCAML - -@@ -573,7 +573,7 @@ v2v_unit_tests_LINK = \ - $(v2v_unit_tests_THEOBJECTS) -o $@ - - # Dependencies. --.depend: $(srcdir)/*.mli $(srcdir)/*.ml -+.depend: $(srcdir)/*.mli $(srcdir)/*.ml output_rhv_upload_createvm_source.ml output_rhv_upload_plugin_source.ml output_rhv_upload_precheck_source.ml - $(top_builddir)/ocaml-dep.sh $^ - -include .depend - --- -2.20.1 - diff --git a/SOURCES/0045-v2v-fix-rhevexp-typo-in-documentation.patch b/SOURCES/0045-v2v-fix-rhevexp-typo-in-documentation.patch deleted file mode 100644 index 97ee2bf..0000000 --- a/SOURCES/0045-v2v-fix-rhevexp-typo-in-documentation.patch +++ /dev/null @@ -1,37 +0,0 @@ -From c49781bcea6367dd17e9245783a14964fd45e555 Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Tue, 29 May 2018 06:49:23 +0200 -Subject: [PATCH] v2v: fix "rhevexp" typo in documentation - -Spotted by Ming Xie. - -(cherry picked from commit c021ac5e64053052a392762aaff9c8ed73fc2082) ---- - v2v/virt-v2v.pod | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod -index 62b726b8f..806225be0 100644 ---- a/v2v/virt-v2v.pod -+++ b/v2v/virt-v2v.pod -@@ -601,7 +601,7 @@ Currently there are two possible flavours: - - =over 4 - --=item rhevexp -+=item rhvexp - - The OVF format used in RHV export storage domain. - -@@ -611,7 +611,7 @@ The OVF format understood by oVirt REST API. - - =back - --For backward compatibility the default is I, but this may change in -+For backward compatibility the default is I, but this may change in - the future. - - =item B<-op> file --- -2.20.1 - diff --git a/SOURCES/0046-v2v-add-and-use-Create_ovf.ovf_flavour_to_string.patch b/SOURCES/0046-v2v-add-and-use-Create_ovf.ovf_flavour_to_string.patch deleted file mode 100644 index 9bba082..0000000 --- a/SOURCES/0046-v2v-add-and-use-Create_ovf.ovf_flavour_to_string.patch +++ /dev/null @@ -1,66 +0,0 @@ -From ecbd5983e10adb6c5d95fdae1dc878a9905ae1b4 Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Tue, 29 May 2018 07:04:50 +0200 -Subject: [PATCH] v2v: add and use Create_ovf.ovf_flavour_to_string - -Add an helper to convert an OVF flavour to string, and use it in --o vdsm to print the actual value of the vdsm-ovf-flavour option. - -Thanks to Ming Xie. - -(cherry picked from commit c0da02f90d9b52413c24dd9dae61662ad033cc16) ---- - v2v/create_ovf.ml | 4 ++++ - v2v/create_ovf.mli | 3 +++ - v2v/output_vdsm.ml | 5 +++-- - 3 files changed, 10 insertions(+), 2 deletions(-) - -diff --git a/v2v/create_ovf.ml b/v2v/create_ovf.ml -index 190cf8bed..ac3c61b13 100644 ---- a/v2v/create_ovf.ml -+++ b/v2v/create_ovf.ml -@@ -40,6 +40,10 @@ let ovf_flavour_of_string = function - | "rhvexp" -> RHVExportStorageDomain - | flav -> invalid_arg flav - -+let ovf_flavour_to_string = function -+ | OVirt -> "ovirt" -+ | RHVExportStorageDomain -> "rhvexp" -+ - (* We set the creation time to be the same for all dates in - * all metadata files. All dates in OVF are UTC. - *) -diff --git a/v2v/create_ovf.mli b/v2v/create_ovf.mli -index 2d80660e3..8200b76f9 100644 ---- a/v2v/create_ovf.mli -+++ b/v2v/create_ovf.mli -@@ -29,6 +29,9 @@ val ovf_flavours : string list - valid flavour. *) - val ovf_flavour_of_string : string -> ovf_flavour - -+(** Convert an OVF flavour to its string representation. *) -+val ovf_flavour_to_string : ovf_flavour -> string -+ - (** Create OVF and related files for RHV. - - The format for RHV export storage domain is described in: -diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml -index 92b3fd122..9a1b748bc 100644 ---- a/v2v/output_vdsm.ml -+++ b/v2v/output_vdsm.ml -@@ -118,9 +118,10 @@ object - | "0.10" -> "" (* currently this is the default, so don't print it *) - | s -> sprintf " -oo vdsm-compat=%s" s) - (match vdsm_options.ovf_flavour with -- | Create_ovf.OVirt -> "-oo vdsm-ovf-flavour=ovf" - (* currently this is the default, so don't print it *) -- | Create_ovf.RHVExportStorageDomain -> "") -+ | Create_ovf.RHVExportStorageDomain -> "" -+ | flav -> sprintf "-oo vdsm-ovf-flavour=%s" -+ (Create_ovf.ovf_flavour_to_string flav)) - - method supported_firmware = [ TargetBIOS ] - --- -2.20.1 - diff --git a/SOURCES/0047-daemon-Move-lvmetad-to-early-in-the-appliance-boot-p.patch b/SOURCES/0047-daemon-Move-lvmetad-to-early-in-the-appliance-boot-p.patch deleted file mode 100644 index 087fe8c..0000000 --- a/SOURCES/0047-daemon-Move-lvmetad-to-early-in-the-appliance-boot-p.patch +++ /dev/null @@ -1,225 +0,0 @@ -From 3ad6840403edac13249d373d29c7d1f72b35c8b0 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 24 May 2018 10:24:25 +0100 -Subject: [PATCH] daemon: Move lvmetad to early in the appliance boot process. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When the daemon starts up it creates a fresh (empty) LVM configuration -and starts up lvmetad (which depends on the LVM configuration). - -However this appears to cause problems: Some types of PV seem to -require lvmetad and don't work without it -(https://bugzilla.redhat.com/show_bug.cgi?id=1581810). If we don't -start lvmetad earlier, the device nodes are not created. - -Therefore move the whole initialization step into appliance/init. - -Two further changes had to be made: - -Now we are using lvmetad all the time, using vgchange is incorrect. -With lvmetad activated early we must use ‘pvscan --cache --activate ay’ -to scan all disks for PVs and activate any VGs on them (although the -documentation is complex, confusing and contradictory so I'm not -completely sure about this). - -The ‘lvm_system_dir’ local variable in ‘daemon/lvm-filter.c’ -previously contained the path of the directory above $LVM_SYSTEM_DIR -(eg. $LVM_SYSTEM_DIR = "/etc/lvm", lvm_system_dir = "/etc"). As this -was highly confusing, I have changed it so the local variable and the -environment variable have identical contents. This involved removing -the ‘lvm/’ component from a couple of paths since it is now included -in the local variable. - -(cherry picked from commit dd162d2cd56a2ecf4bcd40a7f463940eaac875b8) ---- - appliance/init | 11 +++++- - daemon/daemon.h | 4 --- - daemon/guestfsd.c | 8 ----- - daemon/lvm-filter.c | 81 +++++++++++++-------------------------------- - 4 files changed, 33 insertions(+), 71 deletions(-) - -diff --git a/appliance/init b/appliance/init -index 1cd264e08..471d83cae 100755 ---- a/appliance/init -+++ b/appliance/init -@@ -130,9 +130,17 @@ echo nameserver 169.254.2.3 > /etc/resolv.conf - # Scan for MDs but don't run arrays unless all expected drives are present - mdadm -As --auto=yes --no-degraded - -+# Set up a clean LVM environment. -+# Empty LVM configuration file means "all defaults". -+mkdir -p /tmp/lvm -+touch /tmp/lvm/lvm.conf -+LVM_SYSTEM_DIR=/tmp/lvm -+export LVM_SYSTEM_DIR -+lvmetad -+ - # Scan for LVM. - modprobe dm_mod ||: --lvm vgchange -aay --sysinit -+lvm pvscan --cache --activate ay - - # Scan for MDs and run all found arrays even they are in degraded state - mdadm -As --auto=yes --run -@@ -146,6 +154,7 @@ if test "$guestfs_verbose" = 1 && test "$guestfs_boot_analysis" != 1; then - ls -lR /dev - cat /proc/mounts - cat /proc/mdstat -+ lvm config - lvm pvs - lvm vgs - lvm lvs -diff --git a/daemon/daemon.h b/daemon/daemon.h -index 7958ba781..faaf1237e 100644 ---- a/daemon/daemon.h -+++ b/daemon/daemon.h -@@ -249,10 +249,6 @@ extern char *get_blkid_tag (const char *device, const char *tag); - /* lvm.c */ - extern int lv_canonical (const char *device, char **ret); - --/* lvm-filter.c */ --extern void clean_lvm_config (void); --extern void start_lvmetad (void); -- - /* zero.c */ - extern void wipe_device_before_mkfs (const char *device); - -diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c -index 68d3de2ec..ae428e573 100644 ---- a/daemon/guestfsd.c -+++ b/daemon/guestfsd.c -@@ -233,14 +233,6 @@ main (int argc, char *argv[]) - _umask (0); - #endif - -- /* Make a private copy of /etc/lvm so we can change the config (see -- * daemon/lvm-filter.c). -- */ -- if (!test_mode) { -- clean_lvm_config (); -- start_lvmetad (); -- } -- - /* Connect to virtio-serial channel. */ - if (!channel) - channel = VIRTIO_SERIAL_CHANNEL; -diff --git a/daemon/lvm-filter.c b/daemon/lvm-filter.c -index ad85a7cc4..9d877c104 100644 ---- a/daemon/lvm-filter.c -+++ b/daemon/lvm-filter.c -@@ -36,71 +36,36 @@ - #include "daemon.h" - #include "actions.h" - --/* This runs during daemon start up and creates a fresh LVM -- * configuration which we can modify as we desire. LVM allows -- * configuration to be completely empty (meaning "all defaults"). -- * -- * The final directory layout is: -- * -- * /tmp/lvmXXXXXX (lvm_system_dir set to this) -- * /tmp/lvmXXXXXX/lvm ($LVM_SYSTEM_DIR set to this) -- * /tmp/lvmXXXXXX/lvm/lvm.conf (configuration file - initially empty) -- */ --static char lvm_system_dir[] = "/tmp/lvmXXXXXX"; -- --static void rm_lvm_system_dir (void); - static void debug_lvm_config (void); - --void --clean_lvm_config (void) --{ -- char env[64], conf[64]; -- FILE *fp; -- -- if (mkdtemp (lvm_system_dir) == NULL) -- error (EXIT_FAILURE, errno, "mkdtemp: %s", lvm_system_dir); -- -- snprintf (env, sizeof env, "%s/lvm", lvm_system_dir); -- mkdir (env, 0755); -- snprintf (conf, sizeof conf, "%s/lvm/lvm.conf", lvm_system_dir); -- fp = fopen (conf, "w"); -- if (fp == NULL) { -- perror ("clean_lvm_config: cannot create empty lvm.conf"); -- exit (EXIT_FAILURE); -- } -- fclose (fp); -- -- /* Set environment variable so we use the clean configuration. */ -- setenv ("LVM_SYSTEM_DIR", env, 1); -- -- /* Set a handler to remove the temporary directory at exit. */ -- atexit (rm_lvm_system_dir); -+/* Read LVM_SYSTEM_DIR environment variable, or set it to a default -+ * value if the environment variable is not set. -+ */ -+static char *lvm_system_dir; -+static void get_lvm_system_dir (void) __attribute__((constructor)); -+static void free_lvm_system_dir (void) __attribute__((destructor)); - -- debug_lvm_config (); --} -- --/* Try to run lvmetad, without failing if it couldn't. */ --void --start_lvmetad (void) -+static void -+get_lvm_system_dir (void) - { -- int r; -+ const char *p; - -- if (verbose) -- printf ("%s\n", "lvmetad"); -- r = system ("lvmetad"); -- if (r == -1) -- perror ("system/lvmetad"); -- else if (!WIFEXITED (r) || WEXITSTATUS (r) != 0) -- fprintf (stderr, "warning: lvmetad command failed\n"); -+ p = getenv ("LVM_SYSTEM_DIR"); -+ if (p) { -+ lvm_system_dir = strdup (p); -+ if (lvm_system_dir == NULL) abort (); -+ } -+ if (!lvm_system_dir) { -+ lvm_system_dir = strdup ("/etc/lvm"); -+ if (lvm_system_dir == NULL) abort (); -+ } -+ fprintf (stderr, "lvm_system_dir = %s\n", lvm_system_dir); - } - - static void --rm_lvm_system_dir (void) -+free_lvm_system_dir (void) - { -- char cmd[64]; -- -- snprintf (cmd, sizeof cmd, "rm -rf %s", lvm_system_dir); -- ignore_value (system (cmd)); -+ free (lvm_system_dir); - } - - /* Rewrite the 'filter = [ ... ]' line in lvm.conf. */ -@@ -112,7 +77,7 @@ set_filter (char *const *filters) - FILE *fp; - size_t i, j; - -- if (asprintf (&conf, "%s/lvm/lvm.conf", lvm_system_dir) == -1) { -+ if (asprintf (&conf, "%s/lvm.conf", lvm_system_dir) == -1) { - reply_with_perror ("asprintf"); - return -1; - } -@@ -177,7 +142,7 @@ static int - rescan (void) - { - char lvm_cache[64]; -- snprintf (lvm_cache, sizeof lvm_cache, "%s/lvm/cache/.cache", lvm_system_dir); -+ snprintf (lvm_cache, sizeof lvm_cache, "%s/cache/.cache", lvm_system_dir); - - unlink (lvm_cache); - --- -2.20.1 - diff --git a/SOURCES/0048-v2v-o-rhv-upload-Set-inactivity-timeout-RHBZ-1586198.patch b/SOURCES/0048-v2v-o-rhv-upload-Set-inactivity-timeout-RHBZ-1586198.patch deleted file mode 100644 index bce9c32..0000000 --- a/SOURCES/0048-v2v-o-rhv-upload-Set-inactivity-timeout-RHBZ-1586198.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 92035bb2924846ea96aeeec9f9d76839c146eaca Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 5 Jun 2018 19:09:43 +0100 -Subject: [PATCH] v2v: -o rhv-upload: Set inactivity timeout (RHBZ#1586198). -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This increases the inactivity timeout for transfers from the default -(60 seconds in oVirt < 4.2.3, 600 seconds in >= 4.2.3), up to 1 hour, -so that we should never hit it for ordinary transfers. - -Note this requires oVirt >= 4.2.3. The corresponding oVirt fix was -https://bugzilla.redhat.com/1563278 - -I also replaced the deprecated ‘image’ parameter with ‘disk’. - -Thanks: Nir Soffer, Daniel Erez. -(cherry picked from commit f25404c65f8e078a3ca5bd5a1ab91343edd22506) ---- - v2v/rhv-upload-plugin.py | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py -index 791c9e7d2..b4557b83c 100644 ---- a/v2v/rhv-upload-plugin.py -+++ b/v2v/rhv-upload-plugin.py -@@ -123,9 +123,8 @@ def open(readonly): - # Create a new image transfer. - transfer = transfers_service.add( - types.ImageTransfer( -- image = types.Image( -- id = disk.id -- ) -+ disk = types.Disk(id = disk.id), -+ inactivity_timeout = 3600, - ) - ) - debug("transfer.id = %r" % transfer.id) --- -2.20.1 - diff --git a/SOURCES/0049-v2v-linux-fix-kernel-detection-when-split-in-differe.patch b/SOURCES/0049-v2v-linux-fix-kernel-detection-when-split-in-differe.patch deleted file mode 100644 index 025bf69..0000000 --- a/SOURCES/0049-v2v-linux-fix-kernel-detection-when-split-in-differe.patch +++ /dev/null @@ -1,110 +0,0 @@ -From f9586e74f18110ab7a70e29a5a577afed0666ca0 Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Tue, 22 May 2018 10:46:21 +0200 -Subject: [PATCH] v2v: linux: fix kernel detection when split in different - packages - -The current detection code for Linux kernels assumes that a kernel -package contains everything in it, i.e. the kernel itself, its modules, -and its configuration. However, since recent Ubuntu versions (e.g. -starting from 18.04) modules & config (with few more files) are split in -an own package, thus not detecting the modpath from installed vmlinuz -files. - -To overcome this situation, rework this detection a bit: -1) find the vmlinuz file as before, but then immediately make sure it - exists by stat'ing it -2) find the modules path from the package as before: -2a) if found, extract the version in the same step -2b) if not found, get the kernel version from the vmlinuz filename, - and use it to detect the modules path -3) check that the modules path exists - -The detection done in (2b) is based on the current packaging scheme -found in the most important Linux distributions (Fedora, RHEL, CentOS, -Debian, Ubuntu, openSUSE, AltLinux, and possibly more). The notable -exception is Arch Linux. - -As additional change, do not assume the config file is in the same -package as vmlinuz, but directly look into the filesystem using the -version we already have. - -(cherry picked from commit 500acb15f8f777e9fe99a60c4216daf84a92aae3) ---- - v2v/linux_kernels.ml | 47 +++++++++++++++++++++++++++++--------------- - 1 file changed, 31 insertions(+), 16 deletions(-) - -diff --git a/v2v/linux_kernels.ml b/v2v/linux_kernels.ml -index c047d6deb..24f61429d 100644 ---- a/v2v/linux_kernels.ml -+++ b/v2v/linux_kernels.ml -@@ -103,27 +103,42 @@ let detect_kernels (g : G.guestfs) inspect family bootloader = - None - ) - else ( -- (* Which of these is the kernel itself? *) -+ (* Which of these is the kernel itself? Also, make sure to check -+ * it exists by stat'ing it. -+ *) - let vmlinuz = List.find ( - fun filename -> String.is_prefix filename "/boot/vmlinuz-" - ) files in -- (* Which of these is the modpath? *) -- let modpath = List.find ( -- fun filename -> -- String.length filename >= 14 && -- String.is_prefix filename "/lib/modules/" -- ) files in -- -- (* Check vmlinuz & modpath exist. *) -- if not (g#is_dir ~followsymlinks:true modpath) then -- raise Not_found; - let vmlinuz_stat = - try g#statns vmlinuz with G.Error _ -> raise Not_found in - -- (* Get/construct the version. XXX Read this from kernel file. *) -- let version = -- let prefix_len = String.length "/lib/modules/" in -- String.sub modpath prefix_len (String.length modpath - prefix_len) in -+ (* Determine the modpath from the package, falling back to the -+ * version in the vmlinuz file name. -+ *) -+ let modpath, version = -+ let prefix = "/lib/modules/" in -+ try -+ let prefix_len = String.length prefix in -+ List.find_map ( -+ fun filename -> -+ let filename_len = String.length filename in -+ if filename_len > prefix_len && -+ String.is_prefix filename prefix then ( -+ let version = String.sub filename prefix_len -+ (filename_len - prefix_len) in -+ Some (filename, version) -+ ) else -+ None -+ ) files -+ with Not_found -> -+ let version = -+ String.sub vmlinuz 14 (String.length vmlinuz - 14) in -+ let modpath = prefix ^ version in -+ modpath, version in -+ -+ (* Check that the modpath exists. *) -+ if not (g#is_dir ~followsymlinks:true modpath) then -+ raise Not_found; - - (* Find the initramfs which corresponds to the kernel. - * Since the initramfs is built at runtime, and doesn't have -@@ -188,7 +203,7 @@ let detect_kernels (g : G.guestfs) inspect family bootloader = - - let config_file = - let cfg = "/boot/config-" ^ version in -- if List.mem cfg files then Some cfg -+ if g#is_file ~followsymlinks:true cfg then Some cfg - else None in - - let kernel_supports what kconf = --- -2.20.1 - diff --git a/SOURCES/0050-New-API-inspect_get_osinfo.patch b/SOURCES/0050-New-API-inspect_get_osinfo.patch deleted file mode 100644 index 5f72cb1..0000000 --- a/SOURCES/0050-New-API-inspect_get_osinfo.patch +++ /dev/null @@ -1,136 +0,0 @@ -From 5fb23eb5171b6b93adf513ea9025199e2a21c076 Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Wed, 21 Feb 2018 17:33:28 +0100 -Subject: [PATCH] New API: inspect_get_osinfo - -Try to guess the possible osinfo-db short ID for the specified OS. - -Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1544842 - -(cherry picked from commit 286b88891c2288fb7f64c9538296599ece04bcb1) ---- - generator/actions_inspection.ml | 14 ++++++ - lib/Makefile.am | 1 + - lib/inspect-osinfo.c | 75 +++++++++++++++++++++++++++++++++ - 3 files changed, 90 insertions(+) - create mode 100644 lib/inspect-osinfo.c - -diff --git a/generator/actions_inspection.ml b/generator/actions_inspection.ml -index 0ac282435..ff5083114 100644 ---- a/generator/actions_inspection.ml -+++ b/generator/actions_inspection.ml -@@ -770,4 +770,18 @@ advice before using trademarks in applications. - - =back" }; - -+ { defaults with -+ name = "inspect_get_osinfo"; added = (1, 39, 1); -+ style = RString (RPlainString, "id"), [String (Mountable, "root")], []; -+ shortdesc = "get a possible osinfo short ID corresponding to this operating system"; -+ longdesc = "\ -+This function returns a possible short ID for libosinfo corresponding -+to the guest. -+ -+I The returned ID is only a guess by libguestfs, and nothing -+ensures that it actually exists in osinfo-db. -+ -+If no ID could not be determined, then the string C is -+returned." }; -+ - ] -diff --git a/lib/Makefile.am b/lib/Makefile.am -index 91c4e0a2e..bd753d786 100644 ---- a/lib/Makefile.am -+++ b/lib/Makefile.am -@@ -95,6 +95,7 @@ libguestfs_la_SOURCES = \ - info.c \ - inspect-apps.c \ - inspect-icon.c \ -+ inspect-osinfo.c \ - journal.c \ - launch.c \ - launch-direct.c \ -diff --git a/lib/inspect-osinfo.c b/lib/inspect-osinfo.c -new file mode 100644 -index 000000000..816d317f1 ---- /dev/null -+++ b/lib/inspect-osinfo.c -@@ -0,0 +1,75 @@ -+/* libguestfs -+ * Copyright (C) 2018 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 -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include -+ -+#include "guestfs.h" -+#include "guestfs-internal.h" -+#include "guestfs-internal-actions.h" -+ -+char * -+guestfs_impl_inspect_get_osinfo (guestfs_h *g, const char *root) -+{ -+ CLEANUP_FREE char *type = NULL; -+ CLEANUP_FREE char *distro = NULL; -+ int major, minor; -+ -+ type = guestfs_inspect_get_type (g, root); -+ if (!type) -+ return NULL; -+ distro = guestfs_inspect_get_distro (g, root); -+ if (!distro) -+ return NULL; -+ major = guestfs_inspect_get_major_version (g, root); -+ minor = guestfs_inspect_get_minor_version (g, root); -+ -+ if (STREQ (type, "linux")) { -+ if (STREQ (distro, "centos")) { -+ if (major >= 7) -+ return safe_asprintf (g, "%s%d.0", distro, major); -+ else if (major == 6) -+ return safe_asprintf (g, "%s%d.%d", distro, major, minor); -+ } -+ else if (STREQ (distro, "debian")) { -+ if (major >= 4) -+ return safe_asprintf (g, "%s%d", distro, major); -+ } -+ else if (STREQ (distro, "fedora") || STREQ (distro, "mageia")) -+ return safe_asprintf (g, "%s%d", distro, major); -+ else if (STREQ (distro, "sles")) { -+ if (minor == 0) -+ return safe_asprintf (g, "%s%d", distro, major); -+ else -+ return safe_asprintf (g, "%s%dsp%d", distro, major, minor); -+ } -+ else if (STREQ (distro, "ubuntu")) -+ return safe_asprintf (g, "%s%d.%02d", distro, major, minor); -+ -+ if (major > 0 || minor > 0) -+ return safe_asprintf (g, "%s%d.%d", distro, major, minor); -+ } -+ else if (STREQ (type, "freebsd") || STREQ (type, "netbsd") || STREQ (type, "openbsd")) -+ return safe_asprintf (g, "%s%d.%d", distro, major, minor); -+ else if (STREQ (type, "dos")) { -+ if (STREQ (distro, "msdos")) -+ return safe_strdup (g, "msdos6.22"); -+ } -+ -+ /* No ID could be guessed, return "unknown". */ -+ return safe_strdup (g, "unknown"); -+} --- -2.20.1 - diff --git a/SOURCES/0051-inspector-show-the-per-OS-osinfo-guess-RHBZ-1544842.patch b/SOURCES/0051-inspector-show-the-per-OS-osinfo-guess-RHBZ-1544842.patch deleted file mode 100644 index d78cf53..0000000 --- a/SOURCES/0051-inspector-show-the-per-OS-osinfo-guess-RHBZ-1544842.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 6357a82435d328b1da23ab4995f26836427747a4 Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Wed, 21 Feb 2018 17:37:30 +0100 -Subject: [PATCH] inspector: show the per-OS osinfo guess (RHBZ#1544842) - -Output also the osinfo guess for each OS in the generated XML output; -adapt the RNG schema, and the test data to it. - -(cherry picked from commit 2f8ec91fc1f3e81c8fb81d45849bc7462ee13642) ---- - inspector/expected-coreos.img.xml | 1 + - inspector/expected-debian.img.xml | 1 + - inspector/expected-fedora.img.xml | 1 + - inspector/expected-ubuntu.img.xml | 1 + - inspector/inspector.c | 7 +++++++ - inspector/virt-inspector.rng | 1 + - 6 files changed, 12 insertions(+) - -diff --git a/inspector/expected-coreos.img.xml b/inspector/expected-coreos.img.xml -index e4a5d1134..0cdfba6e6 100644 ---- a/inspector/expected-coreos.img.xml -+++ b/inspector/expected-coreos.img.xml -@@ -8,6 +8,7 @@ - 899 - 13 - coreos.invalid -+ coreos899.13 - - / - /usr -diff --git a/inspector/expected-debian.img.xml b/inspector/expected-debian.img.xml -index 37ecfa049..6583dc262 100644 ---- a/inspector/expected-debian.img.xml -+++ b/inspector/expected-debian.img.xml -@@ -11,6 +11,7 @@ - deb - apt - debian.invalid -+ debian5 - - / - /usr -diff --git a/inspector/expected-fedora.img.xml b/inspector/expected-fedora.img.xml -index 8d40e8cb7..df6060a73 100644 ---- a/inspector/expected-fedora.img.xml -+++ b/inspector/expected-fedora.img.xml -@@ -11,6 +11,7 @@ - rpm - yum - fedora.invalid -+ fedora14 - - / - /boot -diff --git a/inspector/expected-ubuntu.img.xml b/inspector/expected-ubuntu.img.xml -index c19c14cd5..4ebcd76d6 100644 ---- a/inspector/expected-ubuntu.img.xml -+++ b/inspector/expected-ubuntu.img.xml -@@ -11,6 +11,7 @@ - deb - apt - ubuntu.invalid -+ ubuntu10.10 - - / - /boot -diff --git a/inspector/inspector.c b/inspector/inspector.c -index d608b1b63..5075a8f04 100644 ---- a/inspector/inspector.c -+++ b/inspector/inspector.c -@@ -443,6 +443,13 @@ output_root (xmlTextWriterPtr xo, char *root) - BAD_CAST str)); - free (str); - -+ str = guestfs_inspect_get_osinfo (g, root); -+ if (!str) exit (EXIT_FAILURE); -+ if (STRNEQ (str, "unknown")) -+ XMLERROR (-1, -+ xmlTextWriterWriteElement (xo, BAD_CAST "osinfo", BAD_CAST str)); -+ free (str); -+ - output_mountpoints (xo, root); - - output_filesystems (xo, root); -diff --git a/inspector/virt-inspector.rng b/inspector/virt-inspector.rng -index 314785202..1e3a58af8 100644 ---- a/inspector/virt-inspector.rng -+++ b/inspector/virt-inspector.rng -@@ -38,6 +38,7 @@ - - - -+ - - - --- -2.20.1 - diff --git a/SOURCES/0052-lib-libvirt-Convert-all-socket-parameters-to-an-abso.patch b/SOURCES/0052-lib-libvirt-Convert-all-socket-parameters-to-an-abso.patch deleted file mode 100644 index 8f8d824..0000000 --- a/SOURCES/0052-lib-libvirt-Convert-all-socket-parameters-to-an-abso.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 1db9a763c92eae49d05e5c7a4c9c5527cced2ad0 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 14 Jun 2018 11:19:49 +0100 -Subject: [PATCH] lib: libvirt: Convert all socket parameters to an absolute - path (RHBZ#1588451). - -(cherry picked from commit 70bc83f893e6e0daf20ca7c9b7bfe875ceaed594) ---- - lib/launch-libvirt.c | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - -diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c -index c709c4fe2..4df26825a 100644 ---- a/lib/launch-libvirt.c -+++ b/lib/launch-libvirt.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -1706,8 +1707,20 @@ construct_libvirt_xml_disk_source_hosts (guestfs_h *g, - } - - case drive_transport_unix: { -+ /* libvirt requires sockets to be specified as an absolute path -+ * (RHBZ#1588451). -+ */ -+ const char *socket = src->servers[i].u.socket; -+ CLEANUP_FREE char *abs_socket = realpath (socket, NULL); -+ -+ if (abs_socket == NULL) { -+ perrorf (g, _("realpath: could not convert ‘%s’ to absolute path"), -+ socket); -+ return -1; -+ } -+ - attribute ("transport", "unix"); -- attribute ("socket", src->servers[i].u.socket); -+ attribute ("socket", abs_socket); - break; - } - } --- -2.20.1 - diff --git a/SOURCES/0053-v2v-o-rhv-upload-Optimize-http-request-sending.patch b/SOURCES/0053-v2v-o-rhv-upload-Optimize-http-request-sending.patch deleted file mode 100644 index 6916be8..0000000 --- a/SOURCES/0053-v2v-o-rhv-upload-Optimize-http-request-sending.patch +++ /dev/null @@ -1,90 +0,0 @@ -From dc6afe583853bc2e18a689aa06685e69d65ede84 Mon Sep 17 00:00:00 2001 -From: Nir Soffer -Date: Thu, 14 Jun 2018 21:16:01 +0300 -Subject: [PATCH] v2v: -o rhv-upload: Optimize http request sending - -When sending request with small or no payload, it is simpler and -possibly more efficient to use the high level HTTPSConnection.request(), -instead of the lower level APIs. - -The only reason to use the lower level APIs is to avoid copying the -payload, or on python 2, to use a bigger buffer size when streaming a -file-like object. - -(cherry picked from commit 77a412c0a1cd0e303a072fc5088c8f3bfed36583) ---- - v2v/rhv-upload-plugin.py | 35 ++++++++++++++++------------------- - 1 file changed, 16 insertions(+), 19 deletions(-) - -diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py -index b4557b83c..9ad354b84 100644 ---- a/v2v/rhv-upload-plugin.py -+++ b/v2v/rhv-upload-plugin.py -@@ -237,12 +237,12 @@ def pread(h, count, offset): - transfer = h['transfer'] - transfer_service = h['transfer_service'] - -- http.putrequest("GET", h['path']) -+ headers = {"Range", "bytes=%d-%d" % (offset, offset+count-1)} - # Authorization is only needed for old imageio. - if h['needs_auth']: -- http.putheader("Authorization", transfer.signed_ticket) -- http.putheader("Range", "bytes=%d-%d" % (offset, offset+count-1)) -- http.endheaders() -+ headers["Authorization"] = transfer.signed_ticket -+ -+ http.request("GET", h['path'], headers=headers) - - r = http.getresponse() - # 206 = HTTP Partial Content. -@@ -297,11 +297,10 @@ def zero(h, count, offset, may_trim): - 'size': count, - 'flush': False}).encode() - -- http.putrequest("PATCH", h['path']) -- http.putheader("Content-Type", "application/json") -- http.putheader("Content-Length", len(buf)) -- http.endheaders() -- http.send(buf) -+ headers = {"Content-Type": "application/json", -+ "Content-Length": str(len(buf))} -+ -+ http.request("PATCH", h['path'], body=buf, headers=headers) - - r = http.getresponse() - if r.status != 200: -@@ -349,11 +348,10 @@ def trim(h, count, offset): - 'size': count, - 'flush': False}).encode() - -- http.putrequest("PATCH", h['path']) -- http.putheader("Content-Type", "application/json") -- http.putheader("Content-Length", len(buf)) -- http.endheaders() -- http.send(buf) -+ headers = {"Content-Type": "application/json", -+ "Content-Length": str(len(buf))} -+ -+ http.request("PATCH", h['path'], body=buf, headers=headers) - - r = http.getresponse() - if r.status != 200: -@@ -370,11 +368,10 @@ def flush(h): - # Construct the JSON request for flushing. - buf = json.dumps({'op': "flush"}).encode() - -- http.putrequest("PATCH", h['path']) -- http.putheader("Content-Type", "application/json") -- http.putheader("Content-Length", len(buf)) -- http.endheaders() -- http.send(buf) -+ headers = {"Content-Type": "application/json", -+ "Content-Length": str(len(buf))} -+ -+ http.request("PATCH", h['path'], body=buf, headers=headers) - - r = http.getresponse() - if r.status != 200: --- -2.20.1 - diff --git a/SOURCES/0054-v2v-o-rhv-upload-Log-full-imageio-response-on-failur.patch b/SOURCES/0054-v2v-o-rhv-upload-Log-full-imageio-response-on-failur.patch deleted file mode 100644 index 4cc3683..0000000 --- a/SOURCES/0054-v2v-o-rhv-upload-Log-full-imageio-response-on-failur.patch +++ /dev/null @@ -1,153 +0,0 @@ -From ed2835440ba7d1a4bc4f9aeb92a14c644522bbfd Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 5 Jun 2018 13:27:43 +0100 -Subject: [PATCH] v2v: -o rhv-upload: Log full imageio response on failure. - -Thanks: Nir Soffer -(cherry picked from commit 831a75cd11c5a87e40fccdadcb62353f6a4d5a72) ---- - v2v/rhv-upload-plugin.py | 69 ++++++++++++++++++++++++---------------- - 1 file changed, 42 insertions(+), 27 deletions(-) - -diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py -index 9ad354b84..7c5084efd 100644 ---- a/v2v/rhv-upload-plugin.py -+++ b/v2v/rhv-upload-plugin.py -@@ -227,6 +227,32 @@ def can_flush(h): - def get_size(h): - return params['disk_size'] - -+# Any unexpected HTTP response status from the server will end up -+# calling this function which logs the full error, pauses the -+# transfer, sets the failed state, and raises a RuntimeError -+# exception. -+def request_failed(h, r, msg): -+ # Setting the failed flag in the handle causes the disk to be -+ # cleaned up on close. -+ h['failed'] = True -+ h['transfer_service'].pause() -+ -+ status = r.status -+ reason = r.reason -+ try: -+ body = r.read() -+ except EnvironmentError as e: -+ body = "(Unable to read response body: %s)" % e -+ -+ # Log the full error if we're verbose. -+ debug("unexpected response from imageio server:") -+ debug(msg) -+ debug("%d: %s" % (status, reason)) -+ debug(body) -+ -+ # Only a short error is included in the exception. -+ raise RuntimeError("%s: %d %s: %r", msg, status, reason, body[:200]) -+ - # For documentation see: - # https://github.com/oVirt/ovirt-imageio/blob/master/docs/random-io.md - # For examples of working code to read/write from the server, see: -@@ -247,16 +273,14 @@ def pread(h, count, offset): - r = http.getresponse() - # 206 = HTTP Partial Content. - if r.status != 206: -- h['transfer_service'].pause() -- h['failed'] = True -- raise RuntimeError("could not read sector (%d, %d): %d: %s" % -- (offset, count, r.status, r.reason)) -+ request_failed(h, r, -+ "could not read sector offset %d size %d" % -+ (offset, count)) - return r.read() - - def pwrite(h, buf, offset): - http = h['http'] - transfer = h['transfer'] -- transfer_service = h['transfer_service'] - - count = len(buf) - h['highestwrite'] = max(h['highestwrite'], offset+count) -@@ -274,15 +298,13 @@ def pwrite(h, buf, offset): - - r = http.getresponse() - if r.status != 200: -- transfer_service.pause() -- h['failed'] = True -- raise RuntimeError("could not write sector (%d, %d): %d: %s" % -- (offset, count, r.status, r.reason)) -+ request_failed(h, r, -+ "could not write sector offset %d size %d" % -+ (offset, count)) - - def zero(h, count, offset, may_trim): - http = h['http'] - transfer = h['transfer'] -- transfer_service = h['transfer_service'] - - # Unlike the trim and flush calls, there is no 'can_zero' method - # so nbdkit could call this even if the server doesn't support -@@ -304,10 +326,9 @@ def zero(h, count, offset, may_trim): - - r = http.getresponse() - if r.status != 200: -- transfer_service.pause() -- h['failed'] = True -- raise RuntimeError("could not zero sector (%d, %d): %d: %s" % -- (offset, count, r.status, r.reason)) -+ request_failed(h, r, -+ "could not zero sector offset %d size %d" % -+ (offset, count)) - - def emulate_zero(h, count, offset): - # qemu-img convert starts by trying to zero/trim the whole device. -@@ -332,15 +353,13 @@ def emulate_zero(h, count, offset): - - r = http.getresponse() - if r.status != 200: -- transfer_service.pause() -- h['failed'] = True -- raise RuntimeError("could not write zeroes (%d, %d): %d: %s" % -- (offset, count, r.status, r.reason)) -+ request_failed(h, r, -+ "could not write zeroes offset %d size %d" % -+ (offset, count)) - - def trim(h, count, offset): - http = h['http'] - transfer = h['transfer'] -- transfer_service = h['transfer_service'] - - # Construct the JSON request for trimming. - buf = json.dumps({'op': "trim", -@@ -355,15 +374,13 @@ def trim(h, count, offset): - - r = http.getresponse() - if r.status != 200: -- transfer_service.pause() -- h['failed'] = True -- raise RuntimeError("could not trim sector (%d, %d): %d: %s" % -- (offset, count, r.status, r.reason)) -+ request_failed(h, r, -+ "could not trim sector offset %d size %d" % -+ (offset, count)) - - def flush(h): - http = h['http'] - transfer = h['transfer'] -- transfer_service = h['transfer_service'] - - # Construct the JSON request for flushing. - buf = json.dumps({'op': "flush"}).encode() -@@ -375,9 +392,7 @@ def flush(h): - - r = http.getresponse() - if r.status != 200: -- transfer_service.pause() -- h['failed'] = True -- raise RuntimeError("could not flush: %d: %s" % (r.status, r.reason)) -+ request_failed(h, r, "could not flush") - - def delete_disk_on_failure(h): - disk_service = h['disk_service'] --- -2.20.1 - diff --git a/SOURCES/0055-v2v-Add-Disk-ovf-capacity-attribute-containing-disk-.patch b/SOURCES/0055-v2v-Add-Disk-ovf-capacity-attribute-containing-disk-.patch deleted file mode 100644 index 62a72d5..0000000 --- a/SOURCES/0055-v2v-Add-Disk-ovf-capacity-attribute-containing-disk-.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 4c82b8c137b9337a80f0658c1712f2318e631bef Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Mon, 18 Jun 2018 10:31:18 +0100 -Subject: [PATCH] v2v: Add attribute containing disk - virtual size (RHBZ#1592468). - -Virt-v2v transfers to newer versions of ovirt-engine can fail with: - - ovirtsdk4.Error: Fault reason is "Operation Failed". Fault detail is "failed to parse a given ovf configuration ovf error: [empty name]: cannot read '//*/disksection' with value: null". HTTP response code is 400. - -This was caused by a change made to oVirt: - - https://gerrit.ovirt.org/#/c/91902/ - -so that it now requires the attribute. - -Thanks: Arik Hadas -(cherry picked from commit 7c2afc88fd6aceb869a5e1c47a8183879ddec5fc) ---- - v2v/create_ovf.ml | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/v2v/create_ovf.ml b/v2v/create_ovf.ml -index ac3c61b13..e0f81e0a2 100644 ---- a/v2v/create_ovf.ml -+++ b/v2v/create_ovf.ml -@@ -835,6 +835,7 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids - | OVirt -> image_uuid - | RHVExportStorageDomain -> vol_uuid); - "ovf:size", Int64.to_string size_gb; -+ "ovf:capacity", Int64.to_string ov.ov_virtual_size; - "ovf:fileRef", fileref; - "ovf:parentRef", ""; - "ovf:vm_snapshot_id", uuidgen (); --- -2.20.1 - diff --git a/SOURCES/0056-v2v-File-ovf-size-changed-to-the-actual-size-if-know.patch b/SOURCES/0056-v2v-File-ovf-size-changed-to-the-actual-size-if-know.patch deleted file mode 100644 index 30b71d0..0000000 --- a/SOURCES/0056-v2v-File-ovf-size-changed-to-the-actual-size-if-know.patch +++ /dev/null @@ -1,41 +0,0 @@ -From b91e15593f5853a9dfabf734aabacb1cc871da07 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Mon, 18 Jun 2018 10:31:18 +0100 -Subject: [PATCH] v2v: changed to the actual size (if known). - -Note that this attribute is optional. - -Thanks: Arik Hadas -(cherry picked from commit 75e8b1386766b18aecefdc8a75fbbf85ddb52037) ---- - v2v/create_ovf.ml | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - -diff --git a/v2v/create_ovf.ml b/v2v/create_ovf.ml -index e0f81e0a2..9e0c772fd 100644 ---- a/v2v/create_ovf.ml -+++ b/v2v/create_ovf.ml -@@ -819,12 +819,17 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids - - (* Add disk to node. *) - let disk = -- e "File" [ -+ let attrs = ref [ - "ovf:href", fileref; - "ovf:id", vol_uuid; -- "ovf:size", Int64.to_string ov.ov_virtual_size; (* NB: in bytes *) - "ovf:description", generated_by; -- ] [] in -+ ] in -+ (match t.target_actual_size with -+ | None -> () -+ | Some actual_size -> -+ List.push_back attrs ("ovf:size", Int64.to_string actual_size) -+ ); -+ e "File" !attrs [] in - append_child disk references; - - (* Add disk to DiskSection. *) --- -2.20.1 - diff --git a/SOURCES/0057-p2v-Allow-virt-v2v-input-and-output-drivers-containi.patch b/SOURCES/0057-p2v-Allow-virt-v2v-input-and-output-drivers-containi.patch deleted file mode 100644 index a4618fb..0000000 --- a/SOURCES/0057-p2v-Allow-virt-v2v-input-and-output-drivers-containi.patch +++ /dev/null @@ -1,65 +0,0 @@ -From ea9feae9d8793e417c393d6c61b558bb8764698d Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 12 Jun 2018 10:22:02 +0100 -Subject: [PATCH] p2v: Allow virt-v2v input and output drivers containing '-' - (RHBZ#1590220). -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The new ‘-o rhv-upload’ output mode contains a '-' character in the -name, but the regular expression which matched the output of the -virt-v2v command did not recognize '-' as a valid character. It ended -up mapping this to just "rhv" meaning two "rhv" entries would appear -in the list of output drivers. - -Thanks: Ming Xie. -(cherry picked from commit 3886a113f231f7b38a89333491888c4d9a0c19da) ---- - p2v/ssh.c | 7 +++++-- - v2v/modules_list.ml | 11 +++++++++-- - 2 files changed, 14 insertions(+), 4 deletions(-) - -diff --git a/p2v/ssh.c b/p2v/ssh.c -index d2699fffd..15f53b692 100644 ---- a/p2v/ssh.c -+++ b/p2v/ssh.c -@@ -181,8 +181,11 @@ compile_regexps (void) - 0); - COMPILE (feature_libguestfs_rewrite_re, "libguestfs-rewrite", 0); - COMPILE (feature_colours_option_re, "colours-option", 0); -- COMPILE (feature_input_re, "input:((?:\\w)*)", 0); -- COMPILE (feature_output_re, "output:((?:\\w)*)", 0); -+ /* The input and output regexps must match the same pattern in -+ * v2v/modules_list.ml. -+ */ -+ COMPILE (feature_input_re, "input:((?:[-\\w])+)", 0); -+ COMPILE (feature_output_re, "output:((?:[-\\w])+)", 0); - COMPILE (portfwd_re, "Allocated port ((?:\\d)+) for remote forward", 0); - } - -diff --git a/v2v/modules_list.ml b/v2v/modules_list.ml -index 91b029b07..b7accc4f9 100644 ---- a/v2v/modules_list.ml -+++ b/v2v/modules_list.ml -@@ -21,8 +21,15 @@ open Std_utils - let input_modules = ref [] - and output_modules = ref [] - --let register_input_module name = List.push_front name input_modules --and register_output_module name = List.push_front name output_modules -+(* Must match the regular expressions in p2v/ssh.c *) -+let module_name_re = PCRE.compile ~anchored:true "[-\\w]+" -+ -+let register_input_module name = -+ assert (PCRE.matches module_name_re name); -+ List.push_front name input_modules -+and register_output_module name = -+ assert (PCRE.matches module_name_re name); -+ List.push_front name output_modules - - let input_modules () = List.sort compare !input_modules - and output_modules () = List.sort compare !output_modules --- -2.20.1 - diff --git a/SOURCES/0058-v2v-o-libvirt-Don-t-write-only-vendor-without-model-.patch b/SOURCES/0058-v2v-o-libvirt-Don-t-write-only-vendor-without-model-.patch deleted file mode 100644 index 1950087..0000000 --- a/SOURCES/0058-v2v-o-libvirt-Don-t-write-only-vendor-without-model-.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 70f1d97ef7b12fddceb3b16618072ad4c142da5c Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Fri, 15 Jun 2018 16:17:35 +0100 -Subject: [PATCH] v2v: -o libvirt: Don't write only without - (RHBZ#1591789). - -Avoids the libvirt error: - - error: XML error: CPU vendor specified without CPU model - -(cherry picked from commit e2910eeaf84afe63887afdc62b319bff1549d296) ---- - v2v/create_libvirt_xml.ml | 18 ++++++++++-------- - 1 file changed, 10 insertions(+), 8 deletions(-) - -diff --git a/v2v/create_libvirt_xml.ml b/v2v/create_libvirt_xml.ml -index 582419f00..fbe90eeaa 100644 ---- a/v2v/create_libvirt_xml.ml -+++ b/v2v/create_libvirt_xml.ml -@@ -51,15 +51,17 @@ let create_libvirt_xml ?pool source target_buses guestcaps - source.s_cpu_topology <> None then ( - let cpu = ref [] in - -- (match source.s_cpu_vendor with -- | None -> () -- | Some vendor -> -- List.push_back cpu (e "vendor" [] [PCData vendor]) -- ); -- (match source.s_cpu_model with -- | None -> () -- | Some model -> -+ (match source.s_cpu_vendor, source.s_cpu_model with -+ | None, None -+ (* Avoid libvirt error: "CPU vendor specified without CPU model" *) -+ | Some _, None -> () -+ | None, Some model -> - List.push_back cpu (e "model" ["fallback", "allow"] [PCData model]) -+ | Some vendor, Some model -> -+ List.push_back_list cpu [ -+ e "vendor" [] [PCData vendor]; -+ e "model" ["fallback", "allow"] [PCData model] -+ ] - ); - (match source.s_cpu_topology with - | None -> () --- -2.20.1 - diff --git a/SOURCES/0059-v2v-rvh-upload-plugin-Always-read-the-response.patch b/SOURCES/0059-v2v-rvh-upload-plugin-Always-read-the-response.patch deleted file mode 100644 index 63de496..0000000 --- a/SOURCES/0059-v2v-rvh-upload-plugin-Always-read-the-response.patch +++ /dev/null @@ -1,112 +0,0 @@ -From 320ba554d11f75c4c2753968505a1d3308b64dda Mon Sep 17 00:00:00 2001 -From: Nir Soffer -Date: Mon, 25 Jun 2018 19:22:13 +0300 -Subject: [PATCH] v2v: rvh-upload-plugin: Always read the response - -Python manual warns[1]: - - Note that you must have read the whole response before you can send - a new request to the server. - -The reason for this warning is exposed only when the server is using -keep alive connections. When the response is not read, sending a new -request will fail with: - - httplib.ResponseNotReady - -Even if Content-Length was 0 or the request has no content. The failure -looks like this when using --verbose: - -nbdkit: python[1]: debug: zero count=33554432 offset=0 may_trim=1 fua=0 -nbdkit: python[1]: debug: zero count=33554432 offset=33554432 may_trim=1 fua=0 -nbdkit: python[1]: error: /home/nsoffer/src/libguestfs/tmp/rhvupload.Au2B5I/rhv-upload-plugin.py: zero: error: Request-sent -nbdkit: python[1]: debug: sending error reply: Input/output error -qemu-img: error writing zeroes at offset 0: Input/output error - -Change all requests to read the whole response. - -Tested with imageio patch supporting keep alive connections: -https://gerrit.ovirt.org/#/c/92296/ - -[1] https://docs.python.org/3.8/library/http.client.html#http.client.HTTPConnection.getresponse - -(cherry picked from commit f4e0a8342dbeb2c779c76e1807a37b24a0c96feb) ---- - v2v/rhv-upload-plugin.py | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - -diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py -index 7c5084efd..2eec375f7 100644 ---- a/v2v/rhv-upload-plugin.py -+++ b/v2v/rhv-upload-plugin.py -@@ -197,11 +197,13 @@ def get_options(h): - http.endheaders() - - r = http.getresponse() -+ data = r.read() -+ - if r.status == 200: - # New imageio never needs authentication. - h['needs_auth'] = False - -- j = json.loads(r.read()) -+ j = json.loads(data) - h['can_zero'] = "zero" in j['features'] - h['can_trim'] = "trim" in j['features'] - h['can_flush'] = "flush" in j['features'] -@@ -276,6 +278,7 @@ def pread(h, count, offset): - request_failed(h, r, - "could not read sector offset %d size %d" % - (offset, count)) -+ - return r.read() - - def pwrite(h, buf, offset): -@@ -302,6 +305,8 @@ def pwrite(h, buf, offset): - "could not write sector offset %d size %d" % - (offset, count)) - -+ r.read() -+ - def zero(h, count, offset, may_trim): - http = h['http'] - transfer = h['transfer'] -@@ -330,6 +335,8 @@ def zero(h, count, offset, may_trim): - "could not zero sector offset %d size %d" % - (offset, count)) - -+ r.read() -+ - def emulate_zero(h, count, offset): - # qemu-img convert starts by trying to zero/trim the whole device. - # Since we've just created a new disk it's safe to ignore these -@@ -357,6 +364,8 @@ def emulate_zero(h, count, offset): - "could not write zeroes offset %d size %d" % - (offset, count)) - -+ r.read() -+ - def trim(h, count, offset): - http = h['http'] - transfer = h['transfer'] -@@ -378,6 +387,8 @@ def trim(h, count, offset): - "could not trim sector offset %d size %d" % - (offset, count)) - -+ r.read() -+ - def flush(h): - http = h['http'] - transfer = h['transfer'] -@@ -394,6 +405,8 @@ def flush(h): - if r.status != 200: - request_failed(h, r, "could not flush") - -+ r.read() -+ - def delete_disk_on_failure(h): - disk_service = h['disk_service'] - disk_service.remove() --- -2.20.1 - diff --git a/SOURCES/0060-v2v-rhv-upload-plugin-Fix-name-error.patch b/SOURCES/0060-v2v-rhv-upload-plugin-Fix-name-error.patch deleted file mode 100644 index 526a5d1..0000000 --- a/SOURCES/0060-v2v-rhv-upload-plugin-Fix-name-error.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 19d61962acdb3afa377631dc2d6658e8e73ac9ac Mon Sep 17 00:00:00 2001 -From: Nir Soffer -Date: Mon, 25 Jun 2018 20:56:52 +0300 -Subject: [PATCH] v2v: rhv-upload-plugin: Fix name error - -"http" and "transfer" variables were missing in emulate_zero, so the -code would fail with NameError. This can happen only when communicating -with old imageio versions not supporting the "zero" feature. - -Testing with qemu-img 2.12 show that we never send emulated zero request -because of the highestwrite mechanism, but it can break with older -qemu-img-rhev used on RHEL. - -(cherry picked from commit 0ae61ce99c351f9cda598016fb55ccc50313df67) ---- - v2v/rhv-upload-plugin.py | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py -index 2eec375f7..10887c031 100644 ---- a/v2v/rhv-upload-plugin.py -+++ b/v2v/rhv-upload-plugin.py -@@ -338,6 +338,9 @@ def zero(h, count, offset, may_trim): - r.read() - - def emulate_zero(h, count, offset): -+ http = h['http'] -+ transfer = h['transfer'] -+ - # qemu-img convert starts by trying to zero/trim the whole device. - # Since we've just created a new disk it's safe to ignore these - # requests as long as they are smaller than the highest write seen. --- -2.20.1 - diff --git a/SOURCES/0061-v2v-rhv-upload-plugin-Remove-unused-variables.patch b/SOURCES/0061-v2v-rhv-upload-plugin-Remove-unused-variables.patch deleted file mode 100644 index 38d4d12..0000000 --- a/SOURCES/0061-v2v-rhv-upload-plugin-Remove-unused-variables.patch +++ /dev/null @@ -1,52 +0,0 @@ -From eb3bcf3bcd791c1a9a8732dfb41514f33a1446d0 Mon Sep 17 00:00:00 2001 -From: Nir Soffer -Date: Tue, 26 Jun 2018 01:43:01 +0300 -Subject: [PATCH] v2v: rhv-upload-plugin: Remove unused variables - -Remove some instances of "transfer" and "transfer_service" that are not -used in current code. - -(cherry picked from commit 32ab53cecd78ee5c140f17e5792710698627d265) ---- - v2v/rhv-upload-plugin.py | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py -index 10887c031..5c036c46a 100644 ---- a/v2v/rhv-upload-plugin.py -+++ b/v2v/rhv-upload-plugin.py -@@ -263,7 +263,6 @@ def request_failed(h, r, msg): - def pread(h, count, offset): - http = h['http'] - transfer = h['transfer'] -- transfer_service = h['transfer_service'] - - headers = {"Range", "bytes=%d-%d" % (offset, offset+count-1)} - # Authorization is only needed for old imageio. -@@ -309,7 +308,6 @@ def pwrite(h, buf, offset): - - def zero(h, count, offset, may_trim): - http = h['http'] -- transfer = h['transfer'] - - # Unlike the trim and flush calls, there is no 'can_zero' method - # so nbdkit could call this even if the server doesn't support -@@ -371,7 +369,6 @@ def emulate_zero(h, count, offset): - - def trim(h, count, offset): - http = h['http'] -- transfer = h['transfer'] - - # Construct the JSON request for trimming. - buf = json.dumps({'op': "trim", -@@ -394,7 +391,6 @@ def trim(h, count, offset): - - def flush(h): - http = h['http'] -- transfer = h['transfer'] - - # Construct the JSON request for flushing. - buf = json.dumps({'op': "flush"}).encode() --- -2.20.1 - diff --git a/SOURCES/0062-v2v-o-rhv-upload-Always-fetch-server-options-when-op.patch b/SOURCES/0062-v2v-o-rhv-upload-Always-fetch-server-options-when-op.patch deleted file mode 100644 index 28045c3..0000000 --- a/SOURCES/0062-v2v-o-rhv-upload-Always-fetch-server-options-when-op.patch +++ /dev/null @@ -1,122 +0,0 @@ -From 376064fc32f0ccfea5c32ff5cd2fd844fc399ca6 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 19 Jun 2018 18:02:21 +0100 -Subject: [PATCH] v2v: -o rhv-upload: Always fetch server options when opening - the connection. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Previously we lazily requested the server options in the can_* -callbacks. The can_* callbacks are always called by nbdkit straight -after open, so this just adds complexity for no benefit. This change -simply makes the code always fetch the server options during the open -callback. - -This is — functionally at least — mostly just refactoring. However I -also added a useful debug message so we can see what features the -imageio server is offering. - -(cherry picked from commit a1e1f6ec887c2a7973612d2edf7066fd3194ba0b) ---- - v2v/rhv-upload-plugin.py | 63 +++++++++++++++++++--------------------- - 1 file changed, 30 insertions(+), 33 deletions(-) - -diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py -index 5c036c46a..f215eaecf 100644 ---- a/v2v/rhv-upload-plugin.py -+++ b/v2v/rhv-upload-plugin.py -@@ -165,34 +165,13 @@ def open(readonly): - context = context - ) - -- # Save everything we need to make requests in the handle. -- return { -- 'can_flush': False, -- 'can_trim': False, -- 'can_zero': False, -- 'connection': connection, -- 'disk': disk, -- 'disk_service': disk_service, -- 'failed': False, -- 'got_options': False, -- 'highestwrite': 0, -- 'http': http, -- 'needs_auth': not params['rhv_direct'], -- 'path': destination_url.path, -- 'transfer': transfer, -- 'transfer_service': transfer_service, -- } -+ # The first request is to fetch the features of the server. -+ needs_auth = not params['rhv_direct'] -+ can_flush = False -+ can_trim = False -+ can_zero = False - --# Can we issue zero, trim or flush requests? --def get_options(h): -- if h['got_options']: -- return -- h['got_options'] = True -- -- http = h['http'] -- transfer = h['transfer'] -- -- http.putrequest("OPTIONS", h['path']) -+ http.putrequest("OPTIONS", destination_url.path) - http.putheader("Authorization", transfer.signed_ticket) - http.endheaders() - -@@ -201,12 +180,12 @@ def get_options(h): - - if r.status == 200: - # New imageio never needs authentication. -- h['needs_auth'] = False -+ needs_auth = False - - j = json.loads(data) -- h['can_zero'] = "zero" in j['features'] -- h['can_trim'] = "trim" in j['features'] -- h['can_flush'] = "flush" in j['features'] -+ can_flush = "flush" in j['features'] -+ can_trim = "trim" in j['features'] -+ can_zero = "zero" in j['features'] - - # Old imageio servers returned either 405 Method Not Allowed or - # 204 No Content (with an empty body). If we see that we leave -@@ -218,12 +197,30 @@ def get_options(h): - raise RuntimeError("could not use OPTIONS request: %d: %s" % - (r.status, r.reason)) - -+ debug("imageio features: flush=%r trim=%r zero=%r" % -+ (can_flush, can_trim, can_zero)) -+ -+ # Save everything we need to make requests in the handle. -+ return { -+ 'can_flush': can_flush, -+ 'can_trim': can_trim, -+ 'can_zero': can_zero, -+ 'connection': connection, -+ 'disk': disk, -+ 'disk_service': disk_service, -+ 'failed': False, -+ 'highestwrite': 0, -+ 'http': http, -+ 'needs_auth': needs_auth, -+ 'path': destination_url.path, -+ 'transfer': transfer, -+ 'transfer_service': transfer_service, -+ } -+ - def can_trim(h): -- get_options(h) - return h['can_trim'] - - def can_flush(h): -- get_options(h) - return h['can_flush'] - - def get_size(h): --- -2.20.1 - diff --git a/SOURCES/0063-v2v-o-rhv-upload-Use-Unix-domain-socket-to-access-im.patch b/SOURCES/0063-v2v-o-rhv-upload-Use-Unix-domain-socket-to-access-im.patch deleted file mode 100644 index c834783..0000000 --- a/SOURCES/0063-v2v-o-rhv-upload-Use-Unix-domain-socket-to-access-im.patch +++ /dev/null @@ -1,141 +0,0 @@ -From c9f230d57b10e776c490b2cc92212c2a3304bd4e Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Mon, 18 Jun 2018 15:34:37 +0100 -Subject: [PATCH] v2v: -o rhv-upload: Use Unix domain socket to access imageio - (RHBZ#1588088). - -In the case where virt-v2v runs on the same server as the imageio -daemon that we are talking to, it may be possible to optimize access -using a Unix domain socket. - -This is only an optimization. If it fails or if we're not running on -the same server it will fall back to the usual HTTPS over TCP -connection. - -Thanks: Nir Soffer, Daniel Erez. -(cherry picked from commit b7a2e6270d53200d2df471c36a1fb2b46db8bbac) ---- - v2v/rhv-upload-plugin.py | 61 ++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 58 insertions(+), 3 deletions(-) - -diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py -index f215eaecf..8805e3552 100644 ---- a/v2v/rhv-upload-plugin.py -+++ b/v2v/rhv-upload-plugin.py -@@ -19,11 +19,12 @@ - import builtins - import json - import logging -+import socket - import ssl - import sys - import time - --from http.client import HTTPSConnection -+from http.client import HTTPSConnection, HTTPConnection - from urllib.parse import urlparse - - import ovirtsdk4 as sdk -@@ -56,6 +57,28 @@ def debug(s): - print(s, file=sys.stderr) - sys.stderr.flush() - -+def find_host(connection): -+ """Return the current host object or None.""" -+ try: -+ with builtins.open("/etc/vdsm/vdsm.id") as f: -+ vdsm_id = f.readline().strip() -+ except Exception as e: -+ return None -+ debug("hw_id = %r" % vdsm_id) -+ -+ hosts_service = connection.system_service().hosts_service() -+ hosts = hosts_service.list( -+ search="hw_id=%s" % vdsm_id, -+ case_sensitive=False, -+ ) -+ if len(hosts) == 0: -+ return None -+ -+ host = hosts[0] -+ debug("host.id = %r" % host.id) -+ -+ return types.Host(id = host.id) -+ - def open(readonly): - # Parse out the username from the output_conn URL. - parsed = urlparse(params['output_conn']) -@@ -121,9 +144,11 @@ def open(readonly): - transfers_service = system_service.image_transfers_service() - - # Create a new image transfer. -+ host = find_host(connection) - transfer = transfers_service.add( - types.ImageTransfer( - disk = types.Disk(id = disk.id), -+ host = host, - inactivity_timeout = 3600, - ) - ) -@@ -170,6 +195,7 @@ def open(readonly): - can_flush = False - can_trim = False - can_zero = False -+ unix_socket = None - - http.putrequest("OPTIONS", destination_url.path) - http.putheader("Authorization", transfer.signed_ticket) -@@ -186,6 +212,7 @@ def open(readonly): - can_flush = "flush" in j['features'] - can_trim = "trim" in j['features'] - can_zero = "zero" in j['features'] -+ unix_socket = j.get('unix_socket') - - # Old imageio servers returned either 405 Method Not Allowed or - # 204 No Content (with an empty body). If we see that we leave -@@ -197,8 +224,17 @@ def open(readonly): - raise RuntimeError("could not use OPTIONS request: %d: %s" % - (r.status, r.reason)) - -- debug("imageio features: flush=%r trim=%r zero=%r" % -- (can_flush, can_trim, can_zero)) -+ debug("imageio features: flush=%r trim=%r zero=%r unix_socket=%r" % -+ (can_flush, can_trim, can_zero, unix_socket)) -+ -+ # If we are connected to imageio on the local host and the -+ # transfer features a unix_socket then we can reconnect to that. -+ if host is not None and unix_socket is not None: -+ try: -+ http = UnixHTTPConnection(unix_socket) -+ debug("optimizing connection using unix socket %r" % unix_socket) -+ except: -+ pass - - # Save everything we need to make requests in the handle. - return { -@@ -463,3 +499,22 @@ def close(h): - raise - - connection.close() -+ -+# Modify http.client.HTTPConnection to work over a Unix domain socket. -+# Derived from uhttplib written by Erik van Zijst under an MIT license. -+# (https://pypi.org/project/uhttplib/) -+# Ported to Python 3 by Irit Goihman. -+ -+class UnsupportedError(Exception): -+ pass -+ -+class UnixHTTPConnection(HTTPConnection): -+ def __init__(self, path, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): -+ self.path = path -+ HTTPConnection.__init__(self, "localhost", timeout=timeout) -+ -+ def connect(self): -+ self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) -+ if self.timeout is not socket._GLOBAL_DEFAULT_TIMEOUT: -+ self.sock.settimeout(timeout) -+ self.sock.connect(self.path) --- -2.20.1 - diff --git a/SOURCES/0064-v2v-improve-os-documentation-for-rhv-upload.patch b/SOURCES/0064-v2v-improve-os-documentation-for-rhv-upload.patch deleted file mode 100644 index 09a5c32..0000000 --- a/SOURCES/0064-v2v-improve-os-documentation-for-rhv-upload.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 6c8bf7005f36665c018d9fa9b17aeea4c09397c0 Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Fri, 29 Jun 2018 12:58:33 +0200 -Subject: [PATCH] v2v: improve -os documentation for rhv-upload - -Thanks to: Ming Xie - -(cherry picked from commit 8d33ff8ba415180dee8f1f91f3b4d16d72ec094e) ---- - v2v/virt-v2v.pod | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod -index 806225be0..90443373f 100644 ---- a/v2v/virt-v2v.pod -+++ b/v2v/virt-v2v.pod -@@ -631,6 +631,9 @@ For I<-o libvirt>, this is a libvirt directory pool - For I<-o local> and I<-o qemu>, this is a directory name. The - directory must exist. - -+For I<-o rhv-upload>, this is the name of the destination Storage -+Domain. -+ - For I<-o rhv>, this can be an NFS path of the Export Storage Domain - of the form ChostE:EpathE>, eg: - --- -2.20.1 - diff --git a/SOURCES/0065-v2v-rhv-upload-plugin-Remove-unneeded-auth.patch b/SOURCES/0065-v2v-rhv-upload-plugin-Remove-unneeded-auth.patch deleted file mode 100644 index 6205374..0000000 --- a/SOURCES/0065-v2v-rhv-upload-plugin-Remove-unneeded-auth.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 2b4bacf2efa04c18a6ab576e30594a8742e45bf7 Mon Sep 17 00:00:00 2001 -From: Nir Soffer -Date: Fri, 29 Jun 2018 17:41:10 +0300 -Subject: [PATCH] v2v: rhv-upload-plugin: Remove unneeded auth - -Old imageio proxy was using Authorization header for GET and PUT -requests. Remove unneeded authorization when sending OPTIONS request. - -Remove unneeded duplicated comments about authorization for old -imageio, and replace them with a comment when we set needs_auth. - -(cherry picked from commit d5f36bacf9bb6d4d244184551792989906f60896) ---- - v2v/rhv-upload-plugin.py | 12 +++++------- - 1 file changed, 5 insertions(+), 7 deletions(-) - -diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py -index 8805e3552..f404bd758 100644 ---- a/v2v/rhv-upload-plugin.py -+++ b/v2v/rhv-upload-plugin.py -@@ -191,16 +191,17 @@ def open(readonly): - ) - - # The first request is to fetch the features of the server. -+ -+ # Authentication was needed only for GET and PUT requests when -+ # communicating with old imageio-proxy. - needs_auth = not params['rhv_direct'] -+ - can_flush = False - can_trim = False - can_zero = False - unix_socket = None - -- http.putrequest("OPTIONS", destination_url.path) -- http.putheader("Authorization", transfer.signed_ticket) -- http.endheaders() -- -+ http.request("OPTIONS", destination_url.path) - r = http.getresponse() - data = r.read() - -@@ -298,7 +299,6 @@ def pread(h, count, offset): - transfer = h['transfer'] - - headers = {"Range", "bytes=%d-%d" % (offset, offset+count-1)} -- # Authorization is only needed for old imageio. - if h['needs_auth']: - headers["Authorization"] = transfer.signed_ticket - -@@ -321,7 +321,6 @@ def pwrite(h, buf, offset): - h['highestwrite'] = max(h['highestwrite'], offset+count) - - http.putrequest("PUT", h['path'] + "?flush=n") -- # Authorization is only needed for old imageio. - if h['needs_auth']: - http.putheader("Authorization", transfer.signed_ticket) - # The oVirt server only uses the first part of the range, and the -@@ -378,7 +377,6 @@ def emulate_zero(h, count, offset): - # After that we must emulate them with writes. - if offset+count < h['highestwrite']: - http.putrequest("PUT", h['path']) -- # Authorization is only needed for old imageio. - if h['needs_auth']: - http.putheader("Authorization", transfer.signed_ticket) - http.putheader("Content-Range", --- -2.20.1 - diff --git a/SOURCES/0066-v2v-rhv-upload-plugin-Improve-error-handling.patch b/SOURCES/0066-v2v-rhv-upload-plugin-Improve-error-handling.patch deleted file mode 100644 index 01c9ec5..0000000 --- a/SOURCES/0066-v2v-rhv-upload-plugin-Improve-error-handling.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 7ed4c98bd7ee8148ce48b0fbc2af3a64de1aaae9 Mon Sep 17 00:00:00 2001 -From: Nir Soffer -Date: Sat, 30 Jun 2018 01:21:50 +0300 -Subject: [PATCH] v2v: rhv-upload-plugin: Improve error handling - -When optimizing the connection using unix socket, we handle these cases: - -- The local host is not an oVirt host (no /etc/vdsm/vdsm.id). -- The local host is an oVirt host, but is not registered with engine. -- Creating UnixHTTPConnection() fails. Unlikely and probably a bug in - the plugin, but we can recover by using the https connection. - -The current code handle these cases silently, making it harder to -understand why the unix socket optimization did no happen. Add debug -message to make this clear. - -Also comment in the error handler why we take this path instead of -failing the operation. - -(cherry picked from commit f5442d2f044b398efc992fb4d56c8d3096c781e6) ---- - v2v/rhv-upload-plugin.py | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py -index f404bd758..8e4052048 100644 ---- a/v2v/rhv-upload-plugin.py -+++ b/v2v/rhv-upload-plugin.py -@@ -63,7 +63,10 @@ def find_host(connection): - with builtins.open("/etc/vdsm/vdsm.id") as f: - vdsm_id = f.readline().strip() - except Exception as e: -+ # This is most likely not an oVirt host. -+ debug("cannot read /etc/vdsm/vdsm.id, using any host: %s" % e) - return None -+ - debug("hw_id = %r" % vdsm_id) - - hosts_service = connection.system_service().hosts_service() -@@ -72,6 +75,8 @@ def find_host(connection): - case_sensitive=False, - ) - if len(hosts) == 0: -+ # This oVirt host is not registered with engine. -+ debug("cannot find host with hw_id=%r, using any host" % vdsm_id) - return None - - host = hosts[0] -@@ -233,9 +238,12 @@ def open(readonly): - if host is not None and unix_socket is not None: - try: - http = UnixHTTPConnection(unix_socket) -+ except Exception as e: -+ # Very unlikely failure, but we can recover by using the https -+ # connection. -+ debug("cannot create unix socket connection, using https: %s" % e) -+ else: - debug("optimizing connection using unix socket %r" % unix_socket) -- except: -- pass - - # Save everything we need to make requests in the handle. - return { --- -2.20.1 - diff --git a/SOURCES/0067-v2v-rhv-upload-plugin-Optimize-only-direct-upload.patch b/SOURCES/0067-v2v-rhv-upload-plugin-Optimize-only-direct-upload.patch deleted file mode 100644 index f8655fe..0000000 --- a/SOURCES/0067-v2v-rhv-upload-plugin-Optimize-only-direct-upload.patch +++ /dev/null @@ -1,32 +0,0 @@ -From f1e11ab12c7e51f648a5efe056cf4ba9be4d9afa Mon Sep 17 00:00:00 2001 -From: Nir Soffer -Date: Sat, 30 Jun 2018 01:39:03 +0300 -Subject: [PATCH] v2v: rhv-upload-plugin: Optimize only direct upload - -The optimization to start the transfer on the local host makes sense -only when using the rhv-direct=true option. When using a proxy, let the -engine choose a host. - -(cherry picked from commit 891b5a0ec0f320acec0f06b64159eaf3dfbbfeaf) ---- - v2v/rhv-upload-plugin.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py -index 8e4052048..da309e288 100644 ---- a/v2v/rhv-upload-plugin.py -+++ b/v2v/rhv-upload-plugin.py -@@ -148,8 +148,8 @@ def open(readonly): - # Get a reference to the transfer service. - transfers_service = system_service.image_transfers_service() - -- # Create a new image transfer. -- host = find_host(connection) -+ # Create a new image transfer, using the local host is possible. -+ host = find_host(connection) if params['rhv_direct'] else None - transfer = transfers_service.add( - types.ImageTransfer( - disk = types.Disk(id = disk.id), --- -2.20.1 - diff --git a/SOURCES/0068-v2v-rhv-plugin-find-suitable-host-RHBZ-1596810-RHBZ-.patch b/SOURCES/0068-v2v-rhv-plugin-find-suitable-host-RHBZ-1596810-RHBZ-.patch deleted file mode 100644 index 5ae34a0..0000000 --- a/SOURCES/0068-v2v-rhv-plugin-find-suitable-host-RHBZ-1596810-RHBZ-.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 39b3bdb8f3a430ac585ed75fa85f51bacebdf22e Mon Sep 17 00:00:00 2001 -From: Daniel Erez -Date: Thu, 5 Jul 2018 20:23:35 +0300 -Subject: [PATCH] v2v: rhv plugin - find suitable host (RHBZ#1596810) - (RHBZ#1596851) - -For direct upload, a suitable host must be in status 'Up' -and belong to the same datacenter as the created disk. -Added these criteria to the host search query. - -(cherry picked from commit 4ed1bc5a79a77ad3a620b339f9ac2ecc8df6fd03) ---- - v2v/rhv-upload-plugin.py | 28 ++++++++++++++++++++++++---- - 1 file changed, 24 insertions(+), 4 deletions(-) - -diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py -index da309e288..931fcfaa2 100644 ---- a/v2v/rhv-upload-plugin.py -+++ b/v2v/rhv-upload-plugin.py -@@ -69,14 +69,34 @@ def find_host(connection): - - debug("hw_id = %r" % vdsm_id) - -- hosts_service = connection.system_service().hosts_service() -+ system_service = connection.system_service() -+ storage_name = params['output_storage'] -+ data_centers = system_service.data_centers_service().list( -+ search='storage=%s' % storage_name, -+ case_sensitive=False, -+ ) -+ if len(data_centers) == 0: -+ # The storage domain is not attached to a datacenter -+ # (shouldn't happen, would fail on disk creation). -+ debug("storange domain (%s) is not attached to a DC" % storage_name) -+ return None -+ -+ datacenter = data_centers[0] -+ debug("datacenter = %s" % datacenter.name) -+ -+ hosts_service = system_service.hosts_service() - hosts = hosts_service.list( -- search="hw_id=%s" % vdsm_id, -+ search="hw_id=%s and datacenter=%s and status=Up" % (vdsm_id, datacenter.name), - case_sensitive=False, - ) - if len(hosts) == 0: -- # This oVirt host is not registered with engine. -- debug("cannot find host with hw_id=%r, using any host" % vdsm_id) -+ # Couldn't find a host that's fulfilling the following criteria: -+ # - 'hw_id' equals to 'vdsm_id' -+ # - Its status is 'Up' -+ # - Belongs to the storage domain's datacenter -+ debug("cannot find a running host with hw_id=%r, " \ -+ "that belongs to datacenter '%s', " \ -+ "using any host" % (vdsm_id, datacenter.name)) - return None - - host = hosts[0] --- -2.20.1 - diff --git a/SOURCES/0069-v2v-change-QXL-ResourceType-in-OVirt-flavour-RHBZ-15.patch b/SOURCES/0069-v2v-change-QXL-ResourceType-in-OVirt-flavour-RHBZ-15.patch deleted file mode 100644 index e432b78..0000000 --- a/SOURCES/0069-v2v-change-QXL-ResourceType-in-OVirt-flavour-RHBZ-15.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 21e2f8ea59a87da9daee239cea26873b51ad2f79 Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Fri, 13 Jul 2018 13:24:07 +0200 -Subject: [PATCH] v2v: change QXL ResourceType in OVirt flavour (RHBZ#1598715) - -Due to a conflict with the IDs of the OVF standard, and the existing -implementation in ovirt-engine, the ID of QXL devices changed to a -different value. - -As a consequence, change the ResourceType of QXL devices, but only in -OVirt flavour to avoid breaking vdsm mode. - -See: https://bugzilla.redhat.com/show_bug.cgi?id=1598715#c5 -(cherry picked from commit aa9e18f6d1fd503822dfd2124b92a2c67704c4c1) ---- - v2v/create_ovf.ml | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/v2v/create_ovf.ml b/v2v/create_ovf.ml -index 9e0c772fd..5db239d66 100644 ---- a/v2v/create_ovf.ml -+++ b/v2v/create_ovf.ml -@@ -643,10 +643,14 @@ let rec create_ovf source targets guestcaps inspect - * See RHBZ#1213701 and RHBZ#1211231 for the reasoning - * behind that. - *) -+ let qxl_resourcetype = -+ match ovf_flavour with -+ | OVirt -> 32768 (* RHBZ#1598715 *) -+ | RHVExportStorageDomain -> 20 in - e "Item" [] [ - e "rasd:Caption" [] [PCData "Graphical Controller"]; - e "rasd:InstanceId" [] [PCData (uuidgen ())]; -- e "rasd:ResourceType" [] [PCData "20"]; -+ e "rasd:ResourceType" [] [PCData (string_of_int qxl_resourcetype)]; - e "Type" [] [PCData "video"]; - e "rasd:VirtualQuantity" [] [PCData "1"]; - e "rasd:Device" [] [PCData "qxl"]; --- -2.20.1 - diff --git a/SOURCES/0070-v2v-o-rhv-upload-check-for-ovirtsdk4-RHBZ-1601943.patch b/SOURCES/0070-v2v-o-rhv-upload-check-for-ovirtsdk4-RHBZ-1601943.patch deleted file mode 100644 index 8d1cf8a..0000000 --- a/SOURCES/0070-v2v-o-rhv-upload-check-for-ovirtsdk4-RHBZ-1601943.patch +++ /dev/null @@ -1,40 +0,0 @@ -From ab8aa6d4b208130ecf290698e2285055df8f5190 Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Tue, 17 Jul 2018 17:12:38 +0200 -Subject: [PATCH] v2v: -o rhv-upload: check for ovirtsdk4 (RHBZ#1601943) - -Check earlier whether the ovirtsdk4 Python can be imported correctly, -to avoid errors later on during the migration. ---- - v2v/output_rhv_upload.ml | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml -index 0152b8d5a..63fa2411a 100644 ---- a/v2v/output_rhv_upload.ml -+++ b/v2v/output_rhv_upload.ml -@@ -126,6 +126,13 @@ class output_rhv_upload output_alloc output_conn - python3 - in - -+ (* Check that the 'ovirtsdk4' Python module is available. *) -+ let error_unless_ovirtsdk4_module_available () = -+ let res = run_command [ python3; "-c"; "import ovirtsdk4" ] in -+ if res <> 0 then -+ error (f_"the Python module ‘ovirtsdk4’ could not be loaded, is it installed? See previous messages for problems.") -+ in -+ - (* Check that nbdkit is available and new enough. *) - let error_unless_nbdkit_working () = - if 0 <> Sys.command "nbdkit --version >/dev/null" then -@@ -231,6 +238,7 @@ object - - method precheck () = - error_unless_python_binary_on_path (); -+ error_unless_ovirtsdk4_module_available (); - error_unless_nbdkit_working (); - error_unless_nbdkit_python3_working (); - error_unless_output_alloc_sparse (); --- -2.20.1 - diff --git a/SOURCES/0071-v2v-rhv-plugin-fix-DC-search-string.patch b/SOURCES/0071-v2v-rhv-plugin-fix-DC-search-string.patch deleted file mode 100644 index 03f6537..0000000 --- a/SOURCES/0071-v2v-rhv-plugin-fix-DC-search-string.patch +++ /dev/null @@ -1,29 +0,0 @@ -From f28a96fadc0997687deaa01652ad80b37b08d657 Mon Sep 17 00:00:00 2001 -From: Daniel Erez -Date: Tue, 24 Jul 2018 19:16:10 +0300 -Subject: [PATCH] v2v: rhv plugin - fix DC search string - -Search for DC by 'storage.name=' to make it explicit. -I.e. "storage=" uses regex, so similar names can be -found in the search query. For example, searching for -a domain named FCSD, will find FCSD1 as well. ---- - v2v/rhv-upload-plugin.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py -index 931fcfaa2..8274f1ee1 100644 ---- a/v2v/rhv-upload-plugin.py -+++ b/v2v/rhv-upload-plugin.py -@@ -72,7 +72,7 @@ def find_host(connection): - system_service = connection.system_service() - storage_name = params['output_storage'] - data_centers = system_service.data_centers_service().list( -- search='storage=%s' % storage_name, -+ search='storage.name=%s' % storage_name, - case_sensitive=False, - ) - if len(data_centers) == 0: --- -2.20.1 - diff --git a/SOURCES/0072-v2v-rhv-plugin-case-sensitive-search-queries.patch b/SOURCES/0072-v2v-rhv-plugin-case-sensitive-search-queries.patch deleted file mode 100644 index a7691d8..0000000 --- a/SOURCES/0072-v2v-rhv-plugin-case-sensitive-search-queries.patch +++ /dev/null @@ -1,35 +0,0 @@ -From d3c135201889d1e66208126b56cc5317295f3093 Mon Sep 17 00:00:00 2001 -From: Daniel Erez -Date: Wed, 25 Jul 2018 11:24:33 +0300 -Subject: [PATCH] v2v: rhv plugin - case-sensitive search queries - -Changed both search queries to case-sensitive (to ensure an exact match). ---- - v2v/rhv-upload-plugin.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py -index 8274f1ee1..4fad27fb8 100644 ---- a/v2v/rhv-upload-plugin.py -+++ b/v2v/rhv-upload-plugin.py -@@ -73,7 +73,7 @@ def find_host(connection): - storage_name = params['output_storage'] - data_centers = system_service.data_centers_service().list( - search='storage.name=%s' % storage_name, -- case_sensitive=False, -+ case_sensitive=True, - ) - if len(data_centers) == 0: - # The storage domain is not attached to a datacenter -@@ -87,7 +87,7 @@ def find_host(connection): - hosts_service = system_service.hosts_service() - hosts = hosts_service.list( - search="hw_id=%s and datacenter=%s and status=Up" % (vdsm_id, datacenter.name), -- case_sensitive=False, -+ case_sensitive=True, - ) - if len(hosts) == 0: - # Couldn't find a host that's fulfilling the following criteria: --- -2.20.1 - diff --git a/SOURCES/0073-Revert-lvm-do-not-pass-cache-to-vgscan.patch b/SOURCES/0073-Revert-lvm-do-not-pass-cache-to-vgscan.patch deleted file mode 100644 index 3ae17f0..0000000 --- a/SOURCES/0073-Revert-lvm-do-not-pass-cache-to-vgscan.patch +++ /dev/null @@ -1,40 +0,0 @@ -From d30cda40ffce15c28e316ec86c342a60881ae30f Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Wed, 25 Jul 2018 12:39:02 +0100 -Subject: [PATCH] Revert "lvm: do not pass --cache to vgscan" - -This reverts commit 19b0ae6c6502c4833c73e1b1bfa47b43a40f21e9. ---- - daemon/lvm-filter.c | 2 +- - daemon/lvm.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/daemon/lvm-filter.c b/daemon/lvm-filter.c -index 9d877c104..c6dd35156 100644 ---- a/daemon/lvm-filter.c -+++ b/daemon/lvm-filter.c -@@ -147,7 +147,7 @@ rescan (void) - unlink (lvm_cache); - - CLEANUP_FREE char *err = NULL; -- int r = command (NULL, &err, "lvm", "vgscan", NULL); -+ int r = command (NULL, &err, "lvm", "vgscan", "--cache", NULL); - if (r == -1) { - reply_with_error ("vgscan: %s", err); - return -1; -diff --git a/daemon/lvm.c b/daemon/lvm.c -index 877bc5f6c..709a1e73b 100644 ---- a/daemon/lvm.c -+++ b/daemon/lvm.c -@@ -642,7 +642,7 @@ do_vgscan (void) - int r; - - r = command (NULL, &err, -- "lvm", "vgscan", NULL); -+ "lvm", "vgscan", "--cache", NULL); - if (r == -1) { - reply_with_error ("%s", err); - return -1; --- -2.20.1 - diff --git a/SOURCES/0074-daemon-inspect-ignore-fstab-devs-that-cannot-be-reso.patch b/SOURCES/0074-daemon-inspect-ignore-fstab-devs-that-cannot-be-reso.patch deleted file mode 100644 index 6311096..0000000 --- a/SOURCES/0074-daemon-inspect-ignore-fstab-devs-that-cannot-be-reso.patch +++ /dev/null @@ -1,46 +0,0 @@ -From adae4d57b007b99cb246c3a3e8b02189b19ce2c4 Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Fri, 27 Jul 2018 12:10:38 +0200 -Subject: [PATCH] daemon: inspect: ignore fstab devs that cannot be resolved - (RHBZ#1608131) - -If the /etc/fstab of a guest contains devices specified with UUID or -LABEL, then the new OCaml inspection code will report the findfs failure -as general failure of the inspection. OTOH, the old C inspection code -simply ignored all the devices that cannot be resolved. - -Hence, restore the old behaviour by ignoring unresolvable devices. ---- - daemon/inspect_fs_unix_fstab.ml | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -diff --git a/daemon/inspect_fs_unix_fstab.ml b/daemon/inspect_fs_unix_fstab.ml -index edb797e3f..170440d2c 100644 ---- a/daemon/inspect_fs_unix_fstab.ml -+++ b/daemon/inspect_fs_unix_fstab.ml -@@ -115,12 +115,20 @@ and check_fstab_entry md_map root_mountable os_type aug entry = - if String.is_prefix spec "UUID=" then ( - let uuid = String.sub spec 5 (String.length spec - 5) in - let uuid = shell_unquote uuid in -- Mountable.of_device (Findfs.findfs_uuid uuid) -+ (* Just ignore the device if the UUID cannot be resolved. *) -+ try -+ Mountable.of_device (Findfs.findfs_uuid uuid) -+ with -+ Failure _ -> return None - ) - else if String.is_prefix spec "LABEL=" then ( - let label = String.sub spec 6 (String.length spec - 6) in - let label = shell_unquote label in -- Mountable.of_device (Findfs.findfs_label label) -+ (* Just ignore the device if the label cannot be resolved. *) -+ try -+ Mountable.of_device (Findfs.findfs_label label) -+ with -+ Failure _ -> return None - ) - (* Resolve /dev/root to the current device. - * Do the same for the / partition of the *BSD --- -2.20.1 - diff --git a/SOURCES/0075-v2v-parse_libvirt_xml-handle-srN-CDROM-devices-RHBZ-.patch b/SOURCES/0075-v2v-parse_libvirt_xml-handle-srN-CDROM-devices-RHBZ-.patch deleted file mode 100644 index 4d35012..0000000 --- a/SOURCES/0075-v2v-parse_libvirt_xml-handle-srN-CDROM-devices-RHBZ-.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0b6ae16f01aaa1a6d5ba9f240e131c688c7224ca Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Thu, 9 Aug 2018 15:01:37 +0200 -Subject: [PATCH] v2v: parse_libvirt_xml: handle srN CDROM devices - (RHBZ#1612785) - -This device naming is mostly written by virt-p2v, so get the slot from -it directly without using the drive_index "decoding" function. ---- - v2v/parse_libvirt_xml.ml | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml -index 57e741574..4912f1cc0 100644 ---- a/v2v/parse_libvirt_xml.ml -+++ b/v2v/parse_libvirt_xml.ml -@@ -385,6 +385,16 @@ let parse_libvirt_xml ?conn xml = - let target_dev = xpath_string "target/@dev" in - match target_dev with - | None -> None -+ | Some dev when String.is_prefix dev "sr" -> -+ (* "srN" devices are found mostly in the physical XML written by -+ * virt-p2v. -+ *) -+ let name = String.sub dev 2 (String.length dev - 2) in -+ (try Some (int_of_string name) -+ with Failure _ -> -+ warning (f_"could not parse device name ‘%s’ from the source libvirt XML") dev; -+ None -+ ) - | Some dev -> - let rec loop = function - | [] -> --- -2.20.1 - diff --git a/SOURCES/0076-v2v-o-rhv-upload-Fix-error-message-disk-numbering-RH.patch b/SOURCES/0076-v2v-o-rhv-upload-Fix-error-message-disk-numbering-RH.patch deleted file mode 100644 index 581b518..0000000 --- a/SOURCES/0076-v2v-o-rhv-upload-Fix-error-message-disk-numbering-RH.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 21a58c8f5f0d4386b5a3c444883d87ccf92b15b5 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 14 Aug 2018 12:50:07 +0100 -Subject: [PATCH] v2v: -o rhv-upload: Fix error message disk numbering - (RHBZ#1615885). - -The output method used the s_disk_id field assuming it was a unique, -monotonically increasing number counting from 0. However this is not -the case, the input method simply has to set s_disk_id to be unique -for each disk. - -Fixes commit cc04573927cca97de60d544d37467e67c25867a7. - -Thanks: Xiaodai Wang ---- - v2v/output_rhv_upload.ml | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml -index 63fa2411a..7dbd98a0d 100644 ---- a/v2v/output_rhv_upload.ml -+++ b/v2v/output_rhv_upload.ml -@@ -383,13 +383,13 @@ If the messages above are not sufficient to diagnose the problem then add the - *) - let nr_disks = List.length targets in - let image_uuids = -- List.map ( -- fun t -> -+ List.mapi ( -+ fun i t -> - let id = t.target_overlay.ov_source.s_disk_id in - let diskid_file = diskid_file_of_id id in - if not (wait_for_file diskid_file finalization_timeout) then - error (f_"transfer of disk %d/%d failed, see earlier error messages") -- (id+1) nr_disks; -+ (i+1) nr_disks; - let diskid = read_whole_file diskid_file in - diskid - ) targets in --- -2.20.1 - diff --git a/SOURCES/0077-v2v-o-rhv-upload-Properly-replace-SD_UUID-in-OVF-RHB.patch b/SOURCES/0077-v2v-o-rhv-upload-Properly-replace-SD_UUID-in-OVF-RHB.patch deleted file mode 100644 index 2d0697b..0000000 --- a/SOURCES/0077-v2v-o-rhv-upload-Properly-replace-SD_UUID-in-OVF-RHB.patch +++ /dev/null @@ -1,29 +0,0 @@ -From ff223abca41eb5c491dc05a1c4e006ad65f34148 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 7 Aug 2018 09:06:46 +0100 -Subject: [PATCH] v2v: -o rhv-upload: Properly replace SD_UUID in OVF - (RHBZ#1612653). - -The @SD_UUID@ pattern was not being replaced correctly. - -Thanks: Daniel Erez. ---- - v2v/rhv-upload-createvm.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/v2v/rhv-upload-createvm.py b/v2v/rhv-upload-createvm.py -index a34627ec8..1d0e8c95d 100644 ---- a/v2v/rhv-upload-createvm.py -+++ b/v2v/rhv-upload-createvm.py -@@ -70,7 +70,7 @@ sds_service = system_service.storage_domains_service() - sd = sds_service.list(search=("name=%s" % params['output_storage']))[0] - sd_uuid = sd.id - --ovf.replace("@SD_UUID@", sd_uuid) -+ovf = ovf.replace("@SD_UUID@", sd_uuid) - - vms_service = system_service.vms_service() - vm = vms_service.add( --- -2.20.1 - diff --git a/SOURCES/0078-ppc64le-Don-t-use-cpu-parameter-under-any-circumstan.patch b/SOURCES/0078-ppc64le-Don-t-use-cpu-parameter-under-any-circumstan.patch deleted file mode 100644 index 537960c..0000000 --- a/SOURCES/0078-ppc64le-Don-t-use-cpu-parameter-under-any-circumstan.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 815c29f1f90dcd96e91ecf80954db5ff409ddb1f Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 28 Aug 2018 12:59:06 +0100 -Subject: [PATCH] ppc64le: Don't use -cpu parameter under any circumstances - (RHBZ#1605071). - ---- - lib/appliance-cpu.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/lib/appliance-cpu.c b/lib/appliance-cpu.c -index a6c1b0faf..fa1bae3f9 100644 ---- a/lib/appliance-cpu.c -+++ b/lib/appliance-cpu.c -@@ -76,6 +76,9 @@ guestfs_int_get_cpu_model (int kvm) - return "host"; - else - return "cortex-a57"; -+#elif defined(__powerpc64__) -+ /* See discussion in https://bugzilla.redhat.com/show_bug.cgi?id=1605071 */ -+ return NULL; - #else - /* On most architectures, it is faster to pass the CPU host model to - * the appliance, allowing maximum speed for things like checksums --- -2.20.1 - diff --git a/SOURCES/0079-RHEL-7-v2v-rhv-upload-Remove-restriction-on-oa-spars.patch b/SOURCES/0079-RHEL-7-v2v-rhv-upload-Remove-restriction-on-oa-spars.patch deleted file mode 100644 index 4b1b2a5..0000000 --- a/SOURCES/0079-RHEL-7-v2v-rhv-upload-Remove-restriction-on-oa-spars.patch +++ /dev/null @@ -1,82 +0,0 @@ -From aa5608a922bd35db28f555e53aea2308361991dd Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Mon, 14 May 2018 10:16:58 +0100 -Subject: [PATCH] RHEL 7: v2v: rhv-upload: Remove restriction on -oa sparse. - -See: https://bugzilla.redhat.com/show_bug.cgi?id=1565681 -and the v2v-devel private thread "Do we already support migration using FC?" ---- - v2v/output_rhv_upload.ml | 11 +---------- - v2v/rhv-upload-plugin.py | 4 +--- - v2v/virt-v2v.pod | 6 ------ - 3 files changed, 2 insertions(+), 19 deletions(-) - -diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml -index 7dbd98a0d..32c2f8f64 100644 ---- a/v2v/output_rhv_upload.ml -+++ b/v2v/output_rhv_upload.ml -@@ -176,19 +176,11 @@ See also \"OUTPUT TO RHV\" in the virt-v2v(1) manual.") - error (f_"nbdkit was compiled without SELinux support. You will have to recompile nbdkit with libselinux-devel installed, or else set SELinux to Permissive mode while doing the conversion.") - in - -- (* Output format/sparse must be raw/sparse. We may be able to -- * lift this limitation in future, but it requires changes on the -- * RHV side. See TODO file for details. XXX -- *) -+ (* Output format must be raw. *) - let error_current_limitation required_param = - error (f_"rhv-upload: currently you must use ‘%s’. This restriction will be loosened in a future version.") required_param - in - -- let error_unless_output_alloc_sparse () = -- if output_alloc <> Sparse then -- error_current_limitation "-oa sparse" -- in -- - (* JSON parameters which are invariant between disks. *) - let json_params = [ - "verbose", JSON.Bool (verbose ()); -@@ -241,7 +233,6 @@ object - error_unless_ovirtsdk4_module_available (); - error_unless_nbdkit_working (); - error_unless_nbdkit_python3_working (); -- error_unless_output_alloc_sparse (); - if have_selinux then - error_unless_nbdkit_compiled_with_selinux () - -diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py -index 4fad27fb8..41cb29992 100644 ---- a/v2v/rhv-upload-plugin.py -+++ b/v2v/rhv-upload-plugin.py -@@ -139,10 +139,8 @@ def open(readonly): - format = disk_format, - initial_size = params['disk_size'], - provisioned_size = params['disk_size'], -- # XXX Ignores params['output_sparse']. -- # Handling this properly will be complex, see: - # https://www.redhat.com/archives/libguestfs/2018-March/msg00177.html -- sparse = True, -+ sparse = params['output_sparse'], - storage_domains = [ - types.StorageDomain( - name = params['output_storage'], -diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod -index 90443373f..91f575617 100644 ---- a/v2v/virt-v2v.pod -+++ b/v2v/virt-v2v.pod -@@ -1813,12 +1813,6 @@ username is not specified then virt-v2v defaults to using - C which is the typical superuser account for oVirt - instances. - --=item I<-of raw> -- --Currently you must use I<-of raw> and you cannot use I<-oa preallocated>. -- --These restrictions will be loosened in a future version. -- - =item I<-op> F - - A file containing a password to be used when connecting to the oVirt --- -2.20.1 - diff --git a/SOURCES/0080-RHEL-7-o-rhv-upload-Use-Python-2-instead-of-Python-3.patch b/SOURCES/0080-RHEL-7-o-rhv-upload-Use-Python-2-instead-of-Python-3.patch deleted file mode 100644 index a77ebba..0000000 --- a/SOURCES/0080-RHEL-7-o-rhv-upload-Use-Python-2-instead-of-Python-3.patch +++ /dev/null @@ -1,316 +0,0 @@ -From 587edb5852a7fafffa468f952ef13efd5958bcb8 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Fri, 9 Mar 2018 12:15:44 +0000 -Subject: [PATCH] RHEL 7: -o rhv-upload: Use Python 2 instead of Python 3. - ---- - v2v/output_rhv_upload.ml | 23 +++++++++++------------ - v2v/rhv-upload-createvm.py | 20 ++++++++++++++++---- - v2v/rhv-upload-plugin.py | 35 ++++++++++++++++++++++++----------- - v2v/rhv-upload-precheck.py | 22 +++++++++++++++++----- - v2v/test-v2v-python-syntax.sh | 2 +- - 5 files changed, 69 insertions(+), 33 deletions(-) - -diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml -index 32c2f8f64..9f87244ae 100644 ---- a/v2v/output_rhv_upload.ml -+++ b/v2v/output_rhv_upload.ml -@@ -78,7 +78,6 @@ let parse_output_options options = - - { rhv_cafile; rhv_cluster; rhv_direct; rhv_verifypeer } - --let python3 = "python3" (* Defined by PEP 394 *) - let pidfile_timeout = 30 - let finalization_timeout = 5*60 - -@@ -120,15 +119,15 @@ class output_rhv_upload output_alloc output_conn - - (* Check that the Python binary is available. *) - let error_unless_python_binary_on_path () = -- try ignore (which python3) -+ try ignore (which "python") - with Executable_not_found _ -> - error (f_"no python binary called ‘%s’ can be found on the $PATH") -- python3 -+ "python" - in - - (* Check that the 'ovirtsdk4' Python module is available. *) - let error_unless_ovirtsdk4_module_available () = -- let res = run_command [ python3; "-c"; "import ovirtsdk4" ] in -+ let res = run_command [ "python"; "-c"; "import ovirtsdk4" ] in - if res <> 0 then - error (f_"the Python module ‘ovirtsdk4’ could not be loaded, is it installed? See previous messages for problems.") - in -@@ -150,14 +149,14 @@ class output_rhv_upload output_alloc output_conn - error (f_"nbdkit is not new enough, you need to upgrade to nbdkit ≥ 1.1.16") - in - -- (* Check that the python3 plugin is installed and working -+ (* Check that the python plugin is installed and working - * and can load the plugin script. - *) -- let error_unless_nbdkit_python3_working () = -+ let error_unless_nbdkit_python_working () = - let cmd = sprintf "nbdkit %s %s --dump-plugin >/dev/null" -- python3 (quote plugin) in -+ "python" (quote plugin) in - if Sys.command cmd <> 0 then -- error (f_"nbdkit Python 3 plugin is not installed or not working. It is required if you want to use ‘-o rhv-upload’. -+ error (f_"nbdkit Python plugin is not installed or not working. It is required if you want to use ‘-o rhv-upload’. - - See also \"OUTPUT TO RHV\" in the virt-v2v(1) manual.") - in -@@ -214,7 +213,7 @@ See also \"OUTPUT TO RHV\" in the virt-v2v(1) manual.") - "--newstyle"; (* use newstyle NBD protocol *) - "--exportname"; "/"; - -- "python3"; (* use the nbdkit Python 3 plugin *) -+ "python"; (* use the nbdkit Python plugin *) - plugin; (* Python plugin script *) - ] in - let args = if verbose () then args @ ["--verbose"] else args in -@@ -232,7 +231,7 @@ object - error_unless_python_binary_on_path (); - error_unless_ovirtsdk4_module_available (); - error_unless_nbdkit_working (); -- error_unless_nbdkit_python3_working (); -+ error_unless_nbdkit_python_working (); - if have_selinux then - error_unless_nbdkit_compiled_with_selinux () - -@@ -261,7 +260,7 @@ object - with_open_out - json_param_file - (fun chan -> output_string chan (JSON.string_of_doc json_params)); -- if run_command [ python3; precheck; json_param_file ] <> 0 then -+ if run_command [ "python"; precheck; json_param_file ] <> 0 then - error (f_"failed server prechecks, see earlier errors"); - - (* Create an nbdkit instance for each disk and set the -@@ -410,7 +409,7 @@ If the messages above are not sufficient to diagnose the problem then add the - - let ovf_file = tmpdir // "vm.ovf" in - with_open_out ovf_file (fun chan -> output_string chan ovf); -- if run_command [ python3; createvm; json_param_file; ovf_file ] <> 0 then -+ if run_command [ "python"; createvm; json_param_file; ovf_file ] <> 0 then - error (f_"failed to create virtual machine, see earlier errors") - - end -diff --git a/v2v/rhv-upload-createvm.py b/v2v/rhv-upload-createvm.py -index 1d0e8c95d..3f2fae4c6 100644 ---- a/v2v/rhv-upload-createvm.py -+++ b/v2v/rhv-upload-createvm.py -@@ -1,5 +1,6 @@ - # -*- python -*- --# oVirt or RHV upload create VM used by ‘virt-v2v -o rhv-upload’ -+# coding: utf-8 -+# oVirt or RHV upload create VM used by 'virt-v2v -o rhv-upload' - # Copyright (C) 2018 Red Hat Inc. - # - # This program is free software; you can redistribute it and/or modify -@@ -21,8 +22,8 @@ import logging - import sys - import time - --from http.client import HTTPSConnection --from urllib.parse import urlparse -+from httplib import HTTPSConnection -+from urlparse import urlparse - - import ovirtsdk4 as sdk - import ovirtsdk4.types as types -@@ -37,8 +38,19 @@ if len(sys.argv) != 3: - raise RuntimeError("incorrect number of parameters") - - # Parameters are passed in via a JSON document. -+# https://stackoverflow.com/a/13105359 -+def byteify(input): -+ if isinstance(input, dict): -+ return {byteify(key): byteify(value) -+ for key, value in input.iteritems()} -+ elif isinstance(input, list): -+ return [byteify(element) for element in input] -+ elif isinstance(input, unicode): -+ return input.encode('utf-8') -+ else: -+ return input - with open(sys.argv[1], 'r') as fp: -- params = json.load(fp) -+ params = byteify(json.load(fp)) - - # What is passed in is a password file, read the actual password. - with open(params['output_password'], 'r') as fp: -diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py -index 41cb29992..3d4ed1270 100644 ---- a/v2v/rhv-upload-plugin.py -+++ b/v2v/rhv-upload-plugin.py -@@ -1,5 +1,6 @@ - # -*- python -*- --# oVirt or RHV upload nbdkit plugin used by ‘virt-v2v -o rhv-upload’ -+# coding: utf-8 -+# oVirt or RHV upload nbdkit plugin used by 'virt-v2v -o rhv-upload' - # Copyright (C) 2018 Red Hat Inc. - # - # This program is free software; you can redistribute it and/or modify -@@ -16,7 +17,7 @@ - # with this program; if not, write to the Free Software Foundation, Inc., - # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - --import builtins -+from __builtin__ import open as builtin_open - import json - import logging - import socket -@@ -24,8 +25,8 @@ import ssl - import sys - import time - --from http.client import HTTPSConnection, HTTPConnection --from urllib.parse import urlparse -+from httplib import HTTPSConnection, HTTPConnection -+from urlparse import urlparse - - import ovirtsdk4 as sdk - import ovirtsdk4.types as types -@@ -37,14 +38,25 @@ timeout = 5*60 - # Parameters are passed in via a JSON doc from the OCaml code. - # Because this Python code ships embedded inside virt-v2v there - # is no formal API here. -+# https://stackoverflow.com/a/13105359 -+def byteify(input): -+ if isinstance(input, dict): -+ return {byteify(key): byteify(value) -+ for key, value in input.iteritems()} -+ elif isinstance(input, list): -+ return [byteify(element) for element in input] -+ elif isinstance(input, unicode): -+ return input.encode('utf-8') -+ else: -+ return input - params = None - - def config(key, value): - global params - - if key == "params": -- with builtins.open(value, 'r') as fp: -- params = json.load(fp) -+ with builtin_open(value, 'r') as fp: -+ params = byteify(json.load(fp)) - else: - raise RuntimeError("unknown configuration key '%s'" % key) - -@@ -54,13 +66,14 @@ def config_complete(): - - def debug(s): - if params['verbose']: -- print(s, file=sys.stderr) -+ sys.stderr.write(s) -+ sys.stderr.write("\n") - sys.stderr.flush() - - def find_host(connection): - """Return the current host object or None.""" - try: -- with builtins.open("/etc/vdsm/vdsm.id") as f: -+ with builtin_open("/etc/vdsm/vdsm.id") as f: - vdsm_id = f.readline().strip() - except Exception as e: - # This is most likely not an oVirt host. -@@ -110,7 +123,7 @@ def open(readonly): - username = parsed.username or "admin@internal" - - # Read the password from file. -- with builtins.open(params['output_password'], 'r') as fp: -+ with builtin_open(params['output_password'], 'r') as fp: - password = fp.read() - password = password.rstrip() - -@@ -232,7 +245,7 @@ def open(readonly): - # New imageio never needs authentication. - needs_auth = False - -- j = json.loads(data) -+ j = byteify(json.loads(data)) - can_flush = "flush" in j['features'] - can_trim = "trim" in j['features'] - can_zero = "zero" in j['features'] -@@ -514,7 +527,7 @@ def close(h): - pass - - # Write the disk ID file. Only do this on successful completion. -- with builtins.open(params['diskid_file'], 'w') as fp: -+ with builtin_open(params['diskid_file'], 'w') as fp: - fp.write(disk.id) - - except: -diff --git a/v2v/rhv-upload-precheck.py b/v2v/rhv-upload-precheck.py -index 2798a29dd..5b650899f 100644 ---- a/v2v/rhv-upload-precheck.py -+++ b/v2v/rhv-upload-precheck.py -@@ -1,5 +1,6 @@ - # -*- python -*- --# oVirt or RHV pre-upload checks used by ‘virt-v2v -o rhv-upload’ -+# coding: utf-8 -+# oVirt or RHV pre-upload checks used by 'virt-v2v -o rhv-upload' - # Copyright (C) 2018 Red Hat Inc. - # - # This program is free software; you can redistribute it and/or modify -@@ -21,8 +22,8 @@ import logging - import sys - import time - --from http.client import HTTPSConnection --from urllib.parse import urlparse -+from httplib import HTTPSConnection -+from urlparse import urlparse - - import ovirtsdk4 as sdk - import ovirtsdk4.types as types -@@ -36,8 +37,19 @@ if len(sys.argv) != 2: - raise RuntimeError("incorrect number of parameters") - - # Parameters are passed in via a JSON document. -+# https://stackoverflow.com/a/13105359 -+def byteify(input): -+ if isinstance(input, dict): -+ return {byteify(key): byteify(value) -+ for key, value in input.iteritems()} -+ elif isinstance(input, list): -+ return [byteify(element) for element in input] -+ elif isinstance(input, unicode): -+ return input.encode('utf-8') -+ else: -+ return input - with open(sys.argv[1], 'r') as fp: -- params = json.load(fp) -+ params = byteify(json.load(fp)) - - # What is passed in is a password file, read the actual password. - with open(params['output_password'], 'r') as fp: -@@ -67,7 +79,7 @@ vms = vms_service.list( - ) - if len(vms) > 0: - vm = vms[0] -- raise RuntimeError("VM already exists with name ‘%s’, id ‘%s’" % -+ raise RuntimeError("VM already exists with name '%s', id '%s'" % - (params['output_name'], vm.id)) - - # Otherwise everything is OK, exit with no error. -diff --git a/v2v/test-v2v-python-syntax.sh b/v2v/test-v2v-python-syntax.sh -index b167f4610..8d5924e3c 100755 ---- a/v2v/test-v2v-python-syntax.sh -+++ b/v2v/test-v2v-python-syntax.sh -@@ -25,7 +25,7 @@ skip_if_skipped - files="rhv-upload-createvm.py rhv-upload-plugin.py rhv-upload-precheck.py" - - # Base version of Python. --python=python3 -+python=python - - # Checks the files are syntactically correct, but not very much else. - for f in $files; do --- -2.20.1 - diff --git a/SOURCES/0081-RHEL-7-v2v-rhv-upload-Disable-Nagle-algorithm.patch b/SOURCES/0081-RHEL-7-v2v-rhv-upload-Disable-Nagle-algorithm.patch deleted file mode 100644 index ac5e083..0000000 --- a/SOURCES/0081-RHEL-7-v2v-rhv-upload-Disable-Nagle-algorithm.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 61ae7a5e6deaac5cb9d9776829ea92ac0ebcc5f8 Mon Sep 17 00:00:00 2001 -From: Nir Soffer -Date: Fri, 15 Jun 2018 22:57:32 +0300 -Subject: [PATCH] RHEL 7: v2v: rhv-upload: Disable Nagle algorithm - -When sending a PUT request, the http header may be sent in the first -packet when calling con.endheaders(). When we send the first chunk, the -kernel may delay the send because the header packet was not acked yet. - -We have seen PUT requests delayed by 40 milliseconds on the server side -during virt-v2v upload to ovirt. Here is example log from current RHEL -virt-v2v version, uploading to RHV 4.2.3: - -2018-06-12 17:04:01,750 INFO (Thread-2) [images] Writing 52736 bytes -at offset 0 flush False to /path/to/image for ticket -374bec27-930d-4097-8e41-e4bc23324eb0 - -2018-06-12 17:04:01,790 INFO (Thread-2) [directio] Operation stats: - - -The server spent 40 milliseconds reading 52736 bytes form -rhv_upload_plugin running on the same host. - -This issue was fixed in python 3.5 by using the TCP_NO_DELAY option -after connecting[1]. I backported this change from python 3.5. - -I tested the same change using imageio example upload script. With this -change and with optimized PATCH requests, upload time of 4G sparse image -was reduced from 7 minutes to 1 minute. - -See this ovirt patch for more details: -https://gerrit.ovirt.org/#/c/92276/ - -This change is needed only for python 2. - -[1] https://bugs.python.org/issue23302 ---- - v2v/rhv-upload-plugin.py | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) - -diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py -index 3d4ed1270..b262fb3d6 100644 ---- a/v2v/rhv-upload-plugin.py -+++ b/v2v/rhv-upload-plugin.py -@@ -25,7 +25,7 @@ import ssl - import sys - import time - --from httplib import HTTPSConnection, HTTPConnection -+from httplib import HTTPSConnection as _HTTPSConnection, HTTPConnection - from urlparse import urlparse - - import ovirtsdk4 as sdk -@@ -51,6 +51,18 @@ def byteify(input): - return input - params = None - -+class HTTPSConnection(_HTTPSConnection): -+ def connect(self): -+ """ -+ Using TCP_NO_DELAY avoids delays when sending small payload, such as -+ ovirt PATCH requests. -+ -+ This issue was fixed in python 3.5, see: -+ https://bugs.python.org/issue23302 -+ """ -+ _HTTPSConnection.connect(self) -+ self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) -+ - def config(key, value): - global params - --- -2.20.1 - diff --git a/SOURCES/0082-RHEL-7-p2v-ignore-rhv-upload-driver-RHBZ-1590220.patch b/SOURCES/0082-RHEL-7-p2v-ignore-rhv-upload-driver-RHBZ-1590220.patch deleted file mode 100644 index 8a45f8b..0000000 --- a/SOURCES/0082-RHEL-7-p2v-ignore-rhv-upload-driver-RHBZ-1590220.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 66fa28613d7574cb2883478c541ed05e0f452058 Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Thu, 19 Jul 2018 13:30:17 +0200 -Subject: [PATCH] RHEL 7: p2v: ignore 'rhv-upload' driver (RHBZ#1590220) - -The 'rhv-upload' output mode requires few options, and virt-p2v does not -have the GUI bits for specifying them. ---- - p2v/ssh.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/p2v/ssh.c b/p2v/ssh.c -index 15f53b692..654121a22 100644 ---- a/p2v/ssh.c -+++ b/p2v/ssh.c -@@ -1021,8 +1021,12 @@ add_input_driver (const char *name, size_t len) - static void - add_output_driver (const char *name, size_t len) - { -- /* Ignore the 'vdsm' driver, since that should only be used by VDSM. */ -- if (len != 4 || memcmp (name, "vdsm", 4) != 0) -+ /* Ignore the 'vdsm' driver, since that should only be used by VDSM. -+ * Ignore the 'rhv-upload' driver, since we do not support passing all the -+ * options for it. -+ */ -+ if ((len != 4 || memcmp (name, "vdsm", 4) != 0) && -+ (len != 10 || memcmp (name, "rhv-upload", 10) != 0)) - add_option ("output", &output_drivers, name, len); - } - --- -2.20.1 - diff --git a/SOURCES/0083-v2v-docs-Describe-support-for-SHA-2-certs-for-Window.patch b/SOURCES/0083-v2v-docs-Describe-support-for-SHA-2-certs-for-Window.patch deleted file mode 100644 index 2b9802b..0000000 --- a/SOURCES/0083-v2v-docs-Describe-support-for-SHA-2-certs-for-Window.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 5731e864c4f6ae58f48972b7c1771e9eefc57bf2 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Mon, 3 Sep 2018 14:30:21 +0100 -Subject: [PATCH] v2v: docs: Describe support for SHA-2 certs for Windows 7 / - 2008 R2 (RHBZ#1624878). - -Thanks: Yan Vugenfirer. -(cherry picked from commit 741ef228cd8d17bd1a8a60a2cfa83c3937120ede) ---- - v2v/virt-v2v.pod | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod -index 91f575617..457effa50 100644 ---- a/v2v/virt-v2v.pod -+++ b/v2v/virt-v2v.pod -@@ -946,6 +946,20 @@ This can also prevent booting with a 7B error [see previous section] - if the guest has group policy containing - C. - -+=head2 Support for SHA-2 certificates in Windows 7 and Windows Server 2008 R2 -+ -+Later versions of the Windows virtio drivers are signed using SHA-2 -+certificates (instead of SHA-1). The original shipping Windows 7 and -+Windows Server 2008 R2 did not understand SHA-2 certificates and so -+the Windows virtio drivers will not install properly. -+ -+To fix this you must apply SHA-2 Code Signing Support from: -+L -+before converting the guest. -+ -+For further information see: -+L -+ - =head1 UEFI - - VMware allows you to present UEFI firmware to guests (instead of the --- -2.20.1 - diff --git a/SOURCES/0084-v2v-windows-Fix-rhev-apt-command-line-RHBZ-1624902.patch b/SOURCES/0084-v2v-windows-Fix-rhev-apt-command-line-RHBZ-1624902.patch deleted file mode 100644 index 6de787c..0000000 --- a/SOURCES/0084-v2v-windows-Fix-rhev-apt-command-line-RHBZ-1624902.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 7c19232808d8c86835ec1b37276c4ae62739c9ac Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Mon, 3 Sep 2018 15:24:05 +0100 -Subject: [PATCH] v2v: windows: Fix rhev-apt command line (RHBZ#1624902). - -See: -https://bugzilla.redhat.com/show_bug.cgi?id=1584678#c15 - -Fixes commit bcdbe6405c10ecb7374ae47eee6385be17dbd49e. However this -bug was copied directly from old virt-v2v which did the same thing -(from lib/Sys/VirtConvert/Converter/Windows.pm): - - echo installing rhev-apt >>log.txt - "rhev-apt.exe" /S /v /qn >>log.txt - -Thanks: Lev Veyde -(cherry picked from commit e12c56176abcc2d970a35f83bffc95f7ad1b2aab) ---- - v2v/convert_windows.ml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml -index 163319545..4f0a08248 100644 ---- a/v2v/convert_windows.ml -+++ b/v2v/convert_windows.ml -@@ -340,7 +340,7 @@ echo Wait for PnP to complete - @echo off - - echo installing rhev-apt --\"\\rhev-apt.exe\" /S /v /qn -+\"\\rhev-apt.exe\" /S /v/qn - - echo starting rhev-apt - net start rhev-apt --- -2.20.1 - diff --git a/SOURCES/0085-inspect-fix-inspection-of-partition-less-devices-RHB.patch b/SOURCES/0085-inspect-fix-inspection-of-partition-less-devices-RHB.patch deleted file mode 100644 index f3f8c3a..0000000 --- a/SOURCES/0085-inspect-fix-inspection-of-partition-less-devices-RHB.patch +++ /dev/null @@ -1,52 +0,0 @@ -From e360577d64cd598d61d4d8696333ce1e1ca3bf17 Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Mon, 14 Jan 2019 17:07:45 +0100 -Subject: [PATCH] inspect: fix inspection of partition-less devices - (RHBZ#1661038) - -When parsing "xdev"-kind devices, do not assume that the partition -number can be converted to integer: re_xdev accepts an empty part of the -partition number, so just handle as it is, as string. - -This fixes a regression due to the conversion of the inspection code to -OCaml, as the old C version did not have this issue. - -(cherry picked from commit cf6b527824b2a8dc6e8bc65e38ebdceb227e6db1) ---- - daemon/inspect_fs_unix_fstab.ml | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/daemon/inspect_fs_unix_fstab.ml b/daemon/inspect_fs_unix_fstab.ml -index 170440d2c..3428ad75c 100644 ---- a/daemon/inspect_fs_unix_fstab.ml -+++ b/daemon/inspect_fs_unix_fstab.ml -@@ -347,7 +347,7 @@ and resolve_fstab_device spec md_map os_type = - debug_matching "xdev"; - let typ = PCRE.sub 1 - and disk = PCRE.sub 2 -- and part = int_of_string (PCRE.sub 3) in -+ and part = PCRE.sub 3 in - resolve_xdev typ disk part default - ) - -@@ -464,7 +464,7 @@ and resolve_fstab_device spec md_map os_type = - debug_matching "Hurd"; - let typ = PCRE.sub 1 - and disk = int_of_string (PCRE.sub 2) -- and part = int_of_string (PCRE.sub 3) in -+ and part = PCRE.sub 3 in - - (* Hurd disk devices are like /dev/hdNsM, where hdN is the - * N-th disk and M is the M-th partition on that disk. -@@ -501,7 +501,7 @@ and resolve_xdev typ disk part default = - let i = drive_index disk in - if i >= 0 && i < Array.length devices then ( - let dev = Array.get devices i in -- let dev = dev ^ string_of_int part in -+ let dev = dev ^ part in - if is_partition dev then - Mountable.of_device dev - else --- -2.20.1 - diff --git a/SOURCES/copy-patches.sh b/SOURCES/copy-patches.sh index 320561d..3ae6d62 100755 --- a/SOURCES/copy-patches.sh +++ b/SOURCES/copy-patches.sh @@ -6,7 +6,7 @@ set -e # directory. Use it like this: # ./copy-patches.sh -rhel_version=7.6 +rhel_version=7.7 # Check we're in the right directory. if [ ! -f libguestfs.spec ]; then diff --git a/SOURCES/libguestfs-1.38.2.tar.gz.sig b/SOURCES/libguestfs-1.38.2.tar.gz.sig deleted file mode 100644 index e0286f8..0000000 --- a/SOURCES/libguestfs-1.38.2.tar.gz.sig +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN PGP SIGNATURE----- - -iQIcBAABAgAGBQJa/CJEAAoJEJFzj3Pht2igY10QAK2BLfAYb2CUntgIKlxWYbXd -5/gF6EvyH7l8/jD2sGcokPVY/8xYYEtu4HifbsW6QJttFTureujAFcaDb4KhL1Z2 -yLcu4HhqWWC5pO6LJUY7pUF+3ZaAPyHr3fUhniqA8VTwrn0rKRh9HVNPEa2IHZG+ -rE0MGMSPk/HKN6f3JDXE7BSSYaEaMNPWuaVW5KxLAEjCN5bl4lbjs1HJe6BGnNaG -TXRa8p+Dehpgp8g3qagtSKJQKTiq2kVkxLIj5mABeEVAbht3grfKlacaOIFq609s -rB/u0Z6fHEweCS1jpcR7CY3hQm2lHqCDfBWhR88ucvk0n3KACwfV2NixyqDc2J9V -R7OWUu5HxAKWd1J6N8SqODBHQcUhoBUOfMHN2dzd00OptgTI/yuyBw5oEWLJ8DP/ -3s8AWywyWT2LsZp4IavLqqRvF1Glm72N65k4iUVXngNVjSOtGZH8Eh/rYt+1PWKb -UZ6LhKOSRq4XsU8/E8168y2vXr77JHzqt9XX7B6sbV92OUDOxVOYtp7NfwhUx+VC -qCM5YEVqdT2Lf146LpC0Ng2Mhw9pYT3Vl5GL4lFzBeMn4J1T+LjRJDhZsVc3hjly -ChkCVURdI+xQMWbaUOyeelUf6V9WZvW9+hb9K3oDsGbs6KVyTciZWpM97nNz42dQ -x/rjwIVwRuoRWfwK+RCS -=5XhU ------END PGP SIGNATURE----- diff --git a/SOURCES/libguestfs-1.40.2.tar.gz.sig b/SOURCES/libguestfs-1.40.2.tar.gz.sig new file mode 100644 index 0000000..016e22b --- /dev/null +++ b/SOURCES/libguestfs-1.40.2.tar.gz.sig @@ -0,0 +1,17 @@ +-----BEGIN PGP SIGNATURE----- + +iQJFBAABCAAvFiEE93dPsa0HSn6Mh2fqkXOPc+G3aKAFAlxdivwRHHJpY2hAYW5u +ZXhpYS5vcmcACgkQkXOPc+G3aKC8SRAAotTR3nvV2lUeABLn8uiv5CjmeEEm++C4 +754zGkOb7bRSQzcQ12XC0e4WQwcS/fHHSRhT2ABc1VeLn8ehyEEQ3T3NfDpnpaKR +NYolsI3l8iae4QI0wo85/Wb/k7pXg1uWFZ9t286d1e/NYudMEZ6hiVXsUNlSu0lR +rU5Xr/XGDV01Vlalo1qcVI1p3b3zBFGcNLv5Myc0+Q+RWVYcyrm270VJYmD0OOnh +zzRgb1fBW4rVIbYEhmmhNgbL3758Qaef/jsTxU/tH83LOdJUpxWYvLD7ec3DzsHr +xcNgDCZxCtn4ObdfxJGzVbWO96nmVPxNnVMeDol+PDsrVkQnpSPMPrU/oth5Xh19 ++JeP22SSDahCIbO9YlL3AoA3l1gpLq2f9yTz9JIHm4ytBZmQPD8QU2KBQFsz+/ZE +Gulc0j/3mzlRyoesuVGb79OWBfSDCHittKVFPXqokzNu0jWZVd7GxfJ2DQqUprJd +eK4LDJpInS+Vdohjko8uuC9AfGB68hWbuazjdWLhTNQb3/8EzX5Xu2N88xlWuBQK +HRu8NPp601uI6qdjj38VUXGY5BryDIJdvqf5hoRNe/2scf3OomaMpdck59gLT4LB +/yaNbfPSRenXQ1IM3mU9Opktvm48cpJQ8B80OEmWenhhjXrHrgplVNkXK7inZ7vu +TKia/N90ugY= +=kgC8 +-----END PGP SIGNATURE----- diff --git a/SPECS/libguestfs.spec b/SPECS/libguestfs.spec index 0db8fb2..ee5fa78 100644 --- a/SPECS/libguestfs.spec +++ b/SPECS/libguestfs.spec @@ -20,111 +20,59 @@ Summary: Access and modify virtual machine disk images Name: libguestfs Epoch: 1 -Version: 1.38.2 -Release: 12%{?dist}.2 +Version: 1.40.2 +Release: 5%{?dist} License: LGPLv2+ # Source and patches. URL: http://libguestfs.org/ -Source0: http://libguestfs.org/download/1.38-stable/%{name}-%{version}.tar.gz +Source0: http://libguestfs.org/download/1.40-stable/%{name}-%{version}.tar.gz %if 0%{verify_tarball_signature} -Source1: http://libguestfs.org/download/1.38-stable/%{name}-%{version}.tar.gz.sig +Source1: http://libguestfs.org/download/1.40-stable/%{name}-%{version}.tar.gz.sig %endif ExclusiveArch: x86_64 %{power64} aarch64 s390x # RHEL 7 git repository is: -# https://github.com/libguestfs/libguestfs/tree/rhel-7.6 +# https://github.com/libguestfs/libguestfs/tree/rhel-7.7 # Use 'copy-patches.sh' to copy the patches from the git repo # to the current directory. # Patches. -Patch0001: 0001-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch -Patch0002: 0002-RHEL-7-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch -Patch0003: 0003-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch -Patch0004: 0004-RHEL-7-Remove-User-Mode-Linux-RHBZ-1144197.patch -Patch0005: 0005-RHEL-7-v2v-Select-correct-qemu-binary-for-o-qemu-mod.patch -Patch0006: 0006-RHEL-7-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch -Patch0007: 0007-RHEL-7-move-VIRTIO_DEVICE_NAME-macro-to-guestfs-inte.patch -Patch0008: 0008-RHEL-7-Revert-tests-rsync-Skip-this-test-when-the-ba.patch -Patch0009: 0009-RHEL-7-Revert-appliance-Change-example-ping-lines-to.patch -Patch0010: 0010-RHEL-7-Revert-launch-libvirt-Use-qemu-bridge-helper-.patch -Patch0011: 0011-RHEL-7-Revert-launch-libvirt-Better-error-when-bridg.patch -Patch0012: 0012-RHEL-7-Revert-appliance-add-dhcp-client-on-Mageia.patch -Patch0013: 0013-RHEL-7-Revert-appliance-add-dhcpcd-and-gptfdisk-on-A.patch -Patch0014: 0014-RHEL-7-Revert-appliance-Use-dhclient-or-dhcpcd-inste.patch -Patch0015: 0015-RHEL-7-Disable-alternate-Augeas-lenses.patch -Patch0016: 0016-RHEL-7-Fix-list-of-supported-sound-cards-to-match-RH.patch -Patch0017: 0017-RHEL-7-v2v-efi-Remove-references-to-Fedora-kraxel-s-.patch -Patch0018: 0018-RHEL-7-Reject-use-of-libguestfs-winsupport-features-.patch -Patch0019: 0019-RHEL-7-daemon-umount-all-Hack-to-avoid-umount-sysroo.patch -Patch0020: 0020-RHEL-7-Fix-tests-for-libguestfs-winsupport-7.2.patch -Patch0021: 0021-RHEL-7-Revert-v2v-Add-a-support-matrix-to-the-manual.patch -Patch0022: 0022-RHEL-7-All-qemu-kvm-in-RHEL-7-supports-discard-of-qc.patch -Patch0023: 0023-RHEL-7-tests-Disable-daemon-tests-that-require-the-u.patch -Patch0024: 0024-RHEL-7-v2v-Disable-the-virt-v2v-in-place-option.patch -Patch0025: 0025-RHEL-7-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch -Patch0026: 0026-RHEL-7-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-143020.patch -Patch0027: 0027-RHEL-7-v2v-disable-unconfig-of-manually-installed-VM.patch -Patch0028: 0028-v2v-Use-Std_utils.qemu_input_filename-instead-of-pre.patch -Patch0029: 0029-v2v-o-null-support-older-qemu-img-RHBZ-1580309.patch -Patch0030: 0030-v2v-ovf-Create-OVF-more-aligned-with-the-standard.patch -Patch0031: 0031-v2v-vdsm-add-vdsm-fixed-ovf-option.patch -Patch0032: 0032-v2v-OVF-Code-formatting.patch -Patch0033: 0033-v2v-DOM-Add-doc_to_string-function.patch -Patch0034: 0034-v2v-Add-op-output-password-file-option.patch -Patch0035: 0035-v2v-cmdline-Move-definition-to-before-its-only-use.patch -Patch0036: 0036-v2v-Add-general-mechanism-for-input-and-output-optio.patch -Patch0037: 0037-v2v-OVF-write-ovirt-id-attribute-for-the-OS-in-OVirt.patch -Patch0038: 0038-v2v-OVF-fix-ovf-id-for-VirtualSystem-in-OVirt-flavou.patch -Patch0039: 0039-v2v-Add-o-rhv-upload-output-mode-RHBZ-1557273.patch -Patch0040: 0040-v2v-refer-to-the-right-embed-script-in-EXTRA_DIST.patch -Patch0041: 0041-v2v-o-rhv-upload-Don-t-require-of-raw-parameter.patch -Patch0042: 0042-v2v-o-rhv-upload-install-RHV-tools-RHBZ-1561828.patch -Patch0043: 0043-v2v-Map-Windows-Server-2012-R2-x86-64-to-ovirt-ID-25.patch -Patch0044: 0044-v2v-fix-build-rules-for-output_rhv_upload_-_source.m.patch -Patch0045: 0045-v2v-fix-rhevexp-typo-in-documentation.patch -Patch0046: 0046-v2v-add-and-use-Create_ovf.ovf_flavour_to_string.patch -Patch0047: 0047-daemon-Move-lvmetad-to-early-in-the-appliance-boot-p.patch -Patch0048: 0048-v2v-o-rhv-upload-Set-inactivity-timeout-RHBZ-1586198.patch -Patch0049: 0049-v2v-linux-fix-kernel-detection-when-split-in-differe.patch -Patch0050: 0050-New-API-inspect_get_osinfo.patch -Patch0051: 0051-inspector-show-the-per-OS-osinfo-guess-RHBZ-1544842.patch -Patch0052: 0052-lib-libvirt-Convert-all-socket-parameters-to-an-abso.patch -Patch0053: 0053-v2v-o-rhv-upload-Optimize-http-request-sending.patch -Patch0054: 0054-v2v-o-rhv-upload-Log-full-imageio-response-on-failur.patch -Patch0055: 0055-v2v-Add-Disk-ovf-capacity-attribute-containing-disk-.patch -Patch0056: 0056-v2v-File-ovf-size-changed-to-the-actual-size-if-know.patch -Patch0057: 0057-p2v-Allow-virt-v2v-input-and-output-drivers-containi.patch -Patch0058: 0058-v2v-o-libvirt-Don-t-write-only-vendor-without-model-.patch -Patch0059: 0059-v2v-rvh-upload-plugin-Always-read-the-response.patch -Patch0060: 0060-v2v-rhv-upload-plugin-Fix-name-error.patch -Patch0061: 0061-v2v-rhv-upload-plugin-Remove-unused-variables.patch -Patch0062: 0062-v2v-o-rhv-upload-Always-fetch-server-options-when-op.patch -Patch0063: 0063-v2v-o-rhv-upload-Use-Unix-domain-socket-to-access-im.patch -Patch0064: 0064-v2v-improve-os-documentation-for-rhv-upload.patch -Patch0065: 0065-v2v-rhv-upload-plugin-Remove-unneeded-auth.patch -Patch0066: 0066-v2v-rhv-upload-plugin-Improve-error-handling.patch -Patch0067: 0067-v2v-rhv-upload-plugin-Optimize-only-direct-upload.patch -Patch0068: 0068-v2v-rhv-plugin-find-suitable-host-RHBZ-1596810-RHBZ-.patch -Patch0069: 0069-v2v-change-QXL-ResourceType-in-OVirt-flavour-RHBZ-15.patch -Patch0070: 0070-v2v-o-rhv-upload-check-for-ovirtsdk4-RHBZ-1601943.patch -Patch0071: 0071-v2v-rhv-plugin-fix-DC-search-string.patch -Patch0072: 0072-v2v-rhv-plugin-case-sensitive-search-queries.patch -Patch0073: 0073-Revert-lvm-do-not-pass-cache-to-vgscan.patch -Patch0074: 0074-daemon-inspect-ignore-fstab-devs-that-cannot-be-reso.patch -Patch0075: 0075-v2v-parse_libvirt_xml-handle-srN-CDROM-devices-RHBZ-.patch -Patch0076: 0076-v2v-o-rhv-upload-Fix-error-message-disk-numbering-RH.patch -Patch0077: 0077-v2v-o-rhv-upload-Properly-replace-SD_UUID-in-OVF-RHB.patch -Patch0078: 0078-ppc64le-Don-t-use-cpu-parameter-under-any-circumstan.patch -Patch0079: 0079-RHEL-7-v2v-rhv-upload-Remove-restriction-on-oa-spars.patch -Patch0080: 0080-RHEL-7-o-rhv-upload-Use-Python-2-instead-of-Python-3.patch -Patch0081: 0081-RHEL-7-v2v-rhv-upload-Disable-Nagle-algorithm.patch -Patch0082: 0082-RHEL-7-p2v-ignore-rhv-upload-driver-RHBZ-1590220.patch -Patch0083: 0083-v2v-docs-Describe-support-for-SHA-2-certs-for-Window.patch -Patch0084: 0084-v2v-windows-Fix-rhev-apt-command-line-RHBZ-1624902.patch -Patch0085: 0085-inspect-fix-inspection-of-partition-less-devices-RHB.patch +Patch0001: 0001-inspect-fix-icon-of-RHEL.patch +Patch0002: 0002-v2v-linux-do-not-uninstall-open-vm-tools-w-ubuntu-se.patch +Patch0003: 0003-v2v-linux-canonicalize-module-path-for-arch-detectio.patch +Patch0004: 0004-v2v-linux-improve-arch-detection-from-modules-RHBZ-1.patch +Patch0005: 0005-v2v-o-libvirt-write-win2k19-osinfo-ID.patch +Patch0006: 0006-v2v-update-documentation-on-nbdkit-RHBZ-1605242.patch +Patch0007: 0007-v2v-linux-add-helper-functions-for-pkg-arch-and-exte.patch +Patch0008: 0008-v2v-try-to-pick-the-right-arch-for-qemu-ga-pkgs.patch +Patch0009: 0009-v2v-change-the-reporting-of-RHV-Tools-messages-warni.patch +Patch0010: 0010-v2v-fix-path-to-source-when-copying-files-from-guest.patch +Patch0011: 0011-v2v-warn-when-the-guest-has-direct-network-interface.patch +Patch0012: 0012-Use-proper-label-for-nbdkit-sockets.patch +Patch0013: 0013-RHEL-7-Remove-libguestfs-live-RHBZ-798980.patch +Patch0014: 0014-RHEL-7-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch +Patch0015: 0015-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch +Patch0016: 0016-RHEL-7-Remove-User-Mode-Linux-RHBZ-1144197.patch +Patch0017: 0017-RHEL-7-v2v-Select-correct-qemu-binary-for-o-qemu-mod.patch +Patch0018: 0018-RHEL-7-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch +Patch0019: 0019-RHEL-7-Disable-alternate-Augeas-lenses.patch +Patch0020: 0020-RHEL-7-Fix-list-of-supported-sound-cards-to-match-RH.patch +Patch0021: 0021-RHEL-7-Reject-use-of-libguestfs-winsupport-features-.patch +Patch0022: 0022-RHEL-7-daemon-umount-all-Hack-to-avoid-umount-sysroo.patch +Patch0023: 0023-RHEL-7-Fix-tests-for-libguestfs-winsupport-7.2.patch +Patch0024: 0024-RHEL-7-All-qemu-kvm-in-RHEL-7-supports-discard-of-qc.patch +Patch0025: 0025-RHEL-7-tests-Disable-daemon-tests-that-require-the-u.patch +Patch0026: 0026-RHEL-7-v2v-Disable-the-virt-v2v-in-place-option.patch +Patch0027: 0027-RHEL-7-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch +Patch0028: 0028-RHEL-7-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-143020.patch +Patch0029: 0029-RHEL-7-v2v-rhv-upload-Remove-restriction-on-oa-spars.patch +Patch0030: 0030-RHEL-7-o-rhv-upload-Use-Python-2-instead-of-Python-3.patch +Patch0031: 0031-RHEL-7-v2v-rhv-upload-Disable-Nagle-algorithm.patch +Patch0032: 0032-RHEL-7-p2v-ignore-rhv-upload-driver-RHBZ-1590220.patch +Patch0033: 0033-RHEL-7-point-to-KB-for-supported-v2v-hypervisors-gue.patch # Use git for patch management. BuildRequires: git @@ -152,7 +100,7 @@ Source7: libguestfs.keyring # RHEV-APT is taken from the RHEV Tools CD # See https://bugzilla.redhat.com/show_bug.cgi?id=1186850 Source96: rhsrvany.exe -Source97: RHEV-Application-Provisioning-Tool.exe_4.42 +Source97: RHEV-Application-Provisioning-Tool.exe_4.43-3 Source98: brew-overrides.sh Source99: copy-patches.sh @@ -198,7 +146,7 @@ BuildRequires: libvirt-daemon-kvm BuildRequires: libacl-devel BuildRequires: libcap-devel #BuildRequires: libldm-devel -BuildRequires: yajl-devel +BuildRequires: jansson-devel BuildRequires: systemd-devel BuildRequires: bash-completion BuildRequires: /usr/bin/ping @@ -258,7 +206,7 @@ BuildRequires: gjs # for f in `cat appliance/packagelist`; do echo $f; done | sort -u # However you have to edit the list down to packages which exist in # current RHEL, since supermin ignores non-existent packages. -BuildRequires: acl attr augeas-libs bash binutils btrfs-progs bzip2 coreutils cpio cryptsetup curl diffutils dosfstools e2fsprogs file findutils gawk gdisk genisoimage grep gzip hivex iproute iputils kernel kmod kpartx less libcap libselinux libxml2 lsof lsscsi lvm2 lzop mdadm openssh-clients parted pciutils pcre policycoreutils procps psmisc qemu-img rsync scrub sed squashfs-tools strace systemd tar udev util-linux vim-minimal which xfsprogs xz yajl +BuildRequires: acl attr augeas-libs bash binutils btrfs-progs bzip2 coreutils cpio cryptsetup curl dhclient diffutils dosfstools e2fsprogs file findutils gawk gdisk genisoimage grep gzip hivex iproute iputils jansson kernel kmod kpartx less libcap libselinux libxml2 lsof lsscsi lvm2 lzop mdadm openssh-clients parted pciutils pcre policycoreutils procps psmisc qemu-img rsync scrub sed squashfs-tools strace systemd tar udev util-linux vim-minimal which xfsprogs xz %ifarch x86_64 BuildRequires: gfs2-utils %endif @@ -1213,11 +1161,17 @@ install -m 0644 utils/boot-benchmark/boot-benchmark.1 $RPM_BUILD_ROOT%{_mandir}/ %ifarch %{v2v_arches} %files -n virt-v2v -%doc COPYING README v2v/TODO +%doc COPYING README %{_bindir}/virt-v2v %{_bindir}/virt-v2v-copy-to-local %{_mandir}/man1/virt-v2v.1* %{_mandir}/man1/virt-v2v-copy-to-local.1* +%{_mandir}/man1/virt-v2v-input-vmware.1* +%{_mandir}/man1/virt-v2v-input-xen.1* +%{_mandir}/man1/virt-v2v-output-local.1* +%{_mandir}/man1/virt-v2v-output-openstack.1* +%{_mandir}/man1/virt-v2v-output-rhv.1* +%{_mandir}/man1/virt-v2v-support.1* %{_datadir}/virt-tools @@ -1238,6 +1192,7 @@ install -m 0644 utils/boot-benchmark/boot-benchmark.1 $RPM_BUILD_ROOT%{_mandir}/ %{_datadir}/bash-completion/completions/guestfish %{_datadir}/bash-completion/completions/guestmount %{_datadir}/bash-completion/completions/guestunmount +%{_datadir}/bash-completion/completions/libguestfs-test-tool %{_datadir}/bash-completion/completions/virt-* @@ -1334,9 +1289,43 @@ install -m 0644 utils/boot-benchmark/boot-benchmark.1 $RPM_BUILD_ROOT%{_mandir}/ %changelog -* Thu Feb 07 2019 Pino Toscano - 1:1.38.2-12.el7_6.2 -- Fix inspection of partition-less devices - resolves: rhbz#1673280 +* Tue Jun 04 2019 Pino Toscano - 1:1.40.2-5 +- Rebase to libguestfs 1.40.2 in RHEL 7.7. + resolves: rhbz#1621895 +- v2v: uninstall the VMware Tools correctly + resolves: rhbz#1465849 + resolves: rhbz#1481930 +- v2v: fix VMware vCenter roles needed for conversion + resolves: rhbz#1530967 +- v2v: preserve the VM Generation ID + resolves: rhbz#1598350 +- Query QEMU to known whether KVM is supported + resolves: rhbz#1605071 +- v2v: add --mac option + resolves: rhbz#1607274 +- v2v: install ovirt-guest-agent-common on Linux guests migrated to RHV + resolves: rhbz#1619665 + resolves: rhbz#1691659 +- v2v: provide a way to query for the estimated size of the disks + resolves: rhbz#1622785 +- Correctly inspect the newer versions of openSUSE (15, Factory, Thumbleweed) + resolves: rhbz#1634248 +- p2v: add an option to Shutdown the machine after the conversion + resolves: rhbz#1642044 +- v2v: fix epoch when querying installed RPM packages + resolves: rhbz#1669395 +- Use a better icon for RHEL >= 7 guests + resolves: rhbz#1679482 +- v2v: improve the architecture detection of Linux kernel modules + resolves: rhbz#1690574 +- v2v: ship a newer version of rhev-apt.exe + resolves: rhbz#1688155 +- v2v: update nbdkit information in documentation + resolves: rhbz#1605242 +- v2v: warn when a guest has 'direct' network interfaces + resolves: rhbz#1151902 +- v2v: use proper SELinux label for nbdkit sockets + resolves: rhbz#1698437 * Fri Oct 12 2018 Pino Toscano - 1:1.38.2-12.el7_6.1 - v2v: update documentation regarding SHA-2 certificates in Windows 7 and