summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Raise error message max size to 64K.Richard Jones2010-08-242-10/+5
| | | | | | | | | This commit removes one of the protocol limits, by raising the maximum error message size from 256 bytes to 64K. Although we could consider raising this further, since the error messages are currently stored in fixed sized buffers on the stack, that would require more invasive code changes.
* Use virtio-serial, remove other vmchannel methods.Richard Jones2010-08-242-275/+56
| | | | | | | | | | | | | This adds support for virtio-serial, and removes all other vmchannel methods. Virtio-serial is faster than other methods, and is now widely available. I tested this by using the guestfs_upload API on an 83 MB file: before: 6.12 seconds (14.1 MB/sec) after: 4.20 seconds (20.6 MB/sec) (note this is with the current 8K chunk size)
* Change to using ext2-based, cached supermin appliance.Richard Jones2010-08-235-190/+493
| | | | | | | | | | | | This changes the method used to build the supermin appliance to use the new ext2-based appliance supported by latest febootstrap. The appliance can also be cached, so we avoid rebuilding it each time it is used. Mailing list discussion goes into the rationale and details: https://www.redhat.com/archives/libguestfs/2010-August/msg00028.html Requires febootstrap >= 2.8.
* Make print_timestamped_message into a cross-module function.Richard Jones2010-08-232-6/+6
| | | | This is just code movement.
* Factor out code for locating the temporary directory.Richard Jones2010-08-232-11/+22
| | | | This is just code movement.
* Whitespace change: Add blank line between structures and functions.Richard Jones2010-08-211-0/+1
|
* Remove old ocaml-inspector code.Richard Jones2010-08-171-490/+0
| | | | | Not used by anyone, didn't work well, and replaced now by the C inspection APIs.
* New APIs for guest inspection.Richard Jones2010-08-176-5/+1360
| | | | | | | | | | | | | | | | | | | | | This commit converts (some of) the Perl inspection code to C and makes it available through core APIs. The new APIs are: inspect-os - Does the inspection, returns list of OSes inspect-get-* - Get results of the inspection where '*' is one of: type - 'windows' or 'linux' distro - Linux distro arch - architecture product-name - long product name string major-version minor-version - major.minor version of OS mountpoints - get a list of the mountpoints filesystems - get all filesystems associated with the OS This works for all existing supported Linux and Windows OSes.
* New APIs: findfs-label and findfs-uuidRichard Jones2010-08-172-3/+27
| | | | | | | | | | | | | | | | | | | | | | | | | These two calls wrap up the /sbin/findfs command, allowing you to find a filesystem by only knowing its label or UUID. This is especially useful when resolving LABEL=... or UUID=... entries in /etc/fstab. Sample guestfish session: ><fs> vfs-uuid /dev/vda1 277dd61c-bf34-4253-a8dc-df500a05e7df ><fs> findfs-uuid 277dd61c-bf34-4253-a8dc-df500a05e7df /dev/vda1 ><fs> vfs-label /dev/vda1 /boot ><fs> findfs-label /boot /dev/vda1 ><fs> vfs-uuid /dev/VolGroup00/LogVol00 40ce7c36-82ce-4a12-a99d-48f5e054162c ><fs> findfs-uuid 40ce7c36-82ce-4a12-a99d-48f5e054162c /dev/mapper/VolGroup00-LogVol00 ><fs> findfs-uuid 12345678 libguestfs: error: findfs_uuid: findfs: unable to resolve 'UUID=12345678'
* New API: file-architectureRichard Jones2010-08-173-1/+410
| | | | | | This change simply converts the existing Perl-only function file_architecture into a core API call. The core API call is written in C and available in all languages and from guestfish.
* generator: No need to redefine safe_* macros.Richard Jones2010-08-171-7/+0
| | | | | These are already defined in "guestfs-internal.h" which is included in the .c file.
* Add safe_strndup call.Richard Jones2010-08-172-0/+10
|
* Send trace output to stderr.Matthew Booth2010-08-171-14/+14
| | | | | Trace output sent to stdout can be lost in the event of a crash due to buffering. This patch sends it to stderr instead.
* Python: Use new PyCapsule API where supported.Richard Jones2010-08-171-0/+13
| | | | | See: http://lists.fedoraproject.org/pipermail/devel/2010-August/141064.html
* generator: Fix typo in error message for RConstOptString.Richard Jones2010-07-311-1/+1
|
* New API: is-lv: check if a block device is a logical volume (RHBZ#619793)Richard Jones2010-07-302-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new API, guestfs_is_lv (g, device), which returns true iff the named device is an LVM2 logical volume. A sample guestfish session: ><fs> lvs /dev/vg_f13x64/lv_root /dev/vg_f13x64/lv_swap ><fs> list-devices /dev/vda ><fs> list-partitions /dev/vda1 /dev/vda2 ><fs> is-lv /dev/vg_f13x64/lv_root true ><fs> is-lv /dev/vg_f13x64/lv_swap true ><fs> is-lv /dev/vda false ><fs> is-lv /dev/vda1 false ><fs> is-lv /dev/vda2 false
* Rename internal functions.Richard Jones2010-07-283-12/+12
| | | | | | | This is an update to commit 41f25ab3df5f306ac717fa7a6efd58328d30c1ae. Internal functions should be named guestfs___* (3 underscores) to avoid clashing with the implementation of actions (2 underscores).
* Rearrange library code into separate files.Richard Jones2010-07-275-2211/+2354
| | | | | | | | | | | | We split the library code into these separate files: - guestfs.c: creating handles, closing handles, handle-related variables - actions.c: generated library-side stubs for each action - bindtests.c: generated code to test bindings - launch.c: launching the appliance - proto.c: the library side of the daemon communications protocol This is just code movement.
* Rename guestfs-{actions,bindtests}.c to {actions,bindtests}.cRichard Jones2010-07-273-7/+7
| | | | | Rename these two generated files, in preparation for splitting up the main src/guestfs.c file.
* New APIs: Support for creating LUKS and managing keys.Richard Jones2010-07-222-1/+38
| | | | | | | | | | | | | | | | | | | This commit adds four APIs for creating new LUKS devices and key management. These are: luks_format Format a LUKS device with the default cipher. luks_format_cipher Format with a chosen cipher. luks_add_key Add another key to an existing device. luks_kill_slot Delete a key from an existing device. This enables all the significant functionality of the cryptsetup luks* commands. Note that you can obtain the UUID of a LUKS device already by using vfs-uuid. This also includes a regression test covering all the LUKS functions.
* Move variable initialization close to variable use.Richard Jones2010-07-221-3/+3
|
* Revert "add_drive_ro adds readonly=on option if available." (RHBZ#617200).Richard Jones2010-07-222-21/+5
| | | | | | | | | | | | | | | | | | Adding the readonly=on option is not so clever. This causes qemu to present the disk as read-only to the guest. (The expected behaviour of snapshots=on,readonly=on was that it would open the disk O_RDONLY but present a writable disk to the guest). Since the guest sees a read-only disk, we are unable to do any recovery if a filesystem on the disk is inconsistent. This basically prevents most accesses to live disk images. What we really want is a qemu option which presents a writable disk to the guest, but only opens the disk on the host side with O_RDONLY, to alleviate the udev bug RHBZ#571714. This reverts commit 676462684e05dd8341dd695762dd99a87d8ec022.
* generator: Make documentation inside guestfish match man page.Richard Jones2010-07-221-2/+9
|
* New APIs: Support for opening LUKS-encrypted disks.Richard Jones2010-07-213-1/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* generator: Add 'Key' parameter type.Richard Jones2010-07-212-75/+142
| | | | | | | | | | | | | Add a 'Key' parameter type, used for passing sensitive key material into libguestfs. Eventually the plan is to mlock() key material into memory. However this is very difficult to achieve because the encoded XDR strings end up in many places. Therefore users should note that key material passed to libguestfs might end up in swap. The only difference between 'Key' and 'String' currently is that guestfish requests the key from /dev/tty with echoing turned off.
* generator: Remove unnecessary parameter.Richard Jones2010-07-211-4/+4
| | | | | The 'name' parameter is not used on the right hand side of the match, so it can be removed.
* New APIs: lvm-set-filter and lvm-clear-filter.Richard Jones2010-07-162-1/+42
| | | | | | | 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.
* Use an unsigned type (size_t) for all loop iterators.Richard Jones2010-07-161-22/+27
| | | | | | | | | This resolves a warning from gcc 4.5: assuming signed overflow does not occur when simplifying conditional to constant This page explains the issues in some detail: http://www.airs.com/blog/archives/120
* generator: Don't hard-code name in DeviceList check.Richard Jones2010-07-161-3/+6
| | | | | Only one function currently uses DeviceList. The generated code unfortunately hard-coded the argument name from that function.
* doc: Add guestfish 'lvcreate 1M' gotcha.Richard Jones2010-07-161-0/+21
|
* Make tmp directory world readable (RHBZ#610880).Richard Jones2010-07-071-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | If you have a restrictive umask (0077 for example) then files in the tmp directory would be created with 0600 permissions. Example: drwx------. 2 rjones rjones 4096 Jul 2 17:52 . drwxrwxrwt. 57 root root 102400 Jul 2 17:52 .. -rw-------. 1 rjones rjones 86328832 Jul 2 17:52 initrd lrwxrwxrwx. 1 rjones rjones 46 Jul 2 17:52 kernel -> /boot/vmlinuz-2.6.33-0.40.rc7.git0.fc13.x86_64 This in itself is not a problem. However in virt-v2v we also change UID:GID and the result is that qemu is unable to read the initrd file: qemu: could not load initial ram disk '/tmp/libguestfs2ssynP/initrd' With this patch we make the tmp directory and the files world readable. After the patch: $ ls -la /tmp/libguestfsJFVzPg/ total 116192 drwxr-xr-x. 2 rjones rjones 4096 Jul 2 18:03 . drwxrwxrwt. 56 root root 102400 Jul 2 18:03 .. -rw-r--r--. 1 rjones rjones 118869504 Jul 2 18:03 initrd lrwxrwxrwx. 1 rjones rjones 46 Jul 2 18:03 kernel -> /boot/vmlinuz-2.6.33-0.40.rc7.git0.fc13.x86_64
* ocaml: Fix thread safety of strings in bindings (RHBZ#604691).Richard Jones2010-06-161-10/+15
| | | | | | | | | | | | | | | | | | | | | | There's a thread safety issue with the current OCaml bindings which is well explained in the bug report: https://bugzilla.redhat.com/show_bug.cgi?id=604691 This commit fixes the safety issue by copying strings temporarily before releasing the thread lock. Updated code looks like this: char *filename = guestfs_safe_strdup (g, String_val (filenamev)); int r; caml_enter_blocking_section (); r = guestfs_add_drive_ro (g, filename); caml_leave_blocking_section (); free (filename); if (r == -1) ocaml_guestfs_raise_error (g, "add_drive_ro"); Also included is a regression test.
* perl: Add explicit close() method (RHBZ#602592).Richard Jones2010-06-101-2/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | This add an optional explicit $g->close method which may be used to force the handle to be closed immediately. Note the provisos about this method in the manual page entry. Callers should *not* normally use this method. The implementation of the handle also changes. Before, the handle was a blessed reference to an integer (the integer being the pointer to the C guestfs_h handle). Now we change this to a hashref containing currently the following field: _g => pointer to C guestfs_h handle (as an integer) If this field is not present, it means that the handle has been explicitly closed. This avoids double-freeing the handle. The user may add their own fields to this hash in order to store per-handle data. However any fields whose names begin with an underscore are reserved for use by the Perl bindings. This commit also adds a regression test. This commit also changes the existing warning when you call a method without a Sys::Guestfs handle as the first parameter, into an error. This is because such cases are always errors.
* Add error callback (RHBZ#602599).Richard Jones2010-06-104-5/+58
| | | | Read the note in the man page before using this feature.
* Fix typo in documentation of guestfs_set_launch_done_callback.Richard Jones2010-06-101-1/+1
|
* file: Fix file command on /dev/VG/LV paths (RHBZ#582484).Richard Jones2010-06-081-1/+1
| | | | | | | | | | | | | 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-5/+18
| | | | | | | | | | | | | | | | | | | | | | 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-1/+4
|
* mkfs-b: Map block size to cluster size for VFAT and NTFS partitions ↵Richard Jones2010-06-031-2/+17
| | | | | | | (RHBZ#599464). This also adds a regression test for VFAT and (conditionally) NTFS filesystems.
* generator: Allow individual tests to depend on daemon features.Richard Jones2010-06-031-2/+12
| | | | | | | | Using IfAvailable "featurename" we allow individual tests to only run if the feature is available in the daemon. This will allow us to extend testing to a lot more optional features such as NTFS.
* tests: Factor out common code into 'is_available' function.Richard Jones2010-06-031-10/+16
| | | | This commit is just code motion.
* grub-install: Enable grub-install tests and create explicit device.map file.Richard Jones2010-06-031-4/+7
|
* grub-install: In docs suggest manually creating device.map (RHBZ#484986).Richard Jones2010-06-031-1/+12
|
* resize2fs: Document this command also works with ext4 (thanks Yufang Zhang).Richard Jones2010-06-021-3/+3
|
* fish: help command return error for non-existent commands (RHBZ#597145).Richard Jones2010-06-021-3/+5
| | | | | | | | | | | | | | With this change, the exit status indicates error for non-existent commands. $ guestfish -h foo foo: command not known, use -h to list all commands $ echo $? 1 $ guestfish help foo foo: command not known, use -h to list all commands $ echo $? 1
* daemon: write-file: Check range of size parameter (RHBZ#597135).Richard Jones2010-06-021-1/+3
| | | | This also adds a regression test.
* Fix and deprecate get_e2label and get_e2uuid (RHBZ#597112).Richard Jones2010-06-011-3/+8
| | | | | | | | | 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-012-1/+24
| | | | | | | | | | | 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).
* Fix documentation for vfs-type to reflect reality.Richard Jones2010-05-271-5/+6
|
* Clarify documentation on distro backports in version command.Richard Jones2010-05-271-2/+4
|