summaryrefslogtreecommitdiffstats
path: root/daemon
Commit message (Collapse)AuthorAgeFilesLines
* Compile rpcgen-generated files with -fno-strict-aliasingMatthew Booth2011-04-111-6/+5
| | | | | | rpcgen generates source which can't be safely compiled with strict-aliasing enabled. (cherry picked from commit 3a84e0784e1e3ab7b56850d0f8c9aa42f1ae3da1)
* daemon: When running commands, restart select if we receive a signal.Richard W.M. Jones2011-04-111-0/+4
| | | | (cherry picked from commit 6e5f64089631622167e60df25ee009ef83df5170)
* daemon: Reset SIGPIPE to default before running subprocesses.Richard W.M. Jones2011-04-111-0/+1
| | | | (cherry picked from commit 42938f6faf9e724130be28f8e67d3c291bb81cba)
* RHEL 5: Use mke4fs on RHEL 5 as replacement for mke2fs.Richard W.M. Jones2011-03-293-3/+10
| | | | (cherry picked from commit a0e3b2183733c7440ad017c4ffe361935672339b)
* mkfs: Force mke2fs to create a filesystem even on raw IDE device (RHBZ#690819).Richard W.M. Jones2011-03-291-2/+18
| | | | (cherry picked from commit 227bea6c7ef89b707fe2c01c4d0d0fb9081e8c04)
* proto: Fix both-ends-cancel case.Richard W.M. Jones2011-03-214-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. Cherry picked and rebased from commit f4d996fd26762053d68f46de5790aae893f03d38.
* proto: Fix FileIn ops that abort during the chunk upload stage.Richard W.M. Jones2011-03-217-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. Cherry picked and rebased from commit 33b638109ed66ea360b53b80b1f407b3a5f5ec39.
* daemon: Ignore return value from chdir.Richard W.M. Jones2011-03-081-1/+1
| | | | | This updates commit 7eb012f3710bb554d5fc2c4229036901b0b5ad90. (cherry picked from commit 8d7d7c4ecfd202e04d18736718e9c5bb125ce4f0)
* daemon: change to root directoryRichard W.M. Jones2011-03-081-0/+2
| | | | | Ensure the daemon always starts with current directory == root. (cherry picked from commit 7eb012f3710bb554d5fc2c4229036901b0b5ad90)
* daemon: Add perror to two exit paths to make errors clearer.Richard W.M. Jones2011-03-081-1/+4
| | | | (cherry picked from commit e85fbee7bff9422a370d3f437594d262c043d89b)
* docs: Obsolete HACKING file, move content into guestfs(3) man page.Richard W.M. Jones2011-01-102-3/+4
| | | | | | | Add a new section called "EXTENDING LIBGUESTFS" to the guestfs manual page which contains all the information previously in "HACKING". (cherry picked from commit d2400da92e5e2cc7fd5e33e61220a33214d5241c)
* New APIs: getxattr and lgetxattr to get single extended attributes.Richard W.M. Jones2010-12-161-0/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These APIs are essentially required to work around a problem with ntfs-3g. This filesystem (or FUSE?) does not list all extended attributes of a file when you call listxattr(2). However if you know the name of an extended attribute, you can retrieve it directly using getxattr(2). The current APIs (getxattrs etc) are simple to use, but they don't work if we can't list out the extended attributes (ie. by calling listxattr(2)). Example using the new APIs on an ntfs-3g filesystem: ><fs> lgetxattr "/Documents and Settings" system.ntfs_attrib | hexdump -C 00000000 16 24 00 00 |.$..| 00000004 ><fs> lgetxattr "/Documents and Settings" system.ntfs_reparse_data | hexdump -C 00000000 03 00 00 a0 34 00 00 00 00 00 18 00 1a 00 10 00 |....4...........| 00000010 5c 00 3f 00 3f 00 5c 00 43 00 3a 00 5c 00 55 00 |\.?.?.\.C.:.\.U.| 00000020 73 00 65 00 72 00 73 00 00 00 43 00 3a 00 5c 00 |s.e.r.s...C.:.\.| 00000030 55 00 73 00 65 00 72 00 73 00 00 00 |U.s.e.r.s...| 0000003c ><fs> getxattr "/Documents and Settings" system.ntfs_reparse_data | hexdump -C libguestfs: error: getxattr: getxattr: No such file or directory ><fs> getxattr "/Documents and Settings" system.ntfs_attrib | hexdump -C libguestfs: error: getxattr: getxattr: No such file or directory ><fs> lgetxattr "/Documents and Settings" system.ntfs_attrib | hexdump -C 00000000 16 24 00 00 |.$..| 00000004 ><fs> getxattr "/Users" system.ntfs_attrib | hexdump -C 00000000 11 00 00 00 |....| 00000004
* daemon: Use prog_exists to check for features.Richard W.M. Jones2010-12-102-12/+5
| | | | This updates commit 0938509e0422363554023ab99381fd70a22a6e08.
* Remove several unused local variables.Richard W.M. Jones2010-12-101-1/+1
| | | | (Revealed by compiling under Debian where this is a warning).
* ubuntu: deactivate LVs and VGs before removing them.Richard W.M. Jones2010-12-071-0/+10
| | | | | | | | Even with the '-f' option, LVM on Ubuntu sometimes cannot remove active LVs and VGs. Change lvm-remove-all so it deactivates each LV and VG before removing them.
* Revert "umount-all: Add udev_settle after unmounting disks."Richard W.M. Jones2010-12-071-3/+0
| | | | | | | This reverts commit ad2abf89c364d5ec73fb12af63b053637d99d757. Ubuntu still has errors even with the addition of udev_settle after umount-all. Therefore this was just masking the problem.
* debian: Fix ntfs3g available API on Debian.Richard W.M. Jones2010-12-071-1/+5
| | | | | Really we should have a test for "is program on $PATH?" but this fix will do for now.
* umount-all: Add udev_settle after unmounting disks.Richard W.M. Jones2010-12-071-0/+3
| | | | | | This helps avoid an error on Ubuntu, but it's not clear if this is a real solution or just helps by adjusting the timing of some race condition.
* build: Don't emit warnings about stack protector failures.Richard W.M. Jones2010-12-061-0/+2
| | | | These are seen on gcc 4.5.1 used in Ubuntu.
* New API: mkfs_opts, mkfs with optional arguments.Richard W.M. Jones2010-12-021-49/+49
| | | | | | This is an extensible version of 'mkfs' which supports optional arguments. There is now no need for 'mkfs_b' since you should use 'mkfs_opts' with the optional 'blocksize' argument instead.
* generator: Code to handle optional arguments in daemon functions.Richard W.M. Jones2010-12-021-8/+0
| | | | | | | | Previously we only supported optional arguments for library functions (commit 14490c3e1aac61c6ac90f28828896683f64f0dc9). This extends that work so that optional arguments can also be passed through to the daemon.
* Add progress notification messages to upload and upload-offset APIs.Richard W.M. Jones2010-12-011-11/+28
|
* protocol: Handle progress notification messages during FileIn.Richard W.M. Jones2010-12-011-0/+1
| | | | | | | If the daemon sends progress notification messages while we are uploading FileIn parameters, these are received in check_for_daemon_cancellation_or_eof. Modify this library function so that it turns these messages into callbacks.
* protocol: Upload progress messages and optional arguments.Richard W.M. Jones2010-12-012-0/+30
| | | | | | | | Two unrelated changes to the protocol to support progress messages during uploads, and optional arguments. Note that this makes an incompatible change to the protocol, and this is reflected in the protocol version field (3 -> 4).
* daemon: Close leaked file descriptor along checksum error path (RHBZ#657499).Richard W.M. Jones2010-11-261-1/+3
|
* daemon: blkid cache is at a different location on Debian.Richard W.M. Jones2010-11-241-1/+2
| | | | Remove both possible cache locations.
* daemon: In sfdisk call blockdev --rereadpt with device name.Richard W.M. Jones2010-11-231-1/+1
|
* daemon: findfs-uuid and findfs-label should not return /dev/mapper paths.Richard W.M. Jones2010-11-161-0/+16
|
* lib: Expose errno through new API guestfs_last_errno.Richard W.M. Jones2010-11-032-2/+24
| | | | | | | If either the daemon sends back an errno, or a system call fails in the library, save the errno in the handle and then make it available to callers through the guestfs_last_errno function.
* daemon: Send back the errno as a string.Richard W.M. Jones2010-11-032-2/+18
| | | | | | | | This changes the protocol again so that if the errno is available, it is converted to a string (like "EIO") and sent back over the protocol to the library. In this commit the library just discards the string.
* daemon: Don't use ../src path to include generator_protocol.hRichard W.M. Jones2010-11-0333-33/+33
| | | | | This file is already hard-linked into the current directory, so the relative path is not required.
* daemon: Tolerate failure of blockdev --rereadpt after sfdisk.Richard W.M. Jones2010-11-021-2/+1
| | | | | See commit 840536ea5a0568296dfd3e483442c76b93c5a949 and commit 956fc5a3feacc970ea763697bf28fb686c875408.
* daemon: Fix /dev/mapper paths from mounts and mountpoints (RHBZ#646432).Richard W.M. Jones2010-10-283-34/+56
| | | | Make the LV paths returned by these two commands canonical.
* New API: lvm-canonical-lv-name: make LV name canonical.Richard W.M. Jones2010-10-271-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When logical volume names appear in places like /etc/fstab files they can have the form "/dev/mapper/foo-bar". This function takes such names and makes them canonical. Note that this operation cannot be performed using the current API, because 'guestfs_stat' does not work on device names, and we don't really want to make a 'stat-device' call since that exposes too much non-useful detail about the appliance. With this patch you can do this: ><fs> debug ll /dev/mapper total 8 drwxrwxr-x 2 root root 4096 Oct 25 12:51 . drwxr-xr-x 16 root root 4096 Oct 25 12:51 .. crw------- 1 root root 10, 62 Oct 25 12:51 control lrwxrwxrwx 1 root root 7 Oct 25 12:51 vg_f13x64-lv_root -> ../dm-0 lrwxrwxrwx 1 root root 7 Oct 25 12:51 vg_f13x64-lv_swap -> ../dm-1 ><fs> lvm-canonical-lv-name /dev/mapper/vg_f13x64-lv_root /dev/vg_f13x64/lv_root ><fs> lvm-canonical-lv-name /dev/mapper/vg_f13x64-lv_swap /dev/vg_f13x64/lv_swap ><fs> lvm-canonical-lv-name /dev/mapper/foo libguestfs: error: lvm_canonical_lv_name: lvm_canonical_lv_name_stub: /dev/mapper/foo: No such file or directory ><fs> lvm-canonical-lv-name /dev/mapper/control libguestfs: error: lvm_canonical_lv_name: /dev/mapper/control: not a logical volume ><fs> lvm-canonical-lv-name /dev/vg_f13x64/lv_root /dev/vg_f13x64/lv_root
* daemon: Print failed path in stat command errors.Richard W.M. Jones2010-10-251-2/+2
|
* daemon: Use stdint UINT64_C instead of <const>ULL.Richard W.M. Jones2010-10-221-4/+5
|
* parted: Don't return "loop" for non-partitioned devices (RHBZ#634246).Richard W.M. Jones2010-10-181-0/+15
| | | | | | | | If you ran part-get-parttype command on a device which didn't contain a partition, it used to return the string "loop". This is an internal representation that parted uses. We should instead return an error because part-get-parttype makes no sense for devices which are not partitioned.
* debug: Add qtrace <device> on|off to allow selective traces.Richard W.M. Jones2010-10-061-0/+91
|
* part-disk: Align whole disk partition to 64 sectors.Richard W.M. Jones2010-10-061-15/+9
| | | | | | Change the part-disk command so it aligns the partition to 64 sectors (instead of 1 or 34 sectors as now). This should ensure that the filesystem contained within is aligned.
* New API: pread-device, partial read for devices.Richard W.M. Jones2010-09-271-15/+38
|
* pread: Check count and offset parameters are not negative.Richard W.M. Jones2010-09-271-0/+10
|
* New API: pwrite-deviceRichard W.M. Jones2010-09-261-9/+35
| | | | | This is the same as the existing 'pwrite' API call, but allows you to write to a device.
* pwrite: Check offset is not negative.Richard W.M. Jones2010-09-261-0/+5
|
* Call blockdev --rereadpt then udev_settle after sfdisk commands.Richard W.M. Jones2010-09-241-3/+6
| | | | | | | This updates commit 956fc5a3feacc970ea763697bf28fb686c875408 so that we call udev_settle after rereading the partition table. This ensures that the devices nodes for the new partitions have been created.
* Call blockdev --rereadpt after sfdisk commands.Richard W.M. Jones2010-09-221-1/+13
| | | | | | | | | | | | On fast machines sfdisk has some sort of race where it fails to re-read the partition table it has just created (it's not clear if this is a race in sfdisk, the kernel or some other component). This commit works around the problem by calling blockdev --rereadpt after sfdisk operations, which experience shows is enough to stop the problem from happening.
* New APIs: upload-offset and download-offsetRichard W.M. Jones2010-09-211-3/+112
| | | | | These APIs allow you to efficiently write and read parts of files or devices.
* New API: part-to-dev: Convert partition name to device name.Richard Jones2010-09-151-0/+27
| | | | | This adds a formal API for going from a partition to the containing device, eg. /dev/sda1 -> /dev/sda
* Split generator into separate source files.Richard Jones2010-09-111-4/+5
| | | | | | | | | | 'src/generator.ml' is no more. Instead the generator is logically split up over many different source files. Read generator/README for help and tips. We compile the generator down to bytecode, not native code. This means it will run more slowly, but is done for maximum portability.
* syntax: Remove unused c-ctype.h header.Richard Jones2010-09-101-1/+0
|
* New APIs: is-chardev, is-blockdev, is-fifo, is-symlink, is-socketRichard Jones2010-09-091-17/+61
| | | | These complement the existing is-file and is-dir APIs.