Re: [Libguestfs] libguestfs powerpc package
by Richard W.M. Jones
[Please keep message on the list]
On Mon, Sep 30, 2013 at 12:58:38AM +0200, Roberto Innocenti wrote:
> [libguestfs on ppc]
You should be able to compile from the latest source on ppc64, since I
spent some time a few weeks ago getting it to work:
http://comments.gmane.org/gmane.linux.redhat.fedora.virtualization/2268
Start with git (not 1.22), read the README file, and let us know on
the mailing list what precise errors you get when you try to compile it.
Note you'll require the latest supermin (from git) first, and qemu
from git, and IIRC there was an endianness bug in hivex too which is
fixed in git. The latest hivex isn't required unless you're doing
Widows guest inspection.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
10 years, 7 months
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, 9 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
Request to relicense hash gnulib module to LGPLv2+
by Richard W.M. Jones
libguestfs (an LGPLv2+ library) uses the 'hash' module, which turns
out to be "GPL".
Actually this happened because we started to use it in a separate
GPL'd utility program, but later on included this functionality in the
core library, copying the same code from the utility but not checking
the license of 'hash'.
We'd therefore like to request that 'hash' is relicensed as LGPLv2+.
If this is not possible, we will have to rewrite the code, probably
implementing our own hash table, which would be a shame because hash
works well for our needs.
Notes:
- the code doesn't appear to call exit (it does call abort), and so
seems to be suitable for a library
- hash-pjw which we also use is already licensed as LGPLv2+
- it looks like the original author was Jim Meyering (CC'd)
- the dependencies are all LGPLv2+
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
11 years
[PATCH 1/5] sysprep: remove tmp files
by Wanlong Gao
This removes tmp files under /tmp and /var/tmp.
Signed-off-by: Wanlong Gao <gaowanlong(a)cn.fujitsu.com>
---
sysprep/Makefile.am | 1 +
sysprep/sysprep_operation_tmp_files.ml | 52 ++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+)
create mode 100644 sysprep/sysprep_operation_tmp_files.ml
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index fcd17fc..b89345a 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
@@ -65,6 +65,7 @@ operations = \
ssh_hostkeys \
ssh_userdir \
sssd_db_log \
+ tmp_files \
udev_persistent_net \
user_account \
utmp yum_uuid
diff --git a/sysprep/sysprep_operation_tmp_files.ml b/sysprep/sysprep_operation_tmp_files.ml
new file mode 100644
index 0000000..a2187df
--- /dev/null
+++ b/sysprep/sysprep_operation_tmp_files.ml
@@ -0,0 +1,52 @@
+(* virt-sysprep
+ * Copyright (C) 2013 Fujitsu Limited.
+ *
+ * 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 Sysprep_operation
+open Common_gettext.Gettext
+
+module G = Guestfs
+
+let tmp_files_perform g root =
+ let typ = g#inspect_get_type root in
+ if typ <> "windows" then (
+ let paths = [ "/tmp/*";
+ "/var/tmp/*"; ] in
+ List.iter (
+ fun path ->
+ let files = g#glob_expand path in
+ Array.iter (
+ fun file ->
+ g#rm_rf file;
+ ) files;
+ ) paths;
+
+ []
+ )
+ else []
+
+let op = {
+ defaults with
+ name = "tmp-files";
+ enabled_by_default = true;
+ heading = s_"Remove the tmp files";
+ pod_description = Some (s_"\
+This removes the temporary files under C</tmp> and C</var/tmp>.");
+ perform_on_filesystems = Some tmp_files_perform;
+}
+
+let () = register_operation op
--
1.8.4.27.g0a41de8
11 years, 1 month
Hivex - Trailing garbage at the end of hive file
by Richard W.M. Jones
[Forwarding to the proper list]
We use hivex for one of our projects and I see the following diff committed to the hivex project (source link provided) that ignores trailing garbage. But this code has been reverted to no ignore this condition in later version of hivex
- /* This error is seemingly common in uncorrupt registry files. */
- /*
- fprintf (stderr, "hivex: %s: ignoring trailing garbage at end of file (at %zu, after %zu pages)\n",
- filename, off, h->pages);
- */
+ /* NB: This error is seemingly common in uncorrupt registry files. */
+ if (h->msglvl >= 2)
+ fprintf (stderr, "hivex: %s: ignoring trailing garbage at end of file (at %zu, after %zu pages)\n",
+ filename, off, h->pages);
Break;
http://git.annexia.org/?p=hivex.git;a=commitdiff;h=5439842dc591accbf620a5...
In your experience, is this a common condition seen in some windows hive files and is it safe to ignore when this condition is encountered?
Thanks
~ Hari
---------
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
11 years, 1 month
[PATCH] build: fix errors when compiling man-pages
by Martin Kletzander
I'm not sure whether this is the best fix, but it makes the build
pass.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
Notes:
The configure was called like this:
./autogen.sh --disable-appliance --disable-daemon --with-readline --disable-php --enable-python --enable-perl --disable-haskell --disable-ruby --enable-gobject --enable-probes --enable-lua --disable-erlang --without-java
And this is a snip from the failed run of 'make -j5':
make[3]: Entering directory `/home/nert/dev/work/libguestfs/upstream/po-docs/ja'
perl /home/nert/dev/work/libguestfs/upstream/podwrapper.pl \
--no-strict-checks \
--man virt-list-filesystems.1 \
virt-list-filesystems.pl
perl /home/nert/dev/work/libguestfs/upstream/podwrapper.pl \
--no-strict-checks \
--man virt-list-partitions.1 \
virt-list-partitions.pl
perl /home/nert/dev/work/libguestfs/upstream/podwrapper.pl \
--no-strict-checks \
--man virt-make-fs.1 \
virt-make-fs.pl
perl /home/nert/dev/work/libguestfs/upstream/podwrapper.pl \
--no-strict-checks \
--man virt-tar.1 \
virt-tar.pl
perl /home/nert/dev/work/libguestfs/upstream/podwrapper.pl \
--no-strict-checks \
--man virt-win-reg.1 \
virt-win-reg.pl
podwrapper.pl: virt-list-filesystems.pl: No such file or directory at /home/nert/dev/work/libguestfs/upstream/podwrapper.pl line 533.
podwrapper.pl: virt-tar.pl: No such file or directory at /home/nert/dev/work/libguestfs/upstream/podwrapper.pl line 533.
make[3]: *** [virt-list-filesystems.1] Error 2
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [virt-tar.1] Error 2
podwrapper.pl: virt-make-fs.pl: No such file or directory at /home/nert/dev/work/libguestfs/upstream/podwrapper.pl line 533.
make[3]: *** [virt-make-fs.1] Error 2
podwrapper.pl: virt-win-reg.pl: No such file or directory at /home/nert/dev/work/libguestfs/upstream/podwrapper.pl line 533.
make[3]: *** [virt-win-reg.1] Error 2
podwrapper.pl: virt-list-partitions.pl: No such file or directory at /home/nert/dev/work/libguestfs/upstream/podwrapper.pl line 533.
make[3]: *** [virt-list-partitions.1] Error 2
make[3]: Leaving directory `/home/nert/dev/work/libguestfs/upstream/po-docs/ja'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/nert/dev/work/libguestfs/upstream/po-docs'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/nert/dev/work/libguestfs/upstream'
make: *** [all] Error 2
po-docs/ja/Makefile.am | 8 +++++++-
po-docs/uk/Makefile.am | 8 +++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/po-docs/ja/Makefile.am b/po-docs/ja/Makefile.am
index 0ec6619..f985adf 100644
--- a/po-docs/ja/Makefile.am
+++ b/po-docs/ja/Makefile.am
@@ -1,5 +1,5 @@
# libguestfs translations of man pages and POD files
-# Copyright (C) 2010-2012 Red Hat Inc.
+# Copyright (C) 2010-2013 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
@@ -136,6 +136,12 @@ virt-sysprep.1: virt-sysprep.pod sysprep-extra-options.pod sysprep-operations.po
--man $@ \
$<
+%.1: $(top_srcdir)/tools/%
+ $(PODWRAPPER) \
+ --no-strict-checks \
+ --man $@ \
+ $<
+
# Ensure that the first time we build from git, since guestfs.pod
# hasn't been built yet, build it.
$(podfiles): stamp-update-po
diff --git a/po-docs/uk/Makefile.am b/po-docs/uk/Makefile.am
index 0ec6619..f985adf 100644
--- a/po-docs/uk/Makefile.am
+++ b/po-docs/uk/Makefile.am
@@ -1,5 +1,5 @@
# libguestfs translations of man pages and POD files
-# Copyright (C) 2010-2012 Red Hat Inc.
+# Copyright (C) 2010-2013 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
@@ -136,6 +136,12 @@ virt-sysprep.1: virt-sysprep.pod sysprep-extra-options.pod sysprep-operations.po
--man $@ \
$<
+%.1: $(top_srcdir)/tools/%
+ $(PODWRAPPER) \
+ --no-strict-checks \
+ --man $@ \
+ $<
+
# Ensure that the first time we build from git, since guestfs.pod
# hasn't been built yet, build it.
$(podfiles): stamp-update-po
--
1.8.3.2
11 years, 2 months
[PATCH 0/4] Add SUSE guest converter to virt-v2v
by Mike Latimer
This is a new conversion module to convert SUSE Linux and openSUSE guests.
The converter is based on the RedHat module, and should offer the same
functionality on both SUSE and RedHat hosts.
There are a few additional messages in this module, such as reporting of
packages when installing through zypper or the local virt-v2v repo. These
messages don't necessarily flow unless verbose switches are used - included
in a patch I posted earlier, and a slightly newer version include here for
convenience.
It is also worth noting that this module does not require any changes on the
SUSE guest. (grubby is not used during SUSE conversions.)
Feedback is welcome (particularly on my virt-v2v.db and messaging changes).
-Mike
Mike Latimer (4):
Add SUSE support documentation to virt-v2v
Add SUSE capabilities
Add SUSE converter
Add verbose logging switches to virt-v2v
MANIFEST | 1 +
lib/Sys/VirtConvert/Converter/SUSE.pm | 2527 +++++++++++++++++++++++++++++++++
v2v/virt-v2v.conf | 8 +
v2v/virt-v2v.db | 61 +
v2v/virt-v2v.pl | 61 +-
5 files changed, 2655 insertions(+), 3 deletions(-)
create mode 100644 lib/Sys/VirtConvert/Converter/SUSE.pm
--
1.8.1.4
11 years, 2 months
[PATCH 0/1] virt-v2v: Track hd->sd block device remaps
by Mike Latimer
During the conversion process, hd* block devices under Xen are mapped
to sd* devices for use under guestfs. These sd devices are later
remapped to vd* (or sd/hd) devices, for future use under kvm.
The current code fails to track the original hd* device names. This
causes subsequent remappings of the block devices (in such places as
/etc/fstab, and /boot/grub/menu.lst), to skip the hd* devices, which
leads to a later failure of the guest.
This patch adds a hash to track the hd->sd remap, and later uses that
hash to add hd->vd maps to the table.
Mike Latimer (1):
Track hd sd block device remaps
lib/Sys/VirtConvert/Converter/RedHat.pm | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
--
1.8.1.4
11 years, 2 months