summaryrefslogtreecommitdiffstats
path: root/daemon
Commit message (Collapse)AuthorAgeFilesLines
* daemon: Move internal-autosync function to new file internal.c.Richard W.M. Jones2012-01-233-18/+47
| | | | | This is just code motion. (cherry picked from commit de5d416fc7b3213641b035288c1df199346e9020)
* daemon: Run udev_settle after pwrite-device finishes.Richard W.M. Jones2012-01-232-4/+17
| | | | | | | | When you call close on any block device, udev kicks off a rule which runs blkid to reexamine the device. We need to wait for this rule to finish running since it holds the device open and can cause other operations to fail, notably BLKRRPART. (cherry picked from commit a9c8123c72db47bcab8dd738e8d5256a9ae87f11)
* daemon: pwrite/pread: Don't double close on error path.Richard W.M. Jones2012-01-231-2/+0
| | | | | | In Linux, close (fd) closes the file descriptor even if it returns an error. (cherry picked from commit 61abcf71c05c07bfaca96666b16a0bc30a6edab4)
* resize2fs-M: fix double-free along error path (thanks Matthew Booth).Richard W.M. Jones2012-01-231-4/+2
| | | | (cherry picked from commit b1ea8a7808744068fe0d1306d1005e841a570b4c)
* ext2: tweak the error returned message of resize2fs-M(BZ755729)Wanlong Gao2012-01-231-2/+7
| | | | | | | | Tweak the error message "e2fsck -f" and "e2fsck -fy". Indicate the user to use the correct and/or forceall options. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> (cherry picked from commit 0eaf06e673833bc25673d5c3d2487fffae310285)
* daemon: debug segv correct use of dereferencing NULL.Richard W.M. Jones2012-01-101-1/+7
| | | | (cherry picked from commit 01e717b3c141c509a7200b0a6c560f75815c08f2)
* mkfs: optimization and code cleanupWanlong Gao2012-01-101-15/+14
| | | | | | | | | | | | v1->v2: fix a typo pointed by Matt Optimizations by reducing the STREQ operations and do some code cleanup. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> RWMJ: Whitespace changes. (cherry picked from commit 2ac869bcc86fbf0dd7e878f10a2b60769a58c962)
* daemon: Fix utimens so it doesn't hang on named pipes (RHBZ#761460).Richard W.M. Jones2011-12-091-18/+5
| | | | | | | | | | | This also adds comprehensive tests for utimens on regular files, directories (RHBZ#761451), named pipes (RHBZ#761460), symbolic links, block and char devices. Note that there is a small change in the (previously undefined) semantics of this call: It now sets the time on a symbolic link itself, not on what the symbolic link points to. (cherry picked from commit 19e2f5aa4fd4ed70b505661d918b5575616ad441)
* daemon: Allow utimens to work for directories (RHBZ#761451).Richard W.M. Jones2011-12-091-1/+1
| | | | | | | You don't need to open the file O_WRONLY in order to call futimens on the file descriptor. Opening it O_WRONLY fails for directories. Therefore open O_RDONLY instead. (cherry picked from commit 31fba8d8033216f8a288e75fe3f575b73b9ef925)
* daemon: Use pkg-config to locate Augeas CFLAGS / libraries.Richard W.M. Jones2011-12-061-2/+2
| | | | | | | | | | | | | | | | | | | Augeas 0.10 depends on libxml2, so this is now required in the appliance (in fact, it was already present). However this exposed two bugs: (1) In libguestfs we use a home-brewed recipe for Augeas flags, resulting in this error: /usr/include/augeas.h:24:25: fatal error: libxml/tree.h: No such file or directory (2) Augeas's own augeas.pc didn't include the libxml2 flags, so it was broken. This requires a patch to Augeas 0.10, see: https://www.redhat.com/archives/augeas-devel/2011-December/msg00008.html Change to using pkg-config to detect Augeas. It is still an optional library. (cherry picked from commit 615924abaa968398d6529529fa2f31ae23de825b)
* mkfs: enable to make xfs filesystems when the device already has a filesystemWanlong Gao2011-12-061-0/+3
| | | | | | | | | Just add the -f option to mkfs.xfs to make sure we can make a xfs filesystem when the device already has a filesystem on it. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> (cherry picked from commit 1970a14178b5c53569965d35e54efead6c4c4bdc)
* libguestfs: Added gnulib includes from builddir, as suggested by the Gnulib ↵Hilko Bengen2011-12-021-1/+1
| | | | | | | | | documentation Since some modules (`getopt', for example) may copy files into the build directory, `top_builddir/lib' is needed as well as `top_srcdir/lib'. -- GNU Gnulib manual, section 2.2 Initial import (cherry picked from commit 1a35ca59088e572c11633e85524bb282cb436186)
* part-disk: Change default alignment of this to 64K (128 sectors).Richard W.M. Jones2011-11-241-5/+6
| | | | | | | This is the minimum alignment. 1MB would be better. Note that the exact behaviour is not defined in the API. (cherry picked from commit c4381dba737d5cb8aad8e1b2e2123b0fcaff1d1a)
* daemon: Define safe ADD_ARG macro for constructing arg lists on the stack.Richard W.M. Jones2011-11-225-87/+102
| | | | (cherry picked from commit edd502543adbdc2fa5dda0c015ea7c390bb39f64)
* Update FSF address.Matthew Booth2011-11-0972-72/+72
| | | | (cherry picked from commit 04ea1375c55aa67df4e7fc61dbb534111767f3b6)
* daemon: Use a private copy of /etc/lvm so we don't modify the real config.Richard W.M. Jones2011-11-093-16/+101
| | | | | | | | | | In the libguestfs live case we need to be careful not to modify the real /etc/lvm/lvm.conf file (when setting the filter rule). When the daemon starts, make a complete copy of /etc/lvm in a temporary directory, and adjust LVM_SYSTEM_DIR to point to the copy. All changes are made in the temporary copy. (cherry picked from commit 9c299b64bb24cefafa582fe425bb65b78373d205)
* daemon: Don't use files with fixed names in /tmp (thanks Steve Kemp).Richard W.M. Jones2011-11-092-20/+46
| | | | | | | 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)
* Fix debug help error message.Matthew Booth2011-11-091-1/+1
| | | | | | | | | | | | 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)
* New APIs: copy-{file,device}-to-{file,device}.Richard W.M. Jones2011-10-262-0/+243
| | | | | | | | | | | The four new APIs: guestfs_copy_device_to_device, guestfs_copy_device_to_file, guestfs_copy_file_to_device, and guestfs_copy_file_to_file let you copy from a source to a destination, between files and devices, optionally allowing source and destination offsets and size to be specified.
* New API: part-to-partnumRichard W.M. Jones2011-10-251-0/+25
| | | | | | This converts a partition device name (eg. /dev/sda1) to a partition number (eg. 1). This is useful in conjunction with the parted APIs that mostly take a disk device + partnum.
* Revert "out-of-tree build: daemon"Richard W.M. Jones2011-10-241-2/+2
| | | | | | | | | | | | | This reverts commit 025dba7f803419f510fd8f085ce693838af82878. If build and source directories are the same, you get this error: make[3]: Leaving directory `/home/rjones/d/libguestfs/generator' make[2]: Circular guestfs_protocol.c <- guestfs_protocol.c dependency dropped. make[2]: Circular guestfs_protocol.h <- guestfs_protocol.h dependency dropped. rm -f guestfs_protocol.h ln guestfs_protocol.h ln: accessing `guestfs_protocol.h': No such file or directory
* out-of-tree build: daemonHilko Bengen2011-10-211-2/+2
|
* mount: No longer implicitly add -o sync,noatime options.Richard W.M. Jones2011-10-011-1/+1
|
* daemon: mkswap --help output changed, breaking linuxfsuuid group detection.Richard W.M. Jones2011-09-291-2/+7
|
* New APIs: compress-out, compress-device-out.Richard W.M. Jones2011-09-282-0/+208
| | | | | | | | | | | | | | | | | These APIs let you copy compressed files or devices out from the disk image. Compression is useful for large images which are mostly zeroes. We cannot currently do sparseness detection, and compression gives us a form of zero detection for free. Example usage: $ guestfish --ro -a /dev/vg_pin/F16x64 -i \ compress-out gzip /etc/passwd /tmp/passwd.gz $ file -z /tmp/passwd.gz /tmp/passwd.gz: ASCII text (gzip compressed data, was "passwd", from Unix, last modified: Sun Aug 28 14:40:46 2011)
* daemon: Move useful is_zero function to header file.Richard W.M. Jones2011-09-282-18/+18
| | | | Code motion.
* Add an optional group ("grub") for the guestfs_grub_install API.Richard W.M. Jones2011-09-151-1/+8
| | | | | | | | 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.
* daemon: Factor out name of virtio serial channel.Richard W.M. Jones2011-09-011-3/+5
| | | | This is just code motion.
* 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.