libguestfs.git
13 years agofish: More informative documentation of optargs.
Richard W.M. Jones [Wed, 9 Nov 2011 21:21:00 +0000 (21:21 +0000)]
fish: More informative documentation of optargs.
(cherry picked from commit 271f8e4b70e4acf2db96f6fe6317fda327fa5f2e)

13 years agoocaml: Compile OCaml bindings and tests with -warn-error.
Richard W.M. Jones [Wed, 9 Nov 2011 17:53:58 +0000 (17:53 +0000)]
ocaml: Compile OCaml bindings and tests with -warn-error.
(cherry picked from commit 145ed04e41a3fcd3be87c11cae0085f4551f1da8)

13 years agodaemon: Don't use files with fixed names in /tmp (thanks Steve Kemp).
Richard W.M. Jones [Fri, 4 Nov 2011 15:30:12 +0000 (15:30 +0000)]
daemon: Don't use files with fixed names in /tmp (thanks Steve Kemp).

Although this doesn't matter for the ordinary (appliance) case, it
matters for the libguestfs live case.  In that case it could cause the
guest to be exploited by a tmp/symlink attack.
(cherry picked from commit 6011b1f803ba7308c6a94b9bf6b7212cfccb9f42)

13 years agoresize: Add tests for some Utils functions.
Richard W.M. Jones [Thu, 3 Nov 2011 10:32:02 +0000 (10:32 +0000)]
resize: Add tests for some Utils functions.

(Cherry picked from commit 63898268101e5ec91c8dac46651dbee5976272ce
and modified for stable-1.12 branch.)

13 years agopython: Use sys.version_info[0] instead of sys.version_info.major.
Richard W.M. Jones [Thu, 3 Nov 2011 09:48:45 +0000 (09:48 +0000)]
python: Use sys.version_info[0] instead of sys.version_info.major.

The major/minor fields only exist in Python >= 2.7.  This works for at
least Python 2.5 and 2.6.

Thanks to Hilko Bengen.

This updates commit 646142f5136da9cfe2b908703a822c53350f70e9.
(cherry picked from commit 31e5539a14f78d8815d0d930e91023a65b5395e7)

13 years agopython: Pass $PYTHON environment variable to tests.
Richard W.M. Jones [Wed, 2 Nov 2011 19:42:29 +0000 (19:42 +0000)]
python: Pass $PYTHON environment variable to tests.

If the user set PYTHON when configuring, this variable is not passed
through to the tests, so it is possible the tests will fail because
they are testing the wrong version of python.  By passing $PYTHON
through to the tests we ensure that we test against the same version
of python that we configured with.

(cherry picked from commit e2249b7ce1dd0a2f8f110e0e47aca397185a6373)

13 years agopython: Include <config.h>.
Richard W.M. Jones [Wed, 2 Nov 2011 18:19:15 +0000 (18:19 +0000)]
python: Include <config.h>.

Ooops ...
(cherry picked from commit 25454b83082a4cfed4f1664d2f9cdfcb222ba7c2)

13 years agopython: Correctly check for Python major/minor.
Richard W.M. Jones [Wed, 2 Nov 2011 18:18:14 +0000 (18:18 +0000)]
python: Correctly check for Python major/minor.

The manual for sys.version warns that you should not parse the string,
which we were doing.  It would have failed on python "2.10" or
similar.

Do it correctly using the sys.version_info struct instead.
(cherry picked from commit 646142f5136da9cfe2b908703a822c53350f70e9)

13 years agofish: Use size_t instead of int when counting strings.
Richard W.M. Jones [Tue, 1 Nov 2011 09:47:01 +0000 (09:47 +0000)]
fish: Use size_t instead of int when counting strings.
(cherry picked from commit b4da051d54a1597c7d8db8880d21a52265a6172e)

13 years agoFix debug help error message.
Matthew Booth [Mon, 31 Oct 2011 16:47:50 +0000 (16:47 +0000)]
Fix debug help error message.

When given an invalid debug command, libguestfs responds with the
error message:

  libguestfs: error: debug: use 'debug help' to list the supported commands

However this command does not work, as debug requires two
arguments. This change updates the message to prompt the user to use
'debug help 0'.
(cherry picked from commit 4e3a1205ebfec1a5cbc3062d6f73a684090e80b5)

13 years agoappliance: Add 'mdadm' package.
Richard W.M. Jones [Mon, 31 Oct 2011 16:44:55 +0000 (16:44 +0000)]
appliance: Add 'mdadm' package.
(cherry picked from commit 6f84ef6768e9c625d67f7eb015277b0ec1b2c2af)

13 years agoVersion 1.12.9. 1.12.9
Richard W.M. Jones [Mon, 31 Oct 2011 11:23:24 +0000 (11:23 +0000)]
Version 1.12.9.

13 years agoperl: Add %guestfs_introspection hash with introspection information.
Richard W.M. Jones [Thu, 27 Oct 2011 16:40:31 +0000 (17:40 +0100)]
perl: Add %guestfs_introspection hash with introspection information.

