summaryrefslogtreecommitdiffstats
path: root/daemon
Commit message (Collapse)AuthorAgeFilesLines
* protocol: Fix case where download can fail for small files.Richard W.M. Jones2011-08-181-0/+6
| | | | | | | | | | | | | 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.
* Improve zeroing and detection of zeroes.Richard W.M. Jones2011-08-161-20/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code modifies zero, zero-device, is-zero, is-zero-device. zero and zero-device are modified so that if the blocks of the device already contain zeroes, then we don't write zeroes. The reason for this is to avoid unnecessarily making the underlying storage non-sparse or (in the qcow2 case) growing it. is-zero and is-zero-device are modified so that zero detection is faster. This is a nice side effect of making the first change. Since avoiding unnecessary zeroing involves reading the blocks before writing them, whereas before we just blindly wrote, this can be slower. As you can see from the tests below, in the case where the disk is sparse, it actually turns out to be faster, because we avoid allocating the underlying blocks. However in the case where the disk is non-sparse and full of existing data, it is much slower. There might be a case for an API flag to adjust whether or not we perform the zero check. I did not add this flag because it is unlikely that the caller would have enough information to be able to set the flag correctly. (Elapsed time in seconds) Format Test case Before After Raw Sparse 16.4 5.3 Preallocated zero 17.0 18.8 Preallocated random 16.0 41.3 Qcow2 preallocation=off 18.7 5.6 preallocation=metadata 17.4 5.8 The current code uses a fixed block size of 4K for reading and writing. I also tried the same tests with a block size of 64K but it didn't make any significant difference. (Thanks to Federico Simoncelli for suggesting this change)
* daemon: Don't include .gitignore in EXTRA_DIST.Richard W.M. Jones2011-08-071-2/+1
| | | | This updates commit 60d5a50f4d3d9e2c2f5a7d42a6859de709bda3f6.
* daemon: Remove separate configure of daemon subdirectory.Richard W.M. Jones2011-08-055-518/+9
| | | | | | | | | | | | | Combine the two Gnulib instances together. Add checks from old daemon/configure.ac into configure.ac. Fix daemon/Makefile.am so it is like a normal subdirectory Makefile.am. Because we are now using the replacement strerror_r function from Gnulib (instead of the one from glibc directly), this requires a small change to src/guestfs.c.
* Add regression test to catch missing libraries in the appliance.Richard W.M. Jones2011-08-021-0/+71
| | | | Related to RHBZ#727178.
* blkid: Use -c /dev/null option to kill the cache.Richard W.M. Jones2011-07-201-9/+4
| | | | | | On recent Debian, /etc/blkid.tab is now a symlink to /dev/.blkid.tab. Rather than chasing the cache file around (it may move to /run in future) use the -c /dev/null option to stop blkid from reading the cache.
* blkid: Detect when value not found and return empty string.Richard W.M. Jones2011-07-201-4/+15
| | | | | | | | | | | | | | If the blkid command returns 2, that means the value was not found. Note that this changes the output of the vfs-type API when the filesystem has no type (eg when it is empty). Previously this would return an error. Now it returns empty string "". We did not document this either way. Making it return empty string is consistent with vfs-label and vfs-uuid. This change broke list-filesystems, since that code was assuming that vfs-type could only return a filesystem type or an error.
* New API: write-appendRichard W.M. Jones2011-07-141-1/+29
| | | | Append content to the end of a file.
* build: Add ./configure --enable-install-daemonRichard W.M. Jones2011-07-142-0/+15
| | | | | | | | If enabled, then the daemon will be installed in $sbindir (eg. /usr/sbin/guestfsd). The default is off, as now. This option should be used by packagers when building the libguestfs live service.
* New API: btrfs-filesystem-resize (RHBZ#721160).Richard W.M. Jones2011-07-142-0/+85
| | | | This resizes a btrfs filesystem.
* mkfs: Don't die if mke2fs is not available.Richard W.M. Jones2011-07-141-4/+4
| | | | Allow other types of filesystems to be created.
* part-get-bootable: Fix when partitions are missing or unordered (RHBZ#602997).Richard W.M. Jones2011-07-121-4/+30
|
* New API: ntfsresize-opts (RHBZ#685009).Richard W.M. Jones2011-07-121-18/+34
| | | | | | This is a more comprehensive fix for RHBZ#685009. Add a new API which allows the --force flag to be passed, allowing multiple NTFS resize operations in a single session.
* New API: list-dm-devices (RHBZ#688062).Richard W.M. Jones2011-07-121-1/+79
| | | | List device mapper devices.
* list-9p: Avoid double free along error path.Richard W.M. Jones2011-07-121-1/+0
| | | | This updates commit 5f10c3350338bbca735a74db26f98da968957bd9.
* mkfs-opts: Add optional sectorsize parameter.Nikita A Menkovich2011-07-061-3/+20
|
* Implement inode option to mkfs_opts command.Nikita A Menkovich2011-07-041-3/+22
| | | | | | | This is needed because older versions of grub(for example in centos) do not understand filesystems created with newer version of e2fsprogs. By default in e2fsprogs 1.4+ creates partitions with 256 bit inode size, and grub expect 128 bit size.
* New API: mount-9p lets you mount 9p filesystems (RHBZ#714981).Richard W.M. Jones2011-06-221-0/+57
| | | | The updated patch makes 'options' into an optional parameter.
* New API: list-9p lists 9p filesystem mount tags (RHBZ#714981).Richard W.M. Jones2011-06-222-0/+171
|
* build: update to latest gnulibJim Meyering2011-06-102-11/+46
| | | | | * .gnulib: Update submodule to latest. * daemon/m4/gnulib-cache.m4: Regenerate.
* daemon: Keep Coverity happy by ignoring some return values.Richard W.M. Jones2011-06-093-7/+17
|
* Coverity: Don't return freed pointers from command* along error path.Richard W.M. Jones2011-06-091-2/+14
| | | | | | | | | | If the external command failed to run, we could free up the allocated *stdoutput and *stderror pointers, but then return those freed pointers to the caller. The caller usually tries to print and free *stderror, so this is a serious error. Instead, return *stdoutput as NULL, and *stderror pointing to a generic error message.
* Coverity: Missing return on error path.Richard W.M. Jones2011-06-091-0/+1
|
* Coverity: Ensure fp is closed along all error paths.Richard W.M. Jones2011-06-091-4/+6
|
* Coverity: Close directory handle along error paths.Richard W.M. Jones2011-06-091-0/+2
|
* Coverity: Don't leak argv arrays.Richard W.M. Jones2011-06-091-0/+4
|
* Coverity: Don't leak error strings.Richard W.M. Jones2011-06-095-3/+14
|
* Coverity: Check return value of sysroot_path.Richard W.M. Jones2011-06-091-1/+1
| | | | For some reason we were checking the parameter!
* Coverity: Check return value of malloc.Richard W.M. Jones2011-06-091-0/+4
|
* Coverity: Don't close fd_cwd if fd_cwd == -1.Richard W.M. Jones2011-06-091-2/+5
|
* Coverity: Avoid calling sort_strings (NULL, 0) on empty list.Richard W.M. Jones2011-06-091-2/+3
|
* Coverity: Don't call free_strings (NULL).Richard W.M. Jones2011-06-091-1/+0
|
* Coverity: Remove unreachable code.Richard W.M. Jones2011-06-094-12/+0
|
* daemon: Fix error message.Nikita A Menkovich2011-05-201-1/+1
|
* daemon: Make sysroot_len be size_t instead of int.Richard W.M. Jones2011-05-192-2/+2
|
* New APIs: is-zero and is-zero-device, to test if file or device is all zeroes.Richard W.M. Jones2011-05-171-1/+74
|
* daemon: Remove some less useful debugging messages.Richard W.M. Jones2011-05-087-61/+7
| | | | | | | | Remove some debug messages which were basically left over from when the code was being developed. However we leave debug messages where it is printing an external command that is about to be executed, since those are useful.
* Compile rpcgen-generated files with -fno-strict-aliasingMatthew Booth2011-04-071-6/+5
| | | | | rpcgen generates source which can't be safely compiled with strict-aliasing enabled.
* daemon: Reimplement 'mounts' and 'mountpoints' commands.Richard W.M. Jones2011-04-051-48/+29
| | | | | | | | Reimplement these so they read /proc/mounts instead of trying to parse the output of the 'mount' external command. One consequence of this is that these commands now work again for ntfs-3g filesystems.
* du: Add pulse mode progress messages.Richard W.M. Jones2011-04-011-1/+7
|
* cpmv: Add pulse mode progress messages.Richard W.M. Jones2011-04-011-1/+6
|
* checksum: Add pulse mode progress messages.Richard W.M. Jones2011-04-011-1/+6
|
* daemon: Introduce "pulse mode" progress events.Richard W.M. Jones2011-04-014-1/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a new form of progress event, where we don't know how much of the operation has taken place, but we nevertheless want to send back some indication of activity. Some progress bar indicators directly support this, eg. GtkProgressBar where it is known as "pulse mode". A pulse mode progress message is a special backwards-compatible form of the ordinary progress message. No change is required in callers, unless they want to add support for pulse mode. The daemon sends: - zero or more progress messages with position = 0, total = 1 - a single final progress message with position = total = 1 Note that the final progress message may not be sent if the call fails and returns an error. This is consistent with the behaviour of ordinary progress messages. The daemon allows two types of implementation. Either you can just call notify_progress (0, 1); ...; notify_progress (1, 1) as usual. Or you can call the functions pulse_mode_start, pulse_mode_end and/or pulse_mode_cancel (see documentation in daemon/daemon.h). For this second form of call, the guarantee is very weak: it *just* says the daemon is still capable of doing something, and it doesn't imply that if there is a subprocess that it is doing anything. However this does make it very easy to add pulse mode progress messages to all sorts of existing calls that depend on long-running external commands. To do: add a third variant that monitors a subprocess and only sends back progress messages if it's doing something, where "doing something" might indicate it's using CPU time or it's printing output.
* daemon: When running commands, restart select if we receive a signal.Richard W.M. Jones2011-04-011-0/+4
|
* daemon: Reset SIGPIPE to default before running subprocesses.Richard W.M. Jones2011-04-011-0/+1
|
* RHEL 5: Use mke4fs on RHEL 5 as replacement for mke2fs.Richard W.M. Jones2011-03-253-3/+10
| | | | | Notes: Labels: cleanup, forcestable Depends: 227bea6c7ef89b707fe2c01c4d0d0fb9081e8c04
* mkfs: Force mke2fs to create a filesystem even on raw IDE device (RHBZ#690819).Richard W.M. Jones2011-03-251-2/+18
| | | | Notes: Labels: bugfix, RHBZ#690819
* umount-all: Use /proc/mounts instead of output of 'mount' command.Richard W.M. Jones2011-03-221-34/+24
| | | | | | | | | | 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. Notes: Labels: bugfix
* proto: Fix both-ends-cancel case.Richard W.M. Jones2011-03-184-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* proto: Fix FileIn ops that abort during the chunk upload stage.Richard W.M. Jones2011-03-187-39/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.