libguestfs.git
13 years agoprotocol: Sleep for 1ms before reading log messages.
Richard W.M. Jones [Fri, 1 Apr 2011 12:29:06 +0000 (13:29 +0100)]
protocol: Sleep for 1ms before reading log messages.

As explained in the comment:

  /* QEMU's console emulates a 16550A serial port.  The real 16550A
   * device has a small FIFO buffer (16 bytes) which means here we see
   * lots of small reads of 1-16 bytes in length, usually single
   * bytes.  Sleeping here for a very brief period groups reads
   * together (so we usually get a few lines of output at once) and
   * improves overall throughput, as well as making the event
   * interface a bit more sane for callers.  With a virtio-serial
   * based console (not yet implemented) we may be able to remove
   * this.  XXX
   */

13 years agoShared function to send progress messages.
Richard W.M. Jones [Fri, 1 Apr 2011 11:17:22 +0000 (12:17 +0100)]
Shared function to send progress messages.

This is just code motion.

13 years agoAdd prototype for timeval_diff.
Richard W.M. Jones [Fri, 1 Apr 2011 12:30:24 +0000 (13:30 +0100)]
Add prototype for timeval_diff.

This is just code motion.

13 years agodocs: Progress messages don't necessarily reach 100% in the error case.
Richard W.M. Jones [Fri, 1 Apr 2011 12:54:18 +0000 (13:54 +0100)]
docs: Progress messages don't necessarily reach 100% in the error case.

This should be obvious, and now it is documented to avoid any
confusion.

13 years agodocs: Fix link to progress messages in guestfs(3).
Richard W.M. Jones [Fri, 1 Apr 2011 12:48:14 +0000 (13:48 +0100)]
docs: Fix link to progress messages in guestfs(3).

This updates commit 4e0cf4dbf8a8a96288f70114fdc3939da0aa7ad1.

13 years agoUpdate copyright date on main guestfs(3) man page.
Richard W.M. Jones [Fri, 1 Apr 2011 14:28:42 +0000 (15:28 +0100)]
Update copyright date on main guestfs(3) man page.

13 years agoVersion 1.9.15. 1.9.15
Richard W.M. Jones [Fri, 1 Apr 2011 08:53:53 +0000 (09:53 +0100)]
Version 1.9.15.

13 years agofish: Fix incorrect path passed to perror.
Richard W.M. Jones [Fri, 1 Apr 2011 08:53:44 +0000 (09:53 +0100)]
fish: Fix incorrect path passed to perror.

Fix commit b8e1dee73a1deef1bfd5937e2abfbe9afef7b1ef.

13 years agoAdd libguestfs-tools.conf file to EXTRA_DIST.
Richard W.M. Jones [Fri, 1 Apr 2011 07:50:49 +0000 (08:50 +0100)]
Add libguestfs-tools.conf file to EXTRA_DIST.

13 years agoexamples: Add virt-dhcp-address program.
Richard W.M. Jones [Thu, 31 Mar 2011 19:20:04 +0000 (20:20 +0100)]
examples: Add virt-dhcp-address program.

This is like the mythical 'virt-ifconfig'.  There is not enough
certainty around the right way to be doing this for us to make
a full virt tool for this.  Therefore the code is just an example.

13 years agoexamples: Use WARN_CFLAGS, WERROR_CFLAGS macros instead of -Wall
Richard W.M. Jones [Thu, 31 Mar 2011 19:18:23 +0000 (20:18 +0100)]
examples: Use WARN_CFLAGS, WERROR_CFLAGS macros instead of -Wall

13 years agoexamples: size_t-correctness change in inspect_vm.c
Richard W.M. Jones [Thu, 31 Mar 2011 19:17:02 +0000 (20:17 +0100)]
examples: size_t-correctness change in inspect_vm.c

13 years agocontrib: Fix URLs in README file.
Richard W.M. Jones [Thu, 31 Mar 2011 17:20:08 +0000 (18:20 +0100)]
contrib: Fix URLs in README file.