Because this is a useful introspection API, it is a candidate for
being backported into older stable branches.
(cherry picked from commit 365885dab2ae6dcdf0b2c45d0adeb803ade03f63)

13 years agofuse: Skip guestmount test if setfacl is not installed.
Richard W.M. Jones [Thu, 27 Oct 2011 12:44:02 +0000 (13:44 +0100)]
fuse: Skip guestmount test if setfacl is not installed.

This dependency is optional, don't fail the test if it's not
installed.
(cherry picked from commit 7b44f7b3df0b20b2b5e889d89e82a35eed20d43e)

13 years agotest-user-cancel: Make this test choose smaller cancellation numbers.
Richard W.M. Jones [Wed, 26 Oct 2011 14:55:29 +0000 (15:55 +0100)]
test-user-cancel: Make this test choose smaller cancellation numbers.

Use a Gaussian distribution for random numbers so that smaller numbers
are chosen more frequently.

This also exposes a bug in this test which only happens when small
numbers are chosen:

If the test thread starts up quickly, it can get to
guestfs_user_cancel before the guestfs_upload command has happened in
the main thread.  This causes the cancel to be ignored (correctly) and
we end up in the second loop writing data until the disk runs out of
space.  Fix this by repeatedly asserting the cancel flag in the second
loop.
(cherry picked from commit 62909197d120c01cc86095518aacca9d4ad268dd)

13 years agoFlush stdout for progress bars used by guestfish, virt-resize.
Richard W.M. Jones [Wed, 26 Oct 2011 12:55:38 +0000 (13:55 +0100)]
Flush stdout for progress bars used by guestfish, virt-resize.
(cherry picked from commit 178a6d78a84a82cfddbf17678c8c8c2a9d9d0dd2)

13 years agoocaml: Make sure virt-resize is rebuilt if Guestfs API changes.
Richard W.M. Jones [Tue, 25 Oct 2011 13:14:35 +0000 (14:14 +0100)]
ocaml: Make sure virt-resize is rebuilt if Guestfs API changes.

Add a dependency so this tool is rebuilt from scratch if the
Guestfs API changes.  This prevents the error:
"[...] make inconsistent assumptions over interface Guestfs".

This commit includes the generated changes to .depend files.
(cherry picked from commit 663b99950daeaa2b023520aae756a3a28969c493)

