summaryrefslogtreecommitdiffstats
path: root/daemon
Commit message (Collapse)AuthorAgeFilesLines
* New APIs: Support for opening LUKS-encrypted disks.Richard Jones2010-07-212-0/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for opening LUKS-encrypted disks, via three new APIs: luks_open: Create a mapping for an encrypted disk. luks_open_ro: Same, but read-only mapping. luks_close: Close a mapping. A typical guestfish session using this functionality looks like this: $ guestfish --ro -a encrypted.img ><fs> run ><fs> list-devices /dev/vda ><fs> list-partitions /dev/vda1 /dev/vda2 ><fs> vfs-type /dev/vda2 crypto_LUKS ><fs> luks-open /dev/vda2 luksdev Enter key or passphrase ("key"): ><fs> vgscan ><fs> vg-activate-all true ><fs> pvs /dev/dm-0 ><fs> vgs vg_f13x64encrypted ><fs> lvs /dev/vg_f13x64encrypted/lv_root /dev/vg_f13x64encrypted/lv_swap ><fs> mount /dev/vg_f13x64encrypted/lv_root / ><fs> ll / total 132 dr-xr-xr-x. 24 root root 4096 Jul 21 12:01 . dr-xr-xr-x 20 root root 0 Jul 21 20:06 .. drwx------. 3 root root 4096 Jul 21 11:59 .dbus drwx------. 2 root root 4096 Jul 21 12:00 .pulse -rw-------. 1 root root 256 Jul 21 12:00 .pulse-cookie dr-xr-xr-x. 2 root root 4096 May 13 03:03 bin NOT included in this patch: - An easier way to use this from guestfish. - Ability to create LUKS devices. - Ability to change LUKS keys on existing devices. - Direct access to the /dev/mapper device (eg. if it contains anything apart from VGs).
* New APIs: lvm-set-filter and lvm-clear-filter.Richard Jones2010-07-162-0/+245
| | | | | | | These APIs allow you to change the device filter, the list of block devices that LVM "sees". Either you can set it to a fixed list of devices / partitions, or you can clear it so that LVM sees everything.
* file: Fix file command on /dev/VG/LV paths (RHBZ#582484).Richard Jones2010-06-081-1/+6
| | | | | | | | | | | | | Previous commit 4df593496e116dfb635731c058b7627e81fc179c broke the "file" command on logical volume paths, since these are symbolic links. We *should* follow these (only). This inadvertantly broke virt-inspector too, which indicates that we need more regression testing in this area. Since carrying whole Fedora images around could make the distribution even larger than now, I'm not sure at the moment how to do this. Thanks to Matt Booth for diagnosing this bug.
* file: Restrict to regular files (RHBZ#582484).Richard Jones2010-06-041-11/+35
| | | | | | | | | | | | | | | | | | | | | | The file call can hang if called on char devices (because we are using the file -s option). This is hard to solve cleanly without adding another file API. However this restricts file to regular files, unless called explicitly with a /dev/ path. For non-regular files, it will now return a string like "directory". There is a small semantic change for symbolic links. Previously it would not have worked at all on absolute links (or rather, the results would have been undefined). It would have treated relative symlinks to regular files as the regular file itself. Now it will return the string "symbolic link" in both cases. This commit also makes the API safe when called on untrusted filesystems. Previously a filesystem might have been set up so that (eg) /etc/redhat-release was a char device, which would have caused virt-inspector and virt-v2v to hang. Now it will not hang.
* touch: Restrict touch to regular files only (RHBZ#582484).Richard Jones2010-06-041-0/+20
|
* daemon: Rearrange code in 'file' command.Richard Jones2010-06-041-16/+15
| | | | | | | | path = path to access file (/sysroot/.. or /dev/..) display_path = original path, saved so we can display it buf = optional buffer which is freed along return codepaths There should be no change to the semantics of the code.
* Update to latest gnulib.Richard Jones2010-06-041-0/+1
|
* mkfs-b: Map block size to cluster size for VFAT and NTFS partitions ↵Richard Jones2010-06-031-5/+34
| | | | | | | (RHBZ#599464). This also adds a regression test for VFAT and (conditionally) NTFS filesystems.
* mkfs-b: Check that blocksize parameter is > 0 and a power of 2.Richard Jones2010-06-033-0/+14
|
* parted: Check partition number >= 1 in several calls.Richard Jones2010-06-021-0/+30
|
* daemon: Parse output of old parted which didn't support -m option (RHBZ#598309).Richard Jones2010-06-021-83/+284
| | | | | | | | This fixes the following commands when run with RHEL 5-era parted: get-bootable get-parttype part-list
* daemon: count_strings function returns size_tRichard Jones2010-06-023-4/+4
|
* base64-in: Ignore garbage characters in input.Richard Jones2010-06-021-1/+1
| | | | | | | | On RHEL 5 you have to specify the -i option to get the external 'base64' command to ignore \n characters. (The Fedora version seems to ignore these characters anyway). Add this option so the tests can pass on RHEL 5.
* daemon: write-file: Check range of size parameter (RHBZ#597135).Richard Jones2010-06-021-1/+22
| | | | This also adds a regression test.
* daemon: Limit label lengths (RHBZ#597118).Richard Jones2010-06-022-0/+42
|
* Fix and deprecate get_e2label and get_e2uuid (RHBZ#597112).Richard Jones2010-06-011-82/+2
| | | | | | | | | Fix these calls (see description in RHBZ#597112), but also deprecate them since the new calls vfs_label and vfs_uuid can work on any filesystem type. This also adds a regression test for the original bug reported in RHBZ#597112.
* New APIs: vfs-label and vfs-uuid return label and uuid for many fs types.Richard Jones2010-06-011-0/+12
| | | | | | | | | | | These APIs generalize the existing 'get-e2label' and 'get-e2uuid' calls, to provide calls which should be able to get the label and UUID for most filesystem types. These use 'blkid' to do the work. I have tested that the blkid commands themselves work on RHEL 5. (Suggested by Yufang Zhang).
* daemon: Kill blkid cache to improve reliability of blkid commands.Richard Jones2010-06-011-0/+7
| | | | | By killing the cache file, we make blkid work in situations such as a just-created filesystem.
* daemon: Generalize the implementation of vfs-type.Richard Jones2010-06-011-3/+9
| | | | Note that there is no change to the semantics of the code.
* New API: fallocate64 (replaces fallocate).Richard Jones2010-05-271-0/+11
| | | | | | guestfs_fallocate takes an integer for the length, effectively limiting it to creating 1GB files. This new call takes an int64_t for the length, but is otherwise identical.
* New API: available-all-groups to return list of all optional groups.Richard Jones2010-05-251-0/+18
|
* New API: ntfsresize-size to allow shrinking NTFS (RHBZ#585223).Richard Jones2010-05-211-0/+21
|
* New API: pvresize-size to allow shrinking PVs (RHBZ#585222).Richard Jones2010-05-211-0/+24
|
* New API: resize2fs-size to allow shrinking ext2 filesystems (RHBZ#585221).Richard Jones2010-05-211-0/+36
|
* generator: Make 'xz' into an optional group.Richard Jones2010-05-201-0/+8
| | | | | | | On Ubuntu <= Karmic, xz-utils was not packaged, and therefore any xz-related tests would fail. Thus make this an optional group so that we can test for this and avoid running the tests if xz utils are not present.
* New API: Implement pwrite system call (partial fix for RHBZ#592883).Richard Jones2010-05-201-0/+31
|
* New API: write for creating files with fixed content (RHBZ#501889).Richard Jones2010-05-201-0/+28
| | | | | | | | | | | | | The guestfs_write call can be used to create small files with arbitrary 8 bit content, including \0 bytes. This replaces and deprecates write-file, which cannot be modified to use BufferIn because of an unfortunate choice in the ABI: the size parameter to write-file, if zero, means that the daemon tries to calculate the length of the buffer using strlen. However this fails if we pass a zero-length buffer using BufferIn because then the daemon tries to do strlen on a (really) zero length buffer, not even containing a terminating \0 character, thus segfaulting.
* Improve errors from tar-in/tgz-in commands (RHBZ#591155 RHBZ#591250).Richard Jones2010-05-133-7/+46
| | | | | | | | | | | | | | | | | | | | This commit improves the error messages from the tar-in, tgz-in (etc) commands by capturing the stderr from the tar command in a file and sending that back in the error message. The method used for the error file is primitive, and there is a case for a more generic error file mechanism, but this will do for now. Sample error messages after this change: $ virt-tar -u /tmp/test1.img /tmp/not.tar / tar_in: tar subcommand failed on directory: /: tar: This does not look like a tar archive tar: Skipping to next header tar: Exiting with failure status due to previous errors at /home/rjones/d/libguestfs/tools/virt-tar line 247. $ virt-tar -u /tmp/test1.img /tmp/test.tar / tar_in: tar subcommand failed on directory: /: tar: access.log: Cannot open: Read-only file system tar: Exiting with failure status due to previous errors at /home/rjones/d/libguestfs/tools/virt-tar line 247.
* Combine common code in daemon/tar.c.Richard Jones2010-05-131-120/+20
| | | | | This commit shouldn't result in any change in the semantics of the code.
* Fix FileIn cmds losing synch if both ends send cancel messages (RHBZ#576879).Richard Jones2010-05-138-44/+51
| | | | | | | | | | | | | | | | | | | | | | | During a FileIn command (eg. upload, tar-in) if both sides experience errors, then both sides could send cancel messages, the result being lost synchronization. The reason for the lost synch was because the daemon was ignoring this case and sending an error message back which the library side (which had cancelled) was not expecting. Fix this by checking in the daemon for the case where the library also cancels during daemon cancellation, and not sending an error messages. This also includes an enhanced regression test which checks for this case. This extends the original fix in commit 5922d7084d6b43f0a1a15b664c7082dfeaf584d0. More details can be found here: https://bugzilla.redhat.com/show_bug.cgi?id=576879#c5
* Fix error message in string-e command (RHBZ#588651).Richard Jones2010-05-131-0/+6
|
* New API: fill-pattern for creating files with predefined patterns.Richard Jones2010-05-121-0/+46
|
* Run udev_settle() after swapon/swapoff (RHBZ#516096).Richard Jones2010-05-121-0/+5
|
* daemon: Use 'error' instead of 'perror' before calling 'abort'.Richard Jones2010-05-071-4/+5
|
* daemon: gnulib module 'error' is used directly by the daemon.Richard Jones2010-05-071-0/+1
|
* daemon: Use parens around code section for safety.Richard Jones2010-05-071-1/+2
|
* daemon: Fix read-file so it fails gracefully for large files (RHBZ#589039).Richard Jones2010-05-072-8/+18
| | | | | | | | | | | | | | | | Pengzhen Cao noticed that read-file would fail for files larger than the protocol size; this is *not* the bug. However it would also lose protocol synchronization after this. The reason was that functions which return RBufferOut in the generator must not 'touch' the *size_r parameter along error return paths. I fixed read-file and initrd-cat, and I checked that pread was doing the right thing. This also adds regression tests for read-file with various categories of large file.
* daemon: Fix wc* commands to work on absolute symbolic links (RHBZ#579608).Richard Jones2010-05-071-8/+10
|
* daemon: Fix strings to work on absolute symbolic links (RHBZ#579608).Richard Jones2010-05-071-7/+11
|
* daemon: Fix head and tail commands to work on absolute symbolic links ↵Richard Jones2010-05-071-8/+10
| | | | (RHBZ#579608).
* daemon: Fix grep and related to work on absolute symbolic links (RHBZ#579608).Richard Jones2010-05-071-8/+10
|
* daemon: Fix checksum to work on absolute symbolic links (RHBZ#579608).Richard Jones2010-05-071-11/+23
|
* daemon: Fix hexdump to work on absolute symbolic links (RHBZ#579608).Richard Jones2010-05-071-7/+11
|
* daemon: Fix for commands working on absolute symbolic links (RHBZ#579608).Richard Jones2010-05-072-5/+102
| | | | | | | | | | | | | | | | The original idea (suggested by Al Viro) was to fork and chroot into the sysroot and read the file from there. Because of the separate process being chrooted, absolute links would be resolved correctly. The slightly modified idea is to open the file in the daemon process (but temporarily chrooted, so symlinks resolve correctly), fork, and have the subprocess just be responsible for copying the file. (Strictly speaking we don't need to fork, but this implementation is simpler). This commit just includes the changes needed to the command*() functions in daemon/guestfsd.c and adds an absolute symlink to the test ISO for testing it. Later commits will fix the broken daemon commands themselves.
* daemon: Change command to abort() on resource problems.Richard Jones2010-05-071-7/+12
| | | | | | | | | | | | | The comment in the code describes it thus: /* Note: abort is used in a few places along the error paths early * in this function. This is because (a) cleaning up correctly is * very complex at these places and (b) abort is used when a * resource problem is indicated which would be due to much more * serious issues - eg. memory or file descriptor leaks. We * wouldn't expect fork(2) or pipe(2) to fail in normal * circumstances. */
* Update to latest gnulib.Richard Jones2010-05-061-0/+3
|
* Change network configuration to use macros.Richard Jones2010-05-041-4/+9
| | | | | | | | | | | | | Change the network configuration so everything is set using some macros at the top of src/guestfs.c. Also, rename the macros used in the daemon so they are not the same. It was a very long time since these sets of macros had to match the ones defined in src/guestfs.c, despite what the comment said. Note that this commit should not change the semantics of the program at all.
* lvresize: Use --force so it can make LVs smaller (RHBZ#587484).Richard Jones2010-04-301-1/+1
| | | | This also adds a regression test for this bug.
* New API: checksums-out for checksumming many files.Richard Jones2010-04-231-0/+84
| | | | Useful API for verifying the integrity of virtual machines.
* daemon: Split out checksum type to program name mapping into function.Richard Jones2010-04-231-14/+22
| | | | This shouldn't change the semantics of the program.