13 years agoinspect: Detect 32 bit applications running on WOW64 emulator (RHBZ#692545).
Richard W.M. Jones [Thu, 31 Mar 2011 14:51:00 +0000 (15:51 +0100)]
inspect: Detect 32 bit applications running on WOW64 emulator (RHBZ#692545).

These applications are located along a different Registry path.  See
http://support.microsoft.com/kb/896459 for all the details.

Thanks Jinxin Zheng for finding the bug and the solution.

13 years agoAdd /etc/libguestfs-tools.conf configuration file.
Richard W.M. Jones [Wed, 30 Mar 2011 16:03:11 +0000 (17:03 +0100)]
Add /etc/libguestfs-tools.conf configuration file.

This allows the default for --ro or --rw to be controlled for the
three tools guestfish, guestmount and virt-rescue.

13 years agorescue: Add -w|--rw option.
Richard W.M. Jones [Wed, 30 Mar 2011 15:33:14 +0000 (16:33 +0100)]
rescue: Add -w|--rw option.

13 years agofuse: Document -w flag in --help output.
Richard W.M. Jones [Wed, 30 Mar 2011 15:32:33 +0000 (16:32 +0100)]
fuse: Document -w flag in --help output.

13 years agoExclude po-docs directory completely if po4a not available.
Richard W.M. Jones [Tue, 29 Mar 2011 15:07:21 +0000 (16:07 +0100)]
Exclude po-docs directory completely if po4a not available.

Lift the if HAVE_PO4A ... endif completely out of the po-docs
subdirectory, and just exclude the whole subdirectory if the po4a
program is not available.

13 years agotests: Don't fail when compiled without support for NTFS.
Richard W.M. Jones [Tue, 29 Mar 2011 15:03:29 +0000 (16:03 +0100)]
tests: Don't fail when compiled without support for NTFS.

13 years agoperl: Canonicalize /dev/vd* paths in old inspection code (RHBZ#691724).
Richard W.M. Jones [Tue, 29 Mar 2011 11:20:57 +0000 (12:20 +0100)]
perl: Canonicalize /dev/vd* paths in old inspection code (RHBZ#691724).

13 years agoREADME: Note that getfacl, getfattr are optional dependencies.
Richard W.M. Jones [Mon, 28 Mar 2011 16:18:24 +0000 (17:18 +0100)]
README: Note that getfacl, getfattr are optional dependencies.

13 years agoVersion 1.9.14. 1.9.14
Richard W.M. Jones [Mon, 28 Mar 2011 16:11:51 +0000 (17:11 +0100)]
Version 1.9.14.

13 years agofuse: Fix getxattr, listxattr calls and add a regression test (RHBZ#691389).
Richard W.M. Jones [Mon, 28 Mar 2011 13:45:23 +0000 (14:45 +0100)]
fuse: Fix getxattr, listxattr calls and add a regression test (RHBZ#691389).

The documentation for the getxattr and listxattr calls is not very
clear and as a result we were always returning something different
from that which the Linux kernel would usually return.

This fixes these calls, at least far enough that both the 'getfattr'
and 'getfacl' programs now work fine on FUSE-mounted filesystems.

Note that SELinux attrs are *not* passed through.  This appears to be
a known bug between SELinux and FUSE.  For more information see:

http://www.spinics.net/lists/selinux/msg09460.html

13 years agofish: fuse: Add -m dev:mnt:opts to allow mount options to be specified.
Richard W.M. Jones [Mon, 28 Mar 2011 12:35:53 +0000 (13:35 +0100)]
fish: fuse: Add -m dev:mnt:opts to allow mount options to be specified.

This lets you turn on ACLs and xattrs by doing:

  -m /dev/sda1:/:acl,user_xattr

The extra parameter is passed through to mount_options:

  libguestfs: trace: mount_options "acl,user_xattr" "/dev/sda1" "/"

13 years agoroadmap: Move QMP to 'beyond 1.10'.
Richard W.M. Jones [Mon, 28 Mar 2011 09:35:14 +0000 (10:35 +0100)]
roadmap: Move QMP to 'beyond 1.10'.

See: https://www.redhat.com/archives/libguestfs/2011-March/msg00124.html

13 years agoOpen release notes for version 1.10.0.
Richard W.M. Jones [Mon, 28 Mar 2011 09:32:14 +0000 (10:32 +0100)]
Open release notes for version 1.10.0.

13 years agoruby: Don't segfault if callbacks throw exceptions (RHBZ#664558).
Richard W.M. Jones [Mon, 28 Mar 2011 09:03:16 +0000 (10:03 +0100)]
ruby: Don't segfault if callbacks throw exceptions (RHBZ#664558).
(Thanks Chris Lalancette).

See:
https://bugzilla.redhat.com/show_bug.cgi?id=664558#c6

13 years agoRHEL 5: Use mke4fs on RHEL 5 as replacement for mke2fs.
Richard W.M. Jones [Fri, 25 Mar 2011 14:42:40 +0000 (14:42 +0000)]
RHEL 5: Use mke4fs on RHEL 5 as replacement for mke2fs.

13 years agomkfs: Force mke2fs to create a filesystem even on raw IDE device (RHBZ#690819).
Richard W.M. Jones [Fri, 25 Mar 2011 14:34:31 +0000 (14:34 +0000)]
mkfs: Force mke2fs to create a filesystem even on raw IDE device (RHBZ#690819).

13 years agoRename $tmpdir/sock to $tmpdir/guestfsd.sock.
Richard W.M. Jones [Fri, 25 Mar 2011 12:32:08 +0000 (12:32 +0000)]
Rename $tmpdir/sock to $tmpdir/guestfsd.sock.

No functional change; this simply makes the purpose of the
socket clearer.

13 years agoinspector: Add detection of Slackware.
Richard W.M. Jones [Fri, 25 Mar 2011 11:22:38 +0000 (11:22 +0000)]
inspector: Add detection of Slackware.

13 years agoVersion 1.9.13. 1.9.13
Richard W.M. Jones [Thu, 24 Mar 2011 12:23:13 +0000 (12:23 +0000)]
Version 1.9.13.

13 years agoNew API: guestfs_inspect_get_product_variant
Richard W.M. Jones [Wed, 23 Mar 2011 16:00:48 +0000 (16:00 +0000)]
New API: guestfs_inspect_get_product_variant

This returns a product variant for inspected operating systems.  In
practice this is a useful way to distinguish between consumer and
enterprise/server versions of Windows that otherwise have the same
version number.

13 years agofish: Add better quick help to --help output.
Richard W.M. Jones [Tue, 22 Mar 2011 11:50:26 +0000 (11:50 +0000)]
fish: Add better quick help to --help output.

13 years agofish: Add -w|--rw option to --help output.
Richard W.M. Jones [Tue, 22 Mar 2011 11:50:03 +0000 (11:50 +0000)]
fish: Add -w|--rw option to --help output.

13 years agoinspect: Don't fail for Windows guests with multiple disks (RHBZ#674130).
Richard W.M. Jones [Tue, 22 Mar 2011 11:20:38 +0000 (11:20 +0000)]
inspect: Don't fail for Windows guests with multiple disks (RHBZ#674130).

13 years agoinspect: Simplify Windows root heuristic code.
Richard W.M. Jones [Tue, 22 Mar 2011 11:05:21 +0000 (11:05 +0000)]
inspect: Simplify Windows root heuristic code.

Add special is_file_nocase and is_dir_nocase functions and
remove the duplicate checks for files and directories with
different cases.

13 years agoumount-all: Use /proc/mounts instead of output of 'mount' command.
Richard W.M. Jones [Tue, 22 Mar 2011 11:15:21 +0000 (11:15 +0000)]
umount-all: Use /proc/mounts instead of output of 'mount' command.

The particular issue is that ntfs-3g (or FUSE?) no longer appears
to update /etc/mtab, which meant that umount-all was not unmounting
these partitions.  But parsing /proc/mounts is simpler and more
robust in any case.

13 years agoguestfs(3): 'kernel' -> 'supermin appliance'.
Richard W.M. Jones [Sat, 19 Mar 2011 18:41:23 +0000 (18:41 +0000)]
guestfs(3): 'kernel' -> 'supermin appliance'.

13 years agoguestfs(3): Indent line to keep code together.
Richard W.M. Jones [Sat, 19 Mar 2011 18:18:56 +0000 (18:18 +0000)]
guestfs(3): Indent line to keep code together.

13 years agotodo: Add ntfsck.
Richard W.M. Jones [Sat, 19 Mar 2011 12:40:24 +0000 (12:40 +0000)]
todo: Add ntfsck.

13 years agofish: Add all stamp-*.pod files to CLEANFILES.
Richard W.M. Jones [Fri, 18 Mar 2011 20:02:29 +0000 (20:02 +0000)]
fish: Add all stamp-*.pod files to CLEANFILES.

13 years agoVersion 1.9.12. 1.9.12
Richard W.M. Jones [Fri, 18 Mar 2011 19:33:06 +0000 (19:33 +0000)]
Version 1.9.12.

13 years agoproto: Fix both-ends-cancel case.
Richard W.M. Jones [Fri, 18 Mar 2011 18:27:21 +0000 (18:27 +0000)]
proto: Fix both-ends-cancel case.

In the case where both ends cancel at the same time (eg. both ends
realize there are errors before or during the transfer), previously we
skipped sending back an error from the daemon, on the spurious basis
that the library would not need it (the library is cancelling because
of its own error).

However this is wrong: we should always send back an error message
from the daemon in order to preserve synchronization of the protocol.

A simple test case is:

  $ guestfish -N fs -m /dev/sda1 upload nosuchfile /
  libguestfs: error: open: nosuchfile: No such file or directory
  libguestfs: error: unexpected procedure number (66/282)

(Notice two things: there are errors at both ends, and the
loss of synchronization).

After applying this commit, the loss of synchronization does not occur
and we just see the library error:

  $ guestfish -N fs -m /dev/sda1 upload nosuchfile /
  libguestfs: error: open: nosuchfile: No such file or directory

The choice of displaying the library or the daemon error is fairly
arbitrary in this case -- it would be valid to display either or even
to combine them into one error.  Displaying the library error only
makes the code considerably simpler.

This commit also (re-)enables a test for this case.

13 years agoproto: Fix FileIn ops that abort during the chunk upload stage.
Richard W.M. Jones [Fri, 18 Mar 2011 17:17:30 +0000 (17:17 +0000)]
proto: Fix FileIn ops that abort during the chunk upload stage.

As a previous, incorrect attempt to fix RHBZ#576879 we tried to
prevent the daemon from sending an error reply if the daemon had
cancelled the transfer.  This is wrong: the daemon should send an
error reply in these cases.

A simple test case is this:

  guestfish -N fs -m /dev/sda1 upload big-file /

(This fails because the target "/" is a directory, not a file.)
Prior to this commit, libguestfs would hang instead of printing an
error.  With this commit, libguestfs prints an error.

What is happening is:

  (1) Library is uploading
  a file                          (2) In the middle of the long
                                  upload, daemon detects an error.
                                  Daemon cancels.
  (3) Library detects cancel,
  sends cancel chunk, then waits
  for the error reply from the
  daemon.                         (4) Daemon is supposed to send
                                  an error reply message.

Because step (4) wasn't happening, uploads that failed like this would
hang in the library (waiting for the error message, while the daemon
was waiting for the next request).

This also adds a regression test.

This temporarily breaks the "both ends cancel" case (RHBZ#576879c5).
Therefore the test for that is disabled, and this is fixed in the next
patch in the series.

This partially reverts commit dc706a639eec16084c0618baf7bfde00c6565f63.

13 years agoproto: Don't drop outgoing message when daemon cancels (RHBZ#576879).
Richard Jones [Fri, 18 Mar 2011 16:18:37 +0000 (16:18 +0000)]
proto: Don't drop outgoing message when daemon cancels (RHBZ#576879).

This is a (potential) fix for the long standing protocol bug
which causes loss of synchronization when a FileIn action
fails very early on the daemon side.  The canonical example
would be the 'upload' action failing immediately if no filesystem
is mounted.

What's supposed to happen is this:

  (1) library sends
  request message              (2) daemon processes request
  first chunk of data          and sees that it will fail,
                               sends cancellation
                               (3) discards chunks of data
  (4) library sees daemon
  cancellation and stops
  sending chunks

It was going wrong in step (1), in guestfs___send_to_daemon.
In some (timing related) circumstances, send_to_daemon could
receive the cancellation before sending the first chunk, at
which point it would exit, *discarding the first chunk*.
This causes the daemon to fail in step (3) since it reads the
next request as if it was a chunk, thus losing synchronization.
(The protocol specifies that you always have to send at least
one chunk if there is a FileIn or FileOut parameter).

The patch changes guestfs___send_to_daemon so that if it detects
cancellation, it sends the remaining data in its output buffer
instead of discarding it.  (This also fixes another edge case
to do with sending partial data although I don't think we
ever saw that in practice).

13 years agodaemon: Improve protocol debug messages.
Richard Jones [Fri, 18 Mar 2011 16:17:09 +0000 (16:17 +0000)]
daemon: Improve protocol debug messages.

This adds 'guestfsd: ...' prefix before each message, and
also puts a message at the top of the main loop just after
a new message has been received.

The intent is to make it simpler to follow the protocol.

13 years agoregressions: Enable both tests for bug 576879 (not fixed).
Richard W.M. Jones [Fri, 18 Mar 2011 11:22:25 +0000 (11:22 +0000)]
regressions: Enable both tests for bug 576879 (not fixed).

13 years agodaemon: Print error for invalid chunk.cancel field.
Richard W.M. Jones [Fri, 18 Mar 2011 11:21:55 +0000 (11:21 +0000)]
daemon: Print error for invalid chunk.cancel field.

The chunk.cancel field should always be [0|1].  If it is not then
something has gone badly wrong -- probably loss of synchronization.
If this occurs print a debug message and return error from
receive_file function.

13 years agoproto: Improve debug messages.
Richard W.M. Jones [Fri, 18 Mar 2011 11:20:26 +0000 (11:20 +0000)]
proto: Improve debug messages.

13 years agohaskell: Small fixes for ghc 7.
Richard W.M. Jones [Fri, 18 Mar 2011 11:19:31 +0000 (11:19 +0000)]
haskell: Small fixes for ghc 7.

13 years agoregressions: Rename the file we are uploading too.
Richard W.M. Jones [Thu, 17 Mar 2011 12:46:57 +0000 (12:46 +0000)]
regressions: Rename the file we are uploading too.

This updates commit cbd8da6d4dd2e4cbc3b87fbc7cb7d6129eb69172.

13 years agoregressions: Split the test rhbz576879.sh into two halves.
Richard W.M. Jones [Thu, 17 Mar 2011 11:57:40 +0000 (11:57 +0000)]
regressions: Split the test rhbz576879.sh into two halves.

We suspect that there are in fact two separate bugs.  In any
case it makes sense for the two tests to be done separately.

Note that these tests still fail.

13 years agotests: Ignore return value from fwrite.
Richard W.M. Jones [Wed, 16 Mar 2011 11:50:16 +0000 (11:50 +0000)]
tests: Ignore return value from fwrite.

13 years agoVersion 1.9.11. 1.9.11
Richard W.M. Jones [Tue, 15 Mar 2011 21:49:53 +0000 (21:49 +0000)]
Version 1.9.11.

13 years agoruby: Missing files from EXTRA_DIST.
Richard W.M. Jones [Tue, 15 Mar 2011 22:00:54 +0000 (22:00 +0000)]
ruby: Missing files from EXTRA_DIST.

13 years agoperl: Binding and test for guestfs_last_errno (RHBZ#672491).
Richard W.M. Jones [Tue, 15 Mar 2011 16:46:00 +0000 (16:46 +0000)]
perl: Binding and test for guestfs_last_errno (RHBZ#672491).

13 years agoruby: Use ALLOC_N to avoid potential memory leak (RHBZ#667610).
Richard W.M. Jones [Tue, 15 Mar 2011 15:00:58 +0000 (15:00 +0000)]
ruby: Use ALLOC_N to avoid potential memory leak (RHBZ#667610).

13 years agoruby: Remove unnecessary checking around StringValueCStr (RHBZ#667610).
Richard W.M. Jones [Tue, 15 Mar 2011 14:52:03 +0000 (14:52 +0000)]
ruby: Remove unnecessary checking around StringValueCStr (RHBZ#667610).

13 years agoruby: Add rdoc documentation (RHBZ#667610).
Richard W.M. Jones [Tue, 15 Mar 2011 14:48:12 +0000 (14:48 +0000)]
ruby: Add rdoc documentation (RHBZ#667610).

13 years agoNew event API - Ruby bindings (RHBZ#664558).
Richard W.M. Jones [Mon, 14 Mar 2011 22:37:21 +0000 (22:37 +0000)]
New event API - Ruby bindings (RHBZ#664558).

13 years agoNew event API - Perl bindings (RHBZ#664558).
Richard W.M. Jones [Mon, 14 Mar 2011 19:42:47 +0000 (19:42 +0000)]
New event API - Perl bindings (RHBZ#664558).

The methods $h->set_progress_callback and $h->clear_progress_callback
have been removed, and replaced with a complete mechanism for setting
and deleting general-purpose events.

This also updates virt-resize to use the new API.

13 years agoNew event API - OCaml bindings (RHBZ#664558).
Richard W.M. Jones [Mon, 14 Mar 2011 16:44:17 +0000 (16:44 +0000)]
New event API - OCaml bindings (RHBZ#664558).

The functions set_progress_callback and clear_progress_callback have
been removed, and replaced with a complete mechanism for setting and
deleting general-purpose events.

13 years agoNew event API (RHBZ#664558).
Richard W.M. Jones [Thu, 10 Mar 2011 12:32:22 +0000 (12:32 +0000)]
New event API (RHBZ#664558).

This API allows more than one callback to be registered for each
event, makes it possible to call the API from other languages, and
allows [nearly all] log, debug and trace messages to be rerouted from
stderr.

An older version of this API was discussed on the mailing list here:
https://www.redhat.com/archives/libguestfs/2010-December/msg00081.html
https://www.redhat.com/archives/libguestfs/2011-January/msg00012.html

This also updates guestfish to use the new API for its progress bars.

13 years agoNew APIs: guestfs_first_private, guestfs_next_private to walk over
Richard W.M. Jones [Mon, 14 Mar 2011 13:19:47 +0000 (13:19 +0000)]
New APIs: guestfs_first_private, guestfs_next_private to walk over
the private data area.

This commit adds new APIs for walking over the keys and pointers in
the private data area associated with each handle (note this is only
applicable to the C API).

13 years agocheck the pid is > 0 before calling waitpid()
Angus Salkeld [Tue, 15 Mar 2011 11:43:02 +0000 (22:43 +1100)]
check the pid is > 0 before calling waitpid()

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
13 years agocheck the pid is > 0 before calling waitpid()
Angus Salkeld [Mon, 14 Mar 2011 11:40:12 +0000 (22:40 +1100)]
check the pid is > 0 before calling waitpid()

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
13 years agoRHEL5: Old pod2man didn't have --stderr or -u options.
Richard W.M. Jones [Fri, 11 Mar 2011 10:47:05 +0000 (10:47 +0000)]
RHEL5: Old pod2man didn't have --stderr or -u options.

13 years agoconfigure: Remove unnecessary variable assignment.
Richard W.M. Jones [Fri, 11 Mar 2011 10:23:58 +0000 (10:23 +0000)]
configure: Remove unnecessary variable assignment.

Left over from pre-virtio-serial days.

13 years agoRHEL5: Make use of 'futimens' function optional.
Richard W.M. Jones [Fri, 11 Mar 2011 10:22:58 +0000 (10:22 +0000)]
RHEL5: Make use of 'futimens' function optional.

13 years agoVersion 1.9.10. 1.9.10
Richard W.M. Jones [Tue, 8 Mar 2011 16:22:10 +0000 (16:22 +0000)]
Version 1.9.10.

13 years agoDetect Red Hat Desktop as 'rhel' distro (RHBZ#682979).
Richard W.M. Jones [Tue, 8 Mar 2011 08:10:19 +0000 (08:10 +0000)]
Detect Red Hat Desktop as 'rhel' distro (RHBZ#682979).

/etc/redhat-release on Red Hat Desktop contains the following
string:
  Red Hat Desktop release 4 (Nahant Update 8)

Previously we matched against the string "Red Hat Enterprise Linux"
but since this does not contain that string, this distro wasn't being
detected correctly.

Note this also changes the obsolete Perl code, for the benefit of
virt-v2v.

13 years agoInclude <locale.h> in compilation units that use setlocale function.
Richard W.M. Jones [Mon, 7 Mar 2011 19:30:31 +0000 (19:30 +0000)]
Include <locale.h> in compilation units that use setlocale function.

Fix required by gcc 4.6.0.

13 years agogenerator: Introduce error code (errcode) concept.
Richard W.M. Jones [Mon, 7 Mar 2011 19:28:30 +0000 (19:28 +0000)]
generator: Introduce error code (errcode) concept.

There was a lot of repeated code to map return types (eg. RErr)
to error cases (eg. -1 or NULL).

This commit introduces an error code type and two functions to
map return types to error codes and error codes to strings.

13 years agoFix trace segfault for non-daemon functions (RHBZ#682756).
Richard W.M. Jones [Mon, 7 Mar 2011 15:55:56 +0000 (15:55 +0000)]
Fix trace segfault for non-daemon functions (RHBZ#682756).

Previously we expanded the code for 'trace_return' unconditionally for
all non-daemon functions.  However this code was not prepared to
handle all error conditions, and in fact would segfault if it tried to
print RStringList or RHashtable where r == NULL.

We need to make the code conditional on the return value, calling
either 'trace_return' or 'trace_return_error' as appropriate.

Note the difficult case for RConstOptString which returns NULL in
non-error cases.

13 years agoFix URL of transifex instance to be the canonical one.
Richard W.M. Jones [Mon, 7 Mar 2011 10:53:22 +0000 (10:53 +0000)]
Fix URL of transifex instance to be the canonical one.

This updates commit 182a2ceae6d6f50448159e24d8b5c0c92f44407f.

13 years agoImport project into transifex.
Richard W.M. Jones [Mon, 7 Mar 2011 10:45:27 +0000 (10:45 +0000)]
Import project into transifex.

http://www.transifex.net/projects/p/libguestfs/

13 years agodebian: Rename nilfs2-tools to nilfs-tools.
Richard W.M. Jones [Sat, 5 Mar 2011 09:17:41 +0000 (09:17 +0000)]
debian: Rename nilfs2-tools to nilfs-tools.

13 years agovirt-make-fs: Round disk size to integer, fix for qemu-img 0.14.
Richard W.M. Jones [Fri, 4 Mar 2011 12:13:32 +0000 (12:13 +0000)]
virt-make-fs: Round disk size to integer, fix for qemu-img 0.14.

qemu-img used to allow you to specify a fractional image size in bytes
(or at least, it used to ignore the part after the decimal place).  In
qemu-img 0.14 it no longer does this so we round down the size to a
whole number of bytes.

13 years agovirt-make-fs: In debug mode, print qemu-img command line.
Richard W.M. Jones [Fri, 4 Mar 2011 12:13:12 +0000 (12:13 +0000)]
virt-make-fs: In debug mode, print qemu-img command line.

13 years agoVersion 1.9.9. 1.9.9
Richard W.M. Jones [Fri, 4 Mar 2011 09:59:15 +0000 (09:59 +0000)]
Version 1.9.9.

13 years agoFix inspection code when PCRE or hivex is missing.
Richard W.M. Jones [Thu, 3 Mar 2011 13:23:23 +0000 (13:23 +0000)]
Fix inspection code when PCRE or hivex is missing.

13 years agojava: Add a test of g.list_filesystems (a function that returns a Map).
Richard W.M. Jones [Wed, 2 Mar 2011 05:11:10 +0000 (05:11 +0000)]
java: Add a test of g.list_filesystems (a function that returns a Map).

13 years agojava: Fix generated functions that return RHashtable.
Richard W.M. Jones [Wed, 2 Mar 2011 04:49:12 +0000 (04:49 +0000)]
java: Fix generated functions that return RHashtable.

Creating a HashMap directly from JNI is possible but very tedious
(see: http://java.sun.com/docs/books/jni/html/fldmeth.html#26254)

Instead we use the existing code to return hashes from JNI as plain
String[], then add some code in the Java wrapper to convert these to
HashMap<String,String>.

13 years agojava: Return Map<String,String> for RHashtable functions.
Richard W.M. Jones [Wed, 2 Mar 2011 04:33:39 +0000 (04:33 +0000)]
java: Return Map<String,String> for RHashtable functions.

There's no point returning the specific HashMap type here.
Return the generic interface type instead.

Note that no users are actually calling these functions yet,
since at present they always fail.

13 years agojava: Fix a minor whitespace error in generated code.
Richard W.M. Jones [Wed, 2 Mar 2011 04:30:30 +0000 (04:30 +0000)]
java: Fix a minor whitespace error in generated code.

In functions that don't have javadoc, the function prototype wasn't
being indented correctly.

13 years agojava: Remove old test file if one was left around.
Richard W.M. Jones [Wed, 2 Mar 2011 05:10:31 +0000 (05:10 +0000)]
java: Remove old test file if one was left around.

If a test.img file was left over from a previous run, then it
would cause the subsequent test to fail.  Therefore remove any
old test.img file.

13 years agojava: Enable assertions when doing 'make check'.
Richard W.M. Jones [Wed, 2 Mar 2011 05:08:20 +0000 (05:08 +0000)]
java: Enable assertions when doing 'make check'.

It turns out that Java assertions are disabled by default.  You have
to add the 'java -ea' flag to the JVM.  Who knew ..?

Because of this oversight, the tests weren't actually performing the
assertions that we wanted (although in fact none of the assertions
were failing).

This change enables assertions when running the tests.

13 years agoVersion 1.9.8. 1.9.8
Richard W.M. Jones [Sun, 6 Feb 2011 17:18:24 +0000 (17:18 +0000)]
Version 1.9.8.

13 years agodaemon: Ignore return value from chdir.
Richard W.M. Jones [Thu, 3 Feb 2011 19:33:30 +0000 (19:33 +0000)]
daemon: Ignore return value from chdir.

This updates commit 7eb012f3710bb554d5fc2c4229036901b0b5ad90.

13 years agofish: Add guestfish --live, guestmount --live options.
Richard W.M. Jones [Fri, 28 Jan 2011 19:25:02 +0000 (19:25 +0000)]
fish: Add guestfish --live, guestmount --live options.

The other programs have the variable, but the flag is not enabled
either because it doesn't make sense or because the implications are
not well understood.

13 years agoAdd documentation for attach method.
Richard W.M. Jones [Thu, 27 Jan 2011 22:45:50 +0000 (22:45 +0000)]
Add documentation for attach method.

13 years agoAdd guestfs_add_domain 'live' flag.
Richard W.M. Jones [Fri, 28 Jan 2011 13:19:52 +0000 (13:19 +0000)]
Add guestfs_add_domain 'live' flag.

This optional flag controls whether this API call will try to connect
to a running virtual machine 'guestfsd' process.

If the flag is given and the virtual machine is running, then the
libvirt XML is parsed looking for a suitable <channel> element, and
'guestfs_set_attach_method' is called with the corresponding
virtio-serial socket path.

13 years agolib: Implement attach-method unix:<path>
Richard W.M. Jones [Thu, 27 Jan 2011 15:54:33 +0000 (15:54 +0000)]
lib: Implement attach-method unix:<path>

Allow connections to a Unix domain socket which is connected
(via virtio-serial) to a guestfsd running free in an existing
guest.

In order to use this you have to add the following element
to the libvirt XML:

  <channel type='unix'>
    <source mode='bind' path='/tmp/socket'/>
    <target type='virtio' name='org.libguestfs.channel.0'/>
  </channel>

(or perform the equivalent on the qemu command line).

Then in guestfish, you can do:

  guestfish \
    attach-method unix:/tmp/socket : \
    run : \
    ll /

(or any other commands as desired).

13 years agodaemon: Remove -f (don't fork) option.
Richard W.M. Jones [Fri, 28 Jan 2011 15:44:40 +0000 (15:44 +0000)]
daemon: Remove -f (don't fork) option.

This option was not being used.

13 years agodaemon: Allow -r option to run daemon standalone.
Richard W.M. Jones [Thu, 27 Jan 2011 16:54:48 +0000 (16:54 +0000)]
daemon: Allow -r option to run daemon standalone.

This changes several aspects of the daemon.  Currently:

* sysroot will be "" (ie. operate directly on /)
* CHROOT_IN/CHROOT_OUT are disabled
* autosync doesn't try to unmount everything

13 years agodaemon: change to root directory
Richard W.M. Jones [Thu, 3 Feb 2011 18:49:35 +0000 (18:49 +0000)]
daemon: change to root directory

Ensure the daemon always starts with current directory == root.

13 years agoNew APIs: set-attach-method, get-attach-method.
Richard W.M. Jones [Thu, 27 Jan 2011 11:20:43 +0000 (11:20 +0000)]
New APIs: set-attach-method, get-attach-method.

These allow you to get and set the attach method.  The format
is one of:

* appliance
* unix:<path>

It's stored broken out into an enum and a string in the handle.

13 years agolib: Move appliance launching to separate function.
Richard W.M. Jones [Thu, 27 Jan 2011 10:12:34 +0000 (10:12 +0000)]
lib: Move appliance launching to separate function.

This is just code motion.

13 years agophp: Ignore another generated file in php/extension directory.
Richard W.M. Jones [Thu, 3 Feb 2011 10:56:01 +0000 (10:56 +0000)]
php: Ignore another generated file in php/extension directory.