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, 8 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, 11 months
[PATCH] sysprep: rhn_systemid: delete osad-auth.conf file in RHN
by Nicholas Strugnell
From 3d321e22fc34f828fdc9cb7a0f503d1bdcf982c3 Mon Sep 17 00:00:00 2001
From: Nicholas Strugnell <nstrug(a)redhat.com>
Date: Wed, 31 Jul 2013 16:24:20 +0100
Subject: [PATCH] sysprep: rhn_systemid: delete osad-auth.conf file in RHN
configuration
---
sysprep/sysprep_operation_rhn_systemid.ml | 1 +
1 file changed, 1 insertion(+)
diff --git a/sysprep/sysprep_operation_rhn_systemid.ml b/sysprep/sysprep_operation_rhn_systemid.ml
index 99ab5e1..6ccf5af 100644
--- a/sysprep/sysprep_operation_rhn_systemid.ml
+++ b/sysprep/sysprep_operation_rhn_systemid.ml
@@ -28,6 +28,7 @@ let rhn_systemid_perform g root =
match typ, distro with
| "linux", "rhel" ->
(try g#rm "/etc/sysconfig/rhn/systemid" with G.Error _ -> ());
+ (try g#rm "/etc/sysconfig/rhn/osad-auth.conf" with G.Error _ -> ());
[]
| _ -> []
--
1.8.3.1
--
Principal Architect, Europe
M: +44 7736 665171
nstrug(a)redhat.com
11 years, 3 months
new buildtime dependency qemu-img
by Olaf Hering
After the upgrade from 1.20.9 to .10 my libguestfs package fails to
build because qemu-img is not installed. Since qemu is not a hard
requirement to build a package I wonder how to fix the tests/data rules
so that the targets which call qemu-img depend on "make test" or
whatever requires the generated files.
Olaf
11 years, 3 months
Re: [Libguestfs] [libvirt-users] Resize errors with virt-resize/vgchange
by Eric Blake
On 07/21/2013 07:01 PM, Alex wrote:
> Hi,
>
> I have an fc18 system and trying to resize an LVM partition with an
> ext4 filesystem and receiving the following message from virt-resize:
virt-resize is part of libguestfs, which is layered on top of libvirt.
As such, I'm redirecting this mail to the libguestfs mailing list.
>
> # virt-resize -d --expand /dev/sda1 --LV-expand /dev/mapper/prop-home
> prop-1.img prop-expand.img
> command line: virt-resize -d --expand /dev/sda1 --LV-expand
> /dev/mapper/prop-home prop-1.img prop-expand.img
> Examining prop-1.img ...
> libguestfs: trace: add_drive "prop-1.img" "readonly:true"
> libguestfs: trace: add_drive = 0
> libguestfs: trace: add_drive "prop-expand.img" "readonly:false"
> libguestfs: trace: add_drive = 0
> libguestfs: trace: launch
> libguestfs: trace: get_tmpdir
> libguestfs: trace: get_tmpdir = "/tmp"
> libguestfs: trace: get_cachedir
> libguestfs: trace: get_cachedir = "/var/tmp"
> libguestfs: trace: disk_format "/var/lib/libvirt/images/prop-expand.img"
> libguestfs: trace: disk_format = "raw"
> libguestfs: trace: get_cachedir
> libguestfs: trace: get_cachedir = "/var/tmp"
> [...] 100% --:--
> libguestfs: trace: launch = 0
> libguestfs: trace: lvm_set_filter "/dev/sda"
> libguestfs: trace: lvm_set_filter = -1 (error)
> Fatal error: exception Guestfs.Error("lvm_set_filter: vgchange:
> Couldn't find device with uuid zouQ8X-qxqJ-mp6p-pzg3-mi2i-K9YM-A763Kc.
> Refusing activation of partial LV home. Use --partial to override.
> Refusing activation of partial LV swap. Use --partial to override.
> R
> libguestfs: trace: close
> libguestfs: trace: internal_autosync
> libguestfs: trace: internal_autosync = 0
>
> I don't understand this error message. I also see that vgchange
> doesn't even have a 'partial' option, so I'm not sure how to
> troubleshoot it. Here is the filesystem layout for this system:
>
> # df -h
> Filesystem Size Used Avail Use% Mounted on
> devtmpfs 7.9G 0 7.9G 0% /dev
> tmpfs 7.9G 0 7.9G 0% /dev/shm
> tmpfs 7.9G 3.9M 7.9G 1% /run
> tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
> /dev/mapper/prop-root 15G 7.4G 6.3G 55% /
> tmpfs 7.9G 0 7.9G 0% /tmp
> /dev/mapper/prop-boot 477M 95M 358M 21% /boot
> /dev/mapper/prop-home 222G 212G 9.9G 96% /home
>
> The image is the 222G /home partition only. The other partitions are
> on another image.
>
> Any ideas how to troubleshoot this would be greatly appreciated.
> Thanks,
> Alex
>
> _______________________________________________
> libvirt-users mailing list
> libvirt-users(a)redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-users
>
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
11 years, 3 months
W/ commit 4d2c63a9bc3accd7b852b1c8b2089c6296fee156: supermin fails to create temporary dir
by Kashyap Chamarthy
That's the current commit head I am at (on 'master' branch):
$ git log | head -2
commit 4d2c63a9bc3accd7b852b1c8b2089c6296fee156
Author: Richard W.M. Jones <rjones(a)redhat.com>
I invoked:
$ git pull ; ./autogen.sh && make clean && make -j 7 \
&& time make -k extra-tests LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1 \
| tee /var/tmp/make-extra-check-libguestfs-24-may.log
.
.
.
.
extracting /usr/lib64/gconv/gconv-modules from glibc-2.17-11.fc19.x86_64.rpm ...
Fatal error: exception Unix.Unix_error(8, "mkdir",
"/tmp/supermin66a2e1c4c95a0e7fb53c3122f449b299.tmp/root//var/run")
make[2]: *** [stamp-supermin] Error 2
make[2]: Leaving directory `/home/kashyap/src/libguestfs/appliance'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/kashyap/src/libguestfs'
make: *** [all] Error 2
Hints?
--
/kashyap
11 years, 3 months
Libguestfs under win32
by Or Goshen
Hi,
Under windows QEMU write its output to stderr.txt and stdout.txt. The
"configure" script expects the out put to be written to the console and
fails to detect a working QEMU.
Is there a way to handle this ?
Thanks,
Or
11 years, 3 months