On 03/24/22 10:13, Richard W.M. Jones wrote:
virt-p2v needs an NBD server running on the p2v machine to export
the
disks. Originally we used qemu-nbd since that was the only choice.
In 2017, I added support for nbdkit as an alternative to qemu-nbd.
So now we're in the situation where either server can be used (see
virt-p2v.git/nbd.c). For added complexity we also support both
servers in either systemd socket activation (SA) mode or "no-SA" mode,
so that's 4 combinations.
This is silly, we should support only one NBD server, and since
systemd socket activation is well-supported and more flexible, we
should just use it.
So the question is *which* NBD server to support. That's not so much
a technical matter since both servers can easily serve a local block
device (always raw format). However I do think that nbdkit might
genuinely be the better choice here:
- qemu-nbd links to the whole qemu block layer, nbdkit can be shipped
with just the plugin we need, so it should be smaller with less
code surface
- nbdkit-file-plugin has a better method of not trashing the host
page cache
- could use nbdkit --exit-with-parent feature (which we don't at the
moment)
- nbdkit is widely available in distros these days
Also that file uses AI_ADDRCONFIG so I guess it has problems with IPv6.
This patch removes qemu-nbd support, as the first step.
"test-virt-p2v.sh" is simply removed, as the remaining
"test-virt-p2v-nbdkit.sh" is mostly identical.
The package references for the various distros, in "dependencies.m4", come
from:
-
https://packages.debian.org/sid/amd64/nbdkit/filelist
-
https://aur.archlinux.org/packages/nbdkit
Ref:
https://listman.redhat.com/archives/libguestfs/2022-March/028475.html
Suggested-by: Richard W.M. Jones <rjones(a)redhat.com>
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
---
Notes:
v2:
- update package names for nbdkit, extend commit message [Rich]
- keep the skip check for nbdkit in "test-virt-p2v-nbdkit.sh" [Rich]
Makefile.am | 2 -
main.c | 2 +-
nbd.c | 136
+-------------------
contrib/aux-scripts/do-build.sh | 7 +-
contrib/patches/0002-RHEL-5-ONLY-QEMU-NBD-1.4-HAS-NO-f-OPTION.patch | 34 -----
dependencies.m4 | 13 +-
docs/p2v-building.pod | 9 +-
test-virt-p2v-nbdkit.sh | 4 +-
test-virt-p2v-scp.sh | 2 +-
test-virt-p2v-ssh.sh | 4 +-
test-virt-p2v.sh | 56 --------
virt-p2v.pod | 29 ++---
12 files changed, 35 insertions(+), 263 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 2080890b14e3..e98129e99028 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,36 +27,35 @@ SUBDIRS += bash
EXTRA_DIST = \
$(BUILT_SOURCES) \
$(TESTS) $(LIBGUESTFS_TESTS) $(SLOW_TESTS) \
AUTHORS \
contrib/aux-scripts/do-build.sh \
contrib/build-p2v-iso.sh \
contrib/patches/0001-RHEL-5-ONLY-DISABLE-AUTOMATIC-REMOTE-PORT-ALLOCATION.patch \
- contrib/patches/0002-RHEL-5-ONLY-QEMU-NBD-1.4-HAS-NO-f-OPTION.patch \
contrib/test-p2v-iso.sh \
dependencies.m4 \
generate-p2v-authors.pl \
generate-p2v-config.pl \
issue \
kiwi-config.sh \
kiwi-config.xml.in \
launch-virt-p2v \
libguestfs/README \
miniexpect/README \
p2v.ks.in \
p2v.service \
podcheck.pl \
test-functions.sh \
test-virt-p2v-docs.sh \
test-virt-p2v-pxe.sshd_config.in \
test-virt-p2v-scp.sh \
test-virt-p2v-ssh.sh \
virt-p2v.pod \
virt-p2v-make-disk.in \
virt-p2v-make-disk.pod \
virt-p2v-make-kickstart.in \
virt-p2v-make-kickstart.pod \
virt-p2v-make-kiwi.in \
virt-p2v-make-kiwi.pod
# Don't clean ssh_host_rsa_key{,.pub} or id_rsa{,.pub} since those
# consume system entropy to regenerate.
@@ -339,7 +338,6 @@ TESTS = \
test-virt-p2v-docs.sh
LIBGUESTFS_TESTS = \
- test-virt-p2v.sh \
test-virt-p2v-nbdkit.sh
if HAVE_LIBGUESTFS
diff --git a/main.c b/main.c
index a28a8b64ddaa..e4e9c1fe21c1 100644
--- a/main.c
+++ b/main.c
@@ -87,27 +87,27 @@ static void __attribute__((noreturn))
usage (int status)
{
if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try ‘%s --help’ for more information.\n"),
g_get_prgname ());
else {
printf (_("%s: Convert a physical machine to use KVM\n"
"Copyright (C) 2009-2019 Red Hat Inc.\n"
"Usage:\n"
" %s [--options]\n"
"Options:\n"
" --help Display brief help\n"
" --cmdline=CMDLINE Used to debug command line parsing\n"
" --colors|--colours Use ANSI colour sequences even if not
tty\n"
" --iso Running in the ISO environment\n"
- " --nbd=qemu-nbd,nbdkit Search order for NBD servers\n"
+ " --nbd=nbdkit Search order for NBD servers\n"
" --test-disk=DISK.IMG For testing, use disk as /dev/sda\n"
" -v|--verbose Verbose messages\n"
" -V|--version Display version and exit\n"
"For more information, see the manpage %s(1).\n"),
g_get_prgname (), g_get_prgname (),
g_get_prgname ());
}
exit (status);
}
/* XXX Copied from fish/options.c. */
diff --git a/nbd.c b/nbd.c
index db6228a8aba0..46f6304d2c51 100644
--- a/nbd.c
+++ b/nbd.c
@@ -1,47 +1,47 @@
/* virt-p2v
* Copyright (C) 2009-2019 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, see <
https://www.gnu.org/licenses/>.
*/
/**
* This file handles the virt-p2v I<--nbd> command line option
- * and running either L<qemu-nbd(8)> or L<nbdkit(1)>.
+ * and running L<nbdkit(1)>.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h>
#include <netdb.h>
#include <errno.h>
#include <error.h>
#include <libintl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <assert.h>
#include "p2v.h"
/* How long to wait for the NBD server to start (seconds). */
#define WAIT_NBD_TIMEOUT 10
/* The local port that the NBD server listens on (incremented for
* each server which is started).
*/
@@ -50,10 +50,8 @@ static int nbd_local_port;
/* List of servers specified by the --nbd option. */
enum nbd_server {
/* 0 is reserved for "end of list" */
- QEMU_NBD = 1,
- QEMU_NBD_NO_SA = 2,
- NBDKIT = 3,
- NBDKIT_NO_SA = 4,
+ NBDKIT = 1,
+ NBDKIT_NO_SA = 2,
};
static enum nbd_server *cmdline_servers = NULL;
@@ -61,32 +59,29 @@ static const char *
nbd_server_string (enum nbd_server s)
{
const char *ret = NULL;
switch (s) {
- case QEMU_NBD: ret = "qemu-nbd"; break;
- case QEMU_NBD_NO_SA: ret = "qemu-nbd-no-sa"; break;
case NBDKIT: ret = "nbdkit"; break;
case NBDKIT_NO_SA: ret = "nbdkit-no-sa"; break;
}
if (ret == NULL)
abort ();
return ret;
}
/* If no --nbd option is passed, we use this standard list instead.
* Must match the documentation in virt-p2v(1).
*/
static const enum nbd_server standard_servers[] =
- { QEMU_NBD, QEMU_NBD_NO_SA, NBDKIT, NBDKIT_NO_SA, 0 };
+ { NBDKIT, NBDKIT_NO_SA, 0 };
/* After testing the list of servers passed by the user, this is
* server we decide to use.
*/
static enum nbd_server use_server;
-static pid_t start_qemu_nbd (const char *device, const char *ipaddr, int port, int *fds,
size_t nr_fds);
static pid_t start_nbdkit (const char *device, const char *ipaddr, int port, int *fds,
size_t nr_fds);
static int get_local_port (void);
static int open_listening_socket (const char *ipaddr, int **fds, size_t *nr_fds);
@@ -131,44 +126,40 @@ void
set_nbd_option (const char *opt)
{
size_t i, len;
CLEANUP_FREE_STRING_LIST char **strs = NULL;
if (cmdline_servers != NULL)
error (EXIT_FAILURE, 0, _("--nbd option appears multiple times"));
strs = guestfs_int_split_string (',', opt);
if (strs == NULL)
error (EXIT_FAILURE, errno, _("malloc"));
len = guestfs_int_count_strings (strs);
if (len == 0)
error (EXIT_FAILURE, 0, _("--nbd option cannot be empty"));
cmdline_servers = malloc (sizeof (enum nbd_server) * (len + 1));
if (cmdline_servers == NULL)
error (EXIT_FAILURE, errno, _("malloc"));
for (i = 0; strs[i] != NULL; ++i) {
- if (STREQ (strs[i], "qemu-nbd") || STREQ (strs[i], "qemu"))
- cmdline_servers[i] = QEMU_NBD;
- else if (STREQ (strs[i], "qemu-nbd-no-sa") || STREQ (strs[i],
"qemu-no-sa"))
- cmdline_servers[i] = QEMU_NBD_NO_SA;
- else if (STREQ (strs[i], "nbdkit"))
+ if (STREQ (strs[i], "nbdkit"))
cmdline_servers[i] = NBDKIT;
else if (STREQ (strs[i], "nbdkit-no-sa"))
cmdline_servers[i] = NBDKIT_NO_SA;
else
error (EXIT_FAILURE, 0, _("--nbd: unknown server: %s"), strs[i]);
}
assert (i == len);
cmdline_servers[i] = 0; /* marks the end of the list */
}
/**
* Test the I<--nbd> option (or built-in default list) to see which
* servers are actually installed and appear to be working.
*
* Set the C<use_server> global accordingly.
*/
@@ -176,113 +167,88 @@ void
test_nbd_servers (void)
{
size_t i;
int r;
const enum nbd_server *servers;
/* Initialize nbd_local_port. */
if (is_iso_environment)
/* The p2v ISO should allow us to open up just about any port, so
* we can fix a port number in that case. Using a predictable
* port number in this case should avoid rare errors if the port
* colides with another (ie. it'll either always fail or never
* fail).
*/
nbd_local_port = 50123;
else
/* When testing on the local machine, choose a random port. */
nbd_local_port = 50000 + (random () % 10000);
if (cmdline_servers != NULL)
servers = cmdline_servers;
else
servers = standard_servers;
use_server = 0;
for (i = 0; servers[i] != 0; ++i) {
#if DEBUG_STDERR
fprintf (stderr, "checking for %s ...\n", nbd_server_string (servers[i]));
#endif
switch (servers[i]) {
- case QEMU_NBD: /* with socket activation */
- r = system ("qemu-nbd --version"
-#ifndef DEBUG_STDERR
- " >/dev/null 2>&1"
-#endif
- " && grep -sq LISTEN_PID `which qemu-nbd`"
- );
- if (r == 0) {
- use_server = servers[i];
- goto finish;
- }
- break;
-
- case QEMU_NBD_NO_SA:
- r = system ("qemu-nbd --version"
-#ifndef DEBUG_STDERR
- " >/dev/null 2>&1"
-#endif
- );
- if (r == 0) {
- use_server = servers[i];
- goto finish;
- }
- break;
-
case NBDKIT: /* with socket activation */
r = system ("nbdkit file --version"
#ifndef DEBUG_STDERR
" >/dev/null 2>&1"
#endif
" && grep -sq LISTEN_PID `which nbdkit`"
);
if (r == 0) {
use_server = servers[i];
goto finish;
}
break;
case NBDKIT_NO_SA:
r = system ("nbdkit file --version"
#ifndef DEBUG_STDERR
" >/dev/null 2>&1"
#endif
);
if (r == 0) {
use_server = servers[i];
goto finish;
}
break;
default:
abort ();
}
}
finish:
if (use_server == 0) {
fprintf (stderr,
_("%s: no working NBD server was found, cannot continue.\n"
"Please check the --nbd option in the virt-p2v(1) man
page.\n"),
g_get_prgname ());
exit (EXIT_FAILURE);
}
/* Release memory used by the --nbd option. */
free (cmdline_servers);
cmdline_servers = NULL;
#if DEBUG_STDERR
fprintf (stderr, "picked %s\n", nbd_server_string (use_server));
#endif
}
/**
* Start the NBD server.
*
* We previously tested all NBD servers (see C<test_nbd_servers>) and
* hopefully found one which will work.
*
* Returns the process ID (E<gt> 0) or C<0> if there is an error.
*/
@@ -290,56 +256,35 @@ pid_t
start_nbd_server (const char **ipaddr, int *port, const char *device)
{
int *fds = NULL;
size_t i, nr_fds;
pid_t pid;
switch (use_server) {
- case QEMU_NBD: /* qemu-nbd with socket activation */
- /* Ideally we would bind this socket to "localhost", but that
- * requires two listening FDs, and qemu-nbd currently cannot
- * support socket activation with two FDs. So we only bind to the
- * IPv4 address.
- */
- *ipaddr = "127.0.0.1";
- *port = open_listening_socket (*ipaddr, &fds, &nr_fds);
- if (*port == -1) return -1;
- pid = start_qemu_nbd (device, *ipaddr, *port, fds, nr_fds);
- for (i = 0; i < nr_fds; ++i)
- close (fds[i]);
- free (fds);
- return pid;
-
- case QEMU_NBD_NO_SA: /* qemu-nbd without socket activation */
- *ipaddr = "localhost";
- *port = get_local_port ();
- if (*port == -1) return -1;
- return start_qemu_nbd (device, *ipaddr, *port, NULL, 0);
-
case NBDKIT: /* nbdkit with socket activation */
*ipaddr = "localhost";
*port = open_listening_socket (*ipaddr, &fds, &nr_fds);
if (*port == -1) return -1;
pid = start_nbdkit (device, *ipaddr, *port, fds, nr_fds);
for (i = 0; i < nr_fds; ++i)
close (fds[i]);
free (fds);
return pid;
case NBDKIT_NO_SA: /* nbdkit without socket activation */
*ipaddr = "localhost";
*port = get_local_port ();
if (*port == -1) return -1;
return start_nbdkit (device, *ipaddr, *port, NULL, 0);
}
abort ();
}
#define FIRST_SOCKET_ACTIVATION_FD 3
/**
* Set up file descriptors and environment variables for
* socket activation.
*
* Note this function runs in the child between fork and exec.
*/
@@ -347,103 +292,32 @@ static inline void
socket_activation (int *fds, size_t nr_fds)
{
size_t i;
char nr_fds_str[16];
char pid_str[16];
if (fds == NULL) return;
for (i = 0; i < nr_fds; ++i) {
int fd = FIRST_SOCKET_ACTIVATION_FD + i;
if (fds[i] != fd) {
dup2 (fds[i], fd);
close (fds[i]);
}
}
snprintf (nr_fds_str, sizeof nr_fds_str, "%zu", nr_fds);
setenv ("LISTEN_FDS", nr_fds_str, 1);
snprintf (pid_str, sizeof pid_str, "%d", (int) getpid ());
setenv ("LISTEN_PID", pid_str, 1);
}
-/**
- * Start a local L<qemu-nbd(1)> process.
- *
- * If we are using socket activation, C<fds> and C<nr_fds> will
- * contain the locally pre-opened file descriptors for this.
- * Otherwise if C<fds == NULL> we pass the port number.
- *
- * Returns the process ID (E<gt> 0) or C<0> if there is an error.
- */
-static pid_t
-start_qemu_nbd (const char *device,
- const char *ipaddr, int port, int *fds, size_t nr_fds)
-{
- pid_t pid;
- char port_str[64];
-
-#if DEBUG_STDERR
- fprintf (stderr, "starting qemu-nbd for %s on %s:%d%s\n",
- device, ipaddr, port,
- fds == NULL ? "" : " using socket activation");
-#endif
-
- snprintf (port_str, sizeof port_str, "%d", port);
-
- pid = fork ();
- if (pid == -1) {
- set_nbd_error ("fork: %m");
- return 0;
- }
-
- if (pid == 0) { /* Child. */
- close (0);
- if (open ("/dev/null", O_RDONLY) == -1) {
- perror ("open: /dev/null");
- _exit (EXIT_FAILURE);
- }
-
- if (fds == NULL) { /* without socket activation */
- execlp ("qemu-nbd",
- "qemu-nbd",
- "-r", /* readonly (vital!) */
- "-p", port_str, /* listening port */
- "-t", /* persistent */
- "-f", "raw", /* force raw format */
- "-b", ipaddr, /* listen only on loopback interface */
- "--cache=unsafe", /* use unsafe caching for speed */
- device, /* a device like /dev/sda */
- NULL);
- perror ("qemu-nbd");
- _exit (EXIT_FAILURE);
- }
- else { /* socket activation */
- socket_activation (fds, nr_fds);
-
- execlp ("qemu-nbd",
- "qemu-nbd",
- "-r", /* readonly (vital!) */
- "-t", /* persistent */
- "-f", "raw", /* force raw format */
- "--cache=unsafe", /* use unsafe caching for speed */
- device, /* a device like /dev/sda */
- NULL);
- perror ("qemu-nbd");
- _exit (EXIT_FAILURE);
- }
- }
-
- /* Parent. */
- return pid;
-}
-
/**
* Start a local L<nbdkit(1)> process using the
* L<nbdkit-file-plugin(1)>.
*
* If we are using socket activation, C<fds> and C<nr_fds> will
* contain the locally pre-opened file descriptors for this.
* Otherwise if C<fds == NULL> we pass the port number.
*
* Returns the process ID (E<gt> 0) or C<0> if there is an error.
*/
diff --git a/contrib/aux-scripts/do-build.sh b/contrib/aux-scripts/do-build.sh
index 53a844d9c99d..4a0aac840df0 100644
--- a/contrib/aux-scripts/do-build.sh
+++ b/contrib/aux-scripts/do-build.sh
@@ -49,22 +49,21 @@ pushd libguestfs-*
# Various hacks for different versions of RHEL.
case $osversion in
rhel-5.*|centos-5.*)
# This just forces configure to ignore these missing dependencies.
export LIBTINFO_CFLAGS=-D_GNU_SOURCE
export LIBTINFO_LIBS=-lncurses
export JANSSON_CFLAGS=-D_GNU_SOURCE
export JANSSON_LIBS=-ljansson
# Remove some unsupported flags that the configure script hard codes.
sed -i -e 's/-fno-strict-overflow//' configure
sed -i -e 's/-Wno-strict-overflow//' configure
# Apply some RHEL 5 only patches.
patch -p1 <
../patches/0001-RHEL-5-ONLY-DISABLE-AUTOMATIC-REMOTE-PORT-ALLOCATION.patch
- patch -p1 < ../patches/0002-RHEL-5-ONLY-QEMU-NBD-1.4-HAS-NO-f-OPTION.patch
;;
rhel-6.*|centos-6.*)
# This just forces configure to ignore these missing dependencies.
export LIBTINFO_CFLAGS=-D_GNU_SOURCE
export LIBTINFO_LIBS=-lncurses
export JANSSON_CFLAGS=-D_GNU_SOURCE
export JANSSON_LIBS=-ljansson
;;
@@ -106,41 +105,43 @@ popd
# More hacks for different versions of RHEL.
case $osversion in
rhel-5.*|centos-5.*)
# RHEL 5 livecd-tools is broken with syslinux, this fixes it:
sed -i -e 's,/usr/lib/syslinux/,/usr/share/syslinux/,g'\
/usr/lib/python2.4/site-packages/imgcreate/live.py
# livecd-tools cannot parse certain aspects of the kickstart:
sed -i \
-e 's/--plaintext//g' \
-e 's/^firewall.*//g' \
-e 's/^%end.*//g' \
p2v.ks
# Remove some packages which don't exist on RHEL 5:
sed -i \
-e 's,^dracut-live.*,,g' \
-e 's,^dejavu-.*,,g' \
-e 's,^mesa-dri-drivers.*,,g' \
-e 's,^network-manager-applet.*,,g' \
-e 's,^nm-connection-editor.*,,g' \
- -e 's,^/usr/bin/qemu-nbd.*,,g' \
+ -e 's,^nbdkit-server.*,,g' \
+ -e 's,^nbdkit-file-plugin.*,,g' \
-e '/^net-tools/a syslinux' \
p2v.ks
# Remove systemctl lines, doesn't exist on RHEL 5.
sed -i \
-e 's/^\(systemctl.*\)/#\1/g' \
p2v.ks
;;
rhel-6.*|centos-6.*)
# Remove some packages which don't exist on RHEL 6:
sed -i \
-e 's,^dracut-live.*,,g' \
-e 's,^firewalld.*,,g' \
-e 's,^network-manager-applet.*,,g' \
-e 's,^nm-connection-editor.*,,g' \
- -e 's,^/usr/bin/qemu-nbd.*,,g' \
+ -e 's,^nbdkit-server.*,,g' \
+ -e 's,^nbdkit-file-plugin.*,,g' \
p2v.ks
# Remove systemctl lines, doesn't exist on RHEL 5.
sed -i \
-e 's/^\(systemctl.*\)/#\1/g' \
p2v.ks
;;
diff --git a/contrib/patches/0002-RHEL-5-ONLY-QEMU-NBD-1.4-HAS-NO-f-OPTION.patch
b/contrib/patches/0002-RHEL-5-ONLY-QEMU-NBD-1.4-HAS-NO-f-OPTION.patch
deleted file mode 100644
index d0bc2cfc9ec2..000000000000
--- a/contrib/patches/0002-RHEL-5-ONLY-QEMU-NBD-1.4-HAS-NO-f-OPTION.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 3ccd25c981431426038d7952f5b0b86118d92c23 Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones" <rjones(a)redhat.com>
-Date: Sat, 21 Jan 2017 05:57:17 -0500
-Subject: [PATCH 2/2] RHEL 5 ONLY QEMU-NBD 1.4 HAS NO -f OPTION
-
----
- p2v/nbd.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/p2v/nbd.c b/p2v/nbd.c
-index b1caf2f..2232b08 100644
---- a/p2v/nbd.c
-+++ b/p2v/nbd.c
-@@ -409,7 +409,7 @@ start_qemu_nbd (const char *device,
- "-r", /* readonly (vital!) */
- "-p", port_str, /* listening port */
- "-t", /* persistent */
-- "-f", "raw", /* force raw format */
-+ //"-f", "raw", /* force raw format */
- "-b", ipaddr, /* listen only on loopback interface */
- "--cache=unsafe", /* use unsafe caching for speed */
- device, /* a device like /dev/sda */
-@@ -424,7 +424,7 @@ start_qemu_nbd (const char *device,
- "qemu-nbd",
- "-r", /* readonly (vital!) */
- "-t", /* persistent */
-- "-f", "raw", /* force raw format */
-+ //"-f", "raw", /* force raw format */
- "--cache=unsafe", /* use unsafe caching for speed */
- device, /* a device like /dev/sda */
- NULL);
---
-1.8.2.3
-
diff --git a/dependencies.m4 b/dependencies.m4
index 40b3786cb0b7..fc3715e4d3c7 100644
--- a/dependencies.m4
+++ b/dependencies.m4
@@ -23,39 +23,40 @@ dnl only runs on the virt-v2v conversion server.
ifelse(REDHAT,1,
dnl Used by the virt-p2v binary.
pcre
libxml2
gtk`'GTK_VERSION
dbus-libs
dnl Run as external programs by the p2v binary.
/usr/bin/ssh
- /usr/bin/qemu-nbd
+ nbdkit-server
+ nbdkit-file-plugin
which
dnl Generally useful tools to use within xterm
vim-minimal
dnl Useful disk and diagnostic utilities.
iscsi-initiator-utils
dnl X11 environment
/usr/bin/xinit
/usr/bin/Xorg
xorg-x11-drivers
xorg-x11-fonts-Type1
dejavu-sans-fonts
dejavu-sans-mono-fonts
mesa-dri-drivers
metacity
NetworkManager
nm-connection-editor
network-manager-applet
dnl dbus is required by nm-applet, but not a dependency in Fedora
dbus-x11
dnl sysadmins prefer ifconfig
net-tools
dnl RHBZ#1157679
@hardware-support
)
@@ -63,19 +64,19 @@ ifelse(REDHAT,1,
ifelse(DEBIAN,1,
libpcre3
libxml2
ifelse(GTK_VERSION,2,libgtk`'GTK_VERSION`'.0-0,libgtk-`'GTK_VERSION`'-0)
libdbus-1-3
openssh-client
- qemu-utils
+ nbdkit
debianutils
vim-tiny
open-iscsi
xorg
xserver-xorg-video-all
fonts-dejavu
metacity
network-manager
network-manager-gnome
dbus-x11
net-tools
)
@@ -83,21 +84,21 @@ ifelse(DEBIAN,1,
ifelse(ARCHLINUX,1,
pcre
libxml2
gtk`'GTK_VERSION
dbus
openssh
- qemu
+ nbdkit
which
vim-tiny
open-iscsi
xorg-xinit
xorg-server
xf86-video-*
ttf-dejavu
metacity
NetworkManager
nm-connection-editor
network-manager-applet
dbus-x11
net-tools
)
@@ -105,22 +106,23 @@ ifelse(ARCHLINUX,1,
ifelse(SUSE,1,
pcre
libxml2
gtk`'GTK_VERSION
libdbus-1-3
- qemu-tools
+ nbdkit-server
+ nbdkit-file-plugin
openssh
dnl /usr/bin/which is in util-linux on SUSE
vim
open-iscsi
xinit
xorg-x11-server
xf86-video-*
dejavu-fonts
NetworkManager
xf86-input-*
icewm-lite
dbus-1-x11
yast2-network
libyui-qt
SuSEfirewall2
)
@@ -128,33 +130,34 @@ ifelse(SUSE,1,
ifelse(OPENMANDRIVA,1,
dnl Used by the virt-p2v binary.
pcre
libxml2
gtk`'GTK_VERSION
dbus-libs
dnl Run as external programs by the p2v binary.
/usr/bin/ssh
- /usr/bin/qemu-nbd
+ nbdkit-server
+ nbdkit-file-plugin
which
dnl Generally useful tools to use within xterm
vim-enhanced
dnl X11 environment
/usr/bin/xinit
/usr/bin/Xorg
xorg-x11-drivers
xorg-x11-fonts-Type1
dejavu-sans-fonts
dejavu-sans-mono-fonts
mesa-dri-drivers
kwin_x11
NetworkManager
nm-connection-editor
network-manager-applet
dnl dbus is required by nm-applet, but not a dependency in Fedora
dbus-x11
dnl sysadmins prefer ifconfig
net-tools
)
diff --git a/docs/p2v-building.pod b/docs/p2v-building.pod
index f249f742554a..21edc0255015 100644
--- a/docs/p2v-building.pod
+++ b/docs/p2v-building.pod
@@ -73,15 +73,12 @@ I<Required>.
I<Required>.
-=item qemu-nbd
-
=item nbdkit
-Optional. qemu-nbd is used for testing.
+Optional.
-L<virt-p2v(1)> requires either qemu-nbd or nbdkit, but these only need
-to be present on the virt-p2v ISO, they do not need to be installed at
-compile time.
+L<virt-p2v(1)> requires nbdkit, but it only needs to be present on the
+virt-p2v ISO, it does not need to be installed at compile time.
=item Gtk E<ge> 2.24, or 3
diff --git a/test-virt-p2v-nbdkit.sh b/test-virt-p2v-nbdkit.sh
index 9adb195f9249..bba4bda4ab87 100755
--- a/test-virt-p2v-nbdkit.sh
+++ b/test-virt-p2v-nbdkit.sh
@@ -1,21 +1,21 @@
#!/bin/bash -
# libguestfs virt-p2v test script
# Copyright (C) 2014-2019 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, see <
https://www.gnu.org/licenses/>.
-# Test virt-p2v in non-GUI mode using nbdkit instead of qemu-nbd.
+# Test virt-p2v in non-GUI mode using nbdkit.
set -e
@@ -47,7 +47,7 @@ export PATH=$d:$PATH
# The Linux kernel command line.
cmdline="p2v.server=localhost p2v.name=fedora p2v.disks=$f1,$f2 p2v.o=local
p2v.os=$(pwd)/$d p2v.network=em1:wired,other p2v.post="
-# Only use nbdkit, disable qemu-nbd.
+# Only use nbdkit.
$VG virt-p2v --cmdline="$cmdline" --nbd=nbdkit,nbdkit-no-sa
# Test the libvirt XML metadata and a disk was created.
diff --git a/test-virt-p2v-scp.sh b/test-virt-p2v-scp.sh
index ca851012fb85..65ed018cdfb8 100755
--- a/test-virt-p2v-scp.sh
+++ b/test-virt-p2v-scp.sh
@@ -1,20 +1,20 @@
#!/bin/bash -
# Copyright (C) 2014-2019 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, see <
https://www.gnu.org/licenses/>.
-# This is an scp substitute used by test-virt-p2v.sh.
+# This is an scp substitute used by test-virt-p2v-nbdkit.sh.
TEMP=`getopt \
-o 'o:P:' \
diff --git a/test-virt-p2v-ssh.sh b/test-virt-p2v-ssh.sh
index 2442b7d3f2c6..8a14b71fbd4b 100755
--- a/test-virt-p2v-ssh.sh
+++ b/test-virt-p2v-ssh.sh
@@ -1,20 +1,20 @@
#!/bin/bash -
# Copyright (C) 2014 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, see <
https://www.gnu.org/licenses/>.
-# This is an ssh substitute used by test-virt-p2v.sh.
+# This is an ssh substitute used by test-virt-p2v-nbdkit.sh.
TEMP=`getopt \
-o 'l:No:p:R:' \
@@ -28,29 +28,29 @@ eval set -- "$TEMP"
while true ; do
case "$1" in
# Regular arguments that we can just ignore.
-N)
shift
;;
-l|-o|-p)
shift 2
;;
# ssh -R 0:localhost:<port> (port forwarding). Don't actually
# port forward, just return the original port number here so that
- # the conversion process connects directly to qemu-nbd.
+ # the conversion process connects directly to nbdkit.
-R)
arg="$2"
port="$(echo $arg | awk -F: '{print $3}')"
echo "Allocated port" $port "for remote forward"
shift 2
;;
--)
shift
break
;;
*)
echo "$0: internal error ($1)"
exit 1
;;
esac
diff --git a/test-virt-p2v.sh b/test-virt-p2v.sh
deleted file mode 100755
index 9629e1b0235a..000000000000
--- a/test-virt-p2v.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/bash -
-# libguestfs virt-p2v test script
-# Copyright (C) 2014 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, see <
https://www.gnu.org/licenses/>.
-
-# Test virt-p2v in non-GUI mode.
-
-set -e
-
-$TEST_FUNCTIONS
-skip_if_skipped
-skip_if_backend uml
-skip_unless test -f fedora.img
-skip_unless test -f blank-part.img
-
-f1="$abs_builddir/fedora.img"
-f2="$abs_builddir/blank-part.img"
-
-d=test-virt-p2v.d
-rm -rf $d
-mkdir $d
-
-# We don't want the program under test to run real 'ssh' or 'scp'.
-# They won't work. Therefore create dummy 'ssh' and 'scp' binaries.
-pushd $d
-ln -sf "$abs_srcdir/test-virt-p2v-ssh.sh" ssh
-ln -sf "$abs_srcdir/test-virt-p2v-scp.sh" scp
-popd
-export PATH=$d:$PATH
-
-# Note that the PATH already contains the local virt-p2v & virt-v2v
-# binaries under test (because of the ./run script).
-
-# The Linux kernel command line.
-cmdline="p2v.server=localhost p2v.name=fedora p2v.disks=$f1,$f2 p2v.o=local
p2v.os=$(pwd)/$d p2v.network=em1:wired,other p2v.post="
-
-$VG virt-p2v --cmdline="$cmdline"
-
-# Test the libvirt XML metadata and a disk was created.
-test -f $d/fedora.xml
-test -f $d/fedora-sda
-test -f $d/fedora-sdb
-
-rm -r $d
diff --git a/virt-p2v.pod b/virt-p2v.pod
index 5f4aa5763524..eb220cbf1cee 100644
--- a/virt-p2v.pod
+++ b/virt-p2v.pod
@@ -509,19 +509,10 @@ features such as the Shutdown popup button.
=item B<--nbd=server[,server...]>
Select which NBD server is used. By default the following servers are
-checked and the first one found is used:
-I<--nbd=qemu-nbd,qemu-nbd-no-sa,nbdkit,nbdkit-no-sa>
+checked and the first one found is used: I<--nbd=nbdkit,nbdkit-no-sa>
=over 4
-=item B<qemu-nbd>
-
-Use qemu-nbd.
-
-=item B<qemu-nbd-no-sa>
-
-Use qemu-nbd, but disable socket activation.
-
=item B<nbdkit>
Use nbdkit with the file plugin (see: L<nbdkit-file-plugin(1)>).
@@ -532,9 +523,9 @@ Use nbdkit, but disable socket activation
=back
-The C<*-no-sa> variants allow virt-p2v to fall back to older versions
-of qemu-nbd and nbdkit which did not support
-L<socket activation|http://0pointer.de/blog/projects/socket-activation.html>.
+The C<nbdkit-no-sa> variant allows virt-p2v to fall back to older
+versions of nbdkit which did not support L<socket
+activation|http://0pointer.de/blog/projects/socket-activation.html>.
=item B<--test-disk=/PATH/TO/DISK.IMG>
@@ -679,22 +670,21 @@ Before conversion actually begins, virt-p2v then makes one or more
further ssh connections to the server for data transfer.
The transfer protocol used currently is NBD (Network Block Device),
-which is proxied over ssh. The NBD server is L<qemu-nbd(1)> by
-default but others can be selected using the I<--nbd> command line
-option.
+which is proxied over ssh. The NBD server is L<nbdkit(1)>; socket
+activation can be controlled using the I<--nbd> command line option.
There is one ssh connection per physical hard disk on the source
machine (the common case — a single hard disk — is shown below):
┌──────────────┐ ┌─────────────────┐
│ virt-p2v │ │ virt-v2v │
│ (physical │ control connection │ (conversion │
│ server) ╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍▶ server) │
│ │ │ │
│ │ data connection │ │
│ ╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍▶ │
- │qemu-nbd ← ─┘ │ │└─ ← NBD │
- │/dev/sda │ │ requests │
+ │ nbdkit ← ─┘ │ │└─ ← NBD │
+ │ /dev/sda │ │ requests │
∼ ∼ ∼ ∼
└──────────────┘ └─────────────────┘
@@ -708,7 +698,7 @@ that virt-v2v via libguestfs can open nbd connections which directly
read the hard disk(s) of the physical server.
Two layers of protection are used to ensure that there are no writes
-to the hard disks: Firstly, the qemu-nbd I<-r> (readonly) option is
+to the hard disks: Firstly, the nbdkit I<-r> (readonly) option is
used. Secondly libguestfs creates an overlay on top of the NBD
connection which stores writes in a temporary file on the conversion
file.
@@ -731,7 +721,6 @@ L<virt-p2v-make-disk(1)>,
L<virt-p2v-make-kickstart(1)>,
L<virt-p2v-make-kiwi(1)>,
L<virt-v2v(1)>,
-L<qemu-nbd(1)>,
L<nbdkit(1)>, L<nbdkit-file-plugin(1)>,
L<ssh(1)>,
L<sshd(8)>,
--
2.19.1.3.g30247aa5d201