Commit Graph

1636 Commits

Author SHA1 Message Date
Richard Jones
de7ef2a0fd Code cleanups related to RHBZ#580246.
This includes various code cleanups:

 (a) A regression test for RHBZ#580246.

 (b) Use write instead of fwrite to write out the tar file.  This is
     just because the error handling of write seems to be better
     specified and easier to use.

 (c) Use size_t instead of int for length.

 (d) Clearer debug messages when in verbose mode.
2010-04-08 09:41:57 +01:00
Richard Jones
07f4b20ae9 Fix tar-in command hangs when running out of disk space (RHBZ#580246).
The problem was this sequence of events:

 (1) File transfer goes through OK.

 (2) pclose returns failure (because 'tar' subprocess failed)

 (3) We try to cancel the transfer by calling cancel_receive.

Step (3) fails because the transfer (as far as the library is
concerned) has succeeded, so causing a hang.

The more fundamental reason why we see steps (1) and (2) is that
'tar' does NOT fail immediately if there is a write error.  Instead
it continues reading and discarding the input until the end of the
input before giving "Error exit delayed from previous errors".
IMHO this is a bug with tar, since an ENOSPC write error should
be fatal for tar.
2010-04-08 08:49:00 +01:00
Richard Jones
4c50f4c38d fish: Print extended help when the user types an unknown command first.
$ guestfish /tmp/disk.img
/tmp/disk.img: unknown command
Did you mean to open a disk image?  guestfish -a disk.img
For a list of commands:             guestfish -h
For complete documentation:         man guestfish
2010-04-07 12:06:07 +01:00
Richard Jones
2ade61d1f8 Check error returns from posix_fallocate (RHBZ#579664).
posix_fallocate has a non-standard way to return error indications.
Thus all our calls to posix_fallocate were effectively unchecked.  For
example:

  $ guestfish alloc test.img 1P
  $ echo $?
  0
  $ ll test.img
  -rw-rw-r--. 1 rjones rjones 0 2010-04-06 11:02 test.img
  $ rm test.img

With this change, errors are detected and reported properly:

  $ ./fish/guestfish alloc test.img 1P
  fallocate: File too large

This is a fix for:
https://bugzilla.redhat.com/show_bug.cgi?id=579664
2010-04-07 12:06:07 +01:00
Richard Jones
f42f2df8bc Signed/unsigned warning on 64 bit. 2010-04-07 12:05:46 +01:00
Richard Jones
ce3a9c56b7 New API: guestfs_zero_device to zero whole devices. 2010-03-31 13:19:34 +01:00
Richard W.M. Jones
fb0375a098 Prettier POD CSS. 2010-03-30 21:07:57 +01:00
Richard Jones
b08725d3be Update PO files. 1.3.0 1.2.0 1.0.89 2010-03-30 17:49:44 +01:00
Richard Jones
2e47daea51 chmod +x virt-resize binary. 2010-03-30 17:49:24 +01:00
Richard Jones
855c321b59 Fix EXTRA_DIST rule. 2010-03-30 17:49:06 +01:00
Richard Jones
e17c5a24b8 Prepare for 1.0.89. 2010-03-30 17:05:56 +01:00
Richard Jones
4b48f93ce6 Improved version of virt-win-reg, supporting exporting and merging. 2010-03-30 16:25:12 +01:00
Richard Jones
29c78cc979 virt-df: Match output with native (coreutils) 'df' command (RHBZ#578123).
This commit fixes the 'Use%' field in the output so it matches what
coreutils' 'df' command would print.

Firstly we change the calculation to use the space available to root,
not the space available to non-root.  This means it matches what 'df'
when run as root in the guest would show.

Secondly we display this rounded up to the next whole percent (ie. using
ceil), which is also what 'df' does.

Thirdly we change the regression test so it tests this.

Note that even with these changes you are not guaranteed to get precisely
the same figures from inside and outside the guest, as it depends on
how quiescent the guest is and how recently the superblock was synced.

Thanks: Rita Wu
2010-03-30 16:14:09 +01:00
Richard Jones
fc5fbd460a tools: Add basic tests for the virt-* tools. 2010-03-30 14:20:23 +01:00
Richard Jones
bbe4888cd4 tools: Sectional header for manpages in Makefile.am 2010-03-30 13:45:16 +01:00
Richard Jones
f25da97554 tools: Rearrange list of tools in Makefile.am. 2010-03-30 13:44:29 +01:00
Richard Jones
641e8275b3 daemon: Set TERM=dumb inside the daemon.
Since commit 977edb3185 we have been passing TERM from the
library into the appliance (for the benefit of virt-rescue).
However this changes the output of parted, which I would argue
is a bug in parted:

 TERM=xterm /sbin/parted -m -- /dev/sda unit b print 2>&1 | hexdump -C
 00000000  1b 5b 3f 31 30 33 34 68  42 59 54 3b 0a 2f 64 65  |.[?1034hBYT;./de|

Notice the escape-sequence junk before the official "BYT;"
header.

By setting TERM=dumb we avoid this.
2010-03-30 13:36:06 +01:00
Richard Jones
f826ce4876 Fix the error message when reply body is too large (RHBZ#509597). 2010-03-27 11:11:30 +00:00
Richard Jones
ef3a669241 tests: Move alarm(2) calls to the correct place in the tests.
This is a re-fix for RHBZ#505329.
2010-03-27 10:49:24 +00:00
Richard Jones
650159fce9 Prepare for 1.0.88. 1.0.88 2010-03-26 21:08:43 +00:00
Richard Jones
977edb3185 rescue: Pass $TERM from library into the virt-rescue appliance.
We set it on the kernel command line, then get it out from
there when the rescue appliance boots.
2010-03-26 20:08:45 +00:00
Richard Jones
cd55161994 rescue: Sync disk on exit, and improve messaging. 2010-03-26 20:02:10 +00:00
Jim Meyering
b6a0c8565c Const-correctness fix. 2010-03-26 20:01:45 +00:00
Richard Jones
9e0b31a2af appliance: Set $PATH instead of hard-coding paths to binaries everywhere.
Change the appliance so PATH includes common directories.  Thus
we don't need to hard-code paths to binaries (eg. "/sbin/fdisk")
everywhere.
2010-03-26 13:36:30 +00:00
Richard Jones
57c143da4d perl: use newSVpvn for variable length strings.
Previously we used newSVpv (str, len), but if len == 0 then
this means Perl tries to calculate the string length using
strlen(3).  This is not desirable when we know the length, in
which case we should use newSVpvn instead.
2010-03-25 19:44:22 +00:00
Richard Jones
3e9d96d246 Update PO files. 2010-03-25 16:03:42 +00:00
Daniel Cabrera
5a5be3c25c Update Spanish translation of libguestfs (RHBZ#576876). 2010-03-25 16:03:01 +00:00
Richard Jones
00a9ae7365 Fix lvresize test on RHEL 5, by fixing guestfs_e2fsck_l.
The problem is that mkfs was making an ext2 filesystem,
which later we were checking with e4fsck.  e4fsck corrects
an "error" on the filesystem:
  /dev/VG/LV: Adding dirhash hint to filesystem.
e4fsck returns 1 (errors corrected) which we were interpreting
as an error return.
2010-03-24 23:28:14 +00:00
Richard Jones
c4e8aa245a Use ext4 dev tools on RHEL 5 (RHBZ#576688). 2010-03-24 22:02:34 +00:00
Richard Jones
f57f1012a6 Add support for minix filesystem (RHBZ#576689). 2010-03-24 21:21:23 +00:00
Richard Jones
0c43d63781 Version 1.0.87. 1.0.87 2010-03-23 22:29:49 +00:00
Richard Jones
def627e4da New tools: virt-resize and virt-list-partitions.
Virt-resize is the main contribution here, a program which can
be used to expand and shrink partitions in disk images.

Virt-list-partitions is used as an ancillary tool for planning
resize operations.
2010-03-23 21:56:14 +00:00
Richard Jones
b6483061c2 New API: guestfs_copy_size to copy a fixed number of bytes.
This is similar to 'guestfs_dd', but it copies just a fixed
number of bytes from the source to the destination.  It's an
error if the source is too short or if the destination is too
small.
2010-03-23 21:56:14 +00:00
Richard W.M. Jones
5d90acbe4b Change some _exit(0|1) to _exit(EXIT_SUCCESS|EXIT_FAILURE). 2010-03-23 21:46:22 +00:00
Richard Jones
cef4ba0b8f Mac OS X: Fix configure-time tests for Ruby.
For ARCHFLAGS change, see:
http://www.ruby-forum.com/topic/129717#579065

We also add a test for the <guestfs.h> header and include
that header when testing the library.
2010-03-22 10:41:46 +00:00
Richard Jones
e5fa90a795 guestfs.h: Include <stdint.h>.
This allows programs to work if they just
  #include <guestfs.h>
and no other headers.  It's not useful in the general
case, but fixes some configure-time tests, particularly
the one for Ruby on OS X.
2010-03-22 10:41:46 +00:00
Richard Jones
82bd4fac87 ocaml examples: Fix linking line so it uses local library. 2010-03-22 10:41:46 +00:00
Richard Jones
36e8ece4cc Mac OS X: Disable null vmchannel implementation.
As far as I can tell, Darwin has no way to check the peer euid
of a _loopback_ TCP socket.  This is required for the "null vmchannel"
implementation to work securely.

Therefore disable this - Darwin will use one of the other supported
vmchannel implementations instead.
2010-03-22 10:41:46 +00:00
Richard Jones
d4a202aa7b Mac OS X: 'xdr_uint32_t' is 'xdr_u_int32_t' 2010-03-22 10:41:46 +00:00
Richard Jones
fd8b87ec2b Mac OS X: For PATH_MAX, include <limits.h> 2010-03-22 10:41:45 +00:00
Richard Jones
9e397cc16b Mac OS X: setlocale function requires <locale.h> header file. 2010-03-22 10:41:45 +00:00
Richard Jones
dd12eaefb5 Mac OS X: implement readline functions.
OS X has an older version of readline with some differences
in the names of functions.
2010-03-22 10:41:45 +00:00
Richard Jones
5ebf3a3934 Mac OS X: provide alternate implementation of posix_fallocate. 2010-03-22 10:41:45 +00:00
Richard Jones
b2070ae3d7 Mac OS X: include <rpc/types.h> before <rpc/xdr.h>
In PortableXDR this is not included automatically so we
have to include it explicitly to get definitions for the
XDR types.
2010-03-22 10:41:45 +00:00
Richard Jones
cc6a6a3dcc Mac OS X: include <string.h> in guestfs-actions.c
This is required because guestfs-actions.c uses 'memset'.
2010-03-22 10:41:45 +00:00
Richard Jones
b369fa6f91 Mac OS X: Fix HAVE_GNU_CALLOC so it works when __GLIBC__ is not defined. 2010-03-22 10:41:45 +00:00
Richard Jones
a28791d6ac Mac OS X: strerror_r on Macs is not like GNU strerror_r.
Really this should be turned into a configure-time test.
Perhaps one exists already?
2010-03-22 10:41:44 +00:00
Richard Jones
a6802f80b3 Mac OS X: define MAX macro if not already defined. 2010-03-22 10:41:44 +00:00
Richard Jones
73e472f1f1 Mac OS X: kill(2) requires <signal.h> 2010-03-22 10:41:44 +00:00
Richard Jones
1bf7668110 generator: Small fix for GODI users.
GODI has an odd package layout, so the generator was unable to
find xml-light.  Add the GODI directory to the search path.
2010-03-22 10:41:44 +00:00