13 years agoAdd test for qemu broken -machine option (RHBZ#748266).
Richard W.M. Jones [Mon, 24 Oct 2011 12:24:16 +0000 (13:24 +0100)]
Add test for qemu broken -machine option (RHBZ#748266).

Also add this option, if necessary, when testing for virtio-serial
support.

When the workaround is enabled, we specify machine type 'pc'.
(cherry picked from commit 3814680423984b3c46c2f99e944c2a71862bde9f)

13 years agovirt-make-fs: Refresh man page.
Richard W.M. Jones [Fri, 21 Oct 2011 21:48:10 +0000 (22:48 +0100)]
virt-make-fs: Refresh man page.
(cherry picked from commit e192035bbd6f80262f60565e0a91588848f2a4e3)

13 years agovirt-make-fs: Set MBR partition type byte correctly (RHBZ#746295).
Richard W.M. Jones [Fri, 21 Oct 2011 15:02:34 +0000 (16:02 +0100)]
virt-make-fs: Set MBR partition type byte correctly (RHBZ#746295).
(cherry picked from commit 0c06d740b77fb9225a0e2bd13dc88b0b88ee87cb)

13 years agoAllow compilation without hivex (RHBZ#723474).
Richard W.M. Jones [Fri, 21 Oct 2011 11:28:45 +0000 (12:28 +0100)]
Allow compilation without hivex (RHBZ#723474).
(cherry picked from commit f5172902bc9d92451c83dc3c1a85b5aeb975b43a)

13 years agopo-docs: Force make update-po on first build from git.
Richard W.M. Jones [Fri, 21 Oct 2011 11:15:36 +0000 (12:15 +0100)]
po-docs: Force make update-po on first build from git.
(cherry picked from commit 9a6e5369b2134a3bd2a6decda48bbf5ac9d7cd41)

13 years agoappliance: udev-174 moves udevd to /lib/udev/udevd (instead of /sbin/udevd)
Richard W.M. Jones [Thu, 20 Oct 2011 22:04:41 +0000 (23:04 +0100)]
appliance: udev-174 moves udevd to /lib/udev/udevd (instead of /sbin/udevd)
(cherry picked from commit fef0ff3d869d2ebdb48eea0c538270fc98f5952d)

13 years agoresize: Remove p_size field from partitions structure.
Richard W.M. Jones [Thu, 20 Oct 2011 13:53:13 +0000 (14:53 +0100)]
resize: Remove p_size field from partitions structure.

This field simply contained a duplicate copy of p_part.part_size.

There is no functional change in this commit.
(cherry picked from commit 9f198956047583e506713a4472117922f8b27b2e)

13 years agoVersion 1.12.8. 1.12.8
Richard W.M. Jones [Wed, 19 Oct 2011 18:11:54 +0000 (19:11 +0100)]
Version 1.12.8.

13 years agoinspection: Return root devices sorted.
Richard W.M. Jones [Wed, 19 Oct 2011 14:43:37 +0000 (15:43 +0100)]
inspection: Return root devices sorted.
(cherry picked from commit c46bedf925cd9c6c9a9cbaee115358fd1dffcbfe)

13 years agoinspect: Don't assume number of captures in match functions
Matthew Booth [Tue, 18 Oct 2011 12:30:40 +0000 (13:30 +0100)]
inspect: Don't assume number of captures in match functions

It is possible for the pcre library to return a variable number of captures for
a single regular expression. e.g.:

  ^/dev/(cciss/c\d+d\d+)(?:p(\d+))?$

This will return either 1 or 2 captures depending on whether the device has a
partition suffix. The current match wrappers don't allow for this, and require
that a predictable number of matches are returned.

This change updates match, match1, match2, and match3 to ignore the specific
number of matches returned. Instead, any returned captures are assigned to the
given arguments, and any remaining arguments are set to NULL.
(cherry picked from commit f5c9f0e9ee1729b1260cef3e51ca91936e1868c4)

13 years agoNFC: Remove unnecessary goto
Matthew Booth [Mon, 17 Oct 2011 15:07:31 +0000 (16:07 +0100)]
NFC: Remove unnecessary goto

Cherry picked from commit 1f615fddaffd33afc75a582021769583c8f4db4e and
backported to libguestfs-1.12 branch.

13 years agolaunch: Ensure g->cmdline is allocated before assigning g->cmdline[0].
Richard W.M. Jones [Wed, 19 Oct 2011 14:20:19 +0000 (15:20 +0100)]
launch: Ensure g->cmdline is allocated before assigning g->cmdline[0].
(cherry picked from commit 138e118d62046b197b715462072256082ecfc0f7)

13 years agovalgrind: guestfish -i: free strings before exit.
Richard W.M. Jones [Wed, 19 Oct 2011 12:42:59 +0000 (13:42 +0100)]
valgrind: guestfish -i: free strings before exit.

This isn't really necessary, but it keeps valgrind happy.
(cherry picked from commit 2f6ec8b4da27c550e2c7187fd17df28f1bdd51a7)

13 years agoUbuntu 11.10: Create /run and /run/lock if not already.
Richard W.M. Jones [Tue, 18 Oct 2011 14:22:01 +0000 (15:22 +0100)]
Ubuntu 11.10: Create /run and /run/lock if not already.

In real machines these directories are a ramdisk.
(cherry picked from commit 6d7d645cdd4a9c94c4d95fc52de53c37b88847e4)

13 years agoSkip guestmount tests if no /dev/fuse.
Richard W.M. Jones [Mon, 17 Oct 2011 08:59:43 +0000 (09:59 +0100)]
Skip guestmount tests if no /dev/fuse.

Cherry picked from commit cf4cc1143393d607a7fb4cdbee1434544237d5d4 and
modified for libguestfs-1.12 branch which only has guestmount.

13 years agoappliance: Fedora cryptsetup-luks renamed to cryptsetup.
Richard W.M. Jones [Fri, 14 Oct 2011 21:08:20 +0000 (22:08 +0100)]
appliance: Fedora cryptsetup-luks renamed to cryptsetup.

Therefore we need both names to be listed in the file.
(cherry picked from commit af0c123be8cc62acf9e1368b1d00acccdd6d91e9)

13 years agoroadmap: Fix Bugzilla URL.
Richard W.M. Jones [Fri, 14 Oct 2011 21:08:14 +0000 (22:08 +0100)]
roadmap: Fix Bugzilla URL.
(cherry picked from commit db499d98e7a290ccbfc4fb333f85021b23155e9d)

13 years agofish: docs: note how to clean up the remote process properly.
Richard W.M. Jones [Thu, 13 Oct 2011 10:56:52 +0000 (11:56 +0100)]
fish: docs: note how to clean up the remote process properly.

Killing it is always a bad idea, because the qemu subprocess will be
left hanging around.  The best thing is to send the exit command.

Cherry picked from commit 11be7d8eee16e6249ed2868b5bd552f29508ec02
and modified.

13 years agofish: Close guestfs handle explicitly before exiting.
Richard W.M. Jones [Thu, 13 Oct 2011 10:54:18 +0000 (11:54 +0100)]
fish: Close guestfs handle explicitly before exiting.

NOTE this is just a cleanup.  It is NOT necessary for correctness,
since libguestfs itself is correctly closing the handle in the exit
handler.
(cherry picked from commit baa1618e0f917017c1934b7da41250029c1791ef)

13 years agoguestmount: Add note to man page about 'fuse' group for Debian.
Richard W.M. Jones [Thu, 13 Oct 2011 10:13:05 +0000 (11:13 +0100)]
guestmount: Add note to man page about 'fuse' group for Debian.
(cherry picked from commit e57c3c37a8648966e19ef33832f353d0f9487a77)

13 years agofish: Add man page section on calling guestfish remote robustly from bash.
Richard W.M. Jones [Fri, 7 Oct 2011 18:20:36 +0000 (19:20 +0100)]
fish: Add man page section on calling guestfish remote robustly from bash.
(cherry picked from commit 3a546663655abfcd6399d4fdb7febc6b0d83b822)

13 years agoMakefile.am: Fix comment.
Richard W.M. Jones [Fri, 7 Oct 2011 12:42:27 +0000 (13:42 +0100)]
Makefile.am: Fix comment.
(cherry picked from commit c6be95453d66ea714a9813a21cfb224d8e346d9e)

13 years agodocs: Add directory section for resize/
Richard W.M. Jones [Wed, 5 Oct 2011 13:38:07 +0000 (14:38 +0100)]
docs: Add directory section for resize/

Based on commit f3341222b37f91d7f7fcdafe30b107ea9da9ad02, but modified
since only resize exists in this branch of libguestfs.

13 years agodocs: Add virt-resize to list of links in guestfs(3).
Richard W.M. Jones [Tue, 4 Oct 2011 09:58:25 +0000 (10:58 +0100)]
docs: Add virt-resize to list of links in guestfs(3).
(cherry picked from commit 293772bf7511dee41a1f3e842424678c1a6bf9e4)

13 years agodocs: virt-win-reg is written in Perl, not virt-resize.
Richard W.M. Jones [Tue, 4 Oct 2011 09:58:02 +0000 (10:58 +0100)]
docs: virt-win-reg is written in Perl, not virt-resize.
(cherry picked from commit b39b3c5c74f1dfb88a6074aac476df877f1bfc4d)

13 years agodaemon: mkswap --help output changed, breaking linuxfsuuid group detection.
Richard W.M. Jones [Thu, 29 Sep 2011 15:08:20 +0000 (16:08 +0100)]
daemon: mkswap --help output changed, breaking linuxfsuuid group detection.
(cherry picked from commit 4e9ed018475ff4bd5171ed50a47ffae7abbdda4b)

13 years agodaemon: Move useful is_zero function to header file.
Richard W.M. Jones [Wed, 28 Sep 2011 13:17:53 +0000 (14:17 +0100)]
daemon: Move useful is_zero function to header file.

Code motion.
(cherry picked from commit ffc01285ee4289da90983a3320873f27b3d31c4d)

13 years agoAdd no_timer_check to disable faulty test during boot (RHBZ#502058).
Richard W.M. Jones [Mon, 26 Sep 2011 12:34:12 +0000 (13:34 +0100)]
Add no_timer_check to disable faulty test during boot (RHBZ#502058).

See:

https://bugzilla.redhat.com/show_bug.cgi?id=502058#c15
https://bugzilla.redhat.com/show_bug.cgi?id=698842#c8

This updates commit 79e66f89e2f6c27486476d7857da58feb491bf5c.
(cherry picked from commit 322106521f546d7c70c5a38255db7d243a456a6b)

13 years agodocs: Show how to use a qemu wrapper to edit the qemu command line.
Richard W.M. Jones [Mon, 26 Sep 2011 08:58:46 +0000 (09:58 +0100)]
docs: Show how to use a qemu wrapper to edit the qemu command line.
(cherry picked from commit 3c7b3634b2c86a4c41fec044ccb59a1fe3224e66)

13 years agoVersion 1.12.7. 1.12.7
Richard W.M. Jones [Fri, 16 Sep 2011 15:33:27 +0000 (16:33 +0100)]
Version 1.12.7.

13 years agoinspection: Handle /dev/root in /etc/fstab.
Richard W.M. Jones [Fri, 16 Sep 2011 14:26:20 +0000 (15:26 +0100)]
inspection: Handle /dev/root in /etc/fstab.

This means "the device that holds /etc/fstab", so map it correctly.

This fixes support for ttylinux and also some other guests that use
/dev/root instead of a real device name.
(cherry picked from commit 917f947590c92318fee2545ba88245d0de012e31)

13 years agoAdd an optional group ("grub") for the guestfs_grub_install API.
Richard W.M. Jones [Thu, 15 Sep 2011 21:02:43 +0000 (22:02 +0100)]
Add an optional group ("grub") for the guestfs_grub_install API.

This also improves the documentation for this call, pointing out
several pitfalls in using it.

This unfortunately breaks existing callers that might use
guestfs_grub_install without checking for this new group.
(cherry picked from commit 99624d29226ece1abbbdd921183b360f5f80de91)

13 years agotest-tool: Display TMPDIR.
Richard Jones [Wed, 14 Sep 2011 12:52:39 +0000 (13:52 +0100)]
test-tool: Display TMPDIR.
(cherry picked from commit bddde7799b80b8292879634548c3c92a3cc1c044)

13 years agotest-tool: Refresh libguestfs-test-tool man page.
Richard Jones [Wed, 14 Sep 2011 12:19:11 +0000 (13:19 +0100)]
test-tool: Refresh libguestfs-test-tool man page.
(cherry picked from commit cda7fa973cbdd5fc4ad3974dcc6b5ea02ec6bb44)

13 years agotest-tool: Make the default timeout be 600 seconds (10 minutes).
Richard Jones [Wed, 14 Sep 2011 12:00:34 +0000 (13:00 +0100)]
test-tool: Make the default timeout be 600 seconds (10 minutes).

We could sometimes hit the 120 second timeout, eg. if the appliance
needed to be rebuilt and the machine was very slow and/or under heavy
I/O load.  10 minutes should be enough for any reasonable situation.
(cherry picked from commit 912284b02e28bd63bdf3397ef841b9782adfd2cd)

13 years agotest-tool: Document the -t command line option.
Richard Jones [Wed, 14 Sep 2011 11:58:43 +0000 (12:58 +0100)]
test-tool: Document the -t command line option.
(cherry picked from commit 95136b149212b92e87d0c9badb7d6849a084ed4d)

13 years agotest-tool: Use B<...> for command line options in man page.
Richard Jones [Wed, 14 Sep 2011 11:58:30 +0000 (12:58 +0100)]
test-tool: Use B<...> for command line options in man page.
(cherry picked from commit c7b88da039725ecd0d1d826b112bc69b518d4c78)

13 years agopo-docs: Make podfiles sort stable.
Richard Jones [Mon, 12 Sep 2011 10:36:00 +0000 (11:36 +0100)]
po-docs: Make podfiles sort stable.
(cherry picked from commit 7c521c7211d61a1bac46c155de1f4d3e8b60b3d7)

13 years agoStable OCaml dependencies.
Richard Jones [Mon, 12 Sep 2011 10:33:19 +0000 (11:33 +0100)]
Stable OCaml dependencies.
(cherry picked from commit cbef2ffb0432756822cd2b02a305384f814e9b50)

13 years agodocs: Add a section explaining the appliance boot process.
Richard W.M. Jones [Wed, 7 Sep 2011 14:21:37 +0000 (15:21 +0100)]
docs: Add a section explaining the appliance boot process.
(cherry picked from commit b3f1457fddd19b1e540866fa01c665aeb371cb44)

13 years agoVersion 1.12.6. 1.12.6
Richard W.M. Jones [Thu, 1 Sep 2011 17:57:10 +0000 (18:57 +0100)]
Version 1.12.6.

13 years agoRemove old regression test that mainly tested a buggy API.
Richard W.M. Jones [Thu, 1 Sep 2011 12:37:20 +0000 (13:37 +0100)]
Remove old regression test that mainly tested a buggy API.

The guestfs_ll command currently lists files in the appliance if you
prefix filenames with "/..".  However this is a bug, not a feature,
and we should not be testing it.
(cherry picked from commit 8ab2b85b2a67270b8cc5a91bb62a70c84cd6a02c)

13 years agodebian: Missing build dependency on db4.8-util.
Richard W.M. Jones [Thu, 1 Sep 2011 12:15:13 +0000 (13:15 +0100)]
debian: Missing build dependency on db4.8-util.
(cherry picked from commit 8928de32d391e3ad4dd98bb27472c27bb8bc38ac)

13 years agodebian: Build libguestfs-ocaml and libguestfs-ocaml-dev subpackages.
Richard W.M. Jones [Sun, 31 Jul 2011 19:48:00 +0000 (20:48 +0100)]
debian: Build libguestfs-ocaml and libguestfs-ocaml-dev subpackages.
(cherry picked from commit 1d134301fc4d05338d09517abc978d0a90d82e09)

13 years agodaemon: Factor out name of virtio serial channel.
Richard W.M. Jones [Thu, 1 Sep 2011 11:59:15 +0000 (12:59 +0100)]
daemon: Factor out name of virtio serial channel.

This is just code motion.
(cherry picked from commit 73be6db9bf1c0ae96262a5f4fa9328bb4e648637)

13 years agoCreate /sys directory if it doesn't exist already.
Richard W.M. Jones [Thu, 1 Sep 2011 11:58:30 +0000 (12:58 +0100)]
Create /sys directory if it doesn't exist already.

Ubuntu 10.04 LTS packages don't create /sys.
(cherry picked from commit 5b012024c49672cc69635ff01f9b9e4f87de1c65)

13 years agocat: Small documentation correction.
Richard W.M. Jones [Sun, 28 Aug 2011 16:35:34 +0000 (17:35 +0100)]
cat: Small documentation correction.
(cherry picked from commit 085a56690611980f438e8af2eb47ebb411465775)

13 years agoVersion 1.12.5. 1.12.5
Richard W.M. Jones [Sun, 28 Aug 2011 09:18:42 +0000 (10:18 +0100)]
Version 1.12.5.

13 years agoinspector: Use xmlstarlet instead of xpath in examples.
Richard W.M. Jones [Sat, 27 Aug 2011 16:53:03 +0000 (17:53 +0100)]
inspector: Use xmlstarlet instead of xpath in examples.
(cherry picked from commit baefb8225c8cbde56a1637c17af5c0965a81060e)

13 years agoman pages: Add a standard EXIT STATUS section to most pages.
Richard W.M. Jones [Sat, 27 Aug 2011 16:47:10 +0000 (17:47 +0100)]
man pages: Add a standard EXIT STATUS section to most pages.
(cherry picked from commit f0f3e1621180724e0a907a30ff5dea9695ddead0)

13 years agoprogress: Make default UTF-8 progress bar less black.
Richard W.M. Jones [Fri, 26 Aug 2011 21:40:27 +0000 (22:40 +0100)]
progress: Make default UTF-8 progress bar less black.
(cherry picked from commit ceb3a57f67f33b33c1f6cafdd0ef81808273f0c0)

13 years agoresize: Add --machine-readable option for machine friendly output.
Richard W.M. Jones [Sun, 28 Aug 2011 08:25:52 +0000 (09:25 +0100)]
resize: Add --machine-readable option for machine friendly output.

Use virt-resize --machine-readable to print a list of facts about what
this version of virt-resize supports.

This includes parts of commit 09a7545649e6cac0de2c4421cb64b659164174ee
from the development branch, but doesn't include the machine-readable
progress bar.

13 years agofish: Make progress bars into a mini library.
Richard W.M. Jones [Fri, 26 Aug 2011 17:17:39 +0000 (18:17 +0100)]
fish: Make progress bars into a mini library.

This library could now be called from other virt tools.
(cherry picked from commit 6146412f06c2f6f33c3ea7d571f16d4fe71dddb2)

13 years agofish: clarify comment: shared source files are used by virt tools too.
Richard W.M. Jones [Fri, 26 Aug 2011 16:39:06 +0000 (17:39 +0100)]
fish: clarify comment: shared source files are used by virt tools too.
(cherry picked from commit 0bd055316f8581f4da33b039e33d5f61cc00294c)

13 years agoruby: Check Ruby callback exists before we call it (RHBZ#733297).
Richard W.M. Jones [Thu, 25 Aug 2011 12:56:09 +0000 (13:56 +0100)]
ruby: Check Ruby callback exists before we call it (RHBZ#733297).
(cherry picked from commit 1a4f1df77eecee053eaae35d5544f151d37342e2)

13 years agoruby: Use a regular C array to pass the arguments through rb_rescue.
Richard W.M. Jones [Thu, 25 Aug 2011 12:25:07 +0000 (13:25 +0100)]
ruby: Use a regular C array to pass the arguments through rb_rescue.
(cherry picked from commit 675f336319058fdbaf11ee004968b4543a5a9815)

13 years agoruby: Append newline character after printing exception in callback.
Richard W.M. Jones [Thu, 25 Aug 2011 12:11:28 +0000 (13:11 +0100)]
ruby: Append newline character after printing exception in callback.
(cherry picked from commit 0cd5b9ac15c62eb570ec74d19b4aebde4990fd82)

13 years agopython: Newer versions want parentheses around arguments of "print"
Hilko Bengen [Mon, 22 Aug 2011 18:42:09 +0000 (20:42 +0200)]
python: Newer versions want parentheses around arguments of "print"
(cherry picked from commit 54911bdd325393d1f7f2861f298463c364b45469)

13 years agophp: Fix bug in PHP tests.
Richard W.M. Jones [Tue, 23 Aug 2011 19:21:29 +0000 (20:21 +0100)]
php: Fix bug in PHP tests.

We partitioned the disk, and then tried to create a PV on the whole
disk.  LVM gave the error:

  Device /dev/vda not found (or ignored by filtering).

It is unclear how this bug persisted for so long.  It might be due to
a change in LVM.
(cherry picked from commit 4fb3b23fb69e4274f434f9258e38f185426298f7)

13 years agoCoverity: fix memory leak along error path.
Richard W.M. Jones [Tue, 23 Aug 2011 18:50:11 +0000 (19:50 +0100)]
Coverity: fix memory leak along error path.
(cherry picked from commit ce18be33cd5279a8d4120eedd037400c275585c0)

13 years agoCoverity: Initialize msg buffer.
Richard W.M. Jones [Tue, 23 Aug 2011 18:29:46 +0000 (19:29 +0100)]
Coverity: Initialize msg buffer.

msg_flags was not being initialized and would have been passed to
sendmsg with a random value.
(cherry picked from commit a31ac8fc32297cc9185fd20a5578d2bc81cc1bce)

13 years agoCoverity: fix memory leak in guestfish.
Richard W.M. Jones [Tue, 23 Aug 2011 18:26:35 +0000 (19:26 +0100)]
Coverity: fix memory leak in guestfish.
(cherry picked from commit c38cb92ec478c4dca83e4d38963720f463d52314)

13 years agoCoverity: in daemon, free struct in RStruct, RStructList functions.
Richard W.M. Jones [Tue, 23 Aug 2011 18:19:13 +0000 (19:19 +0100)]
Coverity: in daemon, free struct in RStruct, RStructList functions.
(cherry picked from commit b2edcbe1b9c9d161e96cb56d0efd944e84d84526)

13 years agopclose: Fix other places where we only tested pclose == -1.
Richard W.M. Jones [Tue, 23 Aug 2011 17:56:12 +0000 (18:56 +0100)]
pclose: Fix other places where we only tested pclose == -1.

pclose can return > 0 when the status of the command was non-zero.
(cherry picked from commit 631faad97171d7c1238b2e413c663cf61476f440)

13 years agotest_qemu: Improve the error message.
Richard W.M. Jones [Tue, 23 Aug 2011 17:53:38 +0000 (18:53 +0100)]
test_qemu: Improve the error message.

Note that errno is probably not set to a useful value here, so there
is not much point recording it.
(cherry picked from commit f15961911316460f7d45342d63c2d784a483f0d1)

13 years agotest_qemu: pclose may return any != 0 on error.
Richard W.M. Jones [Tue, 23 Aug 2011 17:53:00 +0000 (18:53 +0100)]
test_qemu: pclose may return any != 0 on error.

In particular pclose returns a status > 0 if the command fails.
(cherry picked from commit a24652c7b27e8494268ccb6c9a5a2e5541ba5efd)

13 years agoqemu detection: Free up previous qemu help/version strings if they exist.
Richard W.M. Jones [Tue, 23 Aug 2011 17:43:24 +0000 (18:43 +0100)]
qemu detection: Free up previous qemu help/version strings if they exist.
(cherry picked from commit 2ace9be4cd69e84cd88e5b0fd74de861a4973c91)

13 years agoCoverity: test_qemu: Ensure FILE * is not leaked along error paths.
Richard W.M. Jones [Tue, 23 Aug 2011 17:02:24 +0000 (18:02 +0100)]
Coverity: test_qemu: Ensure FILE * is not leaked along error paths.

This refactors the code in test_qemu slightly to ensure that
FILE *fp is not leaked on error paths.
(cherry picked from commit 08e77ad8cb4e8ac70d4217ebd5d236eba81645b5)

13 years agoCoverity: Check guestfs_inspect_get_product_name() != NULL before using.
Richard W.M. Jones [Tue, 23 Aug 2011 15:47:18 +0000 (16:47 +0100)]
Coverity: Check guestfs_inspect_get_product_name() != NULL before using.
(cherry picked from commit fa44536b0ff12102c72ae0337e51d272f0fc2353)

13 years agorescue: Ignore errno after guestfs_launch.
Richard W.M. Jones [Tue, 23 Aug 2011 15:41:07 +0000 (16:41 +0100)]
rescue: Ignore errno after guestfs_launch.

errno is pretty much random on the error path back from guestfs_launch
so there is nothing useful to be gained by checking it.

We could do with a better way to detect if appliance launch failed.
(cherry picked from commit 00fef9eed6a53e10a975814beef775483ff0b3dd)

13 years agoCoverity: Ignore return value from guestfs_launch in virt-rescue.
Richard W.M. Jones [Tue, 23 Aug 2011 15:34:06 +0000 (16:34 +0100)]
Coverity: Ignore return value from guestfs_launch in virt-rescue.

We expect guestfs_launch to fail in this program.
(cherry picked from commit 9bab154d48e367702b65852c3c822341b474ffd2)

13 years agoCoverity: Check return value from sscanf in bindtests calls.
Richard W.M. Jones [Tue, 23 Aug 2011 15:12:27 +0000 (16:12 +0100)]
Coverity: Check return value from sscanf in bindtests calls.
(cherry picked from commit 4c76aaa391d591c5917a06b0277fb9eb7d6d790f)

13 years agoautobuild: Only add last 100 lines of the log file.
Richard W.M. Jones [Sat, 20 Aug 2011 10:41:10 +0000 (11:41 +0100)]
autobuild: Only add last 100 lines of the log file.
(cherry picked from commit ca727deac186981f4d9784696324c8f3af79f9e5)

13 years agoNew autobuild script.
Richard W.M. Jones [Sat, 20 Aug 2011 09:49:35 +0000 (10:49 +0100)]
New autobuild script.

Remove the old top-level autobuild.sh that confused a lot
of people.

Add an autobuild.sh script that builds from the latest tarball.
(cherry picked from commit 6375aede61d57422ad82f4941693493c07b78aa2)

13 years agoconfigure: Add --with-extra flag to allow setting the extra version string.
Richard W.M. Jones [Fri, 19 Aug 2011 20:48:44 +0000 (21:48 +0100)]
configure: Add --with-extra flag to allow setting the extra version string.

Intended use in Fedora and RHEL is to encode the release
string, eg.

  ./configure [...] --with-extra="-%{release}"

13 years agoprotocol: Fix case where download can fail for small files.
Richard W.M. Jones [Thu, 18 Aug 2011 18:13:32 +0000 (19:13 +0100)]
protocol: Fix case where download can fail for small files.

There is another case where downloads of small files could fail if the
library side (writer) fails.  In this case the library would send back
a cancellation, but it would be received after the daemon had finished
sending the whole file (because the file is small enough).  The daemon
would reenter the main loop and immediately get an unexpected cancel
message, causing the daemon to die.

This commit also makes test-cancellation-download-librarycancels.sh
more robust.  We use Monte-Carlo testing with a range of file sizes.
Small file sizes should trigger the error case.
(cherry picked from commit e4cba8f2b1a68e7361ce342ff659cccb0490446e)

13 years agoEscape special/non-printing characters in debug output (RHBZ#731744).
Richard W.M. Jones [Thu, 18 Aug 2011 16:46:50 +0000 (17:46 +0100)]
Escape special/non-printing characters in debug output (RHBZ#731744).

The default event handler in libguestfs was simply writing all debug
output directly to stderr.  However if the output contains
non-printable characters such as terminal control codes then these
would also be sent directly.

With newer SeaBIOS there is a lame attempt to implement a splash
screen using terminal control codes, thus when libguestfs tries to
display debugging output it would cause the screen to clear and debug
output to be lost.

This commit causes all non-printing characters to be escaped.
(\n and \r characters from the appliance are treated somewhat
specially).

Furthermore, instead of using write(2), use buffered stderr calls.
(cherry picked from commit 06019bc82e107f7715ebc59e491610e06dad1e39)

13 years agoRemove guestfs___print_timestamped_argv.
Richard W.M. Jones [Thu, 18 Aug 2011 16:41:09 +0000 (17:41 +0100)]
Remove guestfs___print_timestamped_argv.

This function was used to print the qemu and
febootstrap-supermin-helper command lines.

Unfortunately in the qemu case it was used incorrectly: it called the
internal debug function (ie. event API callback) from the forked qemu
subprocess, which meant that higher level event callbacks might have
been invoked from the child process.

To fix this, convert the qemu case into a new function called
print_qemu_command line which just prints the command line directly to
stderr.  This is called after stderr has been redirected into the pipe
to the main process.  Thus the qemu command line will be marshalled
into the event API along with other qemu and appliance output.

After fixing this, only one use of guestfs___print_timestamped_argv
remained, for printing the febootstrap-supermin-helper command line.
This is converted to a local function print_febootstrap_command_line.

Also print_febootstrap_command_line is now called before we fork
febootstrap-supermin-helper, so that messages no longer overlap.
(cherry picked from commit 635af5be04265f845186b40e9a9fe7b102ad6909)

13 years agoout-of-tree build: generate ./run from template, fix image checks
Hilko Bengen [Wed, 17 Aug 2011 22:14:46 +0000 (00:14 +0200)]
out-of-tree build: generate ./run from template, fix image checks

./run can now be run in a separate build directory. Since some files
needed in the image checks are found in the source tree (but not the
build tree), the source tree location is passed to make-*-img.sh via
an environment variable.
(cherry picked from commit 70c033998e0e721dc4f9eb2a20348098b259752c)

13 years agofish: Add fish-cmds.h to generator_built.
Richard W.M. Jones [Wed, 17 Aug 2011 11:41:41 +0000 (12:41 +0100)]
fish: Add fish-cmds.h to generator_built.

This updates commit 3064277680ad11f887691646d0fa17bb35f38c19.
(cherry picked from commit 85efbc6aa70d522af066a38fd1aae05b790c46d3)

13 years agoout-of-tree build: fix make and make install
Hilko Bengen [Tue, 16 Aug 2011 22:42:00 +0000 (00:42 +0200)]
out-of-tree build: fix make and make install

$(srcdir) is not needed for guestfs_c.c.
*.mli only exists in $(srcdir) and isn't found on "make install" otherwise
(cherry picked from commit 0938e43a60f9d729d9795cf45498e60217fece0e)

13 years agoout-of-tree build: fix documentation generation II
Hilko Bengen [Tue, 16 Aug 2011 22:41:59 +0000 (00:41 +0200)]
out-of-tree build: fix documentation generation II
(cherry picked from commit 8876b2d3764b42ebae3c5fdf61b1899095508169)

13 years agoout-of-tree build: remove unneeded explicit paths
Hilko Bengen [Tue, 16 Aug 2011 22:41:58 +0000 (00:41 +0200)]
out-of-tree build: remove unneeded explicit paths
(cherry picked from commit 4baec012b1b09a888e570fc89dbaa9fbf9944f34)