enable build for ocaml bytecode
by Olaf Hering
This is a first attempt to build libguestfs with just a ocaml bytecode
compiler. The three tools written in ocaml will be build only when an
ocamlopt compiler is available.
Olaf
---
Makefile.am | 5 ++++-
configure.ac | 2 ++
ocaml/Makefile.am | 20 +++++++++++++++++---
resize/Makefile.am | 2 +-
sparsify/Makefile.am | 2 +-
sysprep/Makefile.am | 2 +-
6 files changed, 26 insertions(+), 7 deletions(-)
Index: libguestfs-1.20.1/Makefile.am
===================================================================
--- libguestfs-1.20.1.orig/Makefile.am
+++ libguestfs-1.20.1/Makefile.am
@@ -74,7 +74,10 @@ if HAVE_PERL
SUBDIRS += perl perl/examples
endif
if HAVE_OCAML
-SUBDIRS += ocaml ocaml/examples
+SUBDIRS += ocaml
+endif
+if HAVE_OCAMLOPT
+SUBDIRS += ocaml/examples
endif
if HAVE_PYTHON
SUBDIRS += python python/examples
Index: libguestfs-1.20.1/configure.ac
===================================================================
--- libguestfs-1.20.1.orig/configure.ac
+++ libguestfs-1.20.1/configure.ac
@@ -865,6 +865,8 @@ AS_IF([test "x$enable_ocaml" != "xno"],
])
AM_CONDITIONAL([HAVE_OCAML],
[test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno"])
+AM_CONDITIONAL([HAVE_OCAMLOPT],
+ [test "x$OCAMLOPT" != "xno" && test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno"])
AM_CONDITIONAL([HAVE_OCAMLDOC],
[test "x$OCAMLDOC" != "xno"])
Index: libguestfs-1.20.1/ocaml/Makefile.am
===================================================================
--- libguestfs-1.20.1.orig/ocaml/Makefile.am
+++ libguestfs-1.20.1/ocaml/Makefile.am
@@ -43,10 +43,20 @@ CLEANFILES += t/*.cmi t/*.cmo t/*.cmx t/
if HAVE_OCAML
+DATA_HOOK_FILES = META *.so *.a *.cma \
+ *.cmi $(srcdir)/*.mli
+if HAVE_OCAMLOPT
+DATA_HOOK_FILES += *.cmx *.cmxa
+endif
+
OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX
OCAMLOPTFLAGS = $(OCAMLCFLAGS)
-noinst_DATA = mlguestfs.cma mlguestfs.cmxa META
+noinst_DATA = mlguestfs.cma
+if HAVE_OCAMLOPT
+noinst_DATA += mlguestfs.cmxa
+endif
+noinst_DATA += META
# Build the C part into a library, so that automake handles the C
# compilation step for us. Note that we don't directly use this
@@ -101,9 +111,13 @@ TESTS = run-bindtests \
$(patsubst %,%.opt,$(test_progs)))
noinst_DATA += \
- bindtests.bc bindtests.opt \
+ bindtests.bc
+if HAVE_OCAMLOPT
+noinst_DATA += \
+ bindtests.opt \
$(test_progs:%=%.bc) \
$(test_progs:%=%.opt)
+endif
bindtests.bc: bindtests.cmo mlguestfs.cma
mkdir -p t
@@ -217,7 +231,7 @@ install-data-hook:
$(OCAMLFIND) install \
-ldconf ignore -destdir $(DESTDIR)$(OCAMLLIB) \
guestfs \
- META *.so *.a *.cma *.cmx *.cmxa *.cmi $(srcdir)/*.mli
+ $(DATA_HOOK_FILES)
rm $(DESTDIR)$(OCAMLLIB)/guestfs/bindtests.*
rm $(DESTDIR)$(OCAMLLIB)/guestfs/libguestfsocaml.a
Index: libguestfs-1.20.1/resize/Makefile.am
===================================================================
--- libguestfs-1.20.1.orig/resize/Makefile.am
+++ libguestfs-1.20.1/resize/Makefile.am
@@ -40,7 +40,7 @@ SOURCES = \
resize_utils.ml \
resize_utils_tests.ml
-if HAVE_OCAML
+if HAVE_OCAMLOPT
# Note this list must be in dependency order.
OBJECTS = \
Index: libguestfs-1.20.1/sparsify/Makefile.am
===================================================================
--- libguestfs-1.20.1.orig/sparsify/Makefile.am
+++ libguestfs-1.20.1/sparsify/Makefile.am
@@ -36,7 +36,7 @@ SOURCES = \
sparsify_gettext.ml \
sparsify_utils.ml
-if HAVE_OCAML
+if HAVE_OCAMLOPT
# Note this list must be in dependency order.
OBJECTS = \
Index: libguestfs-1.20.1/sysprep/Makefile.am
===================================================================
--- libguestfs-1.20.1.orig/sysprep/Makefile.am
+++ libguestfs-1.20.1/sysprep/Makefile.am
@@ -86,7 +86,7 @@ SOURCES = \
utils.ml \
utils.mli
-if HAVE_OCAML
+if HAVE_OCAMLOPT
# Note this list must be in dependency order.
OBJECTS = \
10 years, 6 months
[PATCH] sysprep: handle distro specific sysv scripts
by Olaf Hering
Currently firstboot would only work on redhat-based images.
Handle redhat-based, suse-based and debian guests, error out in case of an
unknown distro.
Update firstboot.sh:
- make sure scripts exists and can be executed
- add LSB header to avoid insserv warnings later on
- run script only if called with "start"
Update functions, pass only required options.
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
diff --git a/sysprep/firstboot.ml b/sysprep/firstboot.ml
index 97cd8a9..c5296a1 100644
--- a/sysprep/firstboot.ml
+++ b/sysprep/firstboot.ml
@@ -28,14 +28,35 @@ let firstboot_dir = "/usr/lib/virt-sysprep"
let firstboot_sh = sprintf "\
#!/bin/sh -
+### BEGIN INIT INFO
+# Provides: virt-sysprep
+# Required-Start: $null
+# Should-Start: $all
+# Required-Stop: $null
+# Should-Stop: $all
+# Default-Start: 2 3 5
+# Default-Stop: 0 1 6
+# Short-Description: Start scripts to run once at next boot
+# Description: Start scripts to run once at next boot
+# These scripts run the first time the guest boots,
+# and then are deleted. Output or errors from the scripts
+# are written to ~root/virt-sysprep-firstboot.log.
+### END INIT INFO
+
d=%s/scripts
logfile=~root/virt-sysprep-firstboot.log
-for f in $d/* ; do
- echo '=== Running' $f '===' >>$logfile
- $f >>$logfile 2>&1
- rm $f
-done
+if test \"$1\" = \"start\"
+then
+ for f in $d/* ; do
+ if test -x \"$f\"
+ then
+ echo '=== Running' $f '===' >>$logfile
+ $f >>$logfile 2>&1
+ rm -f $f
+ fi
+ done
+fi
" firstboot_dir
let firstboot_service = sprintf "\
@@ -56,7 +77,7 @@ WantedBy=default.target
let failed fs =
ksprintf (fun msg -> failwith (s_"firstboot: failed: " ^ msg)) fs
-let rec install_service g root =
+let rec install_service g distro =
g#mkdir_p firstboot_dir;
g#mkdir_p (sprintf "%s/scripts" firstboot_dir);
g#write (sprintf "%s/firstboot.sh" firstboot_dir) firstboot_sh;
@@ -64,18 +85,18 @@ let rec install_service g root =
(* systemd, else assume sysvinit *)
if g#is_dir "/etc/systemd" then
- install_systemd_service g root
+ install_systemd_service g
else
- install_sysvinit_service g root
+ install_sysvinit_service g distro
(* Install the systemd firstboot service, if not installed already. *)
-and install_systemd_service g root =
+and install_systemd_service g =
g#write (sprintf "%s/firstboot.service" firstboot_dir) firstboot_service;
g#mkdir_p "/etc/systemd/system/default.target.wants";
g#ln_sf (sprintf "%s/firstboot.service" firstboot_dir)
"/etc/systemd/system/default.target.wants"
-and install_sysvinit_service g root =
+and install_sysvinit_redhat g =
g#mkdir_p "/etc/rc.d/rc2.d";
g#mkdir_p "/etc/rc.d/rc3.d";
g#mkdir_p "/etc/rc.d/rc5.d";
@@ -86,12 +107,51 @@ and install_sysvinit_service g root =
g#ln_sf (sprintf "%s/firstboot.sh" firstboot_dir)
"/etc/rc.d/rc5.d/99virt-sysprep-firstboot"
+(* Make firstboot.sh look like a runlevel script to avoid insserv warnings. *)
+and install_sysvinit_suse g =
+ g#mkdir_p "/etc/init.d/rc2.d";
+ g#mkdir_p "/etc/init.d/rc3.d";
+ g#mkdir_p "/etc/init.d/rc5.d";
+ g#ln_sf (sprintf "%s/firstboot.sh" firstboot_dir)
+ "/etc/init.d/virt-sysprep-firstboot";
+ g#ln_sf "../virt-sysprep-firstboot"
+ "/etc/init.d/rc2.d/S99virt-sysprep-firstboot";
+ g#ln_sf "../virt-sysprep-firstboot"
+ "/etc/init.d/rc3.d/S99virt-sysprep-firstboot";
+ g#ln_sf "../virt-sysprep-firstboot"
+ "/etc/init.d/rc5.d/S99virt-sysprep-firstboot"
+
+and install_sysvinit_debian g =
+ g#mkdir_p "/etc/init.d";
+ g#mkdir_p "/etc/rc2.d";
+ g#mkdir_p "/etc/rc3.d";
+ g#mkdir_p "/etc/rc5.d";
+ g#ln_sf (sprintf "%s/firstboot.sh" firstboot_dir)
+ "/etc/init.d/virt-sysprep-firstboot";
+ g#ln_sf "/etc/init.d/virt-sysprep-firstboot"
+ "/etc/rc2.d/S99virt-sysprep-firstboot";
+ g#ln_sf "/etc/init.d/virt-sysprep-firstboot"
+ "/etc/rc3.d/S99virt-sysprep-firstboot";
+ g#ln_sf "/etc/init.d/virt-sysprep-firstboot"
+ "/etc/rc5.d/S99virt-sysprep-firstboot"
+
+and install_sysvinit_service g distro =
+ match distro with
+ | ("fedora"|"rhel"|"centos"|"scientificlinux"|"redhat-based") ->
+ install_sysvinit_redhat g
+ | ("opensuse"|"sles"|"suse-based") ->
+ install_sysvinit_suse g
+ | "debian" ->
+ install_sysvinit_debian g
+ | _ ->
+ failed "guest type %s is not supported" distro
+
let add_firstboot_script g root id content =
let typ = g#inspect_get_type root in
let distro = g#inspect_get_distro root in
match typ, distro with
| "linux", _ ->
- install_service g root;
+ install_service g distro;
let t = Int64.of_float (Unix.time ()) in
let r = string_random8 () in
let filename = sprintf "%s/scripts/%Ld-%s-%s" firstboot_dir t r id in
--
1.7.12
10 years, 9 months
[PATCH] ssh: fix setting the username part
by Mike Kelly
Right now, we'd always be setting a NULL username.
---
src/drives.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/drives.c b/src/drives.c
index a13dd03..0e62ca8 100644
--- a/src/drives.c
+++ b/src/drives.c
@@ -1105,7 +1105,7 @@ guestfs___drive_source_qemu_param (guestfs_h *g, const struct drive_source *src)
CLEANUP_FREE char *username = NULL, *port = NULL;
if (src->username)
- username = safe_asprintf (g, "%s@", username);
+ username = safe_asprintf (g, "%s@", src->username);
if (src->servers[0].port != 0)
port = safe_asprintf (g, ":%d", src->servers[0].port);
--
1.7.9.5
11 years, 4 months
[PATCH] Fix make-fedora-img for btrfs minimum size
by Mike Kelly
This first factors out all the partition sizing, and then resizes the
images created to be 1GB instead of 512MB, to work around a size
limitation with btrfs:
mkfs_btrfs: /dev/vda2: device /dev/vda2 is too small (must be at least
256 MB)
11 years, 4 months
[PATCH] handle --use-installed in zypp driver
by Olaf Hering
An attempt to use installed files in zypp driver.
Add also a comment about the theory of operation.
Enable set -x in shell only in verbose mode.
This adds a dependency to xmlstarlet, which is required to parse zypper output.
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
---
src/supermin_zypp_rpm.ml | 93 +++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 80 insertions(+), 13 deletions(-)
diff --git a/src/supermin_zypp_rpm.ml b/src/supermin_zypp_rpm.ml
index 2089837..720f50a 100644
--- a/src/supermin_zypp_rpm.ml
+++ b/src/supermin_zypp_rpm.ml
@@ -18,6 +18,31 @@
(* Zypper and RPM support. *)
+(*
+ * Theory of operation:
+ * called as root:
+ * - without --use-installed:
+ * ->ph_resolve_dependencies_and_download() returns a list of filenames
+ * Need to download all packages into an empty --root directory so that
+ * zypper places all dependencies into --pkg-cache-dir
+ * - with --use-installed:
+ * ->ph_resolve_dependencies_and_download() returns a list of package names
+ * Need to work with an empty --root directory so that zypper can list
+ * all dependencies of "names". This mode assumes that all required packages
+ * are installed and the system is consistent. Downloading just the missing
+ * packages is not implemented.
+ * called as non-root:
+ * (Due to the usage of --root zypper does not require root permissions.)
+ * - without --use-installed:
+ * Same as above.
+ * - with --use-installed:
+ * Same as above.
+ *
+ * The usage of --packager-config is tricky: If --root is used zypper assumes
+ * that every config file is below <rootdir>. So the config has to be parsed
+ * and relevant files/dirs should be copied into <rootdir> so that zypper can
+ * use the specified config.
+ *)
open Unix
open Printf
@@ -34,15 +59,15 @@ let zypp_rpm_detect () =
Config.zypper <> "no" && Config.rpm <> "no"
let zypp_rpm_init () =
- if use_installed && Unix.getuid() > 0 then
- failwith "zypp_rpm driver doesn't support --use-installed when called as non-root user"
+ if use_installed then
+ eprintf "supermin: zypp_rpm driver assumes all packages are already installed when called with option --use-installed.\n%!"
-let zypp_rpm_resolve_dependencies_and_download names =
+let zypp_rpm_resolve_dependencies_and_download_no_installed names =
(* Liberate this data from shell. *)
let tmp_pkg_cache_dir = tmpdir // "pkg_cache_dir" in
let tmp_root = tmpdir // "root" in
let sh = sprintf "
-set -ex
+%s
unset LANG ${!LC_*}
tmpdir=%S
cache_dir=\"${tmpdir}/cache-dir\"
@@ -60,6 +85,7 @@ time zypper \
--download-only \
$@
"
+ (if verbose then "set -x" else "")
tmpdir
tmp_pkg_cache_dir
(if verbose then "--verbose --verbose" else "--quiet")
@@ -96,10 +122,47 @@ time zypper \
(* Return list of package filenames. *)
pkgs
+let zypp_rpm_resolve_dependencies_and_download_use_installed names =
+ let cmd = sprintf "
+%s
+unset LANG ${!LC_*}
+zypper \
+ %s \
+ %s \
+ --root %S --reposd-dir /dev/shm/supermin/zypp/repos.d \
+ --cache-dir %S \
+ --gpg-auto-import-keys \
+ --non-interactive \
+ --xml \
+ install \
+ --auto-agree-with-licenses \
+ --dry-run \
+ %s | \
+ xml sel -t \
+ -m \"stream/install-summary/to-install/solvable[%@type='package']\" \
+ -c \"string(%@name)\" -n
+"
+ (if verbose then "set -x" else "")
+ (if verbose then "--verbose --verbose" else "--quiet")
+ (match packager_config with None -> ""
+ | Some filename -> sprintf "--config %s" filename)
+ tmpdir tmpdir (String.concat " " (List.map Filename.quote names)) in
+ let pkg_names = run_command_get_lines cmd in
+
+ (* Return list of package names, remove empty lines. *)
+ List.filter (fun s -> s <> "") pkg_names
+
+let zypp_rpm_resolve_dependencies_and_download names =
+ if use_installed then
+ zypp_rpm_resolve_dependencies_and_download_use_installed names
+ else
+ zypp_rpm_resolve_dependencies_and_download_no_installed names
+
let rec zypp_rpm_list_files pkg =
(* Run rpm -qlp with some extra magic. *)
let cmd =
- sprintf "rpm -q --qf '[%%{FILENAMES} %%{FILEFLAGS:fflags} %%{FILEMODES} %%{FILESIZES}\\n]' -p %S"
+ sprintf "rpm -q --qf '[%%{FILENAMES} %%{FILEFLAGS:fflags} %%{FILEMODES} %%{FILESIZES}\\n]' %s %S"
+ (if use_installed then "" else "-p")
pkg in
let lines = run_command_get_lines cmd in
@@ -153,14 +216,18 @@ let rec zypp_rpm_list_files pkg =
files
let zypp_rpm_get_file_from_package pkg file =
- debug "extracting %s from %s ..." file (Filename.basename pkg);
-
- let outfile = tmpdir // file in
- let cmd =
- sprintf "umask 0000; rpm2cpio %s | (cd %s && cpio --quiet -id .%s)"
- (Filename.quote pkg) (Filename.quote tmpdir) (Filename.quote file) in
- run_command cmd;
- outfile
+ if use_installed then
+ file
+ else (
+ debug "extracting %s from %s ..." file (Filename.basename pkg);
+
+ let outfile = tmpdir // file in
+ let cmd =
+ sprintf "umask 0000; rpm2cpio %s | (cd %s && cpio --quiet -id .%s)"
+ (Filename.quote pkg) (Filename.quote tmpdir) (Filename.quote file) in
+ run_command cmd;
+ outfile
+ )
let () =
let ph = {
11 years, 4 months
[PATCH] Build and test Perl bindings out-of-tree.
by Hilko Bengen
Remaining issue: The C file that is generated from XS is still built
in the source directory
---
configure.ac | 1 +
perl/Makefile.PL.in | 2 +-
perl/Makefile.am | 16 ++++++++++++----
perl/run-perl-tests | 21 ---------------------
perl/run-perl-tests.in | 21 +++++++++++++++++++++
5 files changed, 35 insertions(+), 26 deletions(-)
delete mode 100755 perl/run-perl-tests
create mode 100755 perl/run-perl-tests.in
diff --git a/configure.ac b/configure.ac
index 298e6a9..b398fcb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -548,6 +548,7 @@ AC_CONFIG_FILES([Makefile
sh/Makefile
xml/Makefile])
AC_CONFIG_FILES([python/run-python-tests], [chmod +x python/run-python-tests])
+AC_CONFIG_FILES([perl/run-perl-tests], [chmod +x perl/run-perl-tests])
AC_OUTPUT
dnl Produce summary.
diff --git a/perl/Makefile.PL.in b/perl/Makefile.PL.in
index 77b4a0e..ce97579 100644
--- a/perl/Makefile.PL.in
+++ b/perl/Makefile.PL.in
@@ -19,7 +19,7 @@ use Config;
use ExtUtils::MakeMaker;
WriteMakefile (
- FIRST_MAKEFILE => 'Makefile-pl',
+ FIRST_MAKEFILE => '@abs_builddir@/Makefile-pl',
NAME => 'Win::Hivex',
VERSION => '@PACKAGE_VERSION@',
diff --git a/perl/Makefile.am b/perl/Makefile.am
index 22dd98c..ec49192 100644
--- a/perl/Makefile.am
+++ b/perl/Makefile.am
@@ -42,16 +42,24 @@ TESTS = run-perl-tests
$(TESTS): src_deps all
TESTS_ENVIRONMENT = \
- LD_LIBRARY_PATH=$(top_builddir)/lib/.libs
+ LD_LIBRARY_PATH=$(top_builddir)/lib/.libs \
+ srcdir=$(abs_srcdir)
INSTALLDIRS = site
all: Makefile-pl src_deps
- $(MAKE) -f Makefile-pl
+ $(MAKE) -C $(srcdir) -f $(abs_builddir)/Makefile-pl \
+ INST_ARCHLIB=$(abs_builddir)/blib/arch \
+ INST_SCRIPT=$(abs_builddir)/blib/script \
+ INST_BIN=$(abs_builddir)/blib/bin \
+ INST_LIB=$(abs_builddir)/blib/lib \
+ INST_MAN1DIR=$(abs_builddir)/blib/man1 \
+ INST_MAN3DIR=$(abs_builddir)/blib/man3 \
+ TEST_FILES=$(abs_srcdir)/t/*.t
Makefile-pl: Makefile.PL
- -[ $(srcdir) != $(builddir) ] && cp -rsu $(abs_srcdir)/. $(builddir)/.
- perl Makefile.PL INSTALLDIRS=$(INSTALLDIRS) PREFIX=$(prefix)
+ cd $(srcdir); perl $(abs_builddir)/Makefile.PL INSTALLDIRS=$(INSTALLDIRS) PREFIX=$(prefix)
+ sed -i 's,Makefile.PL,$(abs_builddir)/Makefile.PL,' $@
# No! Otherwise it is deleted before the clean-local rule runs.
#CLEANFILES = Makefile-pl
diff --git a/perl/run-perl-tests b/perl/run-perl-tests
deleted file mode 100755
index 770df94..0000000
--- a/perl/run-perl-tests
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh -
-# hivex Perl bindings
-# Copyright (C) 2009-2010 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-set -e
-
-make -f Makefile-pl test "$@"
diff --git a/perl/run-perl-tests.in b/perl/run-perl-tests.in
new file mode 100755
index 0000000..46f067c
--- /dev/null
+++ b/perl/run-perl-tests.in
@@ -0,0 +1,21 @@
+#!/bin/sh -
+# hivex Perl bindings
+# Copyright (C) 2009-2010 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+set -e
+
+make -C @srcdir@ -f @abs_builddir@/Makefile-pl test "$@"
--
1.7.10.4
11 years, 4 months
Making the tests faster
by Richard W.M. Jones
Currently 'make check' takes 23 minutes (at least) to run on my shiny
new laptop. I'd like to make this faster because I spend a lot of
time waiting for them to finish, but first here's an analysis of time
spent now.
Build the test guests:
[only happens once, as long as you don't make clean]:
tests/guests: 72 seconds
Test gnulib:
gnulib: 13 seconds
Testing the API (about 12 minutes in total):
tests/qemu: 13 seconds
tests/c-api: 277
tests/protocol: 16
tests/disks: 90
tests/mountable: 20
tests/lvm: 10
tests/luks: 53
tests/md: 88
tests/selinux: 13
tests/ntfsclone: 10
tests/rsync: 10
tests/disk-labels: 4
tests/hotplug: 20
tests/nbd: 15
tests/syslinux: 10
tests/regressions: 62
[tests/btrfs skipped by local configuration]
[tests/mount-local skipped by local configuration]
Testing guestfish and bindings (about 6 minutes):
fish: 70 seconds
perl: 15
ocaml: 190
python: 5
ruby: 10
java: 5
haskell: 4
php: 7
erlang: 10
lua: 29
gobject: 10
Testing tools (about 5 minutes):
align: 12 seconds
cat: 40
df: 16
edit: 27
format: 17
inspector: 19
rescue: 4
resize: 29
sparsify: 69
sysprep: 29
tools: 17
fuse: 20
Test environment:
libguestfs 1.21.33
libvirt 1.0.3 backend
qemu 1.0.4
Fedora 19
Intel Core i7-3520M
Hard disk (not SSD)
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
11 years, 4 months
launch failure of appliance with nbd drive
by Skippy VonDrake
I'm using qemu-nbd to setup the device with an offset
into the image. Using libguestfs version 1.21.22
Code for adding the drive:
char *server[] = { "localhost:3000", NULL };
if (guestfs_add_drive_opts (g, "" /* export name - see below */,
GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "nbd",
GUESTFS_ADD_DRIVE_OPTS_SERVER, server,
-1)
Here is some of the stdout. A mix of libguestfs and
qemu-nbd messages.
qemu-nbd -v -n -o 77824 -t -p 3000 -c /dev/nbd0
/home/skippy/mnt/mnt0/win7x64amdHP.vdi
NBD device /dev/nbd0 is now connected to /home/skippy/mnt/mnt0/win7x64amdHP.vdi
libguestfs: launch: attach-method=appliance
libguestfs: launch: tmpdir=/tmp/libguestfsLFMzZI
libguestfs: launch: umask=0022
libguestfs: launch: euid=0
libguestfs: [00000ms] begin testing qemu features
libguestfs: command: run: /usr/bin/qemu-system-x86_64
libguestfs: command: run: \ -nographic
libguestfs: command: run: \ -help
libguestfs: command: run: /usr/bin/qemu-system-x86_64
libguestfs: command: run: \ -nographic
libguestfs: command: run: \ -version
libguestfs: qemu version 1.2
libguestfs: command: run: /usr/bin/qemu-system-x86_64
libguestfs: command: run: \ -nographic
libguestfs: command: run: \ -machine accel=kvm:tcg
libguestfs: command: run: \ -device ?
libguestfs: [00131ms] finished testing qemu features
\ libguestfs: child_cleanup: 0xbc4ba0: child process died
libguestfs: sending SIGTERM to process 23981
libguestfs: closing guestfs handle 0xbc4ba0 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfsLFMzZI
skippy@DaneelOlivaw:~/tmp/bin$
/build/buildd/qemu-kvm-1.2.0+noroms/nbd.c:nbd_trip():L835: From:
18446744073709551104, Len: 0, Size: 20003880960, Offset: 77824
/build/buildd/qemu-kvm-1.2.0+noroms/nbd.c:nbd_trip():L836: requested
operation past EOF--bad client?
/build/buildd/qemu-kvm-1.2.0+noroms/nbd.c:nbd_receive_request():L516:
read failed
So I peppered some fprintfs in launch-appliance.c to try and narrow
down the problem. Just below the comment:
* does not mean the daemon is up until we read the
* GUESTFS_LAUNCH_FLAG below. Failures in qemu startup can still
Is the call where it fails:
r = guestfs___recv_from_daemon (g, &size, &buf);
r is -1 and size is zero
How can I debug this problem further?
I suppose I could build/debug the qemu side of this process...
-Skippy
11 years, 4 months