Compare commits

...

2902 Commits

Author SHA1 Message Date
Richard W.M. Jones
b3df3ba5c8 Version 1.19.14. 2012-06-28 08:56:18 +01:00
Richard W.M. Jones
cadfab1a20 tests: Fix 'run --test' so it cleans up its temporary file.
This fixes commit 05d4e07918.
2012-06-27 16:34:23 +01:00
Richard W.M. Jones
1d17a6e9d8 Ensure #include <config.h> occurs in every C file. 2012-06-27 15:49:06 +01:00
Richard W.M. Jones
6777425636 src/actions.c: Include <config.h> in this generated file.
On RHEL 5, because _GNU_SOURCE was not defined, open_memstream was not
being declared, resulting in miscompilation and a segfault in the
trace code whenever open_memstream returned a pointer >= 0x80000000
(which would be truncated to a 32 bit int and then sign-extended).
2012-06-27 15:37:03 +01:00
Richard W.M. Jones
6afb7336e3 gobject: bindtests: gjs exception behaviour changed, fix test.
When libguestfs calls 'error (g, "error")', gjs in F17 throws
error.message == "Error invoking Guestfs.test0rinterr: error"

In F18, error.message is simply the string "error".

Fix the test so it works for both cases.
2012-06-27 10:55:59 +01:00
Richard W.M. Jones
b3a5403cda Version 1.19.13. 2012-06-26 23:49:00 +01:00
Richard W.M. Jones
2eacd4a191 fuse: Use the ./run --test script to run tests. 2012-06-26 23:43:06 +01:00
Richard W.M. Jones
05d4e07918 tests: Add ./run --test option.
This option, when added via
  TESTS_ENVIRONMENT = [...] $(top_builddir)/run --test
allows us to run the tests and only print the full output (including
debugging etc) when the test fails.
2012-06-26 23:34:30 +01:00
Richard W.M. Jones
bbb7d75c91 ./run: Fix indenting for shell script. 2012-06-26 23:00:29 +01:00
Richard W.M. Jones
0977c8408a ocaml: Allow parallel mount-local test to be skipped.
FUSE is not very reliable on RHEL 5.
2012-06-26 18:39:05 +01:00
Richard W.M. Jones
8d88b06277 FAQ: Add Gentoo (thanks Agostino Sarubbo). 2012-06-26 17:46:05 +01:00
Richard W.M. Jones
eb8eb3b9d5 Version 1.19.12. 2012-06-26 15:32:36 +01:00
Richard W.M. Jones
c87956837e launch: Avoid double-close when qemu exits early.
The stdin and stdout of the qemu process are aliased to g->fd:

  g->fd[0] = wfd[1];
  g->fd[1] = rfd[0];

However if the child exits early, then child_cleanup closes g->fd[0],
g->fd[1], AND the code at the cleanup1 label closes wfd[1], rfd[0],
resulting in a double-close.

Avoid this case by setting wfd[1], rfd[0] to -1.  In the cleanup1
label, only close wfd[1], rfd[0] if they are not -1, and add the same
for g->fd[0], g->fd[1].
2012-06-26 14:53:33 +01:00
Richard W.M. Jones
9e221e55b6 launch: Ensure errno from test_qemu_cmd is captured and printed. 2012-06-26 13:38:57 +01:00
Richard W.M. Jones
11317b5d12 launch: Set g->sock = -1 to avoid double-close.
This fixes commit ef5c02c6ee.
2012-06-26 13:31:58 +01:00
Richard W.M. Jones
ef5c02c6ee launch: Log errors from close syscall. 2012-06-26 11:50:12 +01:00
Richard W.M. Jones
90d0beb3c5 tests: Add thread IDs to test of bug 790721. 2012-06-26 09:17:56 +01:00
Richard W.M. Jones
8fc2127975 sysprep: Don't check for /dev/fuse before running the test.
The program doesn't actually require FUSE when used without
any --script options.
2012-06-25 15:21:32 +01:00
Richard W.M. Jones
f27770e141 fish: Allow mount-local test to be skipped with environment variable.
The test uses FUSE, so we need a way to disable it on RHEL 5.
2012-06-25 15:21:32 +01:00
Richard W.M. Jones
2afa0eeb90 tests: Allow SELinux tests to be skipped with an environment variable. 2012-06-25 15:21:32 +01:00
Richard W.M. Jones
030e318049 Version 1.19.11. 2012-06-25 11:29:16 +01:00
Richard W.M. Jones
729bb9c6b5 launch: Treat /dev/null specially, for old KVM.
Old KVM can't add /dev/null readonly.  Treat /dev/null as a special
case.

We also fix a few tests where /dev/null was being used with
format=qcow2.  This was always incorrect behaviour, but qemu appears
to tolerate it.
2012-06-25 11:20:35 +01:00
Richard W.M. Jones
78a515ec4a lib: Remove obsolete NETWORK, ROUTER definitions in header file.
These haven't been used since we switched over to virtio-serial.
2012-06-25 09:02:18 +01:00
Richard W.M. Jones
a0a86484be Version 1.19.10. 2012-06-22 22:06:30 +01:00
Richard W.M. Jones
461455ca7c tests/xml: Fix compilation of test on RHEL 5 with old libvirt.
Old <libvirt.h> had a conflicting definition of virDomainGetXMLDesc:

fake_libvirt_xml.c:36: error: conflicting types for 'virDomainGetXMLDesc'
/usr/include/libvirt/libvirt.h:715: error: previous declaration of 'virDomainGetXMLDesc' was here

The difference is not material ('int' vs. 'unsigned int').

Avoid the error by not including <libvirt.h>.
2012-06-22 13:18:58 +01:00
Richard W.M. Jones
9e7644346d tests: Add workaround for missing O_CLOEXEC. 2012-06-22 13:18:52 +01:00
Richard W.M. Jones
35882ba977 tests: Fix broken workarounds for missing O_CLOEXEC. 2012-06-22 13:18:49 +01:00
Richard W.M. Jones
ef1514aa1e test-virt-resize: Replace truncate with guestfish sparse.
Another instance of 'truncate' command.

See commit 39df80dcc0 for an
explanation.
2012-06-22 13:18:43 +01:00
Richard W.M. Jones
4d3ec25b47 part-get-bootable: Fix when partitions are missing or unordered (RHBZ#602997).
The original fix for this in
commit 511c82df46 was not complete, in
that it did not fix the case of the old (pre '-m' option) parted.
This doesn't matter for Fedora, but it matters for RHEL 5 which has
this ancient parted.
2012-06-22 11:30:00 +01:00
Richard W.M. Jones
8098d062b4 ruby: Add a replacement rb_hash_lookup function for Ruby 1.8.5.
This function was first added to Ruby in 1.8.7.
2012-06-22 11:29:57 +01:00
Richard W.M. Jones
823ba05ebd ruby: Fix libruby test.
If -lruby was not available, this used to define HAVE_LIBRUBY=0.
However this meant that the later test -n "$HAVE_LIBRUBY" would
be successful, whereas it should fail in this case.
2012-06-22 10:58:00 +01:00
Richard W.M. Jones
6cb74d46ba virt-format: Don't call wipefs unless API is available.
This API is optional.  Don't call it unless it's available
in the appliance.
2012-06-22 10:57:55 +01:00
Richard W.M. Jones
145f35badf tests: Add SKIP_TEST_* variables to allow these tests to be skipped.
By setting these variables, we can skip tests that fail on
RHEL 5.
2012-06-22 10:57:47 +01:00
Richard W.M. Jones
6352953ea9 FAQ: Mention update-guestfs-appliance (thanks Steven Dake). 2012-06-19 08:31:45 +01:00
Richard W.M. Jones
489da3ccdf build: Workaround for AC_PROG_SED not existing.
This didn't exist on ancient autoconf in RHEL 5.
2012-06-18 23:00:43 +01:00
Richard W.M. Jones
bc7f1a5ef1 build: Define abs_builddir if not defined already.
This is missing on RHEL 5.

This updates commit 50aa9533e4.
2012-06-18 21:45:13 +01:00
Richard W.M. Jones
baee3f52ef Version 1.19.9. 2012-06-18 16:33:15 +01:00
Richard W.M. Jones
d7c9c6a0d9 fuse: Skip 'truncate' tests if this command is missing. 2012-06-18 15:33:10 +01:00
Richard W.M. Jones
39df80dcc0 tests: Replace truncate command with 'guestfish sparse'.
RHEL 5 didn't have the truncate command, but we can replace:

  truncate -s SIZE FILE

with the roughly equivalent command:

  guestfish sparse FILE SIZE
2012-06-18 15:33:04 +01:00
Richard W.M. Jones
4846b84476 fuse: Add replacement for fuse_opt_add_opt_escaped.
RHEL 5-era FUSE didn't have this function.

I copied the function out of upstream FUSE, since the license is
compatible.
2012-06-18 15:32:52 +01:00
Richard W.M. Jones
50aa9533e4 build: Define builddir and abs_srcdir when they are missing.
RHEL 5-era autoconf did not define these, so define them manually
when they are missing.

Define builddir as '.'  The scripts require this.  It won't work
in the srcdir != builddir case, but we don't care about that for
RHEL 5.

This commit also moves the builddir / abs_srcdir variable setting
above the include of subdir-rules.mk, in case that include uses
these variables.

Useful script:

  for f in $(find -name Makefile.am | xargs fgrep '$(abs_srcdir)' -l) ; do
    if ! grep -q '^abs_srcdir' $f; then
      echo missing in $f
    fi
  done
2012-06-18 15:32:47 +01:00
Richard W.M. Jones
dd216fedbd ocaml: Use OCAMLOPTFLAGS when compiling .cmx (ie. native code) files. 2012-06-18 15:32:38 +01:00
Richard W.M. Jones
87de366701 configure: Look for mkisofs as well as genisoimage.
For our purposes, the two tools are compatible.
2012-06-18 15:32:12 +01:00
Richard W.M. Jones
60a2f8706b Ignore .gdb_history file. 2012-06-14 17:37:11 +01:00
Richard W.M. Jones
7b1cd65c44 ppc64: is_openable function needed on all platforms now.
This fixes commit 295d6af48d.
2012-06-14 17:36:17 +01:00
Richard W.M. Jones
cd6005128d Version 1.19.8. 2012-06-14 16:21:09 +01:00
Richard W.M. Jones
81ee155b9d tests: Add tests for extended attrs and SELinux, direct and via FUSE.
Note that the SELinux + FUSE test is disabled because of:

https://bugzilla.redhat.com/show_bug.cgi?id=811217
https://bugzilla.redhat.com/show_bug.cgi?id=812798#c42
2012-06-14 16:12:57 +01:00
Richard W.M. Jones
abbace6888 virtio-scsi: Increase udev timeout.
In Koji, when you've got 200+ disks, udev times out before all the
udev events have been processed.
2012-06-14 14:22:07 +01:00
Richard W.M. Jones
d43e3d63de virt-edit: Document CVE-2012-2690. 2012-06-14 12:25:06 +01:00
Richard W.M. Jones
199cc2853c Require febootstrap >= 3.17. 2012-06-14 09:57:28 +01:00
Richard W.M. Jones
8b15fb3e22 Version 1.19.7. 2012-06-13 23:25:50 +01:00
Richard W.M. Jones
4c828dc568 tests: Add a test which adds the maximum number of disks and uses them. 2012-06-13 23:17:13 +01:00
Richard W.M. Jones
8735e92a1d virt-df: Use guestfs_max_disks instead of hard-coding limit of 25.
And comprehensively fix it so it works with > 26 disks.
2012-06-13 23:07:26 +01:00
Richard W.M. Jones
a9d7d044f5 New API: device-index.
This returns the index of the device, eg. /dev/sdb => 1.
Or you can think of it as the order that the device was
added, or the index of the device in guestfs_list_devices.
2012-06-13 23:07:26 +01:00
Richard W.M. Jones
46ed232dc2 New API: guestfs_canonical_device_name.
This API makes device names canonical, eg. /dev/vda1 -> /dev/sda1.
2012-06-13 23:07:26 +01:00
Richard W.M. Jones
998ebc333d lvm-filter: Make it work with > 26 devices.
Thanks Alasdair Kergon.
2012-06-13 23:07:26 +01:00
Richard W.M. Jones
c0a087b823 daemon: Fix order of devices in guestfs_list_devices when > 26 disks.
Sort the device names correctly, not just treating them as
strings.  As a result, /dev/sdz < /dev/sdaa.
2012-06-13 22:10:36 +01:00
Richard W.M. Jones
4165e28b53 New API: guestfs_max_disks.
Returns the maximum number of disks that may be added to a handle.
2012-06-13 22:05:45 +01:00
Richard W.M. Jones
919b7e3f6c Update documentation on maximum number of disks. 2012-06-13 22:05:44 +01:00
Richard W.M. Jones
cef979b289 appliance: Add lsscsi to package list. 2012-06-13 22:05:44 +01:00
Richard W.M. Jones
dbd489f95d virtio-scsi: Fix disk name calculation.
This fixes commit 0c0a7d0d86.
2012-06-13 22:05:39 +01:00
Richard W.M. Jones
69e2616b6c Require febootstrap >= 3.16. 2012-06-13 11:27:50 +01:00
Richard W.M. Jones
6e981fe586 Version 1.19.6. 2012-06-12 23:04:16 +01:00
Richard W.M. Jones
320adf4778 tests/md: Don't hard code /dev/vda in expected output of tests.
Use a small sed script to canonicalize the device names.
2012-06-12 22:31:28 +01:00
Richard W.M. Jones
9a5c0d3908 tests: Fix spelling in comment. 2012-06-12 22:31:28 +01:00
Richard W.M. Jones
7509cdf18e tests/lvm: Don't hard-code /dev/vda in test.
Hard-coding it breaks virtio-scsi because the devices are called
/dev/sda etc.
2012-06-12 22:31:05 +01:00
Richard W.M. Jones
62c5b6db58 daemon: Always pass -F option to mke2fs.
Apparently e2fsprogs only knows that "/dev/sda" is a whole device, but
doesn't think that "/dev/vda" is.  On switching the default device
over to virtio-scsi, that causes mke2fs without -F option to complain
and ask for an interactive prompt.  Adding -F forces it to go ahead
anyway.

This caused several less-used APIs to break with virtio-scsi.
2012-06-12 21:16:35 +01:00
Richard W.M. Jones
0c0a7d0d86 appliance: Add support for virtio-scsi.
This requires febootstrap >= 3.15.
2012-06-12 21:16:32 +01:00
Richard W.M. Jones
e0b5ecc801 Record output of qemu -device '?'.
This allows us to find out what qemu devices are supported
at runtime.
2012-06-12 19:19:03 +01:00
Richard W.M. Jones
295d6af48d Require QEMU >= 1.0.
QEMU 1.0 was released at the end of 2011.

Remove all the cruft about detecting broken -machine type which
was only required for QEMU 0.15.

This also reverts commit 30ecbf3ec2.
Even on ARM you can pass -machine accel=kvm:tcg and qemu does the
right thing, so I'm not sure why we wanted to disable that.
2012-06-12 16:02:10 +01:00
Richard W.M. Jones
7652b5aece Remove ./configure --with-drive-if and --with-net-if options.
These were used to select the default drive and network interface.
They both default to 'virtio'.

These were added back in the day when virtio was buggy, so that
packagers could revert to using ide/ne2k_pci to work around distro
bugs.  However virtio has been stable in qemu for a very long time, so
it seems unlikely that any packager would need to use these, and in
any case it would be better to do this detection at runtime (cf. for
virtio-scsi).
2012-06-12 14:52:21 +01:00
Richard W.M. Jones
7590924022 New API: fstrim - allow filesystem trim. 2012-06-12 14:33:57 +01:00
Richard W.M. Jones
668a0cebdf Version 1.19.5. 2012-06-09 22:00:46 +01:00
Richard W.M. Jones
251b131e0a tests: Allow regression test for bug 690819 to be skipped. 2012-06-09 21:13:09 +01:00
Richard W.M. Jones
42475dd21f blockdev_getbsz: Remove test.
The output of this test depends on page size, so on ppc64
it returns 64K.
2012-06-09 20:50:25 +01:00
Richard W.M. Jones
20137c8731 fish: Change test-escapes so test is not endian-sensitive.
The test used the external 'od' command to compare the output of
guestfish with what it's supposed to be.  Unfortunately by default
this outputs groups of 2-byte words, with the words' endianness
affected by the current hardware endianness.  For example:

x86-64$ echo -n ab | od
0000000 061141
0000002

ppc64$ echo -n ab | od
0000000 060542
0000002

By using 'od -b' instead we can output bytes instead of words, and
there is no endianness issue, and the output is clearer:

x86-64$ echo -n ab | od -b
0000000 141 142
0000002

ppc64$ echo -n ab | od -b
0000000 141 142
0000002
2012-06-09 20:18:09 +01:00
Richard W.M. Jones
ac2f9a42fb btrfs: Modify test to correctly detect btrfs availability. 2012-06-09 14:52:39 +01:00
Richard W.M. Jones
011666ae77 btrfs: Modify btrfs availability to test if the kernel supports btrfs.
This is closer to the real meaning of "availability of btrfs", since
just having the btrfs tool doesn't help much if it's not supported by
the kernel too.
2012-06-09 14:52:39 +01:00
Richard W.M. Jones
4ba6aa3eae New API: filesystem-available: tests for filesystem availability.
This also creates an internal filesystem_available function within the
daemon.
2012-06-09 14:52:39 +01:00
Richard W.M. Jones
4f671c829e ppc64: Update README with notes about ppc64 support. 2012-06-08 19:36:34 +01:00
Hilko Bengen
6cf15e8841 out-of-tree build/install fix for translations 2012-06-08 01:24:39 +02:00
Richard W.M. Jones
52af9a88b8 Version 1.19.4. 2012-06-07 14:42:13 +01:00
Richard W.M. Jones
f90c01a5dc Enhance BUGS script.
Since RHBZ was updated, the old python-bugzilla program broke.  When
it was fixed, I found the (undocumented) ordering of the results from
the old tool was no longer true.

This commit adds a small Perl script to sort the output predictably.
Now bugs are sorted by both bug state and bug number, so the output
should be more stable than before.

Re-enable creation of the BUGS file in 'make dist'
(this reverts commit 91f3456244).

Also the BUGS file has been updated.
2012-06-07 09:21:23 +01:00
Richard W.M. Jones
4e5d3b06fb arm: Use #if defined instead of #ifdef.
No functional change.
2012-06-06 23:09:47 +01:00
Richard W.M. Jones
1bdfc88eba ocaml: Fix parameters to ocaml_guestfs_create.
The first parameter (not used) is a unit, so declare it properly.
2012-06-06 13:42:17 +01:00
Richard W.M. Jones
450493cf6b ppc64: Avoid "defined by not used" warning for is_openable function. 2012-06-02 10:35:06 +01:00
Richard W.M. Jones
bbb21f923a Version 1.19.3. 2012-05-31 23:24:22 +01:00
Hilko Bengen
3893dc0b94 Split off GObject tests that require an appliance 2012-05-28 20:01:47 +02:00
Hilko Bengen
148e806826 Fix out-of-tree build for GObject bindings 2012-05-28 20:01:47 +02:00
Richard W.M. Jones
bcbb6bb760 xattr: Refuse to set or get oversized extended attributes.
See:
https://www.redhat.com/archives/libguestfs/2012-May/msg00152.html
2012-05-28 17:55:07 +01:00
Richard W.M. Jones
a7868dd3c9 appliance: 'udevd' has been renamed, since it joined systemd. 2012-05-28 16:09:40 +01:00
Richard W.M. Jones
a7e4a6c692 appliance: Move udev (common package name) to the common section.
This should be just code motion.
2012-05-28 10:01:45 -04:00
Richard W.M. Jones
a81165eb00 Version 1.19.2. 2012-05-27 21:53:21 +01:00
Richard W.M. Jones
42dd5fa5b9 Update to latest gnulib. 2012-05-26 23:07:03 +01:00
Richard W.M. Jones
fe68cd77cb Version 1.19.1. 2012-05-25 16:52:19 +01:00
Richard W.M. Jones
8e8a576429 tests: Add a test of non-ASCII character fidelity on various filesystem types (RHBZ#823887).
Thanks Laszlo Ersek.
2012-05-25 16:38:54 +01:00
Richard W.M. Jones
6445bc5952 doc: Add documentation covering use of utf8 option when mounting vfat (RHBZ#823887). 2012-05-25 15:46:26 +01:00
Richard W.M. Jones
73071b3163 trace: Fix display of non-printing characters.
Previously the code would drop the first character in any sequence of
non-printing characters that occurred within a string.

Fix for commit e6f18c59d5.
2012-05-25 15:46:18 +01:00
Richard W.M. Jones
fba81add94 trace: Fix escaping of non-printable signed characters.
Fix for commit e6f18c59d5.
2012-05-25 15:46:08 +01:00
Wanlong Gao
3936412e33 sysprep: remove the data and log files of puppet
Remove the data(keys) and log files of puppet.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-05-25 08:34:03 +01:00
Richard W.M. Jones
f00066d22b inspection: Don't fail if /etc/HOSTNAME or /etc/hostname are empty files (RHBZ#823821).
Change guestfs___first_line_of_file so that if the file is empty this
returns an empty string instead of an error.  This is consistent with
the behaviour of this function in the case where the file starts with
a \n character, where it would previously have returned an empty
string.

Change all callers so that they handle this case.

Then change the hostname parsing code so that it doesn't give up when
/etc/HOSTNAME is empty, but falls through to the next alternative, and
similarly for /etc/hostname.

Thanks Todd Mummert for finding and diagnosing this bug.
2012-05-24 15:40:36 +01:00
Richard W.M. Jones
cffb7fefc8 inspection: Use parse_release_file to parse ttylinux release file.
parse_release_file should be used to set fs->product_name, instead of
calling guestfs___first_line_of_file directory, although currently the
two are equivalent.

This is code motion and fixes
commit b648b1813f.
2012-05-24 15:38:46 +01:00
Richard W.M. Jones
ee9ab52bc3 fish/mount: Add better error message when -m (mount) fails (RHBZ#824043). 2012-05-24 14:54:54 +01:00
Richard W.M. Jones
216a6d16ab fish: Remove inaccurate comment from code. 2012-05-24 14:50:00 +01:00
Richard W.M. Jones
d5d9ceee8b virt-make-fs: When writing vfat, add utf8 option to mount (RHBZ#823885). 2012-05-24 14:40:52 +01:00
Richard W.M. Jones
975a41db20 virt-make-fs: Provide a clearer error message when mkfs fails (RHBZ#823883). 2012-05-24 12:30:50 +01:00
Richard W.M. Jones
f904fa8223 appliance: Include 'bzip2' in appliance (RHBZ#824716).
Missing package caused this error in compress-device-out:

libguestfs: error: compress_device_out: compression type bzip2 is not supported

Thanks Mohua Li.
2012-05-24 08:48:51 +01:00
Richard W.M. Jones
b8b5ed65c2 FAQ: Add section about using libguestfs in closed source programs. 2012-05-23 11:46:23 +01:00
Richard W.M. Jones
144d7cd988 FAQ: Add a note about "child process died unexpectedly".
This is a common search term on the main website, and there is no good
information provided by Google at present.
2012-05-23 11:19:34 +01:00
Richard W.M. Jones
c7d3aa9cd6 FAQ: Update Ubuntu instructions. 2012-05-23 11:16:19 +01:00
Wanlong Gao
0e05e9f6ce TODO: sysprep todo list clearance
Remove the implemented features from TODO list.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-05-22 15:34:01 +01:00
Richard W.M. Jones
54028b9b66 java: Remove unnecessary imports from the generated Java code. 2012-05-22 14:55:50 +01:00
Richard W.M. Jones
87d604f88c debug: Add setenv debugging command. 2012-05-22 13:50:19 +01:00
Richard W.M. Jones
f774f8fd8d Version 1.19.0. 2012-05-21 16:27:04 +01:00
Richard W.M. Jones
1f3b8b395b New stable branch: Version 1.18.0. 2012-05-21 16:18:41 +01:00
Richard W.M. Jones
91f3456244 build: Temporarily disable generation of 'BUGS' file.
Red Hat Bugzilla is broken: RHBZ#823510.
2012-05-21 15:24:32 +01:00
Richard W.M. Jones
d51631034a Update API support. 2012-05-21 14:35:07 +01:00
Richard W.M. Jones
695b3c9633 Update PO files from Transifex. 2012-05-21 14:34:46 +01:00
Richard W.M. Jones
27b9c1c755 Update road map for 1.18 branch. 2012-05-21 14:18:43 +01:00
Richard W.M. Jones
d1f6325e10 Update release notes for 1.18 branch. 2012-05-21 14:16:58 +01:00
Richard W.M. Jones
a119e057d1 sysprep: Credit Wanlong Gao, Fujitsu under 'AUTHORS' section. 2012-05-18 11:15:39 +01:00
Wanlong Gao
f5e0c0e3ee sysprep: remove kerberos data in the guest
Remove the generated kerberos data in the guest.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-05-18 11:12:07 +01:00
Wanlong Gao
b6d4c29212 sysprep: remove ca certificates in the guest
Remove the ca certificates.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-05-18 11:12:03 +01:00
Richard W.M. Jones
020e7aa505 Version 1.17.43. 2012-05-17 19:52:03 +01:00
Richard W.M. Jones
88a854cf7f virt-ls: Don't initialize path = NULL. 2012-05-17 17:19:09 +01:00
Richard W.M. Jones
32765e440c virt-ls: Fix --checksum option (RHBZ#822490). 2012-05-17 17:11:16 +01:00
Wanlong Gao
b9331a2d73 NEW API: add new api btrfs-fsck
Add the new API btrfs-fsck to check the btrfs filesystem.
Btrfs is currently under heavy development, and not suitable for
any uses other than benchmarking and review. But it'll be useful
in the near future.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-05-15 16:07:45 +01:00
Wanlong Gao
a84d02e8d8 btrfs: change the return value of btrfs-set-seeding
Change the return value from "r" to "0".

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-05-15 16:04:22 +01:00
Wanlong Gao
e9f6ce2492 gobject: remove old generated files further
also remove guestfs-gobject.c

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-05-15 09:13:12 +01:00
Richard W.M. Jones
7fffaf204e gobject: Remove old generated files. 2012-05-15 08:38:46 +01:00
Richard W.M. Jones
2040a15ac7 sysprep: Add missing 'utils.mli' to SOURCES.
Consequently this file was also missing from the tarball.
2012-05-14 23:03:54 +01:00
Richard W.M. Jones
2fd2c85f6a doc: Add notes on how GPT works on 4k sector disks.
I used scsi_debug to create a 4k sector virtual disk:

  modprobe scsi_debug dev_size_mb=128 sector_size=4096

I then used 'gdisk' to create lots of partitions, and used 'hexdump'
to examine what was written to disk.
2012-05-14 17:47:57 +01:00
Richard W.M. Jones
e8ec521dc6 todo: Notes about partitioning tools. 2012-05-14 15:33:21 +01:00
Wanlong Gao
18451abdf5 New API: add new api btrfs-set-seeding to enable or disable seeding.
Add the new API btrfs-set-seeding to support the seeding-device
feature for btrfs.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-05-14 13:21:53 +01:00
Wanlong Gao
a75020a066 TODO: add note for libblkid
Add the note about compatible in TODO for libblkid.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-05-14 13:13:32 +01:00
Richard W.M. Jones
b42dcb05dc examples: Further fixes to mount-local example program.
* Set PS1 prompt properly for bash shells.
* Touch a file into the root directory of the new filesystem.

This fixes commit 46b6766156.
2012-05-14 12:19:31 +01:00
Richard W.M. Jones
2c50a5da46 example: Various fixes to mount-local example program.
* Move MOUNT_OPTIONS to #define at top.
* Move SIZE_MB to #define at top.
* Set PS1 in subshell (doesn't work - why?).
* Hide libguestfs errors from guestfs_mount_local_run.

This fixes commit 46b6766156.
2012-05-14 10:49:16 +01:00
Richard W.M. Jones
a219fede92 debian: examples: Don't break when O_CLOEXEC is not defined.
This affected Debian 6.

This fixes commit 46b6766156.
2012-05-14 10:24:53 +01:00
Richard W.M. Jones
9cf19466f0 Version 1.17.42. 2012-05-13 23:18:44 +01:00
Richard W.M. Jones
034733e981 examples: Add mount options "acl,user_xattr" to mount-local example.
This fixes commit 46b6766156.
2012-05-13 23:01:15 +01:00
Richard W.M. Jones
46b6766156 examples: Add an example of using the mount-local API from C. 2012-05-13 22:53:01 +01:00
Richard W.M. Jones
7201a48d18 examples: Add if HAVE_HIVEX ... endif around virt_dhcp_address example. 2012-05-13 22:20:32 +01:00
Richard W.M. Jones
157f6fb18b qemu: Move -nodefaults etc logically together.
This is just code motion.
2012-05-12 17:22:36 +01:00
Richard W.M. Jones
eb29a9424c arm: Add configure flag '--with-qemu-options'.
This flag allows extra QEMU options to be passed on the command line.

This is useful mainly on arm (see the notes in the updated README
file).
2012-05-12 17:21:24 +01:00
Richard W.M. Jones
30ecbf3ec2 arm: Disable -machine, -enable-kvm options except on x86, x86-64.
Presently KVM is only applicable to x86 and x86-64 (although that will
change in future, and there are rumoured to be implementations for
some current non-x86 architectures).  In any case having these options
breaks ARM, so disable them for non-x86 architectures at the moment.
2012-05-12 16:59:48 +01:00
Richard W.M. Jones
10725acf96 arm: On Linux ARM kernels, the serial console is ttyAMA0.
Cope with unnecessary lack of standardization.
2012-05-12 16:59:48 +01:00
Richard W.M. Jones
5c59790845 arm: Disable test for -no-hpet during launch. 2012-05-12 16:59:48 +01:00
Richard W.M. Jones
a3718c6b8b arm: Set minimum LIBGUESTFS_MEMSIZE at 128.
For ARM Versatile ("versatilepb") architecture, memsize must be set to
256 (megabytes) else the appliance is unable to boot.  Previously
setting LIBGUESTFS_MEMSIZE=256 was not allowed.

Versatile Express has larger limits.
2012-05-12 16:59:48 +01:00
Richard W.M. Jones
77afc92fcd configure: Fix valgrind --vgdb test. 2012-05-12 16:59:48 +01:00
Richard W.M. Jones
0e960614ab configure: Add a comment about vmchannel_test. 2012-05-12 16:59:47 +01:00
Richard W.M. Jones
e275786cb2 Version 1.17.41. 2012-05-11 14:20:23 +01:00
Richard W.M. Jones
a50db3be60 doc: Add a note about compiling under clang. 2012-05-11 13:50:56 +01:00
Richard W.M. Jones
a1680f03b7 configure: Allow systemtap/DTrace userspace probes to be disabled.
'./configure --disable-probes' will disable these probes.  Otherwise
they are autodetected as before.

The <sys/sdt.h> produces lots of errors when you try to compile with
these probes enabled under clang, so it is necessary to provide a way
to disable them for clang users.
2012-05-11 13:47:29 +01:00
Richard W.M. Jones
042a0b063b FAQ: Fix typo in download (thanks badnews@IRC) 2012-05-10 23:00:31 +01:00
Wanlong Gao
1581dbe79f sysprep: remove blkid tab in the guest
Remove blkid tab cache in the guest.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-05-10 16:27:59 +01:00
Richard W.M. Jones
5647567826 configure: Replace 'echo -n' with 'AS_ECHO_N' macro (thanks Eric Blake). 2012-05-09 16:29:39 +01:00
Richard W.M. Jones
7b72c12428 Update to latest gnulib. 2012-05-09 16:13:57 +01:00
Richard W.M. Jones
5764ac12cf bootstrap: Remove autopoint, po stuff from bootstrap script.
It's not needed since we no longer use gettextize cruft.
2012-05-09 16:13:57 +01:00
Richard W.M. Jones
d0ec0b4c8c Version 1.17.40. 2012-05-08 22:58:05 +01:00
Richard W.M. Jones
af1439bc9f Updated PO files from Transifex. 2012-05-08 17:32:49 +01:00
Wanlong Gao
a79b22a613 sysprep: remove pam data
Remove the generated pam data in the guest.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-05-08 12:31:12 +01:00
Richard W.M. Jones
dd23234f73 test-tool: Implement -V / --version option. 2012-05-05 14:55:03 +01:00
Richard W.M. Jones
3ea36903f2 Update API support. 2012-05-03 18:05:32 +01:00
Richard W.M. Jones
eaa05ff012 Version 1.17.39. 2012-05-03 16:50:25 +01:00
Richard W.M. Jones
e0f36898cb virt-df: Don't fail immediately if a disk is not accessible (RHBZ#789504). 2012-05-03 15:38:08 +01:00
Richard W.M. Jones
bd91bd76d1 virt-alignment-scan: Don't fail immediately if a disk is not accessible (RHBZ#789504). 2012-05-03 15:37:59 +01:00
Richard W.M. Jones
9e2cdd309b virt-alignment-scan, virt-df: Add newlines after error messages. 2012-05-03 15:23:14 +01:00
Richard W.M. Jones
a2cc317c03 virt-make-fs: Add a test of btrfs (regression test for RHBZ#816098). 2012-05-03 14:32:25 +01:00
Richard W.M. Jones
c53ea071c6 virt-make-fs: Simplify test code.
This is just code motion.
2012-05-03 14:32:24 +01:00
Richard W.M. Jones
0cc3525142 virt-make-fs: Fix estimation when making btrfs (RHBZ#816098).
This also disables data and metadata duplication, which is not very
useful on a constructed filesystem on a virtual disk.
2012-05-03 14:32:24 +01:00
Richard W.M. Jones
93734c78d8 virt-make-fs: Use mount instead of mount_options. 2012-05-03 14:32:24 +01:00
Richard W.M. Jones
e60556d927 virt-make-fs: Fix filesystem type check when estimating ntfs. 2012-05-03 14:32:24 +01:00
Richard W.M. Jones
00202b9c29 tests: Regression test for RHBZ#701814.
This commit adds a tests/xml directory, and an LD_PRELOAD module which
can fake arbitrary libvirt XML from an external file (and is therefore
a much more flexible test than using the libvirt test:// driver
alone).

Also added is one regression test for:
https://bugzilla.redhat.com/show_bug.cgi?id=701814

Loading the given libvirt XML using Sys::Guestfs::Lib::open_guest
used to fail with the error:

  format parameter is empty or contains disallowed characters at /home/rjones/d/libguestfs/perl/blib/lib/Sys/Guestfs/Lib.pm line 256.

Thanks to Tom Horsley for supplying the test data.
2012-05-03 12:30:05 +01:00
Richard W.M. Jones
f072a21f3a perl: Don't fail if 'type' (disk format) attribute is missing in libvirt XML (RHBZ#701814).
Old versions of libvirt allowed you to define disks like this:

    <disk type='file' device='disk'>
      <driver name='qemu'/>
      ...

Since the <driver> element does not have a 'type' attribute (which
defines the format), we are supposed to do autodetection, so the
format should be undefined.

However what actually happened was that the code in
Sys::Guestfs::Lib::open_guest received format as an empty string from
the xpath query, causing libguestfs to give an error.

If the xpath query returns the format as an empty string, undefine it.
2012-05-03 12:30:05 +01:00
Richard W.M. Jones
66a525ce5a fish: Add a regression test for the 'glob' command. 2012-05-02 16:35:43 +01:00
Richard W.M. Jones
620ad8eb1a fish: glob command now expands /dev/ patterns (RHBZ#635971).
For example:

><fs> glob echo /dev/*
/dev/vda
/dev/vda1
/dev/vda2
/dev/vda3
><fs> glob echo /dev/v*/*
/dev/vg_f16x64/lv_root
/dev/vg_f16x64/lv_swap
2012-05-02 16:33:23 +01:00
Richard W.M. Jones
79bf966cea fish: Move 'feature_available' function to global.
This is just code motion.
2012-05-02 15:34:02 +01:00
Richard W.M. Jones
29c5e052e4 fish: Clean up glob code and make it return error if malloc fails.
This commit tidies up the code for the 'glob' command.  It also makes
the command return an error if malloc fails (previously it would just
print a message but not return any error indication).
2012-05-02 14:44:54 +01:00
Richard W.M. Jones
1304236c6c fish: Add --pipe-error flag to allow detection of errors in pipe commands (RHBZ#803533).
For a test case, see:
https://bugzilla.redhat.com/show_bug.cgi?id=803533

In guestfish, we use the gnulib closeout module which sets up an
atexit handler to detect if there were any errors on stdout when the
program exits.  This is so we can fail correctly in out of disk space
cases like:

 guestfish [...] > output

However the atexit handler just checks that there was any error on
stdout (using ferror).  If a pipe command such as:

 ><fs> command_with_lots_of_output | head

ran at any time during the session, the error flag would be set
(because the underlying writes failed with EPIPE errors).

So the commit first adds a test for ferror (stdout) after each command
that we issue.  This brings error handling closer to the point of
failure, and so is generally a good thing.

Secondly we reset the error flag after detecting and dealing with the
error, so that avoids the redundant 'guestfish: write error' message
produced by gnulib closeout.

Thirdly we add a --pipe-error flag which causes guestfish commands to
fail on pipe commands line the one above.  The default is off for
backwards compatibility reasons.
2012-05-02 13:55:18 +01:00
Richard W.M. Jones
95a67b1e6a Update release notes. 2012-05-01 19:49:54 +01:00
Richard W.M. Jones
500cc67f29 Version 1.17.38. 2012-05-01 14:08:39 +01:00
Richard W.M. Jones
e6bfb55f65 Turn libguestfs FAQ into a man page: guestfs-faq(1). 2012-05-01 13:55:53 +01:00
Richard W.M. Jones
922052c70f doc: Rewrite description section in man page guestfs(3).
Make the introduction in the man page shorter and punchier, so it
leads readers directly to other pages of interest.
2012-05-01 11:18:57 +01:00
Richard W.M. Jones
51f43402f6 Version 1.17.37. 2012-05-01 09:44:10 +01:00
Richard W.M. Jones
027fefd517 Add gettext support for OCaml tools (virt-resize, virt-sparsify, virt-sysprep).
Note that this support is optional: To enable it, install the
ocaml-gettext library from
http://forge.ocamlcore.org/projects/ocaml-gettext .  If this library
is not installed, then configure detects this and inserts dummy
gettext functions that do nothing.
2012-05-01 09:39:35 +01:00
Richard W.M. Jones
75514ab57a Remove gettextize.
Replace the sociopathic nonsense in gettextize with a simple
Makefile.am which does the same ... and is faster.
2012-05-01 08:58:15 +01:00
Richard W.M. Jones
6aa95e87c1 Remove "convenience header" "gettext.h" and use <libintl.h> instead.
gettextize provides a local file called "gettext.h".  Remove this and
use <libintl.h> from glibc headers instead.

Most of this change is mechanical: #include <libintl.h> in every C
file which uses any gettext function.  But also we remove the
gettext.h file, and adjust the "_" macros.

Note that this effectively removes the ./configure --disable-nls
option, although we don't know if that ever worked.
2012-05-01 08:57:55 +01:00
Richard W.M. Jones
ea74856d95 configure: There are now more OCaml tools than just virt-resize.
virt-resize, virt-sparsify, virt-sysprep are all OCaml tools, so
change what is printed in the report.
2012-04-30 15:08:34 +01:00
Richard W.M. Jones
79822d46e3 configure: Comment fix. 2012-04-30 15:08:34 +01:00
Richard W.M. Jones
bb73cf0941 Move 'libguestfs.pc' (pkgconfig file) to src/ directory.
Since it describes the C library, it's better in the src/ directory.
2012-04-30 15:08:34 +01:00
Richard W.M. Jones
a23e84ee02 todo: virt-sparsify whitelist option. 2012-04-30 09:42:36 +01:00
Richard W.M. Jones
cc79854037 debug: 'progress' (unsupported debug command) now checks argument is reasonable (RHBZ#816839).
Thanks Yuyu Zhou.
2012-04-27 15:35:50 +01:00
Richard W.M. Jones
d448ae0c2b gobject: Fix installation of headers.
RPM build errors:
error: Installed (but unpackaged) file(s) found:
   /usr/include/optargs-add_domain.h
   /usr/include/optargs-add_drive_opts.h
   /usr/include/optargs-btrfs_filesystem_resize.h
   /usr/include/optargs-compress_device_out.h
   /usr/include/optargs-compress_out.h
   /usr/include/optargs-copy_device_to_device.h
   /usr/include/optargs-copy_device_to_file.h
   /usr/include/optargs-copy_file_to_device.h
   /usr/include/optargs-copy_file_to_file.h
   /usr/include/optargs-e2fsck.h
   /usr/include/optargs-inspect_get_icon.h
   /usr/include/optargs-md_create.h
   /usr/include/optargs-mkfs_btrfs.h
   /usr/include/optargs-mkfs_opts.h
   /usr/include/optargs-mount_9p.h
   /usr/include/optargs-mount_local.h
   /usr/include/optargs-ntfsclone_out.h
   /usr/include/optargs-ntfsfix.h
   /usr/include/optargs-ntfsresize_opts.h
   /usr/include/optargs-set_e2attrs.h
   /usr/include/optargs-test0.h
   /usr/include/optargs-tune2fs.h
   /usr/include/optargs-umount_local.h
   /usr/include/session.h
   /usr/include/struct-application.h
   /usr/include/struct-btrfssubvolume.h
   /usr/include/struct-dirent.h
   /usr/include/struct-inotify_event.h
   /usr/include/struct-int_bool.h
   /usr/include/struct-isoinfo.h
   /usr/include/struct-lvm_lv.h
   /usr/include/struct-lvm_pv.h
   /usr/include/struct-lvm_vg.h
   /usr/include/struct-mdstat.h
   /usr/include/struct-partition.h
   /usr/include/struct-stat.h
   /usr/include/struct-statvfs.h
   /usr/include/struct-version.h
   /usr/include/struct-xattr.h
   /usr/include/tristate.h

We want to put these headers into the subdirectory, but not
guestfs-gobject.h.  This isn't easy with automake.
2012-04-27 09:11:33 +01:00
Richard W.M. Jones
1f0964536b gobject: Fix whitespace in Makefile.am. 2012-04-27 09:10:33 +01:00
Wanlong Gao
23f8cab1e8 sysprep: Remove the data of dovecot
Remove the data of dovecot.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-04-27 08:51:03 +01:00
Wanlong Gao
ac75e46c5a sysprep: remove the logfiles configured by logrotate
Remove the logfiles configured by /etc/logrotate.d/*.
Omit the logfile of "samba" and "sssd" which we removed
them separately .

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-04-27 08:49:07 +01:00
Richard W.M. Jones
e493884a76 Version 1.17.36. 2012-04-26 18:03:58 +01:00
Richard W.M. Jones
819cba54e6 btrfs: Fix btrfs test so it works with btrfs-progs in Rawhide.
See: http://bugzilla.redhat.com/816346
2012-04-26 17:55:54 +01:00
Richard W.M. Jones
a505423e58 lib: Remove the BUSY state.
Originally this state was intended so that in some way you could find
out if the appliance was running a command.  However there was never a
thread-safe way to access the state of the handle, so in effect you
could never do anything useful safely with this information.

This commit completely removes the BUSY state.

The only visible change is to the guestfs_is_busy API.  Previously you
could never call this safely from another thread.  If you called it
from the same thread it would always return false (since the current
thread can't be running a libguestfs command at that point by
definition).  Now it always returns false.
2012-04-26 16:48:47 +01:00
Richard W.M. Jones
eafefab937 gobject: Use generator_built macro to ensure generated files are rebuilt properly. 2012-04-26 15:52:59 +01:00
Matthew Booth
d58cb029a3 gobject: Move headers into a subdirectory
The gobject bindings generate a large number of header files, which pollute
/usr/include when installed. This patch moves them all into a guestfs-gobject/
subdirectory. guestfs-gobject.h remains in the same place.

This change also moves generated source files into src/, because it makes the
gobject directory a bit tidier.
2012-04-26 14:02:26 +01:00
Richard W.M. Jones
317ba894b3 btrfs: Fix docs for btrfs_subvolume_set_default (thanks Matt Booth).
This fixes commit 87ea7a0409.
2012-04-26 13:55:30 +01:00
Matthew Booth
8fb67ee66a gobject: Implement libguestfs events as signals
Implement libguestfs events as GObject signals. Callback arguments are passed in
a boxed object.

Note that this patch fixes the length of the uint64_t array in the callback
arguments at 16, whereas it is actually arbitrary length. This is to make it
introspectable. There is currently no way to pass an arbitrary length array to a
callback, and have its type introspected.
2012-04-26 13:35:34 +01:00
Matthew Booth
6c88c3758b gobject: Wrap literal sections in POD in CDATA sections 2012-04-26 13:35:33 +01:00
Matthew Booth
a2dc83cf03 gobject: NFC generated code formatting fix 2012-04-26 13:35:33 +01:00
Richard W.M. Jones
8cb30dc805 rescue: Add --scratch option.
This lets you create temporary scratch disks.
2012-04-26 12:56:34 +01:00
Richard W.M. Jones
39d79e677b fish: Add opaque field to the drives list for programs to use.
Not used at present.
2012-04-26 12:56:01 +01:00
Richard W.M. Jones
2cc4314ecc Version 1.17.35. 2012-04-25 23:08:24 +01:00
Richard W.M. Jones
beaa528855 appliance: Remove some unnecessary errors.
virt-rescue prints errors such as:

  rm: cannot remove `/proc': Is a directory
  mkdir: cannot create directory `/proc': File exists
  rm: cannot remove `/sys': Is a directory
  mkdir: cannot create directory `/sys': File exists

People have reported these errors (which are nothing to worry about)
as bugs in the past, so avoid them where possible.
2012-04-25 22:58:25 +01:00
Richard W.M. Jones
2d414112f7 btrfs: Enhance the btrfs device test.
This enhances commit 87ea7a0409.
2012-04-25 19:42:26 +01:00
Richard W.M. Jones
12c5394d4c tests: Add some more substantial test data.
The two tarballs:

  8252 bytes   tests/data/filesanddirs-10M.tar.xz
 41152 bytes   tests/data/filesanddirs-100M.tar.xz

contain, as their names suggest, highly compressed files and
directories, with unpacked size respectively around 10M and 100M (the
precise size after unpacking depends on the filesystem).

These can be used for testing purposes.
2012-04-25 19:26:57 +01:00
Richard W.M. Jones
e188eb8268 btrfs-device-delete: Use correct (sysroot-prefixed) path to filesystem.
This fixes commit 87ea7a0409.
2012-04-25 19:08:56 +01:00
Richard W.M. Jones
87ea7a0409 New btrfs APIs.
Bind the easy parts of the 'btrfs' program.

The new APIs are:

btrfs-device-add: add devices to a btrfs filesystem
btrfs-device-delete: remove devices from a btrfs filesystem
btrfs-filesystem-sync: sync a btrfs filesystem
btrfs-filesystem-balance: balance a btrfs filesystem
btrfs-subvolume-create: create a btrfs snapshot
btrfs-subvolume-delete: delete a btrfs snapshot
btrfs-subvolume-list: list btrfs snapshots and subvolumes
btrfs-subvolume-set-default: set default btrfs subvolume
btrfs-subvolume-snapshot: create a writable btrfs snapshot
2012-04-25 17:32:30 +01:00
Richard W.M. Jones
3cc9703f90 btrfs: Modify mkfs-btrfs API so it takes a list of devices.
btrfs filesystems can span multiple filesystems.

Note this changes the API, but this API has not yet been released in a
stable version of libguestfs.
2012-04-25 16:33:31 +01:00
Wanlong Gao
bd1a699c15 TODO: remove sssd and samba in sysprep
remove the TODO of sssd and samba in sysprep.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-04-25 11:53:04 +01:00
Wanlong Gao
046d6c20e7 sysprep: fix typo of the object
Fix the typo of the OBJECT.
I'm sorry for the copy and paste typo.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-04-25 11:53:04 +01:00
Wanlong Gao
303b159134 sysprep: remove the db and log of samba
Remove the db and log of samba.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-04-25 11:53:01 +01:00
Wanlong Gao
580ae3297a sysprep: remove the db and log of sssd
Remove the db and log of sssd.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-04-25 11:52:56 +01:00
Richard W.M. Jones
a98d9f4840 todo: Suggest 'virt-customize' tool. 2012-04-24 19:36:33 +01:00
Richard W.M. Jones
0e49186814 todo: Debian APT cache is now removed (thanks Wanlong Gao).
This updates commit 7fc7c3aa5b.
2012-04-24 19:26:09 +01:00
Richard W.M. Jones
5fab4db8de bugs: Update BUGS file. 2012-04-24 19:24:10 +01:00
Richard W.M. Jones
d16868b938 bugs: Print count of bugs in each section. 2012-04-24 19:24:00 +01:00
Richard W.M. Jones
37a3cdbc13 generator: Add explicit types to pod memoization code.
This is just code motion.
2012-04-24 17:38:48 +01:00
Richard W.M. Jones
a2d30626cb Version 1.17.34. 2012-04-24 17:17:59 +01:00
Wanlong Gao
7fc7c3aa5b sysprep: remove the cache of package manager
Remove the cache of package manager like yum and apt.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>

RWMJ:
- Small code cleanup.
2012-04-24 08:32:08 +01:00
Wanlong Gao
95515c4576 sysprep: flag the system for reconfiguration
Flag the system for reconfiguration by touching /.unconfigured .

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>

RWMJ:
- Updated so this is disabled by default, since it requires
  user intervention at next boot.
2012-04-23 15:37:28 +01:00
Wanlong Gao
148b51fe0b sysprep: remove user accounts
Remove user accounts from /etc/passwd, /etc/group,
/etc/shadow, and the home directory of the user,
except the root user.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>

RWMJ:
- Updated to use Augeas to delete accounts.
- Disable this by default, since it is very invasive.
2012-04-23 15:37:24 +01:00
Richard W.M. Jones
7916f5d43c Version 1.17.33. 2012-04-22 23:32:21 +01:00
Richard W.M. Jones
8d41470b6f sysprep: Don't enable every option by default.
All current operations are enabled by default.

Also:

* The POD description is split into a heading and the description body.

* An 'enabled_by_default' flag is added to the structure.
2012-04-21 22:28:15 +01:00
Richard W.M. Jones
97ef9afca7 build: Change comment above OCaml tools. 2012-04-21 21:43:32 +01:00
Richard W.M. Jones
03d321d022 guests: Add /etc/shadow file to fedora.img.
This is used for testing file permissions and SELinux contexts.
2012-04-21 15:37:43 +01:00
Richard W.M. Jones
c844a38d6e tests: Space before parens in perl code. 2012-04-21 14:39:21 +01:00
Richard W.M. Jones
2152affd30 Update release notes. 2012-04-19 23:05:53 +01:00
Richard W.M. Jones
36f1eb9225 configure: Test for tgetent, tputs and 'UP' symbols (from libtinfo). 2012-04-19 10:50:44 +01:00
Jim Meyering
e97b6a1bb1 maint: fix doc typos
Fix typos spotted by http://github.com/lyda/misspell-check.
* configure.ac: As above.
* ocaml/examples/guestfs-ocaml.pod: Likewise.
* fish/guestfish.pod: Likewise.
2012-04-18 20:04:38 +01:00
Richard W.M. Jones
c253c69d09 Remove obsolete valgrind rule from C API tests. 2012-04-18 17:29:13 +01:00
Richard W.M. Jones
58a5b5bd94 extra-tests: Check if valgrind supports --vgdb=no option.
This option didn't exist in RHEL 6 valgrind.
2012-04-18 17:28:47 +01:00
Richard W.M. Jones
5d6a323b93 Check library still compiles without libvirt. 2012-04-18 14:25:15 +01:00
Richard W.M. Jones
b0b5fdc69f sparsify: Add a note about sparsify on tmpfs. 2012-04-18 10:51:04 +01:00
Matthew Booth
4542401fee Don't abort inspection if mdadm.conf ARRAY doesn't have a uuid 2012-04-18 10:10:03 +01:00
Richard W.M. Jones
158479ffc0 Version 1.17.32. 2012-04-17 18:33:23 +01:00
Richard W.M. Jones
255882a3f6 python: Remove 'del g' from the docs, replace with 'g.close ()'.
'del g' is a trap for the unwary.  If the handle has any other
references, it does nothing (in fact, it can be actively dangerous if
the user was expecting the appliance to go away).  In non-CPython it
can be delayed arbitrarily long.

Using 'g.close()' on the other hand is always safe.
2012-04-17 17:41:43 +01:00
Richard W.M. Jones
7995c513ba todo: Note about -cpu host. 2012-04-17 17:41:33 +01:00
Richard W.M. Jones
6065f21b10 virt-alignment-scan: Fix error code.
This fixes commit fb401ebff8.
2012-04-17 16:24:27 +01:00
Richard W.M. Jones
84d450210b resize, sparsify: Add a simple-minded check to stop indisk = outdisk. 2012-04-17 15:03:02 +01:00
Richard W.M. Jones
8d3d5a52d2 sparsify: Fix comma/colon and quoting in qemu-img command.
Colon characters are not allowed in qemu/qemu-img filenames.  There's
no way to quote them.

Comma characters CAN be used.  However they must be quoted (by
doubling) when used in the '-o' option.

Fix general quoting problems in the external command.
2012-04-17 14:58:40 +01:00
Richard W.M. Jones
fb401ebff8 virt-alignment-scan: Add ability to list all domains.
The output looks like this:

 F16x64:/dev/sda1      1048576         1024K   ok
 F16x64:/dev/sda2      2097152         2048K   ok
 F16x64:/dev/sda3    526385152         2048K   ok

If the --uuid option is used, then UUIDs are shown instead of names.
2012-04-17 10:38:07 +01:00
Richard W.M. Jones
5ec0fba56e gitignore: Move cscope.out to second section.
This fixes commit 3c843e2129.
2012-04-16 15:53:34 +01:00
Matthew Booth
3c843e2129 .gitignore: cscope.out isn't always at the top-level 2012-04-16 15:48:16 +01:00
Richard W.M. Jones
63cb25236b fuse: Improve reporting in mount-local when verbose is enabled. 2012-04-16 13:30:07 +01:00
Richard W.M. Jones
6c2b8340c3 Version 1.17.31. 2012-04-15 21:53:43 +01:00
Richard W.M. Jones
8104b2dfab New APIs for reading and writing ext2 file attributes and file generation.
The new APIs are:

  get-e2attrs: List ext2 file attributes of a file.
  set-e2attrs: Set or clear ext2 file attributes of a file.
  get-e2generation: Get ext2 file generation of a file.
  set-e2generation: Set ext2 file generation of a file.

These are implemented using the lsattr and chattr programs from
e2fsprogs.
2012-04-13 15:44:17 +01:00
Richard W.M. Jones
9ccde76f61 todo: Remove obsolete sections from the TODO file. 2012-04-13 12:41:04 +01:00
Richard W.M. Jones
2a5a5e15e2 sysprep: Make the tests run quietly. 2012-04-13 09:35:08 +01:00
Wanlong Gao
1f373aa246 sysprep: bash_history: fix copyright
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-04-13 09:00:35 +01:00
Wanlong Gao
ecdfd2c8cc sysprep: remove .ssh directory in users' directory
Remove the .ssh directory of user "root" and any other
users who have a .ssh directory in their home directory.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-04-13 08:59:25 +01:00
Richard W.M. Jones
b288f21e0c Version 1.17.30. 2012-04-13 08:43:37 +01:00
Richard W.M. Jones
4b0e525d1d tests: Fix reference to guestfish in test for RHBZ#811649.
This fixes commit a9bd90abfb.
2012-04-13 08:31:01 +01:00
Richard W.M. Jones
e14f545f81 Version 1.17.29. 2012-04-12 21:35:14 +01:00
Richard W.M. Jones
a9bd90abfb Add regression test to test funny filenames (RHBZ#811649). 2012-04-12 18:59:14 +01:00
Richard W.M. Jones
d2183a62aa lib: Escape , as ,, on qemu command line (RHBZ#811649). 2012-04-12 18:59:14 +01:00
Richard W.M. Jones
4be630edb3 lib: Remove check_path function, limitation is colon, not comma (RHBZ#811649).
Remove the bogus check_path function and move the functionality into
the two places where it was being used.

  qemu -cdrom ,

works fine, I tested it.

Colon cannot be used in a block device filename anywhere, since the
qemu block driver interprets it as a prefix.  There is no known way to
work around this problem.  I checked this is true with kwolf.

Comma is fine in -drive options, provided it is escaped by doubling it.
2012-04-12 18:59:13 +01:00
Richard W.M. Jones
4dba0e1e9d Revert "launch: don't add a drive twice"
This reverts commit be47b66c30.
2012-04-12 18:59:13 +01:00
Richard W.M. Jones
a97e9429ea extra-tests: Add suppression for memory leak in FUSE. 2012-04-12 18:59:04 +01:00
Richard W.M. Jones
5b414f581f extra-tests: ocaml: Use a short delay instead of Thread.yield.
On the new faster computer, Thread.yield wasn't yielding, so the
second thread would block the main test from proceeding (only when run
under valgrind however).
2012-04-12 18:43:59 +01:00
Richard W.M. Jones
681377f1b2 inspector: Update example XML. 2012-04-12 10:21:15 +01:00
Richard W.M. Jones
96b6504b09 inspection: Remove spurious warning for Ubuntu 10.04 with encrypted swap (RHBZ#811872). 2012-04-12 10:21:15 +01:00
Richard W.M. Jones
a996f0d370 inspector: Fix incorrect arch in example-ubuntu.xml. 2012-04-12 10:21:15 +01:00
Wanlong Gao
6c276606d7 sysprep: remove the bash history of users
Remove the bash history of users in home directory,
and history of root.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-04-12 09:38:35 +01:00
Richard W.M. Jones
ed2a06708c website: typo: guestfs-performance.3 -> guestfs-performance.1 2012-04-12 08:22:53 +01:00
Richard W.M. Jones
292664c3ac Version 1.17.28. 2012-04-11 23:00:39 +01:00
Richard W.M. Jones
287d5a126e New man page: guestfs-performance(1).
This contains tips for engineering libguestfs for greatest performance.
2012-04-11 22:45:32 +01:00
Richard W.M. Jones
307e8bc51a docs: Add libguestfs-test-tool(1) and libguestfs-make-fixed-appliance(1) to guestfs(3) man page.
Inexplicably these were not included before.
2012-04-11 22:04:14 +01:00
Richard W.M. Jones
3e164f15b7 po-docs: Allow parallel builds in po-docs directory.
The first time the directory is checked out from git, there are no
*.pod files.  In a parallel build, the first thread notices this and
runs the 'make -C .. update-po' rule, but the other threads also try
to run at the same time and fail.
2012-04-11 18:46:41 +01:00
Richard W.M. Jones
c1fb89e7fc po-docs: No need to touch virt-sysprep.1 output file. 2012-04-11 18:36:24 +01:00
Richard W.M. Jones
de2dc9f71d extra-tests: Add suppression for libvirt/gnutls leak.
https://www.redhat.com/archives/libvir-list/2012-April/msg00322.html
2012-04-11 18:20:33 +01:00
Richard W.M. Jones
b6dd7e7250 python: Add a regression test for RHBZ#811650. 2012-04-11 17:56:12 +01:00
Richard W.M. Jones
0f7de2279a launch: Set error when qemu fails early during launch (RHBZ#811650).
This caused the Python bindings (and probably others) to
segfault because guestfs_last_error(g) would return NULL.
2012-04-11 17:43:47 +01:00
Richard W.M. Jones
f237ae2ad6 python: Add PYTHONPATH to './run' script.
Also:

 - tidy up the script
 - use the ./run script when running Python tests
2012-04-11 17:27:25 +01:00
Richard W.M. Jones
4ee518508f sysprep: Sort and align all arguments (thanks Wanlong Gao). 2012-04-11 16:27:00 +01:00
Richard W.M. Jones
16b2ffa97e sysprep: Make a common Utils.compare_command_line_args function.
This isn't quite code motion, since the new function also ignores case
(which previously we didn't ignore).
2012-04-11 16:26:32 +01:00
Richard W.M. Jones
a3d6629a0b sysprep: Move skip_dashes function into Utils module.
This is mostly code motion, but I also changed the function to use
String.unsafe_get and raise Invalid_argument on failure.
2012-04-11 16:22:58 +01:00
Richard W.M. Jones
edca57b49e sysprep: Add utils.mli (interface) file. 2012-04-11 16:14:57 +01:00
Richard W.M. Jones
b8fbbcf791 sysprep: Print some logging by default.
It can be disabled using the --quiet option.

The logging looks like:

Examining the guest ...
Performing "cron-spool" ...
Performing "dhcp-client-state" ...
Performing "dhcp-server-state" ...
Performing "hostname" ...
Performing "logfiles" ...
Performing "mail-spool" ...
Performing "net-hwaddr" ...
Performing "random-seed" ...
Performing "rhn-systemid" ...
Performing "script" ...
Performing "smolt-uuid" ...
Performing "ssh-hostkeys" ...
Performing "udev-persistent-net" ...
Performing "utmp" ...
Performing "yum-uuid" ...

Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-04-11 13:50:53 +01:00
Richard W.M. Jones
b10a3d718e extra-tests: Disable valgrind vgdb.
This leaves files called 'vgdb-pipe-*' in .
2012-04-10 18:14:16 +01:00
Richard W.M. Jones
7fe9905c4b Version 1.17.27. 2012-04-10 15:44:02 +01:00
Qin Guan
5e054f8731 sysprep: Allow hwaddr to be removed on other Red Hat derivatives (RHBZ#811117). 2012-04-10 14:15:18 +01:00
Qin Guan
60b87d0a5c sysprep: Allow hostname to be set on other Red Hat derivatives (RHBZ#811112). 2012-04-10 14:15:08 +01:00
Richard W.M. Jones
8ae322e5a7 Use posix_fadvise when uploading or downloading files.
But ignore it if the call fails, since the file descriptor could be a
non-file (eg. /dev/stdout).
2012-04-09 17:36:56 +01:00
Richard W.M. Jones
669c0bd407 Fix libguestfs-make-fixed-appliance --help option so it displays usage.
Previously it printed 'Internal error!'
2012-04-09 15:53:37 +01:00
Richard W.M. Jones
12a56dfc8a gobject: Remove guestfs-gobject.c from POTFILES.in.
This file no longer exists after the sources were split across
multiple files for the benefit of gtk-doc.
2012-04-06 20:09:18 +01:00
Richard W.M. Jones
f2ac7c18a7 tests: Fix guest building so parallel 'make -jN check' works.
This means renaming various temporary files (eg. fstab.tmp) that
several of the scripts were using so they don't conflict
(eg. fstab.tmp.$$).

Also the rule:

  fedora-md1.img fedora-md2.img: guest-aux/make-fedora-img.pl

causes the script to run twice in parallel when using 'make -jN'.
Replace this with a stamp file so it runs once:

  fedora-md1.img fedora-md2.img: stamp-fedora-md.img
  stamp-fedora-md.img: guest-aux/make-fedora-img.pl
2012-04-06 18:49:45 +01:00
Richard W.M. Jones
418a048215 tests: Don't print "4" when running make-windows-img.sh
The return value of the pwrite-device command -- 4 (bytes) -- is
printed out.  Hide it instead.
2012-04-06 18:48:58 +01:00
Matthew Booth
d9f77f214b fuse: Add missing #include to guestmount.c
Fix compilation failure on F17
2012-04-04 14:26:51 +01:00
Richard W.M. Jones
4b86f1ad03 debian: Suggest 'apt-get build-dep' to install dependencies. 2012-04-04 12:46:40 +01:00
Richard W.M. Jones
ec162e7d58 Update RELEASE-NOTES file for future 1.18 release. 2012-04-03 23:10:05 +01:00
Richard W.M. Jones
19494b1988 Version 1.17.26. 2012-04-03 12:58:24 +01:00
Richard W.M. Jones
465c97ebf4 parallel mount-local test: Don't run more than 12 threads.
On the Koji builder that has lots of memory, this was trying to run
something like 20 threads.
2012-04-03 10:52:27 +01:00
Richard W.M. Jones
999aac63eb Use absolute paths where necessary in .gitignore file. 2012-04-03 10:48:55 +01:00
Richard W.M. Jones
5c8a241e5c inspection: Support Fedora 17+ (RHBZ#809361).
Recognize grub2 as a bootloader, and /bin being a symlink to
/usr/bin (ie. UsrMove feature added in Fedora 17+).
2012-04-03 10:24:27 +01:00
Richard W.M. Jones
04ddf3cfa2 sysprep: Add GDM and session preferences to logfiles. 2012-04-03 09:54:50 +01:00
Richard W.M. Jones
25d156f262 sysprep: Remove installation logfiles in /root. 2012-04-03 09:48:45 +01:00
Richard W.M. Jones
a1d88b60e3 sysprep: Include logfile glob list in the man page. 2012-04-03 09:43:12 +01:00
Richard W.M. Jones
817cebe3ad Version 1.17.25. 2012-04-02 19:09:52 +01:00
Richard W.M. Jones
50009403b3 New API: mkfs-btrfs for creating btrfs filesystems (RHBZ#807905).
This allows all parameters from btrfs to be accessed.
2012-04-02 10:12:38 +01:00
Richard W.M. Jones
77ac6b73cd mkfs: Don't allow blocksize to be set on btrfs (RHBZ#807905). 2012-04-02 08:46:23 +01:00
Richard W.M. Jones
f8a88def14 extra-tests: Test virt-sysprep. 2012-04-01 21:55:09 +01:00
Richard W.M. Jones
95123a9144 sysprep: Add a test of the --script option. 2012-04-01 20:02:25 +01:00
Richard W.M. Jones
6282d92b1b sysprep: Simplify and tidy up the test. 2012-04-01 20:01:08 +01:00
Richard W.M. Jones
9cb976ab5f sysprep: script: Documentation fix. 2012-04-01 20:00:36 +01:00
Richard W.M. Jones
b1f997164e sysprep: script: Miscellaneous fixes and cleanups to shell script. 2012-04-01 20:00:28 +01:00
Richard W.M. Jones
de656448f7 sysprep: script: Wait for child process to exit. 2012-04-01 20:00:06 +01:00
Richard W.M. Jones
6c88ae851f sysprep: script: Remove useless check that script is executable.
This check will fail if the script is on the path.  Also document
that script must be on the path or else the full path to the script
must be given.
2012-04-01 19:59:32 +01:00
Richard W.M. Jones
65e20e34dd sysprep: Add some debug code when performing operations. 2012-04-01 19:57:41 +01:00
Richard W.M. Jones
64550dcad2 Version 1.17.24. 2012-04-01 16:06:54 +01:00
Richard W.M. Jones
94e94550ed sysprep: Add more files to CLEANFILES. 2012-04-01 13:17:32 +01:00
Richard W.M. Jones
7ed21d9a5c sysprep: When generating man pages, use 'run' script. 2012-04-01 13:15:56 +01:00
Richard W.M. Jones
3a58a00483 Add po/remove-potcdate.sin to git and EXTRA_DIST.
This file is produced by gettextize and required by 'make dist'.
2012-04-01 09:28:24 +01:00
Richard W.M. Jones
3b94cf5046 Version 1.17.23. 2012-03-31 23:17:41 +01:00
Richard W.M. Jones
6e3de76278 Ensure that SOURCES are always in EXTRA_DIST, even if OCaml not available. 2012-03-31 23:17:41 +01:00
Richard W.M. Jones
ad43dde9c8 sysprep: Implement 'script' operation for running general scripts against the guest. 2012-03-31 23:02:47 +01:00
Richard W.M. Jones
026f616650 Rewrite virt-sysprep. 2012-03-31 22:55:33 +01:00
Richard W.M. Jones
d00596dfbb fish: Add a regression test for mount-local, mount-local-run commands. 2012-03-31 10:28:49 +01:00
Richard W.M. Jones
e430ce8908 Update translations from Transifex. 2012-03-30 18:42:02 +01:00
Richard W.M. Jones
dd126109e5 Update API support. 2012-03-30 18:27:26 +01:00
Richard W.M. Jones
ed96872bd2 Version 1.17.22. 2012-03-29 20:31:54 +01:00
Richard W.M. Jones
b2cddfe2f5 Add test of parallel mount-local calls. 2012-03-29 17:13:28 +01:00
Richard W.M. Jones
c6f09fac06 New APIs: mount-local, mount-local-run, umount-local (FUSE support in the API).
Add FUSE support directly to the API.  Instead of needing to use the
external 'guestmount' command, you can mount the libguestfs filesystem
space on a local mountpoint using an API call from any language.

Note that although mount-local-run is marked as Cancellable, the
current implementation does not support it, but it would be relatively
simple to add it.
2012-03-29 16:45:01 +01:00
Matthew Booth
49fdba0ae9 gobject: Ignore generated guestfs-sections.txt 2012-03-29 13:42:02 +01:00
Matthew Booth
1c5dc612bd gobject: Add split-out files to POTFILES.in 2012-03-29 13:41:54 +01:00
Richard Jones
b9cb387a10 test: Thread function is a candidate for attribute noreturn.
The start_test_thread function never returns, it is always
cancelled by the main thread.
2012-03-29 13:35:48 +01:00
Richard Jones
d67da6419a Partially revert "generator: Fix unescaped '<' and '>' in api descriptions"
Don't escape < and > in verbatim sections.

This partially reverts commit 09a4e7664b.
2012-03-29 09:34:28 +01:00
Hilko Bengen
0c9361a356 Fix out-of-tree build for GObject bindings
guestfs-gobject.h (in the source directory) was not found.

In file included from <stdin>:4:0:
/path/to/libguestfs/gobject/guestfs-gobject.h:23:37: fatal error: guestfs-gobject-session.h: No such file or directory
compilation terminated.
Error while processing the source.
make[2]: *** [Guestfs-1.0.gir] Error 1
2012-03-28 23:30:59 +02:00
Hilko Bengen
4db251048b Fix out-of-tree build for Java bindings 2012-03-28 22:11:00 +02:00
Hilko Bengen
17c828d995 Fix out-of-tree build for appliance 2012-03-28 22:10:04 +02:00
Matthew Booth
2b9167540f gobject: Remove gtk-doc from TODO 2012-03-28 20:05:41 +01:00
Matthew Booth
3b0cb4dfdc gobject: Split sources into 1 file per class
This greatly improves the usability of the generated gtk-doc.

Although there is a lot of churn in generator_gobject.ml, this is almost
exclusively code motion.
2012-03-28 20:04:21 +01:00
Matthew Booth
3311e110c7 gobject: Add gtk-doc for GuestfsSession and GuestfsSessionClass 2012-03-28 20:04:21 +01:00
Matthew Booth
321748d3c2 gobject: Add gtk-doc field descriptions for generated structs 2012-03-28 20:04:21 +01:00
Matthew Booth
e49bd34fb7 gobject: Add gtk-doc for optarg wrapper classes 2012-03-28 20:04:21 +01:00
Matthew Booth
574d104b15 gobject: Drop references to Guestfs::<foo> in comments 2012-03-28 20:04:20 +01:00
Matthew Booth
e3758fc430 gobject: Handle various problem content in gtk-doc API descriptions
Produce better gtk-doc for:
* URLs
* RHBZ# references
* CVE references
* API cross-references
* Parameter references
* Escaped characters
2012-03-28 20:04:20 +01:00
Matthew Booth
6b13952657 gobject: Add basic gtk-doc for all parameters 2012-03-28 20:04:20 +01:00
Matthew Booth
ed5cc90ed5 gobject: Add basic gtk-doc for properties 2012-03-28 20:04:20 +01:00
Matthew Booth
9863dd387f gobject: gtk-doc SECTION must be named after a source file 2012-03-28 20:04:20 +01:00
Matthew Booth
1004b2ec25 gobject: Include explicit types for all parameters 2012-03-28 20:04:20 +01:00
Matthew Booth
b0ebf37a94 gobject: Add infrastructure to build gtk-doc 2012-03-28 20:04:20 +01:00
Richard Jones
4d0aa08b00 java: Delete target file before running javah.
javah from old GNU classpath won't overwrite the target *.h file,
instead leaving the old one which results in a predictable build
failure.  Delete the target so this won't happen.
2012-03-28 19:19:58 +01:00
Richard Jones
5ea27d740e fish: Fix compilation when libconfig is not available. 2012-03-28 19:06:01 +01:00
Richard Jones
3d174b39bf Don't provoke -Wstrict-overflow warning from map_app_md_devices function.
Unclear if this is a real bug or not.
2012-03-28 19:03:30 +01:00
Richard Jones
f2fae5151f Work around -Wstrict-overflow warning on gcc 4.5.1. 2012-03-28 19:01:56 +01:00
Richard Jones
b169b03dd4 m4: Update .gitignore for old Fedora. 2012-03-28 18:55:38 +01:00
Richard Jones
8111b108d2 configure: Don't fail if GOBJECT_INTROSPECTION_CHECK is not defined. 2012-03-28 18:19:54 +01:00
Richard W.M. Jones
f35aadcd86 tests: Don't include internal guestfs header in tests. 2012-03-27 17:40:28 +01:00
Richard W.M. Jones
a33ea71601 generator: Allow functions with no requires args, and with some optional args.
Previously the generator disallowed such functions.
2012-03-27 17:27:21 +01:00
Richard W.M. Jones
a138063acb Ignore guestfs.pyo.
This fixes commit e8ef35df26.
2012-03-27 17:27:21 +01:00
Matthew Booth
e8ef35df26 Only ignore guestfs.* at the top level
The guestfs.* rule appears to be for temporary appliance directories, which are
only at the top level. It was matching more than that.
2012-03-27 15:50:38 +01:00
Matthew Booth
13e5f1a3b1 generator: Remove doc reference to non-existent guestfs_inotify_watch_all 2012-03-27 15:50:38 +01:00
Matthew Booth
09a4e7664b generator: Fix unescaped '<' and '>' in api descriptions 2012-03-27 15:50:38 +01:00
Richard W.M. Jones
f5c31db5ed fuse: Fix documentation for call to virt-filesystems.
virt-filesystems requires -a/-d option.
2012-03-26 18:28:24 +01:00
Richard W.M. Jones
f1d10672c7 df: Avoid a compilation error if libxml2 is not available.
virt_df-domains.o: In function `add_domain':
/home/feeliwood/Downloads/libguestfs-1.17.21/df/domains.c:274: undefined reference to `guestfs___for_each_disk'

guestfs___for_each_disk is only available when libvirt _and_ libxml2
dependencies are available at compile time.

Thanks Tho Huynh.
2012-03-25 19:35:43 +01:00
Richard W.M. Jones
88b5ee9d95 Revert "ruby: Replace deprecated rdoc/task and rake/gempackagetask."
This reverts commit fd7a5a8bbd.

This breaks Ruby 1.8.7 in Fedora 16.
2012-03-25 19:20:07 +01:00
Richard W.M. Jones
fc198a3b9a Remove references to obsolete directory appliance/debian.
This directory has not existed for a long time.
2012-03-22 10:05:27 +00:00
Richard W.M. Jones
a14021078b Remove debian/ subdirectory. 2012-03-22 10:05:12 +00:00
Richard W.M. Jones
55c4e7a0d3 Version 1.17.21. 2012-03-21 12:34:01 +00:00
Richard W.M. Jones
7d2027295f filesystems: Implement parents of MD and VG devices (RHBZ#805070). 2012-03-21 12:08:37 +00:00
Richard W.M. Jones
a8f8af950d filesystems: Allow the parents column to contain multiple parents.
A list of parents is passed for this column.

This column is rendered as an (internally) comma-separated list.
2012-03-20 19:38:05 +00:00
Richard W.M. Jones
3f6cc550ff New API: md-stat.
This returns information about the underlying devices of an MD
(software RAID) device.
2012-03-20 18:50:24 +00:00
Richard W.M. Jones
65ebec4a7a generator: Generate a .gitignore file specifically for java structs. 2012-03-20 17:14:56 +00:00
Richard W.M. Jones
f62db21d8b daemon: Set last errno to ENOTSUP when APIs are not available. 2012-03-20 12:27:44 +00:00
Richard W.M. Jones
7526df547c daemon: Add reply_with_error_errno function.
This function allows you to pass an explicit errno back to the
library.  reply_with_error is redefined as a macro that calls
reply_with_error_errno with errno == 0.
2012-03-20 12:25:40 +00:00
Richard W.M. Jones
c7dff02ccb inspection: Set last errno to ENOTSUP when inspection APIs are not available.
Previously there was no programmatic way to tell if inspection APIs
were unavailable because they are not compiled in (because hivex isn't
around).  This contrasts with daemon APIs where the availability is
covered by the guestfs_available API.

Change the inspection APIs so that when they are not available, the
last errno is set to ENOTSUP.  (Note that ENOTSUP must be defined on
all POSIX platforms).

This allows programs to detect if they are using a version of
libguestfs that was compiled without support for inspection, without
having to parse error messages.
2012-03-20 09:11:29 +00:00
Richard W.M. Jones
b8fc61bd9b todo: Document proposed attach-method fd:N 2012-03-20 09:11:29 +00:00
Richard W.M. Jones
e1ffb10115 po-docs: Rename LINGUAS -> linguas (RHBZ#804464). 2012-03-19 10:20:08 +00:00
Richard W.M. Jones
752bd8f632 Make HTML from libguestfs-test-tool man page. 2012-03-17 22:11:32 +00:00
Richard W.M. Jones
7c2ebad357 Version 1.17.20. 2012-03-17 20:55:09 +00:00
Richard W.M. Jones
a4fd393663 New API: vgmeta: Download volume group metadata. 2012-03-17 14:36:28 +00:00
Richard W.M. Jones
05461175c4 appliance: Add a tool to make fixed appliances. 2012-03-17 10:00:59 +00:00
Richard W.M. Jones
fd7a5a8bbd ruby: Replace deprecated rdoc/task and rake/gempackagetask. 2012-03-16 22:14:44 +00:00
Richard W.M. Jones
f9c4fdfeea todo: Suggestion for virt-sysprep. 2012-03-16 18:27:52 +00:00
Richard W.M. Jones
a6f47c285f Version 1.17.19. 2012-03-16 15:18:48 +00:00
Richard W.M. Jones
14938b46a7 generator: Sort camel-case structs. 2012-03-16 14:42:30 +00:00
Richard W.M. Jones
a43f35f5bb New APIs: isoinfo and isoinfo-device.
Get ISO primary volume descriptor information for either ISO devices
or ISO files.
2012-03-16 14:40:20 +00:00
Richard W.M. Jones
d17218c210 appliance: Include genisoimage in the appliance.
This is mainly useful for the 'isoinfo' tool, but 'genisoimage'
itself may be interesting to have in future.
2012-03-16 14:11:02 +00:00
Richard W.M. Jones
6bee63beb4 generator: Fix CompareWithString test.
This type of test was not used, and in fact the generated test
simply didn't work.
2012-03-16 14:11:02 +00:00
Richard W.M. Jones
c8630300b8 generator: Fix FUInt{32,64} struct field types.
We were not using an unsigned type in the XDR.  This doesn't
affect data integrity or the protocol, but it makes it more
complicated for the daemon to set these fields.
2012-03-16 14:11:02 +00:00
Richard W.M. Jones
710ec49bac daemon: Don't call reply_with_* after split_lines fails.
split_lines already sets reply_with_*, so calling it again would lose
protocol synchronization.
2012-03-16 14:11:02 +00:00
Richard W.M. Jones
974dffc676 inspect: Fedora/RHEL CDs are multipart if totaldiscs > 1, not > 0. 2012-03-16 10:44:04 +00:00
Richard W.M. Jones
553e50c105 inspect: Parse isolinux menu title from RHEL 6.2 Live CD. 2012-03-16 10:43:40 +00:00
Richard W.M. Jones
5749de39c2 inspect: Add comment documenting findings of RHEL 5, 6 install CDs. 2012-03-16 10:43:27 +00:00
Richard W.M. Jones
5411f3fd45 Version 1.17.18. 2012-03-15 16:45:37 +00:00
Richard W.M. Jones
85a701c10c todo: Document further virt-sparsify improvements. 2012-03-15 16:15:49 +00:00
Richard W.M. Jones
98f066e274 sparsify: Implement --zero option.
This unconditionally zeroes the named partition or filesystem.
2012-03-15 16:15:46 +00:00
Richard W.M. Jones
1c1ecb2c41 sparsify: Add a note about encrypted disks to the man page. 2012-03-15 16:15:45 +00:00
Richard W.M. Jones
7283a5a276 sparsify: Unlink temporary overlay file if user presses ^C.
Add a signal handler so this potentially large temporary file
is removed when the user hits ^C.
2012-03-15 16:15:45 +00:00
Richard W.M. Jones
31c26be91f sparsify: Support sparsifying Linux swap partitions. 2012-03-15 16:15:45 +00:00
Richard W.M. Jones
8c9f6a64be sparsify: Use zero-device instead of dd if=/dev/zero to zero device.
zero-device is more efficient in general, and avoids writing to blocks
which are already zero.
2012-03-15 16:15:45 +00:00
Richard W.M. Jones
b05611d8ef Use the new lvcreate-free API to create largest possible LVs. 2012-03-15 16:15:45 +00:00
Richard W.M. Jones
79c4ecc0f3 New API: lvcreate-free: Create logical volume as % of free space. 2012-03-15 16:15:44 +00:00
Richard W.M. Jones
03d4345c8c sparsify: Use new zero_free_space API. 2012-03-15 16:15:44 +00:00
Richard W.M. Jones
d9bdb9587b New API: zero_free_space: zero free space in a filesystem.
Add an API for doing what virt-sparsify was doing: freeing up free
space in a filesystem.

The current implementation is simple-minded: we create a file, fill it
with zeroes until we run out of space, then delete the file.  However
the description leaves it open to do a better implementation, eg.
using sparsification support that is currently being worked on in ext4
and qemu.

The implementation also sends progress notifications, which is an
advantage over the old 'dd' method.
2012-03-15 16:15:44 +00:00
Richard W.M. Jones
7934ea2395 sparsify: Only print qemu-img command if verbose. 2012-03-15 16:15:44 +00:00
Richard W.M. Jones
91cede3465 inspect: Ignore missing HKLM\SYSTEM\MountedDevices (RHBZ#803664).
When a Windows guest doesn't have a HKLM\SYSTEM\MountedDevices node,
inspection fails.  However inspection should not completely fail just
because we cannot get the drive letter mapping from a guest.
2012-03-15 13:55:55 +00:00
Richard W.M. Jones
2bc922dd8e inspector: Update man page to describe how to access inspection info from other languages and guestfish. 2012-03-14 23:13:41 +00:00
Richard W.M. Jones
c23f3b8e52 Add guestfsd.suppressions file to EXTRA_DIST. 2012-03-14 21:13:43 +00:00
Richard W.M. Jones
e743eb3984 Version 1.17.17. 2012-03-14 19:57:36 +00:00
Richard W.M. Jones
606732d02e Use O_CLOEXEC / SOCK_CLOEXEC for almost all file descriptors.
The presumption is that all file descriptors should be created with
the close-on-exec flag set.  The only exception are file descriptors
that we want passed through to exec'd subprocesses (mainly pipes and
stdin/stdout/stderr).

For open calls, we pass O_CLOEXEC as an extra flag, eg:

  fd = open ("foo", O_RDONLY|O_CLOEXEC);

This is a Linux-ism, but using a macro we can easily make it portable.

For sockets, similarly:

  sock = socket (..., SOCK_STREAM|SOCK_CLOEXEC, ...);

For accepted sockets, we use the Linux accept4 system call which
allows flags to be supplied, but we use the Gnulib 'accept4' module to
make this portable.

For dup, dup2, we use the Linux dup3 system call, and the Gnulib
modules 'dup3' and 'cloexec'.
2012-03-14 19:30:46 +00:00
Richard W.M. Jones
13e7a1b400 java: Make sure generator is rerun when necessary to rebuild generated files. 2012-03-14 19:29:52 +00:00
Richard W.M. Jones
d042e56f2a java: Enable -Xlint:all and fix all warnings. 2012-03-14 19:29:11 +00:00
Richard W.M. Jones
6b233bd39e todo: More ongoing code cleanups. 2012-03-14 19:28:13 +00:00
Richard W.M. Jones
302309921a appliance: Enhance --enable-valgrind-daemon with a suppressions file.
This lets us suppress errors in system libraries.
2012-03-14 16:13:40 +00:00
Richard W.M. Jones
5da61d3052 daemon: When copy subprocess fails, print return code.
Useful for debugging.
2012-03-14 16:12:54 +00:00
Richard W.M. Jones
9974c42a29 todo: Document ongoing code cleanups. 2012-03-14 12:53:37 +00:00
Richard W.M. Jones
f876271521 daemon: labels: Memory leak in 'set_label'.
This fixes commit d1711dae9d.
2012-03-14 12:52:55 +00:00
Richard W.M. Jones
7e32d892d7 Version 1.17.16. 2012-03-13 08:45:49 +00:00
Richard W.M. Jones
f76a88011a Replace 'int' with 'size_t' passim.
Analyze all uses of 'int' in the code, and replace with 'size_t' where
appropriate.
2012-03-13 08:23:56 +00:00
Richard W.M. Jones
14df5fa5d1 daemon: Implement a growable strings buffer type.
Previously a lot of daemon code used three variables (a string list,
'int size' and 'int alloc') to track growable strings buffers.  This
commit implements a simple struct containing the same variables, but
using size_t instead of int:

  struct stringsbuf {
    char **argv;
    size_t size;
    size_t alloc;
  };

Use it like this:

  DECLARE_STRINGSBUF (ret);
//...
  if (add_string (&ret, str) == -1)
    return NULL;
//...
  if (end_stringsbuf (&ret) == -1)
    return NULL;
  return ret.argv;
2012-03-13 08:19:11 +00:00
Richard W.M. Jones
d66dd2260c Fix strict-overflow bugs and reenable this warning.
In two places, we were counting things in an array using an 'int'.  In
theory, the int could overflow, so gcc determines this to be undefined
behaviour.

The fix is to use size_t or ssize_t instead.
2012-03-12 16:27:10 +00:00
Richard W.M. Jones
17182af3a6 fish: remote: Output from close event now passed over stdout (RHBZ#802389). 2012-03-12 15:21:35 +00:00
Richard W.M. Jones
f7c744bbf8 fish: remote: Make sure global cleanups are called for guestfish --listen.
Return to the main program ('fish.c') and perform global cleanups when
the guestfish remote server exits.
2012-03-12 15:13:29 +00:00
Richard W.M. Jones
b3a9e81868 fish: remote: Move close_stdout just before accept() call.
This is just code motion.
2012-03-12 15:11:33 +00:00
Richard W.M. Jones
1f603bfd6d fish: Rename tests and make test paths relative.
When these tests were originally in the old regressions/ directory,
they used to refer to guestfish via the path '../fish/guestfish'.
Some of the tests were also called 'test-guestfish-*'.

Now that the tests have been moved into the fish/ directory, neither
of these things make sense.  So change the relative path to
'./guestfish' and rename all 'test-guestfish-*' as 'test-*'.
2012-03-12 15:09:15 +00:00
Richard W.M. Jones
2c8ead5aa0 tests: Remove/fix unused variables warnings. 2012-03-12 14:10:05 +00:00
Richard W.M. Jones
100e30763e Version 1.17.15. 2012-03-12 12:22:25 +00:00
Richard W.M. Jones
099e3dd9f1 tests: Remove unused variable. 2012-03-12 12:22:25 +00:00
Richard W.M. Jones
5cad29043f configure: Enable more warnings, and some cleanup.
However -Wstrict-overflow is still disabled, see:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52560
2012-03-12 11:53:05 +00:00
Richard W.M. Jones
6292e630da erlang: Remove unused variables. 2012-03-12 11:53:05 +00:00
Richard W.M. Jones
e9e0920c00 format: Remove unused variables. 2012-03-12 11:53:04 +00:00
Richard W.M. Jones
13c2db39ab daemon: Remove unused variables. 2012-03-12 11:53:04 +00:00
Richard W.M. Jones
46d1280100 inspect: Move variable decl to top of function. 2012-03-12 11:53:04 +00:00
Richard W.M. Jones
4bcd0b3c17 inspect: Use 1/0 instead of true/false, and fix a bug in UUID parsing.
UUID parsing returned 'false' (ie. 0 == OK) when the UUID contained
illegal characters.  Now it returns -1 == failure.
2012-03-12 11:53:04 +00:00
Richard W.M. Jones
cd3f2986ee lib: Remove some unused variables. 2012-03-12 11:53:04 +00:00
Richard W.M. Jones
1aa72017ca lib: Use size_t instead of int for array iterator. 2012-03-12 11:53:03 +00:00
Richard W.M. Jones
3d279d15c1 inspect: Use uint64_t for maximum file size in bytes. 2012-03-12 11:53:03 +00:00
Richard W.M. Jones
b8cdf6c2b9 lib: Use size_t for allocation size in safe realloc function. 2012-03-12 11:53:03 +00:00
Richard W.M. Jones
24413ac4d8 bindtests: Use size_t instead of int for array iterators. 2012-03-12 11:53:03 +00:00
Richard W.M. Jones
e6f18c59d5 Coalesce printable characters in debug and trace messages (RHBZ#802109). 2012-03-11 20:12:41 +00:00
Richard W.M. Jones
5b7b1c43ab Document error message from resize2fs (RHBZ#755729, RHBZ#801640). 2012-03-09 18:05:35 +00:00
Richard W.M. Jones
2fb545b840 resize2fs: Run 'e2fsck -f' automatically if filesystem is not mounted. 2012-03-09 18:05:31 +00:00
Richard W.M. Jones
4c9218658e e2fsck: Comment, whitespace, error message cleanups. 2012-03-09 16:52:28 +00:00
Richard W.M. Jones
99923c7cd0 Mark e2fsck-f as deprecated, replaced by e2fsck API. 2012-03-09 16:15:41 +00:00
Richard W.M. Jones
dfe30bdfe7 Revert "ext2: tweak the error returned message of resize2fs-M(BZ755729)"
This reverts commit 0eaf06e673.
2012-03-09 16:13:49 +00:00
Richard W.M. Jones
d0cf52b911 Version 1.17.14. 2012-03-09 16:01:17 +00:00
Richard W.M. Jones
baa5e1ea51 example: Copying a directory between two guests using threads. 2012-03-09 15:13:08 +00:00
Richard W.M. Jones
f1f045adf8 Close all file descriptors and remove all signal handlers in the recovery process.
If the parent process uses a pipe (or any fd, but pipes are a
particular problem), then the recovery process would hold open the
file descriptor(s) of the pipe, meaning that it could not be fully
closed in the parent.  Because the recovery process doesn't use
exec(2), this wasn't avoidable even using FD_CLOEXEC.

Avoid this by closing all file descriptors when starting the recovery
process.

After discussion with Dan Berrange, he points out that it's also a
good idea to set signal handlers to the default after forking, so that
any signal handlers set up in the parent don't affect the child.
2012-03-09 13:48:01 +00:00
Richard W.M. Jones
99702fe443 extra-tests: Export LIBVIRT_DEFAULT_URI to pick-guests.pl.
This fixes commit 2912e4e117.
2012-03-08 19:27:37 +00:00
Richard W.M. Jones
f8e7a41e67 Version 1.17.13. 2012-03-08 17:39:11 +00:00
Richard W.M. Jones
2912e4e117 extra-tests: Check that guests are accessible before picking them. 2012-03-08 16:19:20 +00:00
Richard W.M. Jones
0721464b83 fish: Document that guestfish sets pgroup to true (RHBZ#801273). 2012-03-08 15:02:55 +00:00
Richard W.M. Jones
270daae52b inspect_apps: Avoid double-close on error path (found by Coverity) (RHBZ#801298).
Error: USE_AFTER_FREE:
/builddir/build/BUILD/libguestfs-1.16.5/src/inspect_apps.c:392: freed_arg: "fclose" frees "fp".
/builddir/build/BUILD/libguestfs-1.16.5/src/inspect_apps.c:404: deref_arg: Calling "fclose" dereferences freed pointer "fp".
2012-03-08 15:02:41 +00:00
Richard W.M. Jones
3f3b08a6bc dbdump: Avoid double-close on error path (found by Coverity).
Error: USE_AFTER_FREE:
/builddir/build/BUILD/libguestfs-1.16.5/src/dbdump.c:132: freed_arg: "pclose" frees "pp".
/builddir/build/BUILD/libguestfs-1.16.5/src/dbdump.c:142: deref_arg: Calling "pclose" dereferences freed pointer "pp".
2012-03-08 14:36:25 +00:00
Richard W.M. Jones
b2c1d8be39 daemon: glob: Initialize glob buffer (quiet Coverity warning).
Error: UNINIT:
/builddir/build/BUILD/libguestfs-1.16.5/daemon/glob.c:32: var_decl: Declaring variable "buf" without initializer.
/builddir/build/BUILD/libguestfs-1.16.5/daemon/glob.c:36: uninit_use_in_call: Using uninitialized value "buf.gl_offs" when calling "rpl_glob".
/builddir/build/BUILD/libguestfs-1.16.5/gnulib/lib/glob.c:557: read_parm_fld: Reading a parameter field.
/builddir/build/BUILD/libguestfs-1.16.5/daemon/glob.c:36: uninit_use_in_call: Using uninitialized value "buf.gl_pathc" when calling "rpl_glob".
/builddir/build/BUILD/libguestfs-1.16.5/gnulib/lib/glob.c:557: read_parm_fld: Reading a parameter field.
2012-03-08 14:30:10 +00:00
Richard W.M. Jones
3345444ccc comment: Note time-of-check to time-of-use race found by Coverity. 2012-03-08 14:12:45 +00:00
Richard W.M. Jones
ae0f9f149b daemon: inotify: Check event->len in inotify struct is reasonable.
The Coverity error is this (which I think is wrong):

Error: TAINTED_SCALAR:
/builddir/build/BUILD/libguestfs-1.16.5/daemon/inotify.c:211: tainted_data_argument: Calling function "read" taints argument "inotify_buf".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/inotify.c:232: var_assign_var: Assigning: "event" = "(struct inotify_event *)&inotify_buf[n]". Both are now tainted.
/builddir/build/BUILD/libguestfs-1.16.5/daemon/inotify.c:258: lower_bounds: Checking lower bounds of unsigned scalar "event->len" by "event->len > 0U".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/inotify.c:272: var_assign_var: Compound assignment involving tainted variable "16UL + event->len" to variable "n" taints "n".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/inotify.c:228: lower_bounds: Checking lower bounds of unsigned scalar "n" by "n < inotify_posn".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/inotify.c:281: tainted_data: Using tainted variable "n" as an index into an array "inotify_buf".

Adding a sanity check of event->len is prudent.
2012-03-08 13:53:04 +00:00
Richard W.M. Jones
3b3d9ca4e1 daemon: debug: Close fd along error path (found by Coverity).
Error: RESOURCE_LEAK:
/builddir/build/BUILD/libguestfs-1.16.5/daemon/debug.c:469: open_fn: Calling opening function "open".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/debug.c:469: var_assign: Assigning: "fd" =  handle returned from "open("/proc/sys/kernel/core_pattern", 1)".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/debug.c:474: noescape: Variable "fd" is not closed or saved in function "write".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/debug.c:476: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
2012-03-08 13:23:15 +00:00
Richard W.M. Jones
4dd26c28a3 fish: Properly free up strings, lists along all error paths (found by Coverity).
This also includes some tidying up of the generated code.

Error: RESOURCE_LEAK:
/builddir/build/BUILD/libguestfs-1.16.5/fish/cmds.c:13254: alloc_fn: Calling allocation function "parse_string_list".
/builddir/build/BUILD/libguestfs-1.16.5/fish/fish.c:1386: alloc_fn: Storage is returned from allocation function "realloc".
/builddir/build/BUILD/libguestfs-1.16.5/fish/fish.c:1386: var_assign: Assigning: "argv_new" = "realloc(argv, 8UL * argv_len)".
/builddir/build/BUILD/libguestfs-1.16.5/fish/fish.c:1392: var_assign: Assigning: "argv" = "argv_new".
/builddir/build/BUILD/libguestfs-1.16.5/fish/fish.c:1396: return_alloc: Returning allocated memory "argv".
/builddir/build/BUILD/libguestfs-1.16.5/fish/cmds.c:13254: var_assign: Assigning: "devices" =  storage returned from "parse_string_list(argv[i++])".
/builddir/build/BUILD/libguestfs-1.16.5/fish/cmds.c:13271: leaked_storage: Variable "devices" going out of scope leaks the storage it points to.
/builddir/build/BUILD/libguestfs-1.16.5/fish/cmds.c:13288: leaked_storage: Variable "devices" going out of scope leaks the storage it points to.
/builddir/build/BUILD/libguestfs-1.16.5/fish/cmds.c:13293: leaked_storage: Variable "devices" going out of scope leaks the storage it points to.
/builddir/build/BUILD/libguestfs-1.16.5/fish/cmds.c:13311: leaked_storage: Variable "devices" going out of scope leaks the storage it points to.
/builddir/build/BUILD/libguestfs-1.16.5/fish/cmds.c:13316: leaked_storage: Variable "devices" going out of scope leaks the storage it points to.
/builddir/build/BUILD/libguestfs-1.16.5/fish/cmds.c:13334: leaked_storage: Variable "devices" going out of scope leaks the storage it points to.
/builddir/build/BUILD/libguestfs-1.16.5/fish/cmds.c:13349: leaked_storage: Variable "devices" going out of scope leaks the storage it points to.
/builddir/build/BUILD/libguestfs-1.16.5/fish/cmds.c:13355: leaked_storage: Variable "devices" going out of scope leaks the storage it points to.
2012-03-08 13:21:59 +00:00
Richard W.M. Jones
d0453c0254 daemon: proto: Close fd along error paths (found by Coverity).
Error: RESOURCE_LEAK:
/builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:894: open_fn: Calling opening function "open".
/builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:894: var_assign: Assigning: "fd" =  handle returned from "open(filename, 0)".
/builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:903: noescape: Variable "fd" is not closed or saved in function "read".
/builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:911: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
/builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:918: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
2012-03-08 13:21:59 +00:00
Richard W.M. Jones
fbf10d7f68 daemon: upload: Close fd along error path (found by Coverity).
Error: RESOURCE_LEAK:
/builddir/build/BUILD/libguestfs-1.16.5/daemon/upload.c:225: open_fn: Calling opening function "open".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/upload.c:225: var_assign: Assigning: "fd" =  handle returned from "open(filename, 0)".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/upload.c:233: noescape: Variable "fd" is not closed or saved in function "lseek".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/upload.c:235: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
2012-03-08 13:21:58 +00:00
Richard W.M. Jones
cba36e7305 daemon: 9p: Close fd along error paths (found by Coverity).
Error: RESOURCE_LEAK:
/builddir/build/BUILD/libguestfs-1.16.5/daemon/9p.c:130: open_fn: Calling opening function "open".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/9p.c:130: var_assign: Assigning: "fd" =  handle returned from "open(filename, 0)".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/9p.c:142: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
/builddir/build/BUILD/libguestfs-1.16.5/daemon/9p.c:149: noescape: Variable "fd" is not closed or saved in function "read".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/9p.c:153: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
2012-03-08 13:21:58 +00:00
Richard W.M. Jones
855aaf414a proto: Close file along error and cancel paths (found by Coverity).
Error: RESOURCE_LEAK:
/builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:1125: open_fn: Calling opening function "open".
/builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:1125: var_assign: Assigning: "fd" =  handle returned from "open(filename, 833, 438)".
/builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:1133: noescape: Variable "fd" is not closed or saved in function "xwrite".
/builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:1146: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
/builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:1173: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
2012-03-08 13:21:58 +00:00
Richard W.M. Jones
618954a6b0 Check return values of guestfs_inspect_get_{type,distro} (found by Coverity).
Error: NULL_RETURNS:
/builddir/build/BUILD/libguestfs-1.16.5/examples/virt-dhcp-address.c:129: var_assigned: Assigning: "guest_distro" = null return value from "guestfs_inspect_get_distro".
/builddir/build/BUILD/libguestfs-1.16.5/examples/virt-dhcp-address.c:131: dereference: Dereferencing a pointer that might be null "guest_distro" when calling "__coverity_strcmp".
[...]
/builddir/build/BUILD/libguestfs-1.16.5/examples/virt-dhcp-address.c:126: var_assigned: Assigning: "guest_type" = null return value from "guestfs_inspect_get_type".
/builddir/build/BUILD/libguestfs-1.16.5/examples/virt-dhcp-address.c:128: dereference: Dereferencing a pointer that might be null "guest_type" when calling "__coverity_strcmp".
2012-03-08 13:21:58 +00:00
Richard W.M. Jones
35d5be22b1 Check return values from calloc (found by Coverity).
Error: NULL_RETURNS:
/builddir/build/BUILD/libguestfs-1.16.5/src/inspect.c:417: returned_null: Function "calloc" returns null (checked 67 out of 81 times).
/builddir/build/BUILD/libguestfs-1.16.5/src/inspect.c:417: var_assigned: Assigning: "ret" = null return value from "calloc".
/builddir/build/BUILD/libguestfs-1.16.5/src/inspect.c:418: dereference: Dereferencing a null pointer "ret".
[...]
/builddir/build/BUILD/libguestfs-1.16.5/src/inspect.c:374: returned_null: Function "calloc" returns null (checked 67 out of 81 times).
/builddir/build/BUILD/libguestfs-1.16.5/src/inspect.c:374: var_assigned: Assigning: "ret" = null return value from "calloc".
/builddir/build/BUILD/libguestfs-1.16.5/src/inspect.c:375: dereference: Dereferencing a null pointer "ret".
2012-03-08 13:21:52 +00:00
Richard W.M. Jones
0ffa223a75 Dead code: Remove comma-check in first if-clause (found by Coverity).
Error: DEADCODE:
/builddir/build/BUILD/libguestfs-1.16.5/fish/event-names.c:65: dead_error_condition: On this path, the condition "comma" cannot be true.
/builddir/build/BUILD/libguestfs-1.16.5/fish/event-names.c:57: const: After this line, the value of "comma" is equal to 0.
/builddir/build/BUILD/libguestfs-1.16.5/fish/event-names.c:57: assignment: Assigning: "comma" = "0".
/builddir/build/BUILD/libguestfs-1.16.5/fish/event-names.c:65: dead_error_line: Execution cannot reach this statement "fputc(44, fp);".
2012-03-08 13:21:51 +00:00
Richard W.M. Jones
109d3ad34a Dead code: 'lvs' cannot be true here (found by Coverity).
Remove dead code; however only comment it out since if we change the
preceeding code we may need this line again.

Error: DEADCODE:
/builddir/build/BUILD/libguestfs-1.16.5/src/listfs.c:107: dead_error_condition: On this path, the condition "lvs" cannot be true.
/builddir/build/BUILD/libguestfs-1.16.5/src/listfs.c:54: const: After this line, the value of "lvs" is equal to 0.
/builddir/build/BUILD/libguestfs-1.16.5/src/listfs.c:91: const: After this line, the value of "lvs" is equal to 0.
/builddir/build/BUILD/libguestfs-1.16.5/src/listfs.c:54: assignment: Assigning: "lvs" = "NULL".
/builddir/build/BUILD/libguestfs-1.16.5/src/listfs.c:91: new_values: Noticing condition "lvs == NULL".
/builddir/build/BUILD/libguestfs-1.16.5/src/listfs.c:107: dead_error_line: Execution cannot reach this statement "guestfs___free_string_list(...".
2012-03-08 13:21:51 +00:00
Richard W.M. Jones
07a8c3c0c2 Ignore return values from some functions in guestfs_close (Coverity warning).
Error: CHECKED_RETURN:
/builddir/build/BUILD/libguestfs-1.16.5/java/com_redhat_et_libguestfs_GuestFS.c:9552: example_assign: Assigning: "r" = return value from "guestfs_internal_autosync(g)".
/builddir/build/BUILD/libguestfs-1.16.5/java/com_redhat_et_libguestfs_GuestFS.c:9555: example_checked: "r" has its value checked in "r == -1".
/builddir/build/BUILD/libguestfs-1.16.5/ocaml/guestfs_c_actions.c:5584: example_assign: Assigning: "r" = return value from "guestfs_internal_autosync(g)".
/builddir/build/BUILD/libguestfs-1.16.5/ocaml/guestfs_c_actions.c:5586: example_checked: "r" has its value checked in "r == -1".
/builddir/build/BUILD/libguestfs-1.16.5/perl/Guestfs.xs:5990: example_assign: Assigning: "r" = return value from "guestfs_internal_autosync(g)".
/builddir/build/BUILD/libguestfs-1.16.5/perl/Guestfs.xs:5991: example_checked: "r" has its value checked in "r == -1".
/builddir/build/BUILD/libguestfs-1.16.5/python/guestfs-py.c:13702: example_assign: Assigning: "r" = return value from "guestfs_internal_autosync(g)".
/builddir/build/BUILD/libguestfs-1.16.5/python/guestfs-py.c:13707: example_checked: "r" has its value checked in "r == -1".
/builddir/build/BUILD/libguestfs-1.16.5/ruby/ext/guestfs/_guestfs.c:16000: example_assign: Assigning: "r" = return value from "guestfs_internal_autosync(g)".
/builddir/build/BUILD/libguestfs-1.16.5/ruby/ext/guestfs/_guestfs.c:16001: example_checked: "r" has its value checked in "r == -1".
/builddir/build/BUILD/libguestfs-1.16.5/src/guestfs.c:191: check_return: Calling function "guestfs_internal_autosync" without checking return value (as is done elsewhere 5 out of 6 times).
/builddir/build/BUILD/libguestfs-1.16.5/src/guestfs.c:191: unchecked_value: No check of the return value of "guestfs_internal_autosync(g)".
2012-03-08 13:21:51 +00:00
Richard W.M. Jones
10f240a07f tests/md: Number the errors so we can easily see which test fails. 2012-03-08 13:21:51 +00:00
Richard W.M. Jones
5503d95e1b Update translations from Transifex. 2012-03-08 10:46:13 +00:00
Richard W.M. Jones
0fdcc76901 Update API support. 2012-03-07 22:32:14 +00:00
Richard W.M. Jones
4504f424f5 dist: Distribute all tests, even when configured with --disable-appliance. 2012-03-07 19:21:14 +00:00
Richard W.M. Jones
2f126e07bb Version 1.17.12. 2012-03-07 18:36:48 +00:00
Richard W.M. Jones
cfa0f9b381 inspection: Add detection of FreeDOS install CDs (RHBZ#786188). 2012-03-07 18:36:47 +00:00
Richard W.M. Jones
a9510b7b22 inspection: Add detection of FreeDOS (RHBZ#786215).
FreeDOS is returned as type="dos", distro="freedos".  No version or
application information is returned at present.
2012-03-07 18:36:47 +00:00
Richard W.M. Jones
518cdb596e Add 'display_icon' example program.
Running this on a disk image displays the guest icon
(using external 'display' program).
2012-03-07 18:36:46 +00:00
Richard W.M. Jones
4d8ae8f5a2 Comment change. 2012-03-07 18:36:46 +00:00
Richard W.M. Jones
e40f408fae Hide stderr of bmptopng.
This program is noisy on stderr.  Send that to /dev/null.
2012-03-07 18:36:46 +00:00
Richard W.M. Jones
2c9c0525eb build: Make netpbm and icoutils into proper optional dependencies.
Netpbm and icoutils (wrestool) have always been dependencies.  Since
they are not always present, make these into optional dependencies
(which they were, sort of, before).

Also document these dependencies in the README file.
2012-03-07 18:36:46 +00:00
Richard W.M. Jones
b9061ddf2d Add support for Buildroot and Cirros distributions. 2012-03-07 18:36:46 +00:00
Richard W.M. Jones
b106dda97c Whitespace change. 2012-03-07 18:36:46 +00:00
Matthew Booth
3bf5d0d0e4 gobject: Update TODO with details of inspect_get_type fix 2012-03-06 14:48:41 +00:00
Richard W.M. Jones
deaae55072 Version 1.17.11. 2012-03-05 09:36:34 +00:00
Richard W.M. Jones
715f7e2809 Remove ConfigOnly flag from set-autosync.
guestfs_set_autosync sets a flag which affects guestfs_close, and so
this call can be made at any time before the handle is closed, not
just in the config state.
2012-03-05 08:58:00 +00:00
Richard W.M. Jones
705971b509 Test header file under C++. 2012-03-04 14:41:37 +00:00
Marcin Gibula
49611f121f Make "template" a reserved word.
Function guestfs_mkdtemp uses c++ keyword "template" as a parameter
name. In result, attempt to use guestfs.h header in c++ program
results in compile error.
2012-03-04 11:54:19 +00:00
Richard W.M. Jones
b11e9f4919 Version 1.17.10. 2012-03-03 18:41:01 +00:00
Richard W.M. Jones
3b78b3a849 ruby: Use RbConfig instead of Config.
I have checked, and this works with Ruby 1.8 as well.
2012-03-03 18:40:42 +00:00
Richard W.M. Jones
5e8a4627d9 Add a 'fixed' style of appliance.
This is just the 'kernel', 'initrd' and 'root' files, copied from one
machine to another, along with a 'README.fixed' file which is also
used for identification.

This allows the appliance to be copied from one machine to another,
making it easier for us to distribute a starter appliance for people
who cannot get febootstrap or appliance-building working.
2012-03-03 16:58:48 +00:00
Richard W.M. Jones
49726b9269 Rebrand 'ordinary appliance' as 'old-style appliance'.
This is just code motion.
2012-03-03 16:58:05 +00:00
Nikos Skalkotos
ba468e9c5e Test fails in arch linux
--20cf303ea4a84a7a7c04ba331375
Content-Type: text/plain; charset=ISO-8859-1

Hello Richard,

I found what the problem was and the udev symlinks where not created. The
init script in the appliance uses a full paths for udevadm (/sbin/udevadm)
which in my case was wrong. In Arch Linux udevadm is hosted under /usr/bin,
not /sbin. When I fixed this, libguestfs was able to communicate with the
appliance VM.

Since PATH variable is defined and exported in init, there is no need in
using full paths for external programs. As far as I've seen this affects
all the git branches in libguestfs's repository. Please find attached a
patch for the master branch.

Nikos Skalkotos,
Athens, Greece

On 24 February 2012 10:25, Richard W.M. Jones <rjones@redhat.com> wrote:

> On Thu, Feb 23, 2012 at 08:50:12PM +0200, Nikos Skalkotos wrote:
> [...]
>
> I don't know specifically why it fails with ArchLinux, but the problem
> is caused by the /dev/virtio-ports/* symlinks not getting created by
> udev.
>
> /dev/vport0p1 exists:
>
> > crw------- 1 root root 252,   1 Feb 23 18:17 vport0p1
>
> but udev doesn't make the corresponding /dev/virtio-ports symlink:
>
> > /dev/virtio-ports/org.libguestfs.channel.0: No such file or directory
>
> The symlink is supposed to be created by this udev rule:
>
> /lib/udev/rules.d/50-udev-default.rules:KERNEL=="vport*",
> ATTR{name}=="?*", SYMLINK+="virtio-ports/$attr{name}"
>
> So I'd start by looking to see if that rule exists in the udev rules
> that Arch is using.  Secondly if it does exist, is the corresponding
> *.rules being copied into the appliance?  (Check appliance/supermin.d/
> hostfiles)
>
> In an old Ubuntu that has udev that predates having this rule, we add
> the following patch:
>
>
> http://libguestfs.org/download/binaries/ubuntu1004-packages/0002-ubuntu-10.04-Use-dev-vport0p1.patch
>
> Rich.
>
> --
> Richard Jones, Virtualization Group, Red Hat
> http://people.redhat.com/~rjones
> virt-p2v converts physical machines to virtual machines.  Boot with a
> live CD or over the network (PXE) and turn machines into Xen guests.
> http://et.redhat.com/~rjones/virt-p2v
>

Hello Richard,<br><br>I found what the problem was and the udev symlinks where not created. The init script in the appliance uses a full paths for udevadm (/sbin/udevadm) which in my case was wrong. In Arch Linux udevadm is hosted under /usr/bin, not /sbin. When I fixed this, libguestfs was able to communicate with the appliance VM.<br>
<br>Since PATH variable is defined and exported in init, there is no need in using full paths for external programs. As far as I&#39;ve seen this affects all the git branches in libguestfs&#39;s repository. Please find attached a patch for the master branch.<br>
<br>Nikos Skalkotos,<br>Athens, Greece<br><br><div class="gmail_quote">On 24 February 2012 10:25, Richard W.M. Jones <span dir="ltr">&lt;<a href="mailto:rjones@redhat.com">rjones@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Thu, Feb 23, 2012 at 08:50:12PM +0200, Nikos Skalkotos wrote:<br>
[...]<br>
<br>
I don&#39;t know specifically why it fails with ArchLinux, but the problem<br>
is caused by the /dev/virtio-ports/* symlinks not getting created by<br>
udev.<br>
<br>
/dev/vport0p1 exists:<br>
<div class="im"><br>
&gt; crw------- 1 root root 252,   1 Feb 23 18:17 vport0p1<br>
<br>
</div>but udev doesn&#39;t make the corresponding /dev/virtio-ports symlink:<br>
<div class="im"><br>
&gt; /dev/virtio-ports/org.libguestfs.channel.0: No such file or directory<br>
<br>
</div>The symlink is supposed to be created by this udev rule:<br>
<br>
/lib/udev/rules.d/50-udev-default.rules:KERNEL==&quot;vport*&quot;, ATTR{name}==&quot;?*&quot;, SYMLINK+=&quot;virtio-ports/$attr{name}&quot;<br>
<br>
So I&#39;d start by looking to see if that rule exists in the udev rules<br>
that Arch is using.  Secondly if it does exist, is the corresponding<br>
*.rules being copied into the appliance?  (Check appliance/supermin.d/<br>
hostfiles)<br>
<br>
In an old Ubuntu that has udev that predates having this rule, we add<br>
the following patch:<br>
<br>
<a href="http://libguestfs.org/download/binaries/ubuntu1004-packages/0002-ubuntu-10.04-Use-dev-vport0p1.patch" target="_blank">http://libguestfs.org/download/binaries/ubuntu1004-packages/0002-ubuntu-10.04-Use-dev-vport0p1.patch</a><br>

<br>
Rich.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Richard Jones, Virtualization Group, Red Hat <a href="http://people.redhat.com/%7Erjones%0Avirt-p2v" target="_blank">http://people.redhat.com/~rjones<br>
virt-p2v</a> converts physical machines to virtual machines.  Boot with a<br>
live CD or over the network (PXE) and turn machines into Xen guests.<br>
<a href="http://et.redhat.com/%7Erjones/virt-p2v" target="_blank">http://et.redhat.com/~rjones/virt-p2v</a><br>
</font></span></blockquote></div><br>
2012-03-01 19:47:34 +00:00
Wanlong Gao
d6f736ab18 virt-sysprep: add the hostname and net_hwaddr support for rhel
Add the support for rhel.
Change the hostname and delete the HWADDR for rhel.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-02-29 10:11:37 +00:00
Richard W.M. Jones
48a5cb2a2c Version 1.17.9. 2012-02-28 10:34:51 +00:00
Richard W.M. Jones
88ba4da4d6 resize: Fix --output-format flag (RHBZ#798196).
Update the test to use the --format and --output-format flags.
2012-02-28 10:30:57 +00:00
Richard W.M. Jones
a93d4a9dc1 resize: Document steps to avoid UNMOUNTABLE_BOOT_VOLUME BSOD (RHBZ#797986).
(Thanks Grant Williamson for finding and fixing this problem)
2012-02-27 19:39:43 +00:00
Richard W.M. Jones
d1711dae9d New API: set-label, for setting a label on any filesystem.
Currently only ext2/3/4 and (newly) NTFS are supported.

This change also deprecates set-e2label.
2012-02-27 17:26:09 +00:00
Richard W.M. Jones
e567f064e2 New APIs: ntfsclone-in, ntfsclone-out. 2012-02-27 13:43:35 +00:00
Richard W.M. Jones
51aa51884e New API: ntfsfix for fixing problems on NTFS.
Note this is not a "chkdsk" equivalent tool.
2012-02-27 11:13:45 +00:00
Richard W.M. Jones
2e788ca45e Update TODO. 2012-02-27 10:51:45 +00:00
Wanlong Gao
b5cc1fa049 set-smp: limit the number of cpus below 255
Limit the number of cpus below 255, since qemu can't support.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-02-25 15:01:50 +00:00
Wanlong Gao
9e5c0b39c6 Add a flag to make some functions called only at CONFIG state (RHBZ#796520).
Add a flag "ConfigOnly" to make sure that some non-daemon functions
should be called only at CONFIG state (RHBZ#796520).

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-02-23 17:03:07 +00:00
Richard W.M. Jones
db2cb21a85 Version 1.17.8. 2012-02-15 20:58:47 +00:00
Richard W.M. Jones
5fa7aace20 sysprep: Try unmounting the filesystem a few times when busy.
tracker-miner-fs jumps into newly mounted filesystems.  This prevents
the filesystem from being unmounted, so retry a few times.
2012-02-15 19:25:52 +00:00
Richard W.M. Jones
afed7e493d appliance: Make appliance building thread-safe (RHBZ#790721).
Appliance building can be called from multiple processes, but this is
only safe if each process holds a lock on the 'checksum' file.
However threads within a process are not excluded by a file lock, and
so this strategy completely failed for a multithreaded program calling
guestfs_launch in parallel.

Since it makes no sense for threads in a single program to race each
other to try to create the appliance, add a lock around appliance
building.

This serialises building the appliance, but the rest of guestfs_launch
(eg. starting up qemu) can run in parallel.
2012-02-15 16:59:18 +00:00
Richard W.M. Jones
c9ea94810e tests: Test parallel launch from multiple threads. 2012-02-15 16:59:15 +00:00
Richard W.M. Jones
6a70cb337c test-user-cancel: Add \n to fprintf error messages. 2012-02-15 10:39:50 +00:00
Richard W.M. Jones
84a4160fd3 Version 1.17.7. 2012-02-13 14:44:03 +00:00
Richard W.M. Jones
cd06ddf442 tests: Add a regression test for RHBZ#789960.
Test all the ways that the 'mount' command can fail.  Ensure that none
of them result in failures or desynchronization.
2012-02-13 13:49:21 +00:00
Richard W.M. Jones
1b15e543a8 regressions: One test is not being run.
rhbz727178.sh exists, but historically was never added to the list of
tests, so it doesn't run.  Create a special variable for this test and
ensure it is added to EXTRA_DIST.

Test was originally added in
commit d7356a2801.
2012-02-13 13:49:21 +00:00
Richard W.M. Jones
07081591cf daemon: Return error properly when user tries to mount appliance root (RHBZ#789960).
In the case where the caller attempts to mount the "hidden"
appliance root device (eg. /dev/vdb if /dev/vda is the only
normal block device added), we were calling reply_with_error
but not actually returning immediately, resulting in protocol
desynchronization.

This commit fixes this obvious mistake.
2012-02-13 13:49:21 +00:00
Richard W.M. Jones
ba443ae048 daemon: Don't xdr_free uninitialized args struct on error paths.
For stubs of functions that had arguments, code did this:

static void
mount_stub (XDR *xdr_in)
{
  int r;
  struct guestfs_mount_args args;

  if (optargs_bitmask != 0) {
    //...
    goto done;
  }
  // possibly other tests here

  memset (&args, 0, sizeof args);

  [...]

done:
  xdr_free ((xdrproc_t) xdr_guestfs_mount_args, (char *) &args);
  return;
}

This caused xdr_free to be called on uninitialized 'args' struct,
causing a segfault.

The fix is to add another label, so the code looks like:

static void
mount_stub (XDR *xdr_in)
{
  int r;
  struct guestfs_mount_args args;

  if (optargs_bitmask != 0) {
    //...
    goto done_no_free;
  }
  // possibly other tests here

  memset (&args, 0, sizeof args);

  [...]

done:
  xdr_free ((xdrproc_t) xdr_guestfs_mount_args, (char *) &args);
done_no_free:
  return;
}

This fixes commit 330fbea5b2
and commit 0344248af5.
2012-02-13 13:49:21 +00:00
Hilko Bengen
c8a11468c4 Do not run test-virt-format.sh if appliance has not been built 2012-02-12 12:35:26 +01:00
Richard W.M. Jones
9403c5516f Version 1.17.6. 2012-02-10 14:01:42 +00:00
Richard W.M. Jones
badf2d6c4d virt-format: Add a test. 2012-02-10 14:01:38 +00:00
Richard W.M. Jones
7c21e49c2c fish: edit: Preserve permissions, UID, GID, SELinux context when editing files (RHBZ#788641). 2012-02-10 11:27:13 +00:00
Richard W.M. Jones
ddae5abf80 fish: In edit command, upload to a new file.
If the upload fails, this means we don't leave a partially
written file.

Also add a test for the edit command.
2012-02-10 11:27:13 +00:00
Richard W.M. Jones
ca80e44904 fish: Refactor error handling in the 'edit' command.
This is just code motion.
2012-02-10 11:27:13 +00:00
Richard W.M. Jones
ac58ddcd1a wipefs: Fix documentation.
This fixes commit a2b3e0900e.
2012-02-10 11:27:13 +00:00
Richard W.M. Jones
39625b59ee ocaml: Ensure bindings are recompiled whenever there is an API change. 2012-02-10 10:06:49 +00:00
Richard W.M. Jones
df3c6acacd wipefs: Include "optgroups.h".
This fixes commit a2b3e0900e.
2012-02-10 09:56:24 +00:00
Wanlong Gao
088546af9d virt-format: erase the filesystem signatures before erase partitions
erase the filesystem signatures on each device, then erase
the partitions, avoid to list all the partitions here.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-02-10 09:34:17 +00:00
Wanlong Gao
a2b3e0900e NEW API: add a new api wipefs
Add the new api wipefs to erase the filesystem signatures
on a device but now erase any data.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-02-10 09:34:13 +00:00
Richard W.M. Jones
6ca8a2db6d docs: Note that JRuby should use the Java bindings. 2012-02-09 15:46:15 +00:00
Richard W.M. Jones
a915d78ef9 New API: llz: This runs ls -laZ and is useful for showing SELinux contexts. 2012-02-09 15:46:14 +00:00
Richard W.M. Jones
24d7889eba edit: Preserve file permissions, UID, GID, SELinux context on edited files. (RHBZ#788641) 2012-02-09 15:46:14 +00:00
Hilko Bengen
016ae77e6c java: Make use of JAR_INSTALL_DIR, JNI_INSTALL_DIR 2012-02-08 22:47:22 +01:00
Richard W.M. Jones
2cbf5ea543 Version 1.17.5. 2012-02-08 14:35:55 +00:00
Richard W.M. Jones
f504cb02e1 findfs: Remove /run/blkid/blkid.tab.
See this util-linux commit:
b82590ad46
2012-02-08 14:35:55 +00:00
Richard W.M. Jones
518edc506f extra-tests: Add suppression for uninitialized memory bug in latest glibc. 2012-02-08 14:02:51 +00:00
Richard W.M. Jones
0559f038ad extra-tests: libnl moved from /lib64 to /usr/lib64 on Fedora.
Update suppressions file to match.
2012-02-08 14:02:14 +00:00
Richard W.M. Jones
825b5e65c0 perl: Ignore perl/MYMETA.json 2012-02-07 08:13:50 +00:00
Richard W.M. Jones
21a9efcad5 blockdev, parted: Call udev_settle before and after commands. (RHBZ#769304)
See comments in the code for details.

This is an alternate fix to
commit a9c8123c72.
2012-02-06 21:40:38 +00:00
Richard W.M. Jones
a98170e0e2 Revert "daemon: Run udev_settle after pwrite-device finishes."
This reverts commit a9c8123c72.
2012-02-06 18:24:52 +00:00
Richard W.M. Jones
3c9ef0e978 build: Choose a virtual directory for the daemon which is not a symlink.
Check /sbin, /usr/sbin, /bin and /usr/bin to ensure that neither the
directory nor the parent (eg. /usr) is a symlink, and use this
directory for the virtual directory used to store guestfsd in the
appliance.
2012-02-06 18:07:57 +00:00
Richard W.M. Jones
590d8c3c37 build: Remove 'run' from EXTRA_DIST.
This file shouldn't be included in the tarball as it contains
hard-coded paths from the maintainer's machine which cannot be
relevant to the target machine.
2012-02-03 20:57:28 +00:00
Richard W.M. Jones
b7a7ad1d11 Version 1.17.4. 2012-02-01 17:36:19 +00:00
Richard W.M. Jones
330fbea5b2 Clarify the error message when unavailable functions are called (RHBZ#679737).
Callers are supposed to use the availability API to check for
functions that may not be available in particular builds of
libguestfs.  If they don't do this, currently they tend to get obscure
error messages, eg:

  libguestfs: error: zerofree: /dev/vda1: zerofree: No such file or directory

This commit changes the error message to explain what callers ought to
be doing instead:

  libguestfs: error: zerofree: feature 'zerofree' is not available in this
  build of libguestfs.  Read 'AVAILABILITY' in the guestfs(3) man page for
  how to check for the availability of features.

This patch makes the stubs check for availability.  The stub code
changes to:

  static void
  zerofree_stub (XDR *xdr_in)
  {
  [...]

    /* The caller should have checked before calling this. */
    if (! optgroup_zerofree_available ()) {
      reply_with_error ("feature '%s' is not available in this\n"
                        "build of libguestfs.  Read 'AVAILABILITY' in the guestfs(3) man page for\n"
                        "how to check for the availability of features.",
                        "zerofree");
      goto done;
    }
  [...]
2012-02-01 15:09:09 +00:00
Wanlong Gao
90d6386c13 examples: code cleanups
do a code cleanup by removing the tailing spaces

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-01-31 13:27:52 +00:00
Wanlong Gao
d60d5c091f guestmount: use O_ACCMODE instead of hard coding
Change hard code 3 to O_ACCMODE.
it'll be more sensible.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-01-30 10:56:59 +00:00
Wanlong Gao
0042898880 guestmount: remove tailing spaces
just do a cleanup.
remove the tailing spaces.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-01-30 10:56:11 +00:00
Richard W.M. Jones
e3f15780c8 daemon: Fix crash in aug-defnode (RHBZ#785668). 2012-01-30 10:47:47 +00:00
Richard W.M. Jones
6e703c1316 virt-alignment-scan: Fix typo in man page (thanks yurchor). 2012-01-28 19:14:57 +00:00
Richard W.M. Jones
03684e7a61 ocaml: Various fixes for bytecode compilation.
Set LD_LIBRARY_PATH so we link against the just-built library, not
the installed library.

Use OCAMLCFLAGS instead of OCAMLOPTFLAGS where appropriate.

Remove unnecessary -cclib option for bytecode linking (gcc is not used
in this case).

This fixes commit eb68a31413.
2012-01-28 17:35:52 +00:00
Richard W.M. Jones
a3ac2cc788 Version 1.17.3. 2012-01-28 10:47:19 +00:00
Richard W.M. Jones
d33c70fd64 ocaml: Sort the tests. 2012-01-28 10:24:18 +00:00
Richard W.M. Jones
8fd5a377b8 extra-tests: ocaml: Additional suppressions so we can test bytecode. 2012-01-28 10:23:57 +00:00
Richard W.M. Jones
eb68a31413 ocaml: Test bytecode and native code bindings.
Compile each test twice, as bytecode and native code, and
test both.
2012-01-27 22:11:53 +00:00
Richard W.M. Jones
799852e646 ocaml: Fix bytecode bindings for functions with >= 6 args. 2012-01-27 21:48:35 +00:00
Richard W.M. Jones
7972b1da81 Update to latest gnulib.
This contains a workaround for stdalign bug:
http://lists.gnu.org/archive/html/bug-gnulib/2012-01/msg00340.html
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023

(Thanks Paul Eggert).
2012-01-27 18:56:14 +00:00
Richard W.M. Jones
8f564ae7a2 appliance: udev >= 176 now requires /dev to be a devtmpfs.
See this udev commit:
https://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff;h=220893b3cbdbf8932f95c44811b169a8f0d33939
2012-01-27 15:36:31 +00:00
Richard W.M. Jones
d5bc69e545 Version 1.17.2. 2012-01-26 17:05:30 +00:00
Richard W.M. Jones
93e443ccad build: Add gobject/TODO.txt to EXTRA_DIST.
This updates commit dd25638fc1.
2012-01-26 17:05:25 +00:00
Richard W.M. Jones
de00aa84af build: Add contrib/make-check-on-installed.pl to EXTRA_DIST.
This updates commit 3d0c9f3fc6.
2012-01-26 17:04:16 +00:00
Richard W.M. Jones
3d0c9f3fc6 contrib: Add a script for running test suite on installed packages. 2012-01-26 15:36:12 +00:00
Richard W.M. Jones
0a4d181063 contrib: Delete 'removed' sections from the README file.
There is no point in continuing to document removed stuff.
2012-01-26 15:36:12 +00:00
Richard W.M. Jones
09227c9d66 fish: Fix 'test-guestfish-escapes.sh' when running an alternate guestfish binary.
The error messages would be prefixed by the path to the
alternate binary, eg:

../fish/guestfish: invalid escape sequence in string (starting at offset 0)

Fix this by normalizing the messages further.
2012-01-26 15:36:11 +00:00
Richard W.M. Jones
9f8e9dcc70 ocaml: Don't install bindtests.*. 2012-01-26 15:36:11 +00:00
Richard W.M. Jones
b1ace67381 ocaml: Don't install libguestfsocaml.a. 2012-01-26 15:36:11 +00:00
Matthew Booth
dd25638fc1 gobject: Add a TODO list 2012-01-26 11:55:43 +00:00
Matthew Booth
8bad4d1c47 gobject: Add an explicit close call
This change binds guestfs_close(). It consequently results in RConstOptString
being able to throw an error.
2012-01-26 11:49:12 +00:00
Matthew Booth
6568dd85f4 gobject: Allow RConstOptString to return an error
RConstOptString cannot return an error in the C api. This makes it a special
case for the GObject api, as all other return types have a corresponding GError
**err argument to return an error. This change removes this special case, and
includes the possibility of an error return in the API. An error is indicated by
setting *err to a non-NULL value.

This change is in preparation for adding a close api. An attempt to call any
api, even RConstOptString, on a closed handle must return an error.
2012-01-26 11:35:13 +00:00
Jiri Popelka
501561742b appliance: Switch to using 'iproute' ('ip' command) from 'net-tools' (RHBZ#784647).
Change 'ifconfig' and 'netstat' commands to use 'ip' instead.

'iproute' was already included in the appliance, so this reduces the
size of the appliance accordingly.
2012-01-25 19:15:41 +00:00
Richard W.M. Jones
8ac5391935 Version 1.17.1. 2012-01-24 19:29:08 +00:00
Richard W.M. Jones
a05ddcd2a7 daemon: Fix use-after-free in case-insensitive-path (found by valgrind).
This commit tidies up the code by splitting out the path
element-searching code into a separate function.

Valgrind found that 'closedir' frees the 'struct dirent *', which
wasn't immediately obvious.  So now we do the 'closedir' after all
operations which touch 'd->d_name'.
2012-01-24 17:00:37 +00:00
Richard W.M. Jones
9700708a19 daemon: Fix leaking error message (found by valgrind). 2012-01-24 17:00:37 +00:00
Richard W.M. Jones
86f64c37b9 daemon: Close inotify handle on exit. 2012-01-24 17:00:37 +00:00
Richard W.M. Jones
94a7fb9fc5 daemon: Close augeas handle on exit. 2012-01-24 17:00:36 +00:00
Richard W.M. Jones
ff2e685828 daemon: Fix leak of strings in md-detail (found by valgrind). 2012-01-24 17:00:36 +00:00
Richard W.M. Jones
4c2101362e daemon: md: Whitespace changes, and use size_t for i instead of pointer.
This is just a code clean-up with no functional change.
2012-01-24 17:00:32 +00:00
Richard W.M. Jones
aa978b75ae daemon: Fix leak of strings in blkid (found by valgrind). 2012-01-24 17:00:32 +00:00
Richard W.M. Jones
43a6974cb3 daemon: blkid: Whitespace changes, and use size_t for i instead of pointer.
This is just a code clean-up with no functional change.
2012-01-24 17:00:23 +00:00
Richard W.M. Jones
f86c3a45ae daemon: Return value from write syscall is ssize_t, not int. 2012-01-24 15:56:19 +00:00
Richard W.M. Jones
9f8f1fd856 daemon: Don't leak 'cmdline' (found by valgrind). 2012-01-24 15:56:19 +00:00
Richard W.M. Jones
f65f653ab1 daemon: Length of message is a 32 bit unsigned quantity. 2012-01-24 15:56:19 +00:00
Richard W.M. Jones
9cf7ecbe4f daemon: Fix use of uninitialized stack data (found by valgrind).
This uninitialized data was also sent over the protocol,
potentially being a serious information leak.
2012-01-24 15:56:19 +00:00
Richard W.M. Jones
84242a8d0b daemon: Fix memory leak in 'initrd-cat' (found by valgrind). 2012-01-24 15:56:19 +00:00
Richard W.M. Jones
d08806adfc Enable running the daemon under valgrind.
This commit allows you to run the daemon under valgrind.  You have to
enable it at configure time:

  ./configure --enable-valgrind-daemon

This should *not* be done for production builds.

When this feature is enabled, valgrind is added to the appliance and
the daemon is run under valgrind.  Log messages from valgrind are
passed back over a virtio-serial channel into a file called
'valgrind.log.$PID' in the top build directory.

Running 'make check', 'make extra-tests' etc causes many
valgrind.log.* files to be created which must be examined by hand.
2012-01-24 15:56:14 +00:00
Hilko Bengen
b7122eaa58 resize, sparsify: find progress mini-library in out-of-tree builds (2) 2012-01-23 23:17:37 +01:00
Hilko Bengen
22224254fa Fix --{en,dis}able-install-daemon
This fixes...

    configure: error: conditional "INSTALL_DAEMON" was never defined.

... when specifying --disable-daemon
2012-01-23 23:16:37 +01:00
Richard W.M. Jones
734b1f662f API support: Fix src/api-support/added file.
This fixes commit 37e07db159.
2012-01-23 15:33:29 +00:00
Richard W.M. Jones
51c199ca6f Version 1.17.0. 2012-01-23 15:04:10 +00:00
Richard W.M. Jones
b1f188e24b Update ROADMAP. 2012-01-23 13:42:43 +00:00
Richard W.M. Jones
7caa81ab9d Finalize RELEASE NOTES. 2012-01-23 13:34:32 +00:00
Richard W.M. Jones
61dc072a8b Pull translations from Transifex. 2012-01-23 13:22:37 +00:00
Richard W.M. Jones
fd3e3ca188 debian: Debian 6 blkid has -p but not -i.
Fix the existing test to work correctly in this case.

Other cleanups.
2012-01-23 12:18:58 +00:00
Matthew Booth
abc17351ad gobject: Require minimum gobject library version of 2.26.0
The GObject bindings require G_DEFINE_BOXED_TYPE, which was not added until
2.25.15. There are probably other dependencies.
2012-01-23 10:53:29 +00:00
Jim Meyering
6edecdec59 maint: use $var notation rather than ${var} when possible
I noticed some uses of ${srcdir} in shell scripts.
That is almost always better written as $srcdir.
The patch below converts most such variable references.
Here are the few remaining candidates:

$ git grep -i -E '\$\{[a-zA-Z_0-9]+\}'|grep -v Makefile.in.in
configure.ac:        JAR_INSTALL_DIR=\${prefix}/share/java
configure.ac:        JNI_INSTALL_DIR=\${libdir}
debian/rules:   for TEST in ${DEBIAN_SKIP_TEST}; do \
debian/rules:#          mv $${mod} $$(dirname $${mod})/libguestfsmod.so; \
java/Makefile.am:libguestfs_jar_DATA = libguestfs-${VERSION}.jar
java/Makefile.am:libguestfs-${VERSION}.jar: $(libguestfs_jar_class_files)
perl/lib/Sys/Guestfs/Lib.pm:                      "-f", '${Package} ${Version} ${Architecture} ${Status}\n',
perl/typemap:            croak (\"${Package}::$func_name(): called on a closed handle\");
perl/typemap:        croak (\"${Package}::$func_name(): $var is not a blessed HV reference\");
tests/data/Makefile.am:   echo "$${i}abcdefghijklmnopqrstuvwxyz"; \

We could change all of those, too, except the ones in configure.ac
and Makefile.am, since they refer to Make variables.  Even those
should be changed, but to use the preferred Makefile notation:
$(prefix), $(libdir), $(VERSION).

>From a86770ecd45666232a94d76c8725c8f9b1c76e3a Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Mon, 23 Jan 2012 11:15:12 +0100
Subject: [PATCH libguestfs] maint: use $var notation rather than ${var} when
 possible

The only case to avoid in a shell script is when the byte after the
"}" is word-constituent, and concatenating it would thus change the
name of the variable.

These changes were induced by running this command:
  git grep -l -i -E '\$\{(srcdir|md)' \
    |xargs perl -pi -e 's/\$\{(srcdir|md)\}($|\w)/\$$1$2/gi'

The "g" was needed because there was one line with two instances.
The "i" is to handle ${SRCDIR}.  The ($|\w) ensures that concatenating
whatever follows the "}" won't change semantics.

* gobject/run-bindtests: Use "$srcdir", not "${srcdir}".
* haskell/run-bindtests: Likewise.
* java/run-bindtests: Likewise.
* ocaml/run-bindtests: Likewise.
* perl/run-bindtests: Likewise.
* python/run-bindtests: Likewise.
* ruby/run-bindtests: Likewise.
* tests/guests/guest-aux/make-debian-img.sh: Likewise, but $SRCDIR.
* tests/guests/guest-aux/make-ubuntu-img.sh: Likewise.
* tests/guests/guest-aux/make-windows-img.sh: Likewise.
* tests/md/test-mdadm.sh: Likewise, but $md.
2012-01-23 10:40:47 +00:00
Richard W.M. Jones
37e07db159 Update API support. 2012-01-23 10:35:24 +00:00
Hilko Bengen
3a754cc88f gobject: Run bindtests from srcdir. 2012-01-23 09:59:16 +00:00
Jim Meyering
70070cf244 build: don't use automake-internal variable
Hi Rich,

I realized a day or two late that my suggestion was not quite right.
Here's the fix:

>From 5294c21cf07c4ec2f094182ba9f32696f3de2751 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Mon, 23 Jan 2012 10:01:40 +0100
Subject: [PATCH libguestfs] build: don't use automake-internal variable

* ocaml/Makefile.am (mlguestfs.cma): Use the documented variable form,
$(libguestfsocaml_a_OBJECTS), not the $(am_libguestfsocaml_a_OBJECTS)
that I suggested for commit 1.15.16-17-g8b9eaec.
2012-01-23 09:40:18 +00:00
Hilko Bengen
7fbf0cc499 check for febootstrap etc. even if not building appliance 2012-01-23 09:08:33 +00:00
Hilko Bengen
d4f7958487 fish: Filter out error messages about history file in test script 2012-01-23 09:08:33 +00:00
Hilko Bengen
b6e0552ee5 Do not run appliance-related checks if not building appliance 2012-01-23 09:08:33 +00:00
Hilko Bengen
7004fafc69 Replace setting of environment variables with usage of local run script
(Includes fix by RWMJ)
2012-01-23 09:08:21 +00:00
Richard W.M. Jones
5cfd3e7b3e php: function_entry -> zend_function_entry.
function_entry was left over from PHP 3.

See: http://news.php.net/php.pecl.dev/7123
2012-01-22 14:47:43 +00:00
Richard W.M. Jones
4f868b84d6 php: Enable 'make clean' in extension subdirectory. 2012-01-22 14:38:07 +00:00
Richard W.M. Jones
7178554332 Version 1.15.19. 2012-01-22 11:42:55 +00:00
Richard W.M. Jones
17a599ef27 gobject: Include bindtests-manual.js in EXTRA_DIST.
This fixes commit 93b0769ec7.
2012-01-22 11:34:04 +00:00
Richard W.M. Jones
f81499fb64 gobject: Document these bindings in guestfs(3). 2012-01-22 11:34:04 +00:00
Richard W.M. Jones
4edd061975 website: Rebuild the HTML manual pages from scratch. 2012-01-22 11:34:03 +00:00
Richard W.M. Jones
de5d416fc7 daemon: Move internal-autosync function to new file internal.c.
This is just code motion.
2012-01-21 21:31:50 +00:00
Matthew Booth
93b0769ec7 gobject: Add bindtests for return values 2012-01-20 18:43:51 +00:00
Matthew Booth
02ccef7684 bindtests: Test optargs in test0
Note that this change disables compiling and running the haskell bindtests. The
haskell bindings do not implement optargs, and adding optargs to test0 causes
that method not to be bound in the haskell bindings. This prevents the haskell
bindtests from compiling. These should be re-enabled when optargs are
implemented.
2012-01-20 18:42:40 +00:00
Matthew Booth
e99a6a8483 gobject: Add basic bindtests 2012-01-20 18:42:40 +00:00
Matthew Booth
cce1bbb345 run script: Add support for gobject introspection 2012-01-20 18:12:38 +00:00
Matthew Booth
5c5babb40b gobject: Add GObject bindings 2012-01-20 18:12:38 +00:00
Matthew Booth
eb58fa9978 generator: Add CamelName flag
We can make a good guess at camel case names for most APIs. For example,
add_drive_opts can be automatically transformed to AddDriveOpts. However, other
apis don't produce a satisfactory name when transformed automatically. For
example, we would want md_create to produce MDCreate rather than MdCreate.

This change adds a CamelName flag which allows a camel case name to be specified
explicitly when the automatic transformation isn't satisfactory.
2012-01-20 18:06:37 +00:00
Hilko Bengen
b8720abfe5 resize, sparsify: find progress mini-library in out-of-tree builds 2012-01-20 16:10:14 +00:00
Hilko Bengen
251c6e994d Fixed out-of-tree compilation of OCaml code after .depend files removal 2012-01-20 16:10:14 +00:00
Hilko Bengen
762d1bbda1 fish: Remove hard-coded path from test script 2012-01-20 16:10:14 +00:00
Matthew Booth
3d80161d9c c: Fix prototype generator when last argument is a BufferIn
We were passing the name of the last argument directly to va_start. However, if
the last argument is a BufferIn it expands to 2 arguments, the latter of which
is <name>_size.
2012-01-20 15:29:08 +00:00
Matthew Booth
24f01a581b bindtests: Add a test for RBufferOut
Fixup the existing test, and add an entry in actions so it's actually generated.
2012-01-20 15:29:01 +00:00
Matthew Booth
a20b88be83 bindtests: Fix sscanf test in test0rhashtable 2012-01-20 15:28:54 +00:00
Matthew Booth
7412bb3421 bindtests: Add something non-zero to the RStructList test output 2012-01-20 15:28:45 +00:00
Richard W.M. Jones
04cb1bb106 Update release notes with feedback from Hilko Bengen. 2012-01-20 12:16:53 +00:00
Richard W.M. Jones
3f6ca541c7 Revert "generator: Add CamelName flag"
This reverts commit 83c20f02dc.
2012-01-20 09:40:35 +00:00
Richard W.M. Jones
1982779fa3 Version 1.15.18. 2012-01-19 18:41:35 +00:00
Richard W.M. Jones
72c97e6607 Update release notes. 2012-01-19 16:07:39 +00:00
Richard W.M. Jones
a9c8123c72 daemon: Run udev_settle after pwrite-device finishes.
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.
2012-01-19 15:47:19 +00:00
Richard W.M. Jones
ea3f16f6d9 appliance: Add psmisc package to the appliance.
This allows us to use 'fuser' and other ps tools.
2012-01-19 13:07:30 +00:00
Richard W.M. Jones
61abcf71c0 daemon: pwrite/pread: Don't double close on error path.
In Linux, close (fd) closes the file descriptor even if it returns an
error.
2012-01-19 11:31:23 +00:00
Richard W.M. Jones
08840bab44 Tempus fugit.
Update all copyright dates to 2012.
2012-01-18 22:05:02 +00:00
Richard W.M. Jones
d8a1389df3 tools: Mark obsolete tools clearly in the man pages. 2012-01-18 21:15:37 +00:00
Richard W.M. Jones
b9b77e7014 Version 1.15.17. 2012-01-18 17:21:09 +00:00
Richard W.M. Jones
535977bff8 lib: Use -fvisibilty=hidden by default; only ABI symbols are now visible.
http://gcc.gnu.org/wiki/Visibility
2012-01-18 17:21:08 +00:00
Richard W.M. Jones
8b9eaec993 ocaml: Use automake to build the C part of the bindings.
By arranging the C part of the bindings into a library, we can get
automake to build it instead of using $(CC) directly.
2012-01-18 17:21:04 +00:00
Richard W.M. Jones
607784df92 ocaml: Don't include guestfs-internal.h directly.
However since the OCaml bindings use guestfs_safe_strdup and
guestfs_safe_memdup we need to export those two (in the private
functions section) from <guestfs.h>.
2012-01-18 16:28:31 +00:00
Richard W.M. Jones
db90770ec5 ocaml: Add -Wno-missing-field-initializers to avoid a warning. 2012-01-18 16:28:31 +00:00
Richard W.M. Jones
6de1a1242e New tool: virt-format: erase and make blank disks.
This tool allows you to easily reformat a disk, creating a blank disk
with optional partition, LVM and empty filesystem.
2012-01-18 16:28:31 +00:00
Richard W.M. Jones
dd0707be5f fish options parsing: Allow add_drives to be called multiple times.
Ensure that the drv structure is always zeroed on allocation.

Don't leak old drv->device when add_drives is called multiple times.
2012-01-18 16:28:10 +00:00
Matthew Booth
fd1a6d8003 c: Allow NULL optargs to be passed to _argv calls
Previously, passing NULL optargs to an _argv call resulted in a segfault. This
change causes NULL optargs to be interpreted as no optargs, and to be correctly
handled accordingly.
2012-01-17 15:37:14 +00:00
Matthew Booth
c7119da130 c: NFC Remove redundant parentheses 2012-01-17 15:37:14 +00:00
Matthew Booth
3b352de1e9 generator: Add an explicit Cancellable flag
Currently any api which takes a FileIn or FileOut parameter is implicitly
cancellable. This change make cancellable an explicit flag in anticipation of it
being added to other apis.

Note that a Cancellable function must be able to return an error, which means it
can't return RConstOptString.
2012-01-17 15:37:14 +00:00
Matthew Booth
83c20f02dc generator: Add CamelName flag
We can make a good guess at camel case names for most APIs. For example,
add_drive_opts can be automatically transformed to AddDriveOpts. However, other
apis don't produce a satisfactory name when transformed automatically. For
example, we would want md_create to produce MDCreate rather than MdCreate.

This change adds a CamelName flag which allows a camel case name to be specified
explicitly when the automatic transformation isn't satisfactory.
2012-01-17 15:37:14 +00:00
Richard W.M. Jones
b1ea8a7808 resize2fs-M: fix double-free along error path (thanks Matthew Booth). 2012-01-16 10:15:02 +00:00
Richard W.M. Jones
3e9f8d050a e2fsck: Tidy up the documentation for this API. 2012-01-16 10:14:38 +00:00
Wanlong Gao
4ac5e2d218 e2fsck-f: change the internal to use e2fsck
Since we implement the new api e2fsck, just change the
internal of e2fsck_f to use e2fsck now.
v1->v2: use optargs_bitmask

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-01-13 16:48:23 +00:00
Wanlong Gao
38a0966da8 NEW API: add a new api e2fsck
m: Wanlong Gao <gaowanlong@cn.fujitsu.com>

Add a new api e2fsck with two options:
correct: same as '-p' option of e2fsck
forceall: same as '-y' option of e2fsck

Thanks for Rich's idea.
v1->v2: use optargs_bitmask
v2->v3: change the optargs_bitmask check

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-01-13 16:48:22 +00:00
Wanlong Gao
0eaf06e673 ext2: tweak the error returned message of resize2fs-M(BZ755729)
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>
2012-01-13 16:48:20 +00:00
Matthew Booth
f6db1ec410 build: Remove .depend files from git
Remove generated .depend files from source control, and don't barf when they
don't exist while bootstrapping.
2012-01-11 16:00:00 +00:00
Richard W.M. Jones
9fde0fad08 Update RELEASE-NOTES. 2012-01-11 14:05:29 +00:00
Richard W.M. Jones
54a7982dc3 extra-tests: Only test 5 random guests.
If you have a lot of guests, running extra tests takes a lot of time,
but (arguably) you're not really doing any more detailed testing.

Thus pick up to 5 guests at random to test.  A different random
selection is done on each run, ensuring that data-driven errors (eg in
inspection) will still be found eventually.
2012-01-10 18:52:53 +00:00
Richard W.M. Jones
adb0050d86 Version 1.15.16. 2012-01-10 17:52:05 +00:00
Richard W.M. Jones
39a10c9fab Allow /dev/null to be added multiple times.
Change the test for duplicate drives so that you're allowed to
add /dev/null multiple times.  This corresponds to traditional
usage.

This amends commit be47b66c30.
2012-01-10 16:51:36 +00:00
Richard W.M. Jones
01e717b3c1 daemon: debug segv correct use of dereferencing NULL. 2012-01-09 16:55:49 +00:00
Wanlong Gao
e0c3093795 launch: move the filename checking to a wrapper
Move the filename's comma character checking to a wrapper.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-01-09 14:08:41 +00:00
Wanlong Gao
be47b66c30 launch: don't add a drive twice
1. Change the g->path to restore a absolute path instead of the mixed.
2. Check that if the adding drive is duplicated with the added drive.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>

RWMJ:

- Make sure abs_path is NULL before it is assigned, so freeing it
  will work along the error path.

- Fix the test which added /dev/null multiple times.
2012-01-09 14:08:26 +00:00
Matthew Booth
0a7b734d2f generator: Create a separate type for optional arguments
Previously, optional arguments had the same type as regular arguments, but were
constrained by various runtime tests to be only Bool, Int, Int64 or String. This
change makes the type of optional arguments stronger by giving them their own
type.

A convenience function, optargs_to_args is defined to convert optargs in the few
places where they are genuinely treated identically to mandatory arguments.

It also allows for future changes to optional arguments which do not affect
mandatory arguments.

RWMJ:
 - removed redundant parens
 - readded the check for > 64 optargs, but changed it to > 63
 - changed the new function to args_of_optargs
2012-01-09 13:30:34 +00:00
Matthew Booth
e24af214fe generator: Rename java_structs to camel_structs to better reflect their purpose
This map was originally included just for the java bindings, but is generally
useful to any binding which uses camel case by requirement or convention.
2012-01-09 10:34:19 +00:00
Wanlong Gao
6f6485ec34 launch: add a goto label when add_drive error
Code cleanup.
Add a goto label to simplify the code.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-01-09 10:23:18 +00:00
Richard W.M. Jones
da13c1c0e6 Version 1.15.15. 2012-01-08 19:12:46 +00:00
Richard W.M. Jones
49b894599b debian: Add build-dep erlang-dev. 2012-01-06 21:08:25 +00:00
Richard W.M. Jones
c51caebea2 Update to latest gnulib. 2012-01-06 18:44:41 +00:00
Matthew Booth
ebdda911b5 Tempora mutantur, nos et mutamur in illis. 2012-01-04 12:32:35 +00:00
Matthew Booth
c655415dc0 build: Fix automake warnings 2012-01-04 10:38:44 +00:00
Richard W.M. Jones
8824089477 Sort .gitignore (using sort -d -- dictionary order). 2012-01-04 10:16:29 +00:00
Wanlong Gao
8af6237fd6 gitignore: ignore the git related files
*.eml for email picked patches
other for orginal git patch related files.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-01-04 10:14:41 +00:00
Wanlong Gao
f49a30eba8 fish: fix the Ctrl-\ causes guestfish to abort bug(RHBZ#596761)
Handle SIGQUIT by guestfish, so that it can't be terminated.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-01-04 10:04:15 +00:00
Wanlong Gao
10df9d88ab AUTHORS: add the email address for each authors
Add the email address for authors.
It would be better.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-01-03 15:45:32 +00:00
Richard W.M. Jones
49218ae6b4 fish: mount can be used instead of mount-options with libguestfs >= 1.14 2011-12-23 22:30:29 +00:00
Richard W.M. Jones
871e1cfe3a fish: Fix --format parameter in man page. 2011-12-23 22:30:09 +00:00
Richard W.M. Jones
03d052d578 Version 1.15.14. 2011-12-23 13:26:31 +00:00
Richard W.M. Jones
6032da6681 lib: Try harder to remove temporary directory along error paths (RHBZ#769680). 2011-12-23 10:37:04 +00:00
Richard W.M. Jones
690ff694ca lib: Add guestfs___remove_tmpdir helper function.
This function does 'rm -rf <dir>' for temporary directories, safely
working if '<dir>' contains shell meta-characters.

Replace existing code for removing directories with this.
2011-12-23 10:35:34 +00:00
Wanlong Gao
486cafd4ac gitignore: ignore the guestfs.* directory
Let git ignore the guestfs.* directorys.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2011-12-23 08:34:14 +00:00
Wanlong Gao
87e03fd48e extra-tests: add test-guests to prevent test error
extra-tests is depending on tests-guests.
We need guests/*.img when doing extra-tests.

/work/git/libguestfs/run valgrind --log-file=/work/git/libguestfs/tests/extra/valgrind.log --leak-check=full --error-exitcode=119 --suppressions=/work/git/libguestfs/tests/extra/suppressions ../../cat/virt-cat -a ../guests/fedora.img /etc/fstab >/dev/null
../guests/fedora.img: No such file or directory
make[1]: *** [test-tools-internal] Error 1
make[1]: Leaving directory `/work/git/libguestfs/tests/extra'

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2011-12-23 08:32:10 +00:00
Richard W.M. Jones
b5f9079302 fish: Fix test-guestfish-events.sh so it works when LIBGUESTFS_DEBUG=1 is set.
Various messages were added and changed when this variable was set
while tests were running.
2011-12-23 08:28:26 +00:00
Wanlong Gao
2ac869bcc8 mkfs: optimization and code cleanup
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.
2011-12-23 08:19:47 +00:00
Richard W.M. Jones
6067e1540f tests/lvm: Contains a Perl test so we must set PERL5LIB.
This fixes commit 498758faee.
2011-12-22 22:17:17 +00:00
Richard W.M. Jones
37aba887d7 tests/protocol: Contains a Perl test so we must set PERL5LIB.
This fixes commit 498758faee.
2011-12-22 19:12:14 +00:00
Richard W.M. Jones
76044a5c00 Version 1.15.13. 2011-12-22 18:34:22 +00:00
Richard W.M. Jones
9a5f784d51 Security: Mitigate possible privilege escalation via SG_IO ioctl (CVE-2011-4127, RHBZ#757071)
CVE-2011-4127 is a serious qemu & kernel privilege escalation bug
found by Paolo Bonzini.

http://seclists.org/oss-sec/2011/q4/536

An untrusted guest kernel is able to issue special SG_IO ioctls on
virtio devices which qemu passes through to the host kernel without
filtering or sanitizing.  These ioctls allow raw sectors from the
underlying host device to be read and written.  Significantly, neither
qemu nor the host kernel checks that the range of sectors is within
the partition / LV assigned to the guest.  For example, if the guest
is assigned host partition /dev/sda3, it would be able to read or
write any part of /dev/sda including other partitions and the boot
sector.  Exploits through LVs passed to the guest are also possible,
with some limitations.  File-backed virtual block devices are not
vulnerable.  Non-virtio block devices are not vulnerable.

This patch mitigates the problem by disabling the SG_IO ioctl
passthrough in qemu.  Thus if libguestfs is examining an untrusted
guest and the libguestfs appliance/daemon is compromised (eg. by
executing guest commands, or through some other compromise), then the
compromised appliance will not be able to issue the above SG_IO ioctls
and exploit the host.

Note that this is just mitigation for libguestfs.  Users will still
want to fully update their host kernel, qemu/KVM and libvirt, in order
to prevent other (non-libguestfs) routes to compromise.

The following versions of libguestfs (will/have) this patch applied.

  libguestfs >= 1.15.13
  libguestfs >= 1.14.8
  libguestfs >= 1.12.11
  libguestfs >= 1.10.12
  libguestfs >= 1.8.16

Earlier versions may be vulnerable unless a downstream packager has
applied this patch.

Cc: Hilko Bengen <bengen@hilluzination.de>
2011-12-22 18:12:48 +00:00
Hilko Bengen
ad5b5f96da Fixed checks for libpython features
The python3.1 package shipped with Debian/squeeze does not have the
'mu' suffix that was assumed before.
2011-12-22 16:34:43 +00:00
Richard W.M. Jones
be1419a442 Version 1.15.12. 2011-12-22 16:13:08 +00:00
Richard W.M. Jones
1fcec724aa tests: Add a simple liveness tests for qemu. 2011-12-22 15:48:13 +00:00
Richard W.M. Jones
1edf00d3bd tests: Finalize the order we run the tests. 2011-12-22 15:48:13 +00:00
Richard W.M. Jones
d24e088dc3 tests: Put test-tool and comment into own section. 2011-12-22 15:48:13 +00:00
Richard W.M. Jones
cd077b8229 tests: Split images -> tests/data + tests/guests 2011-12-22 15:48:11 +00:00
Richard W.M. Jones
c649817586 tests: Rename extratests -> tests/extra. 2011-12-22 15:47:29 +00:00
Richard W.M. Jones
498758faee tests: Split regressions -> various subdirectories of tests/ 2011-12-22 13:04:41 +00:00
Richard W.M. Jones
5d93d70b4d tests: Rename capitests -> tests/c-api. 2011-12-22 13:04:38 +00:00
Richard W.M. Jones
72f5487be2 tests: Rename caution -> tests/qemu. 2011-12-22 08:36:17 +00:00
Richard W.M. Jones
c09db4e834 tests: Document new tests/ subdirectory. 2011-12-22 08:34:08 +00:00
Richard W.M. Jones
f5a49bf1ca docs: Arrange directory names in alphabetical order. 2011-12-22 08:33:16 +00:00
Richard W.M. Jones
a0a8de4253 extra-tests: Add an extra suppression for OCaml 3.11.2 in RHEL 6. 2011-12-20 18:26:20 +00:00
Richard W.M. Jones
7123f0cab1 fish: Allow events to be processed in guestfish.
Add 'event', 'list-events' and 'delete-event' commands so that event
handlers can be registered, listed and deleted in guestfish.  The
event handler is a shell script snippet or host command.

Cc: Pádraig Brady <P@draigBrady.com>
2011-12-16 19:52:08 +00:00
Richard W.M. Jones
3c9dfd1e95 python: Missing () in guestfs-python(1) examples. 2011-12-14 12:07:47 +00:00
Richard W.M. Jones
0ef30bbb31 Version 1.15.11. 2011-12-09 17:34:01 +00:00
Richard W.M. Jones
ae45cee728 fuse: Return EXIT_FAILURE if fuse_main fails.
fuse_main can return any non-zero value on error.  In particular on
certain sorts of error such as unsupported -o options it returns 1
(not -1).

Therefore make sure any non-zero return is turned into EXIT_FAILURE.

(Thanks Pádraig Brady)
2011-12-09 15:30:23 +00:00
Richard W.M. Jones
54e91da925 fish: -i option should fail if / is not mountable, but warn about others.
In particular this stops a problem with guestmount where if the -i
option half-recognizes the guest OS, it would mount the disk (and
fail, giving only warnings), leaving the mountpoint unusable.

(Thanks Pádraig Brady)
2011-12-09 09:49:37 +00:00
Richard W.M. Jones
19e2f5aa4f daemon: Fix utimens so it doesn't hang on named pipes (RHBZ#761460).
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.
2011-12-08 11:39:58 +00:00
Richard W.M. Jones
31fba8d803 daemon: Allow utimens to work for directories (RHBZ#761451).
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.
2011-12-08 11:15:18 +00:00
Richard W.M. Jones
98edfac1ee copy-in/copy-out: Wait for the tar subprocess only (RHBZ#760669). 2011-12-07 12:12:35 +00:00
Richard W.M. Jones
7d3848ddc0 fish: Improve error messages when no OS / multi-boot OS found with inspection (RHBZ#760775). 2011-12-07 11:46:43 +00:00
Hilko Bengen
41a7a68cf3 let the user explicitly choose ruby and rake programs 2011-12-06 19:48:31 +00:00
Richard W.M. Jones
2353b9d3b8 Version 1.15.10. 2011-12-06 15:10:46 +00:00
Hilko Bengen
43942b08cf Fix rpcgen post-processing for out-of-tree builds 2011-12-06 08:10:00 +00:00
Richard W.M. Jones
2972987d02 ruby: Use RSTRING_PTR, RSTRING_LEN for compat with Ruby 1.9 (RHBZ#760000). 2011-12-05 10:36:13 +00:00
Wanlong Gao
6c5f7c954c blkid: split the RHEL5 which can't support some options
RHEL5 shoult not support '-p', '-i' and '-o export' options.
But we just split it according to the '-p' option.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2011-12-05 10:15:12 +00:00
Wanlong Gao
f499d7d425 TODO: remove the implemented command blkid
Remove the implemented command blkid from TODO lists.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2011-12-05 10:10:11 +00:00
Richard W.M. Jones
e18058a5a5 Revert "blkid: Use -c /dev/null because RHEL 5 blkid doesn't have -p option."
This reverts commit 6533491b17.
2011-12-04 16:47:37 +00:00
Richard W.M. Jones
7f14c042eb Revert "blkid: Fix mistake in previous commit."
This reverts commit c48226a502.
2011-12-04 16:47:29 +00:00
Richard W.M. Jones
c48226a502 blkid: Fix mistake in previous commit.
This updates commit 6533491b17.
2011-12-03 23:16:00 +00:00
Richard W.M. Jones
6533491b17 blkid: Use -c /dev/null because RHEL 5 blkid doesn't have -p option. 2011-12-03 22:58:03 +00:00
Richard W.M. Jones
615924abaa daemon: Use pkg-config to locate Augeas CFLAGS / libraries.
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.
2011-12-03 14:34:52 +00:00
Richard W.M. Jones
cd1322e30d Version 1.15.9. 2011-12-03 12:59:27 +00:00
Wanlong Gao
fcb975a642 NEW API: add blkid command to print the attributes of the device
A NEW API blkid.
It can print the device attributes.
Use it after list-devices, we can list ower devices and the attributes
of each device.
Use it like:
blkid <device>
It's should be a usefull function.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2011-12-03 11:05:48 +00:00
Richard W.M. Jones
b7addee24d extra tests: Test that valgrind and libtool are installed. 2011-12-02 15:03:19 +00:00
Matthew Booth
e72c200e4c inspection: Add a test for MD device mapping in fstab
Check that we properly handle fstab entries of the form /dev/md0 and
/dev/md/foo.

RWMJ: Add a skip to test if the Augeas lens is not available.
2011-12-02 14:14:00 +00:00
Matthew Booth
922c3623c6 inspection: Handle MD devices in fstab
This patch fixes inspection when fstab contains devices md devices
specified as /dev/mdN. The appliance creates these devices without reference to
the guest's mdadm.conf so, for e.g. /dev/md0 in the guest will often be created
as /dev/md127 in the appliance. With this patch, we match the uuids of detected
md devices against uuids specified in mdadm.conf, and map them appropriately
when we encounter them in fstab.
2011-12-02 14:12:11 +00:00
Matthew Booth
655f8037de build: Add more suppressions for valgrind tests 2011-12-02 14:12:07 +00:00
Wanlong Gao
1970a14178 mkfs: enable to make xfs filesystems when the device already has a filesystem
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>
2011-12-02 14:01:28 +00:00
Hilko Bengen
1a35ca5908 libguestfs: Added gnulib includes from builddir, as suggested by the Gnulib 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
2011-12-01 23:40:58 +00:00
Richard W.M. Jones
f23352aefd todo: Suggestion for UUIDs in /etc/fstab (thanks Joshua Daniel Franklin). 2011-11-30 17:08:33 +00:00
Richard W.M. Jones
ce331df0f1 ocaml: Fix OCaml dependencies. 2011-11-30 17:08:27 +00:00
Richard W.M. Jones
ece902712b Version 1.15.8. 2011-11-29 23:31:30 +00:00
Richard W.M. Jones
e7e3a32edc python: Memory leak: Free roots array along handle close path. 2011-11-29 19:44:36 +00:00
Richard W.M. Jones
00c9755ee3 perl: Memory leak: Free roots array along handle close path. 2011-11-29 19:44:34 +00:00
Richard W.M. Jones
eb7ec6170e ruby: Memory leak: Free roots array along handle close path. 2011-11-29 17:52:46 +00:00
Richard W.M. Jones
efef3e3c12 extra tests: Add comments about what is not tested here. 2011-11-29 17:52:46 +00:00
Richard W.M. Jones
27d00960c9 extra tests: Absolute path for 'run' command. 2011-11-29 17:52:43 +00:00
Richard W.M. Jones
cee513112a extra tests: Split up and reorder tests more logically. 2011-11-29 17:22:56 +00:00
Richard W.M. Jones
14b1e7b963 extra tests: Test virt-sparsify.
This adds the virt-sparsify --debug-gc option which causes
virt-sparsify to call Gc.compact before exiting, allowing
GC and memory problems to be tested.

Add an extratest which runs virt-sparsify under valgrind.
2011-11-29 17:20:11 +00:00
Richard W.M. Jones
7708d3e04f extra tests: Test virt-resize.
This adds the virt-resize --debug-gc option which causes
virt-resize to call Gc.compact before exiting, allowing
GC and memory problems to be tested.

Add an extratest which runs virt-resize under valgrind.
2011-11-29 17:14:18 +00:00
Richard W.M. Jones
082a55f76c ocaml: Load test should call Gc.compact to flag memory errors. 2011-11-29 17:13:45 +00:00
Richard W.M. Jones
6bd0eec12f ocaml: Fix memory leak in bindings for functions that return buffers.
RBufferOut binding didn't free the buffer after copying it onto
the OCaml heap.

Found by valgrind.
2011-11-29 17:13:17 +00:00
Richard W.M. Jones
bcd2dba76e Version 1.15.7. 2011-11-29 16:11:21 +00:00
Richard W.M. Jones
e1f395defc extra tests: Run C API tests under valgrind. 2011-11-29 13:13:44 +00:00
Richard W.M. Jones
d81c0829ea protocol: Memory leak: Free temporary buffer along recv_discard path. 2011-11-29 13:13:29 +00:00
Richard W.M. Jones
aa4eb4cd10 extra tests: Run OCaml tests under valgrind. 2011-11-29 12:52:15 +00:00
Richard W.M. Jones
6ccae55ddc extra tests: Split VG variable into VG / RUN_VG.
This is just code motion.
2011-11-29 12:51:20 +00:00
Richard W.M. Jones
c5dbb1e63a ocaml: Memory leak: Free roots array along handle close path. 2011-11-29 12:25:34 +00:00
Matthew Booth
35c8e4fa7f inspection: Cleanup iteration over fstab entries in inspect_fs_unix.c
Select non-comment labels using an augeas path to return the correct
nodes in the first instance, rather than applying a regular expression
to all results.

There is no functional change to the code.

RWMJ:
 - Rebased to current HEAD.
 - Move variable decls to top of function.
 - Some whitespace changes.
 - Remove check for errors from snprintf since it can never happen.
2011-11-29 12:25:06 +00:00
Richard W.M. Jones
7c89d9ef6b inspection: Add outline support for GNU/Hurd. 2011-11-28 20:40:01 +00:00
Richard W.M. Jones
f5bfc68fdb fish: When -m option fails, canonicalize device names that are printed.
The error message now looks like this:

  guestfish: '/dev/vda6' could not be mounted.  Did you mean one of these?
            /dev/sda1 (ext4)
            /dev/vg_f15x32/lv_root (ext4)
            /dev/vg_f15x32/lv_swap (swap)

Note that '/dev/sda1' has been canonicalized.
2011-11-28 19:12:44 +00:00
Richard W.M. Jones
450134501c fish: Rearrange code for displaying mountpoints when -m option fails.
This also frees the list returned by guestfs_list_filesystems.
2011-11-28 19:07:30 +00:00
Richard W.M. Jones
425374ddc8 docs: Tidy up documentation for md-stop.
This cleans up commit cbd1c45d95.
2011-11-25 08:35:26 +00:00
Richard W.M. Jones
56c151fe8c Version 1.15.6. 2011-11-24 20:28:02 +00:00
Richard W.M. Jones
b5b4816ab0 ubuntu: Add extra suppressions for libnl.1 leaks. 2011-11-24 20:17:57 +00:00
Richard W.M. Jones
56b3b40603 Update API support. 2011-11-24 19:36:50 +00:00
Richard W.M. Jones
be7cb78906 extra-tests: Include valgrind suppressions file.
This updates commit c55bad93fb.
2011-11-24 17:48:02 +00:00
Richard W.M. Jones
3bbcbd5eea regressions: Allow test-launch-race.pl to be skipped.
export SKIP_TEST_LAUNCH_RACE_PL=1
will cause this test to be skipped.
2011-11-24 16:54:17 +00:00
Richard W.M. Jones
2d5841133a debian: Use mdadm -D --export instead of mdadm -DY.
For compatibility with mdadm on Debian Squeeze.
2011-11-24 16:27:36 +00:00
Richard W.M. Jones
c55bad93fb Add 'make extra-tests' rule and run extra tests.
These tests are optional, and require a special environment and
tools to run.
2011-11-24 15:51:16 +00:00
Richard W.M. Jones
dd76ce2b4c lib: Fix memory leak when debugging enabled (found by valgrind).
If you enabled debugging (eg. LIBGUESTFS_DEBUG=1) then every
debug message printed would be leaked.
2011-11-24 15:51:16 +00:00
Richard W.M. Jones
bfc0a5f58d test-tool: Fix multiple memory leaks found by valgrind. 2011-11-24 15:51:16 +00:00
Richard W.M. Jones
cd3d28491d filesystems: Fix memory leak found by valgrind. 2011-11-24 15:51:16 +00:00
Richard W.M. Jones
c4381dba73 part-disk: Change default alignment of this to 64K (128 sectors).
This is the minimum alignment.  1MB would be better.

Note that the exact behaviour is not defined in the API.
2011-11-24 14:42:26 +00:00
Richard W.M. Jones
7b192f5a67 virt-alignment-scan: Add checks for when API calls return NULL.
In particular, virt-alignment-scan -a /dev/null would segfault
because of an error returned by parted.
2011-11-24 14:06:31 +00:00
Wanlong Gao
cbd1c45d95 New API: md-stop for stopping MD devices
This API is used to stop a md device.
When we want to move a device to another md array, we should
stop the md device which contained this device first.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2011-11-24 13:24:17 +00:00
Matthew Booth
182c25b2a4 Rename mdadm_ apis to md_
This change renames the following 2 apis:
* mdadm_create -> md_create
* mdadm_detail -> md_detail

This is more consistent with list_md_devices, and removes a reference to an
implementation detail from the api.
2011-11-24 13:22:42 +00:00
Matthew Booth
373dca7d12 NFC: Allow multiple config files in inspect_with_augeas in inspect_fs_unix.c
This change is in support of the addition of MD support to fstab inspection.
2011-11-24 12:50:26 +00:00
Matthew Booth
011a248381 NFC: Consolidate the error path in check_fstab in inspect_fs_unix.c 2011-11-24 12:50:26 +00:00
Matthew Booth
454a08380d md: Inspect MD devices 2011-11-24 12:50:26 +00:00
Matthew Booth
c8cb3d27b6 NFC: Declare and use variables on the same line in inspect.c 2011-11-24 12:50:26 +00:00
Matthew Booth
34c0542189 build: Nothing under images/ should be translated 2011-11-24 12:50:26 +00:00
Matthew Booth
d3458d7bc4 build: Create an MD variant of the dummy Fedora image
This change involves rewriting make-fedora-img.sh in perl. This allows the
flexibility to write mdadm.conf containing whichever uuids where randomly
generated when the md devices were created.
2011-11-24 12:50:22 +00:00
Matthew Booth
252ad4aa41 run script: Don't overwrite LD_LIBRARY_PATH and PERL5LIB
This change allows the run scripts of virt-v2v and libguestfs to be chained.
2011-11-24 11:53:36 +00:00
Richard W.M. Jones
065b6b5798 gnulib: Rebase to latest. 2011-11-22 16:41:48 +00:00
Richard W.M. Jones
9b102aae65 Don't rely on implicit promotion of float to double in printf args. 2011-11-22 16:41:48 +00:00
Richard W.M. Jones
99ec97dcdf fish: In generated code, put function names on a new line.
eg:

static void
run_foo ()
{
}
2011-11-22 16:41:47 +00:00
Richard W.M. Jones
7b3137e664 df, testing: Add notes on virt-df numbers (thanks Kashyap Chamarthy). 2011-11-22 13:21:17 +00:00
Richard W.M. Jones
ce6c4eeabe sparsify: Add -o option for passing qemu-img output format options. 2011-11-22 10:11:10 +00:00
Richard W.M. Jones
b83b705959 sparsify: Add --compress option.
This adds the -c option to the final qemu-img command.
2011-11-22 09:57:06 +00:00
Richard W.M. Jones
342b4a55d0 sparsify: Add auto-detection of .vdi files.
Note that for this to work properly, it requires a patch to
the 'file' command.  See:
https://www.redhat.com/archives/libguestfs/2011-November/msg00120.html
2011-11-22 09:43:49 +00:00
Matthew Booth
0cdd944474 fish: Add MD devices to guestfish device autocompletion. 2011-11-21 15:23:18 +00:00
Richard W.M. Jones
a7740cb19a Version 1.15.5. 2011-11-21 13:25:36 +00:00
Richard W.M. Jones
6f39cfaeac guestfs-testing: Link to libguestfs-test-tool. 2011-11-21 13:09:59 +00:00
Richard W.M. Jones
7828f4dfe3 contrib: Update introduction to libguestfs. 2011-11-21 11:45:54 +00:00
Hilko Bengen
8bc6e9d6a8 out-of-tree build: ruby 2011-11-21 08:43:33 +00:00
Richard W.M. Jones
a3b2429681 Add guestfs-testing(1) man page.
This contains suggested manual tests that users can run.
2011-11-20 13:39:28 +00:00
Richard W.M. Jones
3e9f4af1e1 Version 1.15.4. 2011-11-17 13:33:57 +00:00
Matthew Booth
c4bd6bba8d New API: mdadm-detail. 2011-11-17 12:43:49 +00:00
Matthew Booth
0c99bb06f4 Add custom indentation config for vim. 2011-11-17 12:43:23 +00:00
Hilko Bengen
730fb50780 out of tree build: haskell 2011-11-16 12:39:02 +00:00
Hilko Bengen
a0509ff071 java: out-of-tree build, don't build static library 2011-11-16 12:38:59 +00:00
Hilko Bengen
ddb3fac1bf out of tree build: erlang 2011-11-16 12:38:33 +00:00
Matthew Booth
b051fffc6f Update list-filesystems to check md devices. 2011-11-11 22:52:31 +00:00
Matthew Booth
00a0fab50b New API: list-md-devices.
Return a list of Linux MD devices detected in the guest.

This API complements list_devices, list_partitions, list_lvs and
list_dm_devices.
2011-11-11 22:52:31 +00:00
Richard W.M. Jones
c11a92751e New API: mdadm-create for creating MD devices. 2011-11-11 22:52:31 +00:00
Richard Jones
47963bc9cc 32 bit: Fix printf off_t. 2011-11-11 20:26:49 +00:00
Richard W.M. Jones
5d48250224 32 bit: Use %td for ptrdiff_t (difference between two pointers). 2011-11-11 19:11:29 +00:00
Richard W.M. Jones
6e6b3ff35f df: Disable part of virt-df test.
See:
https://www.redhat.com/archives/libguestfs/2011-November/msg00051.html
2011-11-11 17:30:04 +00:00
Richard W.M. Jones
c81a16a4e2 New API: Bind the tune2fs command.
Previously we bound the 'tune2fs -l' command so that we could list out
the tunables of an ext2/3/4 filesystem.  Also commands like
set_e2label and set_e2uuid used tune2fs.

This commit binds many of the tunables that can be set using tune2fs.

The coverage is not complete, but we can add more later because this
uses optional parameters so the call is extensible without breaking
ABI.  The current change gives us enough for using libguestfs within
OpenStack.
2011-11-11 10:48:22 +00:00
Richard W.M. Jones
9ba779ea36 tune2fs-l: Add a test. 2011-11-11 10:48:22 +00:00
Richard W.M. Jones
5f0b75f040 generator: Support testing the output of RHashtable functions.
You can use TestOutputHashtable to test the output of RHashtable
functions.
2011-11-11 10:48:22 +00:00
Richard W.M. Jones
edd502543a daemon: Define safe ADD_ARG macro for constructing arg lists on the stack. 2011-11-11 10:48:16 +00:00
Richard W.M. Jones
1ecc6b1493 Version 1.15.3. 2011-11-09 22:44:47 +00:00
Richard W.M. Jones
29172e7c48 ocaml: Fix bindings when a function takes more than 10 parameters.
If any function had more than 10 required + optional parameters, OCaml
bindings could not be generated.  Currently there are no such
functions.
2011-11-09 21:21:49 +00:00
Richard W.M. Jones
af2b0378bb tests: Fix bitmask parameter when testing optional arguments.
The bitmask was being constructed backwards(!)

As a result, any test which tested optional arguments didn't work.
There are very few such tests and they happened not to be affected by
this.
2011-11-09 21:21:48 +00:00
Richard W.M. Jones
271f8e4b70 fish: More informative documentation of optargs. 2011-11-09 21:21:48 +00:00
Richard W.M. Jones
145ed04e41 ocaml: Compile OCaml bindings and tests with -warn-error. 2011-11-09 21:21:48 +00:00
Richard W.M. Jones
22c72b911e ocaml: Catch EVENT_ENTER case in test.
For some reason we are not compiling the tests with -warn-error so
this problem was not noticed before.

This fixes commit 9420eaf44e.
2011-11-09 21:21:48 +00:00
Matthew Booth
04ea1375c5 Update FSF address. 2011-11-08 14:43:07 +00:00
Richard W.M. Jones
9c299b64bb daemon: Use a private copy of /etc/lvm so we don't modify the real config.
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.
2011-11-04 16:37:12 +00:00
Richard W.M. Jones
6011b1f803 daemon: Don't use files with fixed names in /tmp (thanks Steve Kemp).
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.
2011-11-04 15:30:12 +00:00
Richard W.M. Jones
f93e8dbb78 Version 1.15.2. 2011-11-03 14:47:26 +00:00
Richard W.M. Jones
22998927f9 virt-sysprep: Don't use xmlstarlet.
Use virt-inspector --xpath option instead.
2011-11-03 13:09:54 +00:00
Richard W.M. Jones
d1ee71782a Add virt-inspector --xpath to run XPath queries directly.
xmlstarlet is good, but not available in Red Hat Enterprise Linux.

Build a simple but sane XPath query parser into virt-inspector
directly so that we don't need any external tools.
2011-11-03 13:06:25 +00:00
Richard W.M. Jones
ffbafadcb8 resize: Remove requirement for ocaml Pcre library.
This library is not available in RHEL 6, and in any case removing the
dependency is a simple change.
2011-11-03 10:46:50 +00:00
Richard W.M. Jones
6389826810 resize: Add tests for some Utils functions. 2011-11-03 10:32:02 +00:00
Richard W.M. Jones
31e5539a14 python: Use sys.version_info[0] instead of sys.version_info.major.
The major/minor fields only exist in Python >= 2.7.  This works for at
least Python 2.5 and 2.6.

Thanks to Hilko Bengen.

This updates commit 646142f513.
2011-11-03 09:48:45 +00:00
Richard W.M. Jones
2116f79cbc python: Fixes for Python 3 (RHBZ#750889).
These fixes allow libguestfs bindings to work with Python 3 (tested
with Python 3.2)

You can select which Python you compile against by doing:

  PYTHON=python ./configure && make && make check

or:

  PYTHON=python3 ./configure && make && make check
2011-11-02 19:43:53 +00:00
Richard W.M. Jones
e2249b7ce1 python: Pass $PYTHON environment variable to tests.
If the user set PYTHON when configuring, this variable is not passed
through to the tests, so it is possible the tests will fail because
they are testing the wrong version of python.  By passing $PYTHON
through to the tests we ensure that we test against the same version
of python that we configured with.
2011-11-02 19:42:29 +00:00
Richard W.M. Jones
25454b8308 python: Include <config.h>.
Ooops ...
2011-11-02 18:19:15 +00:00
Richard W.M. Jones
646142f513 python: Correctly check for Python major/minor.
The manual for sys.version warns that you should not parse the string,
which we were doing.  It would have failed on python "2.10" or
similar.

Do it correctly using the sys.version_info struct instead.
2011-11-02 18:18:14 +00:00
Richard W.M. Jones
b4791fd404 contrib: Use PNG images as fallback for IE compatibility. 2011-11-02 13:23:37 +00:00
Richard W.M. Jones
acd06dbe32 contrib: Update talk. 2011-11-01 17:51:00 +00:00
Richard W.M. Jones
fdcd33a155 Version 1.15.1. 2011-11-01 15:11:16 +00:00
Richard W.M. Jones
fc821f9789 contrib: Add all contrib files to EXTRA_DIST. 2011-11-01 14:10:49 +00:00
Richard W.M. Jones
4ac261b3ee contrib: Add libguestfs talk.
This is a short (10-15 min) talk that I give to introduce the main
features of libguestfs.  The "slides" are in the form of a complete
self-contained HTML page with a handful images that can be easily
distributed before the talk.
2011-11-01 14:07:59 +00:00
Richard W.M. Jones
0257e27e17 rescue: Add --suggest option to suggest mount commands. 2011-11-01 09:58:29 +00:00
Richard W.M. Jones
b4da051d54 fish: Use size_t instead of int when counting strings. 2011-11-01 09:47:01 +00:00
Matthew Booth
4e3a1205eb Fix debug help error message.
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'.
2011-10-31 16:47:50 +00:00
Richard W.M. Jones
6f84ef6768 appliance: Add 'mdadm' package. 2011-10-31 16:44:55 +00:00
Richard W.M. Jones
365885dab2 perl: Add %guestfs_introspection hash with introspection information.
Because this is a useful introspection API, it is a candidate for
being backported into older stable branches.
2011-10-28 14:04:47 +01:00
Richard W.M. Jones
477c437ba0 Version 1.15.0. 2011-10-27 16:06:44 +01:00
Richard W.M. Jones
908fd031d3 Pull latest translations from Transifex. 2011-10-27 14:26:46 +01:00
Richard W.M. Jones
6edd6cdeba generator: Remove DangerWillRobinson.
This warning was applied unevenly.  Potentially any command can be
dangerous or safe, so it was a needless warning.
2011-10-27 13:45:22 +01:00
Richard W.M. Jones
7b44f7b3df fuse: Skip guestmount test if setfacl is not installed.
This dependency is optional, don't fail the test if it's not
installed.
2011-10-27 13:44:02 +01:00
Richard W.M. Jones
2749d6edfb virt-sysprep: Skip test if xmlstarlet is not installed.
This dependency is optional, so don't fail the test if it
is not installed.
2011-10-27 13:37:46 +01:00
Richard W.M. Jones
46e08a159a virt-alignment-scan: Add additional data for 4K sector drives
(thanks Matt Booth).
2011-10-27 13:30:22 +01:00
Richard W.M. Jones
d9c4b702e7 test-virt-sparsify: Relax size_after constraint (for Debian).
size_after on Debian was 10136K.  The host filesystem was ext3 (vs
ext4 for Fedora where we did the original testing).  Probably indirect
blocks (vs more efficient extents on ext4) causes the difference,
although I did not look at it in detail.
2011-10-27 12:28:47 +01:00
Richard W.M. Jones
e077743442 Update RELEASE-NOTES for 1.14 release. 2011-10-27 10:55:06 +01:00
Richard W.M. Jones
a08bfe2896 Update ROADMAP for 1.14 release. 2011-10-27 10:54:55 +01:00
Richard W.M. Jones
7fef001bd9 Update API support. 2011-10-26 22:22:32 +01:00
Richard W.M. Jones
19005b2cfc Version 1.13.26. 2011-10-26 21:12:18 +01:00
Richard W.M. Jones
b0eabcca60 guestmount: Fix --live option (RHBZ#744795). 2011-10-26 20:53:30 +01:00
Richard W.M. Jones
bf7f3170ea fish and other tools: -d option uses readonlydisk="read" (RHBZ#747290).
Tools like virt-edit would not be able to edit disks marked as
<readonly/> in the libvirt XML.  It's not clear if this is a bug or a
feature.
2011-10-26 19:30:23 +01:00
Richard W.M. Jones
b893294dcc add-domain: Add readonlydisk optional argument (RHBZ#747290).
This optional argument controls how <readonly/> disks in
the libvirt XML are handled.  It can be set to one of:

  "write" (default) - add them R/W
  "read" - add them R/O
  "error" - throw an error if asked to add them R/W
  "ignore" - ignore these disks

I have added limited regression tests for this feature.  However
libvirt's test:/// XML does not allow you to specify that a domain
starts off shut down, so we cannot fully test this.  Instead I tested
it by hand.
2011-10-26 19:29:57 +01:00
Richard W.M. Jones
163f7df845 libvirt: Detect if a disk has the <readonly/> flag.
This changes the private function guestfs___for_each_disk so that the
<readonly/> flag on libvirt disks is detected and passed through to
the callback function.
2011-10-26 17:47:34 +01:00
Richard W.M. Jones
62909197d1 test-user-cancel: Make this test choose smaller cancellation numbers.
Use a Gaussian distribution for random numbers so that smaller numbers
are chosen more frequently.

This also exposes a bug in this test which only happens when small
numbers are chosen:

If the test thread starts up quickly, it can get to
guestfs_user_cancel before the guestfs_upload command has happened in
the main thread.  This causes the cancel to be ignored (correctly) and
we end up in the second loop writing data until the disk runs out of
space.  Fix this by repeatedly asserting the cancel flag in the second
loop.
2011-10-26 17:07:02 +01:00
Richard W.M. Jones
ced99cf69e Version 1.13.25. 2011-10-26 14:09:39 +01:00
Richard W.M. Jones
d64fca7b84 virt-resize: Be much more conservative about moving first partition.
Commit 2910413850 caused Windows 7
resizes to break with the 0xc0000225 boot error.

Change the --align-first auto (default) option so that it is more
conservative about when it moves the first partition.  In particular
it doesn't move it if it's already aligned (as it is for Win7), nor if
there is more than one partition (also Win7).

Tested with: Windows XP, 2003, 7, Ubuntu 10.10 and RHEL 5.
2011-10-26 13:56:18 +01:00
Richard W.M. Jones
178a6d78a8 Flush stdout for progress bars used by guestfish, virt-resize. 2011-10-26 13:55:38 +01:00
Richard W.M. Jones
119e67a92e virt-resize: Handle extended and logical partitions (RHBZ#642821). 2011-10-26 10:07:26 +01:00
Richard W.M. Jones
f4b3351692 resize: Get the partition table type of the source disk earlier.
Also we only permit MBR (DOS) and GPT partition tables.  In theory
previously we allowed other partition table types, but it is unlikely
that it would have worked in reality.
2011-10-26 10:07:26 +01:00
Richard W.M. Jones
f223dfa29a New APIs: copy-{file,device}-to-{file,device}.
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.
2011-10-26 10:07:21 +01:00
Richard W.M. Jones
663b99950d ocaml: Make sure virt-resize, virt-sparsify are rebuilt if Guestfs API changes.
Add a dependency so these tools are rebuilt from scratch if the
Guestfs API changes.  This prevents the error:
"[...] make inconsistent assumptions over interface Guestfs".

This commit includes the generated changes to .depend files.
2011-10-25 14:16:47 +01:00
Richard W.M. Jones
51672634fd virt-filesystems: Add MBR partition type byte to the output.
This adds an extra column containing this information, looking
like this:

Name       Type        VFS   Label  MBR  Size  Parent
/dev/sda1  filesystem  ntfs  -      -    6.0G  -
/dev/sda1  partition   -     -      07   6.0G  /dev/sda
/dev/sda   device      -     -      -    6.0G  -

In particular you can use this to tell if a partition is an extended
partition, because the field will contain '05' or '0f'.
2011-10-25 14:02:46 +01:00
Richard W.M. Jones
47412f137f New API: part-to-partnum
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.
2011-10-25 12:46:05 +01:00
Richard W.M. Jones
1e891d9007 virt-cat: Handle Windows paths and drive letters (RHBZ#693359). 2011-10-25 10:55:20 +01:00
Richard W.M. Jones
639232f2b0 Version 1.13.24. 2011-10-24 17:36:07 +01:00
Richard W.M. Jones
3814680423 Add test for qemu broken -machine option (RHBZ#748266).
Also add this option, if necessary, when testing for virtio-serial
support.

When the workaround is enabled, we specify machine type 'pc'.
2011-10-24 15:47:57 +01:00
Richard W.M. Jones
35900223df Revert "out-of-tree build: daemon"
This reverts commit 025dba7f80.

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
2011-10-24 15:47:57 +01:00
Richard W.M. Jones
21a4cf7ef5 virt-win-reg: Document syntax for deleting keys and values (RHBZ#737944).
NB: This requires hivex >= 1.3.2 before this syntax becomes true.
2011-10-22 15:55:48 +01:00
Richard W.M. Jones
e192035bbd virt-make-fs: Refresh man page. 2011-10-22 07:29:39 +01:00
Richard W.M. Jones
c214cdc54e Fix ./configure --disable-erlang. 2011-10-21 17:31:10 +01:00
Hilko Bengen
e7ea6d06ab out-of-tree build: fixed bindtests and inspector 2011-10-21 16:42:06 +01:00
Hilko Bengen
aa67ea2b9b out-of-tree build: fix HAVE_OCAML=false case 2011-10-21 16:41:22 +01:00
Hilko Bengen
025dba7f80 out-of-tree build: daemon 2011-10-21 16:41:22 +01:00
Richard W.M. Jones
31bf0cf313 add-drive-opts: Correctly handle unreadable and unwritable files (RHBZ#747287). 2011-10-21 16:31:19 +01:00
Richard W.M. Jones
0c06d740b7 virt-make-fs: Set MBR partition type byte correctly (RHBZ#746295). 2011-10-21 16:02:34 +01:00
Richard W.M. Jones
527079aa0d lib: Common code for formatting the qemu -drive parameter.
This is just code refactoring.
2011-10-21 12:49:18 +01:00
Richard W.M. Jones
f5172902bc Allow compilation without hivex (RHBZ#723474). 2011-10-21 12:29:12 +01:00
Richard W.M. Jones
9a6e5369b2 po-docs: Force make update-po on first build from git. 2011-10-21 12:15:36 +01:00
Richard W.M. Jones
b148df4df9 Version 1.13.23. 2011-10-20 23:16:52 +01:00
Richard W.M. Jones
fef0ff3d86 appliance: udev-174 moves udevd to /lib/udev/udevd (instead of /sbin/udevd) 2011-10-20 23:16:52 +01:00
Richard W.M. Jones
2910413850 resize: Add --align-first auto|never|always option.
The first partition can now be aligned.  We fix the bootloader
correctly for Windows by adjusting the "Hidden Sectors" field.
2011-10-20 23:16:44 +01:00
Richard W.M. Jones
37cdd39ada resize: Add --alignment flag to allow partition alignment to be picked. 2011-10-20 16:49:15 +01:00
Richard W.M. Jones
5d8e4102b4 resize: Refactor the code for creating target partitions.
The old code mixed the business of planning the layout of the target
partitions with the creation of the target partitions.  The
replacement code separates these into two tasks: firstly we create a
new 'partitions' list with the target layout, secondly this directly
drives the creation of the partitions.

As part of this change I have *removed* the old code that was supposed
to handle extended/logical MBR partitions.  It simply didn't work, and
didn't have any hope of working, and there is a separate bug open to
fix it.
2011-10-20 16:48:30 +01:00
Richard W.M. Jones
9f19895604 resize: Remove p_size field from partitions structure.
This field simply contained a duplicate copy of p_part.part_size.

There is no functional change in this commit.
2011-10-20 14:53:13 +01:00
Richard W.M. Jones
040b6cb061 Update RELEASE-NOTES. 2011-10-20 10:58:21 +01:00
Richard W.M. Jones
41260de67f Version 1.13.22. 2011-10-19 17:37:25 +01:00
Richard W.M. Jones
f354f9b4fd Pushed and pulled latest translations from Transifex.
Fixed one bug in the nl PO file:

msgid "security: cached appliance %s is not owned by UID %d"
msgstr "beveiliging: UID %d is geen eigenaar van toepassing %s in cache"

should be:

msgid "security: cached appliance %s is not owned by UID %d"
msgstr "beveiliging: UID %2$d is geen eigenaar van toepassing %1$s in cache"
2011-10-19 17:32:14 +01:00
Richard W.M. Jones
c46bedf925 inspection: Return root devices sorted. 2011-10-19 16:27:38 +01:00
Matthew Booth
6aa3ece129 inspect: Handle cciss devices in /etc/fstab 2011-10-19 16:27:38 +01:00
Matthew Booth
f5c9f0e9ee inspect: Don't assume number of captures in match functions
It is possible for the pcre library to return a variable number of captures for
a single regular expression. e.g.:

  ^/dev/(cciss/c\d+d\d+)(?:p(\d+))?$

This will return either 1 or 2 captures depending on whether the device has a
partition suffix. The current match wrappers don't allow for this, and require
that a predictable number of matches are returned.

This change updates match, match1, match2, and match3 to ignore the specific
number of matches returned. Instead, any returned captures are assigned to the
given arguments, and any remaining arguments are set to NULL.
2011-10-19 16:27:38 +01:00
Matthew Booth
a1df33eac2 inspect: Add drive naming hints
We currently use a heuristic to guess how drive names we find
referenced in the guest map to drive names in the appliance. If this
heuristic fails it can cause inspection to fail.

This change adds a new 'name' option to add_drive_opts, which allows
the user to explicitly pass the name of a drive to libguestfs if it is
known. This change also updates the fstab-parsing inspection code to
use this information if it is available.
2011-10-19 16:27:38 +01:00
Matthew Booth
1f615fddaf NFC: Remove unnecessary goto 2011-10-19 16:27:38 +01:00
Matthew Booth
f1041e912b launch: Store drive information in guestfs_h
This is a NFC on its own, but provides a place-holder for drive metadata which
can be used after launch.

Fixes by RWMJ:

 - Fix the tests: this requires a new internal function 'debug-drives'
   that dumps out the g->drives information so it can be checked in
   two of the tests.  Previously these tests used 'debug-cmdline'.

 - Test file existence / use_cache_off in the add_drive_opts function,
   not when launching qemu in the child process.

 - Call free along error paths.

 - Add comments.
2011-10-19 16:26:42 +01:00
Matthew Booth
472f02d08b inspect: Fix fstab device mapping for >26 disks
The regular expression matching disk name assumed that there was only a single
letter suffix. This change handles a naming scheme for any number of disks.
2011-10-19 16:26:42 +01:00
Richard W.M. Jones
138e118d62 launch: Ensure g->cmdline is allocated before assigning g->cmdline[0]. 2011-10-19 16:26:39 +01:00
Richard W.M. Jones
2f6ec8b4da valgrind: guestfish -i: free strings before exit.
This isn't really necessary, but it keeps valgrind happy.
2011-10-19 14:05:21 +01:00
Richard W.M. Jones
6d7d645cdd Ubuntu 11.10: Create /run and /run/lock if not already.
In real machines these directories are a ramdisk.
2011-10-18 15:22:04 +01:00
Richard W.M. Jones
b288a1b971 virt-sysprep: Fix link in documentation. 2011-10-17 15:26:43 +01:00
Richard W.M. Jones
cf4cc11433 Skip guestmount and virt-sysprep tests if no /dev/fuse. 2011-10-17 09:59:43 +01:00
Richard W.M. Jones
8cf06ddcdd virt-sysprep: Fix test to use guestmount and virt-inspector binaries that have been built. 2011-10-15 17:51:16 +01:00
Richard W.M. Jones
af0c123be8 appliance: Fedora cryptsetup-luks renamed to cryptsetup.
Therefore we need both names to be listed in the file.
2011-10-14 22:08:20 +01:00
Richard W.M. Jones
db499d98e7 roadmap: Fix Bugzilla URL. 2011-10-14 22:08:14 +01:00
Richard W.M. Jones
bd1cc12731 More TODO items. 2011-10-14 18:22:46 +01:00
Richard W.M. Jones
8b2ebe07c2 Update RELEASE-NOTES file. 2011-10-14 18:14:59 +01:00
Richard W.M. Jones
782a2e0299 Version 1.13.21. 2011-10-14 15:14:57 +01:00
Erik Nolte
91730ce7fa Use ArchLinux's new kernel package "linux". 2011-10-14 11:08:44 +01:00
Michael Scherer
f25d2300ce Add basic support for netbsd detection. 2011-10-14 10:35:17 +01:00
Michael Scherer
8f6eed00da Add support for pkgsrc, default NetBSD package manager.
For now, only detect the tool, but support from reading
installed package could be added later ( may require either
a package of pkgsrc, or a smaller tool to read the db ).
2011-10-14 10:27:48 +01:00
Michael Scherer
05a8359c7c Add support for mounting ufs from NetBSD, and fix FreeBSD detection on Fedora 16
While testing on Fedora 16, I noticed that Linux will mount the disk
without trouble by using automatically ufstype=old, and yet do not
let us read the directories. So we should start directly with usftype=ufs2,
and if it fail, try 44bsd, as used for netbsd and openbsd ( as seen on
http://wiki-static.aydogan.net/How_to_mount_FFS_partition_under_Linux ).
2011-10-14 10:26:16 +01:00
Michael Scherer
15d79b5ea9 Add the Opensuse logo ( thanks to Vincent Untz )
Like Ubuntu one, it may not be always present.
2011-10-14 10:01:49 +01:00
Michael Scherer
5332515db3 Add Opensuse and zypper detection support
This would also erronously detect SLES as Opensuse.
2011-10-14 10:01:44 +01:00
Michael Scherer
1d0683964f Add support for Ubuntu logo
Ths logo is present on Lucid Lynx, but may not always be installed, like
in case of a minimal installation ( or server ). While Edubuntu and Kubuntu
have different logo, I didn't check where it would be placed.
2011-10-14 10:01:43 +01:00
Michael Scherer
7d4a99db87 Detect Mageia distribution 2011-10-14 10:01:40 +01:00
Michael Scherer
787baf1bad Partially fix --disable-erlang
Without this, configure will always enable erlang, no matter what
argument are passed. Now, we can disable it, even if configure still
need the erlang compiler for some obscure reason.
2011-10-14 09:50:39 +01:00
Richard W.M. Jones
c019d073a4 virt-sysprep: Add cron-spool, mail-spool, utmp. 2011-10-14 08:36:00 +01:00
Richard W.M. Jones
05c26a9c09 virt-sysprep: Use /dev/urandom instead of /dev/random. 2011-10-13 23:30:13 +01:00
Richard W.M. Jones
248465a620 virt-sysprep: More clarifications to the man page. 2011-10-13 23:29:58 +01:00
Richard W.M. Jones
42f3abe42d virt-sysprep: Clarify docs on enabling operations. 2011-10-13 23:24:28 +01:00
Richard W.M. Jones
dd73c50dc5 virt-sysprep: Add rhn-systemid. 2011-10-13 23:21:12 +01:00
Richard W.M. Jones
9e382f1ae3 virt-sysprep: Switch to using guestmount, add more features.
This switches virt-sysprep to use guestmount instead of guestfish.
This makes the script a little bit easier to modify for sysadmins.

This commit also adds:

 - dhcp-client-state
 - dhcp-server-state
 - logfiles
 - random-seed
 - smolt-uuid
 - yum-uuid

SELinux relabelling, and a section on security in the manual page.
2011-10-13 22:36:56 +01:00
Richard W.M. Jones
189c3d6ac1 virt-sysprep: Use Augeas for config file manipulation. 2011-10-13 15:25:13 +01:00
Richard W.M. Jones
17b26be232 virt-sysprep: Add prepend_line utility function. 2011-10-13 15:25:13 +01:00
Richard W.M. Jones
11be7d8eee fish: docs: note how to clean up the remote process properly.
Killing it is always a bad idea, because the qemu subprocess will be
left hanging around.  The best thing is to send the exit command.

This also makes the change to virt-sysprep.
2011-10-13 15:25:13 +01:00
Richard W.M. Jones
baa1618e0f fish: Close guestfs handle explicitly before exiting.
NOTE this is just a cleanup.  It is NOT necessary for correctness,
since libguestfs itself is correctly closing the handle in the exit
handler.
2011-10-13 15:25:13 +01:00
Richard W.M. Jones
049116e181 virt-sysprep: Trap ERR as well as EXIT. 2011-10-13 15:25:13 +01:00
Richard W.M. Jones
e57c3c37a8 guestmount: Add note to man page about 'fuse' group for Debian. 2011-10-13 15:25:13 +01:00
Richard W.M. Jones
f6db819081 virt-sysprep: Simplify calls to guestfish --remote. 2011-10-13 15:25:12 +01:00
Richard W.M. Jones
2135ec267e virt-sysprep: Further TODO items (thanks Nikita Menkovich). 2011-10-13 15:25:06 +01:00
Richard W.M. Jones
a78a3dea88 virt-sysprep: Further TODO items (thanks Marko Myllynen, James Antill). 2011-10-13 10:36:24 +01:00
Richard W.M. Jones
0beebeb622 Version 1.13.20. 2011-10-11 20:59:29 +01:00
Richard W.M. Jones
fe31f1897b virt-sysprep: Update TODO list again. 2011-10-11 19:20:53 +01:00
Richard W.M. Jones
92dc3748b6 virt-sysprep: Update TODO list (thanks Steve Grubb, Dan Berrange). 2011-10-11 18:04:46 +01:00
Richard W.M. Jones
e6ed656c98 TODO: More virt-sysprep suggestions (thanks librarian). 2011-10-10 15:13:40 +01:00
Richard W.M. Jones
c155330f04 Add systemtap/DTrace probes.
Mainly this is a documentation change.  However a sample of
DTrace-compatible userspace probes are also added.
2011-10-10 13:26:15 +01:00
Richard W.M. Jones
d6622d7636 Update TODO file with future plans for virt-sysprep. 2011-10-10 09:51:03 +01:00
Richard W.M. Jones
c49819f9b3 Version 1.13.19. 2011-10-08 13:59:13 +01:00
Richard W.M. Jones
1e35941f62 New tool: virt-sysprep: system preparation for guests. 2011-10-08 13:38:30 +01:00
Richard W.M. Jones
3a54666365 fish: Add man page section on calling guestfish remote robustly from bash. 2011-10-07 19:20:36 +01:00
Richard W.M. Jones
df711241ff virt-alignment-scan: Fix SYNOPSIS in manual page. 2011-10-07 13:52:39 +01:00
Richard W.M. Jones
c6be95453d Makefile.am: Fix comment. 2011-10-07 13:42:27 +01:00
Richard W.M. Jones
ffe0e11b4d virt-alignment-scan: docs: Add link to RHEL Storage Administration Guide. 2011-10-06 17:37:01 +01:00
Richard W.M. Jones
8daa036857 virt-alignment-scan: More information in man page.
Thanks Mike Snitzer.
2011-10-06 10:36:24 +01:00
Richard W.M. Jones
74e4e86309 virt-resize: Align partitions to multiple of 128 sectors (instead of 64).
This gives us effectively 64 KByte alignment, optimal for all current
types of storage.
2011-10-06 10:22:16 +01:00
Richard W.M. Jones
36d8bbb858 Update RELEASE-NOTES file. 2011-10-05 19:12:34 +01:00
Richard W.M. Jones
e59e35708b Version 1.13.18. 2011-10-05 18:13:38 +01:00
Richard W.M. Jones
b4bb49ffd1 New tool: virt-alignment-scan to check alignment of partitions. 2011-10-05 18:13:29 +01:00
Richard W.M. Jones
f3341222b3 docs: Add directory sections for resize/ and sparsify/ 2011-10-05 14:38:07 +01:00
Richard W.M. Jones
ca8c2b5996 Update RELEASE-NOTES file. 2011-10-04 22:42:42 +01:00
Richard W.M. Jones
b0605f265b sparsify: Fix --ignore option to work on canonical device names. 2011-10-04 20:00:42 +01:00
Richard W.M. Jones
b3f61a9db3 docs: Clearer language in virt-sparsify man page. 2011-10-04 20:00:21 +01:00
Richard W.M. Jones
4abb239dcc Version 1.13.17. 2011-10-04 19:24:42 +01:00
Richard W.M. Jones
fac15924f5 New tool: virt-sparsify to make disk images sparse. 2011-10-04 17:37:48 +01:00
Richard W.M. Jones
293772bf75 docs: Add virt-resize to list of links in guestfs(3). 2011-10-04 10:58:25 +01:00
Richard W.M. Jones
b39b3c5c74 docs: virt-win-reg is written in Perl, not virt-resize. 2011-10-04 10:58:02 +01:00
Richard W.M. Jones
b57fcc5064 Update API support documentation. 2011-10-04 10:57:05 +01:00
Richard W.M. Jones
2628fa96d8 Version 1.13.16. 2011-10-01 14:35:05 +01:00
Richard W.M. Jones
b1f7b5f911 mount: Not deprecated any more.
This updates commit 5c2f1a2d94.
2011-10-01 10:42:05 +01:00
Richard W.M. Jones
5c2f1a2d94 mount: No longer implicitly add -o sync,noatime options. 2011-10-01 08:20:50 +01:00
Richard W.M. Jones
4e9ed01847 daemon: mkswap --help output changed, breaking linuxfsuuid group detection. 2011-09-29 16:08:20 +01:00
Richard W.M. Jones
d020350c31 Version 1.13.15. 2011-09-28 22:13:27 +01:00
Richard W.M. Jones
04fbcc63eb New API: set-smp, get-smp
These calls allow you to change the number of virtual CPUs assigned to
the appliance.

This also adds a --smp option to virt-rescue.
2011-09-28 14:52:56 +01:00
Richard W.M. Jones
8403f5a9d8 New APIs: compress-out, compress-device-out.
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)
2011-09-28 14:52:56 +01:00
Richard W.M. Jones
ffc01285ee daemon: Move useful is_zero function to header file.
Code motion.
2011-09-28 14:52:56 +01:00
Richard W.M. Jones
322106521f Add no_timer_check to disable faulty test during boot (RHBZ#502058).
See:

https://bugzilla.redhat.com/show_bug.cgi?id=502058#c15
https://bugzilla.redhat.com/show_bug.cgi?id=698842#c8

This updates commit 79e66f89e2.
2011-09-26 13:35:24 +01:00
Richard W.M. Jones
3c7b3634b2 docs: Show how to use a qemu wrapper to edit the qemu command line. 2011-09-26 09:58:46 +01:00
Richard W.M. Jones
67030c6ef2 Version 1.13.14. 2011-09-24 22:32:46 +01:00
Richard W.M. Jones
aa88c1bbd2 Update to latest gnulib. 2011-09-24 19:06:23 +01:00
Richard W.M. Jones
fa13b2838f erlang: Use the official autoconf macros. 2011-09-22 14:41:46 +01:00
Richard W.M. Jones
8324d2fcf0 todo: Suggestion to improve Erlang bindings. 2011-09-21 22:28:11 +01:00
Richard W.M. Jones
79e66f89e2 Enable APIC.
Originally this was disabled to work around RHBZ#502058.  That bug was
never officially fixed, but it may have fixed itself.

In the meantime, KVM has broken ordinary PIC support (RHBZ#723822).
Since APIC is the most common way that regular Linux and Windows
guests run it makes sense to remove this hack.
2011-09-21 19:31:10 +01:00
Richard W.M. Jones
660daf31e2 Version 1.13.13. 2011-09-21 15:22:02 +01:00
Richard W.M. Jones
84763d7fca Add Erlang bindings. 2011-09-21 15:21:58 +01:00
Richard W.M. Jones
917f947590 inspection: Handle /dev/root in /etc/fstab.
This means "the device that holds /etc/fstab", so map it correctly.

This fixes support for ttylinux and also some other guests that use
/dev/root instead of a real device name.
2011-09-16 15:26:20 +01:00
Richard W.M. Jones
b648b1813f inspection: Add support for ttylinux (a minimal Linux). 2011-09-16 15:21:26 +01:00
Richard W.M. Jones
99624d2922 Add an optional group ("grub") for the guestfs_grub_install API.
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.
2011-09-15 22:02:43 +01:00
Richard W.M. Jones
8d8ace19da Version 1.13.12. 2011-09-14 18:56:38 +01:00
Richard Jones
bddde7799b test-tool: Display TMPDIR. 2011-09-14 13:52:39 +01:00
Richard Jones
cda7fa973c test-tool: Refresh libguestfs-test-tool man page. 2011-09-14 13:19:11 +01:00
Richard Jones
912284b02e test-tool: Make the default timeout be 600 seconds (10 minutes).
We could sometimes hit the 120 second timeout, eg. if the appliance
needed to be rebuilt and the machine was very slow and/or under heavy
I/O load.  10 minutes should be enough for any reasonable situation.
2011-09-14 13:00:34 +01:00
Richard Jones
95136b1492 test-tool: Document the -t command line option. 2011-09-14 12:58:43 +01:00
Richard Jones
c7b88da039 test-tool: Use B<...> for command line options in man page. 2011-09-14 12:58:30 +01:00
Richard Jones
7c521c7211 po-docs: Make podfiles sort stable. 2011-09-12 11:36:00 +01:00
Richard Jones
cbef2ffb04 Stable OCaml dependencies. 2011-09-12 11:33:19 +01:00
Richard W.M. Jones
b3f1457fdd docs: Add a section explaining the appliance boot process. 2011-09-07 15:21:37 +01:00
Richard W.M. Jones
504b9d95c4 Version 1.13.11. 2011-09-01 14:55:18 +01:00
Richard W.M. Jones
8ab2b85b2a Remove old regression test that mainly tested a buggy API.
The guestfs_ll command currently lists files in the appliance if you
prefix filenames with "/..".  However this is a bug, not a feature,
and we should not be testing it.
2011-09-01 13:38:53 +01:00
Richard W.M. Jones
8928de32d3 debian: Missing build dependency on db4.8-util. 2011-09-01 13:15:22 +01:00
Richard W.M. Jones
73be6db9bf daemon: Factor out name of virtio serial channel.
This is just code motion.
2011-09-01 13:00:25 +01:00
Richard W.M. Jones
5b012024c4 Create /sys directory if it doesn't exist already.
Ubuntu 10.04 LTS packages don't create /sys.
2011-09-01 13:00:24 +01:00
Richard W.M. Jones
eb209a3664 Version 1.13.10. 2011-08-28 17:58:34 +01:00
Richard W.M. Jones
085a566906 cat: Small documentation correction. 2011-08-28 17:35:34 +01:00
Richard W.M. Jones
baefb8225c inspector: Use xmlstarlet instead of xpath in examples. 2011-08-27 17:53:03 +01:00
Richard W.M. Jones
f0f3e16211 man pages: Add a standard EXIT STATUS section to most pages. 2011-08-27 17:47:10 +01:00
Richard W.M. Jones
69abc787dd Version 1.13.9. 2011-08-26 22:55:09 +01:00
Richard W.M. Jones
ceb3a57f67 progress: Make default UTF-8 progress bar less black. 2011-08-26 22:40:27 +01:00
Richard W.M. Jones
09a7545649 resize: Add --machine-readable option for machine friendly output. 2011-08-26 22:34:49 +01:00
Richard W.M. Jones
75005e48bb progress: Add machine readable flag.
Machine-readable progress bars look like:

0/100
1/100
2/100
2011-08-26 22:03:47 +01:00
Richard W.M. Jones
2faef37957 resize: Use guestfish progress bar mini-library.
There are two benefits:

 - the progress bars look better
 - there is a reasonably accurate estimate of how long each operation
   will take
2011-08-26 21:55:04 +01:00
Richard W.M. Jones
9420eaf44e Add GUESTFS_EVENT_ENTER event.
This event is generated whenever a libguestfs function is called.
2011-08-26 21:55:03 +01:00
Richard W.M. Jones
6146412f06 fish: Make progress bars into a mini library.
This library could now be called from other virt tools.
2011-08-26 21:54:59 +01:00
Richard W.M. Jones
0bd055316f fish: clarify comment: shared source files are used by virt tools too. 2011-08-26 17:39:06 +01:00
Richard W.M. Jones
d64ad1a403 Version 1.13.8. 2011-08-26 11:54:05 +01:00
Richard W.M. Jones
1a4f1df77e ruby: Check Ruby callback exists before we call it (RHBZ#733297). 2011-08-26 10:56:48 +01:00
Richard W.M. Jones
675f336319 ruby: Use a regular C array to pass the arguments through rb_rescue. 2011-08-25 13:25:07 +01:00
Richard W.M. Jones
0cd5b9ac15 ruby: Append newline character after printing exception in callback. 2011-08-25 13:11:28 +01:00
Hilko Bengen
54911bdd32 python: Newer versions want parentheses around arguments of "print" 2011-08-24 12:56:45 +01:00
Hilko Bengen
d36504e1bb python: Don't build static library 2011-08-24 12:56:45 +01:00
Richard W.M. Jones
4e196ad9a3 Version 1.13.7. 2011-08-23 20:36:52 +01:00
Richard W.M. Jones
4fb3b23fb6 php: Fix bug in PHP tests.
We partitioned the disk, and then tried to create a PV on the whole
disk.  LVM gave the error:

  Device /dev/vda not found (or ignored by filtering).

It is unclear how this bug persisted for so long.  It might be due to
a change in LVM.
2011-08-23 20:21:32 +01:00
Richard W.M. Jones
ce18be33cd Coverity: fix memory leak along error path. 2011-08-23 19:50:11 +01:00
Richard W.M. Jones
a31ac8fc32 Coverity: Initialize msg buffer.
msg_flags was not being initialized and would have been passed to
sendmsg with a random value.
2011-08-23 19:29:46 +01:00
Richard W.M. Jones
c38cb92ec4 Coverity: fix memory leak in guestfish. 2011-08-23 19:26:35 +01:00
Richard W.M. Jones
b2edcbe1b9 Coverity: in daemon, free struct in RStruct, RStructList functions. 2011-08-23 19:19:13 +01:00
Richard W.M. Jones
631faad971 pclose: Fix other places where we only tested pclose == -1.
pclose can return > 0 when the status of the command was non-zero.
2011-08-23 18:56:12 +01:00
Richard W.M. Jones
f159619113 test_qemu: Improve the error message.
Note that errno is probably not set to a useful value here, so there
is not much point recording it.
2011-08-23 18:53:48 +01:00
Richard W.M. Jones
a24652c7b2 test_qemu: pclose may return any != 0 on error.
In particular pclose returns a status > 0 if the command fails.
2011-08-23 18:53:00 +01:00
Richard W.M. Jones
2ace9be4cd qemu detection: Free up previous qemu help/version strings if they exist. 2011-08-23 18:43:24 +01:00
Richard W.M. Jones
08e77ad8cb Coverity: test_qemu: Ensure FILE * is not leaked along error paths.
This refactors the code in test_qemu slightly to ensure that
FILE *fp is not leaked on error paths.
2011-08-23 18:03:23 +01:00
Richard W.M. Jones
fa44536b0f Coverity: Check guestfs_inspect_get_product_name() != NULL before using. 2011-08-23 16:47:18 +01:00
Richard W.M. Jones
00fef9eed6 rescue: Ignore errno after guestfs_launch.
errno is pretty much random on the error path back from guestfs_launch
so there is nothing useful to be gained by checking it.

We could do with a better way to detect if appliance launch failed.
2011-08-23 16:41:07 +01:00
Richard W.M. Jones
9bab154d48 Coverity: Ignore return value from guestfs_launch in virt-rescue.
We expect guestfs_launch to fail in this program.
2011-08-23 16:34:06 +01:00
Richard W.M. Jones
4c76aaa391 Coverity: Check return value from sscanf in bindtests calls. 2011-08-23 16:12:27 +01:00
Richard W.M. Jones
ca727deac1 autobuild: Only add last 100 lines of the log file. 2011-08-20 11:41:51 +01:00
Richard W.M. Jones
6375aede61 New autobuild script.
Remove the old top-level autobuild.sh that confused a lot
of people.

Add an autobuild.sh script that builds from the latest tarball.
2011-08-20 10:49:35 +01:00
Richard W.M. Jones
a4db75521d configure: Add --with-extra flag to allow setting the extra version string.
Intended use in Fedora and RHEL is to encode the release
string, eg.

  ./configure [...] --with-extra="-%{release}"
2011-08-19 21:48:44 +01:00
Richard W.M. Jones
7a5f7311d4 Version 1.13.6. 2011-08-19 10:38:30 +01:00
Richard W.M. Jones
e4cba8f2b1 protocol: Fix case where download can fail for small files.
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.
2011-08-18 20:02:30 +01:00
Richard W.M. Jones
06019bc82e Escape special/non-printing characters in debug output (RHBZ#731744).
The default event handler in libguestfs was simply writing all debug
output directly to stderr.  However if the output contains
non-printable characters such as terminal control codes then these
would also be sent directly.

With newer SeaBIOS there is a lame attempt to implement a splash
screen using terminal control codes, thus when libguestfs tries to
display debugging output it would cause the screen to clear and debug
output to be lost.

This commit causes all non-printing characters to be escaped.
(\n and \r characters from the appliance are treated somewhat
specially).

Furthermore, instead of using write(2), use buffered stderr calls.
2011-08-18 18:03:41 +01:00
Richard W.M. Jones
635af5be04 Remove guestfs___print_timestamped_argv.
This function was used to print the qemu and
febootstrap-supermin-helper command lines.

Unfortunately in the qemu case it was used incorrectly: it called the
internal debug function (ie. event API callback) from the forked qemu
subprocess, which meant that higher level event callbacks might have
been invoked from the child process.

To fix this, convert the qemu case into a new function called
print_qemu_command line which just prints the command line directly to
stderr.  This is called after stderr has been redirected into the pipe
to the main process.  Thus the qemu command line will be marshalled
into the event API along with other qemu and appliance output.

After fixing this, only one use of guestfs___print_timestamped_argv
remained, for printing the febootstrap-supermin-helper command line.
This is converted to a local function print_febootstrap_command_line.

Also print_febootstrap_command_line is now called before we fork
febootstrap-supermin-helper, so that messages no longer overlap.
2011-08-18 18:02:56 +01:00
Hilko Bengen
70c033998e out-of-tree build: generate ./run from template, fix image checks
./run can now be run in a separate build directory. Since some files
needed in the image checks are found in the source tree (but not the
build tree), the source tree location is passed to make-*-img.sh via
an environment variable.
2011-08-18 09:55:52 +01:00
Richard W.M. Jones
5d296dfd60 Version 1.13.5 2011-08-17 12:42:17 +01:00
Richard W.M. Jones
85efbc6aa7 fish: Add fish-cmds.h to generator_built.
This updates commit 3064277680.
2011-08-17 12:42:16 +01:00
Hilko Bengen
0938e43a60 out-of-tree build: fix make and make install
$(srcdir) is not needed for guestfs_c.c.
*.mli only exists in $(srcdir) and isn't found on "make install" otherwise
2011-08-17 10:27:29 +01:00
Hilko Bengen
8876b2d376 out-of-tree build: fix documentation generation II 2011-08-17 10:27:29 +01:00
Hilko Bengen
4baec012b1 out-of-tree build: remove unneeded explicit paths 2011-08-17 10:27:29 +01:00
Richard W.M. Jones
5a50c04906 Improve zeroing and detection of zeroes.
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)
2011-08-16 13:25:20 +01:00
Richard W.M. Jones
1fdd0193fd recipes: Remove two C file dependencies which are not actually used in the POD. 2011-08-15 14:55:10 +01:00
Hilko Bengen
0241c75393 out-of-tree build: fix building library 2011-08-15 14:50:33 +01:00
Hilko Bengen
900c9626b9 out-of-tree build: Fix up OCaml bindings and generator 2011-08-15 14:50:33 +01:00
Hilko Bengen
36e0f35a58 out-of-tree build: fix appliance 2011-08-15 14:50:33 +01:00
Hilko Bengen
ff101adf7e out-of-tree build: fix documentation generation 2011-08-15 14:50:33 +01:00
Richard W.M. Jones
44c3a30026 ruby: Fix typo in Ruby bindings file. 2011-08-14 22:07:54 +01:00
Richard W.M. Jones
7739d7f471 Note that additional memory may be required to typecheck Augeas lenses (RHBZ#729887). 2011-08-12 11:17:16 +01:00
Richard W.M. Jones
6cabc1cd02 fish: Document that remote run in cmd substitution context hangs.
This documents bug 592910.
2011-08-12 11:08:57 +01:00
Richard W.M. Jones
2ecaa1f82d Version 1.13.4. 2011-08-11 22:52:06 +01:00
Richard W.M. Jones
b983800101 Fix 'unknown filesystem' warnings in old inspection code (RHBZ#678231 RHBZ#666578).
This is a comprehensive fix for the warnings from the old (and
obsolete) Perl inspection code.  For a full description and
reproducer, see:

https://bugzilla.redhat.com/show_bug.cgi?id=678231#c5
2011-08-11 11:45:25 +01:00
Richard W.M. Jones
2c57305f72 inspection: Better checking for Windows root disks (RHBZ#729075).
Previously any disk that had /autoexec.bat or /boot.ini or /ntldr
would be picked up as a candidate for a Windows root disk.  If further
checking could not find any systemroot (eg. /windows) then this would
result in complete failure of inspection.

In particular, this got confused by Hp_recovery partitions which have
/autoexec.bat, but don't have a systemroot in one of the usual places
(they have /MiniNT instead).

What we do now is to properly investigate all possible systemroot
places before deciding this is a Windows systemroot, so the subsequent
failure cannot occur.

(Thanks to lorimar for reporting this bug).
2011-08-08 18:52:23 +01:00
Richard W.M. Jones
f7d18c84dd build: Set TMPDIR for local testing.
This avoids conflicts with the globally installed libguestfs
appliance, or lets us build in multiple local directories at the same
time without conflicts.
2011-08-08 12:41:54 +01:00
Richard W.M. Jones
54ea124b16 Version 1.13.3. 2011-08-07 23:18:45 +01:00
Richard W.M. Jones
f133f1bb9d daemon: Don't include .gitignore in EXTRA_DIST.
This updates commit 60d5a50f4d.
2011-08-07 23:10:50 +01:00
Richard W.M. Jones
23793d7680 fish: Add setenv and unsetenv commands.
These commands allow you to manipulate the environment within
guestfish.
2011-08-07 21:05:13 +01:00
Richard W.M. Jones
3064277680 fish: Declare run_* functions in a generated header file.
Calls to these functions are generated, so there is no need to declare
the functions by hand.
2011-08-07 21:04:00 +01:00
Richard W.M. Jones
18ee38e1ea docs: Move deprecation notice up to the top in C man page. 2011-08-06 16:04:36 +01:00
Richard W.M. Jones
f351a144d7 docs: Emphasize deprecation notice in man pages. 2011-08-06 16:00:01 +01:00
Richard W.M. Jones
60adf092a8 docs: Fix function names in deprecation notices. 2011-08-06 15:57:21 +01:00
Richard W.M. Jones
70f44cc0ea docs: guestfs_set_out_of_memory_handler returns void, not int.
It always has done.  The documentation was wrong.
2011-08-06 15:53:15 +01:00
Richard W.M. Jones
1bf3941b9c docs: Clarify error handler example. 2011-08-06 15:49:55 +01:00
Richard W.M. Jones
4bd1a5060b fish: Fix regression tests for new guestfish line numbers.
This updates commit 319e946b92.
2011-08-05 16:39:43 +01:00
Richard W.M. Jones
319e946b92 fish: Print input file and line number in error messages.
eg:
*stdin*:37: libguestfs: error: luks_close: Device lukstest is busy.
2011-08-05 15:08:44 +01:00
Richard W.M. Jones
75cc0fc72c gnulib: Add all other libs when linking libguestfs.so.
This updates the previous two commits.
2011-08-05 14:03:18 +01:00
Richard W.M. Jones
f45b40029d gnulib: Add $(LIB_CLOCK_GETTIME) when linking libguestfs.so.
We don't use this library (it is only used in the daemon),
but we need to add this to make the linker happy.
2011-08-05 13:52:42 +01:00
Richard W.M. Jones
60d5a50f4d daemon: Remove separate configure of daemon subdirectory.
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.
2011-08-05 12:34:11 +01:00
Richard W.M. Jones
0d13b05263 Update TODO. 2011-08-05 12:34:11 +01:00
Richard W.M. Jones
6a98ed953b debian: bash is required to run libtool replacement script.
This was failing on Debian where $(SHELL) is the minimal dash shell.
2011-08-05 10:49:45 +01:00
Richard W.M. Jones
e1c6d1738a configure: Fix info about virt-resize when OCaml bindings are disabled. 2011-08-05 10:31:03 +01:00
Richard W.M. Jones
36f662c58f python: Don't name extension with .so.0.0 and symlinks (thanks Dan Berrange). 2011-08-05 10:18:02 +01:00
Richard W.M. Jones
c515cbdf31 Version 1.13.2. 2011-08-02 12:30:32 +01:00
Richard W.M. Jones
d7356a2801 Add regression test to catch missing libraries in the appliance.
Related to RHBZ#727178.
2011-08-02 11:04:13 +01:00
Richard W.M. Jones
5f9c168d91 debian: Add gawk to packagelist.
It's already included, but implicitly.
2011-08-02 11:04:13 +01:00
Richard W.M. Jones
995b3fecb9 virt-tar test: Stable ordering of test output.
The files could be listed in any order, resulting in the test failing
for no reason.  Sort the output of tar.
2011-08-01 15:13:08 +01:00
Richard W.M. Jones
3cf31c2fe0 Change link, since PostgreSQL switched to using git. 2011-08-01 10:35:24 +01:00
Richard W.M. Jones
1d134301fc debian: Build libguestfs-ocaml and libguestfs-ocaml-dev subpackages. 2011-07-31 21:04:48 +01:00
Richard W.M. Jones
bad3f4b54a Don't fail if HOSTNAME field is missing on Red Hat guests (RHBZ#726739). 2011-07-29 17:38:43 +01:00
Richard W.M. Jones
c70532ab4b perl: Fix another place where qw() was used as parentheses.
This is a fix for Perl 5.14.

See previous commit 5c3c7e8825.
2011-07-27 15:43:12 +01:00
Richard W.M. Jones
2b8b3f9794 ocaml: Fix locking in event callbacks.
We weren't acquiring the GC lock around some allocations, resulting in
segfaults when an event callback ran at the same time as a main thread
allocation or garbage collection.

In particular this fixes a noticable crash in guestfs-browser.
2011-07-26 18:58:27 +01:00
Richard W.M. Jones
b5bdd0f800 Version 1.13.1. 2011-07-26 14:17:19 +01:00
Richard W.M. Jones
01f6bce19d virt-df: Re-add documentation for --csv option.
The documentation for the --csv option disappeared between 1.6 and 1.8
when we rewrote virt-df in C.  Re-add it from 1.6 sources.
2011-07-26 12:48:59 +01:00
Richard W.M. Jones
15289d4b72 test-tool: Print FEBOOTSTRAP_* environment variables (RHBZ#671082). 2011-07-26 12:48:59 +01:00
Richard W.M. Jones
deb95471fb test-tool: Display state of pgroup flag from the handle.
This updates commit f173543fd2.
2011-07-26 12:48:59 +01:00
Richard W.M. Jones
5d7dc0dfb6 launch: Add qemu_supports_re function.
This function is like qemu_supports, but allows us to grep
the help text using regular expressions.

Note the function is not used yet.
2011-07-26 12:48:49 +01:00
Richard W.M. Jones
41cd0e302d Require PCRE library.
This library is widely available in distros.
2011-07-25 11:13:21 +01:00
Richard W.M. Jones
316817b5ad docs: Document FEBOOTSTRAP_KERNEL, FEBOOTSTRAP_MODULES (RHBZ#671082). 2011-07-22 16:17:06 +01:00
Richard W.M. Jones
8386a57458 perl: Fix CCFLAGS for Perl 5.14.
A change to ExtUtils::CBuilder in Perl 5.14 causes CCFLAGS to
completely replace, rather than appending, the C flags.

The unfortunate consequence of this is that vital flags such as
-D_FILE_OFFSET_BITS=64 are missing.  For 32 bit code, this means you
get binary-incompatible code that completely fails to load.

For further analysis see:

http://www.nntp.perl.org/group/perl.perl5.porters/2011/04/msg171535.html

This commit changes CCFLAGS so that it appends to the existing
$Config{ccflags} instead of replacing it.  On earlier versions of Perl
this means we get two copies of the flags, which is unfortunate but
should be safe.
2011-07-22 11:12:52 +01:00
Richard W.M. Jones
71eb0bf456 build: Redirect ./configure errors in general to config.log. 2011-07-21 17:59:34 +01:00
Richard W.M. Jones
610642491a build: Send failed Perl test configure output to config.log. 2011-07-21 17:00:48 +01:00
Richard W.M. Jones
806b6e0150 build: Allow 'make quickcheck' test-tool args to be overridden.
A typical use for this is for packagers who want to increase
the default timeout:

  make quickcheck QUICKCHECK_TEST_TOOL_ARGS="-t 300"
2011-07-21 10:50:40 +01:00
Richard W.M. Jones
43ab6dfdf3 Update version number to 1.13.0.
There is no build or tarball for this, since it is identical
to 1.12.0.
2011-07-20 18:28:07 +01:00
Richard W.M. Jones
0b7de697a4 Version 1.12.0. 2011-07-20 17:33:11 +01:00
Richard W.M. Jones
02f3b53863 Finalize release notes for 1.12 release. 2011-07-20 16:37:19 +01:00
Richard W.M. Jones
1d0f398d8e blkid: Use -c /dev/null option to kill the cache.
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.
2011-07-20 15:58:38 +01:00
Richard W.M. Jones
168fd4ad5d blkid: Detect when value not found and return empty string.
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.
2011-07-20 15:57:56 +01:00
Richard W.M. Jones
764e4e2aa2 docs: Update stable release instructions. 2011-07-20 13:49:16 +01:00
Richard W.M. Jones
422678073b configure: Remove -Wmissing-noreturn warning. 2011-07-20 13:33:47 +01:00
Richard W.M. Jones
408f07ed3c po-docs: Fix generation of 'podfiles'. 2011-07-20 13:20:10 +01:00
Richard W.M. Jones
8b2e60ce4b appliance: Capture stderr from qemu to the event system. 2011-07-20 12:08:40 +01:00
Richard W.M. Jones
70daccfe4e appliance: Document pipe fds. 2011-07-20 12:05:40 +01:00
Richard W.M. Jones
5dec784265 Partially revert d82438431c.
It appears qemu-kvm does *not* require -machine accel=tcg option.
That problem disappeared after upgrading seabios(!)  However leave the
test for qemu -help option, since that's useful to determine if qemu
is completely broken or not.
2011-07-20 11:45:02 +01:00
Richard W.M. Jones
d82438431c build: Fix virtio-serial test for qemu 0.15.
Now qemu 0.15 won't even start up unless the -machine accel=... option
is specified.  Essentially this is a regression in qemu.
2011-07-19 19:55:24 +01:00
Richard W.M. Jones
a6f99dd932 Version 1.11.20. 2011-07-19 19:07:50 +01:00
Richard W.M. Jones
1c0f75c806 Update release notes. 2011-07-19 17:56:14 +01:00
Richard W.M. Jones
d025e91f67 java: Add guestfs-java(3) man page. 2011-07-19 17:54:35 +01:00
Richard W.M. Jones
a548c96683 Add missing reference to guestfs-perl(3) to guestfs(3). 2011-07-19 17:40:52 +01:00
Richard W.M. Jones
20480068ca java: Tidy up the generated C bindings file. 2011-07-19 16:34:14 +01:00
Richard W.M. Jones
d7da4807e8 java: Fix optional arguments in calls.
This also adds tests.
2011-07-19 15:18:36 +01:00
Richard W.M. Jones
c79ba93f7e java: Enable warnings when compiling C bindings code.
And fix the code so it doesn't generate warnings.
2011-07-19 14:32:45 +01:00
Nikita A Menkovich
d8140d5689 debian: Fix misspelling in debian/control.
Updates commit c6577ac73d.
2011-07-18 14:35:58 +01:00
Nikita A Menkovich
32baae0e55 debian: Add debian/guestfsd.* to the tarball. 2011-07-18 13:57:09 +01:00
Nikita A Menkovich
c6577ac73d debian: Fix misspelling in debian/control. 2011-07-18 13:55:02 +01:00
Richard W.M. Jones
463a739bf0 Version 1.11.19. 2011-07-18 12:13:08 +01:00
Richard W.M. Jones
3b9d52b2a8 po-docs: Include source (POD files) in EXTRA_DIST. 2011-07-18 12:13:08 +01:00
Richard W.M. Jones
44d295756f po-docs: Remove empty Spanish translation file. 2011-07-18 09:34:04 +01:00
Richard W.M. Jones
33fe14b42f po-docs: Fix UTF-8 encoding problem. 2011-07-18 09:33:24 +01:00
Richard W.M. Jones
03459c8fa7 po-docs: Update the list of output manpages. 2011-07-17 23:05:50 +01:00
Richard W.M. Jones
f5d26e3cea po-docs: Generate list of *.pod files.
Generate the list of *.pod files, instead of hard coding
it (and having it get very very out of date).  Store the
list in a separate file po-docs/podfiles.
2011-07-17 23:05:32 +01:00
Richard W.M. Jones
63c1d5dd6e Add notes on making a libguestfs stable release. 2011-07-17 22:03:22 +01:00
Richard W.M. Jones
d28d76b4fb Pull latest translations from Transifex. 2011-07-17 22:02:58 +01:00
Richard W.M. Jones
dd497b76f8 Add tx pull wrapper script. 2011-07-17 22:01:40 +01:00
Richard W.M. Jones
cd00157efc ocaml: Generate ocamldoc.
Also includes improvements to the OCaml documentation.
2011-07-17 11:23:47 +01:00
Richard W.M. Jones
e72592563c ocaml: Bind guestfs_last_errno. 2011-07-16 19:15:29 +01:00
Richard W.M. Jones
8ee5c6d3a7 Update API support. 2011-07-16 19:11:37 +01:00
Richard W.M. Jones
2d3193e971 Update ROADMAP file. 2011-07-16 15:26:32 +01:00
Richard W.M. Jones
c5bd9539db fish: Don't make --ro the default yet.
Defer this decision to a future version of libguestfs.
2011-07-16 15:23:48 +01:00
Richard W.M. Jones
a711777bed docs: Separate out combined =item 's in man pages.
Turn:

 =item B<-a> | B<--all>

into:

 =item B<-a>

 =item B<--all>

This gives a more natural-looking manual page, as well as making it
easier to directly link to these sections.
2011-07-16 15:20:29 +01:00
Richard W.M. Jones
d84bb5dc19 Update and rearrange release notes. 2011-07-16 12:36:07 +01:00
Richard W.M. Jones
9f135be96e Fix test-guestfish-escapes regression test to work with debug/trace enabled.
If debugging or tracing is enabled, extra messages are sent to stderr
which mess with this test.  Remove the extra messages before checking
stderr.

This updates commit 617e7f6baf.
2011-07-15 22:09:29 +01:00
Richard W.M. Jones
1f0c650c8f Version 1.11.18. 2011-07-15 17:23:41 +01:00
Richard W.M. Jones
35b15d918d Update release notes. 2011-07-15 16:14:56 +01:00
Richard W.M. Jones
db5d157922 Update API support. 2011-07-15 16:10:19 +01:00
Richard W.M. Jones
1e9e351f17 ruby: Add binding for guestfs_user_cancel. 2011-07-15 14:57:00 +01:00
Richard W.M. Jones
f4dadd0fcf perl: Add binding for guestfs_user_cancel. 2011-07-15 14:47:09 +01:00
Richard W.M. Jones
60dd9494f0 ocaml: Add binding for guestfs_user_cancel. 2011-07-15 14:34:21 +01:00
Richard W.M. Jones
50c54d2814 fish: Register ^C handler to cancel long transfers. 2011-07-15 14:12:22 +01:00
Richard W.M. Jones
e187aa8431 fish: Add is_interactive flag.
Decide early (before launch) if this is going to be an interactive
session, and set the is_interactive flag.
2011-07-15 14:12:22 +01:00
Richard W.M. Jones
9ec9c97ce2 Add user cancellation to the C API.
This allows long transfers (FileIn and FileOut operations) to be
cancelled by calling the signal and thread safe guestfs_user_cancel
function.

Most of this commit consists of a multithreaded program that tests
user cancellation of uploads and downloads.
2011-07-15 14:11:46 +01:00
Richard W.M. Jones
f173543fd2 New APIs: set-pgroup, get-pgroup
If the pgroup flag is set in the handle, then the qemu and recovery
subprocesses are placed in separate process groups.  The default is
false.

The purpose for setting up a process group is that ^C will not be
passed from the main process down to these processes (killing them).
This allows ^C and other keyboard events to be caught and handled in
the main process.
2011-07-15 12:24:51 +01:00
Richard W.M. Jones
4b53a3737b guestfs.h: Add missing extern keyword before event functions. 2011-07-15 10:42:56 +01:00
Nikita A Menkovich
d2a25fd173 debian: New sub-package: guestfsd.
This patch adds guestfsd debian package to the build.  The daemon can
be installed in virtualization clients to enable libguestfs live
access.
2011-07-14 19:24:43 +01:00
Richard W.M. Jones
bb6a1b4cdc New API: write-append
Append content to the end of a file.
2011-07-14 18:18:07 +01:00
Richard W.M. Jones
617e7f6baf fish: Handle backslash escapes in guestfish double-quoted strings. 2011-07-14 18:17:39 +01:00
Richard W.M. Jones
d029fa69db build: Add ./configure --enable-install-daemon
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.
2011-07-14 15:52:29 +01:00
Richard W.M. Jones
4accf31972 Version 1.11.17. 2011-07-14 14:32:34 +01:00
Richard W.M. Jones
62a34ff2d3 resize: Clarify examples in the man page. 2011-07-14 13:42:33 +01:00
Richard W.M. Jones
f2d816573f resize: Add btrfs support to virt-resize (RHBZ#721275). 2011-07-14 13:03:49 +01:00
Richard W.M. Jones
a001a0d710 New API: btrfs-filesystem-resize (RHBZ#721160).
This resizes a btrfs filesystem.
2011-07-14 13:03:49 +01:00
Richard W.M. Jones
08910ee60c docs: resize: Not just limited to resizing filesystems in partitions.
If you use --LV-expand then filesystems in LVs can be resized too.
2011-07-14 13:03:49 +01:00
Richard W.M. Jones
c6340f4500 mkfs: Don't die if mke2fs is not available.
Allow other types of filesystems to be created.
2011-07-14 11:28:05 +01:00
Richard W.M. Jones
c21d6dc29c Version 1.11.16. 2011-07-13 15:59:33 +01:00
Richard W.M. Jones
fffe73ec6f Update release notes. 2011-07-13 15:33:07 +01:00
Richard W.M. Jones
f91c6f217f Refresh README file.
Update and verify the list of requirements, by checking it against
both configure.ac and the Fedora specfile.

Remove some obsolete sections that covered historical ground.
2011-07-13 15:03:04 +01:00
Richard W.M. Jones
aa8a9ebf29 appliance: Add systemd to get /sbin/reboot for virt-rescue (RHBZ#661280). 2011-07-13 14:27:28 +01:00
Richard W.M. Jones
0c1cdfc6f2 docs: Update API support. 2011-07-13 09:51:00 +01:00
Richard W.M. Jones
d84db26a2b virt-resize: Arrange options in man page in alphabetical order. 2011-07-13 09:44:13 +01:00
Richard W.M. Jones
d31de200b8 virt-resize: Add --ntfsresize-force option.
Use the non-deprecated g#ntfsresize_opts API call, and also add
the --ntfsresize-force option for forcing resize.
2011-07-13 09:27:57 +01:00
Richard W.M. Jones
8c26750336 Version 1.11.15. 2011-07-12 19:52:27 +01:00
Richard W.M. Jones
995674a44a TODO: Attach method for disconnected operation. 2011-07-12 18:44:46 +01:00
Richard W.M. Jones
511c82df46 part-get-bootable: Fix when partitions are missing or unordered (RHBZ#602997). 2011-07-12 18:44:46 +01:00
Richard W.M. Jones
edd747a090 New API: ntfsresize-opts (RHBZ#685009).
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.
2011-07-12 18:44:46 +01:00
Richard W.M. Jones
2ba2ddf211 Document that ntfsresize cannot be used multiple times (RHBZ#685009). 2011-07-12 18:44:46 +01:00
Richard W.M. Jones
4d4d3b2498 fish: Show device mapper device in tab completion (RHBZ#688062).
With this change:

><fs> luks-open /dev/vda1 lukstest
Enter key or passphrase ("key"):
><fs> ll /dev/<TAB>
/dev/mapper/lukstest  /dev/vda              /dev/vda1
2011-07-12 18:44:45 +01:00
Richard W.M. Jones
ce5a8978b5 New API: list-dm-devices (RHBZ#688062).
List device mapper devices.
2011-07-12 18:44:45 +01:00
Richard W.M. Jones
68af98e570 Don't mention /dev/mapper in docs for vg-activate{,-all} commands.
Although vg-activate and vg-activate-all do make /dev/mapper/VG-LV
devices internally, we always prefer to use the /dev/VG/LV format and
we return this format where possible.  Therefore don't mention
/dev/mapper in this documentation.
2011-07-12 18:44:45 +01:00
Richard W.M. Jones
0344248af5 protocol: Force optargs_bitmask to be passed as 0 for non-opt actions.
If the action doesn't take optional arguments, nevertheless force the
optargs_bitmask field in the header to be passed as 0, and give an
error if not.
2011-07-12 18:44:45 +01:00
Richard W.M. Jones
c0f72f13c0 list-9p: Avoid double free along error path.
This updates commit 5f10c33503.
2011-07-12 13:27:47 +01:00
Richard W.M. Jones
ebe3d8f43a Version 1.11.14. 2011-07-06 17:25:00 +01:00
Richard W.M. Jones
407d8fe1db mkfs-opts: Don't test optional arguments in this test. 2011-07-06 10:53:04 +01:00
Nikita A Menkovich
39d5c63be6 mkfs-opts: Add optional sectorsize parameter. 2011-07-06 10:52:04 +01:00
Richard W.M. Jones
f7a11c6043 capitests: Allow tests to properly test optional arguments.
For optional arguments, you can now specify empty string to mean no
argument, except for String optional arguments where you must use
"NOARG" (empty string meaning a supplied empty string argument).
2011-07-06 10:52:04 +01:00
Nikita A Menkovich
24fb2c1255 Implement inode option to mkfs_opts command.
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.
2011-07-04 10:35:56 +01:00
Richard W.M. Jones
436f8df147 Version 1.11.13. 2011-06-30 16:06:07 +01:00
Richard W.M. Jones
f3ada2c765 Add caution subdirectory containing safety and liveness tests.
Not that I'm paranoid about qemu breaking snapshots of anything like
that ...
2011-06-30 14:36:02 +01:00
Richard W.M. Jones
1acb82e9f7 Update release notes. 2011-06-30 12:06:09 +01:00
Richard W.M. Jones
76bd81820f inspector: Update documentation to cover <icon> element.
This updates commit 7f16c346bb.
2011-06-30 11:36:38 +01:00
Richard W.M. Jones
8c5bdc3e12 python: Add explicit g.close() method (RHBZ#717786). 2011-06-30 10:14:33 +01:00
Richard W.M. Jones
81fbdee6cc docs: Update API support. 2011-06-29 13:41:50 +01:00
Richard W.M. Jones
21c118a20e Version 1.11.12. 2011-06-28 19:52:11 +01:00
Richard W.M. Jones
dfb89e3556 fish: Add 'display' command for displaying graphical files. 2011-06-28 18:58:54 +01:00
Richard W.M. Jones
7f16c346bb New API: inspect-get-icon returns the guest icon.
This API returns the guest's favicon if found, else an icon
representing the guest operating system.  Currently supported by this
patch: Fedora, RHEL and derivatives, Debian (but not Ubuntu),
Windows XP, Windows 7.

This also updates virt-inspector to include an <icon> element
containing the icon in base64 encoding.
2011-06-28 18:41:54 +01:00
Richard W.M. Jones
5f26270c34 Change download_to_tmp so it can work with multi-root operating systems.
The previous guestfs___download_to_tmp function did not handle
multiboot correctly.  In particular it used the same cache name
for downloaded files from different roots, which could have caused
things like applications in each root to be confused.

This changes the function so that the cache filename is prefixed
with the root / fs number, eg. $tmpdir/0-Name instead of $tmpdir/Name.

This change also requires the function to return the new name, so
all places in the code which called this function had to be
updated.

This updates and fixes commit 3c1f762abe.
2011-06-28 17:03:08 +01:00
Richard W.M. Jones
adb5db58d8 generator: Fix functions with both RBufferOut and optional args.
No current function returns RBufferOut and has optional args.  Such
functions would be generated incorrectly.

RBufferOut implies a silent "size_t *size_r" argument is added after
the regular arguments and before the optional arguments.  Various
changes to the code generator need to be made to take this into
account.
2011-06-28 17:03:08 +01:00
Richard W.M. Jones
ea96c7acf7 inspector: Fix comment in virt-inspector.rng.
The comment referred to the command line syntax of the old
virt-inspector.
2011-06-28 17:03:08 +01:00
Richard W.M. Jones
b3c1dcfaee inspection: Remove note about root device string.
This is a fairly pointless note/warning since (a) you can't use the
API if you don't pass a root device string and (b) the code gives you
a good error message if you pass something that is not a root device
string.
2011-06-28 10:48:58 +01:00
Richard W.M. Jones
478f6c5bdb guestfs.h: Tidy up *_argv structs and other #defines. 2011-06-28 10:48:58 +01:00
Richard W.M. Jones
123610f1b5 Revert "Lib.pm: unknown filesystem label SWAP-sda2 (RHBZ#666578)"
This reverts commit 5cab0d6c80.
2011-06-28 09:48:46 +01:00
Richard W.M. Jones
14bb3b5ae7 New API: mount-9p lets you mount 9p filesystems (RHBZ#714981).
The updated patch makes 'options' into an optional parameter.
2011-06-22 15:24:05 +01:00
Richard W.M. Jones
5f10c33503 New API: list-9p lists 9p filesystem mount tags (RHBZ#714981). 2011-06-22 13:22:52 +01:00
Richard W.M. Jones
56b94f5f6a trace: Print empty list correctly.
Empty lists returned by RStringList and RHashtable functions
were incorrectly printed as [""].

Fix this so they are printed as [] instead.
2011-06-22 10:37:42 +01:00
Richard W.M. Jones
e1e78bcef5 Version 1.11.11. 2011-06-21 13:22:16 +01:00
Richard W.M. Jones
9287197a85 Enable deprecated option only with gcc >= 4.5.
Before gcc 4.5, the deprecated option did not take the optional string
argument (see [1]).  This caused compilation to fail with gcc < 4.5.

[1] http://gcc.gnu.org/gcc-4.5/changes.html
2011-06-20 10:35:02 +01:00
Richard W.M. Jones
cabfaa857f perl: Ignore MYMETA.yml.
This file is created by one of the build tools used by Perl 5.14.
2011-06-18 13:04:18 +01:00
Richard W.M. Jones
ba9343b52d todo: Idea for interactive disk creator program. 2011-06-18 13:01:12 +01:00
Richard W.M. Jones
5c3c7e8825 perl: Don't use qw() as parentheses.
In Perl 5.14:

Use of qw(...) as parentheses is deprecated at perl/blib/lib/Sys/Guestfs/Lib.pm line 1111.
2011-06-18 13:00:00 +01:00
Richard W.M. Jones
4ee190628b generator: Rewrite UUIDs that begin with zero byte.
In util-linux <= 2.19, mkswap -U cannot handle the first byte of the
UUID being zero, so we artificially rewrite such UUIDs.

See: http://article.gmane.org/gmane.linux.utilities.util-linux-ng/4273
2011-06-13 18:58:53 +01:00
Richard W.M. Jones
1f59849a4a Version 1.11.10. 2011-06-10 16:03:55 +01:00
Jim Meyering
daf55c0797 build: include <string.h> for src/match.c's use of strlen 2011-06-10 12:32:21 +01:00
Jim Meyering
343ba6d482 bootstrap: use --libtool 2011-06-10 12:29:49 +01:00
Jim Meyering
92a7d592df build: update to latest gnulib
* .gnulib: Update submodule to latest.
* daemon/m4/gnulib-cache.m4: Regenerate.
2011-06-10 12:29:38 +01:00
Richard W.M. Jones
f5096dd546 daemon: Keep Coverity happy by ignoring some return values. 2011-06-09 10:53:52 +01:00
Richard W.M. Jones
29453a58d8 Coverity: Don't return freed pointers from command* along error path.
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.
2011-06-09 10:53:51 +01:00
Richard W.M. Jones
7a091a11d7 Coverity: Missing return on error path. 2011-06-09 10:53:51 +01:00
Richard W.M. Jones
346c5b0ebf Coverity: Ensure fp is closed along all error paths. 2011-06-09 10:53:51 +01:00
Richard W.M. Jones
7c020a1480 Coverity: Close directory handle along error paths. 2011-06-09 10:53:46 +01:00
Richard W.M. Jones
869c11b30c Coverity: Don't leak argv arrays. 2011-06-09 10:53:38 +01:00
Richard W.M. Jones
3135b8c378 Coverity: Don't leak error strings. 2011-06-09 10:53:23 +01:00
Richard W.M. Jones
7fae594df7 Coverity: Check return value of sysroot_path.
For some reason we were checking the parameter!
2011-06-09 10:53:22 +01:00
Richard W.M. Jones
3a5bd5aba2 Coverity: Check return value of malloc. 2011-06-09 10:53:22 +01:00
Richard W.M. Jones
76dfb74324 Coverity: Don't close fd_cwd if fd_cwd == -1. 2011-06-09 10:53:22 +01:00
Richard W.M. Jones
3ed8d51220 Coverity: Avoid calling sort_strings (NULL, 0) on empty list. 2011-06-09 10:53:22 +01:00
Richard W.M. Jones
48ebf50f31 Coverity: Don't call free_strings (NULL). 2011-06-09 10:53:22 +01:00
Richard W.M. Jones
9160eec4fb Coverity: Remove unreachable code. 2011-06-09 10:53:12 +01:00
Richard W.M. Jones
bfc02f78f3 init: Remove timeout in udevadm settle command.
The given timeout (10s) was too low if the appliance was
running slowly, which caused a cascade of other failures
during tests.

Note that in udev-171 and above on Fedora, /sbin/start_udev
no longer exists, so now we are using this manual method to
start udevd.
2011-06-08 13:12:01 +01:00
Richard W.M. Jones
2f73ea343c protocol: Enhance "unexpected end of file when reading from daemon" error.
Make this error more informative, since it is a common error when the
appliance fails to start up.
2011-06-07 12:36:02 +01:00
Richard W.M. Jones
9ce239a836 Version 1.11.9. 2011-06-04 22:48:13 +01:00
Richard W.M. Jones
cdd11b758f Only include date, not time, in BUGS file.
This is so the file does not change so often when using 'make dist'.
2011-06-04 22:48:13 +01:00
Richard W.M. Jones
503c8f8661 Remove dependency diagram, since it is very out of date. 2011-06-04 22:22:04 +01:00
Richard W.M. Jones
42e7ea6840 virt-ls: Add virt-ls -lR option for complex file iteration. 2011-06-04 22:20:05 +01:00
Richard W.M. Jones
bb965ded27 virt-ls: Refactor mode selection code.
This is just code motion.
2011-06-04 18:36:36 +01:00
Richard W.M. Jones
7177340a6f virt-ls: Small fix for output of --help option. 2011-06-04 18:36:36 +01:00
Richard W.M. Jones
418842518b Ubuntu: Fix compilation of virt-resize if old libguestfs already installed. 2011-06-04 13:13:11 +01:00
Richard W.M. Jones
3819b657b0 recipes: in tr command \000 should be \0 2011-06-03 09:41:20 +01:00
Nikita A Menkovich
08bc8e40ce daemon: Fix error message. 2011-05-20 11:26:09 +01:00
Richard W.M. Jones
0c133cf689 todo: Document thoughts on visiting files. 2011-05-20 10:54:55 +01:00
Nikita A Menkovich
b85b4fafe1 debian: Add build dependencies: dpkg-dev, devscripts, gperf. 2011-05-20 10:35:06 +01:00
Richard W.M. Jones
4b91462bad daemon: Make sysroot_len be size_t instead of int. 2011-05-19 14:44:13 +01:00
Richard W.M. Jones
7ac2c210dd todo: Remove event log parsing - done. 2011-05-18 22:23:05 +01:00
Richard W.M. Jones
b646886d1a build: Install guestfs-recipes.1.html on website.
This updates commit f2c7df589c.
2011-05-18 21:11:47 +01:00
Richard W.M. Jones
f2c7df589c Add new guestfs-rescue(1) man page with recipes. 2011-05-18 21:03:44 +01:00
Richard W.M. Jones
00d34429e5 Remove guestfish recipes.
These were out of date.  We will replace them with more up to date
information.
2011-05-18 17:02:53 +01:00
Richard W.M. Jones
9536892721 guestfs-examples(3): Remove link to OCaml homepage. 2011-05-18 17:02:53 +01:00
Richard W.M. Jones
8a1be9265d Version 1.11.8. 2011-05-18 10:31:50 +01:00
Richard W.M. Jones
f55b32b2db zero: Disable file test because of bug in file command.
See: https://bugzilla.redhat.com/show_bug.cgi?id=705499
2011-05-18 10:04:05 +01:00
Richard W.M. Jones
94d1dfde27 virt-win-reg: Win XP paths can contain %systemdrive%. 2011-05-17 22:54:20 +01:00
Richard W.M. Jones
4a6890d824 virt-win-reg: systemroot macro should be replaced case insensitive. 2011-05-17 22:53:53 +01:00
Richard W.M. Jones
5984847296 New APIs: is-zero and is-zero-device, to test if file or device is all zeroes. 2011-05-17 22:06:00 +01:00
Richard W.M. Jones
ef6f877b9d Document that guestfs_file output depends on file(1) command.
And therefore practically it cannot be part of the ABI since
the output of file(1) itself changes from time to time.
2011-05-17 20:57:56 +01:00
Richard W.M. Jones
b777a5a649 fuse: Add note about allowing other users to see filesystem (RHBZ#705200). 2011-05-17 19:51:37 +01:00
Richard W.M. Jones
916392e227 Version 1.11.7. 2011-05-17 17:48:48 +01:00
Richard W.M. Jones
12414ddc02 generator: Mark sfdisk functions as deprecated.
Point to the part-* API calls as replacements.
2011-05-17 17:05:12 +01:00
Richard W.M. Jones
4ec8fd189d generator: Mark mount as deprecated.
Callers should use 'mount_options' or 'mount_vfs' instead.

See also:
http://libguestfs.org/guestfs.3.html#libguestfs_gotchas
2011-05-17 17:05:12 +01:00
Richard W.M. Jones
31de91f6d2 generator: Mark wait_ready as deprecated.
The function has been a no op for a very long time.  By marking
it as deprecated we make it clear that you shouldn't call it
in new code.
2011-05-17 17:05:12 +01:00
Richard W.M. Jones
b43482964a generator: Check the flags fields. 2011-05-17 17:05:12 +01:00
Richard W.M. Jones
34acb80a28 Enable deprecation warnings on all C programs. 2011-05-17 17:05:12 +01:00
Richard W.M. Jones
8c0aca8d92 fish: fuse: Remove redundant -DGUESTFS_DEFAULT_PATH.
This was left over from earlier code.  It is used in the base library,
but not in guestfish or guestmount.
2011-05-17 17:05:12 +01:00
Richard W.M. Jones
be507f6a22 lib: Warn about deprecated functions (enable with -DGUESTFS_WARN_DEPRECATED=1).
This allows C API users to be warned if they are using any deprecated
functions.

We don't warn about this by default.  Users have to specifically
request this by defining the cpp symbol GUESTFS_WARN_DEPRECATED as 1.
2011-05-17 17:05:12 +01:00
Richard W.M. Jones
33adb59b60 lib: Add GCC version macro to the header file.
This will be used to internally enable various GCC enhancements.
2011-05-17 17:05:12 +01:00
Richard W.M. Jones
36b236fc97 lib: Add vertical space between each function in <guestfs.h>. 2011-05-17 17:05:11 +01:00
Richard W.M. Jones
64841fe895 appliance: Use qemu -machine option where available (RHBZ#700369). 2011-05-17 17:05:11 +01:00
Richard W.M. Jones
2dbe26c372 virt-win-reg: Support HKEY_USERS keys.
This adds support for various Registry keys under HKEY_USERS (user
preferences).

(1) HKEY_USERS\<SID>
    where <SID> is a User SID.

For example:

  # virt-win-reg Windows 'HKEY_USERS\S-1-5-19'

lists out the LocalService user's registry.

(2) HKEY_USERS\<username>
    where <username> is a Windows local username (this is a
    libguestfs extension).

For example:

  # virt-win-reg Windows 'HKEY_USERS\rjones'

lists out the user preferences of user 'rjones'.

HKU can be used as an abbreviation for HKEY_USERS.  Merging is also
supported.
2011-05-17 17:05:11 +01:00
Richard W.M. Jones
4443cfab8b virt-win-reg: Don't use implicit $_ in map_path_to_hive function. 2011-05-17 17:05:11 +01:00
Richard W.M. Jones
3b4bb214c3 virt-win-reg: Don't hard-code the relationship between hive name and path.
The crucial change is the tuple that is returned by map_path_to_hive:

-    my ($hivename, [...]) = map_path_to_hive ($_);
+    my ($hiveshortname, $hivefile, [...]) = map_path_to_hive ($_);

Previously the $hivename was both the name of the hive (eg. "sam"),
the name of the local copy in /tmp, and the name of the hive in
%systemroot%\system32\config.

In the new code, the $hiveshortname (eg. "sam") is still used for the
local copy in /tmp, but we return $hivefile which is the full Windows
path (eg. "/windows/system32/config/sam").

The purpose of this change is to allow us in future to return hives
from other Windows directories, specifically HKEY_USERS hives from
Windows home directories.

Although this is just code motion, it requires some quite extensive
changes to virt-win-reg.
2011-05-17 17:05:11 +01:00
Richard W.M. Jones
9116f0eb01 virt-win-reg: Add --unsafe-printable-strings option.
This also requires hivex >= 1.2.7.
2011-05-17 17:05:01 +01:00
Richard W.M. Jones
977b61c525 todo: See if qemu -machine option can be used to select KVM, TCG acceleration. 2011-05-16 12:08:00 +01:00
Richard W.M. Jones
d6cf002174 Version 1.11.6. 2011-05-12 16:31:29 +01:00
Richard W.M. Jones
e95671d69e debian: Note that libconfig-dev ought to be required.
However it doesn't appear to be in Debian at the moment.
2011-05-12 16:04:16 +01:00
Richard W.M. Jones
91ea9c1805 debian: Include debian/ directory in tarball.
This makes it simpler to build Debian and Ubuntu packages from the
tarballs.
2011-05-12 13:52:29 +01:00
Richard W.M. Jones
48c91ac03c build: Sort EXTRA_DIST into lexicographic order. 2011-05-12 13:50:38 +01:00
Richard W.M. Jones
03a8e3fc8e configure: Use Python platform-dependent site-packages.
This updates commit c446e6e26e.
2011-05-09 16:30:30 +01:00
Richard W.M. Jones
2a8cf3aab3 Version 1.11.5. 2011-05-09 15:22:32 +01:00
Richard W.M. Jones
ea70f55812 edit: Reorganize options alphabetically. 2011-05-09 14:59:33 +01:00
Richard W.M. Jones
c665d14f29 edit: Fix reference to virt-cat in the documentation.
This updates commit 2b5fbc882a.
2011-05-09 14:40:12 +01:00
Richard W.M. Jones
c446e6e26e Use Python distutils to determine include and site-packages directories.
This change was inspired by Hilko Bengen's similar change to hivex:
http://git.annexia.org/?p=hivex.git;a=commitdiff;h=b808c875a34e62fcdf360534f923d6030590ff44
2011-05-09 14:34:31 +01:00
Richard W.M. Jones
2b5fbc882a Rewrite virt-edit in C. 2011-05-09 14:23:08 +01:00
Richard W.M. Jones
5ce759bfdc daemon: Remove some less useful debugging messages.
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.
2011-05-08 22:01:00 +01:00
Richard W.M. Jones
5419153954 Version 1.11.4. 2011-05-08 16:53:03 +01:00
Richard W.M. Jones
607aa95de9 Fix guestfs___rollback_cmdline when pos == 0.
Because of the previous change to size_t, when pos == 0 the loop would
wrap around and cause a segmentation fault.

This fixes a regression introduced by
commit 10167cea98.
2011-05-08 15:13:23 +01:00
Richard W.M. Jones
8ee0ad0caf configure: Sort output files in AC_CONFIG_FILES section. 2011-05-06 17:33:44 -04:00
Richard W.M. Jones
87fb6d852d fish: Allow -d UUID (specify libvirt domains by UUID).
This applies in all the commands which use the common C option parsing
code, ie:

* guestfish
* guestmount
* virt-cat
* virt-df
* virt-filesystems
* virt-inspector
* virt-ls
* virt-rescue
2011-05-06 13:04:19 -04:00
Richard W.M. Jones
be3b028d7f add-domain: Add allowuuid flag to allow UUIDs to be used for names.
This makes a backwards-compatible change to the add-domain API.  If
the optional allowuuid flag is true then UUIDs can be used instead of
names in the domain name parameter.
2011-05-06 13:04:18 -04:00
Richard W.M. Jones
a4c28b4ed1 add-domain: Suppress libvirt errors on stderr.
Install an error handler on the libvirt error connection so that
errors are not printed on stderr (instead they go up through the usual
libguestfs error mechanism).

Unfortunately this doesn't suppress initial connection error messages
to stderr.  I cannot see how to do this without affecting the global
libvirt error handler, which is not acceptable for a library to be
doing.
2011-05-06 13:03:50 -04:00
Richard W.M. Jones
c49fc3831d doc: Use I<-...> for cross-references to command line options.
This is now used consistently across all the documentation.
2011-05-01 17:43:18 -04:00
Richard W.M. Jones
988a878464 df: Refresh virt-df(1) man page.
Add examples.

Refresh description.

Use I<...> to refer to command line options.
2011-05-01 14:53:23 -04:00
Richard W.M. Jones
805e6dbc15 guestfs(3): Note that host file size limits affect guest disk limits. 2011-04-30 20:12:07 -04:00
Richard W.M. Jones
40f2b698ac guestfs(3): Refresh documentation for private data area keys. 2011-04-30 19:39:01 -04:00
Richard W.M. Jones
e1836891d4 guestfs(3): Document that old callback functions still work. 2011-04-30 19:26:08 -04:00
Richard W.M. Jones
108d7a134c guestfs(3): Referenced section is above, not below. 2011-04-30 19:10:52 -04:00
Richard W.M. Jones
a5e421570c guestfs(3): Refresh autosync gotcha documentation. 2011-04-30 19:10:25 -04:00
Richard W.M. Jones
470e373eea guestfs(3): Writing to a file descriptor, not just a pipe. 2011-04-30 18:45:56 -04:00
Richard W.M. Jones
dd86183f3f guestfs(3): Refresh documentation for guestfs_create, guestfs_close. 2011-04-30 18:31:06 -04:00
Richard W.M. Jones
91b35746b4 Add a trace message to guestfs_close.
Only the "first half" (ie. the call) is traced, because by the time
the function returns the handle has gone and there's no way to
generate events.

You should see:

  libguestfs: trace: close
2011-04-30 05:55:27 -04:00
Richard W.M. Jones
10167cea98 internal: Use size_t instead of int for command line size. 2011-04-30 05:49:06 -04:00
Richard W.M. Jones
478b2d80ed guestfs_close: Move local variables close to code that uses them.
This is just code motion.
2011-04-30 05:45:26 -04:00
Richard W.M. Jones
b2f8627ab5 guestfs_close: Remove unused local variable. 2011-04-30 05:42:43 -04:00
Richard W.M. Jones
c0f96e9c6e guestfs(3): Document limits. 2011-04-27 20:10:24 +01:00
Richard W.M. Jones
ea293658f4 todo: Integrate with CMDBs (thanks Quinten Laureijs). 2011-04-26 11:00:10 +01:00
Richard W.M. Jones
f24494195a python: Ensure Python GIL state is correct during callback.
This updates commit 2cac52000a.
2011-04-22 22:53:07 +01:00
Richard W.M. Jones
dfd7efb91f Version 1.11.3. 2011-04-22 22:26:02 +01:00
Richard W.M. Jones
2cac52000a python: Implement new event API.
This implements set_event_callback and delete_event_callback so that
Python programs can use the new event mechanism.
2011-04-22 21:50:16 +01:00
Richard W.M. Jones
16da7589e9 python: Rearrange C files for bindings.
Move the hand-written functions into two new files:
guestfs-py.h and guestfs-py-byhand.c

This is just code motion.
2011-04-22 21:50:15 +01:00
Richard W.M. Jones
3acf732c2f perl: Decrement refcount in $g->delete_event_callback.
This updates commit bc468c87d0.
2011-04-22 21:50:15 +01:00
Richard W.M. Jones
0da6f55a67 inspect: Look for %systemroot%/system32 for Windows heuristic.
The virt-v2v transfer ISO had a /windows directory.  The core
inspection code thought this was a Windows root filesystem.
2011-04-21 17:33:48 +01:00
Richard W.M. Jones
782f3a3646 list-applications: If software hive is missing, this is an error.
virt-inspector would exit silently if list-applications failed along
this error path.
2011-04-21 17:29:44 +01:00
Richard W.M. Jones
2b0ca7e7b8 inspect: "centos" and "scientificlinux" are now separate distros.
Previously we returned "rhel" for these, which was not accurate.
2011-04-21 15:09:11 +01:00
Richard W.M. Jones
a9ac448cf8 Update TODO. 2011-04-21 14:47:57 +01:00
Richard W.M. Jones
6d0d3b7f02 Version 1.11.2. 2011-04-18 21:47:45 +01:00
Richard W.M. Jones
08dc4a87b9 python: Release Python GIL while running libguestfs calls.
Release the Python global interpreter lock while running libguestfs
calls.

We don't release it around guestfs_create() because that is a short
call that just allocates memory.  We do release it around
guestfs_close() since that is a potentially long-running (it can call
wait(2) amongst other things).  We also release it around all the
other generated Python calls.

We don't yet support callbacks into Python code (ie. the new event
API).  But when we do in future, we will need to also handle the GIL
around those callbacks.

This code is adapted from libvirt's python/typewrappers.h.  Thanks to
Dan Berrange for showing us how to do this properly.
2011-04-18 20:21:38 +01:00
Richard W.M. Jones
a3cce46557 fish: --rw option will be mandatory in 1.12 not 1.10. 2011-04-16 21:35:11 +01:00
Richard W.M. Jones
4c2bb8b301 fish: Fix typo in guestfish man page (--format option). 2011-04-16 21:26:15 +01:00
Richard W.M. Jones
34d9fed24a inspector: Refresh the virt-inspector(1) manpage. 2011-04-16 21:15:10 +01:00
Richard W.M. Jones
5d139fa8a4 run script: Don't depend on libtool being installed.
Also use 'exec' to run the program.
2011-04-16 15:29:58 +01:00
Richard W.M. Jones
79f5720d2c Version 1.11.1. 2011-04-16 14:57:33 +01:00
Richard W.M. Jones
340ff70c1e Add images/guestfs-aux/fedora-packages.db{,.txt} to EXTRA_DIST.
This updates commit d95874db3d.
2011-04-16 14:56:38 +01:00
Richard W.M. Jones
33a2c184e1 Remove local LIBGUESTFS_PATH detection from guestfish and guestmount.
Remove the hack that let you run ./fish/guestfish or
./fuse/guestmount.  You now have to do:

  ./run ./fish/guestfish
or
  ./run ./fuse/guestmount

to run these programs without installing.
2011-04-16 08:32:48 +01:00
Richard W.M. Jones
5790f5bfaf Remove ad-hoc run*locally scripts, replace with './run'
Remove all the run*locally scripts and replace with a single top level
./run shell script.
2011-04-16 08:32:44 +01:00
Richard W.M. Jones
0108d7861d inspector: Handle write failures when creating example-*.xml. 2011-04-14 18:20:30 +01:00
Richard W.M. Jones
67493bfca4 Delete file so db_load doesn't run incrementally.
It turns out that db_load incrementally updates the database (instead
of writing a new one).  Remove the old database to force db_load to
write a new one.

This also ensures that we handle write failure gracefully.
2011-04-14 18:20:30 +01:00
Richard W.M. Jones
36d3a4ce53 inspector: Include <hostname> in output. 2011-04-14 18:20:26 +01:00
Richard W.M. Jones
d95874db3d inspect: Get version and release of RPM packages.
This commit downloads the Packages RPM database allowing us to find
other details about installed RPM packages (via
inspect-list-applications).  This adds version and release.  Epoch
cannot yet be found.

This commit also updates the Fedora example image so that it contains
a dummy RPM Packages database with some data.
2011-04-14 18:19:42 +01:00
Richard W.M. Jones
a986e8dadb inspect: Abstract out db_dump code for listing RPM applications.
There are two changes here:

(1) The code for listing RPM applications ran db_dump and parsed the
output.  We abstract out that parsing code into a separate reusable
module (src/dbdump.c).

(2) The old db_dump parsing code used db_dump -p (printable) format.
Instead use db_dump -k (hex) format so we can read binary fields.
2011-04-14 13:28:02 +01:00
Richard W.M. Jones
3336b5448f inspect: Split code into separate files.
The src/inspect.c file had grown rather large -- 3,500 lines.  Split
it across several files according to function.

This is just moving code.

After the split the files are more evenly divided:

  536 src/inspect_apps.c
  766 src/inspect.c
  537 src/inspect_fs.c
  404 src/inspect_fs_cd.c
  785 src/inspect_fs_unix.c
  535 src/inspect_fs_windows.c
 3563 total
2011-04-14 11:29:19 +01:00
Richard W.M. Jones
439a42efdb inspect: Move shared PCRE match functions to separate file.
This is just moving code around.
2011-04-13 23:02:45 +01:00
Richard W.M. Jones
3c1f762abe inspect: Cache downloaded files in the handle g->tmpdir.
During inspection we download various files such as the Windows
'software' and 'system' registries.  Previously these were downloaded
as temporary files and discarded immediately after use.  This meant
that the 'software' registry was being downloaded twice by
virt-inspector (it's required once for basic OS inspection, and a
second time to list Windows applications).

This commit changes this so that these files are cached in g->tmpdir,
and thus the second time we just reuse the file we've already
downloaded.

Callers shouldn't be relying on inspect-list-applications to reread
the actual registry from the VM (unless you close and reopen the
handle).  It says in the documentation that the results of inspection
may be cached in the handle.
2011-04-13 22:35:35 +01:00
Richard W.M. Jones
70975981be Remove temporary directory containing arbitrary files.
In preparation for caching inspection information in the temporary
directory (g->tmpdir), allow the temporary directory to contain
arbitrary files, and remove all of them when the handle is closed.

This just generalizes the previous method of cleaning up the tmpdir.
2011-04-13 22:02:08 +01:00
Jim Meyering
6740028b33 Include string.h and libintl.h, as needed.
* df/df.c: As above.
* df/main.c: As above.
* df/output.c: As above.
* fuse/guestmount.c: As above.
* inspector/virt-inspector.c: As above.
* rescue/virt-rescue.c: As above.
2011-04-13 14:26:06 +01:00
Jim Meyering
ace1795d10 Add more missing include directives.
* cat/virt-cat.c: Include string.h and libintl.h.
* cat/virt-filesystems.c: Likewise.
* cat/virt-ls.c: Likewise.
2011-04-13 14:25:56 +01:00
Nikita A Menkovich
173c374bd0 debian: Add dependency on libpcre-ocaml-dev. 2011-04-13 12:41:27 +01:00
Jim Meyering
0db662eae5 Add missing include directives.
* fish/config.c: Include string.h, for use of strlen.
* fish/keys.c: Likewise, but for use of memcpy.
* fish/man.c: Likewise, but for use of memset.
2011-04-13 12:06:27 +01:00
Jim Meyering
a53833fdd2 Avoid warning about implicit declaration of strlen.
* src/events.c: Include <string.h>, for use of strlen.
2011-04-13 12:06:10 +01:00
Richard W.M. Jones
6ec2ed20cb debian: libguestfs-test-tool-helper no longer exists. 2011-04-12 22:45:39 +01:00
Richard W.M. Jones
0d9f2c7311 resize: Include stamp file for manpage in CLEANFILES. 2011-04-12 22:45:18 +01:00
Richard W.M. Jones
6e635ac015 Version 1.11.0. 2011-04-12 20:14:51 +01:00
Richard W.M. Jones
189a2f3075 Update RELEASE-NOTES for 1.10 release. 2011-04-12 19:40:57 +01:00
Richard W.M. Jones
30479a1190 Update ROADMAP for 1.12 and beyond. 2011-04-12 19:36:00 +01:00
Richard W.M. Jones
9e56040cd3 README: virtio-serial is required. 2011-04-12 19:35:27 +01:00
Richard W.M. Jones
62f9e408b4 guestfs(3): Fix documentation for drive letters.
We can now get drive letter mappings through the inspection API.
2011-04-12 18:49:31 +01:00
Richard W.M. Jones
88ff38dab6 inspect: Fix some small memory leaks in Windows inspection.
Found using valgrind.
2011-04-12 18:05:35 +01:00
Richard W.M. Jones
11374abead fish: Allows win:... paths to work with drives mounted anywhere.
This allows you to mount disks on (eg) /c and /e and have the
guestfish win:... path mechanism map drive letters to the
right places.
2011-04-12 17:15:26 +01:00
Richard W.M. Jones
c2c755440b todo: guestfish drive letters. 2011-04-11 12:33:21 +01:00
Richard W.M. Jones
cde0c0c057 resize: Update dependencies. 2011-04-10 21:10:19 +01:00
Richard W.M. Jones
d600d53868 resize: Don't build this directory in parallel. 2011-04-10 20:42:42 +01:00
Richard W.M. Jones
a6cb8fee20 resize: Consistent use of 'part' in help output. 2011-04-10 11:12:03 +01:00
Richard W.M. Jones
61a42ff551 resize: Missing \n after version. 2011-04-10 11:06:58 +01:00
Richard W.M. Jones
047173d186 resize: Link with local copy of guestfs. 2011-04-09 22:50:15 +01:00
Richard W.M. Jones
ee212deef6 Version 1.9.18. 2011-04-09 22:25:56 +01:00
Richard W.M. Jones
de4f5f2fe3 Update POT file. 2011-04-09 22:23:57 +01:00
Richard W.M. Jones
d8818f6cb9 Include po/Makefile.in.in in git, to avoid needing to rerun gettextize. 2011-04-09 22:23:56 +01:00
Richard W.M. Jones
b60a01f9a3 build: virt-resize manpage. 2011-04-09 22:23:56 +01:00
Richard W.M. Jones
ca03635a4c Rewrite virt-resize in OCaml.
This is a fairly straightforward translation of Perl virt-resize into
OCaml.  It is bug-for-bug and feature-for-feature identical to the
Perl version, except as noted below.

The motivation is to have a more solid, high-level, statically safe
compiled language to go forwards with fixing some of the harder bugs
in virt-resize.  In particular contracts between different parts of
the program are now handled by statically typed structures checked at
compile time, instead of the very ad-hoc unchecked hash tables used by
the Perl version.

OCaml and the ocaml-pcre library (Perl-Compatible Regular Expressions
bindings for OCaml) are required.

Extra features in this version:

- 32 bit hosts are now supported.

- We try hard to handle the case where the target disk is not "clean"
  (ie. all zeroes).  It usually works for this case, whereas the
  previous version would usually fail.  However it is still
  recommended that the system administrator creates a fresh blank disk
  for the target before running the program.

- User messages are a bit more verbose and helpful.  You can turn
  these off with the -q (--quiet) option.

There is one lost feature:

- Ability to specify >= T (terabytes) sizes in command line size
  expressions has been removed.  This probably didn't work in the Perl
  version.

Other differences:

- The first partition on the target is no longer aligned; instead we
  place it at the same sector as on the source.  I suspect that
  aligning it was causing the bootloader failures.

- Because it's easier, we do more sanity checking on the source disk.
  This might lead to more failures, but they'd be failures you'd want
  to know about.

- The order in which operations are performed has been changed to make
  it more logical.  The user should not notice any functional
  difference, but debug messages will be quite a bit different.

- virt-resize is a compiled binary, not a script.
2011-04-09 14:28:22 +01:00
Matthew Booth
3a84e0784e Compile rpcgen-generated files with -fno-strict-aliasing
rpcgen generates source which can't be safely compiled with strict-aliasing
enabled.
2011-04-07 16:37:20 +01:00
Richard W.M. Jones
6ea263b1f1 test-tool: Don't use static binary helper program, nor ISO.
This simplifies the libguestfs-test-tool program down to essentials.
Bugs most commonly occur when starting the appliance, so what we
should concentrate on test is just that.

Previously the test tool built a special static binary helper program,
packaged it up in an ISO, then ran this inside the appliance.  None of
this really tested useful failure modes, but they did make the test
tool itself harder to build, harder for users to run, and more
brittle.

This change also adds some more debugging of libguestfs state.
2011-04-06 19:48:39 +01:00
Richard W.M. Jones
cbc6b720a4 Update RELEASE-NOTES file. 2011-04-06 11:52:20 +01:00
Richard W.M. Jones
872e67ffdf Version 1.9.17. 2011-04-05 21:24:51 +01:00
Richard W.M. Jones
5141c8fc02 fish: copy-in, copy-out, edit, more commands can use win:... prefix. 2011-04-05 20:29:05 +01:00
Richard W.M. Jones
b8be128caa fish: Enhance guestfish win:... parsing to understand drive letters. 2011-04-05 20:01:59 +01:00
Richard W.M. Jones
ade2f82450 edit: Allow Windows-style drive letters and paths to be used. 2011-04-05 20:01:59 +01:00
Richard W.M. Jones
13d8963d8c New API: inspect-get-drive-mappings
This returns the drive mappings from the Windows Registry.

virt-inspector displays the drive mappings, giving output
similar to this:

  <drive_mappings>
    <drive_mapping name="C">/dev/sda2</drive_mapping>
    <drive_mapping name="E">/dev/sdb1</drive_mapping>
  </drive_mappings>
2011-04-05 20:01:57 +01:00
Richard W.M. Jones
9e7c6a5483 New API: inspect-get-windows-current-control-set
This returns the actual registry key corresponding to
CurrentControlSet (eg. it might be "ControlSet001").

Previously the inspection code was hard-coding ControlSet001.  Now we
use the correct control set, and also make it available to callers
through the API.

This commit also updates the virt-dhcp-address example so it uses this
new API.

virt-inspector displays the current control set when available.
2011-04-05 20:01:15 +01:00
Richard W.M. Jones
9b945cfa78 daemon: Reimplement 'mounts' and 'mountpoints' commands.
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.
2011-04-05 20:01:15 +01:00
Richard W.M. Jones
f3eea44f97 Rename resolve_windows_path_silently to case_sensitive_path_silently.
A more accurate description of what this function does.

This is just code motion.
2011-04-05 20:01:12 +01:00
Richard W.M. Jones
60cdf44606 edit: Move 'exit 0' to end of file.
This is just code motion.
2011-04-05 18:34:35 +01:00
Richard W.M. Jones
aed8f220d2 edit: Let $root == $roots[0].
This is just code motion.
2011-04-05 18:34:35 +01:00
Richard W.M. Jones
4de124debf cat, edit: Reference guestfish equivalent commands in the manual pages. 2011-04-05 18:34:35 +01:00
Richard W.M. Jones
afa1780959 python: Convert any iterable argument to a list (RHBZ#693324).
Thanks to Erez Shinan.
2011-04-04 12:48:02 +01:00
Richard W.M. Jones
8e61d636bb fish: Add 'pulse mode' to the progress bar. 2011-04-02 22:32:36 +01:00
Richard W.M. Jones
8629149baa fish: Move variable decls to top of function.
This is just code motion.
2011-04-02 22:31:41 +01:00
Nikita A Menkovich
e16d486fa7 debian: Add missing deps: ocaml-findlib, libstring-shellquote-perl. 2011-04-02 11:05:19 +01:00
Nikita A Menkovich
5eaffede90 mkisofs is obsolete. Require genisoimage everywhere instead. 2011-04-02 11:04:47 +01:00
Richard W.M. Jones
bbaea1d03a Pull translations from Transifex.
New Ukrainian po-docs translation added.
2011-04-02 09:14:41 +01:00
Richard W.M. Jones
8bb22a2902 Version 1.9.16. 2011-04-01 20:37:01 +01:00
Richard W.M. Jones
9b60f3a9f3 du: Add pulse mode progress messages. 2011-04-01 18:37:49 +01:00
Richard W.M. Jones
e9feff6f4c cpmv: Add pulse mode progress messages. 2011-04-01 18:37:48 +01:00
Richard W.M. Jones
4a64a5a285 checksum: Add pulse mode progress messages. 2011-04-01 18:37:48 +01:00
Richard W.M. Jones
40f7323134 daemon: Introduce "pulse mode" progress events.
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.
2011-04-01 16:05:45 +01:00
Richard W.M. Jones
6e5f640896 daemon: When running commands, restart select if we receive a signal. 2011-04-01 16:05:30 +01:00
Richard W.M. Jones
42938f6faf daemon: Reset SIGPIPE to default before running subprocesses. 2011-04-01 16:05:30 +01:00
Richard W.M. Jones
371eabfae3 Generate progress messages during launch.
This commit generates approximate progress messages during the
guestfs_launch call.  Currently this code generates:

   0 / 12: launch clock starts
   3 / 12: appliance created
   6 / 12: detected that guest kernel started
   9 / 12: detected that /init script is running
  12 / 12: launch completed successfully

(Note this is not an ABI and may be changed or removed in a future
version).

Progress messages are only generated at all if 5 seconds have elapsed
since the launch, and they are only generated for the ordinary
appliance (not if using attach-method to attach to an existing virtio
serial port).
2011-04-01 16:05:30 +01:00
Richard W.M. Jones
02971adc3b protocol: Sleep for 1ms before reading log messages.
As explained in the comment:

  /* QEMU's console emulates a 16550A serial port.  The real 16550A
   * device has a small FIFO buffer (16 bytes) which means here we see
   * lots of small reads of 1-16 bytes in length, usually single
   * bytes.  Sleeping here for a very brief period groups reads
   * together (so we usually get a few lines of output at once) and
   * improves overall throughput, as well as making the event
   * interface a bit more sane for callers.  With a virtio-serial
   * based console (not yet implemented) we may be able to remove
   * this.  XXX
   */
2011-04-01 16:05:30 +01:00
Richard W.M. Jones
1bf970cb0e Shared function to send progress messages.
This is just code motion.
2011-04-01 16:05:30 +01:00
Richard W.M. Jones
1e6be6afe5 Add prototype for timeval_diff.
This is just code motion.
2011-04-01 16:05:30 +01:00
Richard W.M. Jones
05dbe09a5c docs: Progress messages don't necessarily reach 100% in the error case.
This should be obvious, and now it is documented to avoid any
confusion.
2011-04-01 16:05:30 +01:00
Richard W.M. Jones
94945d84c7 docs: Fix link to progress messages in guestfs(3).
This updates commit 4e0cf4dbf8.
2011-04-01 16:05:30 +01:00
Richard W.M. Jones
50e59c2370 Update copyright date on main guestfs(3) man page. 2011-04-01 16:05:30 +01:00
Richard W.M. Jones
2c082c5d68 Version 1.9.15. 2011-04-01 10:13:40 +01:00
Richard W.M. Jones
decda45734 fish: Fix incorrect path passed to perror.
Fix commit b8e1dee73a.
2011-04-01 09:53:44 +01:00
Richard W.M. Jones
b5130936d8 Add libguestfs-tools.conf file to EXTRA_DIST. 2011-04-01 08:50:49 +01:00
Richard W.M. Jones
97d737a88b examples: Add virt-dhcp-address program.
This is like the mythical 'virt-ifconfig'.  There is not enough
certainty around the right way to be doing this for us to make
a full virt tool for this.  Therefore the code is just an example.
2011-03-31 22:11:53 +01:00
Richard W.M. Jones
b41e73008a examples: Use WARN_CFLAGS, WERROR_CFLAGS macros instead of -Wall 2011-03-31 20:18:23 +01:00
Richard W.M. Jones
d5eb5216aa examples: size_t-correctness change in inspect_vm.c 2011-03-31 20:17:02 +01:00
Richard W.M. Jones
1612201a83 contrib: Fix URLs in README file. 2011-03-31 18:20:08 +01:00
Richard W.M. Jones
64bc449503 inspect: Detect 32 bit applications running on WOW64 emulator (RHBZ#692545).
These applications are located along a different Registry path.  See
http://support.microsoft.com/kb/896459 for all the details.

Thanks Jinxin Zheng for finding the bug and the solution.
2011-03-31 15:51:00 +01:00
Richard W.M. Jones
b8e1dee73a Add /etc/libguestfs-tools.conf configuration file.
This allows the default for --ro or --rw to be controlled for the
three tools guestfish, guestmount and virt-rescue.
2011-03-31 15:42:13 +01:00
Richard W.M. Jones
4155d20014 rescue: Add -w|--rw option. 2011-03-30 16:33:14 +01:00
Richard W.M. Jones
3824935411 fuse: Document -w flag in --help output. 2011-03-30 16:32:33 +01:00
Richard W.M. Jones
58f7a5a4ac Exclude po-docs directory completely if po4a not available.
Lift the if HAVE_PO4A ... endif completely out of the po-docs
subdirectory, and just exclude the whole subdirectory if the po4a
program is not available.
2011-03-29 16:07:21 +01:00
Richard W.M. Jones
edb7501d60 tests: Don't fail when compiled without support for NTFS. 2011-03-29 16:03:29 +01:00
Richard W.M. Jones
759f4369de perl: Canonicalize /dev/vd* paths in old inspection code (RHBZ#691724). 2011-03-29 12:20:57 +01:00
Richard W.M. Jones
d82d6f0633 README: Note that getfacl, getfattr are optional dependencies. 2011-03-28 17:18:24 +01:00
Richard W.M. Jones
c3fc40d0c5 Version 1.9.14. 2011-03-28 17:11:58 +01:00
Richard W.M. Jones
0d6fd9e1d2 fuse: Fix getxattr, listxattr calls and add a regression test (RHBZ#691389).
The documentation for the getxattr and listxattr calls is not very
clear and as a result we were always returning something different
from that which the Linux kernel would usually return.

This fixes these calls, at least far enough that both the 'getfattr'
and 'getfacl' programs now work fine on FUSE-mounted filesystems.

Note that SELinux attrs are *not* passed through.  This appears to be
a known bug between SELinux and FUSE.  For more information see:

http://www.spinics.net/lists/selinux/msg09460.html
2011-03-28 14:49:48 +01:00
Richard W.M. Jones
4e529e06a4 fish: fuse: Add -m dev:mnt:opts to allow mount options to be specified.
This lets you turn on ACLs and xattrs by doing:

  -m /dev/sda1:/:acl,user_xattr

The extra parameter is passed through to mount_options:

  libguestfs: trace: mount_options "acl,user_xattr" "/dev/sda1" "/"
2011-03-28 14:21:55 +01:00
Richard W.M. Jones
feaddb062a roadmap: Move QMP to 'beyond 1.10'.
See: https://www.redhat.com/archives/libguestfs/2011-March/msg00124.html
2011-03-28 10:35:14 +01:00
Richard W.M. Jones
b8724e2352 Open release notes for version 1.10.0. 2011-03-28 10:32:14 +01:00
Richard W.M. Jones
e751293e10 ruby: Don't segfault if callbacks throw exceptions (RHBZ#664558).
(Thanks Chris Lalancette).

See:
https://bugzilla.redhat.com/show_bug.cgi?id=664558#c6
2011-03-28 10:03:16 +01:00
Richard W.M. Jones
a0e3b21837 RHEL 5: Use mke4fs on RHEL 5 as replacement for mke2fs. 2011-03-25 14:42:40 +00:00
Richard W.M. Jones
227bea6c7e mkfs: Force mke2fs to create a filesystem even on raw IDE device (RHBZ#690819). 2011-03-25 14:34:31 +00:00
Richard W.M. Jones
110bfe1fcc Rename $tmpdir/sock to $tmpdir/guestfsd.sock.
No functional change; this simply makes the purpose of the
socket clearer.
2011-03-25 12:32:14 +00:00
Richard W.M. Jones
23b7c92b0d inspector: Add detection of Slackware. 2011-03-25 11:22:38 +00:00
Richard W.M. Jones
652a105237 Version 1.9.13. 2011-03-24 12:23:13 +00:00
Richard W.M. Jones
3f1e3223c4 New API: guestfs_inspect_get_product_variant
This returns a product variant for inspected operating systems.  In
practice this is a useful way to distinguish between consumer and
enterprise/server versions of Windows that otherwise have the same
version number.
2011-03-23 16:00:48 +00:00
Richard W.M. Jones
0daf7e81a6 fish: Add better quick help to --help output. 2011-03-22 11:50:26 +00:00
Richard W.M. Jones
c8faa5d0b0 fish: Add -w|--rw option to --help output. 2011-03-22 11:50:03 +00:00
Richard W.M. Jones
d06fee159c inspect: Don't fail for Windows guests with multiple disks (RHBZ#674130). 2011-03-22 11:26:34 +00:00
Richard W.M. Jones
5776c145d4 inspect: Simplify Windows root heuristic code.
Add special is_file_nocase and is_dir_nocase functions and
remove the duplicate checks for files and directories with
different cases.
2011-03-22 11:15:34 +00:00
Richard W.M. Jones
4905604390 umount-all: Use /proc/mounts instead of output of 'mount' command.
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.
2011-03-22 11:15:34 +00:00
Richard W.M. Jones
1541f3a564 guestfs(3): 'kernel' -> 'supermin appliance'. 2011-03-19 18:41:23 +00:00
Richard W.M. Jones
cf6f380c54 guestfs(3): Indent line to keep code together. 2011-03-19 18:18:56 +00:00
Richard W.M. Jones
c6f45c8975 todo: Add ntfsck. 2011-03-19 12:40:24 +00:00
Richard W.M. Jones
c6310bd242 fish: Add all stamp-*.pod files to CLEANFILES. 2011-03-18 20:02:29 +00:00
Richard W.M. Jones
ec16f13e70 Version 1.9.12. 2011-03-18 19:33:06 +00:00
Richard W.M. Jones
f4d996fd26 proto: Fix both-ends-cancel case.
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.
2011-03-18 18:27:24 +00:00
Richard W.M. Jones
33b638109e proto: Fix FileIn ops that abort during the chunk upload stage.
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 dc706a639e.
2011-03-18 17:56:45 +00:00
Richard Jones
c7368ce167 proto: Don't drop outgoing message when daemon cancels (RHBZ#576879).
This is a (potential) fix for the long standing protocol bug
which causes loss of synchronization when a FileIn action
fails very early on the daemon side.  The canonical example
would be the 'upload' action failing immediately if no filesystem
is mounted.

What's supposed to happen is this:

  (1) library sends
  request message              (2) daemon processes request
  first chunk of data          and sees that it will fail,
                               sends cancellation
                               (3) discards chunks of data
  (4) library sees daemon
  cancellation and stops
  sending chunks

It was going wrong in step (1), in guestfs___send_to_daemon.
In some (timing related) circumstances, send_to_daemon could
receive the cancellation before sending the first chunk, at
which point it would exit, *discarding the first chunk*.
This causes the daemon to fail in step (3) since it reads the
next request as if it was a chunk, thus losing synchronization.
(The protocol specifies that you always have to send at least
one chunk if there is a FileIn or FileOut parameter).

The patch changes guestfs___send_to_daemon so that if it detects
cancellation, it sends the remaining data in its output buffer
instead of discarding it.  (This also fixes another edge case
to do with sending partial data although I don't think we
ever saw that in practice).
2011-03-18 16:18:37 +00:00
Richard Jones
7fb25f53f8 daemon: Improve protocol debug messages.
This adds 'guestfsd: ...' prefix before each message, and
also puts a message at the top of the main loop just after
a new message has been received.

The intent is to make it simpler to follow the protocol.
2011-03-18 16:17:09 +00:00
Richard W.M. Jones
dc8e4b057e regressions: Enable both tests for bug 576879 (not fixed). 2011-03-18 11:22:25 +00:00
Richard W.M. Jones
1e68f84c5a daemon: Print error for invalid chunk.cancel field.
The chunk.cancel field should always be [0|1].  If it is not then
something has gone badly wrong -- probably loss of synchronization.
If this occurs print a debug message and return error from
receive_file function.
2011-03-18 11:21:55 +00:00
Richard W.M. Jones
65852011d8 proto: Improve debug messages. 2011-03-18 11:20:26 +00:00
Richard W.M. Jones
502a98948c haskell: Small fixes for ghc 7. 2011-03-18 11:19:31 +00:00
Richard W.M. Jones
e34fc32092 regressions: Rename the file we are uploading too.
This updates commit cbd8da6d4d.
2011-03-17 12:46:57 +00:00
Richard W.M. Jones
cbd8da6d4d regressions: Split the test rhbz576879.sh into two halves.
We suspect that there are in fact two separate bugs.  In any
case it makes sense for the two tests to be done separately.

Note that these tests still fail.
2011-03-17 11:57:40 +00:00
Richard W.M. Jones
eb6119da38 tests: Ignore return value from fwrite. 2011-03-16 11:50:16 +00:00
Richard W.M. Jones
6bb4d13d71 Version 1.9.11. 2011-03-15 22:06:46 +00:00
Richard W.M. Jones
7160ad148b ruby: Missing files from EXTRA_DIST. 2011-03-15 22:04:46 +00:00
Richard W.M. Jones
883390fb2e perl: Binding and test for guestfs_last_errno (RHBZ#672491). 2011-03-15 16:49:12 +00:00
Richard W.M. Jones
cf26ef818e ruby: Use ALLOC_N to avoid potential memory leak (RHBZ#667610). 2011-03-15 15:00:58 +00:00
Richard W.M. Jones
c50ed37b71 ruby: Remove unnecessary checking around StringValueCStr (RHBZ#667610). 2011-03-15 14:53:16 +00:00
Richard W.M. Jones
e9f25e693e ruby: Add rdoc documentation (RHBZ#667610). 2011-03-15 14:53:08 +00:00
Richard W.M. Jones
6a64114929 New event API - Ruby bindings (RHBZ#664558). 2011-03-15 12:16:51 +00:00
Richard W.M. Jones
bc468c87d0 New event API - Perl bindings (RHBZ#664558).
The methods $h->set_progress_callback and $h->clear_progress_callback
have been removed, and replaced with a complete mechanism for setting
and deleting general-purpose events.

This also updates virt-resize to use the new API.
2011-03-15 12:16:51 +00:00
Richard W.M. Jones
7e51cc94dd New event API - OCaml bindings (RHBZ#664558).
The functions set_progress_callback and clear_progress_callback have
been removed, and replaced with a complete mechanism for setting and
deleting general-purpose events.
2011-03-15 12:16:50 +00:00
Richard W.M. Jones
4e0cf4dbf8 New event API (RHBZ#664558).
This API allows more than one callback to be registered for each
event, makes it possible to call the API from other languages, and
allows [nearly all] log, debug and trace messages to be rerouted from
stderr.

An older version of this API was discussed on the mailing list here:
https://www.redhat.com/archives/libguestfs/2010-December/msg00081.html
https://www.redhat.com/archives/libguestfs/2011-January/msg00012.html

This also updates guestfish to use the new API for its progress bars.
2011-03-15 12:16:50 +00:00
Richard W.M. Jones
6d6b7edd11 New APIs: guestfs_first_private, guestfs_next_private to walk over
the private data area.

This commit adds new APIs for walking over the keys and pointers in
the private data area associated with each handle (note this is only
applicable to the C API).
2011-03-15 12:16:50 +00:00
Angus Salkeld
d1f1f74e5f check the pid is > 0 before calling waitpid()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-15 12:16:50 +00:00
Angus Salkeld
6f7c1a9f9d check the pid is > 0 before calling waitpid()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-14 12:05:30 +00:00
Richard W.M. Jones
eb304e9689 RHEL5: Old pod2man didn't have --stderr or -u options. 2011-03-11 10:47:05 +00:00
Richard W.M. Jones
97eab125fa configure: Remove unnecessary variable assignment.
Left over from pre-virtio-serial days.
2011-03-11 10:23:58 +00:00
Richard W.M. Jones
003fbdfe5d RHEL5: Make use of 'futimens' function optional. 2011-03-11 10:22:58 +00:00
Richard W.M. Jones
15ba6ae17d Version 1.9.10. 2011-03-08 16:22:10 +00:00
Richard W.M. Jones
c1a227a960 Detect Red Hat Desktop as 'rhel' distro (RHBZ#682979).
/etc/redhat-release on Red Hat Desktop contains the following
string:
  Red Hat Desktop release 4 (Nahant Update 8)

Previously we matched against the string "Red Hat Enterprise Linux"
but since this does not contain that string, this distro wasn't being
detected correctly.

Note this also changes the obsolete Perl code, for the benefit of
virt-v2v.
2011-03-08 08:10:19 +00:00
Richard W.M. Jones
a9d6b948b5 Include <locale.h> in compilation units that use setlocale function.
Fix required by gcc 4.6.0.
2011-03-07 19:30:31 +00:00
Richard W.M. Jones
8037da06fe generator: Introduce error code (errcode) concept.
There was a lot of repeated code to map return types (eg. RErr)
to error cases (eg. -1 or NULL).

This commit introduces an error code type and two functions to
map return types to error codes and error codes to strings.
2011-03-07 19:28:30 +00:00
Richard W.M. Jones
7c721e4fd6 Fix trace segfault for non-daemon functions (RHBZ#682756).
Previously we expanded the code for 'trace_return' unconditionally for
all non-daemon functions.  However this code was not prepared to
handle all error conditions, and in fact would segfault if it tried to
print RStringList or RHashtable where r == NULL.

We need to make the code conditional on the return value, calling
either 'trace_return' or 'trace_return_error' as appropriate.

Note the difficult case for RConstOptString which returns NULL in
non-error cases.
2011-03-07 16:42:45 +00:00
Richard W.M. Jones
2a9e345090 Fix URL of transifex instance to be the canonical one.
This updates commit 182a2ceae6.
2011-03-07 10:53:22 +00:00
Richard W.M. Jones
182a2ceae6 Import project into transifex.
http://www.transifex.net/projects/p/libguestfs/
2011-03-07 10:45:27 +00:00
Richard W.M. Jones
1c772c9211 debian: Rename nilfs2-tools to nilfs-tools. 2011-03-05 09:17:41 +00:00
Richard W.M. Jones
eda9826d25 virt-make-fs: Round disk size to integer, fix for qemu-img 0.14.
qemu-img used to allow you to specify a fractional image size in bytes
(or at least, it used to ignore the part after the decimal place).  In
qemu-img 0.14 it no longer does this so we round down the size to a
whole number of bytes.
2011-03-04 12:13:32 +00:00
Richard W.M. Jones
29b3ffdad5 virt-make-fs: In debug mode, print qemu-img command line. 2011-03-04 12:13:12 +00:00
Richard W.M. Jones
290e8864ff Version 1.9.9. 2011-03-04 10:15:49 +00:00
Richard W.M. Jones
2b26c7f721 Fix inspection code when PCRE or hivex is missing. 2011-03-03 13:23:34 +00:00
Richard W.M. Jones
21fef55ca4 java: Add a test of g.list_filesystems (a function that returns a Map). 2011-03-02 05:21:36 +00:00
Richard W.M. Jones
eb54a7ede4 java: Fix generated functions that return RHashtable.
Creating a HashMap directly from JNI is possible but very tedious
(see: http://java.sun.com/docs/books/jni/html/fldmeth.html#26254)

Instead we use the existing code to return hashes from JNI as plain
String[], then add some code in the Java wrapper to convert these to
HashMap<String,String>.
2011-03-02 05:21:36 +00:00
Richard W.M. Jones
0b2e45da60 java: Return Map<String,String> for RHashtable functions.
There's no point returning the specific HashMap type here.
Return the generic interface type instead.

Note that no users are actually calling these functions yet,
since at present they always fail.
2011-03-02 05:21:36 +00:00
Richard W.M. Jones
ec62f1127e java: Fix a minor whitespace error in generated code.
In functions that don't have javadoc, the function prototype wasn't
being indented correctly.
2011-03-02 05:21:27 +00:00
Richard W.M. Jones
80aad70995 java: Remove old test file if one was left around.
If a test.img file was left over from a previous run, then it
would cause the subsequent test to fail.  Therefore remove any
old test.img file.
2011-03-02 05:11:55 +00:00
Richard W.M. Jones
db98ac041e java: Enable assertions when doing 'make check'.
It turns out that Java assertions are disabled by default.  You have
to add the 'java -ea' flag to the JVM.  Who knew ..?

Because of this oversight, the tests weren't actually performing the
assertions that we wanted (although in fact none of the assertions
were failing).

This change enables assertions when running the tests.
2011-03-02 05:11:55 +00:00
Richard W.M. Jones
f455dc3814 Version 1.9.8. 2011-02-06 17:18:24 +00:00
Richard W.M. Jones
8d7d7c4ecf daemon: Ignore return value from chdir.
This updates commit 7eb012f371.
2011-02-03 19:33:30 +00:00
Richard W.M. Jones
a20e5c00c3 fish: Add guestfish --live, guestmount --live options.
The other programs have the variable, but the flag is not enabled
either because it doesn't make sense or because the implications are
not well understood.
2011-02-03 18:50:45 +00:00
Richard W.M. Jones
2020eded8a Add documentation for attach method. 2011-02-03 18:50:45 +00:00
Richard W.M. Jones
cfd9513a54 Add guestfs_add_domain 'live' flag.
This optional flag controls whether this API call will try to connect
to a running virtual machine 'guestfsd' process.

If the flag is given and the virtual machine is running, then the
libvirt XML is parsed looking for a suitable <channel> element, and
'guestfs_set_attach_method' is called with the corresponding
virtio-serial socket path.
2011-02-03 18:50:45 +00:00
Richard W.M. Jones
17434fb159 lib: Implement attach-method unix:<path>
Allow connections to a Unix domain socket which is connected
(via virtio-serial) to a guestfsd running free in an existing
guest.

In order to use this you have to add the following element
to the libvirt XML:

  <channel type='unix'>
    <source mode='bind' path='/tmp/socket'/>
    <target type='virtio' name='org.libguestfs.channel.0'/>
  </channel>

(or perform the equivalent on the qemu command line).

Then in guestfish, you can do:

  guestfish \
    attach-method unix:/tmp/socket : \
    run : \
    ll /

(or any other commands as desired).
2011-02-03 18:50:45 +00:00
Richard W.M. Jones
91324e0a73 daemon: Remove -f (don't fork) option.
This option was not being used.
2011-02-03 18:50:44 +00:00
Richard W.M. Jones
338ecaac05 daemon: Allow -r option to run daemon standalone.
This changes several aspects of the daemon.  Currently:

* sysroot will be "" (ie. operate directly on /)
* CHROOT_IN/CHROOT_OUT are disabled
* autosync doesn't try to unmount everything
2011-02-03 18:50:44 +00:00
Richard W.M. Jones
7eb012f371 daemon: change to root directory
Ensure the daemon always starts with current directory == root.
2011-02-03 18:50:17 +00:00
Richard W.M. Jones
58bcfdf321 New APIs: set-attach-method, get-attach-method.
These allow you to get and set the attach method.  The format
is one of:

* appliance
* unix:<path>

It's stored broken out into an enum and a string in the handle.
2011-02-03 18:41:49 +00:00
Richard W.M. Jones
99f0d8859f lib: Move appliance launching to separate function.
This is just code motion.
2011-02-03 18:41:49 +00:00
Richard W.M. Jones
5ae7525592 php: Ignore another generated file in php/extension directory. 2011-02-03 10:56:01 +00:00
Richard W.M. Jones
61a1a2b71c daemon: Parse /proc/mounts instead of /etc/mtab
Since Fedora util-linux 2.19, the %post script does:

  rm -f /etc/mtab
  ln -s /proc/mounts /etc/mtab

We are no longer running %post scripts, so this means that /etc/mtab
is a plain file in the appliance.  Usual 'mount' still updates it, but
for some reason mount.ntfs does *not* update it in Fedora 15, meaning
that you couldn't mount and then operate on NTFS partitions.

It seems better to always parse /proc/mounts (ie. what the kernel
thinks is mounted) unconditionally, rather than relying on the
capriciousness of the external mount command.

Therefore, parse /proc/mounts instead of /etc/mtab, but add a note
saying that in future we should really be parsing
/proc/self/mountinfo, but that needs a custom parser, and the format
is rather tricky:

http://lxr.linux.no/#linux+v2.6.37/Documentation/filesystems/proc.txt#L1462
2011-02-03 09:47:48 +00:00
Richard W.M. Jones
f2a4020caf regressions: Fix rhbz557655.sh so it works with tracing enabled. 2011-02-03 09:14:12 +00:00
Richard W.M. Jones
5079e0fff3 guestfs-perl: Fix missing \n
This updates commit 477eebc83d.
2011-01-31 09:34:47 +00:00
Richard W.M. Jones
ff60650633 Version 1.9.7. 2011-01-30 23:53:54 +00:00
Richard W.M. Jones
0089575d4b virt-make-fs: Fix typo in man page. 2011-01-30 23:53:04 +00:00
Richard W.M. Jones
477eebc83d perl: Translate C examples into Perl and include a manual page. 2011-01-30 23:41:05 +00:00
Richard W.M. Jones
6975e87153 perl: Ignore internal_* functions in POD coverage test.
This updates commit 1d999540bd.
2011-01-29 07:01:06 +00:00
Richard W.M. Jones
b6c70b3f50 Fix test-guestfish-a.sh regression test for new trace format.
This fixes commit 1d999540bd.
2011-01-28 22:51:36 +00:00
Richard W.M. Jones
f060d5bcd4 autobuild: Add a 'make clean' step. 2011-01-28 21:41:16 +00:00
Richard W.M. Jones
82f5fdb0db lib: Fix use-after-free bug in XPath parsing code. 2011-01-28 18:57:34 +00:00
Richard W.M. Jones
d2636b0984 Add a new internal-autosync API to perform autosync.
Instead of explicitly calling umount-all; sync, we add a daemon
function called internal-autosync which does the same.

Apart from slightly simplifying the process of closing the handle, the
main advantage is we can modify the daemon for the standalone case so
that internal-autosync does not do the umount-all operation.
2011-01-28 15:28:25 +00:00
Richard W.M. Jones
1d999540bd Add a prefix to output when tracing (RHBZ#673479).
Also separate the call and return lines so that everything can be
easily 'grepped' from debug output.  The trace output now looks like
this:

$ guestfish -x -N fs exit
libguestfs: trace: is_config
libguestfs: trace: is_config = 1
libguestfs: trace: add_drive "test1.img"
libguestfs: trace: add_drive = 0
libguestfs: trace: is_config
libguestfs: trace: is_config = 1
libguestfs: trace: launch
libguestfs: trace: launch = 0
libguestfs: trace: part_disk "/dev/sda" "mbr"
libguestfs: trace: part_disk = 0
&c.
2011-01-28 11:51:54 +00:00
Richard W.M. Jones
77df7d6d53 daemon: Replace root_mounted global with intelligence.
We used to maintain a global flag 'root_mounted' which tells us if the
user has mounted something on root (ie. on the sysroot directory).

This flag caused a lot of trouble (eg. RHBZ#599503) because it's hard
to keep the flag updated correctly when the user can do arbitrary
mounts and also use mkmountpoint.

Remove this flag and replace it with a test to see if something is
mounted on *or under* the sysroot.  (It has to be *or under* because
of mkmountpoint and friends).

This also replaces a rather convoluted "have we mounted root yet"
check in the mount* APIs with a simpler check to see if the mountpoint
exists and is an ordinary directory.
2011-01-27 18:08:45 +00:00
Richard W.M. Jones
e85fbee7bf daemon: Add perror to two exit paths to make errors clearer. 2011-01-27 15:55:12 +00:00
Richard W.M. Jones
8a406c7bee debian: Include actual shared libraries in python-guestfs package. 2011-01-27 09:47:44 +00:00
Nikita A Menkovich
92b74729e2 mkfs-opts: Add optional "features" parameter.
This allows the -O parameter to be added to the mkfs command line.
This is used to select filesystem features.
2011-01-26 15:34:01 +00:00
Nikita A Menkovich
dd653336cc mkfs-opts: Add a note about blocksize param and UFS filesystems. 2011-01-26 15:32:18 +00:00
Richard W.M. Jones
2110f6fa8c generator: Fix generation of library-side stubs with optional String arguments. 2011-01-26 14:15:23 +00:00
Richard W.M. Jones
c76f155496 packagelist: Add ufsutils for Debian and Ubuntu.
Note there is no mkfs.ufs available for Fedora (see RHBZ#541618
for details).
2011-01-26 10:00:44 +00:00
Richard W.M. Jones
36fe0acf8a Version 1.9.6. 2011-01-22 18:05:35 +00:00
Richard W.M. Jones
e8ab05b12c fish: Fix typo in error message (copy-in should be copy-out). 2011-01-22 14:46:37 +00:00
Richard W.M. Jones
78f1405de0 Use /var/tmp for the cached appliance (for FHS compliance).
The FHS advises large files not to be stored in the root
filesystem[1], and that /var/tmp is persistent across reboots[2]
(whereas /tmp is possibly not[3]).

Therefore we should store the large cached supermin appliance in
/var/tmp instead of /tmp.  /tmp is still used for all other temporary
files and directories.

In either case you can override this by setting $TMPDIR.

[1] http://www.pathname.com/fhs/pub/fhs-2.3.html#THEROOTFILESYSTEM
[2] http://www.pathname.com/fhs/pub/fhs-2.3.html#VARTMPTEMPORARYFILESPRESERVEDBETWEE
[3] http://www.pathname.com/fhs/pub/fhs-2.3.html#TMPTEMPORARYFILES
2011-01-19 21:47:23 +00:00
Richard W.M. Jones
316ad8311a fish: Initialize pcmd structure.
On Debian we get this warning which I'm pretty sure is bogus:

fish.c:690: error: 'pcmd.cmd' may be used uninitialized in this
function [-Wuninitialized]
2011-01-18 22:38:05 +00:00
Richard W.M. Jones
41bbc0a7a3 Version 1.9.5 2011-01-18 13:34:07 +00:00
Richard W.M. Jones
c3887285ab fish: <! cmd executes a shell command and inlines the resulting commands.
The new guestfish construct "<! cmd" executes the shell command
"cmd", and then anything printed to stdout by "cmd" is parsed
and executed as a guestfish command.

This allows some very hairy shell scripting with guestfish.
2011-01-18 13:16:28 +00:00
Richard W.M. Jones
61a4db138e fish: Factor out command line parsing.
Factor out the code which splits a string into a command line.
2011-01-18 11:24:38 +00:00
Richard W.M. Jones
4bcb267a24 fish: Make exit_on_error into a completely local variable.
Note that 'time' and 'glob' (which both run subcommands) do not
correctly pass the exit_on_error flag in the remote case.  This is not
a regression: the current code doesn't work either.
2011-01-18 10:33:01 +00:00
Richard W.M. Jones
f6a21c1e0d fish: exit_on_error is a local variable. 2011-01-18 10:21:49 +00:00
Richard W.M. Jones
deadcc7326 todo: Live CD inspection works, but not for Windows 7. 2011-01-15 16:40:49 +00:00
Richard W.M. Jones
07f1be28e8 Version 1.9.4. 2011-01-15 14:57:52 +00:00
Richard W.M. Jones
bc93d2ba38 README: Note that po4a is mandatory if compiling from git. 2011-01-15 14:56:25 +00:00
Richard W.M. Jones
c2f2a2c676 Add ability to inspect install disks and live CDs.
For examples of the virt-inspector output, see the additional
inspector/example-*.xml files in this commit.
2011-01-15 14:35:50 +00:00
Richard W.M. Jones
4402e6048f inspect: Add macros for file size limits.
This also bumps the file size limit for "small text files"
up to 2 MB, since we want to parse Windows CD txtsetup.sif
files that are usually around 500K in size.
2011-01-15 13:19:26 +00:00
Nikita A Menkovich
4ffa2d6798 New API: resize2fs-M to resize ext2/3/4 to minimum size. 2011-01-14 13:40:17 +00:00
Richard W.M. Jones
69f2f62900 Version 1.9.3. 2011-01-11 21:54:57 +00:00
Richard W.M. Jones
e5220b26f5 df: Skip final '/' character when calculating basename.
Previously it was including the final '/' character when calculating
the basename for the -a option eg:

Filesystem                                Size       Used  Available  Use%
/Ubuntu1010x64:/dev/sda1                  9.4G       2.3G       6.6G   25%

With this patch the '/' is not printed.
2011-01-11 13:55:23 +00:00
Richard W.M. Jones
0c60e4d9dd fish: Don't fail if some mountpoints in /etc/fstab are bogus (RHBZ#668574).
Fix guestfish (and other C tools) so that they ignore errors
when /etc/fstab contains bogus entries.

Update the documentation for inspect-get-mountpoints to emphasize
that callers must be aware of this when mounting the returned
values.

Add a regression test.

Update the example code ("inspect_vm") to reflect the way this
API ought to be called.

For more detail see:
https://bugzilla.redhat.com/show_bug.cgi?id=668574
2011-01-11 11:09:41 +00:00
Richard W.M. Jones
fc241abdba Add logo used on the website. 2011-01-11 10:47:33 +00:00
Richard W.M. Jones
a2bf709b3c Add cartoon fish logo (not completed). 2011-01-10 10:41:20 +00:00
Richard W.M. Jones
844d7f5755 todo: /proc/self/mountinfo 2011-01-09 13:13:02 +00:00
Richard W.M. Jones
62d4f2550d todo: Add notes on inspecting ISO images. 2011-01-08 20:51:58 +00:00
Richard W.M. Jones
97339a0f43 virt-filesystems: Ignore errors when getting label and UUID (RHBZ#668112).
If virt-filesystems was pointed to an image that contained
bogus or blank filesystems, then calls to vfs-label and/or vfs-uuid
could fail, resulting in errors like this:

libguestfs: error: vfs_label: /dev/vda1:

These errors can be ignored and shouldn't stop virt-filesystems
from working.
2011-01-08 10:15:39 +00:00
Richard W.M. Jones
7e1114445e resize: Fix typo in man page (thanks avesh@IRC). 2011-01-07 20:38:55 +00:00
Richard W.M. Jones
7ce627fce0 fish: fails to tilde expand '~' when $HOME env is unset (RHBZ#617440).
This also adds a regression test.
2011-01-04 16:18:27 +00:00
Richard W.M. Jones
a980250918 fish: Fix off-by-one bug in tilde expansion.
Although this doesn't seem to cause a crash, valgrind confirms
that this is a genuine off-by-one bug.  It could potentially
cause a crash if you did:

  echo 'echo ~root/foo' | guestfish
2011-01-04 16:02:48 +00:00
Richard W.M. Jones
04a9645ca6 Version 1.9.2. 2011-01-03 18:23:49 +00:00
Richard W.M. Jones
b8f9a20b03 New tools: virt-copy-in, virt-copy-out, virt-tar-in, virt-tar-out.
Relatively trivial wrappers around the equivalent guestfish
commands.  Change also includes new man pages.
2011-01-03 18:23:45 +00:00
Richard W.M. Jones
72f4b2e749 .gitignore: Use full paths for some ignored files. 2011-01-03 17:18:31 +00:00
Richard W.M. Jones
1b1db82d64 docs: Add QMP to ROADMAP file. 2011-01-03 14:36:19 +00:00
Richard W.M. Jones
440cd23f54 filesystems: Document the columns in --long output. 2011-01-02 22:55:48 +00:00
Richard W.M. Jones
9ae4168c30 Add initial announcement to release notes. 2011-01-02 21:43:22 +00:00
Richard W.M. Jones
f13f338600 Update TODO file. 2011-01-02 21:01:43 +00:00
Richard W.M. Jones
dd7ad7c7eb inspector: Apps in Windows VMs are now listed - update documentation. 2011-01-02 21:01:41 +00:00
Douglas Schilling Landgraf
f07a0b6f1e Lib.pm: unknown filesystem /dev/hd{x} (cdrom) (RHBZ#666577)
This a purpose patch to avoid the message "unknown filesystem /dev/hdc".
Where /dev/hdc is an entry in fstab for CDROM.

Example of fstab:
/dev/hdc                /media/cdrom            auto
pamconsole,exec,noauto,managed 0 0

https://bugzilla.redhat.com/show_bug.cgi?id=666577

Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
2011-01-02 18:58:19 +00:00
Douglas Schilling Landgraf
5cab0d6c80 Lib.pm: unknown filesystem label SWAP-sda2 (RHBZ#666578)
Hi,

This is a purpose patch to avoid the message: unknown filesystem label
SWAP-sda2.

Instead of validate the label with 'eq', use '=~' and /$label/i.

https://bugzilla.redhat.com/show_bug.cgi?id=666578

Thanks
Douglas
2011-01-02 18:58:09 +00:00
Douglas Schilling Landgraf
e99ac0394a Lib.pm: avoid message "unknown filesystem /dev/fd0" (RHBZ#666577)
This patch to avoid the message "unknown filesystem /dev/fd0".
https://bugzilla.redhat.com/show_bug.cgi?id=666577

Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>

Thanks
Douglas
2011-01-02 18:57:55 +00:00
Richard W.M. Jones
62c47b7431 Tempora mutantur, nos et mutamur in illis. 2011-01-02 16:50:39 +00:00
Richard W.M. Jones
5c9e8a65fe podwrapper: Fix up the HTML output so most inter-page links work. 2010-12-31 11:11:02 +00:00
Richard W.M. Jones
d71faf9862 podwrapper: Fix script indentation. 2010-12-31 10:44:32 +00:00
Richard W.M. Jones
7a8c60e1c8 podwrapper: 'builddir' was not defined - use a properly defined path. 2010-12-31 10:39:05 +00:00
Richard W.M. Jones
2dbd22727d Version 1.9.1. 2010-12-31 08:41:44 +00:00
Richard W.M. Jones
ce85a6a82a docs: add-domain: Remove ref to not impl add-libvirt-dom API call. 2010-12-30 23:32:09 +00:00
Richard W.M. Jones
86a53e17de docs: Refresh programming language list in guestfs(3). 2010-12-30 23:14:12 +00:00
Richard W.M. Jones
33e9639f20 docs: Refresh programming language equivalence example in guestfs(3). 2010-12-30 23:08:18 +00:00
Richard W.M. Jones
cdc798ac35 docs: Fix missing g handle in guestfs(3) man page. 2010-12-30 22:56:25 +00:00
Richard W.M. Jones
22042693cc docs: Refresh guestfs(3)/DOWNLOADING. 2010-12-30 22:56:07 +00:00
Richard W.M. Jones
1a9b7df8f2 docs: Refresh guestfs(3)/MOUNTING 2010-12-30 22:46:29 +00:00
Jaswinder Singh
3f4dc56a32 Update Punjabi translations (RHBZ#665358). 2010-12-23 13:45:26 +00:00
Richard W.M. Jones
49b2ae2e69 recipes: Refresh guestfish recipes. 2010-12-21 17:23:08 +00:00
Piotr Drąg
b1ca8b5fbb Updated Polish translation (RHBZ#502533). 2010-12-21 13:42:27 +00:00
Richard W.M. Jones
327442119f fish: --ro will be default in 1.10, not 1.8. 2010-12-20 22:33:45 +00:00
Richard W.M. Jones
e32a85cf93 docs: Update API support. 2010-12-19 22:09:40 +00:00
Richard W.M. Jones
7ba1b55aa7 api-support: Fix detection of similar APIs.
Because we didn't match on word boundaries, the previous
code would get confused by similar APIs, eg. getxattr vs getxattrs.
2010-12-19 22:09:40 +00:00
Richard W.M. Jones
d2400da92e docs: Obsolete HACKING file, move content into guestfs(3) man page.
Add a new section called "EXTENDING LIBGUESTFS" to the
guestfs manual page which contains all the information
previously in "HACKING".
2010-12-19 21:53:09 +00:00
Richard W.M. Jones
84fbe21855 docs: Refresh README file. 2010-12-19 21:52:46 +00:00
Richard W.M. Jones
dfbdae5dd2 Update TODO file. 2010-12-19 19:29:02 +00:00
Richard W.M. Jones
8df8ccb287 Version 1.9.0. 2010-12-19 15:53:45 +00:00
Richard W.M. Jones
fc279d2806 Update BUGS, PO files for 1.8.0. 2010-12-19 15:39:04 +00:00
Richard W.M. Jones
48eb763d85 Prepare for next stable branch: version 1.8.0. 2010-12-19 14:31:01 +00:00
Richard W.M. Jones
b62e154d97 Update RELEASE-NOTES. 2010-12-19 14:25:50 +00:00
Richard W.M. Jones
e427d86de1 Add ROADMAP for 1.10. 2010-12-19 14:20:17 +00:00
Richard W.M. Jones
85c0bf5308 fuse: Add more tracing for calls into guestmount functions. 2010-12-19 12:04:43 +00:00
Richard W.M. Jones
2712f237b0 appliance: Don't exclude upstart (/sbin/reboot) (RHBZ#661280).
Don't exclude upstart from the appliance.  It provides /sbin/reboot
which is required by virt-rescue.
2010-12-19 11:01:59 +00:00
Richard W.M. Jones
da24e7aab0 appliance: Don't hard-code febootstrap --exclude parameters.
Create a separate file 'excludelist.in' that contains these
regular expressions, and process it the same way as packagelist.in.
2010-12-19 10:57:06 +00:00
Richard W.M. Jones
9556903888 appliance: Use a temporary file when processing packagelist.in. 2010-12-19 10:55:03 +00:00
Richard W.M. Jones
acd25281bf docs: Add section on using /dev/fd/* with upload and download calls. 2010-12-17 18:56:42 +00:00
Richard W.M. Jones
fa4931bc4e docs: Fix link to function in documentation of "du" and "du-s" commands. 2010-12-17 10:21:41 +00:00
Richard W.M. Jones
8ae40fa990 Version 1.7.24. 2010-12-16 23:21:29 +00:00
Richard W.M. Jones
933e970b8a ntfs-3g: Document problems with symlinks and alternatives (RHBZ#663407). 2010-12-16 20:27:09 +00:00
Richard W.M. Jones
3a3836b933 New APIs: getxattr and lgetxattr to get single extended attributes.
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
2010-12-16 20:05:48 +00:00
Richard W.M. Jones
236c1fb7db appliance: Add 'attr' package for xattr support in virt-rescue. 2010-12-16 18:45:08 +00:00
Richard W.M. Jones
dec770f171 generator: List files generated in a separate file. 2010-12-12 23:19:36 +00:00
Richard W.M. Jones
9aacbe712d docs: Update RELEASE-NOTES to latest. 2010-12-12 23:02:44 +00:00
Richard W.M. Jones
0d267d6cd5 README: Advise using febootstrap >= 3.3. 2010-12-12 23:02:30 +00:00
Richard W.M. Jones
573e01e087 Version 1.7.23. 2010-12-12 22:36:06 +00:00
Thomas S Hatch
6e87419597 Removed hfsprogs from supermin packages for Arch 2010-12-12 18:30:17 +00:00
Richard W.M. Jones
e49aefd1f8 fish: Clarify documentation for --ro option. 2010-12-12 10:02:00 +00:00
Richard W.M. Jones
e6a3770b43 fish: Document equivalence of -a/add etc. in man page. 2010-12-12 10:01:30 +00:00
Richard W.M. Jones
f341624668 fish: Split ..|.. options into separate items in man page. 2010-12-12 09:48:59 +00:00
Richard W.M. Jones
a6bfc9f3c4 appliance: Don't set utime on cachedir until we know it is safe.
This could be used to touch an arbitrary file (albeit one which
must already exist), and this could have been a security problem.
2010-12-11 23:35:50 +00:00
Richard W.M. Jones
f410d571cc appliance: Touch cached appliance files so they don't get tmp cleaned. 2010-12-11 23:33:22 +00:00
Richard W.M. Jones
3d114fcf84 Remove extra \n character from end of error messages. 2010-12-11 23:07:56 +00:00
Richard W.M. Jones
52c6b0d96d Version 1.7.22. 2010-12-11 18:08:08 +00:00
Richard W.M. Jones
4beb284409 appliance: Be careful about cleaning up old appliances.
This change resolves several issues with current appliance
building:

(1) Old appliances are cleaned up.

(2) Race conditions between appliance building is handled better.

(3) Several bugs fixed.
2010-12-11 17:22:43 +00:00
Richard W.M. Jones
363978fa7f daemon: Use prog_exists to check for features.
This updates commit 0938509e04.
2010-12-10 17:38:17 +00:00
Richard W.M. Jones
4fb66110c2 debian: Work around warning in Debian udev init script.
See also:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=606622
2010-12-10 17:19:02 +00:00
Richard W.M. Jones
8d8dc4c107 win-reg: Add Windows Tips to documentation. 2010-12-10 15:12:02 +00:00
Richard W.M. Jones
bc484e99c2 win-reg: Move documentation after options, combine shell quote sections. 2010-12-10 14:36:18 +00:00
Richard W.M. Jones
b4310a810c Version 1.7.21. 2010-12-10 13:44:25 +00:00
Richard W.M. Jones
d72815578f Remove several unused local variables.
(Revealed by compiling under Debian where this is a warning).
2010-12-10 12:19:49 +00:00
Thomas S Hatch
8dafeaa477 Added packages for Archlinux support 2010-12-10 09:29:27 +00:00
Richard W.M. Jones
4164e99664 debian: Dependencies for all the different names of qemu/KVM. 2010-12-09 18:31:23 +00:00
Richard W.M. Jones
1d4f1ba129 debian: Quilt is not used for patch management. 2010-12-09 18:31:03 +00:00
Richard W.M. Jones
ff99f399f0 cat: Remove some unused local variables in virt-cat.c and virt-ls.c. 2010-12-09 18:30:08 +00:00
Richard W.M. Jones
8e7012131c Add debian/ directory (temporarily).
This was created initially from pkg-libvirt/libguestfs.git
commit 680ff0b0e8c9133ef987e68392bd3990715f6891.

This is a temporary measure to allow us to build Debian and Ubuntu
packages more easily.  When downstream packaging is being done on
these distros we will remove this directory again.

To build a Debian package, use this command:

  debuild -i -us -uc -b
2010-12-09 16:41:40 +00:00
Richard W.M. Jones
b5516dc9d4 debian: Exclude file-rc.
This package duplicates /etc/init.d/README which is
really supplied by sysv-rc package.
2010-12-09 16:41:40 +00:00
Richard W.M. Jones
ff484e0053 build: Use ./configure --with-python-installdir=DIR to select Python dir.
We don't always want to install in the site-packages directory.  Allow
the directory to be chosen using a configure option.  Rename the
variable PYTHON_INSTALLDIR to reflect its true purpose.
2010-12-09 16:41:40 +00:00
Richard W.M. Jones
8ea322aba3 build: Add "checking ... result" around Python tests. 2010-12-09 16:41:40 +00:00
Richard W.M. Jones
8e4c22db23 build: Remove check for root.
With the new package building system, it is no longer dangerous to run
'configure', 'make' or 'make check' as root (although it is still not
necessary and not advisable).  In any case we don't need to check
this.
2010-12-09 16:41:40 +00:00
Richard W.M. Jones
75893a554c inspector: Remove some unused local variables. 2010-12-09 16:41:40 +00:00
Richard W.M. Jones
5376e13806 fish: Remove some unused local variables. 2010-12-09 11:55:23 +00:00
Richard W.M. Jones
370f79fd3d build: Remove AM_GNU_GETTEXT_VERSION macro.
See discussion on the mailing list:
https://www.redhat.com/archives/libguestfs/2010-December/thread.html#00032
2010-12-09 10:59:23 +00:00
Richard W.M. Jones
f3805e2166 rescue: Add notes about networking.
In particular the 'ping' command does not work because it is
using QEMU user networking.
2010-12-08 12:12:08 +00:00
Richard W.M. Jones
c5747bd436 rescue: Add note about using virt-rescue as root/non-root. 2010-12-08 12:11:53 +00:00
Richard W.M. Jones
df5ae67129 docs: Link to guestfs-examples(3) after simple example. 2010-12-07 22:16:02 +00:00
Richard W.M. Jones
917c3520c7 docs: Note that guestfs_sync is no longer necessary. 2010-12-07 22:15:45 +00:00
Richard W.M. Jones
4b8f70d46d Version 1.7.20. 2010-12-07 18:41:40 +00:00
Richard W.M. Jones
70a92b3cfb build: relink-static.sh script removed from EXTRA_DIST.
This updates commit 9bc15f5d98.
2010-12-07 18:39:11 +00:00
Richard W.M. Jones
0942cab037 ubuntu: deactivate LVs and VGs before removing them.
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.
2010-12-07 17:57:08 +00:00
Richard W.M. Jones
1c63d8239a Revert "umount-all: Add udev_settle after unmounting disks."
This reverts commit ad2abf89c3.

Ubuntu still has errors even with the addition of udev_settle
after umount-all.  Therefore this was just masking the problem.
2010-12-07 17:57:07 +00:00
Richard W.M. Jones
0938509e04 debian: Fix ntfs3g available API on Debian.
Really we should have a test for "is program on $PATH?" but this
fix will do for now.
2010-12-07 17:04:36 +00:00
Richard W.M. Jones
37a2422868 fuse: Set UID and GID when performing FUSE tests.
This avoids breakage on Ubuntu.
2010-12-07 17:16:52 +00:00
Richard W.M. Jones
fd4d0d83f1 autobuild: Skip some tests on Ubuntu. 2010-12-07 16:24:35 +00:00
Richard W.M. Jones
d29304c1b4 ubuntu: Allow test-luks.sh to be bypassed to workaround Ubuntu bug.
This is necessary because of too old cryptsetup on Ubuntu.
2010-12-07 16:24:34 +00:00
Richard W.M. Jones
ad2abf89c3 umount-all: Add udev_settle after unmounting disks.
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.
2010-12-07 16:24:34 +00:00
Richard W.M. Jones
4df67f26ae fuse: Disable test which doesn't run reliably on Debian.
See discussion in RHBZ#660687.
2010-12-07 15:29:55 +00:00
Richard W.M. Jones
de419e4bac fuse: Fix emulation of open call.
We were being over-complex in this call.  All the FUSE API requires
this call to do is to check permissions.
2010-12-07 14:49:34 +00:00
Richard W.M. Jones
97cbb84236 fuse: Fix segfault in guestmount --verbose.
If hash_delete returns NULL and --verbose option was given then
this would cause a segfault.
2010-12-07 13:29:40 +00:00
Richard W.M. Jones
4c5038ab54 Add autobuild script. 2010-12-07 11:26:43 +00:00
Richard W.M. Jones
c45b5e7230 gitignore: Ignore all local* files in the main directory. 2010-12-07 11:01:13 +00:00
Richard W.M. Jones
1e78cd1690 appliance: Don't quote the --exclude parameters.
The quotes appear literally on the command line:

$ s="--foo 'bar'"
$ echo $s
--foo 'bar'
2010-12-06 22:04:27 +00:00
Richard W.M. Jones
53853f717c Add --with-febootstrap-yum-config.
This allows the febootstrap --yum-config option to be passed through,
allowing a separate yum configuration to be used.

The hope is that this will enable building in Koji.
2010-12-06 22:04:27 +00:00
Richard W.M. Jones
9bc15f5d98 Remove ability to build static distribution.
We are now going to build binaries for each distribution so
there is no need to build the quasi-distro-independent static
binaries any more.
2010-12-06 18:17:30 +00:00
Richard W.M. Jones
7eaecf8303 regressions: Disable test for 576879.
This test has worked only intermittently for a while.  Disable
it.  The upstream bug has been reopened.
2010-12-06 16:46:00 +00:00
Richard W.M. Jones
1d29fc2932 build: Use grub-pc instead of old grub on Debian and Ubuntu. 2010-12-06 16:17:47 +00:00
Richard W.M. Jones
2ed6a02af6 build: Add diff to package list for Debian and Ubuntu. 2010-12-06 15:02:04 +00:00
Richard W.M. Jones
1719b764fe build: Add cpio package to package list (for Debian and Ubuntu). 2010-12-06 15:02:04 +00:00
Richard W.M. Jones
e79f143180 build: Look for other db_dump variations (for Ubuntu). 2010-12-06 15:04:12 +00:00
Richard W.M. Jones
095433f7b0 ubuntu: Disable xfsprogs from Ubuntu package list. 2010-12-06 14:32:50 +00:00
Richard W.M. Jones
227c9a4bca ubuntu: Make Ubuntu into a separate distro for the package list.
This allows us to select Ubuntu packages separately from Debian ones.
2010-12-06 14:32:50 +00:00
Richard W.M. Jones
0bb4208467 build: Don't emit warnings about stack protector failures.
These are seen on gcc 4.5.1 used in Ubuntu.
2010-12-06 14:32:50 +00:00
Richard W.M. Jones
34fe8095c5 debian: Enable more packages in packagelist.in.
These were previously disabled because of problems with
debirf.  Now we are not using debirf, we can use them
again.
2010-12-06 13:40:27 +00:00
Richard W.M. Jones
194bacbe2a Version 1.7.19. 2010-12-05 11:23:27 +00:00
Richard W.M. Jones
8227537100 Debian: Extra packages needed to run C API tests. 2010-12-05 11:23:27 +00:00
Richard W.M. Jones
6d75ce8e6c appliance: Change to using febootstrap 3.x supermin appliance.
This removes all support for building the ordinary / old
style appliance using febootstrap 2.x, debootstrap, debirf,
fakeroot and fakechroot.

Instead this uses febootstrap 3.x to build the supermin appliance
in a simpler cross-distro manner.
2010-12-05 11:23:23 +00:00
Richard W.M. Jones
078fbee4e7 appliance: Put /init in a separate supermin appliance component. 2010-12-04 19:07:15 +00:00
Richard W.M. Jones
85ba859aa8 appliance: Don't look for kmod.whitelist.
This file is not used for building the supermin appliance.
2010-12-04 19:06:39 +00:00
Richard W.M. Jones
0710326ac5 New API: mkfs_opts, mkfs with optional arguments.
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.
2010-12-02 13:43:18 +00:00
Richard W.M. Jones
65f44b4590 generator: Code to handle optional arguments in daemon functions.
Previously we only supported optional arguments for library
functions (commit 14490c3e1a).

This extends that work so that optional arguments can also be
passed through to the daemon.
2010-12-02 13:32:40 +00:00
Richard W.M. Jones
01d62985c3 fish: Fix generation of code to handle Int/Int64 optional arguments. 2010-12-02 13:31:52 +00:00
Richard W.M. Jones
faf1cd5049 Fix argv struct mixup over Int/Int64. 2010-12-02 11:35:57 +00:00
Richard W.M. Jones
3451d73a69 todo: Refresh documentation. 2010-12-02 10:23:30 +00:00
Richard W.M. Jones
9f2135c4e4 Version 1.7.18. 2010-12-01 18:00:17 +00:00
Richard W.M. Jones
8022d46e5e Add progress notification messages to upload and upload-offset APIs. 2010-12-01 13:35:32 +00:00
Richard W.M. Jones
11be64049b protocol: Handle progress notification messages during FileIn.
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.
2010-12-01 13:35:32 +00:00
Richard W.M. Jones
8bfca99b9a protocol: Really read 4 bytes while checking for cancellation.
We've not actually hit this bug in practice, but at least in
theory while checking for cancellation we could read > 0 but
fewer than 4 bytes, which would effectively be discarded and
we would lose synchronization.

Note the socket is non-blocking.

Change the code so that we temporarily set the socket back to
blocking and force the read of all 4 bytes.
2010-12-01 13:35:32 +00:00
Richard W.M. Jones
7e523077d6 protocol: Send progress_hint in header.
For actions that have FileIn arguments, count the size of all
the input files and send that in the progress_hint field of the
request header.
2010-12-01 13:35:32 +00:00
Richard W.M. Jones
3aa8182c3c protocol: Upload progress messages and optional arguments.
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).
2010-12-01 13:34:28 +00:00
Richard W.M. Jones
fdc8805362 df: Fix segfault when using virt-df -a filename
If 'filename' doesn't contain a '/' character then virt-df
was calculating NULL as the basename and later segfaulting.
2010-11-30 16:52:48 +00:00
Richard W.M. Jones
8d28fe0ef2 Version 1.7.17. 2010-11-30 15:01:29 +00:00
Richard W.M. Jones
b79e075d63 php: Combine tests to reduce number of launches. 2010-11-30 14:18:34 +00:00
Richard W.M. Jones
2860b21ee1 haskell: Combine tests to reduce number of launches. 2010-11-30 14:10:40 +00:00
Richard W.M. Jones
aba7cad7df java: Combine tests to reduce number of launches. 2010-11-30 14:06:27 +00:00
Richard W.M. Jones
b034795a25 python: Combine tests to reduce number of launches. 2010-11-30 13:59:50 +00:00
Richard W.M. Jones
13af3835cd ocaml: Combine tests together to reduce number of launches.
Combine launch, lvcreate and readdir tests together into a
single 'basic' test, so that we don't launch the appliance
so often when testing in this subdirectory.
2010-11-30 13:56:33 +00:00
Richard W.M. Jones
61a0f79884 capitests: Convert many InitBasicFS tests to InitScratchFS.
These tests run much more quickly if you don't have to run
'mkfs' and (particularly) partitioning/LV commands between each
test.

The total time for running 'make -C capitests check' on my laptop
has gone from 413 seconds down to 221 seconds.
2010-11-30 12:42:55 +00:00
Richard W.M. Jones
f93cdf1ed3 capitests: Add 'InitScratchFS' test environment.
This should allow us to perform filesystem-based write
tests much more quickly, because we don't need to recreate
the filesystem from scratch each time.
2010-11-30 11:48:35 +00:00
Richard W.M. Jones
17233ce211 capitests: Move test documentation into HACKING file. 2010-11-30 10:42:31 +00:00
Richard W.M. Jones
ba7ec6aea3 capitests: Use /dev/sdc for misc tests (instead of /dev/sdb).
This change means that /dev/sdb is not being used during
the tests (except passively, eg. in listings of devices).

This allows us (in a forthcoming commit) to use /dev/sdb as a
quick scratch filesystem for testing writes.
2010-11-30 10:40:09 +00:00
Richard W.M. Jones
6f09e4774c docs: Fix small inaccuracies in virt-resize(1). 2010-11-27 18:52:51 +00:00
Richard W.M. Jones
866a6a0fa5 docs: Fix typo in virt-filesystems(1). 2010-11-27 18:43:23 +00:00
Richard W.M. Jones
94e1465129 docs: Remove ref to L</add-drive-opts> wrongly copied into some man pages. 2010-11-27 18:39:35 +00:00
Richard W.M. Jones
cece0b85ec Update API support. 2010-11-26 23:57:42 +00:00
Richard W.M. Jones
8370d35221 Updated RELEASE-NOTES file. 2010-11-26 23:56:41 +00:00
Richard W.M. Jones
0b2a3bd840 Version 1.7.16. 2010-11-26 22:36:14 +00:00
Richard W.M. Jones
272b754093 fish: Don't use external pod2text program.
This removes the dependency from guestfish to the external
pod2text program (and hence the final dependency on perl for
guestfish).  This is done by storing the formatted pod2text
output in guestfish as the help text.
2010-11-26 21:51:11 +00:00
Richard W.M. Jones
b4c853f7d4 generator: More options for internal pod2text generator.
Allow extra width, and trimming options.

This necessitates a change in the memoized format.  To avoid
causing crashes if a new generator loads the old format, also
change the filename of the memo file.
2010-11-26 21:49:58 +00:00
Richard W.M. Jones
60b3c8e811 libtool fix: Don't do fix if there was no -o option to libtool.
For example if libtool is being run as 'libtool --mode=execute ...'

This fixes commit 4cf4f2b66f.
2010-11-26 18:26:09 +00:00
Richard W.M. Jones
9e6a8a4cbb Version 1.7.15. 2010-11-26 17:28:15 +00:00
Richard W.M. Jones
a44ec081b6 build: Add several missing shell scripts to dist. 2010-11-26 17:01:59 +00:00
Richard W.M. Jones
4cf4f2b66f Remove dependency_libs from libtool *.la files.
Add a libtool wrapper which kills dependency_libs in libtool *.la
files, to ensure that libtool doesn't add unnecessary extra libraries
when linking.

See http://lists.fedoraproject.org/pipermail/devel/2010-November/146343.html
2010-11-26 17:01:55 +00:00
Richard W.M. Jones
18de192b0a df: Missing direct dependency on libvirt.
virt-df has an (optional) direct dependency on libvirt.  Because of
libtool's over-linking behaviour this was being missed.
2010-11-26 16:51:01 +00:00
Richard W.M. Jones
a6054bf90f rescue: Rewrite virt-rescue in C. 2010-11-26 15:12:25 +00:00
Richard W.M. Jones
076a9726e6 Update HACKING description of tools/ subdirectory.
This fixes commit 18374b5b7d.
2010-11-26 11:37:50 +00:00
Richard W.M. Jones
403ac796a5 daemon: Close leaked file descriptor along checksum error path (RHBZ#657499). 2010-11-26 10:18:29 +00:00
Richard W.M. Jones
746c4b7789 Version 1.7.14. 2010-11-25 18:58:20 +00:00
Richard W.M. Jones
18374b5b7d df: Rewrite virt-df in C.
I have diffed the output from the original virt-df with this
new version, and they agree very closely.  Some differences:

 - Old virt-df have a divide-by-zero error in cases where the
   number of used inodes was 0.  New virt-df fixes this.

 - New virt-df uses gnulib human_readable library which displays
   numbers to 3 significant figures for -h output (old version
   used an ad hoc function).
2010-11-25 18:58:13 +00:00
Richard W.M. Jones
4838ec3326 Export private function 'guestfs___for_each_disk' for use by virt-df.
This private function (not part of the API) allows us to
iterate over disks from a guest, avoiding the business of
writing all the XPath code yet again.
2010-11-25 15:40:56 +00:00
Richard W.M. Jones
70faafe8d4 fish: Keep device names in options drives list.
In the 'struct drv *drvs' structure, keep a list of the
device name(s) for each added drive or guest.  The device name
is the canonical name as that drive would be known inside
libguestfs, eg. "/dev/sda"
2010-11-25 15:40:56 +00:00
Richard W.M. Jones
dfa9d6cf32 Fix memory leak (xptype XPath obj) in add-domain API. 2010-11-25 15:40:55 +00:00
Richard W.M. Jones
3fc6dde15c Version 1.7.13. 2010-11-24 20:20:59 +00:00
Richard W.M. Jones
37366ede50 build: Remove some non-existent files from CLEANFILES. 2010-11-24 20:17:08 +00:00
Richard W.M. Jones
37e632b7b8 ruby: Translate C examples into Ruby and include documentation. 2010-11-24 20:13:13 +00:00
Richard W.M. Jones
472722a72d python: Translate C examples into Python and include documentation. 2010-11-24 20:12:50 +00:00
Richard W.M. Jones
086bd1f7bf ocaml: Translate C examples into OCaml and include documentation. 2010-11-24 20:12:16 +00:00
Richard W.M. Jones
58012dc9b6 docs: Standard C examples, and guestfs-examples(3) man page. 2010-11-24 20:12:11 +00:00
Richard W.M. Jones
e1aca6323e build: Centralize all POD manipulation in 'podwrapper.sh' script. 2010-11-24 20:12:08 +00:00
Richard W.M. Jones
c1592ac938 build: Rename bugs-in-changelog.sh 2010-11-24 14:29:31 +00:00
Richard W.M. Jones
0f47893310 build: Rename update-bugs as update-bugs.sh. 2010-11-24 14:29:28 +00:00
Richard W.M. Jones
4e3837d0f3 generator: Remove unused variable. 2010-11-24 12:42:17 +00:00
Richard W.M. Jones
d20b9cd6b8 fuse: Add note in test about how to debug guestmount. 2010-11-24 11:29:13 +00:00
Richard W.M. Jones
951ea0e189 build: virt-make-fs requires String::ShellQuote, add to configure. 2010-11-24 11:29:10 +00:00
Richard W.M. Jones
c6478d6a01 regressions: Fix test-launch-race to work in non-supermin case. 2010-11-24 09:41:51 +00:00
Richard W.M. Jones
5d7ee3f0c5 daemon: blkid cache is at a different location on Debian.
Remove both possible cache locations.
2010-11-24 09:41:48 +00:00
Richard W.M. Jones
bd631df66f debian: Include ntfsprogs in the appliance.
This allows us to build NTFS filesystems at least.  Mounting
NTFS doesn't work in Debian because of a problem with debirf.
2010-11-24 09:41:43 +00:00
Richard W.M. Jones
22a50e4e3b inspect: Detect if db_dump and db_load programs are available.
If db_dump is not available then disable RPM application detection.

Note these utilities have odd names on Debian.
2010-11-24 09:41:41 +00:00
Richard W.M. Jones
72932bd0c9 build: Move po4a detection up near other program detection. 2010-11-24 09:41:38 +00:00
Richard W.M. Jones
b9bd24b943 daemon: In sfdisk call blockdev --rereadpt with device name. 2010-11-23 18:42:26 +00:00
Richard W.M. Jones
8d3e97679a ocaml: Fix some unused parameter warnings in OCaml bindings. 2010-11-23 18:25:18 +00:00
Richard W.M. Jones
4220b7a641 Update README to reflect Perl modules that are really still required. 2010-11-23 15:56:13 +00:00
Richard W.M. Jones
12eb3eb8ab build: XML::Writer Perl module is no longer required. 2010-11-23 15:56:13 +00:00
Richard W.M. Jones
fa0c588d1e filesystems: Fix command synopsis in usage message.
This updates commit fbc2555903.
2010-11-23 12:06:12 +00:00
Richard W.M. Jones
9e6f85877c Version 1.7.12. 2010-11-23 10:39:31 +00:00
Richard W.M. Jones
d90bc32c74 fish: Link to virt-inspector from guestfish man page. 2010-11-23 10:29:26 +00:00
Richard W.M. Jones
fbc2555903 New tool: virt-filesystems
This tool replaces virt-list-filesystems and virt-list-partitions with
a new tool written in C with a more uniform command line structure
and output.

This existing Perl tools are deprecated but remain indefinitely.
2010-11-23 10:22:08 +00:00
Richard W.M. Jones
f6d3d56771 ls: Rewrite virt-ls in C. 2010-11-23 09:48:05 +00:00
Richard W.M. Jones
f33d899fd0 resize: Fix canonical device function (RHBZ#655554). 2010-11-23 09:48:04 +00:00
Richard W.M. Jones
f8af59c234 inspector: Make whole disk paths canonical (RHBZ#655554). 2010-11-23 09:04:00 +00:00
Richard W.M. Jones
938c98ad76 inspector: Fix documentation of -x option in usage.
This updates commit c5cb65f0aa.
2010-11-22 17:35:36 +00:00
Richard W.M. Jones
b875f8e115 cat: Fix documentation of -x option in usage.
This updates commit d29e9a552f.
2010-11-22 17:35:36 +00:00
Richard W.M. Jones
730d4db45e cat: Continue after encountering an error. 2010-11-22 13:09:38 +00:00
Richard W.M. Jones
cb8403c428 cat: Fix documentation for command line with format option. 2010-11-22 12:38:30 +00:00
Richard W.M. Jones
3d3ec55c35 inspector: Fix rule to build HTML file.
This updates commit c5cb65f0aa.
2010-11-19 22:50:30 +00:00
Richard W.M. Jones
ccea24323b Version 1.7.11. 2010-11-19 22:31:24 +00:00
Richard W.M. Jones
16127e773b po-docs: Remove virt-inspector.pl reference from Makefile.am. 2010-11-19 22:30:54 +00:00
Richard W.M. Jones
c5cb65f0aa inspector: Rewrite virt-inspector in C. 2010-11-19 15:32:02 +00:00
Richard W.M. Jones
60a62788d4 fish: Fix memory leak in handling of encrypted volumes by -i option.
This fixes a memory leak introduced by
commit a232e62dcf.
2010-11-19 15:32:02 +00:00
Richard W.M. Jones
4f9a670d09 inspect: Fix memory leak of hostname.
This fixes a memory leak introduced by
commit fab75c0337.
2010-11-19 15:32:02 +00:00
Richard W.M. Jones
53f670c33a cat: Fix run-cat-locally script so it doesn't go via Perl. 2010-11-19 15:13:36 +00:00
Richard W.M. Jones
3bd883f344 cat: Give a better error if the user specified no drives on command line. 2010-11-19 13:06:22 +00:00
Richard W.M. Jones
06e993b7ba cat: Tidy up documentation for --format option. 2010-11-19 12:56:38 +00:00
Richard W.M. Jones
16e39ac0b8 Remove FIPS .*.hmac files from the supermin appliance (RHBZ#654638). 2010-11-18 15:32:05 +00:00
Richard W.M. Jones
e1ad5afaea Version 1.7.10. 2010-11-17 23:13:36 +00:00
Richard W.M. Jones
f445d25d7b generator: trace mode prints return values. 2010-11-17 16:43:18 +00:00
Richard W.M. Jones
6c6aa11179 generator: Make return value into an explicit variable.
This is just code motion.
2010-11-17 16:06:55 +00:00
Richard W.M. Jones
a5884a88fc generator: Make trace flag an explicit variable.
This is just code motion.
2010-11-17 15:54:06 +00:00
Richard W.M. Jones
5067f8fc77 todo: Suggest that trace should include return values. 2010-11-17 15:07:45 +00:00
Richard W.M. Jones
4ac3124760 rescue: Fix typo in documentation of --network option. 2010-11-16 23:34:07 +00:00
Richard W.M. Jones
91b490ec79 Version 1.7.9. 2010-11-16 19:08:16 +00:00
Richard W.M. Jones
9d3f336152 inspector: Replace old examples with ones derived from phony images. 2010-11-16 18:36:33 +00:00
Richard W.M. Jones
fcc631dedb images: Make phony Windows image for testing. 2010-11-16 18:36:33 +00:00
Richard W.M. Jones
9becb385b7 images: Make phony Ubuntu image for testing. 2010-11-16 18:36:33 +00:00
Richard W.M. Jones
858d75d391 images: Make a phony Debian image for testing. 2010-11-16 18:36:33 +00:00
Richard W.M. Jones
6d4815d3a4 images: Make a better phony Fedora image.
This now includes a product string, major and minor version,
hostname and even some applications.
2010-11-16 18:36:29 +00:00
Richard W.M. Jones
2bfeaeaa30 daemon: findfs-uuid and findfs-label should not return /dev/mapper paths. 2010-11-16 15:56:54 +00:00
Richard W.M. Jones
fab75c0337 New API: inspect-get-hostname to return the hostname of the guest.
This returns the hostname of the guest.  Tested on RHEL, Fedora,
Debian 5, Ubuntu 10.10, FreeBSD 8, Windows 7.
2010-11-16 13:27:01 +00:00
Richard W.M. Jones
35afe0cb33 inspect: Check /etc/lsb-release is not too large before calling head on it. 2010-11-16 12:58:44 +00:00
Richard W.M. Jones
a4448956e9 inspect: Add function to read the first line of a file, with safety checks. 2010-11-16 12:58:41 +00:00
Richard W.M. Jones
61cfe13ec4 inspect: Abstract the wrapper that sets up Augeas.
This is just code motion.
2010-11-16 11:16:17 +00:00
Richard W.M. Jones
e428f914dd Version 1.7.8. 2010-11-15 23:22:08 +00:00
Richard W.M. Jones
2cfd89d631 inspector: Replace code for listing applications with new core API. 2010-11-15 22:34:56 +00:00
Richard W.M. Jones
163be3d72a New API: inspect-list-applications.
This converts the current Perl code in virt-inspector for
listing applications, into C, making it a part of the core API.

This is also capable of fetching the list of Windows applications
from the registry.
2010-11-15 22:25:16 +00:00
Richard W.M. Jones
8a3a4c25d3 inspect: Centralize all file downloads through a single function. 2010-11-15 22:25:15 +00:00
Richard Jones
2729421d17 inspect: Add support for Linux Mint and Mandriva.
Linux Mint is derived from Ubuntu.

Mandriva has a release file, but it also has /etc/lsb-release and
the same parsing code can be reused.  Mandriva has a package manager
called urpmi.
2010-11-15 22:21:52 +00:00
Richard Jones
a22d5a7390 docs: Put list of distros in alphabetical order. 2010-11-15 22:21:15 +00:00
Richard Jones
47af6aaab8 docs: Debian and Ubuntu are now separate distros. 2010-11-15 22:20:51 +00:00
Richard W.M. Jones
3e766f745d todo: live CD inspection 2010-11-15 19:30:12 +00:00
Richard W.M. Jones
c3ae17cc79 Version 1.7.7. 2010-11-15 10:14:16 +00:00
Maxim Koltsov
e0afd9a3e4 build: Missing backslash again. 2010-11-14 16:21:56 +00:00
Richard W.M. Jones
d8346d5d64 Version 1.7.6. 2010-11-13 18:06:28 +00:00
Richard W.M. Jones
b943d06466 filearch: Refuse to download initrd if it is huge. 2010-11-13 14:58:50 +00:00
Richard W.M. Jones
9674a73c08 inspect: Fix error out path if minor_version parsing fails. 2010-11-13 14:55:14 +00:00
Richard W.M. Jones
e44cf42f36 inspect: Refuse to download software hive if it is huge. 2010-11-13 14:54:52 +00:00
Richard W.M. Jones
692f127447 inspect: Refuse to parse /etc/fstab if it is huge. 2010-11-13 14:49:37 +00:00
Richard W.M. Jones
528cd8f641 lib: Make some error strings localizable. 2010-11-13 14:49:07 +00:00
Richard W.M. Jones
79b202ca26 inspect: Inspection support for FreeBSD.
This adds inspection support for FreeBSD.

However this is not quite enough to allow guestfish -i freebsd.img
to work, because guestfish will try to mount the filesystems,
which cannot be done because Linux requires special mount options
for the Universal Filesystem (UFS) used by *BSD.  Nevertheless
you can manually run the same commands.
2010-11-13 14:42:06 +00:00
Richard W.M. Jones
a5fd85e739 inspect: Optimize root filesystem check.
Avoid duplicate checks for things like /etc and /bin.
2010-11-13 14:41:01 +00:00
Richard W.M. Jones
55e6ccb23e lib: Add match3 function. 2010-11-13 14:39:21 +00:00
Richard W.M. Jones
a48ab78dc8 lib: Add safe_asprintf function. 2010-11-13 14:37:53 +00:00
Richard W.M. Jones
cd96cca38c docs: Add a section on security. 2010-11-13 12:25:56 +00:00
Richard W.M. Jones
35dbedb1b1 docs: Rearrange guestfs(3) sections.
This rearranges the sections into a more logical order:

 - synopsis and introduction
 - API-related overview sections
 - (security will go here, see next commit)
 - API in detail
 - architecture and other internals
 - usual end sections
2010-11-13 11:32:47 +00:00
Richard W.M. Jones
92444940f3 static: Use correct libraries for static binaries.
Also add virt-cat.static target.
2010-11-13 08:13:22 +00:00
Richard W.M. Jones
74cc619d94 Version 1.7.5. 2010-11-13 07:15:46 +00:00
Richard W.M. Jones
aec3091fa9 ruby: Add 'make install' rule for ruby bindings (RHBZ#652796). 2010-11-12 22:09:49 +00:00
Richard W.M. Jones
2325c99d07 todo: Notes on parsing. 2010-11-12 19:33:55 +00:00
Richard Jones
3fd2b9d0b6 New APIs: inspect-get-package-format, inspect-get-package-management.
This APIs reimplement some parts of virt-inspector in C.
2010-11-12 14:01:38 +00:00
Richard W.M. Jones
6ab5783721 capitests: Remove warning about dead definitions.
This updates commit cb7ec8be4c.
2010-11-11 23:37:54 +00:00
Richard W.M. Jones
59db941bf6 Check that just including <guestfs.h> on its own works. 2010-11-11 23:37:54 +00:00
Richard W.M. Jones
096f341714 Don't need to include XDR headers in <guestfs.h>.
Include the XDR headers in the internal guestfs-internal.h instead.

This is knock-on effects to several other source files which
were implicitly relying on indirectly loaded headers.
2010-11-11 23:29:46 +00:00
Richard W.M. Jones
649b990bbf Be less verbose in the macros defending typedefs in <guestfs.h>.
This updates commit 4d59e27104.
2010-11-11 23:18:12 +00:00
Richard W.M. Jones
3431f397d3 perl: Ignore debug functions in Test::Pod::Coverage. 2010-11-11 22:25:20 +00:00
Richard W.M. Jones
f614a6dde9 Version 1.7.4. 2010-11-11 19:04:40 +00:00
Richard W.M. Jones
f6c4026f85 build: xml-light is no longer required (thanks Maxim Koltsov).
At some point we removed the last thing that required
xml-light, but were still testing for it at various places
in the build.  This removes all traces.
2010-11-11 18:03:12 +00:00
Richard W.M. Jones
d29e9a552f Rewrite virt-cat in C.
With changes in the core API since 1.5, virt-cat was little
more than a Perl wrapper which did some command line argument
processing.  Thus it could easily be rewritten in C.

This version also shares core command line argument processing
with guestfish and guestmount, so the options have changed
slightly (old-style command line *is* supported).

 virt-cat -a disk.img file [file ...]
 virt-cat -d domname file [file ...]

Several other guestfish options are supported including encryption,
and with the new style multiple files can be downloaded.  See the
man page for details.
2010-11-11 16:56:43 +00:00
Richard W.M. Jones
4d900cdac8 Generate a dummy 'Fedora' fedora.img in images directory for use by tests.
We were generating this dummy 'Fedora' image already in the
tools directory.  It contains just enough Fedora-like files
to fool our inspection code and thus to test the tools.

This is general enough that we can use it everywhere.
2010-11-11 16:56:11 +00:00
Richard W.M. Jones
4d59e27104 Defend all typedefs in <guestfs.h> with #ifdefs.
This allows other libraries to redefine those typedefs
if they need to use but not depend on <guestfs.h>.
2010-11-11 12:14:37 +00:00
Richard W.M. Jones
6263da7474 lib: Make <guestfs.h> be completely generated.
This removes the 'not-quite-separate' guestfs-actions.h and
guestfs-structs.h files.
2010-11-11 11:51:02 +00:00
Richard W.M. Jones
4a3726d5ed Fix small typo in a comment in src/Makefile.am. 2010-11-11 11:49:53 +00:00
Richard W.M. Jones
cb7ec8be4c capitests: Add the code to test (proposed) add-libvirt-dom C API.
This API was dropped as there are some problems with it.  This
commit adds the original test code, but commented out.
2010-11-11 11:26:38 +00:00
Richard Jones
7509c91a71 fish: Use core add-domain API to implement '-d' option.
This also makes libxml2 and libvirt into optional dependencies.
If they are missing then the core API will print an error, as
will the '-d' option to guestfish.
2010-11-11 11:24:13 +00:00
Richard Jones
f08fe63761 New API: add-domain
This new API allows you to add the disks from a libvirt
domain.

In guestfish you can use the 'domain' command to access the
API, eg:

><fs> domain Fedora14 libvirturi:qemu:///system
1

The returned number is the number of disks that were added.

Also here is a proposed (but commented out) low-level API
which would allow you to add a domain from a virDomainPtr.
However there are several problems with this API -- see discussion
on the list:
https://www.redhat.com/archives/libguestfs/2010-November/thread.html#00028
2010-11-11 11:22:39 +00:00
Richard Jones
4ada0a7815 generator: Add Pointer parameter type to the generator.
This allows generic "foo *bar" pointers to be passed to
library functions (not to daemon functions).

In the language bindings (except Perl) these are handled
as generic int64s with the assumption being that any
pointer can be converted to and from this.  There is room
to add specific support for some pointer types in future
by specializing the match cases.  However this is inherently
tricky because it depends on the implementation details of
other bindings (eg. to support virDomainPtr in OCaml depends
on the implementation details of the ocaml-libvirt project).

Perl is slightly different in that you have to supply a
typemap.  Again this would depend on the implementation
detail of an external library unless you supplied a generic
typemap for int64.
2010-11-10 10:52:12 +00:00
Richard W.M. Jones
eaedf025f5 New API: debug-cmdline for printing QEMU command line (internal only).
This is an internal-only debugging API so may be changed or
removed at any time in the future.
2010-11-10 10:52:12 +00:00
Richard Jones
1c29849e0b Add internal facility to checkpoint and roll back the command line.
This internal interface can be used to ensure that certain
operations are atomic.
2010-11-10 10:52:12 +00:00
Richard Jones
a0b4caa082 lib: Make pcre, libmagic and hivex libraries optional.
This change makes these libraries optional.  If they are not
available at compile time then certain core API features will
be disabled (see below).

This also changes PCRE detection to use pkg-config instead
of the ad hoc autoconf checks.

The large inspect.c file has been split out into separate
function-specific files.

  file-architecture: requires pcre & libmagic
  inspection: requires pcre & hivex
2010-11-10 10:52:12 +00:00
Richard W.M. Jones
ec63875f9c Don't include debug* commands in the documentation. 2010-11-10 10:52:12 +00:00
Richard W.M. Jones
2ee6ea2ce1 capitests: Add whitespace in Makefile. 2010-11-10 10:52:12 +00:00
Richard Jones
8ac9575b20 inspect: win64 regexp was dead code. 2010-11-10 10:34:48 +00:00
Richard Jones
b52183b549 lib: Augeas (client side) is not needed by the library.
However it is used by the daemon.
2010-11-10 10:34:48 +00:00
Richard Jones
bf3b9e2e23 ocaml: Error on compiler warnings. 2010-11-09 12:05:08 +00:00
Richard Jones
a6454a437f ruby: Remove extra space before parenthesis. 2010-11-09 12:04:29 +00:00
Richard Jones
ed2bd31f91 Revert "autogen: Touch ocaml/.depend"
This reverts commit a0f85ba643.
2010-11-08 22:36:24 +00:00
Richard Jones
e3acf93ce9 Revert "Remove ocaml/.depend from git."
This reverts commit 064569bcbf.

This commit does the wrong thing: creating an empty ocaml/.depend
file is wrong because building the OCaml bindings will fail.
Not having this file will prevent automake from running.  Therefore
this file has to exist with the correct content in git.
2010-11-08 22:35:13 +00:00
Richard W.M. Jones
04df249d82 Version 1.7.3. 2010-11-08 15:52:07 +00:00
Richard W.M. Jones
5a10318ac8 build: Create an AUTHORS file. 2010-11-08 15:51:01 +00:00
Maxim Koltsov
e5ec461c67 build: Don't try to rebuild po-docs/<lang> if no po4a. 2010-11-08 15:10:54 +00:00
Maxim Koltsov
b0a48fa450 build: Add ./configure --disable-php option.
This disables the PHP language bindings.
2010-11-08 15:08:01 +00:00
Richard W.M. Jones
8e4a4d3d88 build: Test for virt tools Perl libraries conditionally.
Only test for these if $PERL is defined, and use $PERL as
the interpreter.
2010-11-08 14:53:48 +00:00
Maxim Koltsov
ada8756423 build: Add ./configure --disable-haskell option.
This disables the Haskell language bindings.
2010-11-08 14:46:46 +00:00
Maxim Koltsov
5b99e1b983 build: Add ./configure --disable-ruby option.
This disables the Ruby language bindings.
2010-11-08 14:35:13 +00:00
Maxim Koltsov
041969480a build: Warn if Python include or site-packages not found. 2010-11-08 14:28:52 +00:00
Maxim Koltsov
3a7eb8ebdb build: Add ./configure --disable-python option.
This disables the Python language bindings.
2010-11-08 14:28:52 +00:00
Maxim Koltsov
57c74708ca build: Add ./configure --disable-perl option.
This disables the Perl bindings.
2010-11-08 14:28:51 +00:00
Richard W.M. Jones
53c5248193 ocaml: Remove the old OCaml viewer program.
This program is obsolete and the code has been reused for
guestfs-browser here:
http://people.redhat.com/~rjones/guestfs-browser/
2010-11-08 14:28:44 +00:00
Maxim Koltsov
af7af2fc5e build: Add ./configure --disable-ocaml option.
This can be used to disable the OCaml bindings.  Note that
OCaml is still required in any case where you need to rerun
the generator.
2010-11-08 14:28:04 +00:00
Maxim Koltsov
428a45c3e1 build: Add ./configure --disable-fuse option.
If this option is specified, FUSE support is unconditionally
disabled.
2010-11-08 13:13:15 +00:00
Richard W.M. Jones
4e656a61d4 supermin: If disabled, don't compile in supermin code or check for supermin.
If supermin is disabled at compile time and the user just wants to
use the ordinary appliance, there is no need to compile in all
the supermin code, and in particular there is no need to check
for the supermin appliance (which involves running
febootstrap-supermin-helper that probably doesn't exist).

This fixes a warning message observed under Debian w/o supermin:

  sh: febootstrap-supermin-helper: command not found
2010-11-08 12:46:31 +00:00
Richard W.M. Jones
2c4a7ef92a fish: Add --rw option (does nothing yet).
This adds the guestfish --rw option, intended in future
to be required for writing to disk images.

At the moment this does not change the default and so does
nothing.  This patch is intended for backporting to the
stable branches so that we can start to introduce scripts
which use 'guestfish --rw'.
2010-11-08 10:21:48 +00:00
Richard W.M. Jones
26118d498e Add missing generated files to the tarball (thanks maksbotan).
C# bindings were omitted entirely.  Add a Makefile.am for this
directory even though we don't build these.

Because of a missing backslash, some POD files were not being
included.
2010-11-07 10:00:32 +00:00
Richard W.M. Jones
371e83c090 fish: Add --listen --csh to for csh, tcsh compatibility.
(Thanks Eric Blake).
2010-11-05 15:39:27 +00:00
Richard W.M. Jones
be728962ff fish: Suggest safer form of eval.
eval "$(guestfish --listen)"

instead of various other forms.

(Thanks Eric Blake).
2010-11-05 15:39:24 +00:00
Richard W.M. Jones
633ae13c80 fish: More portable export sh statment.
Don't depend on bash, but allow sh/dash/etc format:
GUESTFISH_PID=nn; export GUESTFISH_PID

(Thanks Eric Blake).
2010-11-05 15:04:10 +00:00
Richard W.M. Jones
7d8807ec3b New API: inspect-get-roots to return roots from last inspection.
Return the roots found by the last call to inspect-os, but
without redoing the whole inspection.
2010-11-05 13:43:08 +00:00
Richard W.M. Jones
9f7926e727 generator: Don't die if an API call isn't listed in API versions file.
For example, it may just have been added.
2010-11-05 13:42:07 +00:00
Richard W.M. Jones
12cf2f732a Version 1.7.2. 2010-11-05 12:29:44 +00:00
Guido Günther
e51d6724d5 configure: Test for 'kvm' binary. 2010-11-05 12:25:24 +00:00
Guido Günther
7fc338690f Include <stdarg.h> in public header.
Public headers use va_list, and this gives an error unless <stdarg.h>
had been included before the header.
2010-11-05 12:25:24 +00:00
Richard W.M. Jones
6283982e36 Don't print out key material in trace output. 2010-11-05 11:54:54 +00:00
Richard W.M. Jones
a232e62dcf fish: '-i' option automatically handles whole-disk encryption.
This feature is also available in guestmount because of the
shared option parsing code.

You don't need to do anything to enable it, just using -i
will attempt decryption of encrypted partitions.

Only works for simple Fedora whole-disk encryption.  It's a
work-in-progress to make it work for other types of encryption.
2010-11-05 11:39:24 +00:00
Richard W.M. Jones
446db62e11 docs: Fix API support script.
Before libguestfs 1.0.69 we needed to look in src/guestfs.c to
see all the API calls.
2010-11-04 17:43:17 +00:00
Richard W.M. Jones
ca236acc67 fish: Fix missing guestfish commands in HTML docs. 2010-11-04 17:23:21 +00:00
Richard W.M. Jones
74f7c9e4b7 fish: Make the 'help' command more helpful. 2010-11-04 17:04:03 +00:00
Richard W.M. Jones
7e3d76e41b docs: Which API calls were first supported in which upstream versions.
Run src/api-support/update-from-tarballs.sh (this won't work
unless you have a local copy of the tarballs from the website).

src/api-support/added contains the result of running the
script, a list of pairs: (API name, version first appeared).
2010-11-04 10:04:40 +00:00
Richard W.M. Jones
bfeffeb1e4 virt-win-reg: Current is the control set Windows chooses at boot. 2010-11-03 23:17:51 +00:00
Richard W.M. Jones
9694cd59f8 HACKING: Mention PHP bindings. 2010-11-03 22:23:55 +00:00
Richard W.M. Jones
19ea54b3f4 docs: Indent *_va and *_argv functions correctly.
This fixes commit f661db2c39.
2010-11-03 22:12:05 +00:00
Richard W.M. Jones
ece3b30e49 Version 1.7.1. 2010-11-03 21:09:51 +00:00
Richard W.M. Jones
58915725b1 fish: Use a perfect hash for faster command lookups.
Existing command lookups are approx O(n^2).  Replace this
with a perfect hash implementation which should be a lot
faster.
2010-11-03 20:34:42 +00:00
Richard W.M. Jones
f661db2c39 generator: Properly lay out and indent multi-line C function decls. 2010-11-03 19:26:10 +00:00
Richard W.M. Jones
5d6a918445 docs: Clarify no additional error available from guestfs_create. 2010-11-03 18:52:45 +00:00
Richard W.M. Jones
01d613ae95 docs: Clarify default error handler. 2010-11-03 18:49:00 +00:00
Richard W.M. Jones
6a21809281 docs: Error strings are in fact localized, documentation was wrong. 2010-11-03 18:49:00 +00:00
Richard W.M. Jones
aae5bebe68 docs: Clarify, not every function that returns int returns -1 for errors. 2010-11-03 18:49:00 +00:00
Richard W.M. Jones
9cd1810b5e capitests: Test guestfs_last_errno call. 2010-11-03 18:49:00 +00:00
Richard W.M. Jones
39052d270f fuse: Use guestfs_last_errno instead of errno-reversal-hack. 2010-11-03 18:49:00 +00:00
Richard W.M. Jones
2066805a5d lib: Expose errno through new API guestfs_last_errno.
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.
2010-11-03 18:48:56 +00:00
Richard W.M. Jones
d859c283c4 daemon: Send back the errno as a string.
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.
2010-11-03 17:44:30 +00:00
Richard W.M. Jones
2be1648632 capitests: Test guestfs_add_drive_opts with optional args from C. 2010-11-03 17:44:30 +00:00
Richard W.M. Jones
b535363e7e capitests: Test some basic aspects of the C API. 2010-11-03 17:44:30 +00:00
Richard W.M. Jones
162c89ed49 capitests: Use ftruncate instead of seek + write to create test files. 2010-11-03 17:44:30 +00:00
Richard W.M. Jones
ec0fe45e48 capitests: Don't open test files with O_NONBLOCK.
I have no idea why we were doing this.
2010-11-03 17:44:30 +00:00
Richard W.M. Jones
2a33d81e2b capitests: Set path in TESTS_ENVIRONMENT instead of in tests.c
By exporting LIBGUESTFS_PATH with the right path to the appliance,
we no longer need to hard code the path in tests.c
2010-11-03 17:28:02 +00:00
Richard W.M. Jones
8ccc6cd1f7 generator: Remove unnecessary macro redefinitions.
These macros are already defined in guestfs-internals.h
2010-11-03 15:49:59 +00:00
Richard W.M. Jones
6b8d05438c Define internal safe_calloc shorthand. 2010-11-03 15:49:59 +00:00
Richard W.M. Jones
9ff9941836 daemon: Don't use ../src path to include generator_protocol.h
This file is already hard-linked into the current directory, so
the relative path is not required.
2010-11-03 13:15:19 +00:00
Richard W.M. Jones
c5a6584c4f tests: Remove use of sfdisk from tests.
Some older tests used sfdisk to create partitions for the
tests.  sfdisk is buggy (more so than parted -- what is it
with partitioning tools?) so replace these tests with
equivalent part-* commands.
2010-11-02 20:57:40 +00:00
Richard W.M. Jones
1937698c25 daemon: Tolerate failure of blockdev --rereadpt after sfdisk.
See commit 840536ea5a
and commit 956fc5a3fe.
2010-11-02 20:33:06 +00:00
Richard W.M. Jones
47d1585961 binary: Link guestmount static binary with -lm.
This is indirectly required via the new shared guestfish
C inspection code by libxml2.
2010-11-02 17:05:58 +00:00
Richard W.M. Jones
c36214c682 website: Distribute BUGS and RELEASE-NOTES files to website. 2010-11-02 17:05:43 +00:00
Richard W.M. Jones
a2591230c1 Version 1.7.0. 2010-11-02 16:23:58 +00:00
Richard W.M. Jones
3fac199a8b Final RELEASE-NOTES file for version 1.6.0. 2010-11-02 16:18:30 +00:00
Richard W.M. Jones
f0c28b391c inspect: Add support for MeeGo. 2010-11-02 10:11:04 +00:00
Richard W.M. Jones
bf0280bf58 Version 1.5.26. 2010-10-29 15:49:36 +01:00
Richard Jones
7badf512f6 inspect: Add support for Ubuntu. 2010-10-29 11:54:54 +01:00
Richard Jones
96b44334dd inspect: Add detection of Gentoo. 2010-10-29 10:58:20 +01:00
Richard Jones
b4618fb060 inspect: Add detection of Arch Linux. 2010-10-29 10:55:40 +01:00
Richard Jones
233530d354 inspect: Add detection of Pardus. 2010-10-29 10:55:34 +01:00
Richard Jones
a81bf3f3ef inspect: Generic parsing of MAJOR.MINOR in product names. 2010-10-29 10:54:29 +01:00
Richard Jones
6e9917f725 inspect: Generic parsing of release files. 2010-10-29 10:53:43 +01:00
Richard Jones
994ae6e356 inspector: Sort <filesystems> section. 2010-10-29 10:53:43 +01:00
Richard W.M. Jones
12cf22ade4 inspect: Ignore Pardus "/.swap" swapfile. 2010-10-29 10:15:02 +01:00
Richard Jones
a0f85ba643 autogen: Touch ocaml/.depend 2010-10-29 10:15:02 +01:00
Richard W.M. Jones
9f5d2171b8 inspector: List Debian packages.
List Debian packages by downloading and parsing the file
/var/lib/dpkg/status.
2010-10-28 22:56:11 +01:00
Richard W.M. Jones
6548a876f3 inspector: Introductory documentation for XML format. 2010-10-28 22:32:50 +01:00
Richard W.M. Jones
99ed8d1be7 inspector: Debian package format 'deb' instead of 'dpkg'. 2010-10-28 22:32:05 +01:00
Richard W.M. Jones
237627df37 inspector: Return canonical block device paths in XML. 2010-10-28 22:30:55 +01:00
Richard W.M. Jones
4c5ca903b5 Version 1.5.25. 2010-10-28 18:46:13 +01:00
Matthew Booth
f2460699ab Ensure atomic creation of a cached appliance
Cached appliances are discovered by their predictable path. Previously we were
creating a cached appliance directly in this predictable path. This had at least
2 undesirable effects:

* Interrupting appliance creation would leave a corrupt appliance
* 2 processes could simultaneously attempt to create the same appliance, causing
  corruption.

This patch causes the cached appliance to be created in a temporary directory,
and then renamed to the predictable path. As rename is an atomic operation, this
makes the whole creation atomic.

This patch also changes the predictable path to have a prefix of 'guestfs.'.
This will make it simpler for system administrators to clean up old cached
appliances.

This patch resolves RHBZ#639405
2010-10-28 16:47:06 +01:00
Matthew Booth
38af2eaceb Call febootstrap-supermin-helper using the new -u and -g options
Use febootstrap-supermin-helper's new -u and -g command line options to setuid,
rather than doing it in libguestfs.

This resolves an issue with the generation of the cached appliance checksum. The
checksum was being generated by a call to febootstrap-supermin-helper through
popen(). Unfortunately, a bash misfeature meant that euid would be reset to uid,
and the checksum was generated for uid, not euid. When virt-v2v is writing to a
RHEV target, uid == 0 and euid == 36, which resulted in a cached appliance being
created for root with permissions for uid 36.

Note this requires febootstrap 2.10.
2010-10-28 16:17:38 +01:00
Matthew Booth
cf8add59d2 Log the febootstrap-supermin-helper command line
A side-effect of change 17e7cb9937 was the the
febootstrap-supermin-helper was no longer logged. This change adds it back using
the new guestfs___print_timestamped_argv internal function.
2010-10-28 16:08:47 +01:00
Matthew Booth
06fef60db5 New internal function guestfs___print_timestamped_argv
This function generalises the existing print_cmdline used to output the qemu
command line to output any given command line, and exports it to other modules.
It also adds a timestamp to the old print_cmdline output for consistency with
guestfs___print_timestamped_message.
2010-10-28 16:08:45 +01:00
Richard W.M. Jones
0353688577 list-filesystems: Use core list-filesystems API (RHBZ#642933).
Change virt-list-filesystems to use the core inspection API
instead of the deprecated Sys::Guestfs::Lib::get_partitions
function.
2010-10-28 15:48:16 +01:00
Richard W.M. Jones
756c23997b Sys::Guestfs::Lib: deprecate get_partitions (RHBZ#642933).
However the code is left since this function is used
by virt-v2v amongst others.
2010-10-28 15:48:16 +01:00
Richard W.M. Jones
f30210cba8 inspector: Rewrite virt-inspector (RHBZ#642930).
Rewrite virt-inspector:

 - remove old and unsupportable features
 - use the C inspection API
 - don't run programs from the guest

The RNG has been updated to reflect the new XML-only output.

The new example files show the new XML output.
2010-10-28 15:48:12 +01:00
Richard W.M. Jones
ca7e941329 tools: Use C API for inspection (RHBZ#642930).
Update the following tools to use the C API for inspection:

 - virt-cat
 - virt-edit
 - virt-ls
 - virt-tar
 - virt-win-reg

None of the tools in the tools/ directory now use the deprecated
Perl inspection APIs.
2010-10-28 15:16:15 +01:00
Richard W.M. Jones
a51f56adb1 New API: inspect-get-windows-systemroot to get systemroot.
We are already using heuristics in the C inspection code to
determine the Windows %SYSTEMROOT% directory.  This change
just exposes this information through the API.
2010-10-28 15:16:15 +01:00
Richard W.M. Jones
40d58fe65e Sys::Guestfs::Lib: deprecate inspection functions (RHBZ#642930).
Deprecate the guest inspection functions in this module, remove
documentation, and point users at the core API functions instead.

However we will keep the code here since it is used by virt-v2v
and virt-inspector.
2010-10-28 15:16:14 +01:00
Richard W.M. Jones
fea2e61ac1 daemon: Fix /dev/mapper paths from mounts and mountpoints (RHBZ#646432).
Make the LV paths returned by these two commands canonical.
2010-10-28 15:16:14 +01:00
Richard W.M. Jones
2f52a40bed edit: Clean up tmp file handling in virt-edit.
This was probably not a security issue, but this change
makes the code cleaner by not opening the tmp file twice.

Also be more careful about error checking in close syscall.
2010-10-28 15:16:14 +01:00
Richard W.M. Jones
f93b234401 doc: Warn about security implications of running commands. 2010-10-28 15:16:14 +01:00
Richard W.M. Jones
e3851914de virt-ls: Small fix to documentation. 2010-10-28 15:16:14 +01:00
Matthew Booth
064569bcbf Remove ocaml/.depend from git.
ocaml/.depend is automatically generated. This patch removes it from git.
2010-10-28 15:16:14 +01:00
Richard W.M. Jones
0e896a490c Version 1.5.24. 2010-10-27 12:51:30 +01:00
Richard W.M. Jones
fb998000e6 Disable test for RHBZ#576879 comment 5.
This test has started to hang, for reasons we don't understand.
2010-10-27 12:17:26 +01:00
Richard W.M. Jones
c66d6f215e Unify guestfish and guestmount options processing (RHBZ#642932).
In guestfish, factor out the processing of the options -a, -c,
-d, -i, -m, -n, -r, -v, -V, -x into a separate set of files:
options.c, options.h, inspect.c, virt.c.

Change guestmount so that it uses these same files (from the
../fish directory) to process the same options.

This unifies the handling of these options between the two programs.
It also adds the useful inspection feature to guestmount, so you
can now do:

  guestmount -d Guest -i --ro mnt/
2010-10-27 12:04:16 +01:00
Richard W.M. Jones
d600342b7d df: Add --uuid option to print guest UUIDs instead of names (RHBZ#646821). 2010-10-27 10:59:45 +01:00
Richard W.M. Jones
6590e04bdc todo: Remove obsolete items from TODO file. 2010-10-27 10:59:45 +01:00
Richard W.M. Jones
33d6e0e723 Document problems mixing mkmountpoint and umount-all (RHBZ#599503). 2010-10-27 10:59:45 +01:00
Richard W.M. Jones
607dcadd2d appliance: Repo name is not Fedora-specific.
The --with-repo parameter is also used by Debian to specify
the Debian software repository, so remove references to
Fedora.
2010-10-27 10:59:45 +01:00
Richard W.M. Jones
f1930720d9 appliance: Remove repo from appliance filename (RHBZ#638901).
There's no need to have the appliance filename contain the
repository name it was built from, and this change gives
downstream users more freedom to mix and match libraries
and appliances if they want to.
2010-10-27 10:59:45 +01:00
Richard W.M. Jones
99dc2a9702 inspection: Ignore floppy disks and CD-ROM drives (RHBZ#642929). 2010-10-27 10:59:45 +01:00
Richard W.M. Jones
f48cd1f262 Enable autosync by default. 2010-10-27 10:59:45 +01:00
Richard W.M. Jones
9160dee922 /dev/mapper paths should not be returned from C inspection APIs (RHBZ#638899).
With this patch, /dev/mapper paths do not appear in the output
of guestfs_inspect_os, as you can see from this example:

Welcome to guestfish, the libguestfs filesystem interactive shell for
editing virtual machine filesystems.

Type: 'help' for a list of commands
      'man' to read the manual
      'quit' to quit the shell

Operating system: Fedora release 13 (Goddard)
/dev/vg_f13x64/lv_root mounted on /              <--- NB
/dev/vda1 mounted on /boot
2010-10-27 10:59:45 +01:00
Richard W.M. Jones
b01ef8eae1 New API: lvm-canonical-lv-name: make LV name canonical.
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
2010-10-27 10:59:45 +01:00
Richard W.M. Jones
504c3de9fe rescue: Add --network option.
This enables networking in the rescue shell.
2010-10-27 10:59:44 +01:00
Richard W.M. Jones
ec736e20d3 Don't use kernel module whitelist with ext2-based appliance.
Since the ext2-based appliance is cached, and since it is not
all loaded into memory (as with the initrd), we might as well
put all the kernel modules in there.

Note the kmod.whitelist.in file is still used for building the
ordinary appliance.
2010-10-27 10:59:44 +01:00
Matthew Booth
61da709722 Fix networking in the appliance.
Commit 4963be85 re-introduced networking to the appliance,
but didn't configure the custom network the appliance expects
since we switched to link local addressing. This patch
configures QEMU to use the custom network again.

Note that you still need to use guestfs_set_network (g, 1)
to enable user networking.
2010-10-27 10:59:44 +01:00
Matthew Booth
9332031543 Don't include control characters in BufferIn trace output (RHBZ#646822).
The example below shows what the output looks like for a large
random buffer.

$ guestfish -N fs -m /dev/sda1 -x -- \
    touch /test : \
    pwrite /test "$(dd if=/dev/urandom bs=128k count=1)" 0
[...]
pwrite "/test" "\x7f\xa0/\xb3\x80\xd3\xbc\xc3\xc3.\xb1\xe0\x1b\xafC\x06\xd5;\x0ajJ[o\xc1\xdd\xae\x1f\xce\xb2\x8d\xb3\xd0\x11\xcc$%\xe6<\xc7\xc7\xe7BU*\xc4l%\xaa\xea\xe9\x1an\xda]\xc6I\x0eC\xf9;\xec\x12a\x1f\xeaRH\xb2P\xd6+\xc4\xe6\xa5bW\x99\\x9d\xc8\x9bJ\xef\x99-\x16:h5\xe2\x0f\xa2\xa08\x9bU\x0b$\x138\xcf\xd4j\x9b\x83{%\xac0\xdaa1Xx\xbd`\x8e\xdd\x82\x87\x07\x98\xd2\x9ed\x8bq\xd0\x1f5\x8f\xab\xad4z1\xda\xc4b\xc1\xbc\x0f\xaa\xea\xc1\x15(\xfd1\xc2\x0bF\xe6\x9e\xb0+/g\\xab\xb0b\xde_\xca\xf9\xad\xe1?%\x17\xad\x98\xa4e\xc1\xe0f'\x89\xe9>\xff\xadhYi\xe7\x8c]%\xef\xe0\xa1R\xe5\xd5\x03K\xefI\xdf\xad\xd3\x82\xdb\x0f\xdd\xc3\x8f"\xf1G\xea\xf9r\xdd\xff\x88\x81\xb7\xf2\x0e\x0f\x1d;:\xf2F1\xdb\xb5D\xa1^\x928\xf5\x8e)\xab\xc4\xc3H(\xd0ol\xc6\xe4\xd6\xa3L\x1c\x06\xf4"<truncated, original size 130567 bytes> 0
[...]
2010-10-26 15:29:22 +01:00
Richard W.M. Jones
c9670080e9 daemon: Print failed path in stat command errors. 2010-10-25 13:01:28 +01:00
Karel Klíč
1d5ec10659 fish: Fix too-short allocation in tilde expansion (RHBZ#636061). 2010-10-25 12:48:36 +01:00
Piotr Drąg
247324a4b3 Update Polish translations (RHBZ#502533). 2010-10-23 12:52:35 +01:00
Richard W.M. Jones
ae748ba3c1 fish: Quote optional argument name in error message. 2010-10-23 10:45:25 +01:00
Richard W.M. Jones
b7133b2709 fish: Reject unknown opt args (RHBZ#642934,CVE-2010-3851).
This updates commit 0c1d3c02a8.
2010-10-23 10:45:06 +01:00
Richard W.M. Jones
6ecaa6371a fuse: Add --format option to docs (RHBZ#642934,CVE-2010-3851).
This updates commit 44c5ee1163.

Document the --format option in the guestmount manual page.
2010-10-23 10:23:45 +01:00
Richard W.M. Jones
204d54609b Version 1.5.23. 2010-10-22 23:12:16 +01:00
Richard W.M. Jones
4b0e7f5c6a resize: Specify format of input, output disk (RHBZ#642934,CVE-2010-3851).
This adds two new options: --format specifies the format of the
input disk, and --output-format specified the format of the output
disk.

Requiring the format of the output disk seems a bit strange at first:
after all, this is the disk that the virt-resize user has to create.
However it is needed because we sometimes reopen this disk, after
copying data over the first sector, and in theory a raw-format guest
could write a qcow2 header here and have it copied to the output
disk, which we would subsequently reopen.
2010-10-22 17:45:06 +01:00
Richard W.M. Jones
38bc7c98df virt-make-fs: Specify format of disk (RHBZ#642934,CVE-2010-3851). 2010-10-22 17:45:06 +01:00
Richard W.M. Jones
1250d553f1 df: Specify format of disks (RHBZ#642934,CVE-2010-3851).
The format parameter is taken from libvirt if available, else
the user should supply the '--format' parameter (eg. for local
disk files).
2010-10-22 17:45:06 +01:00
Richard W.M. Jones
641ccab6c3 tools: Specify format of disks (RHBZ#642934,CVE-2010-3851).
Sys::Guestfs::Lib is changed in two ways: firstly we take the format
string from libvirt and pass it to add_drive_opts.  Secondly we allow
an extra format =>  parameter to open_guest which allows the
format to be specified for disk images.

All the tools are changed to add an extra --format parameter allowing
the format to be specified for direct disk images.
2010-10-22 17:45:06 +01:00
Richard W.M. Jones
44c5ee1163 fuse: Specify format of disks (RHBZ#642934,CVE-2010-3851).
For command line disk images, specify the format using --format option
in the same way as for guestfish.
2010-10-22 17:45:06 +01:00
Richard W.M. Jones
0c1d3c02a8 fish: Specify format of disks (RHBZ#642934,CVE-2010-3851).
For libvirt guests, the disk format is copied from libvirt (if
libvirt knows it).

For command line disk images, you can use --format to override
format auto-detection.
2010-10-22 17:45:06 +01:00
Richard W.M. Jones
14490c3e1a generator: Optional arguments, add-drive-opts (RHBZ#642934,CVE-2010-3851).
This large commit changes the generator so that optional arguments
can be supported for functions.

The model for arguments (known as the "style") is changed from
(ret, args) to (ret, args, optargs) where optargs is a more limited
list of arguments.

One function has been added which takes optional arguments, it is
"add-drive-opts", modelled as:

  (RErr, [String "filename"], #required
         [Bool "readonly"; String "format"; String "iface"]) #optional

Note that this function is processed in the library (does not go over
the RPC protocol to the daemon).  This has allowed us to simplify
the current implementation by omitting changes related to RPC or the
daemon, although we plan to add these at some point in the future.

From C this function can be called in 3 different ways as in these
examples:

  guestfs_add_drive_opts (g, filename,
                          GUESTFS_ADD_DRIVE_OPTS_READONLY, 1,
			  GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
                          -1);

(the argument(s) between 'filename' and '-1' are the optional ones).

  guestfs_add_drive_opts_va (g, filename, args);

where 'args' is a va_list.  This works like the first version.

  struct guestfs_add_drive_opts_argv optargs = {
    .bitmask = GUESTFS_ADD_DRIVE_OPTS_READONLY_BITMASK,
    .readonly = 1,
  }
  guestfs_add_drive_opts_argv (g, filename, &optargs);

This last form lets you construct lists of optional arguments, and
is used by guestfish and the language bindings.

In guestfish optional arguments are used like this:

  add-drive-opts filename readonly:true

In OCaml these are mapped naturally to OCaml optional arguments, eg:

  g#add_drive_opts ~readonly:true filename;

In Perl these are mapped to extra arguments, eg:

  $g->add_drive_opts ($filename, readonly => 1);

In Python these are mapped to optional arguments, eg:

  g.add_drive_opts ("file", readonly = 1, format = "qcow2")

In Ruby these are mapped to a final hash argument, eg:

  g.add_drive_opts("file", {})
  g.add_drive_opts("file", :readonly => 1)
  g.add_drive_opts("file", :readonly => 1, :iface => "virtio")

In PHP these are mapped to extra parameters.  This is not quite
accurate since you cannot omit arbitrary optional parameters, but
there's not much than can be done within the limitations of PHP
as a language.

Unimplemented in: Haskell, C#, Java.
2010-10-22 17:45:00 +01:00
Richard W.M. Jones
87be9b26e7 generator: Rearrange argt logically (RHBZ#642934,CVE-2010-3851).
This structure has accreted over time.  Rearrange the types
into a logical order.
2010-10-22 17:11:32 +01:00
Richard W.M. Jones
cd29c50ca8 daemon: Use stdint UINT64_C instead of <const>ULL. 2010-10-22 17:10:49 +01:00
Richard W.M. Jones
2109d8d86a inspector: Add comment about why --fish option implies write mode. 2010-10-22 12:13:07 +01:00
Richard W.M. Jones
4460280960 php: Create test file properly before running test. 2010-10-21 18:47:44 +01:00
Richard W.M. Jones
c97d6c16bd php: Note that tests are testing the wrong thing. 2010-10-21 18:41:56 +01:00
Richard W.M. Jones
8f30c3c3f8 ruby: Run tests one at a time, instead of in parallel. 2010-10-21 16:39:04 +01:00
Richard W.M. Jones
ea62091980 generator: Refactor code for Perl bindings.
This simplifies the code that generates the Perl bindings
by removing repeated sections.
2010-10-21 13:59:36 +01:00
Richard W.M. Jones
ed74706d80 generator: Missing newline character. 2010-10-21 11:59:49 +01:00
Richard W.M. Jones
6391d1a7cf fish: Change 'int argc' to 'size_t argc' throughout. 2010-10-21 10:50:25 +01:00
Richard W.M. Jones
fcd75e021a generator: Remove unused parameter.
generate_c_call_args optional decl parameter is never actually
used, so remove it.
2010-10-20 13:35:43 +01:00
Richard W.M. Jones
dad3fcfefd Version 1.5.22. 2010-10-19 15:18:15 +01:00
Richard W.M. Jones
7d746ba691 virt-resize: Document guest boot stops at "GRUB" (RHBZ#640961). 2010-10-18 14:34:28 +01:00
Richard W.M. Jones
f7475ec577 df: Correctly quote libvirt domain and filesystem in --csv mode (RHBZ#639986).
This fixes virt-df --csv when used with libvirt domains that contain
quotes, spaces, commas and other lesser-used characters.
2010-10-18 14:18:58 +01:00
Richard W.M. Jones
4d88a74532 virt-resize: Document qcow2 output format (RHBZ#642826). 2010-10-18 13:35:06 +01:00
Richard W.M. Jones
94fa736b64 virt-resize: List truncate(1) in SEE ALSO section. 2010-10-18 13:33:02 +01:00
Richard W.M. Jones
a80177cc84 tools: Add section describing quoting libvirt domain names to docs (RHBZ#643624) 2010-10-18 13:18:20 +01:00
Richard W.M. Jones
b3d27793f0 parted: Don't return "loop" for non-partitioned devices (RHBZ#634246).
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.
2010-10-18 12:56:54 +01:00
Richard W.M. Jones
361c513dc3 contrib: Note about what needs to be done for visualization. 2010-10-18 12:44:08 +01:00
Richard W.M. Jones
06397c2f1f todo: Add wishlist items to to-do list. 2010-10-18 12:41:41 +01:00
Richard W.M. Jones
c50eb8f1cc todo: Add note about using blktrace. 2010-10-06 16:38:12 +01:00
Richard W.M. Jones
241c34fb7a contrib: More trace visualization. 2010-10-06 12:12:34 +01:00
Richard W.M. Jones
13276f7534 debug: Add qtrace <device> on|off to allow selective traces. 2010-10-06 11:26:25 +01:00
Richard W.M. Jones
4f6bd18d2e part-disk: Align whole disk partition to 64 sectors.
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.
2010-10-06 09:08:39 +01:00
Richard W.M. Jones
ccc5425105 contrib: Fix small mistake in README file. 2010-10-05 22:48:37 +01:00
Richard W.M. Jones
37e0c30d90 contrib: Update README files. 2010-10-05 22:21:43 +01:00
Richard W.M. Jones
3e1a535270 contrib: Visualizing block device access and alignment. 2010-10-05 22:19:15 +01:00
Richard W.M. Jones
6fbbcdd64c ocaml: Add g#ocaml_handle method. 2010-10-04 20:34:36 +01:00
Richard W.M. Jones
63bfcdbdd8 ocaml: Document g#close () method for objects. 2010-10-04 20:33:14 +01:00
Richard W.M. Jones
6af1cd7245 ocaml: Create the handle when the object is instantiated.
Previously we had only one handle shared between all objects .. oops.
This fixes commit 67636f7210.
2010-10-04 20:29:05 +01:00
Richard W.M. Jones
67636f7210 ocaml: Add alternate object-oriented programming style.
In original style:

let () =
  let filename = Sys.argv.(1) in
  let g = Guestfs.create () in
  Guestfs.add_drive_ro g filename;
  Guestfs.launch g;
  let roots = Guestfs.inspect_os g in
  print_endline (Guestfs.inspect_get_product_name g roots.(0))

The same code in the new OO style:

let () =
  let filename = Sys.argv.(1) in
  let g = new Guestfs.guestfs in
  g#add_drive_ro filename;
  g#launch ();
  let roots = g#inspect_os () in
  print_endline (g#inspect_get_product_name roots.(0))
2010-10-03 21:18:25 +01:00
Richard W.M. Jones
1a3324ea2b test-copy: Skip this test if /dev/fd is missing, because of broken mock 1.1.4. 2010-10-02 09:10:22 +01:00
Richard W.M. Jones
887a79d1d1 test-virt-resize: Skip this test on 32 bit hosts. 2010-10-02 09:07:42 +01:00
Richard W.M. Jones
fd10487c9e Version 1.5.21. 2010-10-01 21:04:07 +01:00
Richard W.M. Jones
ffc75da713 fish: Fix glob command (RHBZ#635969).
This is a fix for the glob command in guestfish which was inadvertently
broken in commit c359347dd4.

This also appears to fix:
  https://bugzilla.redhat.com/show_bug.cgi?id=635969
  glob echo mkfs ext2 /dev/vd[b-t]1 prints garbage
2010-10-01 11:13:06 +01:00
Richard W.M. Jones
c6c030b64b Add test for virt-resize.
This tests a number of things which have caused problems for us:

 - resizing PVs and LV content
 - handling GPT format disks
 - using qcow2 as a target disk format
 - shrinking disk images

Note that the disk content is empty (not a real VM), but this is
adequate since all we want to test are the operations and calculations
done by virt-resize.  We are not interested here in whether e2fsprogs
and LVM actually works.
2010-09-27 18:28:34 +01:00
Richard W.M. Jones
0dc1f8e7ae resize: Fix handling of GPT and qcow2 (RHBZ#633766, RHBZ#633096).
Previously we copied the bootloader data directly from the
source disk image to the target disk image using host file
operations (before launching libguestfs).  This has two problems:
firstly it has no chance of working with qcow2, and secondly
it didn't behave properly with GPT.

This changes the code so that everything is done through
libguestfs.  Block device sizes are now calculated properly
for qcow2 (RHBZ#633096) because this is done using the libguestfs
blockdev_getsize64 call.  The partition table is still created
by parted, but to workaround a bug in parted this is done before
copying the bootloader.  Finally the bootloader copy is done
using the new APIs pread-device and pwrite-device.

Shrinking now works, at least for simple cases (RHBZ#633766).
2010-09-27 18:28:30 +01:00
Richard W.M. Jones
7e4bf29fdf New API: pread-device, partial read for devices. 2010-09-27 12:04:44 +01:00
Richard W.M. Jones
e65f521363 pread: Check count and offset parameters are not negative. 2010-09-27 10:51:38 +01:00
Richard W.M. Jones
533aff2879 Freshen POD (manual pages) stylesheet. 2010-09-27 10:12:28 +01:00
Richard W.M. Jones
a50cdb512c Version 1.5.20. 2010-09-26 22:41:24 +01:00
Richard W.M. Jones
eeaab2ba84 New API: pwrite-device
This is the same as the existing 'pwrite' API call, but allows you
to write to a device.
2010-09-26 22:21:36 +01:00
Richard W.M. Jones
5a8c8b8bf6 pwrite: Check offset is not negative. 2010-09-26 22:21:36 +01:00
Richard W.M. Jones
406dbf7565 fish: Refresh guestfish documentation. 2010-09-26 22:21:35 +01:00
Richard W.M. Jones
a707068293 Document ambiguity between devices and paths in API. 2010-09-26 19:35:33 +01:00
Richard W.M. Jones
d72a617a26 Document accurately how supermin appliance uses /tmp as a cache. 2010-09-24 19:28:01 +01:00
Richard W.M. Jones
c9c0ac7d36 Allow $TMPDIR to override most temporary directory uses.
Be more consistent in allowing the user to override use of the
temporary directory by specifying $TMPDIR.  Also prefer P_tmpdir
macro (defined in <stdio.h>) if that is defined, rather than
hard-coding "/tmp" for the fallback location.
2010-09-24 19:25:06 +01:00
Richard W.M. Jones
840536ea5a Call blockdev --rereadpt then udev_settle after sfdisk commands.
This updates commit 956fc5a3fe so
that we call udev_settle after rereading the partition table.  This
ensures that the devices nodes for the new partitions have been
created.
2010-09-24 19:11:56 +01:00
Daniel Cabrera
be49d1efa2 Update Spanish translations (RHBZ#636918). 2010-09-23 18:11:35 +01:00
Piotr Drąg
efdc9c0503 Update Polish translations (RHBZ#502533). 2010-09-23 14:45:50 +01:00
Richard W.M. Jones
a7a1c98152 Version 1.5.19. 2010-09-22 21:50:46 +01:00
Richard W.M. Jones
df69543720 regressions: Test just-built guestfish.
Instead of testing the installed /usr/bin/guestfish.

This fixes commit ddda0f7bd0.
2010-09-22 17:43:34 +01:00
Richard W.M. Jones
956fc5a3fe Call blockdev --rereadpt after sfdisk commands.
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.
2010-09-22 16:35:52 +01:00
Richard W.M. Jones
f6fda69953 Version 1.5.18. 2010-09-22 15:37:34 +01:00
Richard W.M. Jones
ddda0f7bd0 Test guestfish -a and guestfish -d options.
Since these options were both broken in released version 1.5.17,
best to have a regression test to catch this in future.
2010-09-22 14:39:01 +01:00
Richard Jones
e319b120ac appliance: Ignore unreadable dbus service file (Fedora 15). 2010-09-22 14:10:13 +01:00
Richard W.M. Jones
734b2d2483 fish: Fix segfault in free_drives() function.
This updates commit 8ea62c8d7f
so it doesn't try to free the optarg (stack-allocated) strings.
2010-09-22 11:59:58 +01:00
Richard W.M. Jones
460aa67118 Version 1.5.17. 2010-09-21 22:51:34 +01:00
Richard W.M. Jones
a54aa3caae Update release notes for new features in 1.5 branch. 2010-09-21 22:49:35 +01:00
Richard W.M. Jones
d75a2bff12 fish: Implement 'hexedit' command. 2010-09-21 19:51:22 +01:00
Richard W.M. Jones
5d4ae18e2b New APIs: upload-offset and download-offset
These APIs allow you to efficiently write and read parts of
files or devices.
2010-09-21 19:51:22 +01:00
Richard W.M. Jones
8c5a4d949e leak: Clear history before exiting guestfish.
Clear the in-memory history before exiting.  This removes
some but not all memory leaks associated with using the GNU
History library.  As far as I can tell it is not possible to
free up everything used by GNU History.

(Found by valgrind).
2010-09-21 19:51:22 +01:00
Richard W.M. Jones
8ea62c8d7f leak: Free list of drives and mountpoints in guestfish.
Previously the list of -a, -d, -m, -N parameters were leaked.  This
change frees them explicitly.

This is not such an important fix since guestfish is a one-shot
program, but it aids in finding other leaks in future.

(Found by valgrind).
2010-09-21 19:51:22 +01:00
Richard W.M. Jones
e7f62742b6 leak: Free PCRE regexps when library is unloaded.
The compiled PCRE regexps used for inspection were being leaked when
the library was unloaded.

(Found by valgrind).
2010-09-21 19:51:22 +01:00
Richard W.M. Jones
6d276dae8d leak: Appliance name was leaked during guestfs_launch.
This frees the string containing the name of the appliance
which was previously being leaked during launch.

(Found by valgrind).
2010-09-21 19:51:22 +01:00
Matthew Booth
0132890790 Add more exclusions to .gitignore. 2010-09-21 13:23:27 +01:00
Matthew Booth
d1c2287fe4 Fix appliance build dependency problem
The appliance was being completely rebuilt every time guestfsd was updated. This
was because make.sh depended on guestfsd, which it had to do because it
called update.sh to install guestfsd.

This fix removes the call to update.sh in make.sh, and therefore the dependency
on guestfsd. The Makefile already includes a rule to run update.sh when guestfsd
is updated, so this was unnecessary.
2010-09-21 10:56:47 +01:00
Richard W.M. Jones
ff4ae8633e fish: Add --echo-keys option to allow passphrases/keys to be echoed.
See also:
http://catless.ncl.ac.uk/Risks/26.17.html#subj13.3
2010-09-21 10:56:47 +01:00
Richard W.M. Jones
832864922a df: Add --one-per-guest option for using one appliance per guest. 2010-09-20 16:03:09 +01:00
Richard W.M. Jones
17e7cb9937 Fix error launching libguestfs when euid != uid.
When writing to a RHEV target, virt-v2v launches the libguestfs
appliance with euid:egid = 36:36, which is required to write to
an NFS target using root_squash.

Since we changed to using a cached appliance, this causes an error on
start up, as the cached files are owned by root, but the cache directory
is owned by 36:36.  The reason is that bash resets euid to uid and
egid to gid so when febootstrap-supermin-helper is executed, it runs as
root:root.  The cache directory was created by libguestfs directly so
it has the correct ownership.

This patch fixes the issue by using explicit fork/exec instead of
system (ie. not going via a shell) and by setting the real UID and
GID to the effective UID and GID before execing.
2010-09-20 15:04:57 +01:00
Richard W.M. Jones
6123abc165 todo: Suggest removing repo name from appliance name. 2010-09-20 13:07:11 +01:00
Richard W.M. Jones
0003ea2c3d generator: Generate guestfish-only commands.
The guestfish-only commands such as 'alloc' and 'edit' are
now generated from one place in the generator instead of being
spread around ad-hoc in the C code.
2010-09-18 09:38:05 +01:00
Richard W.M. Jones
585fceb335 fish: In guestfish(1) turn command references into links. 2010-09-18 09:11:31 +01:00
Richard W.M. Jones
3eb76554ef fish: Correction for online help for 'edit' and 'more' commands.
This corrects commit b5c287bcd4
and commit 639ca1828b.
2010-09-17 14:35:48 +01:00
Richard Jones
a37ec221af Version 1.5.16. 2010-09-15 22:12:35 +01:00
Richard Jones
6b2ae9a8b0 configure: Make "fedora-13" the default repository. 2010-09-15 22:08:35 +01:00
Richard Jones
dd093a7660 fish: If -m option fails, suggest a mountpoint. 2010-09-15 21:47:37 +01:00
Richard Jones
325587d89e todo: Remove section since we now have list-filesystems API. 2010-09-15 20:49:32 +01:00
Richard Jones
d4ba3d3421 Version 1.5.15. 2010-09-15 20:35:06 +01:00
Richard Jones
000c4a82fb New API: list-filesystems: list filesystems
This API is a simpler replacement for the guestfish commands
list-devices / list-partitions / lvs, in the case where you are
just examining a guest by hand to see what it contains.

Typical usage and output in guestfish is like this:

$ guestfish --ro -a /dev/vg_trick/F13x64
><fs> run
><fs> list-filesystems
/dev/vda1: ext4
/dev/vg_f13x64/lv_root: ext4
/dev/vg_f13x64/lv_swap: swap

It can also be used to replace programs that try to mount
devices to determine if they are mountable filesystems.
2010-09-15 19:42:23 +01:00
Richard Jones
ffd4820ffe New API: part-to-dev: Convert partition name to device name.
This adds a formal API for going from a partition to the containing
device, eg. /dev/sda1 -> /dev/sda
2010-09-15 17:16:51 +01:00
Richard Jones
ff38fea645 generator: Add TestOutputDevice.
This is for testing functions that return a device or partition
name, so that we can compare the return value with the canonical
device name (eg. "/dev/vda1" == "/dev/sda1").
2010-09-15 17:16:51 +01:00
Richard Jones
43d5ea6f1e todo: More use of libblkid. 2010-09-15 16:37:24 +01:00
Richard Jones
c98f073361 fish: In usage message use new-style -i option syntax. 2010-09-14 22:29:08 +01:00
Richard Jones
42b62b8240 fish: Update copyright dates in usage message. 2010-09-14 22:28:10 +01:00
Richard Jones
31a2c006cd fish: Remove extraneous space from usage message. 2010-09-14 22:27:06 +01:00
Richard Jones
7c87dd1cf9 todo: More ideas. 2010-09-14 22:17:24 +01:00
Richard Jones
5a7c430f1f Version 1.5.14. 2010-09-14 13:29:59 +01:00
Richard Jones
d3c6e50422 configure: Check for virtio-serial support in qemu.
All other vmchannel methods are obsolete, but we were still trying
to check for them.  This replaces all of them with a simple check
for virtio-serial.
2010-09-14 12:24:54 +01:00
Richard Jones
9cab7e3ecd pardus: Check for cpio in configure. 2010-09-14 12:24:12 +01:00
Richard Jones
17b50a384f Update Spanish translation (RHBZ#633357). 2010-09-13 19:06:39 +01:00
Richard Jones
a403e74355 build: Add run-test-tool-locally to EXTRA_DIST. 2010-09-13 16:01:53 +01:00
Richard Jones
2b1e36db75 Version 1.5.13. 2010-09-13 15:19:46 +01:00
Richard Jones
7419335e11 appliance: Disable setting scheduler to noop.
This is a workaround until
https://bugzilla.redhat.com/show_bug.cgi?id=630583
is fixed (bug in Linux 2.6.36).
2010-09-13 14:49:58 +01:00
Richard Jones
3deebe5bf1 ubuntu: Remove bogus debirf file. 2010-09-13 14:45:18 +01:00
Richard Jones
75f0a92deb ubuntu: Add linux-image to the packagelist.
It seems that linux-image (ie. the kernel) is omitted in some
versions of the base packages.
2010-09-13 14:44:46 +01:00
Richard Jones
93ae3fa9da ubuntu: /proc can be a symlink
If it's a symlink then the succeeding mount commnd will fail.
Remove it and make a /proc directory.
2010-09-13 14:44:05 +01:00
Richard Jones
da107cf3d9 build: 'make quickcheck' rule now uses new run-test-tool-locally script. 2010-09-13 14:42:47 +01:00
Richard Jones
9f653edcdc build: hivex is required.
hivex library has been required since we moved the inspection
code to C.  Check for this in configure.ac.
2010-09-11 17:16:22 +01:00
Richard Jones
f565e71560 Version 1.5.12. 2010-09-11 13:47:15 +01:00
Richard Jones
e903739935 build: require Augeas for library.
Augeas has been required since we moved the inspection code to C,
however we were not correctly enforcing this in configure.ac, nor
correctly linking to the library until now.
2010-09-11 13:42:04 +01:00
Richard Jones
67fd3a7d99 generator: Provide no-op generator if no OCaml compiler. 2010-09-11 13:42:00 +01:00
Richard Jones
2fbac04b9d build: Don't distribute src/generator.ml, no longer exists. 2010-09-11 13:14:04 +01:00
Richard Jones
b42262c3db generator: Calculate MD5 of test.iso at runtime.
Because this used to be compiled into the C test, it changed
every time the ISO was rebuilt (which because of Makefile deps
was every run).

Now it is calculated at runtime so the C test file doesn't keep
changing.
2010-09-11 12:44:55 +01:00
Richard Jones
451a28349b generator: Don't use real uuidgen for UUIDs.
This was one reason why capitests/tests.c changed every time the
generator was run.
2010-09-11 12:44:52 +01:00
Richard Jones
04d8209077 Split generator into separate source files.
'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.
2010-09-11 12:04:44 +01:00
Richard Jones
264629b9f0 syntax: Replace -a and -o with && and || for portability. 2010-09-11 08:11:43 +01:00
Richard Jones
431503d007 syntax: Use exit (EXIT_SUCCESS) instead of hard-coded number. 2010-09-10 23:00:07 +01:00
Richard Jones
513363290e syntax: Remove unused assert.h header. 2010-09-10 22:57:52 +01:00
Richard Jones
21aac863e2 syntax: Remove unused ignore-value.h header. 2010-09-10 22:57:52 +01:00
Richard Jones
0e422c0f59 syntax: Remove unused signal.h header. 2010-09-10 22:57:52 +01:00
Richard Jones
a0b7045e0a syntax: Remove unused c-ctype.h header. 2010-09-10 22:57:52 +01:00
Richard Jones
c1b6352677 syntax: Fully bracket m4 macro arguments. 2010-09-10 22:57:52 +01:00
Richard Jones
b3d94d6a71 syntax: Remove trailing spaces. 2010-09-10 22:57:48 +01:00
Richard Jones
b4a3aec60e syntax: Use spaces instead of tabs for indentation. 2010-09-10 22:57:48 +01:00
Richard Jones
3d994f3d8e syntax: Replace _prohibit_regexp with _sc_search_regexp. 2010-09-10 22:51:39 +01:00
Richard Jones
c359347dd4 fish: glob should only print commands when trace mode is enabled. 2010-09-10 13:26:10 +01:00
Richard Jones
b033b55558 fish: Add regression test for copy-in and copy-out. 2010-09-10 13:25:40 +01:00
Richard Jones
3161cb58a5 README: Document virtio-serial is now the only vmchannel. 2010-09-10 12:01:03 +01:00
Richard Jones
b1e65806a1 fish: const-correctness fixes in copy.c 2010-09-10 11:53:46 +01:00
Richard Jones
f6246e932c Version 1.5.11. 2010-09-10 10:43:09 +01:00
Richard Jones
025583593b Update OCaml dependencies. 2010-09-10 10:28:51 +01:00
Richard Jones
646813ec51 Update PO files. 2010-09-10 10:28:37 +01:00
Richard Jones
878c8c77d8 fish: Fix 'copy-out' command when local directory is "/foo". 2010-09-10 10:27:45 +01:00
Richard Jones
3578f170a1 fish: Fix typo in documentation of copy-out. 2010-09-10 00:02:56 +01:00
Richard Jones
8902b33c0e Version 1.5.10. 2010-09-09 23:25:37 +01:00
Richard Jones
f383ac139f todo: Remove discussion of copy-in/copy-out. 2010-09-09 23:25:23 +01:00
Richard Jones
2635a9c70e fish: Implement copy-in and copy-out commands. 2010-09-09 23:12:19 +01:00
Richard Jones
43eed09112 New APIs: is-chardev, is-blockdev, is-fifo, is-symlink, is-socket
These complement the existing is-file and is-dir APIs.
2010-09-09 22:45:22 +01:00
Richard Jones
3a99114360 daemon: Move 'exists', 'is-file' and 'is-dir' to separate file.
This commit is just code movement.
2010-09-09 22:45:22 +01:00
Richard Jones
55b6e18f95 generator: Fix incorrect shortdesc in docs for 'is-dir' command. 2010-09-09 22:44:53 +01:00
Richard Jones
22aa9268f5 generator: Fix documentation for 'is-file' command. 2010-09-09 22:44:53 +01:00
Richard Jones
639ca1828b fish: Fix 'more' command to work with any file. 2010-09-09 14:11:32 +01:00
Richard Jones
b5c287bcd4 fish: Fix 'edit' command to work with any file. 2010-09-09 14:11:20 +01:00
Richard Jones
13be761682 guestfs: Reference guestfs-browser architecture in threads documentation. 2010-09-09 13:53:08 +01:00
Richard Jones
b1454e3898 guestfs: Document progress notification messages in protocol. 2010-09-09 13:52:48 +01:00
Richard Jones
e2ef068cb7 guestfs: More accurate documentation for initial message. 2010-09-09 13:52:32 +01:00
Richard Jones
6d9f8f5c14 guestfs: Remove traces of documentation for non-existent 'low-level API' 2010-09-09 13:51:52 +01:00
Richard Jones
f3c05da4f9 guestfs: Fix typo in man page. 2010-09-09 13:42:09 +01:00
Richard Jones
979bcc5538 todo: Notes on virt copy command. 2010-09-09 13:40:45 +01:00
Richard Jones
6a87e0af24 Bring TODO file up to date. 2010-09-08 17:50:44 +01:00
Richard Jones
c51ade2e85 Version 1.5.9. 2010-09-08 11:41:25 +01:00
Richard Jones
d5c8d3b45b fish: Add guestfish -N bootroot and -N bootrootlv for creating boot+root disks. 2010-09-08 11:00:00 +01:00
Richard Jones
574df371a0 fish: Add guestfish -N lvfs for creating formatted LVs. 2010-09-08 10:24:22 +01:00
Richard Jones
422a8d85d2 fish: Add guestfish -N lv for creating disks with LVs. 2010-09-08 10:24:22 +01:00
Richard Jones
45f72c804b fish: Improve appearance of guestfish -N help output. 2010-09-08 10:24:22 +01:00
Richard Jones
fa918b166a fish: Allow guestfish -N help for listing prepared disk image help. 2010-09-08 09:59:32 +01:00
Richard Jones
60cdd02b02 fish: Generate list of prepared disk image types.
This commit shouldn't change the semantics of the code.
2010-09-08 09:59:29 +01:00
Richard Jones
06c906168c test-tool: Add a 'run-test-tool-locally' script.
This can be used to run the test tool without installing it.
It sets the environment variables and command line arguments
up correctly to run the tool from the build directory.
2010-09-06 10:13:31 +01:00
Richard Jones
b76284876b appliance: init script does 'ls -lR /dev' (verbose only)
It's useful to see what files are in /dev subdirectories
at boot, eg. for looking at virtio-serial ports.
2010-09-06 10:04:01 +01:00
Richard Jones
aa96881a51 daemon: Don't warn about 'long long' usage.
This removes a fatal warning (-Werror) which stops compilation
on 32 bit machines.
2010-09-06 10:03:44 +01:00
Richard Jones
bd77c8d1b4 php: Remove 'make clean' rule in subdirectory. 2010-09-05 16:51:45 -04:00
Richard Jones
56da696fc2 Version 1.5.8. 2010-09-04 14:27:06 +01:00
Richard Jones
2c61e04c45 PHP bindings.
Note that these are not complete on 32 bit architectures.  PHP doesn't
offer any convenient 64 bit type (on 32 bit).  Therefore you should
always use these PHP bindings on 64 bit.
2010-09-04 13:38:03 +01:00
Richard Jones
2d8fd7dacd Define LIBGUESTFS_HAVE_<shortname> for C API functions.
The actions each have a corresponding define, eg:

  #define LIBGUESTFS_HAVE_VGUUID 1
  extern char *guestfs_vguuid (guestfs_h *g, const char *vgname);

However functions which are for testing, debugging or deprecated do
not have the corresponding define.  Also a few functions are so
basic (eg. guestfs_create) that there is no point defining a symbol
for them.
2010-09-04 13:38:03 +01:00
Richard Jones
5fc69ce3ec build: guestfs-structs.h was missing from libguestfs_la_SOURCES. 2010-09-04 13:38:03 +01:00
Richard Jones
8ad79a7c4d Add full docs pot file. 2010-09-04 13:37:58 +01:00
Richard Jones
8c48f5ae2e Allow manual pages and POD files to be translated.
This uses the optional po4a package to split these files into
PO files for translation, and reassemble afterwards.

Note this creates an extra pot file (po-docs/libguestfs-docs.pot).
We don't (yet) combine this with the main po/libguestfs.pot file.
The 'libguestfs-docs.pot' file included in this commit is not the
real thing, just a short cut down snippet for testing.  The real
thing is created if you update one of the dependent files and
rebuild.

Note also the dummy ja.po, for testing the principles.
2010-09-02 20:37:06 +01:00
Geert Warrink
1193df7e0a Add Dutch translation (RHBZ#629593). 2010-09-02 14:57:14 +01:00
Richard Jones
25521f17d5 ruby: Add Guestfs::Guestfs.new() method.
This is a more standard way to create objects in Ruby.  The old
way was to call the module function Guestfs::create() which still
works.
2010-09-02 12:03:54 +01:00
Richard Jones
b8b0c99b46 perl: Document handle is a hashref.
For details see commit eb566f7dc7.
2010-09-02 11:11:55 +01:00
Richard Jones
0f24424f35 perl: Add documentation about testing availability of methods and features. 2010-09-02 10:58:28 +01:00
Richard Jones
71f5cc5a2e build: Link static -ltinfo into guestfish.static binary. 2010-09-01 18:44:33 +01:00
Richard Jones
d8daebf309 Version 1.5.7. 2010-09-01 18:11:06 +01:00
Richard Jones
231051474b fish: Add missing header file to sources. 2010-09-01 18:11:05 +01:00
Richard Jones
d1485e02f5 ocaml: Add test for progress notification callbacks. 2010-09-01 17:12:15 +01:00
Richard Jones
8c37961b45 debug: Add 'debug progress' command.
This debugging command generates progress notification messages,
used for testing purposes.
2010-09-01 17:03:19 +01:00
Richard Jones
99679fe5a2 debug: Arrange prototypes in alphabetical order. 2010-09-01 15:38:15 +01:00
Richard Jones
83f381f5cc daemon: Enable debug command by default.
The debug command is useful for internal testing, and so should
be enabled by default in all builds.

Note that it is still *not* part of the stable ABI.
2010-09-01 15:37:24 +01:00
Richard Jones
867319ec5f Consistent use of 'void *opaque' to refer to opaque pointer in C API.
We inconsistently used 'void *data' or 'void *opaque' all over to
refer to the same thing.  Use 'void *opaque' in all places in the
published API and documentation.
2010-09-01 14:20:22 +01:00
Richard Jones
c9bc865a7a resize: Add progress bar to virt-resize.
With this commit you will see a plain progress bar during the
lengthy copy operations, similar to below:

Summary of changes:
/dev/sda1: partition will be left alone
/dev/sda2: partition will be resized from 7.5G to 9.5G
/dev/sda2: content will be expanded using the 'pvresize' method
Copying /dev/sda1 ...
[############################################################################]
Copying /dev/sda2 ...
[########################################------------------------------------]
2010-09-01 14:20:22 +01:00
Richard Jones
8ff17e1c9c perl: bindings to progress callback. 2010-09-01 14:20:21 +01:00
Richard Jones
3978a308a5 ocaml: bindings to progress callback. 2010-09-01 14:20:21 +01:00
Richard Jones
4ea0abfce4 Implement private data area.
The private data area is a hash table which is associated with
libguestfs handles, that C callers may use to store arbitrary
data for the lifetime of the handle.

Later the OCaml bindings will use this in order to implement
callbacks.
2010-09-01 14:20:21 +01:00
Richard Jones
54837f6d7b fish: Implement progress bars in guestfish.
The progress bar is updated 3 times per second, and is not displayed
at all for operations which take less than two seconds.

You can disable progress bars by using the flag --no-progress-bars,
and you can enable progress bars in non-interactive sessions with
the flag --progress-bars.

A good way to test this is to use the following command:

guestfish --progress-bars \
          -N disk:10G \
          zero-device /dev/sda

(adjust "10G" to get different lengths of time).
2010-09-01 14:20:02 +01:00
Richard Jones
3003df6bbc fish: Detect UTF-8 output and open termcap/terminfo database.
Provide a generic mechanism within guestfish to detect if
output if UTF-8 and to open the termcap (or terminfo) database
for the current terminal type.
2010-09-01 12:03:35 +01:00
Richard Jones
65510965b3 Add progress messages to download command. 2010-09-01 12:03:35 +01:00
Richard Jones
133a92be69 Add progress messages to zero-device command. 2010-09-01 10:00:40 +01:00
Richard Jones
88ab203e61 Add progress messages to zero command. 2010-09-01 10:00:37 +01:00
Richard Jones
55938405cc Add progress messages to fill-pattern command. 2010-09-01 10:00:34 +01:00
Richard Jones
7f1ecfc87e Add progress messages to fill command. 2010-09-01 10:00:30 +01:00
Richard Jones
41512f498b Add progress messages to copy-size command. 2010-08-31 19:27:35 +01:00
Richard Jones
e776a46ffc Implement progress messages in the daemon and library.
This implements progress notification messages in the daemon, and
adds a callback in the library to handle them.

No calls are changed so far, so in fact no progress messages can
be generated by this commit.

For more details, see:
https://www.redhat.com/archives/libguestfs/2010-July/msg00003.html
https://www.redhat.com/archives/libguestfs/2010-July/msg00024.html
2010-08-31 19:27:34 +01:00
Richard Jones
a8a44cecba ocaml: Remove old entry from .gitignore file. 2010-08-31 19:27:34 +01:00
Richard Jones
377926be5b Version 1.5.6. 2010-08-27 22:01:23 +01:00
Richard Jones
d46230f94e Requires febootstrap >= 2.9. 2010-08-27 21:47:49 +01:00
Richard Jones
d89a88d67e daemon: Set O_CLOEXEC flag on the virtio-serial file descriptor. 2010-08-27 15:29:33 +01:00
Richard Jones
4932fdca3c build: Don't add version extra string to the version number.
If this string was non-empty, then it broke a lot of things because
autoconf and other parts of the build system were expecting this
string to contain a simple MAJOR.MINOR.RELEASE version number.

This requires changes to guestfish and guestmount so they use the
guestfs_version API to fetch the version from the library.  (The
Perl tools were already doing it this way).  In a way this is more
accurate, because it's no longer hard-coded in the binary, but
fetched from the dynamically linked libguestfs.so.
2010-08-27 13:38:49 +01:00
Richard Jones
1c523760d3 Update BUGS, PO files. 2010-08-26 16:43:50 +01:00
Daniel Cabrera
b59aff0bae Update Spanish translations (RHBZ#627556). 2010-08-26 16:40:44 +01:00
Daniel Cabrera
3f7965b6de Updated Spanish translations (RHBZ#626843). 2010-08-26 16:39:39 +01:00
Piotr Drąg
9bc72e2f9b Update Polish translation (RHBZ#502533). 2010-08-26 16:38:11 +01:00
Richard Jones
92876a49db Prepare for version 1.5.5. 2010-08-26 16:37:24 +01:00
Richard Jones
daead56fae rescue: Fix typo in comment. 2010-08-26 15:55:34 +01:00
Matthew Booth
c3194e4d37 Ignore launch() error in virt-rescue. (RHBZ#618556)
launch() expects guestfsd to start, which it never does in virt-rescue, so it
always returns an error about the appliance shutting down unexpectedly.
2010-08-26 15:53:25 +01:00
Matthew Booth
d3fc7e1e4d Shut down the appliance cleanly
When guestfsd exits, or the user exits the virt-rescue shell, the init script
exits which causes the kernel to panic. This isn't really a functional issue, as
all useful work is done by this point. However, it does cause virt-rescue to
display an unsightly error message.

This patch causes the appliance to power off cleanly before the init script
exits. Note it actually does a reboot rather than a poweroff. This is because
ACPI is disabled in the appliance, meaning poweroff doesn't work, but qemu is
configured not to restart on reboot.
2010-08-26 15:04:38 +01:00
Matthew Booth
c0b38fbb27 Call sync after guestfsd exits
Core files are not reliably written to disk if guestfsd dumps core. This patch
makes libguestfs do the same appliance cleanup for guestfsd and virt-rescue,
which seems to fix the matter.

It also removes a redundant sleep and additional sync when exiting virt-rescue.
2010-08-26 15:04:35 +01:00
Matthew Booth
a45302cb8a Add a core_pattern debug command
This adds a new debug command, core_pattern, which writes a new pattern for
coredump files to the appliance kernel, and sets the daemon's hard and soft core
limits to infinity.
2010-08-26 14:00:57 +01:00
Richard Jones
a0d514f13d Include statically linked binaries in the binary distribution. 2010-08-25 17:22:54 +01:00
Richard Jones
27ef6f9171 Rename global 'xdr_str'.
Two bits of XDR both contained a definition called 'str' which
means that 'xdr_str' was being exported globally twice.  Because
of the linker script this didn't affect us.  But it's best to
rename this global so that conflicts cannot arise.
2010-08-25 11:41:17 +01:00
Daniel Berrange
6d15d4e7c2 Add -nodefconfig command line option to qemu.
Without this option, qemu will read some defaults from /etc/qemu/
configuration files.
2010-08-24 14:27:15 +01:00
Richard Jones
e503b31c15 Version 1.5.4. 2010-08-24 13:28:52 +01:00
Richard Jones
4963be8500 New APIs: set-network and get-network to enable network support.
guestfs_set_network (g, true) enables network support in the appliance.
2010-08-24 12:37:54 +01:00
Richard Jones
10d1aa3b64 build: Add 'bindist' rule for building binary distribution. 2010-08-24 11:54:42 +01:00
Richard Jones
5c1346dae7 Don't print debug messages when not in verbose mode.
Don't print them because no one's listening ...
2010-08-24 11:54:42 +01:00
Richard Jones
831b1fc180 Change protocol to send Linux errno from daemon to library.
This changes the protocol so that the Linux errno (if available)
is sent back to the library.  Note that the errno is not yet
made available to callers, since it is not clear how best to
present this Linux-specific number.
2010-08-24 11:54:42 +01:00
Richard Jones
90d06e2888 Raise error message max size to 64K.
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.
2010-08-24 11:54:41 +01:00
Richard Jones
866ec00d1f Use virtio-serial, remove other vmchannel methods.
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)
2010-08-24 11:54:37 +01:00
Richard Jones
5c31f6126b Change to using ext2-based, cached supermin appliance.
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.
2010-08-23 16:00:39 +01:00
Richard Jones
4b753c6208 Make print_timestamped_message into a cross-module function.
This is just code movement.
2010-08-23 12:56:54 +01:00
Richard Jones
a2d4a8bf07 Factor out code for locating the temporary directory.
This is just code movement.
2010-08-23 12:56:14 +01:00
Richard Jones
4d2f1632ad Whitespace change: Add blank line between structures and functions. 2010-08-21 12:45:51 +01:00
Richard Jones
c56fa58721 appliance: Remove some obsolete testing rules from Makefile.am
This haven't been used -- and haven't worked -- for a long time.
2010-08-21 10:39:39 +01:00
Richard Jones
83c221764d Version 1.5.3 2010-08-17 14:30:58 +01:00
Richard Jones
ad373a4d6c Remove old ocaml-inspector code.
Not used by anyone, didn't work well, and replaced now by the
C inspection APIs.
2010-08-17 14:09:26 +01:00
Richard Jones
4440e22f4f fish: Reimplement -i option using new C-based inspection.
Don't shell out to virt-inspector.  Instead, use the new C-based
inspection APIs.

This is much faster.

The new syntax is slightly different:

  guestfish -a disk.img -i
  guestfish -d guest -i

However, the old syntax still works.
2010-08-17 14:09:25 +01:00
Richard Jones
1a9aa565b3 fish: Add -c/--connect and -d/--domain options.
The -d option lets you specify libvirt domains.  The disks from
these domains are found and added, as if you'd named them with -a.

The -c option lets you specify a libvirt URI, which is needed
when we consult libvirt to implement the above.
2010-08-17 14:09:25 +01:00
Richard Jones
8289aa1ad6 New APIs for guest inspection.
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.
2010-08-17 14:09:25 +01:00
Richard Jones
65e9ac4595 New APIs: findfs-label and findfs-uuid
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'
2010-08-17 14:09:25 +01:00
Richard Jones
ad4cff2625 New API: file-architecture
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.
2010-08-17 14:09:25 +01:00
Richard Jones
3cd272fc6a generator: No need to redefine safe_* macros.
These are already defined in "guestfs-internal.h" which is
included in the .c file.
2010-08-17 14:09:25 +01:00
Richard Jones
3905cc7ab4 Add safe_strndup call. 2010-08-17 14:09:25 +01:00
Matthew Booth
64d70228c7 Send trace output to stderr.
Trace output sent to stdout can be lost in the event of a crash due to
buffering.  This patch sends it to stderr instead.
2010-08-17 12:19:05 +01:00
Richard Jones
834077946a Python: Use new PyCapsule API where supported.
See:
http://lists.fedoraproject.org/pipermail/devel/2010-August/141064.html
2010-08-17 10:31:39 +01:00
Richard Jones
29925244c1 generator: Fix typo in error message for RConstOptString. 2010-07-31 14:35:07 +01:00
Richard Jones
6280ac9b98 New API: is-lv: check if a block device is a logical volume (RHBZ#619793)
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
2010-07-30 16:32:35 +01:00
Richard Jones
737181bcd7 Rename internal functions.
This is an update to commit 41f25ab3df.

Internal functions should be named guestfs___* (3 underscores) to
avoid clashing with the implementation of actions (2 underscores).
2010-07-28 12:41:29 +01:00
Richard Jones
41f25ab3df Rearrange library code into separate files.
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.
2010-07-27 13:05:41 +01:00
Richard Jones
a617f521a4 Rename guestfs-{actions,bindtests}.c to {actions,bindtests}.c
Rename these two generated files, in preparation for splitting
up the main src/guestfs.c file.
2010-07-27 12:29:59 +01:00
Richard Jones
d30176ddbe TODO: Implement inspector code in C. 2010-07-27 11:11:42 +01:00
Richard Jones
b42d34be04 TODO: Implement recursive upload/download in guestfish. 2010-07-27 11:11:09 +01:00
Richard Jones
4a7d8cd5ce TODO: Add link to discussion of progress bars. 2010-07-27 11:10:32 +01:00
Richard Jones
cd773b0707 Version 1.5.2. 2010-07-22 17:06:48 +01:00
Richard Jones
e7ee6eebed regressions: Don't print misleading 'Expect error ...' lines.
Some tests in the regressions directory deliberately print
error messages.  As long as they still PASS, this is OK.

However these tests also printed some misleading messages
about what error to expect.  Since error messages were slightly
different across distros, these messages were not accurate.

Therefore remove these messages, and replace with a general
message before all tests telling users not to worry about
errors from the tests as long as the tests don't fail.
2010-07-22 16:51:56 +01:00
Richard Jones
945e569db6 New APIs: Support for creating LUKS and managing keys.
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.
2010-07-22 16:51:56 +01:00
Richard Jones
2fd8c259d3 Move variable initialization close to variable use. 2010-07-22 16:51:56 +01:00
Richard Jones
799d52be4f Revert "add_drive_ro adds readonly=on option if available." (RHBZ#617200).
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 676462684e.
2010-07-22 16:51:55 +01:00
Richard Jones
2a286f1621 generator: Make documentation inside guestfish match man page. 2010-07-22 10:59:43 +01:00
Richard Jones
e67298ce80 Version 1.5.1. 2010-07-21 21:58:56 +01:00
Richard Jones
637f8df837 New APIs: Support for opening LUKS-encrypted disks.
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).
2010-07-21 20:48:40 +01:00
Richard Jones
581a7965fa generator: Add 'Key' parameter type.
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.
2010-07-21 19:49:22 +01:00
Richard Jones
2e7da2a2f3 generator: Remove unnecessary parameter.
The 'name' parameter is not used on the right hand side of the
match, so it can be removed.
2010-07-21 12:52:10 +01:00
Richard Jones
45a4cd7921 df: Minimize the number of times we launch the libguestfs appliance.
This commit greatly improves the performance of the 'virt-df'
command by batching as many disks as possible onto a single appliance.
In many situations this means the appliance is launched only once,
versus one launch per domain as before.

However doing it this way is a lot more complex:

(1) Because of limits in Linux and virtio-blk, we can only attach
26 disks maximum at a time to the appliance.

(2) We have to use LVM filters (lvm-set-filter) to confine LVM to
the disks of a single guest.
2010-07-16 18:22:09 +01:00
Richard Jones
d2cf9a15a9 New APIs: lvm-set-filter and lvm-clear-filter.
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.
2010-07-16 15:49:50 +01:00
Richard Jones
321ca1ef91 Use an unsigned type (size_t) for all loop iterators.
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
2010-07-16 15:23:27 +01:00
Richard Jones
aac51942aa generator: Don't hard-code name in DeviceList check.
Only one function currently uses DeviceList.  The generated code
unfortunately hard-coded the argument name from that function.
2010-07-16 15:23:26 +01:00
Richard Jones
0c0976496d build: Don't warn about 'long long'.
Various language bindings simply need this, so we have to allow
it even though it's a GCC extension.
2010-07-16 15:23:26 +01:00
Richard Jones
5b77be72bc doc: Add guestfish 'lvcreate 1M' gotcha. 2010-07-16 15:23:26 +01:00
Richard Jones
70d27f6e79 tar: Remove redundant use statement. 2010-07-11 23:11:45 +01:00
Richard Jones
10ea14a3f1 edit: Clean up temporary files.
Note to self: The 'tempfile' function does *not* default to
removing files with the program exits!
2010-07-11 23:11:08 +01:00
Richard Jones
fed8714b92 edit: Add -b (backup) option and make uploading more robust. 2010-07-11 23:09:07 +01:00
Richard Jones
8f6d8b0515 edit: Add -e 'expr' option to non-interactively apply expression to the file.
(Suggested by Justin Clift).
2010-07-11 22:50:09 +01:00
Richard Jones
58667f2be0 Prepare for new development branch, starting at 1.5.0.
Add BUGS and RELEASE-NOTES to EXTRA_DIST.

Also update the RELEASE-NOTES file.
2010-07-08 13:34:40 +01:00
Richard Jones
49a71a4c60 Make tmp directory world readable (RHBZ#610880).
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
2010-07-07 15:03:51 +01:00
Richard Jones
8161ea9bb0 fish: Don't fail if -m and --listen flags are both given (RHBZ#612178).
Testing this against a Fedora disk image:

$ ./fish/guestfish --ro -a F13.img -m /dev/sda1 --listen
export GUESTFISH_PID=6033
$ ./fish/guestfish --remote=6033 -- ping-daemon
$ ./fish/guestfish --remote=6033 -- ping-daemon
$ ./fish/guestfish --remote=6033 -- exit

Without this fix the first remote command would fail because
qemu would have already been killed.
2010-07-07 15:03:51 +01:00
Richard Jones
cf9e01508d todo: Add comment about progress of long-running operations. 2010-07-02 20:13:01 +01:00
Richard Jones
015b7a2ee6 inspector: Improve error message when YAML::Any library is not installed. 2010-07-02 10:50:38 +01:00
Richard Jones
9928498ad8 Explicitly depend on e2fsprogs.
See: http://lists.fedoraproject.org/pipermail/devel/2010-June/137953.html
2010-06-28 13:51:42 +01:00
Richard Jones
61adbba900 Fix gfs2 support by adding required kernel modules. 2010-06-28 09:36:36 +01:00
Richard Jones
02b3ed7a4a Version 1.3.21. 2010-06-16 16:12:52 +01:00
Richard Jones
1079f74704 ocaml: Fix thread safety of strings in bindings (RHBZ#604691).
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.
2010-06-16 15:32:20 +01:00
Richard Jones
1e568f057e TODO: Add a note about impl of list-filesystems. 2010-06-16 14:29:39 +01:00
Richard Jones
e832959a4d todo: More ideas for TODO list. 2010-06-15 11:15:30 +01:00
Richard Jones
2ce51fda79 Update Spanish translations (RHBZ#603870). 2010-06-15 11:15:06 +01:00
Richard Jones
e67e216118 perl: Check all images are defined in first param of open_guest. 2010-06-11 10:40:48 +01:00
Richard Jones
eb566f7dc7 perl: Add explicit close() method (RHBZ#602592).
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.
2010-06-10 17:52:54 +01:00
Richard Jones
dbfd93b72f Add error callback (RHBZ#602599).
Read the note in the man page before using this feature.
2010-06-10 14:30:36 +01:00
Richard Jones
91b00dc092 Fix typo in documentation of guestfs_set_launch_done_callback. 2010-06-10 14:30:36 +01:00
Richard Jones
4dad67b683 Version 1.3.20. 2010-06-08 18:22:03 +01:00
Richard Jones
a043b6854a Revert "perl: Rerun configure if MAX_PROC_NR changes."
This reverts commit f8ee7869f4.
2010-06-08 18:18:06 +01:00
Richard Jones
d706d7d40e TODO: Freeze/thaw filesystems. 2010-06-08 18:12:32 +01:00
Richard Jones
6e9b06d990 TODO: Need to add regression test for virt-inspector. 2010-06-08 18:11:16 +01:00
Richard Jones
8994202561 TODO: 'file' command should be fixed. 2010-06-08 18:04:17 +01:00
Richard Jones
aaf03a51a2 virt-df: Disallow -h and --csv options together (RHBZ#600977).
Before this commit, if you used the -h and --csv options together
you would get these warnings from virt-df:

$ virt-df -h --csv Guest
Virtual Machine,Filesystem,Size,Used,Available,Use%
Argument "13.5G" isn't numeric in printf at /home/rjones/d/libguestfs/tools/virt-df line 298.
Argument "4.7G" isn't numeric in printf at /home/rjones/d/libguestfs/tools/virt-df line 298.
Argument "8.1G" isn't numeric in printf at /home/rjones/d/libguestfs/tools/virt-df line 298.
"/dev/vg_trick/RHEL55x64","/dev/VolGroup00/LogVol00",13,4,8,34.8%
Argument "98.7M" isn't numeric in printf at /home/rjones/d/libguestfs/tools/virt-df line 298.
Argument "18.8M" isn't numeric in printf at /home/rjones/d/libguestfs/tools/virt-df line 298.
Argument "74.9M" isn't numeric in printf at /home/rjones/d/libguestfs/tools/virt-df line 298.
"/dev/vg_trick/RHEL55x64","/dev/vda1",98,18,74,19.0%

We could fix this so that the human-readable numbers get written
into the CSV file.  However would probably be wrong for most uses
of the CSV format (databases and spreadsheets) since they would not
be able to interpret these human-readable numbers, or worse could
misinterpret, eg. thinking that "1M" and "1G" are both 1.

Therefore this commit disallows this combination of options.
2010-06-08 16:50:52 +01:00
Richard Jones
ba39ced880 file: Fix file command on /dev/VG/LV paths (RHBZ#582484).
Previous commit 4df593496e 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.
2010-06-08 16:04:01 +01:00
Richard Jones
1253f577fa Use the noop scheduler inside the appliance.
In my limited tests, this seems to make a small but noticable
difference, improving the performance of some straightforward
read operations by a little over 10%.

For more information see:
http://kbase.redhat.com/faq/docs/DOC-5428
2010-06-07 15:29:31 +01:00
Richard Jones
1fd03b8400 Add release notes.
To generate the "Bugs fixed" list, run the bugs-in-changelog script
like this:

  ./bugs-in-changelog 1.0.89..
2010-06-05 18:18:13 +01:00
Richard Jones
6c27155621 Version 1.3.19.
Update BUGS and PO files.
2010-06-04 16:52:58 +01:00
Richard Jones
4df593496e file: Restrict to regular files (RHBZ#582484).
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.
2010-06-04 15:07:27 +01:00
Richard Jones
74958b0ad4 touch: Restrict touch to regular files only (RHBZ#582484). 2010-06-04 13:53:10 +01:00
Richard Jones
e3befe5a2e daemon: Rearrange code in 'file' command.
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.
2010-06-04 11:23:01 +01:00
Richard Jones
32f48cc333 gnulib: Ignore asm-underscore.m4 in the correct place. 2010-06-04 11:21:58 +01:00
Richard Jones
00cc40a5f3 Update to latest gnulib. 2010-06-04 10:19:33 +01:00
Richard Jones
4d5c228002 mkfs-b: Map block size to cluster size for VFAT and NTFS partitions (RHBZ#599464).
This also adds a regression test for VFAT and (conditionally)
NTFS filesystems.
2010-06-03 14:33:59 +01:00
Richard Jones
0606cb5467 mkfs-b: Check that blocksize parameter is > 0 and a power of 2. 2010-06-03 14:33:59 +01:00
Richard Jones
f9d08600c5 generator: Allow individual tests to depend on daemon features.
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.
2010-06-03 14:33:59 +01:00
Richard Jones
cbe80b2bcf tests: Factor out common code into 'is_available' function.
This commit is just code motion.
2010-06-03 14:33:59 +01:00
Richard Jones
8fca8549ed grub-install: Enable grub-install tests and create explicit device.map file. 2010-06-03 11:49:38 +01:00
Richard Jones
dccd9b8f52 grub-install: In docs suggest manually creating device.map (RHBZ#484986). 2010-06-03 11:48:41 +01:00
Richard Jones
fbe0802f9d Version 1.3.18.
Update BUGS and PO files.
2010-06-02 18:48:27 +01:00
Richard Jones
ac37f65aaf RHEL 6: sr_mod.ko is needed for RHEL 6 to see CD-ROM devices (RHBZ#598807). 2010-06-02 17:12:59 +01:00
Richard Jones
cbb0260368 parted: Check partition number >= 1 in several calls. 2010-06-02 15:35:58 +01:00
Richard Jones
3ab2d089f3 daemon: Parse output of old parted which didn't support -m option (RHBZ#598309).
This fixes the following commands when run with RHEL 5-era parted:

  get-bootable
  get-parttype
  part-list
2010-06-02 15:33:03 +01:00
Richard Jones
aee7d55fcf daemon: count_strings function returns size_t 2010-06-02 15:33:02 +01:00
Richard Jones
50eed6d20d base64-in: Ignore garbage characters in input.
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.
2010-06-02 15:33:02 +01:00
Richard Jones
1020b212b1 resize2fs: Document this command also works with ext4 (thanks Yufang Zhang). 2010-06-02 15:33:02 +01:00
Richard Jones
f2b7a8e15c fish: help command return error for non-existent commands (RHBZ#597145).
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
2010-06-02 13:38:00 +01:00
Richard Jones
9733d47469 daemon: write-file: Check range of size parameter (RHBZ#597135).
This also adds a regression test.
2010-06-02 13:38:00 +01:00
Richard Jones
52f9cd4882 daemon: Limit label lengths (RHBZ#597118). 2010-06-02 13:38:00 +01:00
Richard Jones
000f8059a5 Update BUGS and PO files. 2010-06-02 13:38:00 +01:00
Richard Jones
da4812ab6b Fix and deprecate get_e2label and get_e2uuid (RHBZ#597112).
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.
2010-06-01 15:30:13 +01:00
Richard Jones
27b730a682 New APIs: vfs-label and vfs-uuid return label and uuid for many fs types.
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).
2010-06-01 15:30:08 +01:00
Richard Jones
21c42e9fab daemon: Kill blkid cache to improve reliability of blkid commands.
By killing the cache file, we make blkid work in situations such
as a just-created filesystem.
2010-06-01 15:29:09 +01:00
Richard Jones
85c71f8fff daemon: Generalize the implementation of vfs-type.
Note that there is no change to the semantics of the code.
2010-06-01 13:39:25 +01:00
Richard Jones
fc1dc099a1 todo: Should generate -N option. 2010-05-28 20:08:45 +01:00
Richard Jones
0e42861ccf todo: Remove implemented resize functions from TODO file. 2010-05-28 20:05:56 +01:00
Matthew Booth
90b3539e28 Make the supermin appliance include local augeas lenses 2010-05-27 16:30:30 +01:00
Matthew Booth
245ed4b8eb Rely on new augeas lens for modules.conf and conf.modules
Latest augeas includes a lens for /etc/modules.conf. If this new lens is
present, the code to force the Modprobe lens to try to match /etc/modules.conf
as well results in /etc/modules.conf not being parsed at all. This results in
modprobe_aliases in virt-inspector output being empty.

This change is equivalent to change cfd28d1140393667913689b7b9bcf21c8bfe592c
from virt-v2v.

An effect of this change is that the Modules_conf augeas lens is now required
for correct operation on guests which use /etc/modules.conf.

Fixes RHBZ#596776
2010-05-27 16:30:17 +01:00
Daniel Cabrera
1b566fd688 Updates to Spanish translation (RHBZ#596763). 2010-05-27 15:20:37 +01:00
Richard Jones
e3881fd0b7 Version 1.3.17. 2010-05-27 14:34:58 +01:00
Richard Jones
0f6c6239fe Fix documentation for vfs-type to reflect reality. 2010-05-27 10:37:43 +01:00
Richard Jones
11eeb8885c Clarify documentation on distro backports in version command. 2010-05-27 10:33:37 +01:00
Richard Jones
8355d32456 Add reference to version number documentation to version command. 2010-05-27 10:33:32 +01:00
Richard Jones
d12a702fe1 Clarify sparse behaviour of truncate-size command. 2010-05-27 10:25:18 +01:00
Richard Jones
4412fd951e Fix typo in documentation of guestfs_readlinklist. 2010-05-27 10:03:47 +01:00
Richard Jones
b8861242d1 Fix missing word in docuentation of guestfs_readdir. 2010-05-27 10:01:25 +01:00
Richard Jones
1d1cc4114d Revise documentation on creating files. 2010-05-27 09:49:28 +01:00
Richard Jones
6b500f1b8e New API: fallocate64 (replaces fallocate).
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.
2010-05-27 09:48:22 +01:00
Richard Jones
c1e3cff523 Fix typo in description of echo-daemon command. 2010-05-26 23:42:43 +01:00
Richard Jones
c35c83167d Version 1.3.16. 2010-05-25 23:23:51 +01:00
Richard Jones
b0cd2042bb Add bash complation script to EXTRA_DIST. 2010-05-25 23:16:23 +01:00
Richard Jones
5fb9cddf1e Version 1.3.15. 2010-05-25 22:45:45 +01:00
Richard Jones
2b7af34c30 Add tests for available-all-groups command. 2010-05-25 22:24:12 +01:00
Richard Jones
f7d3c8ec69 fish: First pass at guestfish bash completion script. 2010-05-25 20:13:55 +01:00
Richard Jones
21bd2db7cf fish: Don't eat words when completing case-insensitive paths (RHBZ#582993). 2010-05-25 13:59:44 +01:00
Richard Jones
53c3b9d2b0 fish: Sort returned paths so the list is stable across multiple calls. 2010-05-25 13:52:53 +01:00
Richard Jones
06d8064ff8 fish: Document test1.img, test2.img etc used by -N option in FILES section. 2010-05-25 13:52:17 +01:00
Richard Jones
7fd6e4bfb1 fish: Create a separate FILES section in the manpage. 2010-05-25 13:51:58 +01:00
Richard Jones
34a306ab2a fish: Move 'EXIT CODE' section to a more logical place in the documentation. 2010-05-25 13:41:39 +01:00
Richard Jones
0e28e4104d resize: Refresh the examples in the documentation.
The documentation was previously very intimidating.  Bring some
common, simple examples up to the top of the page in a separate
section.
2010-05-25 11:45:23 +01:00
Richard Jones
57cc217335 fish: Make the read/write warning more prominent.
Follow the example on other manual pages by making the warning
more prominent.
2010-05-25 11:44:43 +01:00
Richard Jones
c9f1a45334 fish: New command: 'supported'
This checks all available optional groups and prints out which
ones are supported by the daemon.  Note you must launch the appliance
first.

Example:

><fs> supported
      augeas yes
     inotify yes
 linuxfsuuid yes
linuxmodules yes
 linuxxattrs yes
        lvm2 yes
       mknod yes
      ntfs3g yes
   ntfsprogs yes
    realpath yes
       scrub yes
     selinux yes
          xz yes
    zerofree yes
2010-05-25 11:31:11 +01:00
Richard Jones
1bd1f9b85f New API: available-all-groups to return list of all optional groups. 2010-05-25 11:27:49 +01:00
Richard Jones
f8ee7869f4 perl: Rerun configure if MAX_PROC_NR changes.
If MAX_PROC_NR changes (because a new API has been added to the
generator) then we need to rerun configure in order to set the
Makefile's ${MAX_PROC_NR} variable, in order to rebuild Makefile.PL.
2010-05-25 11:25:12 +01:00
Piotr Drąg
90c51f9113 Update Polish translations (RHBZ#502533). 2010-05-25 09:41:20 +01:00
Richard Jones
f323479760 Version 1.3.14. 2010-05-24 13:38:24 +01:00
Richard Jones
a554c62b70 build: Remove install_kernel from EXTRA_DIST.
This updates commit a34fadf900,
removing this now non-existent script from EXTRA_DIST.
2010-05-24 13:34:33 +01:00
Richard Jones
613d041c78 build: For development releases, print a notice. 2010-05-24 12:09:38 +01:00
Richard Jones
94030c5ce8 guestfs_version: Correct documentation.
Remove reference to 'ELF weak linking tricks' and replace
with suggestion to use dl* functions.
2010-05-22 18:51:57 +01:00
Richard W.M. Jones
012b1c71f4 Build workaround for Python 2.4.x in RHEL 5.
See:
http://www.python.org/dev/peps/pep-0353/#conversion-guidelines
2010-05-21 18:21:40 +01:00
Richard W.M. Jones
63e8da5abe C99 compatible build fix for RHEL 5. 2010-05-21 16:15:56 +01:00
Richard Jones
7cb6fac307 New API: ntfsresize-size to allow shrinking NTFS (RHBZ#585223). 2010-05-21 14:51:57 +01:00
Richard Jones
9be89728f2 New API: pvresize-size to allow shrinking PVs (RHBZ#585222). 2010-05-21 14:51:57 +01:00
Richard Jones
71b02d6654 New API: resize2fs-size to allow shrinking ext2 filesystems (RHBZ#585221). 2010-05-21 14:51:54 +01:00
Richard Jones
5e1aff7856 fish: Allow suffixes on number parameters (eg. 1M)
This small change uses the gnulib xstrtoll functionality to
enable suffixes on integer parameters in guestfish.  For example:

 truncate-size /file 1G

(previously you would have had to given the full number).

This also applies to the 'alloc' and 'sparse' commands (and
indirectly to the -N option).  The specification for these commands
has changed slightly, in that 'alloc foo 1MB' would now use SI
units, allocating 1000000 bytes instead of a true megabyte.  All
existing uses would use 'alloc foo 1M' which still allocates true
megabytes.
2010-05-21 14:51:53 +01:00
Richard Jones
48a216a06d fish: Fix '-N part' disk partition type sub-option. 2010-05-21 14:51:53 +01:00
Richard Jones
478e1942a9 TODO: Suggest including undelete utility. 2010-05-21 11:25:36 +01:00
Richard Jones
aecdf3c117 Fix name of update-bugs script in output file BUGS. 2010-05-21 11:25:19 +01:00
Richard Jones
5f9630338b ubuntu: Use direct udevd method to start udev on Ubuntu.
On Ubuntu, /etc/init.d/udev is a symlink to an upstart file,
but running that causes the appliance to hang.

Therefore detect if this is a symlink and fall through to the
direct start of udevd.  This shouldn't affect Debian because the
file is not a symlink on standard Debian.
2010-05-20 18:57:20 +01:00
Richard Jones
4557112772 ubuntu: Remove two FUSE packages from the default list.
fuse-utils (a dependency of these) cannot be installed under
debirf because it does something with the system udevd which is
not permitted.  Seems to be a bug either in fakeroot or in the
post install scripts for fuse-utils.
2010-05-20 17:37:19 +01:00
Richard Jones
4312988e0e ubuntu: Ignore packages in packagelist.in which are missing.
For distros using 'yum', packages which cannot be found are just
ignored.  This allows us to include for example 'e4fsprogs' on the
list even though that only exists on RHEL 5.

However for Debian-derived distros, missing packages would cause
apt to fail.  This was particularly a problem when building Ubuntu
since it doesn't have as complete a list of packages, and the list
changed a lot between releases.

This commit adds a check first for missing packages, ignoring those
and thus acting more like 'yum'.
2010-05-20 17:37:16 +01:00
Richard Jones
2954491e73 Ubuntu: Use apt-get instead of aptitude when installing guestfsd. 2010-05-20 17:37:14 +01:00
Richard Jones
a34fadf900 Ubuntu: Revert install-kernel to debirf default script. 2010-05-20 17:37:11 +01:00
Richard Jones
53ca11ee44 generator: Make 'xz' into an optional group.
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.
2010-05-20 10:42:21 +01:00
Richard Jones
30c091f49d generator: Check parameters are not NULL (RHBZ#501893).
This adds additional tests to check that several types of parameter
including String are not NULL when passed to the C functions.
Previously this would cause a segfault inside libguestfs.  With
this change, you get an error message / exception.

Of the possible pointer parameters, only OptString is now permitted
to be NULL.

This change does not affect the Perl bindings.  This is because Perl
XS code was already adding similar checks if you passed undef into
a parameter expecting a string.
2010-05-20 10:30:12 +01:00
Richard Jones
e715451fae generator: Some String parameters should be OptString (RHBZ#501894).
I haven't checked the list of functions exhaustively, but
these are the obvious ones.
2010-05-20 10:30:12 +01:00
Richard Jones
9735484c35 fuse: Implement write syscall (RHBZ#592883). 2010-05-20 10:30:12 +01:00
Richard Jones
1214b32162 New API: Implement pwrite system call (partial fix for RHBZ#592883). 2010-05-20 10:30:12 +01:00
Richard Jones
3920ad95f6 New API: write for creating files with fixed content (RHBZ#501889).
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.
2010-05-20 10:30:12 +01:00
Richard Jones
bda6cf75f2 generator: Implement BufferIn parameter type (RHBZ#501889).
The BufferIn argument turns into various things:

 in C      const char *, size_t parameter pair

 in XDR    an opaque<> type (instead of string) which allows \0 chars

 in other bindings
           mostly just a string, since most languages except for C
           permit strings to contain any 8 bit data
2010-05-20 10:30:12 +01:00
Richard Jones
5af010c96d fish: Fix build error if built without readline.
fish.c:1447: error: 'add_history_line' defined but not used [-Wunused-function]

(Reported by Matt Booth)
2010-05-20 10:30:12 +01:00
Richard Jones
6e10a24df0 appliance: Fix /etc/resolv.conf
Since changing to use link local address
(commit fbf29976b3)
we have included an incorrect resolv.conf file in the appliance
which points to the old (qemu) DNS server.  This commit changes
to use the new DNS server.
2010-05-20 10:30:12 +01:00
Richard Jones
58d1f3c030 Update BUGS. 2010-05-19 11:06:46 +01:00
Daniel Cabrera
49fae775c4 Update Spanish translations (RHBZ#593292). 2010-05-18 14:38:57 +01:00
Richard Jones
2dc7bb0033 appliance: Ignore utempter unreadable binaries (for RHEL 6). 2010-05-18 10:37:11 +01:00
Richard Jones
155aa76e57 appliance: Change comment about unreadable binaries. 2010-05-18 10:01:45 +01:00
Richard Jones
f1b651a99b Version 1.3.13. 2010-05-15 21:07:49 +01:00
Richard Jones
ef5f132588 Update BUGS 2010-05-15 20:40:25 +01:00
Richard Jones
d858418b8b Update PO files. 2010-05-15 08:44:04 +01:00
Richard Jones
002dc21cba Generate BUGS file from Red Hat Bugzilla database.
Add a script which generates the 'BUGS' file from Red Hat Bugzilla.
This is run whenever we do 'make dist' and deliberately stored in git.
2010-05-15 08:43:02 +01:00
Richard Jones
5d5565ca24 virt-df: Display domains in sorted order. 2010-05-14 19:42:48 +01:00
Richard Jones
ee03a22f41 Updated Spanish translations (RHBZ#592360). 2010-05-14 17:41:39 +01:00
Richard Jones
40d270b011 Ensure ordinary appliance is updated before trying to build supermin appliance. 2010-05-14 15:43:51 +01:00
Richard Jones
2357adc79a Version 1.3.12, update PO files. 2010-05-14 12:38:39 +01:00
Richard Jones
8700a55d52 Unify supermin appliance building using febootstrap 2.7 2010-05-13 18:52:15 +01:00
Richard Jones
55748a94bc Improve errors from tar-in/tgz-in commands (RHBZ#591155 RHBZ#591250).
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.
2010-05-13 17:08:02 +01:00
Richard Jones
b76fd51e14 Combine common code in daemon/tar.c.
This commit shouldn't result in any change in the semantics
of the code.
2010-05-13 17:08:02 +01:00
Richard Jones
dc706a639e Fix FileIn cmds losing synch if both ends send cancel messages (RHBZ#576879).
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 5922d7084d.

More details can be found here:
https://bugzilla.redhat.com/show_bug.cgi?id=576879#c5
2010-05-13 17:08:02 +01:00
Richard Jones
11a2ad8c9a guestfish: Fix build error in 'print_shell_quote' function.
Amend commit 1c6ed48bd3 so the prototype of
'print_shell_quote' function is correct.
2010-05-13 17:07:45 +01:00
Richard Jones
520d895383 fish: Fix guestfish -N option when called with unknown image type.
Previously it was falling off the end of the loop if you
called it with an unknown image type.
2010-05-13 16:22:10 +01:00
Richard Jones
94e310dcfb Improved error if virt-inspector cannot find OSes in image (RHBZ#591142). 2010-05-13 16:22:10 +01:00
Richard Jones
287f8957fe Fix error message in string-e command (RHBZ#588651). 2010-05-13 16:22:10 +01:00
Richard Jones
1c6ed48bd3 guestfish -i and virt-inspector work on filenames containing spaces (RHBZ#507810).
This commit fixes a long-standing bug which prevented guestfish -i
and virt-inspector from working on disk images which had a space
in the filename (or other unsafe characters).  It works by ensuring
that the strings passed between guestfish -i and virt-inspector are
quoted correctly in both directions.

Note that this commit adds a dependency from virt-inspector to
the perl module String::ShellQuote.  We have previously used this
module in virt-make-fs.
2010-05-13 16:22:05 +01:00
Richard Jones
7232458080 Add version numbers to Perl modules (RHBZ#521674).
Sys::Guestfs now contains a version number which reflects the
ABI that we are compiled against, ie. '0.<MAX_PROC_NR>'.  This has
the beneficial side effect of causing an error if the user tries
to mix versions of the Perl module and the XS code.

Sys::Guestfs::Lib now contains a synthetic version number which
will reflect future changes in that module.
2010-05-12 18:13:01 +01:00
Richard Jones
b7046fecee Update PO files, including extra strings from Perl files. 2010-05-12 18:13:01 +01:00
Richard Jones
feb0cd0482 po: Include strings from Perl programs in the PO files (RHBZ#559963).
xgettext will only recognize '*.pl' as being a Perl file (otherwise
it treats it as a C file and does not correctly find any strings
in it).

This commit also fixes two actual bugs that xgettext found in the
strings in our Perl programs.
2010-05-12 18:13:01 +01:00
Richard Jones
4813311807 po: Don't generate po/Makevars file and include Perl keywords (RHBZ#559963).
I don't see a reason to autogenerate po/Makevars, and in the
earlier commit which changed this file to being autogenerated
we accidentally lost the special Perl keywords, copyright notice
and bug reporting address.  Fix all of that.

This partially reverts commit febff9d2a3.
2010-05-12 18:13:01 +01:00
Richard Jones
5477d98548 Reduce imported functions in virt-df to ones which are actually used. 2010-05-12 18:13:01 +01:00
Richard Jones
0c1e77219e New API: fill-pattern for creating files with predefined patterns. 2010-05-12 17:33:16 +01:00
Richard Jones
9d158c3ab1 Run udev_settle() after swapon/swapoff (RHBZ#516096). 2010-05-12 16:13:07 +01:00
Richard Jones
87eecb507e fish: With both '-x' and '-i', pass through '-x' to inferior process. 2010-05-12 16:13:07 +01:00
Richard Jones
3cead72850 Version 1.3.11. 2010-05-08 20:12:55 +01:00
Richard Jones
f35365ecbf virt-rescue: Add extra options.
This commit adds the extra options '--append', '--memsize' and '--selinux'.
2010-05-08 19:57:52 +01:00
Richard Jones
d0afef23e5 virt-rescue: Refresh documentation. 2010-05-08 19:55:27 +01:00
Richard Jones
214a803ac5 Revert "fish: Add 'please wait' message when launching (and interactive)."
This reverts commit 01fedcde05.
2010-05-08 09:45:19 +01:00
Richard Jones
01fedcde05 fish: Add 'please wait' message when launching (and interactive). 2010-05-08 09:37:25 +01:00
Richard Jones
55e9707f85 launch: Rearrange the code so config check is first.
Move the config state check first in the guestfs_launch function,
so that we don't reset g->launch_t or calculate the temporary
directory in the case where the launch function will immediately
return with an error.
2010-05-08 09:28:19 +01:00
Richard Jones
301abf33c6 generator: FishAction is no longer used, remove this feature. 2010-05-08 09:26:57 +01:00
Richard Jones
bece54704b fish: Make 'launch' function static.
This commit makes the launch function static and private to
'fish.c', and changes the generator so the function is no longer
called for the 'run/launch' command.
2010-05-08 09:25:32 +01:00
Richard Jones
a96d70113f fish: In 'reopen' copy trace setting to new handle. 2010-05-08 09:14:00 +01:00
Richard Jones
2064e43bcf Ignore test1.img file in directory. 2010-05-08 09:10:00 +01:00
Richard Jones
846238a031 fish -N option unconditionally overwrites test*.img files.
This is more convenient and makes it consistent with the
'alloc' and 'sparse' commands.
2010-05-08 09:09:24 +01:00
Richard Jones
8e007581c9 fish: Make '-x' option enable traces instead of using separate echo path.
Previously we had separate code paths for echoing commands (-x)
and tracing (guestfs_set_trace).  This just unifies that so that
the guestfish -x option enables tracing.
2010-05-08 09:04:28 +01:00
Richard Jones
94775c53f1 inspector: Support filesystem-on-image VMs (RHBZ#590167).
$ virt-df /tmp/dbroot.img
Filesystem                           1K-blocks       Used  Available  Use%
/tmp/dbroot.img:/dev/vda               3096336     593628    2345424   20%
2010-05-07 23:15:40 +01:00
Richard Jones
f606a79ed7 daemon: Use 'error' instead of 'perror' before calling 'abort'. 2010-05-07 22:51:20 +01:00
Richard Jones
b52ef0b021 daemon: gnulib module 'error' is used directly by the daemon. 2010-05-07 22:51:20 +01:00
Richard Jones
63882fb220 daemon: Use parens around code section for safety. 2010-05-07 22:51:20 +01:00
Richard Jones
fc6dd9daa1 If qemu dies during launch, set an error message (RHBZ#588851). 2010-05-07 22:37:55 +01:00
Richard Jones
a3eb97d637 Version 1.3.10. 2010-05-07 16:34:08 +01:00
Richard Jones
42f59b28f1 daemon: Fix read-file so it fails gracefully for large files (RHBZ#589039).
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.
2010-05-07 15:27:29 +01:00
Richard Jones
a84f136049 daemon: Fix wc* commands to work on absolute symbolic links (RHBZ#579608). 2010-05-07 15:27:28 +01:00
Richard Jones
26991ebb81 daemon: Fix strings to work on absolute symbolic links (RHBZ#579608). 2010-05-07 15:27:28 +01:00
Richard Jones
deee8e2b4e daemon: Fix head and tail commands to work on absolute symbolic links (RHBZ#579608). 2010-05-07 15:27:28 +01:00
Richard Jones
7d8e5886a6 daemon: Fix grep and related to work on absolute symbolic links (RHBZ#579608). 2010-05-07 15:27:28 +01:00
Richard Jones
00fae9fe88 daemon: Fix checksum to work on absolute symbolic links (RHBZ#579608). 2010-05-07 15:27:28 +01:00
Richard Jones
7a4ec57e54 daemon: Fix hexdump to work on absolute symbolic links (RHBZ#579608). 2010-05-07 15:27:28 +01:00
Richard Jones
07369cb77a daemon: Fix for commands working on absolute symbolic links (RHBZ#579608).
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.
2010-05-07 15:27:28 +01:00
Richard Jones
34067b5c36 daemon: Change command to abort() on resource problems.
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.
   */
2010-05-07 15:27:28 +01:00
Matthew Booth
4839d5142c Warn instead of dying if grub refers to non-existent kernel 2010-05-07 15:23:37 +01:00
Richard Jones
01c1d82823 Update to latest gnulib. 2010-05-06 18:57:25 +01:00
Richard Jones
fbf29976b3 Use link-local addresses between appliance and host (RHBZ#588763). 2010-05-04 17:01:34 +01:00
Richard Jones
8a9f2ca655 Change network configuration to use macros.
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.
2010-05-04 15:26:20 +01:00
Daniel Cabrera
7d005a9ae8 Update Spanish translations (RHBZ#588733). 2010-05-04 13:35:01 +01:00
Richard Jones
097266e01c tests: In verbose mode, print dashes between each test.
Only affects tests when run with LIBGUESTFS_DEBUG=1.  Lets you easily
see when each test starts and ends.
2010-04-30 23:12:34 +01:00
Richard Jones
a0a394a461 Version 1.3.9. 2010-04-30 18:27:37 +01:00
Richard Jones
fd2d10d6ed Document that guestfs_mount implies -o sync and performance problem (RHBZ#587582). 2010-04-30 13:56:11 +01:00
Richard Jones
90b4e24df6 contrib: Add dependency diagram of libguestfs ecosystem. 2010-04-30 12:27:00 +01:00
Richard Jones
2f9f337502 contrib: Add header to README file. 2010-04-30 11:34:21 +01:00
Richard Jones
c24de46d06 lvresize: Use --force so it can make LVs smaller (RHBZ#587484).
This also adds a regression test for this bug.
2010-04-30 10:51:49 +01:00
Richard Jones
25c1526125 tools: Fix documentation for CurrentControlSet (thanks Yuval Kashtan). 2010-04-30 09:46:40 +01:00
Richard Jones
55641f5d1e guestfs(3): Documentation on protocol gotchas. 2010-04-29 13:55:52 +01:00
Richard Jones
d3be0facdd Version 1.3.8. 2010-04-27 15:48:38 +01:00
Daniel Cabrera
467268bc32 Update Spanish translation (RHBZ#585961). 2010-04-26 15:57:45 +01:00
Richard Jones
78d2523ec8 fish: Add 'man' command which opens the manual. 2010-04-24 09:11:37 +01:00
Richard Jones
ce95be8b18 docs: Routine refresh of the documentation for guestfs(3) and guestfish(1). 2010-04-24 08:50:40 +01:00
Richard Jones
b054e33db6 Version 1.3.7 - note: fixes a segfault in guestfish 1.3.6. 2010-04-23 14:43:13 +01:00
Richard Jones
7c285ea84f todo docs: Discuss shrinking filesystems and specifying sizes in guestfish. 2010-04-23 14:29:56 +01:00
Richard Jones
41ee105aab New API: checksums-out for checksumming many files.
Useful API for verifying the integrity of virtual machines.
2010-04-23 14:15:13 +01:00
Richard Jones
89a707aac5 generator: Update docs for checksum to point to checksum-device. 2010-04-23 14:15:13 +01:00
Richard Jones
af29c84cef daemon: Split out checksum type to program name mapping into function.
This shouldn't change the semantics of the program.
2010-04-23 14:15:12 +01:00
Richard Jones
d054dfb2f9 fish: Fix segfault in '-a' option.
This fixes a segfault in the guestfish -a option which you would
get when using guestfish 1.3.6.
2010-04-23 14:15:12 +01:00
Richard Jones
6e269c6e51 todo docs: Integrate with host intrusion detection systems. 2010-04-23 10:25:35 +01:00
Richard Jones
2ed549e95c todo docs: Mapping filesystems to and from disk blocks. 2010-04-23 10:23:45 +01:00
Richard Jones
dfe539d764 Version 1.3.6. 2010-04-22 22:29:25 +01:00
Richard Jones
4a9b979a31 fish: Add -N option for making prepared disk images.
Previously you might have typed:

$ guestfish
><fs> alloc test1.img 100M
><fs> run
><fs> part-disk /dev/sda mbr
><fs> mkfs ext4 /dev/sda1

now you can do the same with:

$ guestfish -N fs:ext4

Some tests have also been updated to use this new
functionality.
2010-04-22 18:07:11 +01:00
Richard Jones
89486c50ea fish docs: Be consistent about using I<-..> for options. 2010-04-22 17:16:13 +01:00
Richard Jones
e3e67f63b0 fish docs: Use L</...> for internal links in the man page. 2010-04-22 17:16:13 +01:00
Matthew Booth
75d9c056b2 Whitelist the loop kernel module
loop is sometimes a module, for example on RHEL 5.
2010-04-22 17:16:13 +01:00
Matthew Booth
39416cdb11 Don't die during inspection if rpm -qa or dpkg-query fails
If a problem in the package database prevented package enumeration from working,
inspection would die. This change makes it emit a warning and continue.
2010-04-21 16:51:20 +01:00
Matthew Booth
2b43970c8c Don't die during inspection if initrd doesn't exist
This fixes a problem where inspection would die if grub.conf referenced a
non-existent initrd. Just return an empty initrd instead.
2010-04-21 16:51:20 +01:00
Richard Jones
216557b1eb Add zfs-fuse (ZFS via FUSE) support to the appliance. 2010-04-20 22:20:46 +01:00
Richard Jones
c8f302a174 Remove checks for Test::Pod and Test::Pod::Coverage.
Although these modules are optionally used by the Perl tests,
they aren't necessary and won't break the build if they are not
there.  These modules aren't available in RHEL 5.  Therefore
remove these checks.
2010-04-20 18:47:02 +01:00
Daniel Cabrera
d7768dc526 Updated Spanish translations (RHBZ#584038). 2010-04-20 16:30:27 +01:00
Richard Jones
199f218bf4 Check user doesn't run configure, make or make check as root.
(Thanks to Yufang Zhang for helping to debug this issue).
2010-04-20 13:22:09 +01:00
Richard Jones
175c01d233 Replace 'dd' in tests with use of guestfish 'sparse' command.
'dd' is a very inefficient way to create files.  'truncate' is
better, but unfortunately that command is not available in RHEL 5.
So use the guestfish 'sparse' command instead (which also avoids
allocating disk space).
2010-04-20 11:04:14 +01:00
Richard Jones
54a8f8f30d Document new version numbering policy.
See discussion on mailing list:

https://www.redhat.com/archives/libguestfs/2010-April/msg00005.html
https://www.redhat.com/archives/libguestfs/2010-April/msg00057.html
https://www.redhat.com/archives/libguestfs/2010-April/msg00058.html
2010-04-20 10:50:50 +01:00
Richard Jones
c2a8efc548 Document umask (RHBZ#582548, RHBZ#583554). 2010-04-19 20:55:15 +01:00
Richard Jones
42e43db927 docs: Clarify documentation for mknod (RHBZ#582948). 2010-04-19 20:13:05 +01:00
Richard Jones
27a67f8615 Update PO files. 2010-04-19 17:25:58 +01:00
Richard Jones
aba59fd355 Prepare for version 1.3.5. 2010-04-19 17:13:46 +01:00
Richard Jones
c3a6896185 New APIs: base64-in and base64-out for uploading/downloading base64 content. 2010-04-19 17:09:58 +01:00
Richard Jones
87e49e7e87 New API: debug-upload (not a formal part of the API/ABI).
Allow arbitrary files to be uploaded into the appliance, but
only when --enable-debug-command is enabled.  This lets you
run shell scripts, like this:

  ><fs> debug-upload -<<EOF /tmp/script.sh 0700
  #!/bin/sh -
  # ...
  EOF
  ><fs> debug sh "/tmp/script.sh"
2010-04-19 16:31:24 +01:00
Richard Jones
3119aa687d fish: Allow -<<END as a syntax for uploading "heredocs".
For example:

    ><fs> upload -<<END /foo
    some data
    some more data
    END
    ><fs> cat /foo
    some data
    some more data
2010-04-19 15:08:45 +01:00
Richard Jones
819f30e332 todo docs: Feature for base64 uploads and scripts. 2010-04-19 11:49:08 +01:00
Richard Jones
92d38b9ae3 docs: Add virt-resize(1) link to guestfish(1) manpage. 2010-04-19 10:20:58 +01:00
Richard Jones
1525e2ba08 Version 1.3.4 2010-04-17 22:30:58 +01:00
Richard Jones
e55400960a todo documentation: Idea: List, mount filesystems by UUID and label. 2010-04-17 20:41:28 +01:00
Richard Jones
abb7365d4d todo documentation: remove 'virt-grow/shrink', see virt-resize 2010-04-17 20:36:11 +01:00
Richard Jones
398e6830a3 todo documentation: virt-rescue now uses $TERM from library, remove from todo list 2010-04-17 20:35:34 +01:00
Richard Jones
3b759fe7fe todo documentation: Remove old section on PPC bugs.
No one cares for PPC, and if they do they should file these
as bugs in the bug tracker.
2010-04-17 20:34:35 +01:00
Richard Jones
fc50bf2680 todo documentation: Remove old ideas for Python bindings. 2010-04-17 20:34:21 +01:00
Richard Jones
2e0f3ed54b Documentation: Use 'g' instead of 'handle' in documentation.
By convention we use 'g' for handles.  Copy this convention
through to all the documentation.
2010-04-17 16:33:07 +01:00
Richard Jones
6e4bf8e278 In guestfs(3), unmount "/" directory in the example. 2010-04-17 16:24:03 +01:00
Richard Jones
4680c73258 Add compilation/linking example to guestfs(3) man page. 2010-04-17 16:22:53 +01:00
Richard Jones
3297466d33 generator: Use shortname in check_state() call.
Saves a tiny bit of space in the library.
2010-04-17 15:59:41 +01:00
Richard Jones
09a0427448 Build top-level directories in a more logical order. 2010-04-17 15:46:08 +01:00
Richard Jones
2a9abc7791 Rerun generator if images/test.iso does not exist or has been updated.
The MD5 hash of this file is embedded in the output of the
generator.
2010-04-17 15:41:16 +01:00
Richard Jones
5922d7084d Fix upload losing synchronization if root not mounted (RHBZ#576879).
Modify the generator so that it can correctly handle early
cancellation for Pathname|Device|.. parameters.  This fixes
the upload command, but consequently we need to fix the
parameters for tar_in and t?z_in commands.  This should also
mean that 'win:' can now be used as the second argument of
tar_in and t?z_in commands in guestfish, whereas previously
this wouldn't have worked.

Adds a regression test for the original problem.
2010-04-17 15:22:29 +01:00
Richard Jones
68467cb1c2 generator: Fix typo in a comment. 2010-04-17 14:14:30 +01:00
Richard Jones
61ab83d190 Improved checking, documentation of modes (RHBZ#582901, RHBZ#582929).
chmod: Disallow negative mode, document mode affected by umask.

mkdir-mode: Disallow negative mode, document that filesystems
may interpret the mode in different ways.

mknod: Disallow negative mode, document mode affected by umask.

umask: Check the range of umask mask value carefully.
2010-04-17 13:36:26 +01:00
Richard Jones
42fc0e02b0 fish: Autocomplete 'sparse' command (RHBZ#582899).
I also rechecked the list of built-in commands against
the actual commands to make sure no others were omitted.
2010-04-17 13:11:20 +01:00
Richard Jones
4e5327187d New API: get-umask, returns the current umask (RHBZ#582891). 2010-04-17 13:07:56 +01:00
Richard Jones
116d497c68 Add a build test for the 'umask' command. 2010-04-17 12:38:18 +01:00
Richard Jones
4f376dbafb fish: Print output from some commands in octal/hex as approp. (RHBZ#583242). 2010-04-17 12:33:31 +01:00
Richard Jones
e64c1e5aac Documentation: lvcreate should say 'logical volume' (RHBZ#582953) 2010-04-17 12:13:23 +01:00
Daniel Cabrera
b35d2a0fd7 Update Spanish translations (RHBZ#582252). 2010-04-14 14:59:30 +01:00
Matthew Booth
c0d73e0e60 Fix build error in fuse/guestmount.c.
guestmount.c: In function 'main':
guestmount.c:899: error: implicit declaration of function 'setlocale'
[-Wimplicit-function-declaration]

guestmount.c wasn't including locale.h.
2010-04-14 11:13:04 +01:00
Richard Jones
66477d07e3 New API: Add aug-clear call for clearing an Augeas node. 2010-04-13 22:09:21 +01:00
Richard Jones
ad752b80d7 fish: Allow '-' prefix on command line to override exit on error (RHBZ#578407).
Allow -cmd on the command line to mean that normal exit on error
behaviour is overridden, ie. we will not exit.

This allows you to do:

  guestfish -- command : -command : command

with the second command allowing errors.  (Note that '--' is required
to stop getopt parsing -command as an option).

Also this fixes the remote case which is what the original
bug report was about.
2010-04-13 22:09:21 +01:00
Richard Jones
c076aaea7e fish: Update documentation: Add another pipe example. 2010-04-13 21:26:47 +01:00
Richard Jones
c7c4a476a5 fish: Update documentation: Using 'lcd' command to change local directory. 2010-04-13 21:26:47 +01:00
Richard Jones
3d9b2a707d Update PO files. 2010-04-12 19:52:03 +01:00
Richard Jones
bbf56d28b2 Prepare for version 1.3.3. 2010-04-12 19:32:38 +01:00
Richard Jones
cdc89bb10f resize: Add --LV-expand option for expanding Linux LVs. 2010-04-12 18:55:18 +01:00
Richard Jones
2bec01ba1f New API: lvresize-free to extend LVs into percentage of free space. 2010-04-12 18:55:18 +01:00
Richard Jones
508f1ee87e Fix time and timezone to be correct within the appliance. 2010-04-12 18:55:18 +01:00
Richard Jones
960b99f875 resize: Fix missing newline from end of print. 2010-04-12 18:55:18 +01:00
Richard Jones
ba099ee689 resize: Fix regular expression to exactly match ^ext[234]$ 2010-04-12 16:35:47 +01:00
Richard Jones
c53e64a156 virt-resize: Mention alternate tools like gparted in the documentation. 2010-04-12 16:35:47 +01:00
Daniel Cabrera
de5607909b Updated Spanish translation (RHBZ#581501). 2010-04-12 16:35:47 +01:00
Richard Jones
9a608a1516 Documentation updates.
Fix copyright years.
Fix URLs to point to new PRC site.
Make sure guestfish(1) and guestfs(3) manpages reference the
current list of tools.
2010-04-11 17:02:18 +01:00
Richard Jones
4e5678c104 Version 1.3.2 2010-04-10 21:54:04 +01:00
Richard Jones
540da0bc19 New API: checksum-device for checksumming devices.
Analogous to the usual 'checksum' call.
2010-04-10 21:23:27 +01:00
Richard Jones
5466638279 virt-resize: Enhance virt-resize so it can expand partition content.
Enhance virt-resize so it can expand "first level" partition
content, including ext/2/3/4/ntfs filesystems and PVs.

Also extensively update the documentation.

This has been tested on a variety of Linux and Windows guests.
2010-04-10 13:43:36 +01:00
Richard Jones
e6bdd66fa6 virt-list-partitions: Add -t / --total option.
This option lists out block devices separately:

 $ virt-list-partitions -lht /tmp/WindowsResized.img
 /dev/sda1 ntfs 100.0M
 /dev/sda2 ntfs 11.9G
 /dev/sda device 12.0G
2010-04-10 13:43:35 +01:00
Richard Jones
add5e22563 Bugfixes for virt-resize.
- copy more than 64 boot loader sectors across, since real boot
   loaders (eg. for Windows) can be much larger than this
 - copy bootable flag and ID byte to new partitions
 - start the first partition on the new disk at the same sector
   offset as on the old disk
 - sync the disks before existing
2010-04-10 13:43:35 +01:00
Richard Jones
b68c030adf New partition APIs: part_del, part_get_bootable, part_get/set_mbr_id
These APIs flesh out further the partitioning API.
2010-04-10 13:43:35 +01:00
Richard Jones
cb9350019c daemon: More reliable parsing of the output from 'parted print'.
Previously we used strtok.  However this has the problem that
strtok considers multiple delimiter characters to be like a single
delimiter, eg. "1:::2" would be parsed the same as "1:2".  In
other words, the previous code would skip over or fail if there
are empty fields.
2010-04-10 13:43:18 +01:00
Richard Jones
440ad646cd daemon: Make the RUN_PARTED macro take an error statement.
This allows us to make the RUN_PARTED macro do something else
along the error path, other than just returning -1.
2010-04-10 13:41:46 +01:00
Richard Jones
30752ac7ca Documentation: Clarify documentation on the bootable flag. 2010-04-10 13:41:46 +01:00
Richard Jones
9752039e52 New API: vgscan
Implement vgscan to allow for a full rescan of all LVM
PVs, VGs and LVs.
2010-04-10 13:41:45 +01:00
Richard Jones
f8210da958 New API: ntfsresize.
This implements the ntfsresize operation, using the external
program from ntfsprogs.
2010-04-10 13:41:45 +01:00
Richard Jones
e323d93ed2 virt-make-fs: Use Sys::Guestfs::Lib::feature_available helper function. 2010-04-10 13:41:10 +01:00
Richard Jones
d1dd00606d Allow aug-ls to take Augeas variable as argument (RHBZ#580016). 2010-04-09 09:40:59 +01:00
Richard Jones
3765f97898 Remove warning "No grub default" (RHBZ#580650). 2010-04-08 19:33:57 +01:00
Richard Jones
e35debd642 If qemu dies during launch in "null vmchannel" mode, don't hang (RHBZ#579155).
Detect if qemu dies during launch by wait(2)-ing for it, and
then getting EOF on the qemu pipe.  This was broken in null
vmchannel mode, causing a hang.
2010-04-08 19:07:45 +01:00
Richard Jones
dc5df3bfec Don't kill self accidentally.
Always check that pid > 0 before calling kill (pid, 9).  The
issue was that sometimes pid == 0, and this ends up killing
ourselves.
2010-04-08 19:06:00 +01:00
Richard Jones
fb4ec82d97 Fix for "warning: unexpected connection from UID ..."
This warning is currently a fatal error.  The code attempts
to retry the accept call, but because we don't reset sock = -1
the retry doesn't happen and it dies anyway.

Set sock = -1 so the retry attempt can happen.
2010-04-08 18:53:40 +01:00
Richard Jones
50195d6ec4 New API calls to upload/download txz files (RHBZ#580556). 2010-04-08 16:07:32 +01:00
Richard Jones
0ce9b2bb9b configure: Default to using Fedora 12 repo (was Fedora 11).
Fedora 11 is almost EOL at this point.
2010-04-08 15:49:14 +01:00
Richard Jones
d0efcd6b63 Version 1.3.1. 2010-04-08 15:31:23 +01:00
Richard Jones
d868221d9f New tool: virt-make-fs for creating filesystems on devices. 2010-04-08 14:07:10 +01:00
Richard Jones
de7ef2a0fd Code cleanups related to RHBZ#580246.
This includes various code cleanups:

 (a) A regression test for RHBZ#580246.

 (b) Use write instead of fwrite to write out the tar file.  This is
     just because the error handling of write seems to be better
     specified and easier to use.

 (c) Use size_t instead of int for length.

 (d) Clearer debug messages when in verbose mode.
2010-04-08 09:41:57 +01:00
Richard Jones
07f4b20ae9 Fix tar-in command hangs when running out of disk space (RHBZ#580246).
The problem was this sequence of events:

 (1) File transfer goes through OK.

 (2) pclose returns failure (because 'tar' subprocess failed)

 (3) We try to cancel the transfer by calling cancel_receive.

Step (3) fails because the transfer (as far as the library is
concerned) has succeeded, so causing a hang.

The more fundamental reason why we see steps (1) and (2) is that
'tar' does NOT fail immediately if there is a write error.  Instead
it continues reading and discarding the input until the end of the
input before giving "Error exit delayed from previous errors".
IMHO this is a bug with tar, since an ENOSPC write error should
be fatal for tar.
2010-04-08 08:49:00 +01:00
Richard Jones
4c50f4c38d fish: Print extended help when the user types an unknown command first.
$ guestfish /tmp/disk.img
/tmp/disk.img: unknown command
Did you mean to open a disk image?  guestfish -a disk.img
For a list of commands:             guestfish -h
For complete documentation:         man guestfish
2010-04-07 12:06:07 +01:00
Richard Jones
2ade61d1f8 Check error returns from posix_fallocate (RHBZ#579664).
posix_fallocate has a non-standard way to return error indications.
Thus all our calls to posix_fallocate were effectively unchecked.  For
example:

  $ guestfish alloc test.img 1P
  $ echo $?
  0
  $ ll test.img
  -rw-rw-r--. 1 rjones rjones 0 2010-04-06 11:02 test.img
  $ rm test.img

With this change, errors are detected and reported properly:

  $ ./fish/guestfish alloc test.img 1P
  fallocate: File too large

This is a fix for:
https://bugzilla.redhat.com/show_bug.cgi?id=579664
2010-04-07 12:06:07 +01:00
Richard Jones
f42f2df8bc Signed/unsigned warning on 64 bit. 2010-04-07 12:05:46 +01:00
Richard Jones
ce3a9c56b7 New API: guestfs_zero_device to zero whole devices. 2010-03-31 13:19:34 +01:00
Richard W.M. Jones
fb0375a098 Prettier POD CSS. 2010-03-30 21:07:57 +01:00
Richard Jones
b08725d3be Update PO files. 2010-03-30 17:49:44 +01:00
Richard Jones
2e47daea51 chmod +x virt-resize binary. 2010-03-30 17:49:24 +01:00
Richard Jones
855c321b59 Fix EXTRA_DIST rule. 2010-03-30 17:49:06 +01:00
Richard Jones
e17c5a24b8 Prepare for 1.0.89. 2010-03-30 17:05:56 +01:00
Richard Jones
4b48f93ce6 Improved version of virt-win-reg, supporting exporting and merging. 2010-03-30 16:25:12 +01:00
Richard Jones
29c78cc979 virt-df: Match output with native (coreutils) 'df' command (RHBZ#578123).
This commit fixes the 'Use%' field in the output so it matches what
coreutils' 'df' command would print.

Firstly we change the calculation to use the space available to root,
not the space available to non-root.  This means it matches what 'df'
when run as root in the guest would show.

Secondly we display this rounded up to the next whole percent (ie. using
ceil), which is also what 'df' does.

Thirdly we change the regression test so it tests this.

Note that even with these changes you are not guaranteed to get precisely
the same figures from inside and outside the guest, as it depends on
how quiescent the guest is and how recently the superblock was synced.

Thanks: Rita Wu
2010-03-30 16:14:09 +01:00
Richard Jones
fc5fbd460a tools: Add basic tests for the virt-* tools. 2010-03-30 14:20:23 +01:00
Richard Jones
bbe4888cd4 tools: Sectional header for manpages in Makefile.am 2010-03-30 13:45:16 +01:00
Richard Jones
f25da97554 tools: Rearrange list of tools in Makefile.am. 2010-03-30 13:44:29 +01:00
Richard Jones
641e8275b3 daemon: Set TERM=dumb inside the daemon.
Since commit 977edb3185 we have been passing TERM from the
library into the appliance (for the benefit of virt-rescue).
However this changes the output of parted, which I would argue
is a bug in parted:

 TERM=xterm /sbin/parted -m -- /dev/sda unit b print 2>&1 | hexdump -C
 00000000  1b 5b 3f 31 30 33 34 68  42 59 54 3b 0a 2f 64 65  |.[?1034hBYT;./de|

Notice the escape-sequence junk before the official "BYT;"
header.

By setting TERM=dumb we avoid this.
2010-03-30 13:36:06 +01:00
Richard Jones
f826ce4876 Fix the error message when reply body is too large (RHBZ#509597). 2010-03-27 11:11:30 +00:00
Richard Jones
ef3a669241 tests: Move alarm(2) calls to the correct place in the tests.
This is a re-fix for RHBZ#505329.
2010-03-27 10:49:24 +00:00
Richard Jones
650159fce9 Prepare for 1.0.88. 2010-03-26 21:08:43 +00:00
Richard Jones
977edb3185 rescue: Pass $TERM from library into the virt-rescue appliance.
We set it on the kernel command line, then get it out from
there when the rescue appliance boots.
2010-03-26 20:08:45 +00:00
Richard Jones
cd55161994 rescue: Sync disk on exit, and improve messaging. 2010-03-26 20:02:10 +00:00
Jim Meyering
b6a0c8565c Const-correctness fix. 2010-03-26 20:01:45 +00:00
Richard Jones
9e0b31a2af appliance: Set $PATH instead of hard-coding paths to binaries everywhere.
Change the appliance so PATH includes common directories.  Thus
we don't need to hard-code paths to binaries (eg. "/sbin/fdisk")
everywhere.
2010-03-26 13:36:30 +00:00
Richard Jones
57c143da4d perl: use newSVpvn for variable length strings.
Previously we used newSVpv (str, len), but if len == 0 then
this means Perl tries to calculate the string length using
strlen(3).  This is not desirable when we know the length, in
which case we should use newSVpvn instead.
2010-03-25 19:44:22 +00:00
Richard Jones
3e9d96d246 Update PO files. 2010-03-25 16:03:42 +00:00
Daniel Cabrera
5a5be3c25c Update Spanish translation of libguestfs (RHBZ#576876). 2010-03-25 16:03:01 +00:00
Richard Jones
00a9ae7365 Fix lvresize test on RHEL 5, by fixing guestfs_e2fsck_l.
The problem is that mkfs was making an ext2 filesystem,
which later we were checking with e4fsck.  e4fsck corrects
an "error" on the filesystem:
  /dev/VG/LV: Adding dirhash hint to filesystem.
e4fsck returns 1 (errors corrected) which we were interpreting
as an error return.
2010-03-24 23:28:14 +00:00
Richard Jones
c4e8aa245a Use ext4 dev tools on RHEL 5 (RHBZ#576688). 2010-03-24 22:02:34 +00:00
Richard Jones
f57f1012a6 Add support for minix filesystem (RHBZ#576689). 2010-03-24 21:21:23 +00:00
Richard Jones
0c43d63781 Version 1.0.87. 2010-03-23 22:29:49 +00:00
Richard Jones
def627e4da New tools: virt-resize and virt-list-partitions.
Virt-resize is the main contribution here, a program which can
be used to expand and shrink partitions in disk images.

Virt-list-partitions is used as an ancillary tool for planning
resize operations.
2010-03-23 21:56:14 +00:00
Richard Jones
b6483061c2 New API: guestfs_copy_size to copy a fixed number of bytes.
This is similar to 'guestfs_dd', but it copies just a fixed
number of bytes from the source to the destination.  It's an
error if the source is too short or if the destination is too
small.
2010-03-23 21:56:14 +00:00
Richard W.M. Jones
5d90acbe4b Change some _exit(0|1) to _exit(EXIT_SUCCESS|EXIT_FAILURE). 2010-03-23 21:46:22 +00:00
Richard Jones
cef4ba0b8f Mac OS X: Fix configure-time tests for Ruby.
For ARCHFLAGS change, see:
http://www.ruby-forum.com/topic/129717#579065

We also add a test for the <guestfs.h> header and include
that header when testing the library.
2010-03-22 10:41:46 +00:00
Richard Jones
e5fa90a795 guestfs.h: Include <stdint.h>.
This allows programs to work if they just
  #include <guestfs.h>
and no other headers.  It's not useful in the general
case, but fixes some configure-time tests, particularly
the one for Ruby on OS X.
2010-03-22 10:41:46 +00:00
Richard Jones
82bd4fac87 ocaml examples: Fix linking line so it uses local library. 2010-03-22 10:41:46 +00:00
Richard Jones
36e8ece4cc Mac OS X: Disable null vmchannel implementation.
As far as I can tell, Darwin has no way to check the peer euid
of a _loopback_ TCP socket.  This is required for the "null vmchannel"
implementation to work securely.

Therefore disable this - Darwin will use one of the other supported
vmchannel implementations instead.
2010-03-22 10:41:46 +00:00
Richard Jones
d4a202aa7b Mac OS X: 'xdr_uint32_t' is 'xdr_u_int32_t' 2010-03-22 10:41:46 +00:00
Richard Jones
fd8b87ec2b Mac OS X: For PATH_MAX, include <limits.h> 2010-03-22 10:41:45 +00:00
Richard Jones
9e397cc16b Mac OS X: setlocale function requires <locale.h> header file. 2010-03-22 10:41:45 +00:00
Richard Jones
dd12eaefb5 Mac OS X: implement readline functions.
OS X has an older version of readline with some differences
in the names of functions.
2010-03-22 10:41:45 +00:00
Richard Jones
5ebf3a3934 Mac OS X: provide alternate implementation of posix_fallocate. 2010-03-22 10:41:45 +00:00
Richard Jones
b2070ae3d7 Mac OS X: include <rpc/types.h> before <rpc/xdr.h>
In PortableXDR this is not included automatically so we
have to include it explicitly to get definitions for the
XDR types.
2010-03-22 10:41:45 +00:00
Richard Jones
cc6a6a3dcc Mac OS X: include <string.h> in guestfs-actions.c
This is required because guestfs-actions.c uses 'memset'.
2010-03-22 10:41:45 +00:00
Richard Jones
b369fa6f91 Mac OS X: Fix HAVE_GNU_CALLOC so it works when __GLIBC__ is not defined. 2010-03-22 10:41:45 +00:00
Richard Jones
a28791d6ac Mac OS X: strerror_r on Macs is not like GNU strerror_r.
Really this should be turned into a configure-time test.
Perhaps one exists already?
2010-03-22 10:41:44 +00:00
Richard Jones
a6802f80b3 Mac OS X: define MAX macro if not already defined. 2010-03-22 10:41:44 +00:00
Richard Jones
73e472f1f1 Mac OS X: kill(2) requires <signal.h> 2010-03-22 10:41:44 +00:00
Richard Jones
1bf7668110 generator: Small fix for GODI users.
GODI has an odd package layout, so the generator was unable to
find xml-light.  Add the GODI directory to the search path.
2010-03-22 10:41:44 +00:00
Richard Jones
df54298591 Ignore m4/intmax.m4 2010-03-22 10:41:44 +00:00
Richard Jones
35e916dbcf Remove out-of-date comment. 2010-03-22 10:41:44 +00:00
Richard Jones
ef044690c5 configure: Add --disable-daemon and --disable-appliance options.
Use these on any platforms where you don't want or need to
build the daemon/appliance combination.
2010-03-22 10:41:44 +00:00
Richard Jones
b7d59e2cda Run qemu with -nographic option.
On Mac OS X this prevents a short "flash" as qemu opens a
toplevel window.
2010-03-22 10:41:44 +00:00
Richard Jones
a7cb2d9b08 configure: Move host_cpu definition to earlier in the file. 2010-03-22 10:41:43 +00:00
Richard Jones
4a065c99e4 appliance: Run depmod to create modules.dep for the kernel.
Since we disabled running new-kernel-pkg in febootstrap, this
has meant that the normal appliance has not had a modules.dep
file.  (Supermin was unaffected by this).
2010-03-22 10:41:16 +00:00
Richard Jones
7581672c78 Mac OS X: Detect bindtextdomain.
These are missing on Mac OS X.  I think you would need to install
a gettext package to get these.
2010-03-22 08:48:08 +00:00
Richard Jones
f5d52fa3c0 Mac OS X: Use gnulib setenv module explicitly.
See:
https://www.redhat.com/archives/libguestfs/2010-March/thread.html#00094
2010-03-22 08:38:36 +00:00
Richard Jones
50d2af4f85 New APIs: Query the relationship between LVM objects.
These calls allow you to query the relationship between
LVM objects, for example, which PVs contain a VG, or which
LVs are contained in a VG.

See the example / test program 'regressions/test-lvm-mapping.pl'
for an example of how to do this from Perl.
2010-03-18 15:21:08 +00:00
Richard Jones
27e73269d3 daemon: Add a trim utility function.
This function trims the whitespace from around a string.  It
does this in-place, so it can be called for malloc'd strings.
2010-03-18 15:21:04 +00:00
Richard Jones
676462684e add_drive_ro adds readonly=on option if available.
Change the add_drive_ro call so it adds the readonly=on option
if qemu supports that.

This just means that qemu will not try to open the drive with
O_RDWR, and should not otherwise change the behaviour of qemu or
libguestfs.  (In particular, writes to the read-only drive are
still permitted, and are just discarded when the handle is closed).

However it should alleviate RHBZ#571714 where udev was deciding
to incorrectly relabel a device because we had opened the device
for writing (even though we didn't actually write to it).
2010-03-16 21:50:13 +00:00
Richard Jones
5442f45aea Allow qemu_supports to run earlier.
Reimplement qemu_supports() internal function.  Allow it to run
before launch so we can test qemu features.  Document that you
should run guestfs_set_qemu as early as possible to make sure
these tests are reliable.
2010-03-16 21:44:26 +00:00
Richard Jones
f8d781a00d Add minimal vim to the appliance for virt-rescue.
virt-rescue lacks an editor.  Add vim-minimal (Fedora)
or vim-tiny (Debian) to make up for this omission.
2010-03-16 21:13:06 +00:00
Richard Jones
760a1c84d7 tests: Don't use <guestfs-internal.h> in tests.
It was failing when including this header, as a consequence
of earlier commit 1f56debfcf.
2010-03-16 21:13:06 +00:00
Richard Jones
d89955fde9 guestfs.h: More adjustment to comments in the header file. 2010-03-16 11:50:39 +00:00
Richard Jones
1f56debfcf guestfs.h: Move some internal functions to the internal header.
Functions like guestfs__send were never exported through the public
API (libguestfs.syms prevented that).  However they appeared in the
public header.  Move them to the internal header.
2010-03-16 11:18:51 +00:00
Richard Jones
504177b0aa Rearrangement and comment changes in <guestfs.h> header file.
There should be no substantive change.
2010-03-16 11:15:28 +00:00
Richard Jones
84bcb4dbee Prepare for version 1.0.86. 2010-03-12 18:28:21 +00:00
Richard Jones
369872b91e Tab to space (whitespace fixes only). 2010-03-12 16:23:46 +00:00
Richard Jones
ffa3af3b5d Docs: Change exit(1) -> exit(EXIT_FAILURE) 2010-03-12 16:23:14 +00:00
Richard Jones
cb9613b993 Rewrite libguestfs-supermin-helper in C.
libguestfs-supermin-helper was previously a shell script.  Although
we had steadily optimized it, there were a number of intractable
hot spots:

  (1) cpio still reads input files in 512 byte chunks; this is *very*
    pessimal behaviour, particularly when SELinux is enabled.
  (2) the hostfiles globbing was done very inefficiently by the shell,
    with the shell rereading the same directory over and over again.

This is a rewrite of this shell script in C.  It is approximately
3 times faster without SELinux, and has an even greater speed difference
with SELinux.

The main features are:

  (a) It never frees memory, making it simpler.  The program is designed
    to run and exit in sub-second times, so this is acceptable.
  (b) It caches directory reads, making the globbing of host files much
    faster (measured this as ~ 4 x speed up).
  (c) It doesn't use external cpio, but instead contains code to write
    newc format cpio files, which is all that the kernel can read.  Unlike
    cpio, this code uses large buffers for reads and writes.
  (d) Ignores missing or unreadable hostfiles, whereas cpio gave a
    warning.
  (e) Checks all return values from system calls.
  (f) With --verbose flag, it will print messages timing itself.

This passes all tests.

Updated with feedback from Jim Meyering.
2010-03-12 16:21:58 +00:00
Richard Jones
891aac7a0c guestfish: Use xstrtoll to parse Int params (RHBZ#569757 RHBZ#567567).
Change guestfish so it uses xstrtoll to parse Int (31 bit)
parameters.  This fixes two bugs on 32 bit platforms which
failed when long = 32 bits.  long long = 64 bits on both.
2010-03-12 15:13:05 +00:00
Richard Jones
599f94c9c1 Special case hostfiles handling for libntfs-3g.so
The ntfs-3g project keeps bumping their soname, and this causes
dependency problems for the Fedora package.  The root of the problem
is we depend on /lib/libntfs-3g.so.<N>, but if <N> keeps bumping,
the dependency keeps breaking.

This commit changes the hostfiles (and hence dependency) to be on
/lib/libntfs-3g.so.* instead.  The downside to this is we could end
up pulling more files into the appliance than are strictly required,
but it will fix the Fedora packaging problems being felt by the
Fedora maintainer of ntfs-3g.

After applying this commit, the change to hostfiles looks like this:

@@ -1489,7 +1489,7 @@
 ./lib/libpam_misc.so.0
 ./lib/libdmraid.so
 ./lib/libidn.so.11
-./lib/libntfs-3g.so.74
+./lib/libntfs-3g.so.*
 ./lib/libext2fs.so.2.*
 ./lib/libpam.so.0
 ./lib/libsepol.so.1
@@ -1520,7 +1520,6 @@
 ./lib/libnss_files-*.so
 ./lib/libgio-2.0.so.0
 ./lib/libpam_misc.so.0.*
-./lib/libntfs-3g.so.74.*
 ./lib/libanl.so.1
 ./lib/libdevmapper-event-lvm2.so.2.*
 ./lib/libpthread.so.0
2010-03-12 15:13:05 +00:00
Richard Jones
ebfcb7f23d inspector: Read information about Windows guests from the Registry.
This commit changes substantially the way that we get information
about Windows guests.  We now use the Windows Registry to get
information such as the version, product name and much else.

This uses Win::Hivex (ie. the hivex library).  'reged' is no longer
needed or used.

As an incidental change, this also tries harder to search for
%systemroot%, in the case when we cannot find boot.ini (ie.
Windows Vista and more recent).  This ensures we can get more
detail from those versions of Windows.
2010-03-08 19:35:23 +00:00
Richard Jones
4851466ec5 inspector: Add product_name field to output.
This is a free text string containing the "product name" of
the OS.  It's mainly useful for Windows guests, and a forthcoming
patch will get this field from the Windows Registry.
2010-03-08 19:35:22 +00:00
Richard Jones
ed6fc794c8 inspector: Don't crash if $os->{kernels} does not exist.
ie. on Windows.
2010-03-08 19:35:22 +00:00
Richard Jones
dcfa05f703 inspector: Sort application names.
This ensures the list of applications is stable.
2010-03-08 19:24:48 +00:00
Richard Jones
aca024e976 Remove plymouth libraries from the appliance. 2010-03-08 16:04:09 +00:00
Daniel Cabrera
f550f31477 Spanish translation of libguestfs (RHBZ#570181). 2010-03-03 15:49:39 +00:00
Richard Jones
4891ff9945 More complete fix for bash regexp quoting bug.
Commit 457fccae1b was not a complete fix, in that it
didn't work properly on RHEL 5 era bash (3.2.x).  For example:

  file=libntfs-3g.so.74
  [[ "$file" =~ ^lib(.*)\.so\.([0-9]+)\. ]] && \
    echo "lib${BASH_REMATCH[1]}.so.${BASH_REMATCH[2]}.*"

would on those old shells print:

  libntfs-3g.so.7.*

It seems the final \. was being treated as a plain period (ie.
match anything).

The only way to work around this incompatibility is to assign the
patterns to variables and match on those, ie:

  p='^lib(.*)\.so\.([0-9]+)\.'
  [[ "$file" =~ $p ]] && ...

This works in both old and new shells.
2010-03-02 10:34:20 +00:00
Richard Jones
d09a918e08 Prepare for version 1.0.85.
Update PO files.
2010-03-01 14:30:17 +00:00
Richard Jones
d9e2285837 fuse: Fix typo in test. 2010-03-01 14:17:31 +00:00
Richard Jones
457fccae1b build: Fix for bash quoting in supermin-split.sh.in (RHBZ#566511 RHBZ#566512)
Bash changed how the =~ operator worked, see bash FAQ question
E14 http://tiswww.case.edu/php/chet/bash/FAQ and
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=487387#25
(RHBZ#566511).

This also stops stray "builddir" (yum database) files being
incorporated into supermin hostfiles in Koji (RHBZ#566512).
2010-03-01 13:32:34 +00:00
Piotr Drąg
afcb3695b6 Updated Polish translations (RHBZ#502533). 2010-03-01 09:38:07 +00:00
Richard Jones
49d85054fc Remove bogus msgstr from kn.po. 2010-02-25 20:02:38 +00:00
Guido Günther
de33cc91ee List application in Debian based vm images
Hi,
attached patch adds the code to list applications installed in Debian
based vm images.
Cheers,
 -- Guido

>From 9427a14725b33415058a0713923c62bd231504ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Tue, 23 Feb 2010 21:05:02 +0100
Subject: [PATCH 2/2] Add application listing for Debian
2010-02-24 15:30:41 +00:00
Guido Günther
b5c307b7d6 Debian package format
Hi,
Minor nitpick: the Debian folks usually refer to deb as the package format not dpkg.
Cheers,
 -- Guido

>From 7a9665d40e0a3109833de10f17831ae06fc8885a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Tue, 23 Feb 2010 21:04:37 +0100
Subject: [PATCH 1/2] Debina package format is called 'deb' not 'dpkg'
2010-02-24 15:30:41 +00:00
Guido Günther
d070a017f7 check for grub/menu.lst too
On Tue, Feb 23, 2010 at 08:07:14PM +0100, Guido Günther wrote:
> On Tue, Feb 23, 2010 at 07:52:43PM +0100, Guido Günther wrote:
> > Hi,
> > attached patch makes virt-inspector find the kernels on Debian systems.
> > Since there is no /etc/grub.conf it falls back to
> > $grubpartition/grub/menu.lst.
> Patch got somehow broken. New version fortchcoming. Sorry for the noise.
Attached now. No idea where the 'if' went in the first version ;)
 -- Guido

>From d30b4946f017ff8bde9d4ff62f93c418a707d9e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Tue, 23 Feb 2010 19:50:40 +0100
Subject: [PATCH] Check for grub/menu.lst if /etc/grub.conf can't be found
2010-02-24 15:30:41 +00:00
Guido Günther
4ff21ceb25 Use 'service' if installed
Hi,
attached patch should make:

http://git.debian.org/?p=pkg-libvirt/libguestfs.git;a=blob;f=debian/patches/0003-appliance-Use-service-udev-start-instead-of-running-.patch;h=c9e6b8489807d4fb1247cb6a8b6f9799bad2a09e;hb=d3a21b5b6850fc3c6e7903d0f5cafa3eb4197d49
http://git.debian.org/?p=pkg-libvirt/libguestfs.git;a=blob;f=debian/patches/0004-Ubuntu-Prefer-starting-udev-by-hand-instead-of-using.patch;h=64b65a971b186e6ab1c9351e94b46d6f5aa242e0;hb=d3a21b5b6850fc3c6e7903d0f5cafa3eb4197d49

superflous. If there's an init script it uses 'service' or falls back to
calling the init script directly if it isn't there, otherwise it starts
udev directly. Tested on Debian only so far. The patch is based on
Rich's above two patches.
Cheers,
 -- Guido

From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Tue, 23 Feb 2010 18:49:34 +0100
Subject: [PATCH] Check for service and use it if it's there

Based on Richard's two patches for the Ubuntu build.
2010-02-24 15:30:41 +00:00
Richard Jones
1ea1e53634 Update PO files. 2010-02-24 10:33:27 +00:00
Shankar Prasad
d6a10efaaa Added Kannada translations (RHBZ#567860). 2010-02-24 10:32:03 +00:00
Richard Jones
a8c3723e38 Spin off hivex as a separate upstream project.
This commit makes the semi-independent hivex library into a
separate upstream project.  The git repo for hivex is now:

http://git.annexia.org/?p=hivex.git;a=summary

Downloads of hivex are available here:

http://libguestfs.org/download/

All questions, patches, bugs etc should be sent to the libguestfs
mailing list and bug tracker.
2010-02-22 13:19:21 +00:00
Guido Günther
aa4700f032 enable scrub on Debian 2010-02-22 09:41:52 +00:00
Richard Jones
219b80cc6c hivexsh: Print hex bytes >= 0x80 correctly.
These were being interpreted as signed chars, and thus printed
as "ffffff80" etc.
2010-02-19 13:51:07 +00:00
Richard Jones
abe54abdd2 Remove unused Perl modules.
These were 'use'd but not actually used.
2010-02-19 13:50:31 +00:00
Richard Jones
c06ee4ba02 Update PO files. 2010-02-16 08:06:04 +00:00
Rajesh Ranjan
04ee1adc91 Add Hindi translations (RHBZ#565759). 2010-02-16 08:04:59 +00:00
Richard Jones
699f38f05f Turn ProtocolLimitWarning into link to documentation section. 2010-02-15 23:15:17 +00:00
Richard Jones
e3f371fff2 initrd-cat: Needs ProtocolLimitWarning. 2010-02-15 22:58:22 +00:00
Richard Jones
dabe72cb8b Remove references to FTP, replace with FUSE.
We originally intended to implement an FTP server (and before
than, an NFS server).  But we didn't implement either.  We
did however implement a FUSE service (guestmount) which takes
the place of both.
2010-02-15 22:53:40 +00:00
Richard Jones
1f0f0df9b1 Remove some unused variables.
Since we have to compile with -Wno-unused-variables, we don't
spot unused variables in code.  I found these by compiling the
code in Ubuntu.
2010-02-15 15:55:38 +00:00
Richard Jones
30a0b5cf16 Distribute .gitignore files.
These are useful for Debian since they keep the tarball unpacked
in git.
2010-02-15 15:35:07 +00:00
Richard Jones
ed83d77025 Add 'make quickcheck' rule to run a quick check. 2010-02-15 15:33:13 +00:00
Richard Jones
2109327021 Version 1.0.84. 2010-02-12 19:43:17 +00:00
Richard Jones
e9c3711310 daemon: Don't need to prefix error messages with the command name.
The RPC stubs already prefix the command name to error messages.
The daemon doesn't have to do this.  As a (small) benefit this also
makes the daemon slightly smaller.

Code in the daemon such as:

  if (argv[0] == NULL) {
    reply_with_error ("passed an empty list");
    return NULL;
  }

now results in error messages like this:

  ><fs> command ""
  libguestfs: error: command: passed an empty list

(whereas previously you would have seen ..command: command:..)
2010-02-12 16:49:00 +00:00
Richard Jones
9b3ef85a3d generator: Don't prefix error messages with command name.
The command name is already being added by the RPC stubs, so
adding it again in Perl and C# just results in doubled error messages
like:
  foo: foo: the error
2010-02-12 16:48:34 +00:00
Richard Jones
c03b7e4d75 Sys::Guestfs::Lib::open_guest: Add interface parameter.
This allows you to override the default QEMU block device emulation.
2010-02-12 12:13:40 +00:00
Richard Jones
33b4b759af Sys::Guestfs::Lib::open_guest: Remove freeform parameters.
Remove the ability to pass freeform parameters to Sys::Virt->new.
We don't use it, it makes the code more complex to modify, and
indeed there are no other args that Sys::Virt->new supports so
this would never be used.

Also change $readwrite to $rw to match parameter name.
2010-02-12 12:08:58 +00:00
Richard Jones
946dc06bb8 New APIs: add-drive{,-ro}-with-if allows you to set QEMU block emulation.
The default if=... comes from configure time (currently it
defaults to if=virtio).

This change allows you to set the QEMU block emulation.

We don't think this will be used very often, but virt-v2v
requires it in order to work around a subtle problem with
running 'mkinitrd' in an appliance attached to a guest.
2010-02-12 11:47:18 +00:00
Richard Jones
48a9ff7331 generator: 'interface' is a reserved word in Java. 2010-02-12 11:46:40 +00:00
Richard Jones
8d70639e27 add_cdrom: Update docs for adding ISO images.
See also RHBZ#563450 (NB: This commit does not fix the bug).
2010-02-12 11:27:44 +00:00
Richard Jones
f93cbe5756 Use mount-options instead of mount to avoid implicit -o sync.
guestfs_mount adds -o sync implicitly.  This causes a very large
performance problem for write-intensive programs (eg. virt-v2v).

Document this as a "gotcha".

Change the tests, guestfish, Sys::Guestfs::Lib, guestmount to use
mount-options instead.

(Note that this gotcha does not affect mount-ro).

The source of the performance problem was first identified by
Matthew Booth.
2010-02-10 10:46:23 +00:00
Richard Jones
245ac56737 Add -enable-kvm option to qemu command line.
If the version of qemu being used supports -enable-kvm option,
then check if /dev/kvm is openable and add this option.

I have found this option makes no difference, although it is
*supposed* to enable KVM (hardware virtualization) support.
2010-02-09 16:30:18 +00:00
Richard Jones
e4fbe3e2cd New API call: initrd-cat to list a file from an initrd. 2010-02-09 12:26:22 +00:00
Richard Jones
80bc4ffe93 Remove invalid Plural-Forms header from ml.po. 2010-02-08 22:51:19 +00:00
Richard Jones
c0baa7bdb2 Documentation: Added a section on libguestfs gotchas. 2010-02-08 16:44:41 +00:00
Richard Jones
6c97a65ce7 Make virtio block driver be the default for the appliance.
Previously this caused a serious performance regression,
but we believe this is now fixed:
https://bugzilla.redhat.com/show_bug.cgi?id=509383
2010-02-08 10:18:31 +00:00
Ani Peter
a1d388f258 Added Malayalam translations (RHBZ#562710). 2010-02-08 10:06:32 +00:00
Richard Jones
0d4bc93c73 Distribute hivexsh.1.html HTML file. 2010-02-05 18:54:52 +00:00
Richard Jones
23e117d8cf Update PO files. 2010-02-05 18:42:09 +00:00
Richard W.M. Jones
665ddb18fa RHEL5: Keep old automake happy by defining docdir 2010-02-05 18:42:08 +00:00
Richard Jones
75f803a9d5 Add scripts to EXTRA_DIST. 2010-02-05 18:01:22 +00:00
Richard Jones
a65cc6b06d Update PO files. 2010-02-05 17:19:30 +00:00
Richard Jones
e543a9a214 Prepare for version 1.0.83. 2010-02-05 17:19:21 +00:00
Richard Jones
6d7777d480 Add files to EXTRA_DIST. 2010-02-05 17:19:01 +00:00
Richard Jones
75beebd012 hivex: example6: Don't double backslashes. 2010-02-05 15:12:09 +00:00
Richard Jones
8e15d5a189 hivex: example6: Hypothetical addition of keys for viostor. 2010-02-05 15:05:36 +00:00
Richard Jones
90781ca7d2 hivex: Fix handling of inline VKs. 2010-02-05 14:50:19 +00:00
Richard Jones
0764b93267 hivexsh: Set correct type for 'expandstring' values. 2010-02-05 13:47:32 +00:00
Richard Jones
348bcd59b3 hivex: Documentation and cleanups. 2010-02-05 12:59:43 +00:00
Richard Jones
ba48a213ab hivex: Make limits into macros. 2010-02-05 12:59:18 +00:00
Richard Jones
495aa36aa6 hivexsh: Remove unused variable.
This removes an unused variable left over by
commit ab608f3948.
2010-02-05 12:57:53 +00:00
Richard Jones
3a06848a71 hivex: Complete the implementation of adding child nodes. 2010-02-05 12:18:33 +00:00
Richard Jones
006795555e hivex: More debugging around nk 'unknown2' field. 2010-02-04 18:43:50 +00:00
Richard Jones
5b7f2f3f9f hivex: Check hash fields in lf/lh records. 2010-02-04 18:43:50 +00:00
Richard Jones
9a7f01917f hivexsh: del command: Fix error message. 2010-02-04 16:32:22 +00:00
Richard Jones
3932b38386 hivexsh: lsval: Remove stray quotation mark. 2010-02-04 16:31:55 +00:00
Richard Jones
4350479625 hivexsh: cd command: fix error handling
The error behaviour of hivex_node_get_child is subtle, so the 'cd'
command wouldn't always report errors correctly.  This fixes it.
2010-02-04 16:31:09 +00:00
Richard Jones
3113582ef8 hivex: allocate_block should update valid block bitmap.
The internal allocate_block() function wasn't updating the bitmap,
so if you revisited a block which you had allocated in the same
session, you could get an EFAULT error.
2010-02-04 16:29:32 +00:00
Richard Jones
51efd7de7d hivex: More debug messages. 2010-02-04 16:29:11 +00:00
Richard Jones
d717570399 hivex: Documentation update.
ntreg_lf_record can have id "lf" (old-style hashes) or "lh" (new-
style hashes).
2010-02-04 16:28:26 +00:00
Richard Jones
023a1811a7 hivex: Some missing le32toh endianness conversions. 2010-02-04 16:27:58 +00:00
Richard Jones
6ecb9ef141 hivexsh: Document some peculiarities of the "cd" command. 2010-02-04 14:12:04 +00:00
Richard Jones
aef0d618b0 hivex: Implement deleting child nodes. 2010-02-04 13:29:03 +00:00
Richard Jones
e14d001fc9 hivex: Add flags argument to internal get_children() function.
When we later call get_children to visit the intermediate
ri/lf/lh records, we have already deleted the subkey nk-records,
so checking that those nk-records are still valid is not very
helpful.

This commit adds a flag to turn these checks off.
2010-02-04 13:29:03 +00:00
Richard Jones
01ba5f80ee hivex: Don't die on valid registries which have bad declared data lengths.
Some apparently valid registries contain value data length
declarations which exceed the allocated block size for the
value.

Previously the code would return EFAULT for such registries.
However since these appear to be otherwise valid registries,
turn this into a warning and just use the allocated block size
as the data length (in other words, truncate the value).
2010-02-04 13:28:26 +00:00
Richard Jones
578a5774a3 hivex: Minimal registry example.
This is the smallest registry you can make and still have it
load correctly in Windows regedit.
2010-02-04 11:06:33 +00:00
Richard Jones
d9d885e7c8 hivexsh: Add 'setval' and 'commit' commands.
This adds the 'setval' and 'commit' commands to the hivex shell.

Also adds some example scripts showing use of these.
2010-02-04 11:06:33 +00:00
Richard Jones
f604f9b0b4 hivex: Begin implementation of writing to hives.
This implements hivex_node_set_values which is used to
delete the (key, value) pairs at a node and optionally
replace them with a new set.

This also implements hivex_commit which is used to commit
changes to hives back to disk.
2010-02-04 11:06:33 +00:00
Richard Jones
4718aeb9f0 hivex: Add HIVEX_OPEN_WRITE flag to allow hive to be opened for writing.
If this flag is omitted (as in the case for all existing callers)
then the hive is still opened read-only.

We add a 'writable' flag to the hive handle, and we change the way
that the hive file (data) is stored.  The data is still mmapped if
the file is opened read-only, since that is more efficient and allows
us to handle larger hives.  However if we need to write to the file
then we have to read it all into memory, since if we had to extend the
file we need to realloc that data.

Note the manpage section L</WRITING TO HIVE FILES> comes in a later
commit.
2010-02-04 11:06:33 +00:00
Richard Jones
db8a46aa11 Tools for analyzing and reverse engineering hive files.
This commit is not of general interest.  It contains the tools which
I used to reverse engineer the hive format and to test changes.
Keeping these with the rest of the code is useful in case in future
we encounter a hive file that we fail to modify.

Note that the tools are not compiled by default.  You have to compile
each explicitly with:

  make -C hivex/tools <toolname>.opt

You will also need ocaml-extlib-devel and ocaml-bitstring-devel.
2010-02-04 11:06:15 +00:00
Richard Jones
6ea059d6a1 hivexsh: Change some exit(1) -> exit(EXIT_FAILURE) 2010-02-04 10:26:12 +00:00
Richard Jones
286113fa0a hivexsh: Only print final \n when interactive.
When hivexsh was called non-interactively, it would print an
annoying extra line.  Only print this line if we are being
used interactively.
2010-02-04 10:26:12 +00:00
Richard Jones
ab608f3948 hivexsh: Change handling of prompt argument to rl_gets()
Make the result of isatty into a global variable (is_tty).

Change the rl_gets() function so it takes the prompt string
instead of a "display prompt?" flag.  rl_gets() then consults
the global to find out if it should display the prompt at all.
2010-02-04 10:26:12 +00:00
Richard Jones
933505a3be Document that this flag is clear for default keys. 2010-02-04 10:26:12 +00:00
Richard Jones
97dac113f9 Misc documentation and gitignore update. 2010-02-04 10:26:12 +00:00
Richard Jones
e8ad7d2e1b Move htole*/le*toh macros into a separate header file.
This allows us to reuse these macros in hivexsh later.
2010-02-04 10:26:11 +00:00
Sandeep Shedmake
187651c138 Add Marathi translations (RHBZ#561671). 2010-02-04 08:50:14 +00:00
Piotr Drąg
f513c8876e Polish translations (RHBZ#502533). 2010-02-02 22:08:24 +00:00
Richard Jones
36a8928599 Update PO files. 2010-02-02 08:49:56 +00:00
Richard Jones
6121d53a90 Add Gujarti translations (Sweta Kothari) (RHBZ#560918). 2010-02-02 08:49:10 +00:00
Richard Jones
9dc69372c8 Update Oriya translations (thanks Manoj Kumar Giri) (RHBZ#559498). 2010-02-01 14:51:10 +00:00
Richard Jones
73c587ff0f hivex: Reimplement hivexget as a simple shell script.
hivexget is currently a large C program.  Now that we have hivexsh
(the shell) we can reimplement hivexget as a simple bash script that
calls out to hivexsh.
2010-01-29 19:12:34 +00:00
Richard Jones
15a5511e03 hivex: Add 'hivexsh' program (shell for navigating registry hives). 2010-01-29 18:23:58 +00:00
Richard Jones
a6025c11d9 Set locale in C programs so l10n works (RHBZ#559962).
This commit adds the calls to setlocale &c to all of the current
C programs.

It also adds l10n support to hivexget and hivexml which lacked them
previously.

To test this, try:

LANG=pa_IN.UTF-8 guestfish --cmd-help

(You can only do this test after installing the package, or at
least the 'pa.mo' mo-file in the correct place).
2010-01-29 15:11:59 +00:00
Richard Jones
088d0c53cf Another unreadable file: /var/log/yum.log 2010-01-29 14:24:54 +00:00
Richard Jones
35a2aa114d Update PO files. 2010-01-29 09:57:37 +00:00
Richard Jones
21cf5f7760 Add Tamil translation (RHBZ#559877) (thanks to I.Felix) 2010-01-29 09:57:12 +00:00
Richard Jones
c9ca014313 Update Punjabi translation (RHBZ#559480) (thanks Jaswinder Singh) 2010-01-29 09:46:52 +00:00
Richard Jones
2a224424ac Fix regressions/rhbz557655.sh when debugging is enabled (v2).
The previous fix didn't cope with ordinary warnings emitted by
qemu (eg. "open /dev/kvm: No such file or directory").  This
is a hopefully more complete fix for the problem.

See also commit 3cd7ce75f1.
2010-01-29 09:02:14 +00:00
Richard Jones
3cd7ce75f1 Fix regressions/rhbz557655.sh when debugging is enabled.
The regression test for RHBZ#557655 would fail if debugging was
enabled, because debug output would get mixed up with the test
output.

To reproduce the error do:

LIBGUESTFS_DEBUG=1 make -C regressions TESTS=rhbz557655.sh check

This commit disables debug for just this test.
2010-01-28 22:35:16 +00:00
Richard Jones
74fe427460 Implement 'vgrename' and 'lvrename' APIs. 2010-01-28 22:06:27 +00:00
Richard Jones
3c973b8a96 Version 1.0.82. 2010-01-28 19:28:21 +00:00
Richard Jones
9a7640218c hivex: Const-correctness fix on header_checksum (thanks Jim Meyering). 2010-01-28 17:39:40 +00:00
Richard Jones
f8753ae9f7 hivex: Update some previously unknown nk-record fields.
Update these fields with what we found out from reverse engineering
the file.  Also bring the unknownX field names into line with
visualizer.ml.
2010-01-28 16:26:35 +00:00
Richard Jones
64fa7b9db7 hivex: Fix calculation of block size for vk data blocks. 2010-01-28 11:25:31 +00:00
Richard Jones
c052b36385 hivex: Display incorrect block size as unsigned in an error message. 2010-01-28 11:25:30 +00:00
Richard Jones
cb2ec65d5e hivex: display bad block offset in hex 2010-01-28 11:25:30 +00:00
Richard Jones
203013dc16 hivex: hive type in vk-record is an unsigned 32 bit int 2010-01-28 11:25:30 +00:00
Richard Jones
8635be75c5 hivex: Add missing le32toh conversion around field access.
This was missing.  It only worked because we test on a little
endian platform.
2010-01-28 11:25:30 +00:00
Richard Jones
a1b72fd0ba hivex: Clarify some more fields.
Taken from sentinelchicken.com documentation.
2010-01-28 11:25:30 +00:00
Richard Jones
09d988e8f1 hivex: Modify children/values functions to return intermediate blocks.
Modify the functions that return child subnodes and values so they
can also be used to return a list of the intermediate blocks.  This
is so we can delete those intermediate blocks (in a later commit).

We also introduce an offset_list structure which is used for collecting
lists of offsets, ie. lists of nodes, values or blocks.

Note that this commit should not change the semantics of the code.
2010-01-28 11:25:30 +00:00
Richard Jones
a96877f750 hivex: Add value_any callback to the visitor.
The visitor currently contains lots of value_* callbacks, such as
value_string which is called back when the value has type string.

This is fine but it makes it complicated to deal with the case where
you just want to see 'a value', and don't care about its type.

The value_any callback allows visitors to see values generically.
2010-01-28 11:25:30 +00:00
Richard Jones
5fe4d4718c hivex: Move header checksum code into a function.
This function can be reused later.
2010-01-28 11:25:30 +00:00
Richard Jones
f1dc74b8d6 hivex: page 'offset_next' field is really 'page_size'.
The documentation, as usual, is contradictory.  However this
field is definitely the page size in all observed registries.
Furthermore the following field marked 'unknown' is always
zero, although this contradicts what the sentinelchicken.com
paper says.
2010-01-28 11:25:30 +00:00
Richard Jones
fd70638e05 hivex: Collect more statistics about registries. 2010-01-28 11:25:30 +00:00
Richard Jones
1e4614ca8f hivex: Store filename in hive handle. 2010-01-28 11:25:30 +00:00
Richard Jones
5eb3856999 Added Oriya translations (RHBZ#559498).
Translation by Manoj Kumar Giri.
2010-01-28 10:46:32 +00:00
Richard Jones
dab98a0e52 supermin: Add special case for libgcc_s-*.so.N
Because this file contains the GCC version and a date, it frequently
changes on the host.  Create a special case so that this file is
matched using a wildcard for the version/date part of the name.
2010-01-28 09:59:08 +00:00
Richard Jones
1577cb04fa Added translations for Punjabi (pa-IN) (RHBZ#559480).
Translated by Jaswinder Singh.

Also updated pot files.
2010-01-28 09:50:12 +00:00
Richard Jones
214babb060 supermin: Prevent multilib corruption (RHBZ#558593).
On some combination of installing, upgrading and removing the base
libguestfs package on x86_64, multilib can corrupt libguestfs by
leaving a copy of /usr/bin/libguestfs-supermin-helper around which
references the wrong architecture (usually, contains links to the
i386-based appliance, when the x86_64 appliance should be constructed).

This commit changes libguestfs-supermin-helper so that the script is
the same on all architectures.  Instead, the library passes the
differences to the script (eg. $host_cpu).  Because the i386 and
x86_64 libraries should be at different locations (/usr/lib vs
/usr/lib64) this should prevent multilib from screwing things up.

Related links:
https://bugzilla.redhat.com/show_bug.cgi?id=558593
http://rwmj.wordpress.com/2009/11/16/please-someone-shoot-multilib/#content
https://bugzilla.redhat.com/show_bug.cgi?id=235752
2010-01-27 16:22:19 +00:00
Richard Jones
7de6391695 Added Telugu translations (RHBZ#559237).
Also ran 'make -C po update-po' to update the POT file.
2010-01-27 15:30:34 +00:00
Richard Jones
3c398c8928 supermin: Ignore more unreadable files found on RHEL 6. 2010-01-25 16:18:17 +00:00
Richard Jones
c479a06f4b Sync to latest Gnulib. 2010-01-25 12:22:36 +00:00
Richard Jones
58abe782bf guestfish: Use xstrtol to parse integers (RHBZ#557655).
Current code uses atoi to parse the generator Int type and
atoll to parse the generator Int64 type.  The problem with the
ato* functions is that they don't cope with errors very well,
and they cannot parse numbers that begin with 0.. or 0x..
for octal and hexadecimal respectively.

This replaces the atoi call with a call to Gnulib xstrtol
and the atoll call with a call to Gnulib xstrtoll.

The generated code looks like this for all Int arguments:

  {
    strtol_error xerr;
    long r;

    xerr = xstrtol (argv[0], NULL, 0, &r, "");
    if (xerr != LONGINT_OK) {
      fprintf (stderr,
               _("%s: %s: invalid integer parameter (%s returned %d)\n"),
               cmd, "memsize", "xstrtol", xerr);
      return -1;
    }
    /* The Int type in the generator is a signed 31 bit int. */
    if (r < (-(2LL<<30)) || r > ((2LL<<30)-1)) {
      fprintf (stderr, _("%s: %s: integer out of range\n"), cmd, "memsize");
      return -1;
    }
    /* The check above should ensure this assignment does not overflow. */
    memsize = r;
  }

and like this for all Int64 arguments (note we don't need the
range check for these):

  {
    strtol_error xerr;
    long long r;

    xerr = xstrtoll (argv[1], NULL, 0, &r, "");
    if (xerr != LONGINT_OK) {
      fprintf (stderr,
               _("%s: %s: invalid integer parameter (%s returned %d)\n"),
               cmd, "size", "xstrtoll", xerr);
      return -1;
    }
    size = r;
  }

Note this also fixes an unrelated bug in guestfish handling of
RBufferOut.  We were using 'fwrite' without checking the return
value, and this could have caused silent failures, eg. in the case
where there was not enough disk space to store the resulting file,
or even if the program was interrupted (but continued) during the
write.

Replace this with Gnulib 'full-write', and check the return value
and report errors.
2010-01-25 12:07:34 +00:00
Richard Jones
306077ac96 Add 'filesize' call.
Returns the size of a file.  You can already do this with 'stat',
but this call is good for scripting.
2010-01-25 11:37:12 +00:00
Richard Jones
c9324c2025 Missing crc kernel module on RHEL 6 / Linux 2.6.32 (fixes RHBZ#557195) 2010-01-21 10:55:24 +00:00
Richard Jones
0c28fb1a52 hivex: Various improvements in header parsing, thanks to better documentation. 2010-01-15 14:06:32 +00:00
Richard Jones
f004c406e0 hivex: Print header fields. Print all offsets in hex (in debug output). 2010-01-15 12:42:02 +00:00
Richard Jones
ac8ee450db hivex: Reenable checksum calculations, but don't check result. 2010-01-15 12:41:34 +00:00
Richard Jones
add1be720e hivex: Update documentation. 2010-01-15 12:40:56 +00:00
Richard Jones
0221c671e4 hivex: Send all debug messages to stderr. 2010-01-14 16:51:02 +00:00
Richard Jones
fab4298b63 hivex: Remove stray debugging message. 2010-01-14 16:45:59 +00:00
Richard Jones
d0507993a7 hivex: Documentation: Add environment variables section. 2010-01-14 16:29:47 +00:00
Richard Jones
949d6e79ad hivex: Whitespace change. 2010-01-14 16:29:40 +00:00
Richard Jones
8df82f709a hivex: Move STR* macros into C file.
Don't pollute the public header file with these macros.
2010-01-14 16:21:47 +00:00
Richard Jones
80dc92b979 hivex: Small updates to the documentation. 2010-01-14 15:50:53 +00:00
Richard Jones
e28207d5ad Fix generation of HTML documentation for website. 2010-01-13 14:55:04 +00:00
Richard Jones
279c560c62 Add guestfs.pod and guestfish.pod to EXTRA_DIST. 2010-01-13 13:08:30 +00:00
Richard Jones
33ad9f02e1 Prepare for version 1.0.81. 2010-01-13 13:03:28 +00:00
Richard Jones
008cbfcc15 Update to latest Gnulib. 2010-01-13 11:27:50 +00:00
Richard Jones
b4a4db522f qemu: Upstream regression of -stdio serial option.
Best explained by the comment in the code:

    /* Newer versions of qemu (from around 2009/12) changed the
     * behaviour of monitors so that an implicit '-monitor stdio' is
     * assumed if we are in -nographic mode and there is no other
     * -monitor option.  Only a single stdio device is allowed, so
     * this broke the '-serial stdio' option.  There is a new flag
     * called -nodefaults which gets rid of all this default crud, so
     * let's use that to avoid this and any future surprises.
     */
2010-01-07 13:31:19 +00:00
Richard Jones
ce68503d5c inspector: Update example XML and RNG schema.
This updates commit a59dcdbd1b.
2010-01-06 09:55:57 +00:00
Richard Jones
a59dcdbd1b inspector: Make RPM application data more specific (RHBZ#552718).
List applications with epoch, release and arch data.

If epoch is 0, don't store this as an empty string, but as
undefined, and don't output empty <epoch/> element in the XML.
2010-01-05 23:04:57 +00:00
Richard Jones
5e180db9ee Use linker script to control visibility of symbols. 2010-01-04 16:23:36 +00:00
Richard Jones
db430348ca generator: Move all library generation code together. 2010-01-04 14:55:24 +00:00
Richard Jones
a9666ce8bb generator: Print total lines of generated code. 2010-01-04 14:52:00 +00:00
Richard Jones
70c853d67a C#: Add documentation about experimental nature of these bindings. 2010-01-04 14:52:00 +00:00
Richard Jones
c0e4b5dc69 Experimental C# bindings.
Tested in only limited situations, with Mono on Linux.
2010-01-02 21:55:17 +00:00
Richard Jones
d3c615c2d6 Update copyright years. 2010-01-02 19:47:37 +00:00
Richard Jones
8980c01b46 Move guestfs(3) and guestfish(1) man pages into subdirectories.
These manual pages have for a very long time 'lived' in the top
source directory.

Clean up this situation by moving those manual pages (plus associated
generated files) into the src/ and fish/ subdirectories respectively.
2009-12-31 12:26:04 +00:00
Richard Jones
500ab86509 generator: Move src/guestfs-bindtests.c next to other src/ files. 2009-12-31 12:16:10 +00:00
Richard Jones
b177f05ed6 generator: Use Continuation Passing Style (CPS) in output_to function.
This makes the code simpler, shorter and less error-prone.
2009-12-31 11:51:48 +00:00
Richard Jones
de08dbc830 generator: Rename GPLv2 to GPLv2plus, LGPLv2 to LGPLv2plus.
The licenses are "any later version", so reflect this in the
naming of the parameter to generate_header.
2009-12-31 11:29:49 +00:00
Richard Jones
677e021225 generated code: Set copyright years to 2009-xxxx when current year > 2009. 2009-12-31 11:24:57 +00:00
Richard Jones
2e2eb15df0 Remove separate inspector_generator.ml, combine this with generator.ml.
This commit combines the previously separate "inspector_generator.ml"
program which generated bindings for virt-inspector.

Having two separate programs caused no end of troubles for developers,
so we now combine them into a single program.

NOTE: OCaml xml-light is now *required* in order to rebuild the
generated code.
2009-12-31 11:20:56 +00:00
Richard Jones
9ff1c97f04 generator: Comment and whitespace changes only. 2009-12-31 10:52:08 +00:00
Richard Jones
5c6147ecc7 daemon: Work around udevsettle issue (RHBZ#548121). 2009-12-18 19:20:37 +00:00
Richard Jones
b3c4ddc863 Prepare for 1.0.80. 2009-12-16 11:58:52 +00:00
Richard Jones
168cdbebb6 Include latest Polish translations (Piotr Drąg, RHBZ#502533). 2009-12-16 11:58:17 +00:00
Richard Jones
1c0ab7ab95 Update PO files. 2009-12-16 11:55:30 +00:00
Richard Jones
ab100792a1 build: Fix typo in filename. 2009-12-16 11:55:30 +00:00
Richard Jones
835c0186c8 build: Remove references to old contrib/ files which were removed. 2009-12-16 11:53:30 +00:00
Richard Jones
4b09663f01 appliance: Special case handling for libbfd in the supermin appliance.
The libbfd library has a constantly changing, non-standard and
very long name, eg:

/usr/lib64/libbfd-2.20.51.0.2-7.fc13.so

Just add a special case to deal with this.  This fixes the guestfs_strings
command, which relies on the external strings binary which uses this
library.
2009-12-16 11:15:26 +00:00
Richard Jones
795cf46a03 appliance: Ignore unreadable dbus helper programs. 2009-12-16 11:04:10 +00:00
Richard Jones
3b0d91890d lib: Link with $(LTLIBTHREAD), required by Gnulib lock module.
This fixes commit cada248a53.
2009-12-07 13:09:08 +00:00
Matthew Booth
f025a9c41d appliance: Fix code which gets list of kernels.
The first 'ls' command was failing, so the second 'ls' command
would never run at all.
2009-12-07 11:13:12 +00:00
Jim Meyering
9e5fabbe01 accommodate leading "+" in git submodule output
* cfg.mk (_submodule_hash): Also filter out "+".
* autogen.sh: Likewise.
2009-12-07 11:13:12 +00:00
Richard Jones
cada248a53 lib: Add thread-safety to global list of handles.
This commit uses the Gnulib 'lock' module to implement a mutex on
the global list of handles which is stored by the library.

Note that Gnulib nicely avoids explicitly linking with -lpthread
unless the application program itself links to -lpthread.  Locks
are only enabled in multithreaded applications.

$ ldd src/.libs/libguestfs.so.0.217.0
	linux-vdso.so.1 =>  (0x00007fffcb7ff000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f96a4e6c000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f96a544d000)

Please enter the commit message for your changes. Lines starting
2009-12-07 11:13:12 +00:00
Richard Jones
983e7a2345 daemon error handling: Define a new function reply_with_perror_errno.
This allows you to save the errno from a previous call and
pass it to reply_with_perror.

For example, original code:

  r = some_system_call ();
  err = errno;
  do_cleanup ();
  errno = err;
  if (r == -1) {
    reply_with_perror ("failed");
    return -1;
  }

can in future be changed to:

  r = some_system_call ();
  err = errno;
  do_cleanup ();
  if (r == -1) {
    reply_with_perror_errno (err, "failed");
    return -1;
  }
2009-12-07 11:13:12 +00:00
Richard Jones
4b4e0d0d07 daemon error handling: recursive_mkdir shouldn't need to set errno. 2009-12-07 11:13:11 +00:00
Richard Jones
50c239c045 daemon error handling: Clear errno before calling stub functions.
This just ensures that we accurately report errors, even if our
error path code doesn't set errno.  We won't end up with a bogus
errno left over from a previous call.
2009-12-04 15:06:23 +00:00
Richard Jones
f02acc3d30 Whitespace change. 2009-11-27 14:32:47 +00:00
Richard Jones
582b64a7b1 virt-rescue: Freshen documentation. 2009-11-26 22:40:57 +00:00
Richard Jones
47ecaa9ad4 guestfish: Freshen documentation. 2009-11-26 22:40:53 +00:00
Richard Jones
940ef864d0 daemon: Move prototypes around to keep functions grouped logically. 2009-11-26 17:16:17 +00:00
Richard Jones
bba019781a Fix error handling in 'zero' function. 2009-11-26 17:16:17 +00:00
Richard Jones
4d53df4d73 daemon/Win32: Add contributed test script to test daemon using Wine.
This test script allows you to test limited features of the
Windows daemon by running it on a standard Fedora host using
Wine.

Read contrib/README and contrib/guestfsd-in-wine.sh in detail
before using.
2009-11-26 15:36:41 +00:00
Richard Jones
115bc4b816 Ignore guestfsd.exe (Windows daemon). 2009-11-26 15:36:41 +00:00
Richard Jones
7a2f4dbbcb Remove old contrib/febootstrap directory. 2009-11-26 14:34:35 +00:00
Richard Jones
f4845292fb Update PO files. 2009-11-26 14:26:44 +00:00
Richard Jones
a86eb0e0d2 Make realpath call optional, disable it for Windows. 2009-11-26 14:13:55 +00:00
Richard Jones
6699491803 build: update gnulib submodule to latest 2009-11-26 14:11:46 +00:00
Richard Jones
9799810df9 daemon: program_name must be defined for Gnulib error module. 2009-11-26 14:11:46 +00:00
Richard Jones
15ebf32891 daemon/Win32: use gnulib modules connect, socket and symlinkat (for readlinkat). 2009-11-26 14:11:43 +00:00
Richard Jones
fd84feb822 daemon/Win32: provide htonl, htons, ntohl, ntohs functions.
These functions are not available on Windows.
2009-11-26 11:52:44 +00:00
Richard Jones
b76462f743 daemon/Win32: Use Gnulib perror module. 2009-11-26 11:28:02 +00:00
Richard Jones
929ba5a843 daemon: Link guestfs_protocol.[ch] into the daemon directory.
Instead of doing a recursive call into the src/ directory to build
the object files, hard link the source files into the daemon
directory and build them separately.

See:
http://www.redhat.com/archives/libguestfs/2009-November/msg00254.html

Thanks to Jim Meyering for noticing a typo in the original version.
2009-11-26 11:27:45 +00:00
Richard Jones
12f3e9780f daemon: Typo generator_build -> generator_built 2009-11-26 11:04:53 +00:00
Richard Jones
8e33cd5f2f daemon: Indent C macros to reflect nesting level. 2009-11-26 10:32:00 +00:00
Richard Jones
fcae398873 daemon/Win32: Win32 can't fork message moved to separate function (Jim Meyering) 2009-11-26 10:32:00 +00:00
Richard Jones
0a302b7878 guestfs documentation: Missing space. 2009-11-25 22:20:22 +00:00
Richard Jones
8504318756 guestfs: Update architecture section of documentation. 2009-11-25 21:41:51 +00:00
Richard Jones
d32cf86698 Update PO files. 2009-11-25 17:12:00 +00:00
Richard Jones
fafd87038b daemon: Fix build on Unix. 2009-11-25 17:10:33 +00:00
Richard Jones
34ac5d7b7a daemon: Fix sync() call on Unix. 2009-11-25 16:54:46 +00:00
Richard Jones
b854ff35a3 daemon/Win32: update comment 2009-11-25 16:36:00 +00:00
Richard Jones
ed08d34eb6 daemon/Win32: Supply MAX macro for challenged platforms. 2009-11-25 16:28:26 +00:00
Richard Jones
8d0d8cd4a3 daemon/Win32: Windows can't daemonize. 2009-11-25 16:28:26 +00:00
Richard Jones
ea99d9ec56 daemon/Win32: Windows replacement for umask. 2009-11-25 16:28:26 +00:00
Richard Jones
33bc8fb6d2 daemon/Win32: Replace setenv with Win32 equivalent. 2009-11-25 16:28:26 +00:00
Richard Jones
55355491c5 daemon/Win32: Use xdr_u_int for PortableXDR compatibility.
PortableXDR didn't support xdr_uint32_t.  xdr_u_int is the same type.
2009-11-25 16:28:26 +00:00
Richard Jones
b884456237 daemon/Win32: Don't bother blocking SIGPIPE on Win32. 2009-11-25 16:28:26 +00:00
Richard Jones
b20a0916d8 daemon/Win32: Use gnulib getaddrinfo module. 2009-11-25 16:28:26 +00:00
Richard Jones
579465ec1f daemon/Win32: Implement statvfs using GetDiskFreeSpaceEx.
At the time of writing Gnulib didn't support Win32 for its
fsusage API.  Therefore this patch uses GetDiskFreeSpaceEx
if it's available (on Windows) otherwise falls back to using
Gnulib fsusage.
2009-11-25 16:28:26 +00:00
Richard Jones
63516f39a0 daemon: Move statvfs code into separate file.
This makes no functional change to the code.  It just moves the
statvfs-related code out of daemon/stat.c into a new file called
daemon/statvfs.c.
2009-11-25 16:28:26 +00:00
Richard Jones
b3035e8d7c daemon: Use gnulib futimens module.
Instead of checking for futimens support and falling back
(incorrectly in one case) to using futimes, use gnulib's
module.

However the gnulib module does not yet support Win32, so
this change is only really useful on platforms like RHEL 5.
2009-11-25 16:28:26 +00:00
Richard Jones
25081d6268 daemon/Win32: Use gnulib pread module. 2009-11-25 16:28:26 +00:00
Richard Jones
fdbc5aa711 sync: Windows implementation of sync() call.
Replace calls to sync() with calls to sync_disks() which supports
Win32 via FlushFileBuffers.
2009-11-25 16:28:26 +00:00
Richard Jones
c2aad5cd92 daemon: Alternate implementation of posix_fallocate.
If the posix_fallocate function is not available [ie. Windows]
use an alternate implementation that just loops and writes.
2009-11-25 16:28:25 +00:00
Richard Jones
a951965403 dd: Missing include of <string.h>
Breaks compilation on Windows.
2009-11-25 16:28:25 +00:00
Richard Jones
34d5df70d8 daemon/Windows: Define _WIN32_WINNT when compiling on Windows. 2009-11-25 16:28:25 +00:00
Richard Jones
62d6ae454f build: update gnulib submodule to latest 2009-11-25 16:24:49 +00:00
Richard Jones
65ab9e660b build: update gnulib submodule to latest 2009-11-25 15:29:39 +00:00
Richard Jones
4404688aa3 supermin: Die with an error if no kernels found (RHBZ#539746).
Updated with a suggestion from Jim Meyering to use the '-d'
option to ls to avoid a future case of directories matching.
2009-11-25 10:22:30 +00:00
Richard Jones
299d5b9dd2 New tool: virt-list-filesystems
Use this program as a convenient way to list the filesystems
available in a disk image or libvirt guest.

Example:

  $ virt-list-filesystems /dev/vg_trick/Debian5x64
  /dev/debian5x64/home
  /dev/debian5x64/root
  /dev/debian5x64/tmp
  /dev/debian5x64/usr
  /dev/debian5x64/var
  /dev/sda1

This is designed to make it easier for novices to use guestfish
and guestmount.  In particular with guestmount this acts as a way
to get a list of filesystems to use with the '-m' option.  ie:

  $ virt-list-filesystems unknowndisk.img
  /dev/sda1
  /dev/sda2
  $ guestmount -a unknowndisk.img -m /dev/sda1 /mnt
2009-11-24 16:01:11 +00:00
Richard Jones
9b6185b9bf availability: Document how to check for single API calls
This documents how to use autotools and dlopen(3) to test for
the availability of single API calls at compile time and run time
respectively.
2009-11-24 16:01:11 +00:00
Richard Jones
979eda8a5d availability: Add a test for this call.
Because all the tested groups are optional, there's not really
a group we can reliably test, therefore test against the
empty list (which should not fail).
2009-11-24 16:01:11 +00:00
Richard Jones
3817708a5b availability: Clarify and fix documentation. 2009-11-24 16:01:11 +00:00
Richard Jones
b017cd67bb generator: Passing "" to StringList tests should turn into empty list.
This is a bug in the generator which wasn't being tickled.  If
you had a test which expected a StringList or DeviceList parameter,
and you passed "" to that test, then you'd (probably) expect to be
testing an empty list, but in fact you got a single element list
containing an empty string.  This fixes it so you get an empty list.
2009-11-24 16:01:11 +00:00
Richard Jones
6b2c7a23b6 daemon: Fix return value from aug_defnode.
Bug fix - the return value from this function was wrong
in the no-Augeas case.
2009-11-24 16:01:11 +00:00
Richard Jones
22e531bc45 Implement 'dd' command. 2009-11-23 00:10:37 +00:00
Richard Jones
acdcbac91e Use STRPREFIX instead of STREQLEN. 2009-11-22 19:14:48 +00:00
Richard Jones
e496f30dc5 generator: second parameter to upload is Dev_or_Path, not String. 2009-11-22 19:14:19 +00:00
Matthew Booth
a7a88083f0 build: Add missing dependencies in perl directory
make all in the perl directory was missing a check that the library had been
built.

make check in the perl directory was missing a check that the appliance and test
images had been built.
2009-11-21 21:14:03 +00:00
Matthew Booth
1b60344e67 build: Ensure building appliance depends on guestfsd
Previously, only the update.sh rule checked the daemon had been built. update.sh
is called directly from within make.sh, so in that path the dependency was never
checked. This adds the daemon dependency explicitly to the rebuild-from-scratch
path.
2009-11-21 21:13:36 +00:00
Matthew Booth
1befbee8b8 build: Don't re-check generator.ml for each generator_built in daemon directory 2009-11-21 21:13:12 +00:00
Matthew Booth
8b135cb552 build: Rebuild the daemon as necessary from other directories
This change ensure that making the appliance will always rebuild the daemon if
required.
2009-11-21 21:12:45 +00:00
Richard Jones
d49890d5bc Update TODO file. 2009-11-21 21:11:44 +00:00
Richard Jones
6ce1228672 perl: Add Sys::Guestfs::Lib::feature_available
This is a nicer Perl wrapper around $g->available call.

Update the other code in Sys::Guestfs::Lib to use it before using
LVM, Augeas.
2009-11-20 18:25:18 +00:00
Richard Jones
64de216ac7 availability: Skip tests when functions are not available. 2009-11-20 18:03:36 +00:00
Richard Jones
2d9953097b availability: Add optional groups and implement guestfs_available call.
The current groups are defined very conservatively using the
following criteria:
 (a) Would be impossible to implement on Windows because of
     sheer architectural differences (eg: mknod).
 (b) Already optional (augeas, inotify).
 (c) Not currently optional but not implemented on older RHEL and
     Debian releases (ntfs-3g.probe, scrub, zerofree).

The optional groups I've defined according to these criteria are:

 . augeas
 . inotify
 . linuxfsuuid
 . linuxmodules
 . linuxxattrs
 . lvm2
 . mknod
 . ntfs3g
 . scrub
 . selinux
 . zerofree

(Note that these choices don't prevent us from adding more
optional groups in future.  On the other hand to avoid breaking
ABIs we would not wish to change the above groups).

The rest of this large commit is really just implementation:

Each optional function is classified using Optional "group"
flag in the generator.

The daemon has to implement a function

  int optgroup_<name>_available (void);

for each optional group.  Some of these functions are fixed at
compile time, and some do simple run-time tests.

The do_available implementation in the daemon looks up the correct
function in a table and runs it.

We document the optional groups in the guestfs(3) man page.

Also: I added a NOT_AVAILABLE macro in order to unify all the
existing places where we had a message equivalent to
"function __func__ is not available".
2009-11-20 18:03:36 +00:00
Richard Jones
8fd7f255d6 availability: Add guestfs_available.
Start a new API allowing groups of functions to be tested for
availability.

There are two reasons for this:

(1) If libguestfs is built with missing dependencies (eg. no Augeas lib)
then the corresponding functions are disabled in the appliance.  Up till
now there has been no way to test for this except to speculatively
issue commands and check for errors.

(2) When we port the daemon to Win32 it is likely that major pieces of
functionality won't be available (eg. LVM support).  This API gives
a way to test for that.

There is no change for existing clients: you still have to check for
errors from individual API calls.

For new clients, you will be able to test for availability of particular
APIs.

Usage scenario (A): An LVM editing tool which requires
both the LVM API and inotify in order to function at all:

  char *apis[] = { "inotify", "lvm2", NULL };
  r = guestfs_available (g, apis);
  if (r == -1) {
    /* print an error and exit */
  }

Usage scenario (B): A general purpose tool which optionally provides
configuration file editing, but this can be disabled, the result
merely being reduced functionality:

  char *apis[] = { "augeas", NULL };
  r = guestfs_available (g, apis);
  enable_config_edit_menus = r == 0;
2009-11-20 18:02:10 +00:00
Richard Jones
5c9004347f daemon/Win32: Use gnulib modules for first porting to Win32. 2009-11-20 18:01:51 +00:00
Matthew Booth
03cd3050b3 build: Add missing dependency libguestfs.la->guestfs_protocol.h 2009-11-20 17:04:04 +00:00
Jim Meyering
e1b48287eb build: correct sed transformation to work also on .git-module-status
My patch was wrong.
I kept the sed transformation the same in the two places,
but it wasn't strict enough to also work on the file contents.
Sorry about that.  This fixes it.

>From 93927cc7b9f63c414e5bfeb7eba393fde3295601 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Fri, 20 Nov 2009 16:23:17 +0100
Subject: [PATCH libguestfs] build: correct sed transformation to work also on .git-module-status

* autogen.sh: Use a more strict sed transformation so it works also
on the contents of .git-module-status, which has no prefix.
* cfg.mk (_submodule_hash): Use a stricter sed regexp.
2009-11-20 15:40:19 +00:00
Jim Meyering
1b4bab6db2 build: make autogen.sh update .git-module-status, as it should
I ran autogen.sh, but then make was always failing like this:

    $ make
    cfg.mk:141: *** gnulib update required; run ./autogen.sh first.  Stop.

Here's the fix:

>From f743f32079fea2e8a17c7f5b59305e584c75dba0 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Fri, 20 Nov 2009 14:29:55 +0100
Subject: [PATCH libguestfs] build: make autogen.sh update .git-module-status, as it should

* autogen.sh: Without this, "make" would always say "gnulib update
required; run ./autogen.sh first", even after you'd run autogen.sh
successfully.
2009-11-20 14:11:08 +00:00
Jim Meyering
a84dee0f8d maint: use EXIT_* symbol (not constant, 2) to indicate key/path not found
* hivex/hivexget.c (EXIT_NOT_FOUND): Define.
(main): Use exit (EXIT_NOT_FOUND), not "exit (2)".
2009-11-20 12:14:32 +00:00
Jim Meyering
4d45c45f09 maint: use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1 in "usage", too
Convert by running these commands:
perl -pi -e 's/\b(usage ?)\(1\)/$1(EXIT_FAILURE)/' \
  fish/fish.c fuse/guestmount.c
perl -pi -e 's/\b(usage ?)\(0\)/$1(EXIT_SUCCESS)/' \
  fish/fish.c fuse/guestmount.c
* fish/fish.c (main): Replace 0/1 with EXIT_SUCCESS/EXIT_FAILURE.
* fuse/guestmount.c (main): Likewise.
2009-11-20 12:14:32 +00:00
Jim Meyering
c372c7c23a maint: use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1 to exit
Convert all uses automatically, via these two commands:
git grep -l '\<exit *(1)' \
  | grep -vEf .x-sc_prohibit_magic_number_exit \
  | xargs --no-run-if-empty \
    perl -pi -e 's/\b(exit ?)\(1\)/$1(EXIT_FAILURE)/'
git grep -l '\<exit *(0)' \
  | grep -vEf .x-sc_prohibit_magic_number_exit \
  | xargs --no-run-if-empty \
  perl -pi -e 's/\b(exit ?)\(0\)/$1(EXIT_SUCCESS)/'
* .x-sc_prohibit_magic_number_exit: New file.

Edit (RWMJ): Don't change Java code.
2009-11-20 12:14:14 +00:00
Jim Meyering
e94f89f40d maint: remove unnecessary include of openat.h
* daemon/realpath.c: Don't include "openat.h".  not used.
2009-11-20 10:55:02 +00:00
Richard Jones
4e9fefd4e8 build: update gnulib submodule to latest 2009-11-20 10:48:02 +00:00
Richard Jones
0d5b38f1d9 daemon/gnulib: Include glob module. 2009-11-20 10:43:45 +00:00
Richard Jones
295a920f52 daemon/Win32: Don't include missing headers.
This is a partial fix for code in guestfsd.c where many of these
header files are missing on Win32.
2009-11-20 10:41:07 +00:00
Richard Jones
edb9b3abc0 daemon/Win32: make some functions and fields optional.
inotify: Make this optional on platforms that don't have this interface.

mknod, mkfifo etc.: Make these optional on non-Unix platforms.

readdir: If d_type field is missing on the platform, set the corresponding
field to 'u'.

stat: st_blocks and st_blksize are missing on non-Unix platforms, so
set these fields to -1 in the corresponding structures.
2009-11-20 10:38:07 +00:00
Richard Jones
7d8a3404b2 daemon/Win32: NAME_MAX does not exist on Windows, use FILENAME_MAX instead. 2009-11-20 10:36:59 +00:00
Richard Jones
688bdc1a06 daemon: Missing #includes revealed by cross-compiling. 2009-11-20 10:36:21 +00:00
Richard Jones
4d35cc2ff0 daemon/Win32: Ignore mingw32-config.cache.
The Fedora Windows cross-compiler 'mingw32-configure' script always
uses a configure cache.  Ignore that file.
2009-11-20 10:33:27 +00:00
Richard Jones
a216a8adaa generator: open Unix module by default.
Add:

  open Unix

at the top of the generator, which means that we don't need to
prefix any 'Unix.foo' symbols (we can just use 'foo' instead).

Unfortunately the Unix module shadows one symbol in Pervasives
(the Pervasives module is opened by default in OCaml code).  That
symbol is 'stdout'.  So we replace this with 'Pervasives.stdout'
in two places.  Still a net reduction in code size.
2009-11-19 17:01:53 +00:00
Richard Jones
986541c26d syntax-check: Fix tab-vs-space issue in the generator. 2009-11-19 16:59:56 +00:00
Richard Jones
b7423df56e Update PO files. 2009-11-19 16:50:19 +00:00
Richard Jones
3d05963f9e Update TODO file. 2009-11-19 16:50:04 +00:00
Matthew Booth
8b3e75a3c7 build: Fix parallel build of haskell bindings
ghc isn't clever enough not to stomp on itself when building dependencies. This
change makes the 1 dependency explicit.

It also adds a dependency on src/libguestfs.la.
2009-11-19 16:40:22 +00:00
Matthew Booth
c477e2fb78 build: Fix inter-directory dependencies
This change adds an explicit dependency on generator.ml for every file it
generates, except java files. Java is left for another time because it's
considerably trickier.

It also adds a build rule for src/libguestfs.la so it can be rebuilt as required
from other directories.

It does this by creating a top level make file, subdir-rules.mk, which can be
included from sub-directories. sub-directories need to define 'generator_built'
to include local files which are built by generator.ml, and they will be updated
automatically.

This fixes parallel make, and will automatically re-create generated files when
make is run from any directory.

It also fixes the problem which efad4f53 was targetting. Specifically,
src/guestfs_protocol.(c|h) had an erroneous dependency on stamp-generator, and
therefore generator.ml, despite not being directly created by it. This caused
them to be recreated every time generator.ml ran rather than only when
src/guestfs_protocol.x was updated, which cascaded into a daemon and therefore
appliance update.

This patch also changes the contents of the distribution tarball by including
files created by rpcgen.
2009-11-19 16:40:22 +00:00
Richard Jones
16c1b31646 generator: Acquire lock to prevent two parallel runs of the generator.
This commit acquires a lock on a file to prevent two parallel runs of
the generator from stomping on each other.  The second run will wait
for the first to complete before starting.

The lock is acquired on the "HACKING" file because it's convenient --
we are already checking this file exists to make sure that we don't
start off in the wrong directory.

Tested by adding some artificial sleeps in the code to observe
locking behaviour between two parallel runs.
2009-11-19 14:03:59 +00:00
Jim Meyering
60d020d363 syntax-check: expand TABs in generator.ml
Jim Meyering wrote:
>>From 6f128e90afb055f9899011c4a592eb289e678936 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering@redhat.com>
> Date: Thu, 19 Nov 2009 11:39:10 +0100
> Subject: [PATCH libguestfs] syntax-check: expand TABs in generator.ml
>
> * src/generator.ml: Expand leading TABs to spaces.

That was incomplete.
Please use the following instead.
With it, now, "make syntax-check" now passes once again.

>From 716a30d0b692972aac8fbea1fb7ad3318ab3a0d8 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Thu, 19 Nov 2009 11:39:10 +0100
Subject: [PATCH libguestfs] syntax-check: expand leading TABs

* src/generator.ml: Expand leading TABs to spaces.
* fuse/test-fuse.sh: Likewise.
2009-11-19 10:44:56 +00:00
Jim Meyering
f4619c24e2 syntax-check: exempt *.pod from no-trailing-blank prohibition
* .x-sc_trailing_blank: Exempt *.pod.
2009-11-19 10:44:53 +00:00
Richard Jones
44097b509c BUILT_SOURCES now depends on running the generator.
This completely reverts commit efad4f5392.
2009-11-18 17:41:41 +00:00
Richard Jones
9c75b1554b daemon/RHEL: Choose correct udev settle script.
On RHEL/CentOS 5.4, udevadm settle command does not work.  This didn't
affect us before, but now that we're using parted for partitioning, we
*do* need to wait for udev to settle (because parted isn't waiting for
this, unlike sfdisk).

This commit chooses the correct program to run.
2009-11-18 17:33:25 +00:00
Richard Jones
83eb2cf2fd fuse/RHEL: Don't require UTIME_{NOW,OMIT} to be defined.
These macros don't exist on RHEL/CentOS 5.4.  If the feature
is missing then just don't implement it in the FUSE layer.
2009-11-18 17:33:17 +00:00
Richard Jones
09d7b265e6 appliance: Print uptime.
Print the uptime just before the init script runs the daemon, so we
have a good idea of how long the kernel boot + init script takes to run.
2009-11-18 17:31:08 +00:00
Richard Jones
9473e8f72d recipes: Fix git URL. 2009-11-18 14:11:25 +00:00
Richard Jones
52390cde84 Prepare for version 1.0.79. 2009-11-18 13:40:32 +00:00
Richard Jones
4ffd4d460b fuse: Add test-fuse.sh to EXTRA_DIST. 2009-11-18 13:40:04 +00:00
Richard Jones
f5a3da1483 generator: Fix API of functions that return RBufferOut
(NB: The API / ABI doesn't actually change here - it's just made much
simpler to use).

The API for RBufferOut functions was unexpectedly hard to use in the
case where a zero-length buffer might be returned.  For discussion on
this see:

https://www.redhat.com/archives/libguestfs/2009-November/thread.html#00115

This commit ensures that in the zero-length buffer case, the return
value is never NULL.  Thus code is now able to just check if the return
value == NULL to indicate an error, which is simpler for all concerned.

The implementation of this is, however, more complex because we have
to be careful about this case inside both the daemon and the library
code, which is what this commit does.

This has passed a full round of tests.
2009-11-18 10:37:10 +00:00
Richard Jones
5c2da21b2a fuse: Add tests for guestmount.
This script contains non-exhaustive tests for the system calls
implemented by guestmount.
2009-11-17 20:14:47 +00:00
Richard Jones
336275ee6d fuse: Fix read for empty files.
Error handling for the guestfs_pread call was incorrect, which
meant that empty files could produce spurious error messages.
2009-11-17 20:14:47 +00:00
Richard Jones
3fc9951016 fish: Improve output of guestfish -h cmd
Display this output like a short manual page.

Don't put <..> around the parameters to the command.
2009-11-17 20:14:47 +00:00
Richard Jones
540c85a110 New API call: fill - fill a file with octets 2009-11-17 20:14:47 +00:00
Richard Jones
dcd08dd356 fuse: Fix cache invalidation in rename operation.
We need to invalidate both parameters, otherwise the old (moved)
file can appear that it still exists after the move.
2009-11-17 17:47:47 +00:00
Richard Jones
a15f118e3b fuse: Fix hard link creation.
The parameters were swapped.  We also need to invalidate the
cache for both parameters.
2009-11-17 17:47:47 +00:00
Richard Jones
366339d41b fuse: Fix symlink creation (RHBZ#538069).
The parameters were swapped, preventing symlinks from being created.
2009-11-17 17:47:42 +00:00
Richard Jones
dda10cd935 virt-df: Ignore domains which have ID 0.
This is the remainder of the fix for RHBZ#538041.  Domains
which have ID 0 are special domains.  libvirt defines it as
the "control plane OS".  Only Xen and HyperV have this
behaviour, and in both cases we should ignore those domains
for the purposes of virt-df (user can just run "df" if they
need that information for the dom0).
2009-11-17 14:21:54 +00:00
Richard Jones
9004f3c530 virt-df: Turn errors into warnings when listing all domains.
This is a partial fix for RHBZ#538041.  When listing all domains,
don't die just because one domain fails, but keep trying for the
rest.
2009-11-17 14:09:58 +00:00
Richard W.M. Jones
15de7e0d8d Docs: copyediting 2009-11-13 22:23:08 +00:00
Richard W.M. Jones
5f9be62e68 Docs: Add documentation about other language bindings to API overview. 2009-11-13 16:45:07 +00:00
Richard W.M. Jones
b296287daf Docs: line folding in example. 2009-11-13 16:35:51 +00:00
Richard W.M. Jones
747eb7138a Docs: group preformatted sections of text together. 2009-11-13 15:57:32 +00:00
Richard W.M. Jones
259f78cfa7 Docs typo: limited -> limits 2009-11-13 15:09:10 +00:00
Richard W.M. Jones
c2cbf9cd08 Docs: Add section on using multiple threads.
This section was missing from the previous documentation.
2009-11-13 14:50:39 +00:00
Richard W.M. Jones
38d8943009 Docs: Add/extend API overview. 2009-11-13 14:50:35 +00:00
Richard W.M. Jones
407f349013 Docs: Remove incorrect statement from man page.
The low-level event-based API never existed so this statement
in the man page is wrong.  If you want an asynchronous API, use
threads.
2009-11-13 12:15:09 +00:00
Jim Meyering
825d855b22 build: revive the ocaml package tests
* autogen.sh: Generalize the ocaml-package-existence test.
Remove the git-related part of the old test.
2009-11-12 11:34:08 +01:00
Matthew Booth
a6832406fa Generate guestfs_protocol.x when stamp-generator updates
This partially reverts efad4f5392.
guestfs_protocol.x wasn't being generated when building from a clean checkout.
2009-11-11 13:50:24 +00:00
Richard Jones
62288e7118 autogen.sh: Remove test for ocaml etc from this script.
This test seems to cause a lot of trouble.  We need to go back to
the drawing-board on this one.
2009-11-11 13:40:04 +00:00
Richard Jones
cc9b2e30e5 Set cpio blocksize to 64K.
See:
https://www.redhat.com/archives/fedora-devel-list/2009-November/thread.html#00523
2009-11-11 10:55:26 +00:00
Richard Jones
a11927340d Debian: don't depend on gfs-tools since these have depsolving problems. 2009-11-10 19:13:57 +00:00
Richard Jones
b0c050c7de Update PO files for release. 2009-11-10 18:45:13 +00:00
Richard Jones
3ca69d9db3 Check for ocaml-xml-light-devel (xml-light.cmxa)
Also unquote $pkg since OCaml package names can never contain
spaces or other unfriendly characters.
2009-11-10 18:44:37 +00:00
Richard Jones
61a1449b79 Prepare for version 1.0.78 2009-11-10 18:23:52 +00:00
Jim Meyering
bdfb1bddff tell "make syntax-check" that examples/to-xml.c is exempt from some tests
* .x-sc_prohibit_strcmp: Exempt examples/to-xml.c.
* .x-sc_prohibit_strcmp_and_strncmp: Likewise.
2009-11-10 18:49:42 +01:00
Richard Jones
ae4589f17b examples: Don't use STREQ etc in the to-xml.c example. 2009-11-10 17:09:54 +00:00
Richard Jones
ade327a7af Don't export STREQ and friends in <guestfs.h>
Move these to private header file(s) and other places as required
since these aren't part of the public API.
2009-11-10 17:09:12 +00:00
Richard Jones
3833ddc656 Fix problems found by 'make syntax check' 2009-11-10 16:46:31 +00:00
Richard Jones
da33feca27 Print timestamped messages during appliance launch.
In verbose mode, print timestamped messages during guestfs_launch
so we can see how long each step takes.
2009-11-10 16:32:21 +00:00
Richard Jones
3ae742c149 Record time of guest launch.
The guest handle field start_t was previously used (when we
had the wait_ready call), but had fallen into disuse.  Note
that it could never be accessed through the API.

Rename this field as launch_t, convert it to a timeval, and
use it to measure the time since guestfs_launch was called
so that we can start profiling guest launch.
2009-11-10 16:32:20 +00:00
Richard Jones
28d74ee234 appliance: Prefix kernel messages with timestamp. 2009-11-10 16:32:20 +00:00
Richard Jones
b1e1ca2f74 Generic partition creation interface.
This commit introduces a generic partition creation interface
which should be future-proof and extensible, and partially
replaces the old sfdisk-based interface.

The implementation is based on parted but is hopefully not too
dependent on the particulars of parted.

The following new calls are introduced:

  guestfs_part_init:
    Initialize a disk with a partition table.  Unlike the sfdisk-
    based interface, we also support GPT and other partition
    types, which is essential to scale to devices larger than 2TB.

  guestfs_part_add: Add a partition to an existing disk.

  guestfs_part_disk:
    Convenience function which combines part_init & part_add,
    creating a single partition that covers the whole disk.

  guestfs_part_set_bootable:
  guestfs_part_set_name:
    Set various aspects of existing partitions.

  guestfs_part_list:
    List partitions on a device.  This returns a programming-friendly
    list of partition structs (in contrast to sfdisk-l which cannot
    be parsed).

  guestfs_part_get_parttype:
    Return the partition table type, eg. "msdos" or "gpt".

The following calls are planned, but not added currently:

  guestfs_part_get_bootable
  guestfs_part_get_name
  guestfs_part_set_type
  guestfs_part_get_type
2009-11-10 16:32:20 +00:00
Richard Jones
b03995b67f Add ata_piix to kernel module whitelist (RHBZ#533886). 2009-11-10 16:32:20 +00:00
Richard Jones
aa4fffd512 Fix compilation if readline library is not present. 2009-11-10 16:32:20 +00:00
Richard Jones
7cf477952a Fix compilation when Augeas is not present.
It would complain that NEED_AUG macro was defined but not used.
2009-11-10 16:32:20 +00:00
Jim Meyering
b9de2dc611 avoid "syntax-check" failure: hide cast of argument to free
* fuse/guestmount.c (fg_readlink): Perform cast in a
 separate statement to hide it from "make syntax-check".
2009-11-10 17:00:18 +01:00
Jim Meyering
15821057d4 build: die early if we lack ocaml, ocamlfind or ocaml-xml-light
* autogen.sh: Ensure that we fail very early when not building
from a tarball and when one of those is not installed.
2009-11-10 16:56:50 +01:00
Jim Meyering
0e1e0f10df tests: enable strcmp-related syntax-check tests
* cfg.mk (local-checks-to-skip): Don't skip these checks:
sc_prohibit_strcmp_and_strncmp, sc_prohibit_strcmp.
2009-11-09 22:42:02 +01:00
Jim Meyering
c9d9498458 change strncasecmp() == 0 to STRCASEEQLEN()
git grep -l 'strncasecmp *([^=]*== *0'|xargs \
  perl -pi -e 's/\bstrncasecmp( *\(.*?\)) *== *0\b/STRCASEEQLEN$1/g'
2009-11-09 22:42:02 +01:00
Jim Meyering
0c20bd8ea7 change strncasecmp() == 0 to STRCASENEQLEN()
git grep -l 'strncasecmp *([^=]*!= *0'|xargs \
  perl -pi -e 's/\bstrncasecmp( *\(.*?\)) *!= *0\b/STRCASENEQLEN$1/g'
2009-11-09 22:42:01 +01:00
Jim Meyering
539bf7e898 use STREQ, not strcmp: part 2
git grep -l 'strcmp *([^=]*!= *0'|xargs \
  perl -pi -e 's/\bstrcmp( *\(.*?\)) *!= *0\b/STRNEQ$1/g'
2009-11-09 22:34:16 +01:00
Jim Meyering
9a8889e4d0 use STREQ, not strcmp: part 1
git grep -l 'strcmp *([^=]*== *0'|xargs \
  perl -pi -e 's/\bstrcmp( *\(.*?\)) *== *0/STREQ$1/g'
2009-11-09 22:34:16 +01:00
Jim Meyering
3e70b34eed change strncmp() == 0 to STREQLEN()
git grep -l 'strncmp *([^=]*== *0'|xargs \
  perl -pi -e 's/\bstrncmp( *\(.*?\)) *== *0\b/STREQLEN$1/g'
2009-11-09 22:34:16 +01:00
Jim Meyering
627f89351d change strncmp(...) != 0 to STRNEQLEN(...)
git grep -l 'strncmp *([^=]*!= *0'|xargs \
  perl -pi -e 's/\bstrncmp( *\(.*?\)) *!= *0/STRNEQLEN$1/g'
2009-11-09 22:34:16 +01:00
Jim Meyering
29842da137 convert strcasecmp(...) != 0 to STRCASENEQ(...)
git grep -E -l 'strcasecmp *\(.*!= ?0\b'|xargs \
  perl -pi -e 's/\bstrcasecmp( ?\(.*?\)) != 0/STRCASENEQ$1/g'
2009-11-09 22:34:16 +01:00
Jim Meyering
9353c6253d convert uses of strcasecmp to STRCASEEQ
git grep -l 'strcasecmp *([^=]*== *0'| xargs \
  perl -pi -e 's/\bstrcasecmp( *\(.*?\)) *== *0/STRCASEEQ$1/'
2009-11-09 22:34:16 +01:00
Jim Meyering
7cd4b6aeee define STREQ, STRNEQ, STREQLEN, STRCASEQ, etc.
* src/guestfs.h: Define STREQ and company.
* daemon/daemon.h: Likewise.
* hivex/hivex.h: Likewise.
2009-11-09 22:34:16 +01:00
Jim Meyering
e645763007 indent with spaces, not TABs
* HACKING: Expand indentation TABs.
* configure.ac: Likewise.
* daemon/daemon.h: Likewise.
* daemon/guestfsd.c: Likewise.
* fuse/guestmount.c: Likewise.
* hivex/LICENSE: Likewise.
* src/generator.ml: Likewise.
* tools/virt-win-reg: Likewise.
2009-11-09 20:19:42 +01:00
Jim Meyering
d710f76816 fix doc typo
* fuse/guestmount.pod: Avoid "the the".
2009-11-09 20:19:38 +01:00
Jim Meyering
9299f25cd2 placate 'make syntax-check'
* hivex/hivex.c: Remove unused "#include <assert.h>".
2009-11-09 20:19:30 +01:00
Jim Meyering
4e201a0c9b avoid syntax-check warning about isdigit use in example program
* .x-sc_avoid_ctype_macros: New file.
2009-11-09 20:19:17 +01:00
Richard Jones
e0fb48c01f appliance: Enhance mkfs to support many more filesystem types.
This fixes support for NTFS, and adds support for:
 - reiserfs
 - btrfs
 - GFS and GFS2
 - JFS
 - HFS and HFS+
 - NILFS
 - OCFS2 (disabled)

We don't enable OCFS2 by default, because it pulls in about
140 extra packages into the appliance.

GFS & GFS2 default to single node (no lock manager etc).
2009-11-09 11:05:19 +00:00
Richard Jones
3cf719bc07 Fix prototype of commandv to match prototype of commandrv. 2009-11-09 11:05:19 +00:00
Richard W.M. Jones
a25d175cf6 daemon: Always reflect command stderr to stderr when debugging.
When debugging (ie. LIBGUESTFS_DEBUG=1 & verbose flag set in daemon)
always reflect any stderr output from commands that we run to
stderr of the daemon, so it is visible.

Previously if stderror == NULL in command*, stderr output was
just eaten and discarded which meant useful error messages could
be lost.
2009-11-09 11:05:19 +00:00
Richard W.M. Jones
d714547ab3 daemon: Add flags argument to command*() functions.
This adds new variations of the command*() functions which
take a 'flags' argument.  Currently the only flag available
is defined as follows:

 COMMAND_FLAG_FOLD_STDOUT_ON_STDERR: For broken external commands
 that send error messages to stdout (hello, parted) but that don't
 have any useful stdout information, use this flag to capture the
 error messages in the *stderror buffer.  If using this flag,
 you should pass stdoutput as NULL because nothing could ever be
 captured in that buffer.

This patch also adds some documentation for command*()
function.
2009-11-09 11:05:19 +00:00
Richard Jones
49e85f8cda haskell: Disambiguate truncate symbol.
This is a hack, but GHC doesn't like it if we have a symbol
with the same name as one in the Haskell Prelude.  Therefore
we much hide the corresponding symbol in the Prelude when
building this module.
2009-11-09 11:05:19 +00:00
Richard Jones
93e3253fa6 ocaml: Update dependencies file. 2009-11-09 11:05:19 +00:00
Richard W.M. Jones
c0465ca3ae ocaml: Sort the dependencies so they are stable between machines. 2009-11-06 12:33:27 +00:00
Richard W.M. Jones
79125c4dea ocaml: General improvements to generated code. 2009-11-06 10:49:32 +00:00
Richard W.M. Jones
e1f5472395 Fixes for compiling on 32 bit. 2009-11-06 09:14:55 +00:00
Richard Jones
efad4f5392 Don't update appliance after running generator.
I'm not sure why these dependencies exist, but they cause the
appliance to be updated every time the generator runs, which
appears to be unnecessary.
2009-11-05 13:13:44 +00:00
Richard Jones
ac2a53bbab appliance: Add xfsprogs to list of packages 2009-11-05 13:13:43 +00:00
Richard Jones
857954dfbd fish: Allow <nn>P and <nn>E for petabyte and exabyte allocations. 2009-11-04 21:51:35 +00:00
Richard Jones
3266e51054 fish: Allow <nn>T for terabyte allocations. 2009-11-04 18:03:58 +00:00
Richard Jones
5ce72e039c fish: New command 'sparse', like 'alloc' but to generate sparse files.
With sparse you can make sparse files, which is fun because you
can experiment with really large devices:

  ><fs> sparse /tmp/test.img 100G
  ><fs> run
  ><fs> sfdiskM /dev/vda ,
  ><fs> mkfs ext2 /dev/vda1    # very long pause here ...
  ><fs> mount /dev/vda1 /

To see the real (ie. allocated) size of the sparse file, use the du
command, eg:

  ><fs> !du -h /tmp/test.img
  1.6G -rw-rw-r-- 1 rjones rjones 100G 2009-11-04 17:40 /tmp/test.img
2009-11-04 17:42:03 +00:00
Richard Jones
fc2cce06ec daemon: Build daemon with AC_SYS_LARGEFILE. 2009-11-04 17:23:11 +00:00
Richard Jones
4f48803036 Debian: Use /bin/bash as the shell for regression test scripts.
/bin/sh on Debian is a minimal shell called 'dash' which doesn't
support some features we need such as the particular 'function'
syntax used by regressions/test-stringlist.sh, and therefore
this script was failing on Debian.

Change all of these scripts to use #!/bin/bash explicitly to avoid
these sorts of problems.
2009-11-04 16:32:50 +00:00
Richard Jones
df1af0bbe2 daemon: When running external commands, open stdin as /dev/null
Previously when we ran external commands from the daemon, stdin
(ie. fd 0) was closed.  This caused a problem when running the
external hexdump command which seems to break if stdin is closed.

This patch opens stdin on /dev/null.
2009-11-04 15:47:03 +00:00
Richard Jones
a3be3a3b87 Debian: Include ISOFS driver in the kernel. 2009-11-04 14:31:06 +00:00
Richard Jones
644fccb4ae Debian: Ignore Debian appliance root when looking for translatable files. 2009-11-04 14:30:41 +00:00
Richard Jones
3e4bd83ce0 debian: Ignore some generated debirf files. 2009-11-04 14:30:13 +00:00
Richard Jones
333e3da945 configure: Fix summary messages.
The following 3 summary messages in the configure output
always displayed "yes" even if they were not actually
enabled.

Haskell bindings .................... yes
virt-inspector ...................... yes
virt-* tools ........................ yes

Fixed by correcting the code that tests if the automake
conditional is set.
2009-11-04 12:42:18 +00:00
Jim Meyering
ef642eb4e3 hivex: fail upon integer overflow
* hivex/hivex.c (windows_utf16_to_utf8): Avoid overflow and a
potential infloop.
2009-11-04 11:36:59 +00:00
Richard Jones
f95c697a44 hivex: Check unchecked calloc (Jim Meyering). 2009-11-04 11:33:29 +00:00
Richard Jones
f8a0d66082 Update PO files. 2009-11-03 16:50:08 +00:00
Richard Jones
e2976edb67 Fix EXTRA_DIST line in fuse/Makefile.am. 2009-11-03 16:49:31 +00:00
Richard Jones
bca3931590 Add make.sh.in to EXTRA_DIST. 2009-11-03 16:49:13 +00:00
Richard Jones
aad55a71f6 Comment out code which provokes strange gcc optimization error. 2009-11-03 16:44:47 +00:00
Richard Jones
589ce7e1c8 Prepare for 1.0.77. 2009-11-03 16:31:37 +00:00
Richard Jones
429de22541 FUSE filesystem support.
This implements FUSE filesystem support so that any libguestfs-
accessible disk image can be mounted as a local filesystem.

Note: file writes (ie. write(2) system call) is not yet implemented.

The API needs more test coverage, particularly lesser-used system
calls.

The big unresolved issue is UID/GID mapping between guest filesystem
IDs and the host.  It's not easy to automate this because you need
extra details about the guest itself in order to get to its
UID->username map (eg. /etc/passwd from the guest).
2009-11-03 15:57:26 +00:00
Richard Jones
08c9bf5e22 Allow callers to disable the recovery process. 2009-11-03 15:31:20 +00:00
Richard Jones
90cf7fc904 New API call: pread
guestfs_pread lets you do partial file reads from arbitrary
places within a file.  It works like the pread(2) system call.
2009-11-02 17:48:39 +00:00
Richard Jones
55a7427b76 New API calls: lstatlist, lxattrlist, readlinklist.
These three functions are very specifically designed for FUSE
support, so we can list directories efficiently.  Instead of
making lots of lstat, lgetxattr and readlink calls, we can make just
three calls per directory to grab all the attributes (which we
then cache briefly).
2009-11-02 17:48:35 +00:00
Richard Jones
2eb19f5261 New API calls: truncate, truncate_size, mkdir_mode, utimens, lchown.
truncate, truncate_size: Used to truncate files to a particular
size, or to zero bytes.

mkdir_mode: Like mkdir but allows you to also specify the
initial permissions for the new directory.

utimens: Set timestamp on a file with nanosecond accuracy.

lchown: Corresponding to lchown(2) syscall (we already have chown).

The implementation is complicated by the fact that we had to
add an Int64 parameter type to the generator.
2009-11-02 16:37:51 +00:00
Richard Jones
00425c073e examples/to-xml.c: Don't depend on Gnulib function.
Since this program is just an example, it shouldn't require
the Gnulib c-ctype functions.
2009-11-02 16:37:51 +00:00
Richard Jones
ff704b2291 appliance: Don't rebuild the appliance every time configure runs.
config.status touches make.sh each time it runs, even if the
resulting script would not change.  This causes the appliance
to get rebuilt much more frequently than is necessary.

There's no way to stop configure running, but we can move the
config.status command into a Makefile rule to stop this
undesirable behaviour.
2009-11-02 16:36:37 +00:00
Richard Jones
7ab898c286 guestfish: Fix a third indentation problem. 2009-11-02 16:15:36 +00:00
Richard Jones
dd56b3c4c3 guestfish: Another indentation fix. 2009-11-02 16:06:46 +00:00
Richard Jones
4293b71a90 guestfish: Fix printing of buffers in structs.
Somehow an 'indent' string crept in there, so it was printing:

  <char><indent><char><indent><char>...

instead of:

  <char><char><char>...
2009-11-02 16:02:06 +00:00
Richard Jones
752aec78b0 Fix rstructs_used handling in guestfish generated code.
rstructs_used wasn't correctly generating code for guestfish
because guestfish doesn't make all functions visible.  Since the
calculation of rstructs_used was over all functions (including
ones not available in guestfish) it could have generated
unnecessary functions.

In fact this error didn't affect us before - but I discovered
it when I added some extra struct-returning functions (future
commit).
2009-11-02 16:02:06 +00:00
Richard Jones
32ab3c1838 daemon: Don't warn on -Wunsafe-loop-optimizations.
Ignore -Wunsafe-loop-optimizations, same as in the top level
configure file.
2009-11-02 15:50:22 +00:00
Richard Jones
6600c275b2 Add hivex* documentation to website. 2009-10-29 20:35:59 +00:00
Richard Jones
2ec5ff5d34 Add HTML documentation to website. 2009-10-29 20:33:27 +00:00
Richard Jones
bb67f62e3c Prepare for 1.0.76. 2009-10-29 20:19:52 +00:00
Richard Jones
43a8e107ce Fix misspelling in previous commit. 2009-10-29 18:46:46 +00:00
Richard Jones
d707ecc55a RHEL 5: Also add le{16,64}toh functions 2009-10-29 18:36:12 +00:00
Richard Jones
a4e27cdf4d RHEL 5: Detect endianness functions and supply them. 2009-10-29 17:54:48 +00:00
Richard Jones
e02f42cb1d Add virt-win-reg to toplevel Makefile.am, fix POTFILES.in 2009-10-29 16:54:18 +00:00
Richard Jones
130d7bc3a2 Prepare for version 1.0.75. 2009-10-29 16:44:09 +00:00
Richard Jones
792c528300 Support for Windows Registry.
In hivex/:  This mini-library allows us to extract Windows
Registry binary files ("hives").

There are also two tools: hivexml converts a hive to a
self-describing XML format.  hivexget can be used to extract
single subkeys from a hive.

New tool: virt-win-reg.  This is a wrapper around the library
functionality allowing you to pull out data from the registries
of Windows guests.
2009-10-29 15:58:23 +00:00
Richard Jones
d609130cb6 New API: vfs_type - get the Linux VFS driver for a mounted device. 2009-10-26 15:52:40 +00:00
Richard Jones
aa7ca27e4b Modify Sys::Guestfs::Lib::resolve_windows_path to use case_sensitive_path. 2009-10-26 15:09:20 +00:00
Richard Jones
ec02f0da15 guestfish: Add win: prefix to use Windows paths.
Add a win: prefix for path arguments in guestfish:

><fs> file win:c:\windows\system32\config\system.log
MS Windows registry file, NT/2000 or above
2009-10-26 15:09:20 +00:00
Richard Jones
74bde73d5c daemon: Change chdir to use openat/fdopendir.
Uses Gnulib implementation of openat which should be portable.
2009-10-26 15:09:06 +00:00
Richard Jones
9add3c10a3 New API: case-sensitive-path to return case sensitive path on NTFS 3g fs
This function handles an annoyance/peculiarity of the Linux
NTFS 3g driver, which is that it exports NTFS filesystems with
names case sensitive, even though under Windows they would be
case insensitive.

This causes problems because the location of (eg.) c:\windows
might appear as /windows or /WINDOWS (etc) depending on the
inconsequential details of how it was originally created.

Example of this problem on a real Windows guest:

  ><fs> file /windows/system32/config/system.log
  libguestfs: error: file: access: /windows/system32/config/system.log: No such file or directory
  ><fs> case-sensitive-path /windows/system32/config/system.log
  /WINDOWS/system32/config/system.LOG
  ><fs> file /WINDOWS/system32/config/system.LOG
  MS Windows registry file, NT/2000 or above
2009-10-26 13:05:07 +00:00
Richard Jones
a421719267 inspector: Remove inaccurate paragraph from documentation. 2009-10-26 09:31:10 +00:00
Richard Jones
a3dfe9398c Include HFS (Mac OS X) driver. 2009-10-25 21:43:37 +00:00
Richard Jones
805cb234f3 Set LC_ALL=C before running qemu. 2009-10-21 16:34:09 +01:00
Matthew Booth
300461966b init: Check that start_udev succeeded
If start_udev fails for any reason, notice and fall through to manual /dev
creation.

Patch from Charles Duffy <charles@dyfis.net>
2009-10-21 10:16:50 +01:00
Richard Jones
c925dce4e7 Version 1.0.74. 2009-10-20 15:37:40 +01:00
Richard Jones
de64183f3d Tab to space fixes, now passes 'make syntax-check' 2009-10-20 15:03:16 +01:00
Richard Jones
cefc644d58 guestfs_find: Fix memory leak of sysrootdir. 2009-10-20 10:31:55 +01:00
Richard Jones
ea12489788 virt-ls: Modify to use find0 instead of find.
find0 is more scalable than find.  virt-ls will no longer
crash if asked to recursively list / on a Linux guest.
2009-10-20 10:31:54 +01:00
Richard Jones
42c89f2e6b New API: find0 (unlimited version of find)
This adds a new API call guestfs_find0, which is like guestfs_find
but mainly doesn't suffer from the protocol limit of the earlier
command.  The earlier command is not deprecated because it is
still very useful.

guestfs_find0 uses a FileOut parameter and writes the results to
an external file.  The filenames in the output are separated by
ASCII NUL characters (so a bit like "find -print0").

There is also the addition of a regression test for this command.
2009-10-20 10:31:54 +01:00
Richard Jones
55f5dc6f11 guestfs_find: Document protocol limits for this API call.
guestfs_find has to send the complete list of files in a single
protocol message (hence, limited to 2-4 MB).  Unfortunately on
a typical Linux guest, guestfs_find ("/") will exceed this limit
resulting in an error.

Therefore we should add an unlimited version of this call in a
future commit.  This commit just documents the current limit.
2009-10-20 10:31:54 +01:00
Richard Jones
4dd6b77ff7 New tool: virt-ls
This tool makes available the functionality of "ls", "ll", and "find"
in a slightly simpler to use form.

Examples:

  virt-ls -l myguest /tmp
2009-10-20 10:31:54 +01:00
Richard Jones
984a35cfc0 New tool: virt-tar
This adds a new tool call virt-tar which is a general purpose
archive and uploading tool.  It doesn't add any functionality
which wasn't previously possible using guestfish, but makes it
simpler to access for some users.

Examples:

 virt-tar -zx myguest /home home.tar.gz
 virt-tar -zu myguest uploadstuff.tar.gz /tmp
2009-10-20 10:31:44 +01:00
Richard Jones
5c4bf92bc2 tools: Make warnings about running on live guests more prominent.
Add prominent warnings to the man pages about how it is dangerous
to run these tools against live guests.
2009-10-19 10:45:44 +01:00
Richard Jones
945b6e0a08 Move virt tools (virt-cat, virt-edit etc) into tools/ subdirectory.
This moves the tool programs into a single directory:
  cat/* -> tools/virt-cat
  df/* -> tools/virt-df
  edit/* -> tools/virt-edit
  rescue/* -> tools/virt-rescue

This in itself simplifies the build process because we only need
one Makefile and one copy of 'run-locally'.

'run-*-locally' has become just 'run-locally' and takes an extra
parameter which is the name of the tool, eg:
  run-locally cat [virt-cat params...]

virt-inspector stays in its own directory, because this contains
more than just a single Perl script.
2009-10-19 10:18:46 +01:00
Richard Jones
854f8e0d56 Comment: Describe the build order requirements for toplevel directories. 2009-10-19 09:10:15 +01:00
Richard Jones
29148ac40f Prepare for 1.0.73. 2009-10-14 11:24:52 +01:00
Richard Jones
f57f338c3b Add some missing EXTRA_DIST files. 2009-10-14 11:24:33 +01:00
Richard Jones
d37f697953 inspector: Generate language bindings for OCaml.
This commit adds a generic mechanism for deriving language bindings
for virt-inspector, and implements one concrete binding, for OCaml.

The bindings are generated from the RELAX NG schema (virt-inspector.rng)
which is supposed to be a correct and always up to date description
of the XML that the virt-inspector program can generate.

From the RNG we generate a set of types to describe the output of
virt-inspector for the language, plus an XML parser, plus some
glue code to actually run an external instance of virt-inspector
and parse the resulting XML.

At runtime, an external 'virt-inspector --xml <name>' command runs
and the XML is parsed into language-specific structures.

This has been tested on the four example files (inspector/example?.xml)

The only particular difficulty about the OCaml binding is the use of
Obj.magic, which is naughty but works because of the isomorphism
between the representation of tuples and records in OCaml.  This
seems to cause no problems in my test program.  Apart from this, the
OCaml binding is straightforward and could be adapted easily for any
other languages that want type-safe virt-inspector bindings.

It's important to keep virt-inspector.rng up to date with changes
to virt-inspector's XML output format.
2009-10-13 17:53:20 +01:00
Jim Meyering
c6b8db6493 build: avoid parallel ocaml/... build failure
A parallel build could fail due to the use in ocaml/examples
of ocaml/guestfs.cmi before it was built.
* Makefile.am (SUBDIRS): Add both ocaml and ocaml/examples,
to ensure they're built in this order, and not in parallel.
* ocaml/Makefile.am (SUBDIRS): Don't define.
2009-10-05 14:16:46 +02:00
Piotr Drąg
65d61d4244 Updated Polish translation 2009-10-05 12:20:53 +01:00
Richard Jones
9f206cc4a6 inspector: Fix inspector/Makefile.am
Accidentally pushed the older version of the patch in
commit 9d25e82491.

This includes Jim Meyering's suggested changes from
https://www.redhat.com/archives/libguestfs/2009-October/msg00017.html
2009-10-02 15:50:43 +01:00
Jim Meyering
dde81c0c0e build: fix compile error
Link demo scripts with just-build library, not the installed one.
* ocaml/examples/Makefile.am (OCAMLFINDFLAGS): New variable.
(lvs, viewer): Use it.
This fix is based on a suggestion from Rich Jones.
This addresses RHBZ#526917.
2009-10-02 16:15:12 +02:00
Richard Jones
9d25e82491 inspector: Add tests for RELAX NG schema. 2009-10-02 15:00:27 +02:00
Richard Jones
ee21bc1f80 inspector: Add RELAX NG schema for virt-inspector --xml output. 2009-10-02 15:00:27 +02:00
Richard Jones
3c58ea10c7 configure: Update comment about viewer.ml. 2009-10-02 09:51:31 +01:00
Richard Jones
bf6ea12557 inspector: Canonicalize device names (fix RHBZ#526717).
Make filesystem device names canonical, so they are /dev/sd*
instead of /dev/vd*.
2009-10-01 17:06:46 +01:00
Richard Jones
5d01670e31 run-*-locally: The programs are now virt-[tool], not virt-[tool].pl
This fixes commit b488436cc5.
2009-10-01 15:22:12 +01:00
Richard Jones
5021b2efea inspector: Don't bomb if no kernels detected.
If $os->{kernels} wasn't defined, virt-inspector would exit with
an error, leaving partial XML output.

Change the code so it doesn't die in this case, instead just
leaves out the <kernels> section.
2009-10-01 15:20:14 +01:00
Richard Jones
d525103c86 OCaml viewer: Use ocamlduce to replace xpath code. 2009-09-30 16:14:35 +01:00
Richard Jones
d278ef8ad9 OCaml viewer: Handle exceptions properly. 2009-09-29 11:56:26 +01:00
Richard Jones
4c8bdd3424 OCaml example: graphical disk usage viewer.
This is an example of how to write an app which uses libguestfs
and libvirt, and has a responsive user interface (using threads).
It is a Gtk-based "graphical virt-df".

Read the top of the 'viewer.ml' file first for instructions on
how to compile.  This program is not compiled by default.
2009-09-29 11:05:26 +01:00
Richard Jones
f8a96c6596 virt-df: Add note about parsing CSV. 2009-09-24 11:22:37 +01:00
Jim Meyering
6a14f1c250 avoid use of all ctype macros
* cfg.mk (disable_temporarily): Don't disable sc_avoid_ctype_macros.
* fish/tilde.c: Remove unnecessary inclusion of ctype.h.
* bootstrap: Add gnulib's c-ctype module to the list.
* daemon/m4/gnulib-cache.m4: Likewise.
* daemon/ext2.c: Include "c-ctype.h", not <ctype.h>.
Use c_isspace, etc, rather than isspace.
* daemon/guestfsd.c: Likewise.
* daemon/lvm.c: Likewise.
* daemon/proto.c: Likewise.
* fish/fish.c: Likewise.
* fish/tilde.c: Likewise.
* src/generator.ml: Likewise.
* src/guestfs.c: Likewise.
* examples/to-xml.c: Likewise.
* examples/Makefile.am (to_xml_CPPFLAGS): Add -I$(top_srcdir)/gnulib/lib
so inclusion of "c-ctype.h" works.
(to_xml_CPPFLAGS): Rename from to_xml_CFLAGS.
2009-09-24 11:00:44 +02:00
Jim Meyering
0ca36888c6 maint: prune dead wood from list of skipped syntax-check rules
* cfg.mk (local-checks-to-skip): Remove now-passing and
no-longer-relevant rule names.
2009-09-24 11:00:44 +02:00
Jim Meyering
dc0c80b388 maint: use spaces, not TABs for indentation
"make syntax-check" was failing.  This fixes it.
* HACKING: Indent with spaces, not TABs.
* configure.ac: Likewise.
* rescue/virt-rescue: Likewise.
* src/generator.ml: Likewise.
2009-09-24 10:59:53 +02:00
Richard Jones
275b0db961 Prepare for 1.0.72.
Also update PO files.
2009-09-23 14:24:04 +01:00
Richard Jones
4bd623f6a2 More HTMLFILES. 2009-09-23 14:24:04 +01:00
Richard Jones
406d4aea4d Include virt tools in EXTRA_DIST.
Partially revert b488436cc5.
It turns out that automake doesn't automatically place bin_SCRIPTS
in EXTRA_DIST.
2009-09-23 14:03:05 +01:00
Richard Jones
b488436cc5 Rename virt-[tool].pl as virt-[tool] 2009-09-23 12:37:26 +01:00
Richard Jones
75b6338da3 Check return value from readlink. 2009-09-23 12:09:26 +01:00
Richard Jones
9adddc19e4 Create manpage atomically.
Don't fail with a partial file if disk full, etc.
2009-09-23 12:05:55 +01:00
Richard Jones
154370c0e8 Replace @...@ with $(...) in these common Makefile.am files. 2009-09-23 12:04:25 +01:00
Richard Jones
82918538ab guestfish: Update 'SEE ALSO' section of the manpage. 2009-09-23 11:50:49 +01:00
Richard Jones
7801621dc9 New tool: virt-edit
Edit any file in a guest.  This was possibly previously
using guestfish, but having a separate command makes it
simpler.

The usage is simply:

  virt-edit mydomain /some/file

It runs $EDITOR or vi on the file, and if the user changes
it, uploads the result back to the VM.
2009-09-23 11:37:37 +01:00
Richard Jones
d15195bad9 virt-cat: Remove some unused Perl module includes. 2009-09-23 11:18:45 +01:00
Richard Jones
1b21ed4f5d Add 'virt-rescue' command.
This command runs a "rescue appliance" against a virtual machine
or disk image.  This is useful for making ad-hoc interactive
changes to virtual machines.

  $ virt-rescue --ro /dev/vg_trick/F11x64

  Welcome to virt-rescue, the libguestfs rescue shell.

  Note: The contents of / are the rescue appliance.
  You have to mount the guest's partitions under /sysroot
  before you will be able to examine them.

  bash: cannot set terminal process group (-1): Inappropriate ioctl for device
  bash: no job control in this shell
  ><rescue> mount /dev/vg_f11x64/lv_root /sysroot
  EXT4-fs (dm-0): barriers enabled
  kjournald2 starting: pid 269, dev dm-0:8, commit interval 5 seconds
  EXT4-fs (dm-0): internal journal on dm-0:8
  EXT4-fs (dm-0): delayed allocation enabled
  EXT4-fs: file extents enabled
  EXT4-fs: mballoc enabled
  EXT4-fs (dm-0): mounted filesystem with ordered data mode
  ><rescue> ls /sysroot/
  bin   dev  home  lib64       media  opt   root  selinux  sys  usr
  boot  etc  lib   lost+found  mnt    proc  sbin  srv      tmp  var
  ><rescue> exit
2009-09-23 11:18:45 +01:00
Richard Jones
3bc5555135 Add direct appliance mode flag and implementation.
When the g->direct flag is set, the appliance stdin/stdout
are not connected to the library.  Instead they inherit the
stdin/stdout of the caller.

This is used to implement virt-rescue.
2009-09-23 11:18:45 +01:00
Richard Jones
d186e9d3d3 Tidy up appliance rescue code.
The appliance shouldn't run the daemon after we leave the
rescue shell.  It should just exit instead.
2009-09-23 11:18:45 +01:00
Richard Jones
0d9325bd10 Rejig configure.ac tests for qemu vmchannel support.
vmchannel is no longer required, so we shouldn't test for it.
However we should test instead for user mode networking support.

Also fix up the documentation / error messages.

Always test for vmchannel and user mode networking support in
qemu.  This gives us more troubleshooting information if people
report bugs.
2009-09-23 11:18:41 +01:00
Richard Jones
b9da0fe3f7 Prepare for 1.0.71.
Update version number and update PO files.

Put latest version and release date on the website front page.
2009-09-22 14:51:14 +01:00
Richard Jones
1e9e6e50bd Change handling of spaces on Linux kernel command line. 2009-09-22 11:03:22 +01:00
Richard Jones
419cf4bb01 Update documentation of qemu / vmchannel. 2009-09-22 11:03:22 +01:00
Richard Jones
ae2e569489 Implement "null vmchannel" - no vmchannel needed!
This commit removes the requirement for vmchannel, although retaining
support for it.

In this configuration, known as "null vmchannel", the library
listens on a random loopback port.  It passes the number of this
port to the appliance (guestfs_vmchannel=tcp:10.0.2.2:12345), and
the daemon then connects back.  The library, instead of connecting,
listens and accepts the connection during guestfs_launch.

QEMU SLIRP (user mode networking) is still required to make this
work: SLIRP forwards the TCP connection transparently (instead of
explicitly as with guestfwd) to 127.0.0.1:<port>

There is a window in which any other local process on the machine
could see the port number in the qemu command line and try to
connect to it.  This would be a devastating security hole, because
any local process could pretend to be the daemon and feed back
malicious replies to our remote procedure calls.  To prevent this,
we check the UID of the other side of the TCP connection.  If
the UID is different from the library's EUID, then we reject the
connection.  To do this we have to parse /proc/net/tcp.  (On Solaris
we could use getsockopt (SO_PEERCRED), but this doesn't work on
Linux TCP sockets).

Other vmchannel(s) are still supported.  This is important, because
we can't in general be sure the qemu will always support SLIRP.
In particular, in recent versions of qemu it is possible to compile
out SLIRP.
2009-09-22 11:03:16 +01:00
Richard Jones
dcb5aa0183 Gnulib: Add arpa-inet and netinet-in modules. 2009-09-22 10:55:03 +01:00
Richard Jones
8b217a87bf Flexible guestfs_vmchannel parameter for future appliances.
This reimplements parts of commit da0a4f8d1f
in a different, but compatible way.

We pass guestfs_vmchannel=tcp:<ip>:<port> on the command line.  This
is intended to be used as follows (now and in future versions):

  tcp:10.0.2.4:6666    for guestfwd vmchannel
  tcp:10.0.2.2:<port>  for future "no vmchannel" implementation
  /dev/vcon4           for future virtio-console vmchannel*

It also accepts the old-style guestfs=10.0.2.4:6666 parameter which
is sent by older libraries, and turns this transparently into the
correct format above.

If no guestfs_vmchannel is passed, then this defaults to the guestfwd
vmchannel which older libraries would expect.

* Maybe this last one should be dev:/dev/vcon4 or file:/dev/vcon4, but
we don't need to decide that now.
2009-09-22 10:26:58 +01:00
Richard Jones
8b91ee5e2d Rearrange and tidy up code in guestfsd.c
This just tidies up the main() function in the daemon.  There is
no longer a huge fixed-sized buffer used for the kernel command
line.  Variables are moved closer to where they are used.  Some
local variables turned out to be unused - these are removed.  Finally
the part that reads the kernel command line is moved into a separate
function.

There is only minimal functional change here (it now prints out
the kernel command line).

Literal '4' replaced with 'sizeof' expression, at Jim Meyering's
suggestion during patch review.
2009-09-22 10:00:49 +01:00
Richard Jones
0740d45d28 Make GUESTFWD_PORT into a string. 2009-09-21 12:11:51 +01:00
Richard Jones
a1c8c3e1be Remove unnecessary extra space from qemu command line. 2009-09-21 12:11:01 +01:00
Richard Jones
8869adf1e8 Remove guestfs_wait_ready (turn it into a no-op).
This commit changes guestfs_launch so that it both launches
the appliance and waits until it is ready (ie. the daemon communicates
back to us).

Since we removed the pretence that we could implement a low-level
asynchronous API, the need to call launch() followed by wait_ready()
has looked a bit silly.

Now guestfs_wait_ready() is basically a no-op.  It is left in the
API for backwards compatibility.  Any calls to guestfs_wait_ready()
can be removed from client code.
2009-09-21 12:01:51 +01:00
Richard Jones
62b3228725 Combine temporary buffers.
buf[], append[] and memsize_str[] were all temporary buffers
used in non-overlapping code.

Combine them to use a single buffer (buf[]).
2009-09-21 12:01:51 +01:00
Richard Jones
8d8b3fafa3 Rearrange qemu command line order (no functional change). 2009-09-21 11:07:47 +01:00
Richard Jones
27374fa479 Enable new-style -chardev ... guestfwd command line.
Newer versions of qemu have changed the command line format
(again).  '-net channel' is now deprecated.  Instead we use:

    -chardev socket,id=guestfsvmc,path=/path/to/sock,server,nowait
    -net user,vlan=0,net=10.0.2.0/8,guestfwd=tcp:10.0.2.4:6666-chardev:guestfsvmc
    -net nic,model=ne2k_pci,vlan=0

The old style format is still used if the new style is not
detected at runtime.
2009-09-18 14:06:07 +01:00
Richard Jones
d5fad33b4e Fix code which looked for leaked FDs between each command.
This code was not checking the return value from system()
so it failed if uncommented.  Add ignore_value() around the
call to system.  However, leave the code still disabled.
2009-09-17 16:58:09 +01:00
Richard Jones
da0a4f8d1f Remove explicit guestfs=10.0.2.4:6666 kernel command line parameter.
Since we control the appliance tightly, we can just specify
that it will always use a particular host and port, and we
don't need to pass it on the command line each time.

Also the VMCHANNEL_* constants are only relevant to the
particular guestfwd vmchannel implementation, so we rename
them as GUESTFWD_*.
2009-09-17 16:05:39 +01:00
Richard Jones
abac360f32 Daemon: fix handling of errors from xread and xwrite.
If xread or xwrite returns -1, that indicates an error and we
should exit.  Note that xread/xwrite has already printed the
error message.
2009-09-17 16:05:39 +01:00
Richard Jones
bb02f0fbe8 Fix verbose packet dumping functions.
Add the configure parameter --enable-packet-dump so that this
code can be enabled without editing the source.

This code is normally commented out, because it is too verbose
unless you happen to be debugging the underlying protocol.  Because
it is normally commented out, I found it had bit-rotted slightly.
This commit also fixes the obvious problems.
2009-09-17 16:01:52 +01:00
Richard Jones
5ccae24e06 'len' should be an unsigned 32 bit int.
This only happened to work by accident before because 'unsigned len'
happens to be 32 bit on all platforms we support.
2009-09-17 15:31:22 +01:00
Richard Jones
6c8a69c602 Disable -Wunsafe-loop-optimizations
This warning indicates that GCC could not do a particular sort
of loop optimization.  It pops up randomly in certain forms of
looping code, and seems safe to ignore.
2009-09-17 15:31:22 +01:00
Richard Jones
b25ebed9e6 Update PO files (no functional change). 2009-09-15 17:13:24 +01:00
1164 changed files with 496055 additions and 25427 deletions

582
.gitignore vendored
View File

@@ -1,198 +1,420 @@
*~
*.a
ABOUT-NLS
aclocal.m4
appliance/debian/debirf.conf
appliance/initramfs.*.img
appliance/initramfs.*.supermin.hostfiles
appliance/kmod.whitelist
appliance/libguestfs-supermin-helper
appliance/make.sh
appliance/packagelist
appliance/stamp-debirf-modules
appliance/supermin.incfiles
appliance/supermin-make.sh
appliance/supermin-split.sh
appliance/update.sh
appliance/vmlinuz.*
autom4te.cache
*.bak
bindtests.tmp
capitests/test-command
capitests/test*.img
capitests/tests
capitests/tests.c
capitests/test*.tmp
cat/virt-cat.1
ChangeLog
*.class
*.cma
*.cmi
*.cmo
*.cmx
*.cmxa
compile
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
daemon/actions.h
daemon/guestfsd
daemon/install-sh
daemon/missing
daemon/names.c
daemon/stubs.c
depcomp
.deps
df/virt-df.1
emptydisk
examples/hello
examples/to-xml
fish/cmds.c
fish/completion.c
fish/guestfish
fish/rc_protocol.c
fish/rc_protocol.h
guestfish.1
guestfish-actions.pod
guestfs.3
guestfs-actions.pod
guestfs-structs.pod
haskell/Bindtests
haskell/Bindtests.hs
haskell/Guestfs005Load
haskell/Guestfs010Launch
haskell/Guestfs050LVCreate
haskell/Guestfs.hs
*.diff
*.eml
*.hi
html/guestfish.1.html
html/guestfs.3.html
html/recipes.html
html/virt-cat.1.html
html/virt-df.1.html
html/virt-inspector.1.html
images/100kallnewlines
images/100kallspaces
images/100kallzeroes
images/100krandom
images/10klines
images/initrd
images/initrd-x86_64.img
images/initrd-x86_64.img.gz
images/test.iso
images/test-grep.txt.gz
initramfs
initramfs.timestamp
inspector/virt-inspector.1
install-sh
*.jar
java/api
java/Bindtests.java
java/com/redhat/et/libguestfs/Dirent.java
java/com_redhat_et_libguestfs_GuestFS.c
java/com_redhat_et_libguestfs_GuestFS.h
java/com/redhat/et/libguestfs/GuestFS.java
java/com/redhat/et/libguestfs/INotifyEvent.java
java/com/redhat/et/libguestfs/IntBool.java
java/com/redhat/et/libguestfs/LV.java
java/com/redhat/et/libguestfs/PV.java
java/com/redhat/et/libguestfs/Stat.java
java/com/redhat/et/libguestfs/StatVFS.java
java/com/redhat/et/libguestfs/Version.java
java/com/redhat/et/libguestfs/VG.java
java/com/redhat/et/libguestfs/XAttr.java
java/doc-stamp
*.la
libguestfs.pc
libguestfs.spec
libguestfs-*.tar.gz
.libs
libtool
*.lo
localconfigure
localrepo
ltmain.sh
m4/gnulib-cache.m4
m4/intmax.m4
m4/libtool.m4
m4/lt~obsolete.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
*.o
*.orig
*.patch
*.rej
*.swp
bindtests.tmp
cscope.out
.deps
.gdb_history
.libs
Makefile
Makefile.in
missing
*.o
ocaml/bindtests
ocaml/bindtests.ml
ocaml/dllmlguestfs.so
ocaml/examples/lvs
ocaml/guestfs_c_actions.c
ocaml/guestfs.ml
ocaml/guestfs.mli
ocaml/META
ocaml/t/guestfs_005_load
ocaml/t/guestfs_010_launch
ocaml/t/guestfs_050_lvcreate
ocaml/t/guestfs_060_readdir
perl/bindtests.pl
perl/blib
perl/Guestfs.bs
perl/Guestfs.c
perl/Guestfs.xs
perl/lib/Sys/Guestfs.pm
perl/Makefile-pl
perl/Makefile-pl.old
perl/Makefile.PL
perl/pm_to_blib
pod2htm?.tmp
po/*.gmo
po/Makevars.template
po/POTFILES
po/remove-potcdate.sed
po/stamp-it
po/stamp-po
po/LINGUAS
po/Makefile.in.in
po/Makevars
po/Rules-quot
po/boldquot.sed
po/en@boldquot.header
po/en@quot.header
po/insert-header.sin
po/quot.sed
po/remove-potcdate.sin
python/bindtests.py
python/guestfs.py
python/guestfs-py.c
python/guestfs.pyc
regressions/test1.img
ruby/bindtests.rb
ruby/ext/guestfs/extconf.h
ruby/ext/guestfs/_guestfs.c
ruby/ext/guestfs/_guestfs.so
ruby/ext/guestfs/mkmf.log
ruby/Rakefile
src/guestfs-actions.c
src/guestfs-actions.h
src/guestfs-bindtests.c
src/guestfs-internal-actions.h
src/guestfs_protocol.c
src/guestfs_protocol.h
src/guestfs_protocol.x
src/guestfs-structs.h
src/.libs/libguestfs.so
src/.pod2text.data
src/stamp-generator
stamp-h1
test-tool/libguestfs-test-tool.1
test-tool/libguestfs-test-tool
test-tool/libguestfs-test-tool-helper
/GNUmakefile
/maint.mk
/ABOUT-NLS
/aclocal.m4
/align/stamp-virt-alignment-scan.pod
/align/virt-alignment-scan
/align/virt-alignment-scan.1
/appliance/excludelist
/appliance/libguestfs-make-fixed-appliance
/appliance/libguestfs-make-fixed-appliance.1
/appliance/make.sh
/appliance/packagelist
/appliance/stamp-libguestfs-make-fixed-appliance.pod
/appliance/stamp-supermin
/appliance/supermin.d
/autom4te.cache
/build-aux
/cat/stamp-virt-*.pod
/cat/virt-cat
/cat/virt-cat.1
/cat/virt-filesystems
/cat/virt-filesystems.1
/cat/virt-ls
/cat/virt-ls.1
/ChangeLog
/compile
/config.guess
/config.h
/config.h.in
/config.log
/config.status
/config.sub
/configure
/csharp/Libguestfs.cs
/daemon/actions.h
/daemon/errnostring.c
/daemon/errnostring_gperf.c
/daemon/errnostring_gperf.gperf
/daemon/errnostring.h
/daemon/guestfsd
/daemon/guestfsd.exe
/daemon/guestfs_protocol.c
/daemon/guestfs_protocol.h
/daemon/install-sh
/daemon/missing
/daemon/names.c
/daemon/optgroups.c
/daemon/optgroups.h
/daemon/stubs.c
/depcomp
/df/stamp-virt-df.pod
/df/virt-df
/df/virt-df.1
/edit/stamp-virt-*.pod
/edit/virt-edit
/edit/virt-edit.1
/erlang/erl-guestfs
/erlang/erl-guestfs.c
/erlang/examples/guestfs-erlang.3
/erlang/examples/stamp-guestfs-erlang.pod
/erlang/guestfs.beam
/erlang/guestfs.erl
/examples/copy_over
/examples/create_disk
/examples/display_icon
/examples/guestfs-examples.3
/examples/guestfs-faq.1
/examples/guestfs-performance.1
/examples/guestfs-recipes.1
/examples/guestfs-testing.1
/examples/inspect_vm
/examples/mount_local
/examples/stamp-guestfs-examples.pod
/examples/stamp-guestfs-faq.pod
/examples/stamp-guestfs-performance.pod
/examples/stamp-guestfs-recipes.pod
/examples/stamp-guestfs-testing.pod
/examples/virt-dhcp-address
/fish/cmds.c
/fish/cmds_gperf.c
/fish/cmds_gperf.gperf
/fish/completion.c
/fish/event-names.c
/fish/fish-cmds.h
/fish/guestfish
/fish/guestfish.1
/fish/guestfish-actions.pod
/fish/guestfish-commands.pod
/fish/prepopts.c
/fish/prepopts.h
/fish/rc_protocol.c
/fish/rc_protocol.h
/fish/stamp-guestfish.pod
/fish/stamp-virt-copy-in.pod
/fish/stamp-virt-copy-out.pod
/fish/stamp-virt-tar-in.pod
/fish/stamp-virt-tar-out.pod
/fish/virt-copy-in.1
/fish/virt-copy-out.1
/fish/virt-tar-in.1
/fish/virt-tar-out.1
/format/stamp-virt-format.pod
/format/virt-format
/format/virt-format.1
/fuse/guestmount
/fuse/guestmount.1
/fuse/stamp-guestmount.pod
/generator/.depend
/generator/files-generated.txt
/generator/generator
/generator/.pod2text.data*
/generator/stamp-generator
/.gitattributes
/.git-module-status
/gnulib
.git-module-status
/GNUmakefile
/gobject/bindtests.js
/gobject/Guestfs-1.0.gir
/gobject/Guestfs-1.0.typelib
/gobject/guestfs-gobject*.c
/gobject/guestfs-gobject*.h
/.guestfs-*
/guestfs.*
/guestfsd-in-wine.log
/haskell/Bindtests
/haskell/Bindtests.hs
/haskell/Guestfs005Load
/haskell/Guestfs010Basic
/haskell/Guestfs.hs
/html/guestfish.1.html
/html/guestfs.3.html
/html/guestfs-erlang.3.html
/html/guestfs-examples.3.html
/html/guestfs-faq.1.html
/html/guestfs-java.3.html
/html/guestfs-ocaml.3.html
/html/guestfs-performance.1.html
/html/guestfs-perl.3.html
/html/guestfs-python.3.html
/html/guestfs-recipes.1.html
/html/guestfs-ruby.3.html
/html/guestfs-testing.1.html
/html/guestmount.1.html
/html/libguestfs-make-fixed-appliance.1.html
/html/libguestfs-test-tool.1.html
/html/virt-alignment-scan.1.html
/html/virt-cat.1.html
/html/virt-copy-in.1.html
/html/virt-copy-out.1.html
/html/virt-df.1.html
/html/virt-edit.1.html
/html/virt-filesystems.1.html
/html/virt-format.1.html
/html/virt-inspector.1.html
/html/virt-list-filesystems.1.html
/html/virt-list-partitions.1.html
/html/virt-ls.1.html
/html/virt-make-fs.1.html
/html/virt-rescue.1.html
/html/virt-resize.1.html
/html/virt-sparsify.1.html
/html/virt-sysprep.1.html
/html/virt-tar.1.html
/html/virt-tar-in.1.html
/html/virt-tar-out.1.html
/html/virt-win-reg.1.html
/inspector/stamp-virt-inspector.pod
/inspector/virt-inspector
/inspector/virt-inspector.1
/install-sh
/java/api
/java/Bindtests.java
/java/com_redhat_et_libguestfs_GuestFS.c
/java/com_redhat_et_libguestfs_GuestFS.h
/java/com/redhat/et/libguestfs/GuestFS.java
/java/doc-stamp
/java/examples/guestfs-java.3
/java/examples/stamp-guestfs-java.pod
/libguestfs.spec
/libguestfs-*.tar.gz
/libtool
/local*
/ltmain.sh
/m4/ChangeLog
/m4/gnulib-cache.m4
/m4/intmax.m4
/m4/libtool.m4
/m4/lt~obsolete.m4
/m4/ltoptions.m4
/m4/ltsugar.m4
/m4/ltversion.m4
/maint.mk
/missing
/ocaml/bindtests.bc
/ocaml/bindtests.opt
/ocaml/bindtests.ml
/ocaml/.depend
/ocaml/dllmlguestfs.so
/ocaml/examples/create_disk
/ocaml/examples/guestfs-ocaml.3
/ocaml/examples/inspect_vm
/ocaml/examples/stamp-guestfs-ocaml.pod
/ocaml/guestfs_c_actions.c
/ocaml/guestfs_inspector.ml
/ocaml/guestfs_inspector.mli
/ocaml/guestfs.ml
/ocaml/guestfs.mli
/ocamlinit-stamp
/ocaml/META
/ocaml/t/guestfs_005_load.bc
/ocaml/t/guestfs_005_load.opt
/ocaml/t/guestfs_010_basic.bc
/ocaml/t/guestfs_010_basic.opt
/ocaml/t/guestfs_070_threads.bc
/ocaml/t/guestfs_070_threads.opt
/ocaml/t/guestfs_080_optargs.bc
/ocaml/t/guestfs_080_optargs.opt
/ocaml/t/guestfs_400_events.bc
/ocaml/t/guestfs_400_events.opt
/ocaml/t/guestfs_400_progress.bc
/ocaml/t/guestfs_400_progress.opt
/ocaml/t/guestfs_500_parallel_mount_local.bc
/ocaml/t/guestfs_500_parallel_mount_local.opt
/perl/bindtests.pl
/perl/blib
/perl/examples/guestfs-perl.3
/perl/examples/stamp-guestfs-perl.pod
/perl/Guestfs.bs
/perl/Guestfs.c
/perl/Guestfs.xs
/perl/lib/Sys/Guestfs.pm
/perl/Makefile-pl
/perl/Makefile.PL
/perl/Makefile-pl.old
/perl/MYMETA.json
/perl/MYMETA.yml
/perl/pm_to_blib
/php/extension/acinclude.m4
/php/extension/aclocal.m4
/php/extension/autom4te.cache
/php/extension/build/
/php/extension/config.guess
/php/extension/config.h
/php/extension/config.h.in
/php/extension/config.log
/php/extension/config.nice
/php/extension/config.status
/php/extension/config.sub
/php/extension/configure
/php/extension/configure.in
/php/extension/guestfs_php.c
/php/extension/guestfs_php_*.diff
/php/extension/guestfs_php_*.exp
/php/extension/guestfs_php_*.log
/php/extension/guestfs_php_*.out
/php/extension/guestfs_php_*.php
/php/extension/guestfs_php_*.sh
/php/extension/install-sh
/php/extension/libtool
/php/extension/ltmain.sh
/php/extension/Makefile.fragments
/php/extension/Makefile.global
/php/extension/Makefile.objects
/php/extension/mkinstalldirs
/php/extension/missing
/php/extension/modules/
/php/extension/php_guestfs_php.h
/php/extension/run-tests.php
/php/extension/tmp-php.ini
/po-docs/*/*.1
/po-docs/*/*.3
/po-docs/*/*.pl
/po-docs/po4a.conf
/po-docs/*/*.pod
/po-docs/*/stamp-update-po
/podwrapper.sh
/po/*.gmo
/python/bindtests.py
/python/examples/guestfs-python.3
/python/examples/stamp-guestfs-python.pod
/python/guestfs.py
/python/guestfs-py.c
/python/guestfs.pyc
/python/guestfs.pyo
/python/__pycache__
/rescue/stamp-virt-rescue.pod
/rescue/virt-rescue
/rescue/virt-rescue.1
/resize/.depend
/resize/resize_gettext.ml
/resize/stamp-virt-resize.pod
/resize/utils_tests
/resize/virt-resize
/resize/virt-resize.1
/ruby/bindtests.rb
/ruby/doc/site/api
/ruby/examples/guestfs-ruby.3
/ruby/examples/stamp-guestfs-ruby.pod
/ruby/ext/guestfs/extconf.h
/ruby/ext/guestfs/_guestfs.bundle
/ruby/ext/guestfs/_guestfs.c
/ruby/ext/guestfs/_guestfs.so
/ruby/ext/guestfs/mkmf.log
/ruby/Rakefile
/run
/sparsify/.depend
/sparsify/sparsify_gettext.ml
/sparsify/stamp-virt-sparsify.pod
/sparsify/virt-sparsify
/sparsify/virt-sparsify.1
/src/actions.c
/src/bindtests.c
/src/errnostring.c
/src/errnostring_gperf.c
/src/errnostring_gperf.gperf
/src/errnostring.h
/src/guestfs.3
/src/guestfs-actions.pod
/src/guestfs-availability.pod
/src/guestfs.h
/src/guestfs-internal-actions.h
/src/guestfs_protocol.c
/src/guestfs_protocol.h
/src/guestfs_protocol.x
/src/guestfs-structs.pod
/src/libguestfs.pc
/src/libguestfs.syms
/src/.libs/libguestfs.so
/src/stamp-guestfs.pod
/stamp-h1
/sysprep/.depend
/sysprep/stamp-script1.sh
/sysprep/stamp-script2.sh
/sysprep/stamp-virt-sysprep.pod
/sysprep/sysprep-extra-options.pod
/sysprep/sysprep_gettext.ml
/sysprep/sysprep-operations.pod
/sysprep/virt-sysprep
/sysprep/virt-sysprep.1
/test1.img
/test2.img
/test.err
/test.out
/tests/c-api/test-add-drive-opts
/tests/c-api/test-add-libvirt-dom
/tests/c-api/test-command
/tests/c-api/test-config
/tests/c-api/test-create-handle
/tests/c-api/test-debug-to-file
/tests/c-api/test*.img
/tests/c-api/test-just-header
/tests/c-api/test-just-header-cxx
/tests/c-api/test-last-errno
/tests/c-api/test.log
/tests/c-api/test-private-data
/tests/c-api/tests
/tests/c-api/tests.c
/tests/c-api/test*.tmp
/tests/c-api/test-user-cancel
/tests/charsets/test-charset-fidelity
/tests/data/100kallnewlines
/tests/data/100kallspaces
/tests/data/100kallzeroes
/tests/data/100krandom
/tests/data/10klines
/tests/data/abssymlink
/tests/data/hello.b64
/tests/data/initrd
/tests/data/initrd-x86_64.img
/tests/data/initrd-x86_64.img.gz
/tests/data/test-grep.txt.gz
/tests/data/test.iso
/tests/extra/valgrind.log
/tests/guests/debian.img
/tests/guests/fedora.img
/tests/guests/fedora-md1.img
/tests/guests/fedora-md2.img
/tests/guests/guest-aux/fedora-name.db
/tests/guests/guest-aux/fedora-packages.db
/tests/guests/stamp-fedora-md.img
/tests/guests/ubuntu.img
/tests/guests/windows.img
/tests/regressions/rhbz501893
/tests/regressions/rhbz790721
/test-tool/libguestfs-test-tool
/test-tool/libguestfs-test-tool.1
/test-tool/libguestfs-test-tool-helper
/test-tool/stamp-libguestfs-test-tool.pod
/tools/test.img
/tools/virt-*.1
/tools/virt-*.pl
/valgrind.log.*

Submodule .gnulib updated: eeee74f5ef...4fb7ea2012

9
.lvimrc Normal file
View File

@@ -0,0 +1,9 @@
" Custom libguestfs indentation configuration for vim
"
" This configuration file requires localrc.vim to be installed. You can obtain
" localrc.vim from http://www.vim.org/scripts/script.php?script_id=1408
set sw=2
set ts=2
set tw=80
set expandtab

13
.tx/config Normal file
View File

@@ -0,0 +1,13 @@
[main]
host = https://www.transifex.net
[libguestfs.libguestfspot]
file_filter = po/<lang>.po
source_file = po/libguestfs.pot
source_lang = en
[libguestfs.libguestfsdocspot]
file_filter = po-docs/<lang>.po
source_file = po-docs/libguestfs-docs.pot
source_lang = en

View File

@@ -1,5 +1,4 @@
^appliance/debian/modules/
^images/
^tests/data/
^COPYING(.LIB)?$
^\.gitmodules$
(^|\/)ChangeLog[^/]*$

1
.x-sc_avoid_ctype_macros Normal file
View File

@@ -0,0 +1 @@
^examples/to-xml\.c$

View File

@@ -0,0 +1,2 @@
^.*\.java$
^.*\.pl$

1
.x-sc_prohibit_strcmp Normal file
View File

@@ -0,0 +1 @@
^examples/to-xml\.c$

View File

@@ -0,0 +1 @@
^examples/to-xml\.c$

View File

@@ -1 +1,2 @@
images/bin-win64.exe
tests/data/bin-win64.exe
*.pod

28
AUTHORS Normal file
View File

@@ -0,0 +1,28 @@
Angus Salkeld <asalkeld@redhat.com>
Ani Peter <apeter@redhat.com>
Charles Duffy <cduffy@messageone.com>
Daniel Berrange <berrange@redhat.com>
Daniel Cabrera <logan@fedoraproject.org>
Douglas Schilling Landgraf <dougsland@redhat.com>
Erik Nolte <erik_nolte@acm.org>
Geert Warrink <geert.warrink@onsnet.nu>
Guido Günther <agx@sigxcpu.org>
Hilko Bengen <bengen@hilluzination.de>
Jaswinder Singh <jsingh@redhat.com>
Jim Meyering <jim@meyering.net>
Jiri Popelka <jpopelka@redhat.com>
Karel Klíč <kklic@redhat.com>
Marcin Gibula <m.gibula@e24cloud.com>
Matthew Booth <mbooth@redhat.com>
Maxim Koltsov <kolmax94@gmail.com>
Michael Scherer <misc@zarb.org>
Nikita A Menkovich <menkovich@gmail.com>
Nikos Skalkotos <skalkoto@gmail.com>
Piotr Drąg <piotrdrag@gmail.com>
Qin Guan <qguan@redhat.com>
Rajesh Ranjan <rranjan@redhat.com>
Richard W.M. Jones <rich@annexia.org>
Sandeep Shedmake <sshedmak@redhat.com>
Shankar Prasad <svenkate@redhat.com>
Thomas S Hatch <thatch45@gmail.com>
Wanlong Gao <gaowanlong@cn.fujitsu.com>

246
BUGS
View File

@@ -1,16 +1,244 @@
Please note: This file used to contain a list of bugs. Bugs in
libguestfs are now tracked in Red Hat's Bugzilla.
NOTE: This file is automatically generated from "update-bugs.sh".
Last updated: 2012-06-28
To get a list of bugs against libguestfs use this link:
https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
To report a new bug against libguestfs use this link:
This contains a local list of the bugs that are open against
libguestfs. Bugs are tracked in the Red Hat Bugzilla database
at https://bugzilla.redhat.com/ and to report a new bug you
should follow this link:
https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
When reporting a bug, please check:
When reporting a new bug, please check:
- That the bug hasn't been reported already.
- That the bug has not been reported already.
- That you are testing a recent version.
- Describe the bug accurately, and give a way to reproduce it.
- Include the version of libguestfs, distro version and any other
relevant information.
- Attach the complete output of "libguestfs-test-tool".
--------------------------------------------------
Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
507278 NEW https://bugzilla.redhat.com/show_bug.cgi?id=507278
libguestfs fails to build on Fedora sparc64
547488 NEW https://bugzilla.redhat.com/show_bug.cgi?id=547488
guestfish cannot tab complete filenames that contain spaces
554829 NEW https://bugzilla.redhat.com/show_bug.cgi?id=554829
SELinux handling could be done better.
555803 NEW https://bugzilla.redhat.com/show_bug.cgi?id=555803
guestfs_tgz_out does not detect failure of tar command
563450 NEW https://bugzilla.redhat.com/show_bug.cgi?id=563450
list-devices returns devices of different types out of order
572337 NEW https://bugzilla.redhat.com/show_bug.cgi?id=572337
libguestfs should support gptsync
578103 NEW https://bugzilla.redhat.com/show_bug.cgi?id=578103
[RFE] Tool to Compare Windows Registry Entries
593511 NEW https://bugzilla.redhat.com/show_bug.cgi?id=593511
[RFE] function to get partition name
596354 NEW https://bugzilla.redhat.com/show_bug.cgi?id=596354
guestfish.1.html and guestfs.3.html declared "XHTML 1.0 Strict" but are not in fact well-formed XML
604041 NEW https://bugzilla.redhat.com/show_bug.cgi?id=604041
guestmount absolute symlinks don't work
624334 NEW https://bugzilla.redhat.com/show_bug.cgi?id=624334
blockdev-setbsz succeeds, but does not affect blockdev-getbsz
624335 NEW https://bugzilla.redhat.com/show_bug.cgi?id=624335
blockdev-setbsz succeeds, but does not affect blockdev-getbsz
627675 NEW https://bugzilla.redhat.com/show_bug.cgi?id=627675
libguestfs inspector code cannot handle /dev/disk/by-id/* paths
637251 NEW https://bugzilla.redhat.com/show_bug.cgi?id=637251
virt-inspector fails to recognize data-only NTFS disk image
660687 NEW https://bugzilla.redhat.com/show_bug.cgi?id=660687
guestmount: "touch" command fails: touch: setting times of `timestamp': Invalid argument
672485 NEW https://bugzilla.redhat.com/show_bug.cgi?id=672485
[RFE] virt-edit/tar/inspector do not support encrypted system
676020 NEW https://bugzilla.redhat.com/show_bug.cgi?id=676020
After using virt-resize with an ntfs partition windows is not booting
693064 NEW https://bugzilla.redhat.com/show_bug.cgi?id=693064
Symbolic links on ntfs-3g are not followed correctly by some commands
696445 NEW https://bugzilla.redhat.com/show_bug.cgi?id=696445
Backport virt-inspector for virt-v2v
696451 NEW https://bugzilla.redhat.com/show_bug.cgi?id=696451
libguestfs: unknown filesystem label SWAP-sda2
696484 NEW https://bugzilla.redhat.com/show_bug.cgi?id=696484
[RFE] virt-v2v show the warning info after convert rhel4u8 guest if comment a line of swap in the fstab
700342 NEW https://bugzilla.redhat.com/show_bug.cgi?id=700342
virt-inspector resports unknown filesystem UUID
709326 NEW https://bugzilla.redhat.com/show_bug.cgi?id=709326
virt-inspector cannot detect ReactOS
728224 NEW https://bugzilla.redhat.com/show_bug.cgi?id=728224
configure can't find qemu on PPC
737261 NEW https://bugzilla.redhat.com/show_bug.cgi?id=737261
libguestfs grub-install API needs grub1
745282 NEW https://bugzilla.redhat.com/show_bug.cgi?id=745282
[RFE] Support to use virt-filesystems with remote libvirt systems
745576 NEW https://bugzilla.redhat.com/show_bug.cgi?id=745576
libguestfs (or qemu?) hangs if sparse file runs out of disk space
761565 NEW https://bugzilla.redhat.com/show_bug.cgi?id=761565
Missing deps on netpbm-progs and icoutils
770075 NEW https://bugzilla.redhat.com/show_bug.cgi?id=770075
FEBOOTSTRAP_MODULES fails if modules directory is not under /lib
770076 NEW https://bugzilla.redhat.com/show_bug.cgi?id=770076
FEBOOTSTRAP_KERNEL causes appliance build to fail
782167 NEW https://bugzilla.redhat.com/show_bug.cgi?id=782167
libguestfs doesn't recognize Windows Dynamic disks in some configurations, eg. spanned
785603 NEW https://bugzilla.redhat.com/show_bug.cgi?id=785603
copy-out can't find root directory
790837 NEW https://bugzilla.redhat.com/show_bug.cgi?id=790837
Use of atexit to clean up handles is wrong in multithreaded programs
798979 NEW https://bugzilla.redhat.com/show_bug.cgi?id=798979
Ubuntu install CDs from oneiric onwards are not recognized: "multi-boot operating systems are not supported"
801117 NEW https://bugzilla.redhat.com/show_bug.cgi?id=801117
libguestfs cannot get icon for Windows 8 preview
801640 NEW https://bugzilla.redhat.com/show_bug.cgi?id=801640
[RFE] the error reported by resize2fs-M need to be more clear
802389 NEW https://bugzilla.redhat.com/show_bug.cgi?id=802389
event handlers for 'close' event doesn't work in remote mode
803643 NEW https://bugzilla.redhat.com/show_bug.cgi?id=803643
inspect-is-multipart return false when inspection results should be true
803650 NEW https://bugzilla.redhat.com/show_bug.cgi?id=803650
inspect-is-live return false when inspection results should be true
803657 NEW https://bugzilla.redhat.com/show_bug.cgi?id=803657
[RFE] inspect-is-netinst : support more distributions
805417 NEW https://bugzilla.redhat.com/show_bug.cgi?id=805417
RFE: support inspection of installation ISOs of WinVista, Win7, Win2008 & Win2008r2
806176 NEW https://bugzilla.redhat.com/show_bug.cgi?id=806176
libguestfs doesn't use the external tools (wrestool ...) to get icon even these tools are installed
806179 NEW https://bugzilla.redhat.com/show_bug.cgi?id=806179
RFE: support inspection of icon for more Windows guests
808193 NEW https://bugzilla.redhat.com/show_bug.cgi?id=808193
g.launch() crashes on RHEL 5
811265 NEW https://bugzilla.redhat.com/show_bug.cgi?id=811265
the list-filesystems can detect the reiserFS,but can not mount it.and minix filesystem too.
811395 NEW https://bugzilla.redhat.com/show_bug.cgi?id=811395
virt-inspector to detect ia64 Windows 2k3 install media
811398 NEW https://bugzilla.redhat.com/show_bug.cgi?id=811398
virt-inspector fails to detect Win2k, Win2k8, Win2k8r2, WinVista, Win7 install media
812970 NEW https://bugzilla.redhat.com/show_bug.cgi?id=812970
virt-rescue cannot set ><rescue> prompt, on Ubuntu 12.04
813271 NEW https://bugzilla.redhat.com/show_bug.cgi?id=813271
intermittent appliance boot failures (divide_error)
813290 NEW https://bugzilla.redhat.com/show_bug.cgi?id=813290
mdadm (md-detail) test occasionally fails with 'md device /dev/md125 does not appear to be active.'
815149 NEW https://bugzilla.redhat.com/show_bug.cgi?id=815149
virt-alignment-scan gives error "part_list: could not parse row from output of parted print command: /dev/vda:4194304B:virtblk:512:512:msdos:Virtio Block Device"
816839 NEW https://bugzilla.redhat.com/show_bug.cgi?id=816839
data overflow error when debug progress -1
819086 NEW https://bugzilla.redhat.com/show_bug.cgi?id=819086
look for qemu-kvm on /usr/libexec
822538 NEW https://bugzilla.redhat.com/show_bug.cgi?id=822538
libguestfs tools hang on qcow2 encrypted disks
822626 NEW https://bugzilla.redhat.com/show_bug.cgi?id=822626
virt-ls error: "libguestfs: error: checksum: path: parameter cannot be NULL"
824021 NEW https://bugzilla.redhat.com/show_bug.cgi?id=824021
inspection cannot recognize guest which uses btrfs subvolumes for root
824782 NEW https://bugzilla.redhat.com/show_bug.cgi?id=824782
virt-resize cannot resize PowerPC guests
825034 NEW https://bugzilla.redhat.com/show_bug.cgi?id=825034
libguestfs has bad depndency on /lib/libusb-1.0.so.0
830135 NEW https://bugzilla.redhat.com/show_bug.cgi?id=830135
libguestfs should support mount-local APIs in RHEL 6 (for OpenStack)
832602 NEW https://bugzilla.redhat.com/show_bug.cgi?id=832602
"error in chunked encoding" when trying to extract (tar-out) a truncated ISO image
833362 NEW https://bugzilla.redhat.com/show_bug.cgi?id=833362
virt-make-fs test fails on ppc64 because filesystem block size is 64k
834712 NEW https://bugzilla.redhat.com/show_bug.cgi?id=834712
virt-resize test failed once: lvresize_free: New size (91 extents) matches existing size (91 extents)
834896 NEW https://bugzilla.redhat.com/show_bug.cgi?id=834896
'mount' command hangs if you try to mount an extended partition
835622 NEW https://bugzilla.redhat.com/show_bug.cgi?id=835622
virt-sparsify to LVM thin raw volume isn't sparse
503134 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=503134
guestfish's list splitting does not recognize internal quoting
539746 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=539746
launch fails when run inside a Xen guest, when no non-PV kernels are installed
541618 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=541618
guestfish not able to mount freebsd ufs2 partitions automatically
619334 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=619334
RFE: Enable coredump capture in the appliance
691389 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=691389
Extended attributes don't work over guestmount (FUSE)
713678 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=713678
Not all febootstrap messages are redirected to log callbacks
(70 bugs)
--------------------------------------------------
Bugs in MODIFIED, POST or ON_QA state are fixed.
You can help by testing the fixes.
749828 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=749828
p2v does not support raid devices
(1 bugs)
End of BUGS file.

187
HACKING
View File

@@ -1,185 +1,2 @@
PLEASE LOOK AT THE TOP OF EACH FILE BEFORE EDITING TO SEE WHETHER IT
IS AUTOMATICALLY GENERATED OR NOT.
Adding a new action
----------------------------------------------------------------------
All action functions are generated automatically, so there are only
two files you need to edit:
(1) src/generator.ml: Add your new action, parameters, description,
etc. to the big list called 'functions' at the top of this file.
(2) Edit/create a C file in daemon/ subdirectory which implements your
'do_action' function. Take a look at one of the numerous examples
there.
Formatting
----------------------------------------------------------------------
Try to use GNU / Emacs default formatting, following the convention
used elsewhere in the source.
Please make sure that the code compiles without warnings.
Please test any changes.
Useful targets:
make syntax-check Checks the syntax of the C code.
make check Runs the test suite.
Enable warnings, and fix any you find:
./configure --enable-gcc-warnings
Code indentation
----------------------------------------------------------------------
Our C source code generally adheres to some basic code-formatting
conventions. The existing code base is not totally consistent on this
front, but we do prefer that contributed code be formatted similarly.
In short, use spaces-not-TABs for indentation, use 2 spaces for each
indentation level, and other than that, follow the K&R style.
If you use Emacs, add the following to one of one of your start-up files
(e.g., ~/.emacs), to help ensure that you get indentation right:
;;; In libguestfs, indent with spaces everywhere (not TABs).
;;; Exceptions: Makefile and ChangeLog modes.
(add-hook 'find-file-hook
'(lambda () (if (and buffer-file-name
(string-match "/libguestfs\\>" (buffer-file-name))
(not (string-equal mode-name "Change Log"))
(not (string-equal mode-name "Makefile")))
(setq indent-tabs-mode nil))))
;;; When editing C sources in libguestfs, use this style.
(defun libguestfs-c-mode ()
"C mode with adjusted defaults for use with libguestfs."
(interactive)
(c-set-style "K&R")
(setq c-indent-level 2)
(setq c-basic-offset 2))
(add-hook 'c-mode-hook
'(lambda () (if (string-match "/libguestfs\\>" (buffer-file-name))
(libguestfs-c-mode))))
Directories
----------------------------------------------------------------------
appliance/
The qemu appliance, build scripts and so on.
cat/
The virt-cat tool.
capitests/
Automated tests of the C API.
contrib/
Outside contributions, experimental parts.
daemon/
The daemon that runs inside the guest and carries out actions.
df/
The virt-df tool.
examples/
The examples.
fish/
Guestfish (the command-line program / shell)
haskell/
Haskell bindings.
images/
Some guest images to test against. These are gzipped to save
space. You have to unzip them before use.
Also contains some files used by the test suite.
inspector/
Virtual machine image inspector (virt-inspector).
java/
Java bindings.
m4/
M4 macros used by autoconf.
ocaml/
OCaml bindings.
po/
Translations.
perl/
Perl bindings.
python/
Python bindings.
regressions/
Regression tests.
ruby/
Ruby bindings.
src/
Source code to the C library.
Also contains the crucial generator program.
test-tool/
Interactive qemu/kernel test tool.
Debugging
----------------------------------------------------------------------
It's a good idea to use guestfish to try out new commands.
Debugging the daemon is a problem because it runs inside a minimal
qemu environment. However you can print messages from the daemon, and
they will show up if you use 'guestfish -v'.
Patches
----------------------------------------------------------------------
Submit patches to the mailing list:
http://www.redhat.com/mailman/listinfo/libguestfs
and CC to rjones@redhat.com
I18N
----------------------------------------------------------------------
We support i18n (gettext anyhow) in the library.
However many messages come from the daemon, and we don't translate
those at the moment. One reason is that the appliance generally has
all locale files removed from it, because they take up a lot of space.
So we'd have to readd some of those, as well as copying our PO files
into the appliance.
Debugging messages are never translated, since they are intended for
the programmers.
Extended printf
----------------------------------------------------------------------
In the daemon code we have created custom printf formatters %Q and %R,
which are used to do shell quoting.
%Q => Simple shell quoted string. Any spaces or other shell characters
are escaped for you.
%R => Same as %Q except the string is treated as a path which is prefixed
by the sysroot.
eg.
asprintf (&cmd, "cat %R", path);
==> "cat /sysroot/some\ path\ with\ spaces"
Note: Do NOT use these when you are passing parameters to the
command{,r,v,rv}() functions. These parameters do NOT need to be
quoted because they are not passed via the shell (instead, straight to
exec). You probably want to use the sysroot_path() function however.
The contents of this page have moved to the section "EXTENDING LIBGUESTFS"
in the guestfs(3) man page.

View File

@@ -1,5 +1,5 @@
# libguestfs
# Copyright (C) 2009 Red Hat Inc.
# Copyright (C) 2009-2012 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,149 +13,218 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include $(top_srcdir)/subdir-rules.mk
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = gnulib/lib src daemon appliance fish po examples images \
gnulib/tests capitests regressions test-tool
# Gnulib - must be built and tested before the library.
SUBDIRS = gnulib/lib gnulib/tests
if HAVE_OCAML
SUBDIRS += ocaml
# Basic source for the library.
SUBDIRS += tests/data generator src examples po
if ENABLE_DAEMON
SUBDIRS += daemon
endif
if ENABLE_APPLIANCE
SUBDIRS += appliance
endif
# Tests - order is important.
if ENABLE_APPLIANCE
SUBDIRS += tests/qemu
SUBDIRS += tests/guests
SUBDIRS += tests/c-api
SUBDIRS += tests/protocol
SUBDIRS += tests/disks
SUBDIRS += tests/lvm
SUBDIRS += tests/luks
SUBDIRS += tests/md
SUBDIRS += tests/selinux
SUBDIRS += tests/ntfsclone
SUBDIRS += tests/btrfs
SUBDIRS += tests/charsets
SUBDIRS += tests/xml
SUBDIRS += tests/regressions
endif
# Extra tests don't run by default. You have to do 'make extra-tests'.
SUBDIRS += tests/extra
# libguestfs-test-tool
SUBDIRS += test-tool
# Guestfish.
SUBDIRS += fish
# virt-tools in C.
SUBDIRS += align cat df edit format inspector rescue
# Language bindings.
if HAVE_PERL
SUBDIRS += perl
SUBDIRS += perl perl/examples
endif
if HAVE_OCAML
SUBDIRS += ocaml ocaml/examples
endif
if HAVE_PYTHON
SUBDIRS += python
SUBDIRS += python python/examples
endif
if HAVE_RUBY
SUBDIRS += ruby
SUBDIRS += ruby ruby/examples
endif
if HAVE_JAVA
SUBDIRS += java
SUBDIRS += java java/examples
endif
if HAVE_HASKELL
SUBDIRS += haskell
endif
if HAVE_INSPECTOR
SUBDIRS += inspector
if HAVE_PHP
SUBDIRS += php
endif
if HAVE_DF
SUBDIRS += df
if HAVE_ERLANG
SUBDIRS += erlang erlang/examples
endif
if HAVE_CAT
SUBDIRS += cat
if HAVE_GOBJECT
SUBDIRS += gobject
endif
# Unconditional because nothing is built yet.
SUBDIRS += csharp
# OCaml tools.
if HAVE_OCAML
SUBDIRS += resize sparsify sysprep
endif
# Perl tools.
if HAVE_TOOLS
SUBDIRS += tools
endif
# guestmount
if HAVE_FUSE
SUBDIRS += fuse
endif
# po-docs must come after tools, inspector.
if HAVE_PO4A
SUBDIRS += po-docs
endif
EXTRA_DIST = \
guestfs.pod guestfs-actions.pod guestfs-structs.pod \
guestfish.pod guestfish-actions.pod \
html/pod.css \
HACKING TODO \
libguestfs.pc libguestfs.pc.in \
recipes/LICENSE \
recipes/README \
recipes/*.html \
recipes/*.sh \
recipes/*.example \
html/recipes.css \
make-recipes.sh \
contrib/README \
contrib/febootstrap/install.title \
contrib/febootstrap/install.html \
contrib/febootstrap/install.sh \
$(generator_built) \
BUGS HACKING RELEASE-NOTES ROADMAP TODO \
.gitignore \
bugs-in-changelog.sh \
autogen.sh \
bindtests \
libguestfs.3
contrib/autobuild/autobuild.sh \
contrib/guestfsd-in-wine.sh \
contrib/intro/libguestfs-intro.html \
contrib/intro/overview.svg \
contrib/intro/talk.txt \
contrib/intro/tools.svg \
contrib/make-check-on-installed.pl \
contrib/README \
contrib/visualize-alignment/.gitignore \
contrib/visualize-alignment/guestfish-add-mount.qtr \
contrib/visualize-alignment/guestfish-lv-ext4-4k.qtr \
contrib/visualize-alignment/guestfish-lv-ext4-4k-write-hello.qtr \
contrib/visualize-alignment/guestfish-N-fs-10M-aligned-part-disk.qtr \
contrib/visualize-alignment/guestfish-N-fs-10M.qtr \
contrib/visualize-alignment/guestfish-write-hello.qtr \
contrib/visualize-alignment/qemu-0.13-trace-block-device-access.patch \
contrib/visualize-alignment/README \
contrib/visualize-alignment/tracetops.ml \
html/pod.css \
libtool-kill-dependency_libs.sh \
logo/fish.svg logo/fish.png \
m4/.gitignore \
update-bugs.sh
# Manual pages.
# guestfs-actions.pod and guestfs-structs are autogenerated. There is
# no include mechanism for POD, so we have to do it by hand.
man_MANS = guestfs.3 libguestfs.3 guestfish.1
guestfs.3: guestfs.pod guestfs-actions.pod guestfs-structs.pod
sed \
-e '/@ACTIONS@/rguestfs-actions.pod' -e 's/@ACTIONS@//' \
-e '/@STRUCTS@/rguestfs-structs.pod' -e 's/@STRUCTS@//' \
< $< | \
$(POD2MAN) \
--section 3 \
-c "Virtualization Support" \
--name "guestfs" \
--release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
> $@
guestfish.1: guestfish.pod guestfish-actions.pod
sed \
-e '/@ACTIONS@/rguestfish-actions.pod' -e 's/@ACTIONS@//' \
< $< | \
$(POD2MAN) \
--section 1 \
-c "Virtualization Support" \
--name "guestfish" \
--release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
> $@
noinst_DATA = html/guestfs.3.html html/guestfish.1.html
html/guestfs.3.html: guestfs.pod guestfs-actions.pod guestfs-structs.pod
mkdir -p html
sed \
-e '/@ACTIONS@/rguestfs-actions.pod' -e 's/@ACTIONS@//' \
-e '/@STRUCTS@/rguestfs-structs.pod' -e 's/@STRUCTS@//' \
< $< | \
pod2html \
--css 'pod.css' \
--title "libguestfs API documentation" \
--htmldir html \
--outfile $@
html/guestfish.1.html: guestfish.pod guestfish-actions.pod
mkdir -p html
sed \
-e '/@ACTIONS@/rguestfish-actions.pod' -e 's/@ACTIONS@//' \
< $< | \
pod2html \
--css 'pod.css' \
--title "guestfish, libguestfs filesystem interactive shell" \
--htmldir html \
--outfile $@
# Recipes web page.
html/recipes.html: $(wildcard recipes/*.sh) $(wildcard recipes/*.html) $(wildcard recipes/*.example) Makefile make-recipes.sh
mkdir -p html
rm -f $@ $@-t
sh make-recipes.sh recipes/*.sh > $@-t
mv $@-t $@
HTMLFILES = html/guestfs.3.html html/guestfish.1.html \
# The website.
HTMLFILES = \
html/guestfs.3.html \
html/guestfs-examples.3.html \
html/guestfs-erlang.3.html \
html/guestfs-faq.1.html \
html/guestfs-java.3.html \
html/guestfs-ocaml.3.html \
html/guestfs-performance.1.html \
html/guestfs-perl.3.html \
html/guestfs-python.3.html \
html/guestfs-recipes.1.html \
html/guestfs-ruby.3.html \
html/guestfs-testing.1.html \
html/guestfish.1.html \
html/guestmount.1.html \
html/libguestfs-make-fixed-appliance.1.html \
html/libguestfs-test-tool.1.html \
html/virt-alignment-scan.1.html \
html/virt-cat.1.html \
html/virt-copy-in.1.html \
html/virt-copy-out.1.html \
html/virt-df.1.html \
html/virt-edit.1.html \
html/virt-filesystems.1.html \
html/virt-format.1.html \
html/virt-inspector.1.html \
html/recipes.html \
html/pod.css html/recipes.css
html/virt-list-filesystems.1.html \
html/virt-list-partitions.1.html \
html/virt-ls.1.html \
html/virt-make-fs.1.html \
html/virt-rescue.1.html \
html/virt-resize.1.html \
html/virt-sparsify.1.html \
html/virt-sysprep.1.html \
html/virt-tar.1.html \
html/virt-tar-in.1.html \
html/virt-tar-out.1.html \
html/virt-win-reg.1.html
TEXTFILES = README TODO HACKING
TEXTFILES = BUGS README RELEASE-NOTES ROADMAP TODO
WEBSITEDIR = $(HOME)/d/redhat/websites/libguestfs
# For reasons not fully understood, we need to rebuild all the
# man pages and HTMLFILES from scratch here.
website: $(HTMLFILES) $(TEXTFILES)
find -name 'stamp-*.pod' -delete
$(MAKE)
cp $(HTMLFILES) $(WEBSITEDIR)
for f in $(TEXTFILES); do cp $$f $(WEBSITEDIR)/$$f.txt; done
cd $(WEBSITEDIR) && \
date=`date +%F`; \
sed -e "s/SUBST_VERSION/$(VERSION)/" \
-e "s/SUBST_DATE/$$date/" \
< index.html.in > index.html
# Generate the ChangeLog automatically from the gitlog.
# When doing 'make dist' update a few files automatically.
dist-hook:
$(top_srcdir)/build-aux/gitlog-to-changelog > ChangeLog
cp ChangeLog $(distdir)/ChangeLog
$(top_srcdir)/update-bugs.sh > BUGS-t
mv BUGS-t BUGS
cp BUGS $(distdir)/BUGS
git log --pretty="format:%an <%ae>" | sort -u | uniq -w 10 | \
grep -v rjones | \
grep -v "Richard Jones" \
> AUTHORS-t
mv AUTHORS-t AUTHORS
cp AUTHORS $(distdir)/AUTHORS
# Update the list of translatable files in po/POTFILES.in.
# Update the list of translatable files (po/POTFILES po/POTFILES-ml).
# This has to be in the top-level Makefile.am so that we have access
# to DIST_SUBDIRS.
all-local:
cd $(srcdir); \
find $(DIST_SUBDIRS) -name '*.c' -o -name '*.pl' -o -name '*.pm' | \
find $(DIST_SUBDIRS) \
-name '*.c' -o -name '*.pl' -o -name '*.pm' | \
grep -v '^perl/blib/' | \
grep -v '^capitests/' | \
grep -v '^tests/' | \
grep -v '^daemon/lib/' | \
grep -v '^daemon/tests/' | \
grep -v '^examples/' | \
@@ -163,21 +232,40 @@ all-local:
grep -v '^perl/examples/' | \
grep -v '/guestfs_protocol.c' | \
grep -v '/rc_protocol.c' | \
grep -v '^po-docs/' | \
grep -v '^images/' | \
LC_ALL=C sort | \
sed 's,^\./,,' > po/POTFILES.in
# Pkgconfig.
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libguestfs.pc
sed 's,^\./,,' > po/POTFILES
cd $(srcdir); \
find resize sparsify sysprep -name '*.ml' | \
LC_ALL=C sort > po/POTFILES-ml
# Make clean.
CLEANFILES = $(fs_DATA) \
emptydisk \
CLEANFILES = \
pod2htm?.tmp \
html/*.html \
guestfs.3 guestfish.1
html/*.html
clean-local:
rm -rf initramfs
# If you don't want to run all of the tests ('make check') then this
# will just run libguestfs-test-tool for a quick check. Note this
# is NOT a substitute for proper testing!
quickcheck:
./run test-tool/libguestfs-test-tool $(QUICKCHECK_TEST_TOOL_ARGS)
# Run extra-tests in tests/extra/ subdirectory.
extra-tests:
make -C tests/extra $@
# Make binary distribution.
BINTMPDIR = /tmp/libguestfs-bin
bindist:
rm -rf $(BINTMPDIR)
mkdir $(BINTMPDIR)
$(MAKE)
$(MAKE) DESTDIR=$(BINTMPDIR) install
-find $(BINTMPDIR) -type d -exec rmdir --ignore-fail-on-non-empty {} \;
(cd $(BINTMPDIR) && tar cf - .) | \
gzip -c -9 > libguestfs-$(VERSION)-$(DISTRO)-$(host_cpu).tar.gz

379
README
View File

@@ -1,88 +1,153 @@
Libguestfs is a library for accessing and modifying guest disk images.
Amongst the things this is good for: making batch configuration
changes to guests, getting disk used/free statistics (see also:
virt-df), migrating between virtualization systems (see also:
virt-p2v), performing partial backups, performing partial guest
clones, cloning guests and changing registry/UUID/hostname info, and
much else besides.
Libguestfs uses Linux kernel and qemu code, and can access any type of
guest filesystem that Linux and qemu can, including but not limited
to: ext2/3/4, btrfs, FAT and NTFS, LVM, many different disk partition
schemes, qcow, qcow2, vmdk.
Libguestfs provides ways to enumerate guest storage (eg. partitions,
LVs, what filesystem is in each LV, etc.). It can also run commands
in the context of the guest. Also you can access filesystems over FTP.
Libguestfs is a library that can be linked with C and C++ management
programs (or management programs written in OCaml, Perl, Python, Ruby, Java
or Haskell). You can also use it from shell scripts or the command line.
Libguestfs was written by Richard W.M. Jones (rjones@redhat.com) and
hacked on by lots of other people. For discussion, development,
patches, etc. please use the mailing list:
http://www.redhat.com/mailman/listinfo/libguestfs
Home page
----------------------------------------------------------------------
Libguestfs is tools and a library for accessing and modifying guest
disk images. For more information see the home page:
http://libguestfs.org/
For discussion, development, patches, etc. please use the mailing
list:
http://www.redhat.com/mailman/listinfo/libguestfs
Requirements
----------------------------------------------------------------------
- recent QEMU >= 0.10 with vmchannel support
http://lists.gnu.org/archive/html/qemu-devel/2009-02/msg01042.html
Running ./configure will check you have all the requirements installed
on your machine.
- febootstrap >= 2.3
Fedora/RHEL users:
- fakeroot
A useful tip is to run:
- fakechroot >= 2.9
yum-builddep libguestfs
which will install all build dependencies automatically. If that is
successful, you don't need to bother with the rest of this section.
Debian/Ubuntu users:
Use:
apt-get build-dep libguestfs
to install all build dependencies. If that doesn't work, take a
look at the Debian source package:
http://packages.debian.org/source/libguestfs
at the list of 'build-depends' and 'build-depends-indep', and
install everything listed there.
If either of those techniques is successful, you don't need to
bother with the rest of this section.
The full requirements are described below.
For basic functionality and the C tools:
- look at appliance/packagelist.in and install as many of the packages
that apply to your distro as possible
- QEMU >= 1.0.
- kernel >= 2.6.34 with virtio-serial support enabled.
- virtio-block and virtio-net drivers should be compiled into your
host kernel (strictly speaking this is optional, but you will have
to make complex changes to the ./configure command line to get it
to work if you don't have virtio)
- febootstrap >= 3.17
Notes: (1) febootstrap 2.x WILL NOT WORK
(2) febootstrap 3.x is distro-independent, and is required on
Debian and other distros as well as Fedora
(3) that is the minimum version, but later versions are better
- XDR, rpcgen (on Linux these are provided by glibc)
- squashfs-tools (mksquashfs only)
- cpio
- genisoimage / mkisofs
- gperf
- (Optional) Augeas (http://augeas.net/)
- pcre (Perl Compatible Regular Expressions C library)
- perldoc (pod2man, pod2text) to generate the manual pages and
other documentation.
- genisoimage (NOT mkisofs any more)
- (Optional) Readline to have nicer command-line editing in guestfish.
- hivex >= 1.2.7 (http://libguestfs.org/download) (optional)
- (Optional) 'reged' program from chntpw to decode Windows registry
entries (http://home.eunet.no/~pnordahl/ntpasswd/)
- libmagic (the library that corresponds to the 'file' command) (optional)
- (Optional) OCaml if you want to rebuild the generated files, and
also to build the OCaml bindings
- libvirt (optional)
- (Optional) local Fedora mirror
- libxml2 (optional)
- (Optional) Perl if you want to build the perl bindings
- libconfig (optional)
- (Optional) Python if you want to build the python bindings
- augeas >= 0.5.0 (http://augeas.net/) (optional)
- (Optional) Ruby, rake if you want to build the ruby bindings
- Berkeley DB 'db_dump' and 'db_load' utilities
(db4-utils or db4.X-util or similar) (optional)
- (Optional) Java, JNI, jpackage-utils if you want to build the java
bindings
- systemtap/DTrace userspace probes (optional)
http://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps
- (Optional) GHC if you want to build the Haskell bindings
- perldoc (pod2man, pod2text, pod2html) to generate the manual pages
and other documentation.
- (Optional) Perl XML::XPath, Sys::Virt modules (for libvirt support
in virt-inspector).
- Readline to have nicer command-line editing in guestfish (optional)
- (Optional, but highly recommended) perl-libintl for translating perl code.
- xmllint (part of libxml2) to validate virt-inspector
RELAX NG schema (optional)
Running ./configure will check you have all the requirements installed
on your machine.
- OCaml if you want to rebuild the generated files, and
also to build the OCaml bindings (optional)
- ocaml-gettext if you want to translate OCaml tools (optional)
- po4a for translating manpages and POD files.
This is optional when compiling from the tarball, but mandatory
if you compile from git.
- getfacl, getfattr libraries and programs (optional)
- netpbm, icoutils (optional)
These programs are used to render icons from guests.
To build FUSE support (guestmount):
- FUSE libraries and kernel module (optional)
To build language bindings:
- Perl if you want to build the perl bindings (optional)
- Python if you want to build the python bindings (optional)
- Ruby, rake if you want to build the ruby bindings (optional)
- Java, JNI, jpackage-utils if you want to build the java
bindings (optional)
- GHC if you want to build the Haskell bindings (optional)
- PHP, phpize if you want to build the PHP bindings (optional)
To build the Perl tools:
- Perl Sys::Virt module (optional)
- Perl Win::Hivex module (optional)
- Perl Pod::Usage module (optional)
- Perl Test::More module (from perl Test::Simple) (optional)
- Perl String::ShellQuote module (optional)
- perl-libintl for translating perl code (optional)
To run virt-sysprep:
- virt-sysprep requires FUSE support since it uses guestmount
Building
@@ -90,55 +155,55 @@ Building
Then make the daemon, library and root filesystem:
./configure [--with-mirror=URI]
./configure
make
Use the optional --with-mirror parameter to specify the URI of a local
Fedora mirror. See the discussion of the MIRROR parameter in the
febootstrap(8) manpage.
Finally run the tests:
make check
There are some extra tests, but these require that you have some
libvirt guests installed, that these guests' disks are accessible by
the current user, and these tests may fail for other reasons which are
not necessarily because of real problems. If you want to run these
extra tests do:
make extra-tests
If everything works, you can install the library and tools by running
this command as root:
make install
You can run guestfish, guestmount and the virt tools without needing
to install, using the "run" script in the top directory. This script
sets up some environment variables. For example:
Fedora
----------------------------------------------------------------------
./run ./fish/guestfish [usual guestfish args ...]
We provide packages for Fedora >= 11 in Fedora. Use those, or build
from our source RPMs - it's far simpler that way.
./run ./inspector/virt-inspector [usual virt-inspector args ...]
You can compile libguestfs on Fedora 10 but you cannot use it with the
version of qemu in Fedora 10. You need to compile your own qemu, see
section 'qemu' below.
If you are already in the fish/ subdirectory, then the following
command will also work:
../run ./guestfish [...]
RHEL / EPEL / CentOS etc
----------------------------------------------------------------------
You can also make a symlink (note: NOT a hard link) from your $PATH to
the run script, eg:
We provide packages in EPEL which cover RHEL/CentOS >= 5. Use those
or build from our source RPMs.
cd ~/bin
ln -s ~/libguestfs/run libguestfs-run
cd ~/libguestfs
libguestfs-run ./inspector/virt-inspector [...]
You can also run the C programs under valgrind like this:
Debian
----------------------------------------------------------------------
./run valgrind [valgrind opts...] ./cat/virt-cat [virt-cat opts...]
libguestfs is now built as a package in Debian by Guido Gunther and
the other Debian libvirt maintainers. See:
This also works with sudo (eg. if you need root access for libvirt or
to access a block device):
http://wiki.debian.org/Teams/DebianLibvirtTeam#Packages
You can build for Debian in two different ways, either building a
Fedora-based appliance using febootstrap, yum, rpm, fakeroot,
fakechroot (all packaged in Debian). However the recommended way is
to build a Debian-based appliance using debootstrap and debirf.
Both ways are supported by the configure script.
sudo ./run ./cat/virt-cat -d LinuxGuest /etc/passwd
qemu
@@ -147,16 +212,9 @@ qemu
By far the most common problem is with broken or incompatible
qemu releases.
First of all, you need qemu >= 0.10.4, which contains a vmchannel
implementation. There are several, conflicting, incompatible things
called 'vmchannel' which at one time or another have been added or
proposed for qemu/KVM. The _only_ one we support is this one:
http://lists.gnu.org/archive/html/qemu-devel/2009-02/msg01042.html
Secondly, different versions of qemu have problems booting the
appliance for different reasons. This varies between versions of
qemu, and Linux distributions which add their own patches.
Different versions of qemu have problems booting the appliance for
different reasons. This varies between versions of qemu, and Linux
distributions which add their own patches.
If you find a problem, you could try using your own qemu built from
source (qemu is very easy to build from source), with a 'qemu
@@ -183,82 +241,11 @@ On some systems, the chmod will not survive a reboot, and you will
need to make edits to the udev configuration.
Supermin appliance
----------------------------------------------------------------------
If you configure with --enable-supermin then we will build a supermin
appliance (supermin = super-minimized). This is a very specialized
appliance which is built on-the-fly at runtime (specifically, when you
call guestfs_launch).
The normal appliance is a self-contained Linux operating system, based
on the Fedora/RHEL/CentOS Linux distro. So it contains a complete
copy of all the libraries and programs needed, like kernel, libc,
bash, coreutils etc etc.
The supermin appliance removes the kernel and all the executable
libraries and programs from the appliance. That just leaves a
skeleton of config files and some data files, which is obviously
massively smaller than the normal appliance. At runtime we rebuild
the appliance on-the-fly from the libraries and programs on the host
(eg. pulling in the real /lib/libc.so, the real /bin/bash etc.)
Although this process of rebuilding the appliance each time sounds
slow, it turns out to be faster than using the prebuilt appliance.
(Most of the saving comes from not compressing the appliance - it
transpires that decompressing the appliance is the slowest part of the
whole boot sequence). On my machine, a new appliance can be built in
under a fifth of a second, and the boot time is several seconds
shorter.
The big advantage of the supermin appliance for distributions like
Fedora is that it gets security fixes automatically from the host, so
there is no need to rebuild the whole of libguestfs for a security
update in some underlying library.
There are several DISADVANTAGES:
It won't work at all except in very narrow, controlled cases like the
Fedora packaging case. We control the dependencies of the libguestfs
RPM tightly to ensure that the required binaries are actually present
on the host.
Furthermore there are certain unlikely changes in the packages on the
host which could break a supermin appliance, eg. an updated library
which depends on an additional data file.
Also supermin appliances are subjected to changes in the host kernel
which might break compatibility with qemu -- these are, of course,
real bugs in any case.
Lastly, supermin appliances really can't be moved between branches of
distributions (eg. built on Fedora 12 and moved to Fedora 10) because
they are not self-contained and they rely on certain libraries being
around. You shouldn't do this anyway.
Use supermin appliances with caution.
Notes on cross-architecture support
----------------------------------------------------------------------
At the moment we basically don't support cross-architecture or
32-on-64. This limits what is possible for some guests. Filesystem
operations and FTP export will work fine, but running commands in
guests may not be possible.
To enable this requires work for cross-architecture and 32-on-64
support in febootstrap, fakeroot and fakechroot.
The daemon/ directory contains its own configure script. This is so
that in future we will be able to cross-compile the daemon.
Mirroring tip
----------------------------------------------------------------------
On my machines I can usually rebuild the appliance in around 3
minutes. If it takes much longer for you, use a local Fedora mirror
minutes. If it takes much longer for you, use a local distro mirror
or squid.
To use squid to cache yum downloads, read this first:
@@ -282,21 +269,61 @@ distributions. Non-Linux ports are trickier, but we will accept
patches if they aren't too invasive.
The main porting issues are with the dependencies needed to build the
appliance. You will need to find or port the following packages
first:
appliance. You will need to port the febootstrap first
(http://people.redhat.com/~rjones/febootstrap/).
- fakeroot
- fakechroot
- python
- rpm-python http://www.rpm.org/
- yum http://yum.baseurl.org/
- febootstrap http://et.redhat.com/~rjones/febootstrap/
Note on using clang (from LLVM) instead of GCC
----------------------------------------------------------------------
export CC=clang
./configure --disable-probes
make
SystemTap/DTrace-style userspace probe points don't work under the
clang compiler, which is why you may need to disable them.
Don't enable GCC warnings (ie. *don't* use
'./configure --enable-gcc-warnings').
Note on using non-x86 architectures
----------------------------------------------------------------------
In theory libguestfs should work on non-x86 architectures. Usually if
it doesn't it's because qemu isn't available or cannot boot the
kernel.
For ARM you will need to specify the exact machine type and CPU
variant that is required to boot the Linux kernel (there's no way to
know this except by looking at how the Linux kernel was configured).
For example:
./configure \
--with-qemu="qemu-system-arm" \
--with-qemu-options="-M versatilepb -cpu arm926"
./configure \
--with-qemu="qemu-system-arm" \
--with-qemu-options="-M vexpress-a9 -cpu cortex-a9"
Note that since virtio is required by libguestfs, and virtio is a
PCI-based architecture, whatever architecture qemu emulates must
support PCI also.
For PPC64 you will need to specify the IBM pSeries machine type:
./configure \
--with-qemu="qemu-system-ppc64" \
--with-qemu-options="-M pseries"
After building libguestfs, run 'make quickcheck' and pay close
attention to the qemu command line and kernel output.
Copyright and license information
----------------------------------------------------------------------
Copyright (C) 2009 Red Hat Inc.
Copyright (C) 2009-2012 Red Hat Inc.
The library is distributed under the LGPLv2+. The programs are
distributed under the GPLv2+. Please see the files COPYING and

1341
RELEASE-NOTES Normal file

File diff suppressed because it is too large Load Diff

52
ROADMAP Normal file
View File

@@ -0,0 +1,52 @@
Roadmap for future releases
---------------------------
Before you read this:
(1) To see what's in the current release, read 'RELEASE-NOTES'.
(2) To see the list of bugs, read 'BUGS'.
(3) To understand libguestfs versioning, read this:
http://libguestfs.org/guestfs.3.html#libguestfs_version_numbers
(4) For general "might be good to have" items, see 'TODO'.
For next major stable release (1.20)
------------------------------------
* Allow remote libvirt volumes to be accessed. This requires some
enhancements to libvirt which have been agreed but not yet
implemented.
Bugs assigned to 1.20 (put "1.20" in the Devel Whiteboard field in
Bugzilla):
https://bugzilla.redhat.com/buglist.cgi?query_format=advanced&field0-0-0=cf_devel_whiteboard&bug_status=NEW&bug_status=ASSIGNED&bug_status=MODIFIED&bug_status=ON_DEV&bug_status=ON_QA&bug_status=VERIFIED&bug_status=FAILS_QA&bug_status=RELEASE_PENDING&bug_status=POST&bug_status=PASSES_QA&type0-0-0=anywords&value0-0-0=1.20&component=libguestfs&product=Virtualization%20Tools
Beyond 1.20
-----------
* Make 'guestfish --ro' be the default, and get users to use
'guestfish --rw' for write access (but allow the default to be
overridden in a configuration file). This was originally planned
for 1.10 but there's not nearly enough adoption of the new
'guestfish --rw' option out there to do this yet.
* Allow alternate methods to start the appliance, including through
libvirt, by connecting to an existing appliance, and remotely over
ssh. Libvirt integration was originally planned for 1.10 but we
didn't get patches in time.
* Write a new partition handling library to replace parted, and use it
instead of parted. (RHBZ#593511, RHBZ#642821).
* Hot plugging of disks using QMP. This would allow more efficient
reuse of the appliance in some circumstances: multiple disks
(ie. VMs) can be added in turn to the same appliance. In particular
this would help virt-df.
[Note this requires upstream work on QMP, see:
https://www.redhat.com/archives/libguestfs/2011-March/msg00124.html]
See TODO and BUGS files.

627
TODO
View File

@@ -6,61 +6,27 @@ to libguestfs in future.
- RWMJ
Python bindings
---------------
Ideas for the Python bindings:
https://www.redhat.com/archives/fedora-virt/2009-April/msg00114.html
FTP server or FUSE?
-------------------
Originally we had intended to implement an NFS server inside the
appliance, which would allow the guest filesystems to be mounted on
the host, and large changes to be made. We eventually rejected the
idea of using NFS, partly because it requires root to mount
filesystems in the host, and partly because of problems handling UID
mappings between host and guest filesystem.
Then we look at implementing an FTP server instead. FTP clients are
widely available for many languages, don't require root, and don't
have any UID mapping problems. However there is the problem of
getting the TCP connection into the guest, and that FTP requires a
secondary data connection either in or out of the guest (the NFS
situation is even more dire).
Thirdly we looked at implementing a FUSE-based filesystem. This is
plausible - it could be implemented just by adding the additional FUSE
operations to the standard guestfs(3) API, and then implementing a
simple FUSE daemon. (The FUSE website has some very helpful
documentation and examples). I [RWMJ] am not particularly convinced
that a FUSE-based filesystem would really be useful to anyone, but am
prepared to accept patches if someone does all the work.
See also the mountlo project:
http://sourceforge.net/project/showfiles.php?group_id=121684&package_id=150116
BufferIn
FUSE API
--------
BufferIn should turn into <char *, int> and simple strings in other
languages that can handle 8 bit clean strings.
The API needs more test coverage, particularly lesser-used system
calls.
Limit on transfers would still be 2MB for these types.
- then implement write-file properly
febootstrap / debootstrap inside appliance
------------------------------------------
This was originally proposed as a way to install new operating systems
in the appliance. However no one has come up with a workable
solution.
The big unresolved issue is UID/GID mapping between guest filesystem
IDs and the host. It's not easy to automate this because you need
extra details about the guest itself in order to get to its
UID->username map (eg. /etc/passwd from the guest).
Haskell bindings
----------------
Complete the Haskell bindings (see discussion on haskell-cafe).
PHP bindings
------------
Add bindtests to PHP bindings.
Complete bind tests
-------------------
@@ -77,90 +43,20 @@ data, at least partially. This would be just another output type so:
Note that recent versions of libvirt/virt-install allow guests to be
imported, so this is not so useful any more.
"Standalone/local mode"
-----------------------
Instead of running guestfsd (the daemon) inside qemu, there should be
an option to just run guestfsd directly.
The architecture in this mode would look like:
+------------------+
| main program |
|------------------|
| libguestfs |
+--------^---------+
| | reply
cmd | |
+----v-------------+
| guestfsd |
+------------------+
Notes:
(1) This only makes sense if we are running as root.
(2) There is no console / kernel messages in this configuration, but
we might consider capturing stderr from the daemon.
(3) guestfs_config and guestfs_add_drive become no-ops.
Obviously in this configuration, commands are run directly on the
local machine's disks. You could just run the commands themselves
directly, but libguestfs provides a convenient API and language
bindings. Also deals with tricky stuff like parsing the output of the
LVM commands. Also we get to leverage other code such as
virt-inspector.
This is mainly useful from live CDs, ie. virt-p2v.
Should we bother having the daemon at all and just link the guestfsd
code directly into libguestfs?
PPC problems
------------
[This section should be filed as bugs, but no one seems to care for
PPC hosts and the hardware is rapidly becoming obsolete]
ppc (32 bit) works with qemu from git, however there is no serial console
ppc64 requires extra parameters:
-M mac99 -cpu ppc64
however it still fails:
invalid/unsupported opcode: 01 - 01 - 1a (06301e83) 00000000018c2738 1
invalid bits: 00400000 for opcode: 0b - 19 - 15 (2d746572) 0000000000009230
no serial console in ppc or ppc64 because no one can tell us what
console=ttyXX option to use
Supermin appliance to febootstrap
---------------------------------
Supermin appliance functionality should be moved into febootstrap.
Ideas for extra commands
------------------------
General glibc / core programs:
chgrp
dd (?)
utime / utimes / futimes / futimens / l..
more mk*temp calls
trunc[ate??]
ext2 properties:
chattr
lsattr
badblocks
blkid
debugfs
dumpe2fs
e2image
e2undo
filefrag
findfs
logsave
mklost+found
SELinux:
@@ -180,88 +76,425 @@ Such as:
initrd-extract
initrd-replace
Simple editing of configuration files
-------------------------------------
Some easy non-Augeas methods to edit configuration files.
I'm thinking:
replace /etc/file key value
which would look in /etc/file for any instances of
key=...
key ...
key:...
and replace them with
key=value
key value
key:value
That would solve about 50% of reconfiguration needs, and for the
rest you'd use Augeas, 'download'+'upload' or 'edit'.
RWMJ: I had a go at implementing this, but it's quite error-prone to
do this sort of editing inside the C-based daemon code. It's far
better to do it with Augeas, or else to use an external language like
Perl.
Quick Perl scripts
------------------
Currently we can't do Perl "one-liners". ie. The current syntax for
any short Perl one-liner would be:
perl -MSys::Guestfs -e '$g = Sys::Guestfs->new(); $g->add_drive ("foo"); $g->launch; $g->wait_ready; $g->mount ("/dev/sda1", "/"); ....'
You can see we're well beyond a single line just getting to the point
of adding drives and mounting.
First suggestion:
$h = create ($filename, \"/dev/sda1\" => \"/\");
$h = create ([$file1, $file2], \"/dev/sda1\" => \"/\");
To mount read-only, add C<ro =E<gt> 1> like this:
$h = create ($filename, \"/dev/sda1\" => \"/\", ro => 1);
which is equivalent to the following sequence of calls:
$h = Sys::Guestfs->new ();
$h->set_autosync (1);
$h->add_drive_ro ($filename);
$h->launch ();
$h->wait_ready ();
$h->mount_ro (\"/dev/sda1\", \"/\");
Command-line form would be:
perl -MSys::Guestfs=:all -e '$_=create("guest.img", "/dev/sda1" => "/"); $_->cat ("/etc/fstab");'
That's not brief enough for one-liners, so we could have an extra
autogenerated module which creates a Sys::Guestfs handle singleton
(the handle is an implicit global variable as in guestfish), eg:
perl -MSys::Guestfs::One -e 'inspect("guest.img"); cat ("/etc/fstab");'
How would editing files work?
ntfsclone
---------
Useful imaging tool:
http://man.linux-ntfs.org/ntfsclone.8.html
Standard images
virt-rescue pty
---------------
Equip guestfish with some standard images that it can load
quickly, eg:
See:
http://search.cpan.org/~rgiersig/IO-Tty-1.08/Pty.pm
http://www.perlmonks.org/index.pl?node_id=582185
load ext2
Note that pty requires cooperation inside the C code too (there are
two sides to a pty, and one has to be handled after the fork).
Maybe it's better to create these on the fly?
[I tried to implement this in the new C virt-rescue, but it doesn't
work. qemu is implementing its own ptys, and they are broken. Need
to fix qemu.]
Windows-based daemon/appliance
------------------------------
See discussion on list:
https://www.redhat.com/archives/libguestfs/2009-November/msg00165.html
virt-disk-explore
-----------------
For multi-level disk images such as live CDs:
http://rwmj.wordpress.com/2009/07/15/unpack-the-russian-doll-of-a-f11-live-cd/
It's possible with libguestfs to recursively look for anything that
might be a filesystem, mount-{,loop} it and look in those, revealing
anything in a disk image.
However this won't work easily for VM disk images in the disk image.
One would have to download those to the host and launch another
libguestfs instance.
[Not sure this is such a good idea. See also live CD inspection idea below.]
Map filesystems to disk blocks
------------------------------
Map files/filesystems/(any other object) to the actual disk
blocks they occupy.
And vice versa.
Is it even possible?
See also contribs/visualize-alignment/
Integration with host intrusion systems
---------------------------------------
Perfect way to monitor VMs from outside the VM. Look for file
hashes, log events, login/logout etc.
http://www.ossec.net/
http://la-samhna.de/samhain/
http://sourceforge.net/projects/aide/
http://osiris.shmoo.com/
http://sourceforge.net/projects/tripwire/
Freeze/thaw filesystems
-----------------------
Access to these ioctls:
http://git.kernel.org/linus/fcccf502540e3d7
Tips for new users in guestfish
-------------------------------
$ guestfish
Tip: You need to 'add disk.img' or 'alloc disk.img nn' to make a new image.
Type 'notips' to disable tips permanently.
><fs> add mydisk
Tip: You need to type 'run' before you can see into the disk image.
><fs> run
Tip: Use 'list-filesystems' to see what filesystems are available.
><fs> list-filesystems
/dev/vda1
Tip: Use 'mount fs /' to mount a filesystem.
><fs> mount /dev/vda1 /
Tip: Use 'll /' to view the filesystem or ...
><fs> ll /
Could we make guestfish interactive if commands are used without params?
------------------------------------------------------------------------
><fs> sparse
[[Prints man page]]
Image name? disk.img
Size of image? 10M
Better support for encrypted devices
------------------------------------
Currently LUKS support only works if the device contains volume
groups. If it contains, eg., partitions, you cannot access them.
We would like to add:
- Direct access to the /dev/mapper device (eg. if it contains
anything apart from VGs).
Display image as PS
-------------------
Display the structure of an image file as a PS.
Greater use of blkid / libblkid
-------------------------------
There are various useful functions in libblkid for listing partitions,
devices etc which we are essentially duplicating in the daemon. It
would make more sense to just use libblkid for this.
There are some places where we call out to the 'blkid' program. This
might be replaced by direct use of the library (if this is easier).
But it is very hard to be compatible between RHEL6 and RHEL5 when
using direct library.
Visualization
-------------
Eric Sandeen pointed out the blktrace tool which is a better way of
capturing traces than using patched qemu (see
contrib/visualize-alignment). We would still use the same
visualization tools in conjunction with blktrace traces.
guestfish parsing
-----------------
At the moment guestfish uses an ad hoc parser which has many
shortcomings. We should change to using a lex/yacc-based scanner and
parser (there are better parsers out there, but yacc is sufficient and
very widely available).
The scanner must deal with the case of parsing a whole command string,
eg. for a command that the user types in:
><fs> add-drive-opts "/tmp/foo" readonly:true
and also with parsing single words from the command line:
guestfish add-drive-opts /tmp/foo readonly:true
Note the quotes are for scanning and don't indicate types.
We should also allow variables and expressions as part of this new
parsing code, eg:
set roots inspect-os
set product inspect-get-product-name %{roots[0]}
% is better than $ because of shell escaping and confusion with shell
variables.
Can we combine this with ability to set and read environment
variables? Currently guestfish uses many environment variables like
$EDITOR without any corresponding ability to set them.
set EDITOR /usr/bin/emacs
echo $EDITOR # or %{EDITOR}
edit /etc/resolv.conf
More ntfs tools
---------------
ntfsprogs actually has a lot more useful tools than we currently
use. Interesting ones are:
ntfscluster: display file(s) that occupy a cluster or sector
ntfsinfo: print various information about NTFS volume and files
ntfs streams: extract alternate streams from NTFS files
ntfsck: checker for NTFS filesystems
Undelete files
--------------
Two useful tools:
- ext2undelete
- ntfsundelete
More mkfs_opts options
----------------------
Useful options to offer:
- Set label.
- Set UUID.
Use /proc/self/mountinfo
------------------------
This file contains lots of interesting information about
what is mounted and where. eg:
16 21 0:3 / /proc rw,relatime - proc /proc rw
17 21 0:16 / /sys rw,relatime - sysfs /sys rw,seclabel
18 23 0:5 / /dev rw,relatime - devtmpfs udev rw,seclabel,size=1906740k,nr_inodes=476685,mode=755
26 21 253:3 / /home rw,relatime - ext4 /dev/mapper/vg-lv_home rw,seclabel,barrier=1,data=ordered
This could be used instead of current hairy code to parse the output
of the 'mount' command. We could add new APIs to return kernel mount
options, type of filesystem at a mountpoint etc.
guestfish drive letters
-----------------------
There should be an option to mount all Windows drives as separate
paths, like C: => /c/, D: => /d/ etc.
More inspection features
------------------------
- last shutdown time
- DHCP address
- last time the software was updated
- last user who logged in
- lastlog, last, who
Integrate virt-inspector with CMDBs
-----------------------------------
Either integrate virt-inspector with Configuration Management
Databases (CMDBs) or at least check that virt-inspector produces the
right range of data so that integration would be possible. The
standards for CMDBs come from the DMTF, see eg:
http://dmtf.org/news/pr/2009/7/dmtf-releases-cmdbf-standard-federating-configuration-management-data
Efficient way to visit all files
--------------------------------
https://rwmj.wordpress.com/2010/12/15/tip-audit-virtual-machine-for-setuid-files/#content
A naive method would look like:
g#visit ~return_stats:true "/" (
fun pathname stat ->
...
)
However this has two disadvantages:
- requires hand-written custom bindings in each language
- unclear about locking, thread-safety and re-entrancy of handle g
A better way would be to have some sort of explicit "download all
filenames and stat structures", which could then be iterated over:
let files = g#find_opts ~return_stats:true "/" in
List.iter (
fun pathname stat ->
...
)
The problem with this is that 'files' is going to be larger than a
protocol buffer.
This leads to thinking about changes to the protocol / generator to
make this simpler. The proposal would be to add RBigStringList,
RBigStructList [or RBig (Ranytype ...)]. These would work like
FileOut, in that they would use file streaming to stream XDR
structures (probably written to a file on the library side).
Generated code would hide most of the implementation.
We also need to think about security issues: is it possible for the
daemon to keep sending back data forever, and if so what happens on
the library side.
[Users can now use virt-ls to solve some of these problems, but it is
not a general solution at the API level]
Interactive disk creator
------------------------
An interactive disk creator program.
Attach method for disconnected operation
----------------------------------------
http://libguestfs.org/guestfs.3.html#guestfs_set_attach_method
"Librarian" has an idea that he should be able to attach to a regular
appliance, but disconnect from it and reconnect to it later. This
would be some sort of modified attach method (see link above).
The complexity here is that we would no longer have access to
stdin/stdout (or we'd have to direct that somewhere else).
libosinfo mappings for virt-inspector
-------------------------------------
Return libosinfo mappings from inspection API.
virt-sysprep ideas
------------------
- other Spacewalk / RHN IDs (?)
- Windows sysprep
(see: https://github.com/clalancette/oz/blob/e74ce83283d468fd987583d6837b441608e5f8f0/oz/Windows.py )
- (librarian suggests ...)
. install a firstboot script virt-sysprep --script=/tmp/foo.sh
. run external guestfish script virt-sysprep --fish=/tmp/foo.fish
- if drives are encrypted, then dm-crypt key should be changed
and drives all re-encrypted
- /etc/pki
(Steve says ...)
Rpm uses nss. Nss sets up its crypto database in
/etc/pki. Depending on how long the machine ran before cloning, you
may have picked up some certificates or things. This is an area
that you would want to look into.
- secure erase of inodes etc using scrub (Steve Grubb)
- other directories that could require cleaning include:
/var/run/*
(thanks Marko Myllynen, James Antill)
- remove or modify UUIDs in /etc/fstab (eg. on Ubuntu)
(thanks Joshua Daniel Franklin)
As well as 'virt-sysprep' there is a case for a 'virt-customize' tool
which can customize templated guests. This would be useful within
companies/organizations that want to offer multiple guests, but all
customized with the organization logo etc. Some ideas:
- change the background image to some custom desktop
- change the sign-on messages (/etc/issue.net etc)
- firstboot script (as suggested by librarian above)
- Windows login script/service
Launch remote sessions over ssh
-------------------------------
We had an idea you could add a launch method that uses ssh, ie. all
febootstrap and qemu commands happen the same as now, but prefixed by
ssh so it happens on a remote machine.
Note that proper remote support and integration with libvirt is
different from this, and people are working on that. ssh would just
be "remote-lite".
virt-make-fs and virt-win-reg need to not be in Perl
----------------------------------------------------
Probably they should be in C or OCaml.
Integrate snap-type functionality in inspection tools
-----------------------------------------------------
Mo Morsi's "snap" program lets you describe a guest as the list of
packages (eg. RPMs) installed + changes made to those RPMs + files
added.
http://projects.morsi.org/wiki/Snap
This results in a compact description of the guest. He even managed
to do a kind of migration of guests by simply recreating the guest
from the description on the target machine.
It would be ideal to integrate this and/or use inspection to do this.
Ongoing code cleanups
---------------------
Examine every use of 'int' in C code for signed overflow problems.
All file descriptors in the library and daemon should normally be
opened with O_CLOEXEC. Therefore we need to examine every call to:
- open, openat
- creat
- pipe (see also: pipe2)
- dup, dup2 (see also: dup3)
- socket, socketpair
- accept (see also: accept4)
- signalfd, timerfd, epoll_create
virt-sparsify enhancements
--------------------------
TMPDIR should be checked to ensure that we won't run out of space
during the conversion, since current behaviour is very bad when this
happens (it usually causes virt-sparsify to hang). This requires
writing a small C binding to statvfs for OCaml.
'virt-sparsify --whitelist' option to generate skeletons (for
debugging, bug forensics, diagnosis). The whilelist option would
specify a list of files to be *preserved*. All other files in the
image would be replaced by equivalent files of zeroes, thus minimizing
the size of the debug image that needs to be shipped to us by the
customer.
Optimize the appliance
----------------------
Pass -cpu host. Anything else?
Sort out partitioning
---------------------
Ignoring some legacy APIs, we currently have a mixed selection of
'part-*' APIs, implemented using parted. We don't like parted or
libparted very much, and would love to replace it with something else.
The part-* APIs are quirky, but not too bad and we should maintain and
extend them instead of making another set of APIs.
One option is to write "libmbr" and "libgpt" libraries that would just
do MBR and GPT respectively, and do it directly and do it well. They
wouldn't try to abstract anything (so, unlike libparted). We could
then reimplement the part-* APIs on top of these hopefully sensible
libraries. This is a lot of work.
Another option is to look for tools or libraries to replace parted.
For GPT there is a fairly obvious candidate: Rod Smith's GPT fdisk
(http://www.rodsbooks.com/gdisk/). Rod has spent a lot of time
studying GPT, and seems to know more about it than any sane man
should. There is a command line tool designed for scripts called
'sgdisk'. The tools are packaged for many Linux distros. Even if
this approach works, it doesn't solve the MBR problem, so likely we'd
have to write a library for that (or perhaps go back to sfdisk but
using a very abstracted interface over sfdisk).

79
align/Makefile.am Normal file
View File

@@ -0,0 +1,79 @@
# libguestfs virt alignment tools
# Copyright (C) 2011 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = \
virt-alignment-scan.pod
CLEANFILES = stamp-virt-alignment-scan.pod
bin_PROGRAMS = virt-alignment-scan
SHARED_SOURCE_FILES = \
../fish/config.c \
../fish/inspect.c \
../fish/keys.c \
../fish/options.h \
../fish/options.c \
../fish/virt.c
virt_alignment_scan_SOURCES = \
$(SHARED_SOURCE_FILES) \
domains.c \
scan.c \
scan.h
virt_alignment_scan_CFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \
-I$(top_srcdir)/src -I$(top_builddir)/src \
-I$(top_srcdir)/fish \
-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(LIBCONFIG_CFLAGS) \
$(LIBVIRT_CFLAGS)
virt_alignment_scan_LDADD = \
$(LIBCONFIG_LIBS) \
$(top_builddir)/src/libguestfs.la \
../gnulib/lib/libgnu.la \
$(LIBVIRT_LIBS) \
-lm
# Manual pages and HTML files for the website.
man_MANS = virt-alignment-scan.1
noinst_DATA = $(top_builddir)/html/virt-alignment-scan.1.html
virt-alignment-scan.1 $(top_builddir)/html/virt-alignment-scan.1.html: stamp-virt-alignment-scan.pod
stamp-virt-alignment-scan.pod: virt-alignment-scan.pod
$(top_builddir)/podwrapper.sh \
--man virt-alignment-scan.1 \
--html $(top_builddir)/html/virt-alignment-scan.1.html \
$<
touch $@
# Tests.
# random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
# TESTS_ENVIRONMENT = \
# MALLOC_PERTURB_=$(random_val) \
# $(top_builddir)/run --test
# TESTS = test-virt-alignment-scan.sh

360
align/domains.c Normal file
View File

@@ -0,0 +1,360 @@
/* virt-alignment-scan
* Copyright (C) 2012 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libintl.h>
#include <assert.h>
#ifdef HAVE_LIBVIRT
#include <libvirt/libvirt.h>
#include <libvirt/virterror.h>
#endif
#include "progname.h"
#if defined(HAVE_LIBVIRT) && defined(HAVE_LIBXML2)
#define GUESTFS_PRIVATE_FOR_EACH_DISK 1
#endif
#include "guestfs.h"
#include "options.h"
#include "scan.h"
#if defined(HAVE_LIBVIRT) && defined(HAVE_LIBXML2)
/* The list of domains and disks that we build up in
* get_domains_from_libvirt.
*/
struct disk {
struct disk *next;
char *filename;
char *format; /* could be NULL */
};
struct domain {
char *name;
char *uuid;
struct disk *disks;
size_t nr_disks;
};
struct domain *domains = NULL;
size_t nr_domains;
static int
compare_domain_names (const void *p1, const void *p2)
{
const struct domain *d1 = p1;
const struct domain *d2 = p2;
return strcmp (d1->name, d2->name);
}
static void
free_domain (struct domain *domain)
{
struct disk *disk, *next;
for (disk = domain->disks; disk; disk = next) {
next = disk->next;
free (disk->filename);
free (disk->format);
free (disk);
}
free (domain->name);
free (domain->uuid);
}
static void add_domains_by_id (virConnectPtr conn, int *ids, size_t n);
static void add_domains_by_name (virConnectPtr conn, char **names, size_t n);
static void add_domain (virDomainPtr dom);
static int add_disk (guestfs_h *g, const char *filename, const char *format, int readonly, void *domain_vp);
static size_t add_disks_to_handle_reverse (struct disk *disk, size_t *errors_r);
static void reset_guestfs_handle (void);
void
get_domains_from_libvirt (int uuid, size_t *worst_alignment_ptr)
{
virErrorPtr err;
virConnectPtr conn;
int n;
size_t i, count, errors;
const char *prefix;
nr_domains = 0;
domains = NULL;
/* Get the list of all domains. */
conn = virConnectOpenReadOnly (libvirt_uri);
if (!conn) {
err = virGetLastError ();
fprintf (stderr,
_("%s: could not connect to libvirt (code %d, domain %d): %s\n"),
program_name, err->code, err->domain, err->message);
exit (EXIT_FAILURE);
}
n = virConnectNumOfDomains (conn);
if (n == -1) {
err = virGetLastError ();
fprintf (stderr,
_("%s: could not get number of running domains (code %d, domain %d): %s\n"),
program_name, err->code, err->domain, err->message);
exit (EXIT_FAILURE);
}
int ids[n];
n = virConnectListDomains (conn, ids, n);
if (n == -1) {
err = virGetLastError ();
fprintf (stderr,
_("%s: could not list running domains (code %d, domain %d): %s\n"),
program_name, err->code, err->domain, err->message);
exit (EXIT_FAILURE);
}
add_domains_by_id (conn, ids, n);
n = virConnectNumOfDefinedDomains (conn);
if (n == -1) {
err = virGetLastError ();
fprintf (stderr,
_("%s: could not get number of inactive domains (code %d, domain %d): %s\n"),
program_name, err->code, err->domain, err->message);
exit (EXIT_FAILURE);
}
char *names[n];
n = virConnectListDefinedDomains (conn, names, n);
if (n == -1) {
err = virGetLastError ();
fprintf (stderr,
_("%s: could not list inactive domains (code %d, domain %d): %s\n"),
program_name, err->code, err->domain, err->message);
exit (EXIT_FAILURE);
}
add_domains_by_name (conn, names, n);
/* You must free these even though the libvirt documentation doesn't
* mention it.
*/
for (i = 0; i < (size_t) n; ++i)
free (names[i]);
virConnectClose (conn);
/* No domains? */
if (nr_domains == 0)
return;
/* Sort the domains alphabetically by name for display. */
qsort (domains, nr_domains, sizeof (struct domain), compare_domain_names);
errors = 0;
for (i = 0; i < nr_domains; ++i) {
if (domains[i].disks == NULL)
continue;
count = add_disks_to_handle_reverse (domains[i].disks, &errors);
if (count == 0)
continue;
if (guestfs_launch (g) == -1)
exit (EXIT_FAILURE);
prefix = !uuid ? domains[i].name : domains[i].uuid;
/* Perform the scan. */
scan (worst_alignment_ptr, prefix);
if (i < nr_domains - 1)
reset_guestfs_handle ();
}
/* Free up domains structure. */
for (i = 0; i < nr_domains; ++i)
free_domain (&domains[i]);
free (domains);
if (errors > 0) {
fprintf (stderr, _("%s: failed to analyze a disk, see error(s) above\n"),
program_name);
exit (EXIT_FAILURE);
}
}
static void
add_domains_by_id (virConnectPtr conn, int *ids, size_t n)
{
size_t i;
virDomainPtr dom;
for (i = 0; i < n; ++i) {
if (ids[i] != 0) { /* RHBZ#538041 */
dom = virDomainLookupByID (conn, ids[i]);
if (dom) { /* transient errors are possible here, ignore them */
add_domain (dom);
virDomainFree (dom);
}
}
}
}
static void
add_domains_by_name (virConnectPtr conn, char **names, size_t n)
{
size_t i;
virDomainPtr dom;
for (i = 0; i < n; ++i) {
dom = virDomainLookupByName (conn, names[i]);
if (dom) { /* transient errors are possible here, ignore them */
add_domain (dom);
virDomainFree (dom);
}
}
}
static void
add_domain (virDomainPtr dom)
{
struct domain *domain;
domains = realloc (domains, (nr_domains + 1) * sizeof (struct domain));
if (domains == NULL) {
perror ("realloc");
exit (EXIT_FAILURE);
}
domain = &domains[nr_domains];
nr_domains++;
domain->name = strdup (virDomainGetName (dom));
if (domain->name == NULL) {
perror ("strdup");
exit (EXIT_FAILURE);
}
char uuid[VIR_UUID_STRING_BUFLEN];
if (virDomainGetUUIDString (dom, uuid) == 0) {
domain->uuid = strdup (uuid);
if (domain->uuid == NULL) {
perror ("strdup");
exit (EXIT_FAILURE);
}
}
else
domain->uuid = NULL;
domain->disks = NULL;
int n = guestfs___for_each_disk (g, dom, add_disk, domain);
if (n == -1)
exit (EXIT_FAILURE);
domain->nr_disks = n;
}
static int
add_disk (guestfs_h *g,
const char *filename, const char *format, int readonly,
void *domain_vp)
{
struct domain *domain = domain_vp;
struct disk *disk;
disk = malloc (sizeof *disk);
if (disk == NULL) {
perror ("malloc");
return -1;
}
disk->next = domain->disks;
domain->disks = disk;
disk->filename = strdup (filename);
if (disk->filename == NULL) {
perror ("malloc");
return -1;
}
if (format) {
disk->format = strdup (format);
if (disk->format == NULL) {
perror ("malloc");
return -1;
}
}
else
disk->format = NULL;
return 0;
}
static size_t
add_disks_to_handle_reverse (struct disk *disk, size_t *errors_r)
{
size_t nr_disks_added;
if (disk == NULL)
return 0;
nr_disks_added = add_disks_to_handle_reverse (disk->next, errors_r);
struct guestfs_add_drive_opts_argv optargs = { .bitmask = 0 };
optargs.bitmask |= GUESTFS_ADD_DRIVE_OPTS_READONLY_BITMASK;
optargs.readonly = 1;
if (disk->format) {
optargs.bitmask |= GUESTFS_ADD_DRIVE_OPTS_FORMAT_BITMASK;
optargs.format = disk->format;
}
if (guestfs_add_drive_opts_argv (g, disk->filename, &optargs) == -1) {
(*errors_r)++;
return nr_disks_added;
}
return nr_disks_added+1;
}
/* Close and reopen the libguestfs handle. */
static void
reset_guestfs_handle (void)
{
/* Copy the settings from the old handle. */
int verbose = guestfs_get_verbose (g);
int trace = guestfs_get_trace (g);
guestfs_close (g);
g = guestfs_create ();
if (g == NULL) {
fprintf (stderr, _("guestfs_create: failed to create handle\n"));
exit (EXIT_FAILURE);
}
guestfs_set_verbose (g, verbose);
guestfs_set_trace (g, trace);
}
#endif

318
align/scan.c Normal file
View File

@@ -0,0 +1,318 @@
/* virt-alignment-scan
* Copyright (C) 2011 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <inttypes.h>
#include <unistd.h>
#include <getopt.h>
#include <locale.h>
#include <assert.h>
#include <libintl.h>
#ifdef HAVE_LIBVIRT
#include <libvirt/libvirt.h>
#include <libvirt/virterror.h>
#endif
#include "progname.h"
#include "c-ctype.h"
#include "guestfs.h"
#include "options.h"
#include "scan.h"
/* These globals are shared with options.c. */
guestfs_h *g;
int read_only = 1;
int live = 0;
int verbose = 0;
int keys_from_stdin = 0;
int echo_keys = 0;
const char *libvirt_uri = NULL;
int inspector = 0;
static int quiet = 0; /* --quiet */
static inline char *
bad_cast (char const *s)
{
return (char *) s;
}
static void __attribute__((noreturn))
usage (int status)
{
if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
else {
fprintf (stdout,
_("%s: check alignment of virtual machine partitions\n"
"Copyright (C) 2011 Red Hat Inc.\n"
"Usage:\n"
" %s [--options] -d domname\n"
" %s [--options] -a disk.img [-a disk.img ...]\n"
"Options:\n"
" -a|--add image Add image\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" -d|--domain guest Add disks from libvirt guest\n"
" --format[=raw|..] Force disk format for -a option\n"
" --help Display brief help\n"
" -q|--quiet No output, just exit code\n"
" -v|--verbose Verbose messages\n"
" -V|--version Display version and exit\n"
" -x Trace libguestfs API calls\n"
"For more information, see the manpage %s(1).\n"),
program_name, program_name, program_name,
program_name);
}
exit (status);
}
int
main (int argc, char *argv[])
{
/* Set global program name that is not polluted with libtool artifacts. */
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEBASEDIR);
textdomain (PACKAGE);
enum { HELP_OPTION = CHAR_MAX + 1 };
static const char *options = "a:c:d:qvVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "connect", 1, 0, 'c' },
{ "domain", 1, 0, 'd' },
{ "format", 2, 0, 0 },
{ "help", 0, 0, HELP_OPTION },
{ "quiet", 0, 0, 'q' },
{ "uuid", 0, 0, 0, },
{ "verbose", 0, 0, 'v' },
{ "version", 0, 0, 'V' },
{ 0, 0, 0, 0 }
};
struct drv *drvs = NULL;
struct drv *drv;
const char *format = NULL;
int c;
int option_index;
int uuid = 0;
/* This just needs to be larger than any alignment we care about. */
size_t worst_alignment = UINT_MAX;
int exit_code;
g = guestfs_create ();
if (g == NULL) {
fprintf (stderr, _("guestfs_create: failed to create handle\n"));
exit (EXIT_FAILURE);
}
argv[0] = bad_cast (program_name);
for (;;) {
c = getopt_long (argc, argv, options, long_options, &option_index);
if (c == -1) break;
switch (c) {
case 0: /* options which are long only */
if (STREQ (long_options[option_index].name, "format")) {
if (!optarg || STREQ (optarg, ""))
format = NULL;
else
format = optarg;
} else if (STREQ (long_options[option_index].name, "uuid")) {
uuid = 1;
} else {
fprintf (stderr, _("%s: unknown long option: %s (%d)\n"),
program_name, long_options[option_index].name, option_index);
exit (EXIT_FAILURE);
}
break;
case 'a':
OPTION_a;
break;
case 'c':
OPTION_c;
break;
case 'd':
OPTION_d;
break;
case 'q':
quiet = 1;
break;
case 'v':
OPTION_v;
break;
case 'V':
OPTION_V;
break;
case 'x':
OPTION_x;
break;
case HELP_OPTION:
usage (EXIT_SUCCESS);
default:
usage (EXIT_FAILURE);
}
}
/* These are really constants, but they have to be variables for the
* options parsing code. Assert here that they have known-good
* values.
*/
assert (read_only == 1);
assert (inspector == 0);
assert (live == 0);
/* Must be no extra arguments on the command line. */
if (optind != argc)
usage (EXIT_FAILURE);
/* The user didn't specify any drives to scan. */
if (drvs == NULL) {
#if defined(HAVE_LIBVIRT) && defined(HAVE_LIBXML2)
get_domains_from_libvirt (uuid, &worst_alignment);
#else
fprintf (stderr, _("%s: compiled without support for libvirt and/or libxml2.\n"),
program_name);
exit (EXIT_FAILURE);
#endif
} else {
if (uuid) {
fprintf (stderr, _("%s: --uuid option cannot be used with -a or -d\n"),
program_name);
exit (EXIT_FAILURE);
}
/* Add domains/drives from the command line (for a single guest). */
add_drives (drvs, 'a');
if (guestfs_launch (g) == -1)
exit (EXIT_FAILURE);
/* Free up data structures, no longer needed after this point. */
free_drives (drvs);
/* Perform the scan. */
scan (&worst_alignment, NULL);
guestfs_close (g);
}
/* Decide on an appropriate exit code. */
if (worst_alignment < 10) /* 2^10 = 4096 */
exit_code = 3;
else if (worst_alignment < 16) /* 2^16 = 65536 */
exit_code = 2;
else
exit_code = 0;
exit (exit_code);
}
void
scan (size_t *worst_alignment, const char *prefix)
{
char **devices, *p;
size_t i, j;
size_t alignment;
uint64_t start;
struct guestfs_partition_list *parts;
devices = guestfs_list_devices (g);
if (devices == NULL)
exit (EXIT_FAILURE);
for (i = 0; devices[i] != NULL; ++i) {
parts = guestfs_part_list (g, devices[i]);
if (parts == NULL)
exit (EXIT_FAILURE);
/* Canonicalize the name of the device for printing. */
p = guestfs_canonical_device_name (g, devices[i]);
if (p == NULL)
exit (EXIT_FAILURE);
free (devices[i]);
devices[i] = p;
for (j = 0; j < parts->len; ++j) {
/* Start offset of the partition in bytes. */
start = parts->val[j].part_start;
if (!quiet) {
if (prefix)
printf ("%s:", prefix);
printf ("%s%d %12" PRIu64 " ",
devices[i], (int) parts->val[j].part_num, start);
}
/* What's the alignment? */
if (start == 0) /* Probably not possible, but anyway. */
alignment = 64;
else
for (alignment = 0; (start & 1) == 0; alignment++, start /= 2)
;
if (!quiet) {
if (alignment < 10)
printf ("%12" PRIu64 " ", UINT64_C(1) << alignment);
else if (alignment < 64)
printf ("%12" PRIu64 "K ", UINT64_C(1) << (alignment - 10));
else
printf ("- ");
}
if (alignment < *worst_alignment)
*worst_alignment = alignment;
if (alignment < 12) { /* Bad in general: < 4K alignment */
if (!quiet)
printf ("bad (%s)\n", _("alignment < 4K"));
} else if (alignment < 16) { /* Bad on NetApps: < 64K alignment */
if (!quiet)
printf ("bad (%s)\n", _("alignment < 64K"));
} else {
if (!quiet)
printf ("ok\n");
}
}
guestfs_free_partition_list (parts);
free (devices[i]);
}
free (devices);
}

30
align/scan.h Normal file
View File

@@ -0,0 +1,30 @@
/* virt-alignment-scan
* Copyright (C) 2012 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef GUESTFS_VIRT_ALIGNMENT_SCAN_H_
#define GUESTFS_VIRT_ALIGNMENT_SCAN_H_
/* domains.c */
#if defined(HAVE_LIBVIRT) && defined(HAVE_LIBXML2)
extern void get_domains_from_libvirt (int uuid, size_t *worst_alignment);
#endif
/* scan.c */
extern void scan (size_t *worst_alignment, const char *prefix);
#endif /* GUESTFS_VIRT_ALIGNMENT_SCAN_H_ */

404
align/virt-alignment-scan.pod Executable file
View File

@@ -0,0 +1,404 @@
=encoding utf8
=head1 NAME
virt-alignment-scan - Check alignment of virtual machine partitions
=head1 SYNOPSIS
virt-alignment-scan [--options] -d domname
virt-alignment-scan [--options] -a disk.img [-a disk.img ...]
virt-alignment-scan [--options]
=head1 DESCRIPTION
When older operating systems install themselves, the partitioning
tools place partitions at a sector misaligned with the underlying
storage (commonly the first partition starts on sector C<63>).
Misaligned partitions can result in an operating system issuing more
I/O than should be necessary.
The virt-alignment-scan tool checks the alignment of partitions in
virtual machines and disk images and warns you if there are alignment
problems.
Currently there is no virt tool for fixing alignment problems. You
can only reinstall the guest operating system. The following NetApp
document summarises the problem and possible solutions:
L<http://media.netapp.com/documents/tr-3747.pdf>
=head1 OUTPUT
To run this tool on a disk image directly, use the I<-a> option:
$ virt-alignment-scan -a winxp.img
/dev/sda1 32256 512 bad (alignment < 4K)
$ virt-alignment-scan -a fedora16.img
/dev/sda1 1048576 1024K ok
/dev/sda2 2097152 2048K ok
/dev/sda3 526385152 2048K ok
To run the tool on a guest known to libvirt, use the I<-d> option and
possibly the I<-c> option:
# virt-alignment-scan -d RHEL5
/dev/sda1 32256 512 bad (alignment < 4K)
/dev/sda2 106928640 512 bad (alignment < 4K)
$ virt-alignment-scan -c qemu:///system -d Win7TwoDisks
/dev/sda1 1048576 1024K ok
/dev/sda2 105906176 1024K ok
/dev/sdb1 65536 64K ok
Run virt-alignment-scan without any I<-a> or I<-d> options to scan all
libvirt domains.
# virt-alignment-scan
F16x64:/dev/sda1 1048576 1024K ok
F16x64:/dev/sda2 2097152 2048K ok
F16x64:/dev/sda3 526385152 2048K ok
The output consists of 4 or more whitespace-separated columns. Only
the first 4 columns are significant if you want to parse this from a
program. The columns are:
=over 4
=item col 1
The device and partition name (eg. C</dev/sda1> meaning the
first partition on the first block device).
When listing all libvirt domains (no I<-a> or I<-d> option given) this
column is prefixed by the libvirt name or UUID (if I<--uuid> is
given). eg: C<WinXP:/dev/sda1>
=item col 2
the start of the partition in bytes
=item col 3
the alignment in bytes or Kbytes (eg. C<512> or C<4K>)
=item col 4
C<ok> if the alignment is best for performance, or C<bad> if the
alignment can cause performance problems
=item cols 5+
optional free-text explanation.
=back
The exit code from the program changes depending on whether poorly
aligned partitions were found. See L</EXIT STATUS> below.
If you just want the exit code with no output, use the I<-q> option.
=head1 OPTIONS
=over 4
=item B<--help>
Display brief help.
=item B<-a> file
=item B<--add> file
Add I<file> which should be a disk image from a virtual machine.
The format of the disk image is auto-detected. To override this and
force a particular format use the I<--format=..> option.
=item B<-c> URI
=item B<--connect> URI
If using libvirt, connect to the given I<URI>. If omitted, then we
connect to the default libvirt hypervisor.
If you specify guest block devices directly (I<-a>), then libvirt is
not used at all.
=item B<-d> guest
=item B<--domain> guest
Add all the disks from the named libvirt guest. Domain UUIDs can be
used instead of names.
=item B<--format=raw|qcow2|..>
=item B<--format>
The default for the I<-a> option is to auto-detect the format of the
disk image. Using this forces the disk format for I<-a> options which
follow on the command line. Using I<--format> with no argument
switches back to auto-detection for subsequent I<-a> options.
For example:
virt-alignment-scan --format=raw -a disk.img
forces raw format (no auto-detection) for C<disk.img>.
virt-alignment-scan --format=raw -a disk.img --format -a another.img
forces raw format (no auto-detection) for C<disk.img> and reverts to
auto-detection for C<another.img>.
If you have untrusted raw-format guest disk images, you should use
this option to specify the disk format. This avoids a possible
security problem with malicious guests (CVE-2010-3851).
=item B<-q>
=item B<--quiet>
Don't produce any output. Just set the exit code
(see L</EXIT STATUS> below).
=item B<--uuid>
Print UUIDs instead of names. This is useful for following a guest
even when the guest is migrated or renamed, or when two guests happen
to have the same name.
This option only applies when listing all libvirt domains (when no
I<-a> or I<-d> options are specified).
=item B<-v>
=item B<--verbose>
Enable verbose messages for debugging.
=item B<-V>
=item B<--version>
Display version number and exit.
=item B<-x>
Enable tracing of libguestfs API calls.
=back
=head1 RECOMMENDED ALIGNMENT
Operating systems older than Windows 2008 and Linux before ca.2010
place the first sector of the first partition at sector 63, with a 512
byte sector size. This happens because of a historical accident.
Drives have to report a cylinder / head / sector (CHS) geometry to the
BIOS. The geometry is completely meaningless on modern drives, but it
happens that the geometry reported always has 63 sectors per track.
The operating system therefore places the first partition at the start
of the second "track", at sector 63.
When the guest OS is virtualized, the host operating system and
hypervisor may prefer accesses aligned to one of:
=over 4
=item * 512 bytes
if the host OS uses local storage directly on hard drive partitions,
and the hard drive has 512 byte physical sectors.
=item * 4 Kbytes
for local storage on new hard drives with 4Kbyte physical sectors; for
file-backed storage on filesystems with 4Kbyte block size; or for some
types of network-attached storage.
=item * 64 Kbytes
for high-end network-attached storage. This is the optimal block size
for some NetApp hardware.
=item * 1 Mbyte
see L</1 MB PARTITION ALIGNMENT> below.
=back
Partitions which are not aligned correctly to the underlying
storage cause extra I/O. For example:
sect#63
+--------------------------+------
| guest |
| filesystem block |
---+------------------+------+-------------------+-----+---
| host block | host block |
| | |
---+-------------------------+-------------------------+---
In this example, each time a 4K guest block is read, two blocks on the
host must be accessed (so twice as much I/O is done). When a 4K guest
block is written, two host blocks must first be read, the old and new
data combined, and the two blocks written back (4x I/O).
=head2 LINUX HOST BLOCK AND I/O SIZE
New versions of the Linux kernel expose the physical and logical block
size, and minimum and recommended I/O size.
For a typical consumer hard drive with 512 byte sectors:
$ cat /sys/block/sda/queue/hw_sector_size
512
$ cat /sys/block/sda/queue/physical_block_size
512
$ cat /sys/block/sda/queue/logical_block_size
512
$ cat /sys/block/sda/queue/minimum_io_size
512
$ cat /sys/block/sda/queue/optimal_io_size
0
For a new consumer hard drive with 4Kbyte sectors:
$ cat /sys/block/sda/queue/hw_sector_size
4096
$ cat /sys/block/sda/queue/physical_block_size
4096
$ cat /sys/block/sda/queue/logical_block_size
4096
$ cat /sys/block/sda/queue/minimum_io_size
4096
$ cat /sys/block/sda/queue/optimal_io_size
0
For a NetApp LUN:
$ cat /sys/block/sdc/queue/logical_block_size
512
$ cat /sys/block/sdc/queue/physical_block_size
512
$ cat /sys/block/sdc/queue/minimum_io_size
4096
$ cat /sys/block/sdc/queue/optimal_io_size
65536
The NetApp allows 512 byte accesses (but they will be very
inefficient), prefers a minimum 4K I/O size, but the optimal I/O size
is 64K.
For detailed information about what these numbers mean, see
L<http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/newstorage-iolimits.html>
[Thanks to Matt Booth for providing 4K drive data. Thanks to Mike
Snitzer for providing NetApp data and additional information.]
=head2 1 MB PARTITION ALIGNMENT
Microsoft picked 1 MB as the default alignment for all partitions
starting with Windows 2008 Server, and Linux has followed this.
Assuming 512 byte sectors in the guest, you will now see the first
partition starting at sector 2048, and subsequent partitions (if any)
will start at a multiple of 2048 sectors.
1 MB alignment is compatible with all current alignment requirements
(4K, 64K) and provides room for future growth in physical block sizes.
=head2 SETTING ALIGNMENT
L<virt-resize(1)> can change the alignment of the partitions of some
guests. Currently it can fully align all the partitions of all
Windows guests, and it will fix the bootloader where necessary. For
Linux guests, it can align the second and subsequent partitions, so
the majority of OS accesses except at boot will be aligned.
Another way to correct partition alignment problems is to reinstall
your guest operating systems. If you install operating systems from
templates, ensure these have correct partition alignment too.
For older versions of Windows, the following NetApp document contains
useful information: L<http://media.netapp.com/documents/tr-3747.pdf>
For Red Hat Enterprise Linux E<le> 5, use a Kickstart script that
contains an explicit C<%pre> section that creates aligned partitions
using L<parted(8)>. Do not use the Kickstart C<part> command. The
NetApp document above contains an example.
=head1 SHELL QUOTING
Libvirt guest names can contain arbitrary characters, some of which
have meaning to the shell such as C<#> and space. You may need to
quote or escape these characters on the command line. See the shell
manual page L<sh(1)> for details.
=head1 EXIT STATUS
This program returns:
=over 4
=item *
0
successful exit, all partitions are aligned E<ge> 64K for best performance
=item *
1
an error scanning the disk image or guest
=item *
2
successful exit, some partitions have alignment E<lt> 64K which can result
in poor performance on high end network storage
=item *
3
successful exit, some partitions have alignment E<lt> 4K which can result
in poor performance on most hypervisors
=back
=head1 SEE ALSO
L<guestfs(3)>,
L<guestfish(1)>,
L<virt-filesystems(1)>,
L<virt-rescue(1)>,
L<virt-resize(1)>,
L<http://libguestfs.org/>.
=head1 AUTHOR
Richard W.M. Jones L<http://people.redhat.com/~rjones/>
=head1 COPYRIGHT
Copyright (C) 2011 Red Hat Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

View File

@@ -13,136 +13,101 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Old RHEL 5 autoconf doesn't have builddir.
builddir ?= .
include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = \
libguestfs-supermin-helper \
kmod.whitelist.in \
packagelist.in \
excludelist.in \
guestfsd.suppressions \
init \
debian/modules/install_kernel \
debian/modules/y0_install-guestfsd \
debian/modules/z99_final-cleanups \
debian/debirf.conf.in
libguestfs-make-fixed-appliance.in \
libguestfs-make-fixed-appliance.pod \
make.sh.in \
packagelist.in
# Build the root filesystem (appliance).
# Currently this is arch-dependent, so it seems like putting it in
# $(libdir) is best. When we build cross-architecture filesystems we
# should probably move them to $(datadir).
fsdir = $(libdir)/guestfs
fs_DATA = $(APPLIANCE_FILES)
superminfsdir = $(libdir)/guestfs/supermin.d
# These are the resulting output files from the whole process:
# VMLINUZ kernel for the full appliance
# INITRAMFSIMG initramfs (ie. root fs) for the full appliance
# For details of the supermin appliance, read the README file:
# SUPERMINIMG initramfs (ie. partial root fs) for the supermin appliance
# SUPERMINFILES list of missing files (the ones we will pull out of the
# host filesystem at runtime) in the supermin appliance
APPLIANCE_FILES = $(INITRAMFSIMG) $(VMLINUZ)
if SUPERMIN
APPLIANCE_FILES += $(SUPERMINIMG) $(SUPERMINFILES) kmod.whitelist
bin_SCRIPTS = libguestfs-supermin-helper
fs_DATA =
superminfs_DATA = \
supermin.d/base.img \
supermin.d/daemon.img \
supermin.d/init.img \
supermin.d/hostfiles
# This used to be a configure-generated file (as is update.sh still).
# However config.status always touches the destination file, which
# means the appliance got rebuilt too often.
make.sh: make.sh.in
cd $(top_builddir) && \
./config.status --file=appliance/$@-t:appliance/$<
chmod +x $@-t
mv $@-t $@
PACKAGELIST_CPP_FLAGS = -D$(DISTRO)=1
if VALGRIND_DAEMON
PACKAGELIST_CPP_FLAGS += -DVALGRIND_DAEMON=1
endif
# Don't change these names - they must be the same as in '*.sh' scripts.
INITRAMFSIMG = initramfs.$(REPO).$(host_cpu).img
VMLINUZ = vmlinuz.$(REPO).$(host_cpu)
if SUPERMIN
SUPERMINIMG = initramfs.$(REPO).$(host_cpu).supermin.img
SUPERMINFILES = initramfs.$(REPO).$(host_cpu).supermin.hostfiles
endif
# This is for building the normal appliance:
$(INITRAMFSIMG) $(VMLINUZ): $(top_builddir)/initramfs/fakeroot.log
$(top_builddir)/initramfs/fakeroot.log: make.sh kmod.whitelist packagelist
mv $(INITRAMFSIMG) $(INITRAMFSIMG).bak 2>/dev/null; :
mv $(VMLINUZ) $(VMLINUZ).bak 2>/dev/null; :
if ! bash make.sh; then rm -f $@; exit 1; fi
$(INITRAMFSIMG): $(top_builddir)/initramfs/fakeroot.log $(top_builddir)/daemon/guestfsd init update.sh
rm -f $@
bash update.sh
touch $@
kmod.whitelist: kmod.whitelist.in
grep -v '^[[:space:]]*$$' < $< | grep -v '^#' > $@
packagelist: packagelist.in
cpp -undef -D$(DIST)=1 < $< | \
grep -v '^[[:space:]]*$$' | grep -v '^#' > $@
cpp -undef $(PACKAGELIST_CPP_FLAGS) < $< | \
grep -v '^[[:space:]]*$$' | grep -v '^#' > $@-t
mv $@-t $@
# This is for building the supermin appliance. It has to be enabled
# specifically with './configure --enable-supermin'. You really need
# to read the README file.
excludelist: excludelist.in
cpp -undef $(PACKAGELIST_CPP_FLAGS) < $< | \
grep -v '^[[:space:]]*$$' | grep -v '^#' > $@-t
mv $@-t $@
if SUPERMIN
# First we need to decide which files go in and out of the supermin
# appliance. This decision is made by 'supermin-split.sh'.
$(SUPERMINFILES): supermin.incfiles
supermin.incfiles: $(top_builddir)/initramfs/fakeroot.log $(top_builddir)/daemon/guestfsd supermin-split.sh
rm -f supermin.incfiles $(SUPERMINFILES)
bash supermin-split.sh
# Second we need to create a supermin appliance with just the included
# files (leaving out the host files, which we'll add back at runtime).
$(SUPERMINIMG): supermin.incfiles supermin-make.sh
rm -f $@
bash supermin-make.sh
endif
# Extra symlinks needed by the Debian appliance.
debirf_symlinks = \
a0_prep-root \
z0_remove-aptitude \
z0_remove-locales \
z1_clean-root
noinst_DATA = $(debirf_symlinks:%=debian/modules/%)
$(debirf_symlinks:%=debian/modules/%): stamp-debirf-modules
stamp-debirf-modules:
mkdir -p debian/modules
for f in $(debirf_symlinks); do \
ln -sf /usr/share/debirf/modules/$$f debian/modules/$$f; \
done
supermin.d/base.img supermin.d/hostfiles: stamp-supermin
stamp-supermin: make.sh packagelist excludelist
mkdir -p supermin.d
rm -f $@ supermin.d/base.img supermin.d/hostfiles
./make.sh
touch $@
#----------------------------------------------------------------------
# Extra rules for testing the appliance.
supermin.d/daemon.img: ../daemon/guestfsd guestfsd.suppressions
mkdir -p supermin.d
rm -f $@ $@-t
rm -rf tmp
mkdir -p tmp$(DAEMON_SUPERMIN_DIR) tmp/etc
ln ../daemon/guestfsd tmp$(DAEMON_SUPERMIN_DIR)/guestfsd
ln $(srcdir)/guestfsd.suppressions tmp/etc/guestfsd.suppressions
( cd tmp && find | cpio --quiet -o -H newc ) > $@-t
rm -rf tmp
mv $@-t $@
# Test-boot the appliance.
supermin.d/init.img: init
cmp -s $(srcdir)/init $(builddir)/init || cp $(srcdir)/init $(builddir)/init
mkdir -p supermin.d
rm -f $@ $@-t
echo "init" | cpio --quiet -o -H newc > $@-t
mv $@-t $@
test-boot: emptydisk
qemu-system-$(host_cpu) \
-m 384 \
-kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
-hda emptydisk
# libguestfs-make-fixed-appliance script and man page.
emptydisk:
rm -f emptydisk
dd if=/dev/zero of=emptydisk bs=1024 count=1440
echo 0, | sfdisk -q -C 80 -H 2 -S 18 emptydisk > /dev/null
sbin_SCRIPTS = libguestfs-make-fixed-appliance
# This is a more realistic test boot command line which better
# reflects what the library does.
man_MANS = libguestfs-make-fixed-appliance.1
test-boot-realistic: emptydisk
qemu-system-$(host_cpu) \
-m 384 \
-kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
-hda emptydisk \
-append "console=ttyS0 guestfs=10.0.2.4:6666 guestfs_rescue=1" \
-nographic \
-serial stdio \
-net channel,6666:unix:/tmp/sock,server,nowait \
-net user,vlan=0 \
-net nic,model=virtio,vlan=0
libguestfs-make-fixed-appliance.1 $(top_builddir)/html/libguestfs-make-fixed-appliance.1.html: stamp-libguestfs-make-fixed-appliance.pod
stamp-libguestfs-make-fixed-appliance.pod: libguestfs-make-fixed-appliance.pod
$(top_builddir)/podwrapper.sh \
--man libguestfs-make-fixed-appliance.1 \
--html $(top_builddir)/html/libguestfs-make-fixed-appliance.1.html \
$<
touch $@
# Make clean.
CLEANFILES = $(APPLIANCE_FILES) packagelist kmod.whitelist supermin.incfiles
CLEANFILES = packagelist excludelist \
libguestfs-make-fixed-appliance.1 \
stamp-libguestfs-make-fixed-appliance.pod
clean-local:
rm -rf $(top_builddir)/initramfs
rm -rf supermin.d

View File

@@ -1,5 +0,0 @@
DEBIRF_LABEL="debirf-libguestfs"
DEBIRF_SUITE=@REPO@
DEBIRF_MIRROR=@MIRROR@/${DEBIRF_DISTRO}
DEBIRF_KERNEL_ARCH=@DEBIAN_KERNEL_ARCH@
DEBIRF_METHOD=stupid_simple

View File

@@ -1 +0,0 @@
/usr/share/debirf/modules/a0_prep-root

View File

@@ -1,68 +0,0 @@
#!/bin/bash -e
# debirf module: install-kernel
# install a kernel package, indicated by the expected environment
# variables:
# DEBIRF_PATH
# DEBIRF_ROOT
# DEBIRF_KERNEL_PACKAGE
#
# *** REQUIRED MODULE ***
# WARNING: this module is necessary for proper functioning of debirf.
#
# The debirf scripts were written by
# Jameson Rollins <jrollins@fifthhorseman.net>
# and
# Daniel Kahn Gillmor <dkg-debian.org@fifthhorseman.net>.
#
# They are Copyright 2007, and are all released under the GPL,
# version 3 or later.
# clear out old modules if they exist, to avoid confusion
rm -rf "$DEBIRF_ROOT/lib/modules"
# download/copy in kernel package
if [ -z "$DEBIRF_KERNEL_PACKAGE" ] ; then
# determine kernel to install. assume arch of build host.
# determine kernel arch. need everything after the kernel version
# and debian version
if [ -z "$DEBIRF_KERNEL_ARCH" ]; then
KARCH=$(uname -r | cut -d- -f3-)
else
KARCH="$DEBIRF_KERNEL_ARCH"
fi
# determine the full kernel version from the dependency of the
# generic 2.6-ARCH package in the debirf root (since it may be
# different than what is installed on the build host)
KNAME=$(debirf_exec apt-cache show linux-image-2.6-"$KARCH" | grep '^Depends: ' | sed 's/^Depends: //')
# download only the desired kernel package directly into the apt
# cache for dpkg extraction
debirf_exec sh -c "cd /var/cache/apt/archives/ && aptitude download \"$KNAME\""
else
# install kernel deb if given at command line
debirf_exec sh -c "cd /var/cache/apt/archives/ && aptitude download \"$DEBIRF_KERNEL_PACKAGE\""
fi
KPKG=$(basename "$DEBIRF_ROOT"/var/cache/apt/archives/linux-image-2.6.*)
echo "extracting kernel package $KPKG..."
debirf_exec dpkg --extract /var/cache/apt/archives/"$KPKG" /
# install the module init tools, since they are needed for depmod
debirf_exec apt-get --assume-yes install module-init-tools
# depmod to create module list
KVERS=$(ls -1 -t "$DEBIRF_ROOT/lib/modules" | head -n1)
echo "generating modules.dep..."
debirf_exec depmod -a "$KVERS"
# extract kernel and debian stock initrd from the build root:
mv "$DEBIRF_ROOT"/boot/vmlinu* "$DEBIRF_BUILDD"
# remove kernel symlinks
if [ -L "$DEBIRF_ROOT"/vmlinuz ] ; then
rm "$DEBIRF_BUILDD"/vmlinuz
fi

View File

@@ -1,32 +0,0 @@
#!/bin/bash -e
# install guestfsd specific stuff
# Kernel modules take up nearly half of the image. Only include ones
# which are on the whitelist.
exec 5<../appliance/kmod.whitelist
whitelist=
while read kmod 0<&5; do
whitelist="$whitelist -a -not -name $kmod"
done
exec 5<&-
echo "Module whitelist: $whitelist"
find $DEBIRF_ROOT/lib/modules/*/kernel -name '*.ko' $whitelist -a -exec rm '{}' \;
# install additional packages:
PKGLIST=$(< packagelist)
echo "Will add $PKGLIST"
debirf_exec aptitude -R -y install $PKGLIST
debirf_exec aptitude -y remove vim-tiny dhcp3-client iptables
debirf_exec mkdir -p --mode=0777 /sysroot
# cleanup some other heavy lifters:
rm -rf "$DEBIRF_ROOT"/usr/share/doc/
rm -rf "$DEBIRF_ROOT"/usr/share/zoneinfo/
rm -rf "$DEBIRF_ROOT"/usr/share/man/
# Install the actual appliance:
echo $PWD
install -o root -g root -m 0755 ../daemon/guestfsd "$DEBIRF_ROOT"/sbin/guestfsd
install -o root -g root -m 0755 init "$DEBIRF_ROOT"/sbin/init

View File

@@ -1 +0,0 @@
/usr/share/debirf/modules/z0_remove-aptitude

View File

@@ -1 +0,0 @@
/usr/share/debirf/modules/z0_remove-locales

View File

@@ -1 +0,0 @@
/usr/share/debirf/modules/z1_clean-root

View File

@@ -1,3 +0,0 @@
#!/bin/sh
rm -rf "$DEBIRF_ROOT"/var/lib/dpkg/info

52
appliance/excludelist.in Normal file
View File

@@ -0,0 +1,52 @@
/* This is the list of distro packages which are
* excluded from the appliance, even if they appear in
* packagelist.in (or more likely, as dependencies of
* packages in packagelist.in).
*
* List is a list of basic regular expressions, one per line.
*
* This file is processed by cpp with one of the
* following symbols defined (depending on the distro):
*
* REDHAT=1 For Fedora, RHEL, EPEL and workalikes.
* DEBIAN=1 For Debian.
* UBUNTU=1 For Ubuntu.
* ARCHLINUX=1 For Archlinux.
*
* Note that any file provided by one of these packages will
* be dropped from the appliance. Of course, this may break
* the appliance, so be careful. Other files are also dropped
* from the appliance such as docs and man pages: see 'make.sh.in'
* for the full details.
*/
/* Basically the same with a few minor tweaks. */
#ifdef UBUNTU
#define DEBIAN 1
#endif
/* Don't need any Perl or Python appearing in the appliance. */
^perl
^python
/* Plymouth is a graphical boot thing - not needed. */
^plymouth
/* Linux firmware. Note that febootstrap itself excludes the kernel
* which is also not needed since we get the kernel, modules etc
* from the host at appliance boot.
*/
^linux-firmware
/* Keyboard maps - appliance is not interactive. */
^kbd-misc
#ifdef REDHAT
^fedora-logos
^redhat-logos
^dracut
#endif
#ifdef DEBIAN
^file-rc
#endif

View File

@@ -0,0 +1,19 @@
# This file is only used when libguestfs is configured with
#
# ./configure --enable-valgrind-daemon
#
# (only used for development, and only used in the regular supermin
# appliance, not libguestfs live).
#
# If there are any valgrind errors in the base libraries such as
# glibc, then we can suppress them here, so we only see errors in
# libguestfs daemon code.
# libdl
{
libdl_index_cond
Memcheck:Cond
fun:index
fun:expand_dynamic_string_token
fun:_dl_map_object
}

View File

@@ -2,66 +2,155 @@
echo Starting /init script ...
PATH=/sbin:/usr/sbin:$PATH
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
# Debian bug 606622.
RUNLEVEL=S
PREVLEVEL=N
export RUNLEVEL PREVLEVEL
mkdir -p /sysroot
if [ ! -d /proc ]; then rm -f /proc; fi
mkdir -p /proc
mount -t proc /proc /proc
if [ ! -d /sys ]; then rm -f /sys; fi
mkdir -p /sys
mount -t sysfs /sys /sys
mkdir -p /run/lock
if [ -x /etc/init.d/udev ]; then
/etc/init.d/udev start
elif [ -x /sbin/start_udev ]; then
/sbin/start_udev
# devtmpfs is required since udev 176
mount -t devtmpfs /dev /dev
if [ ! -L /etc/init.d/udev -a -x /etc/init.d/udev ]; then
if type service >/dev/null 2>&1; then
service udev start
else
/etc/init.d/udev start
fi
elif [ -x /sbin/start_udev ] && /sbin/start_udev; then
:
else
echo No udev, creating /dev manually
mount -t tmpfs none /dev
mkdir /dev/pts /dev/shm /dev/mapper
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
# Must do each MAKEDEV individually, because if one device fails,
# MAKEDEV will quit without creating the rest (RHBZ#507374).
for dev in mem null port zero core full ram tty console fd \
hda hdb hdc hdd sda sdb sdc sdd loop sd; do
MAKEDEV $dev ||:
# Find udevd and run it directly.
for f in /sbin/udevd /lib/udev/udevd /lib/systemd/systemd-udevd; do
if [ -x "$f" ]; then UDEVD="$f"; fi
done
mknod /dev/ptmx c 5 2; chmod 0666 /dev/ptmx
mknod /dev/random c 1 8; chmod 0666 /dev/random
mknod /dev/urandom c 1 9; chmod 0444 /dev/urandom
ln -sf /proc/self/fd/0 /dev/stdin
ln -sf /proc/self/fd/1 /dev/stdout
ln -sf /proc/self/fd/2 /dev/stderr
if [ -n "$UDEVD" ]; then
echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
$UDEVD --daemon
udevadm trigger
udevadm settle --timeout=600
else
echo No udevd, creating /dev manually.
mount -t tmpfs none /dev
mkdir /dev/pts /dev/shm /dev/mapper
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
# Must do each MAKEDEV individually, because if one device fails,
# MAKEDEV will quit without creating the rest (RHBZ#507374).
for dev in mem null port zero core full ram tty console fd \
hda hdb hdc hdd sda sdb sdc sdd loop sd; do
MAKEDEV $dev ||:
done
mknod /dev/ptmx c 5 2; chmod 0666 /dev/ptmx
mknod /dev/random c 1 8; chmod 0666 /dev/random
mknod /dev/urandom c 1 9; chmod 0444 /dev/urandom
ln -sf /proc/self/fd/0 /dev/stdin
ln -sf /proc/self/fd/1 /dev/stdout
ln -sf /proc/self/fd/2 /dev/stderr
modprobe virtio_pci
modprobe virtio_net
modprobe virtio_pci
modprobe virtio_net
fi
fi
if grep -sq selinux=1 /proc/cmdline; then
mount -t selinuxfs none /selinux
fi
modprobe dm_mod ||:
# Update the system clock.
hwclock -u -s
ifconfig lo 127.0.0.1
ifconfig eth0 10.0.2.10
route add default gw 10.0.2.2
# Set up the network.
ip addr add 127.0.0.1/8 brd + dev lo scope host
ip link set dev lo up
ip addr add 169.254.2.10/16 brd + dev eth0 scope global
ip link set dev eth0 up
ip route add default via 169.254.2.2
# Scan for MDs.
mdadm -As --auto=yes --run
# Scan for LVM.
modprobe dm_mod ||:
lvm vgscan --ignorelockingfailure
lvm vgchange -ay --ignorelockingfailure
# Keep these to enhance the usefulness of debug output.
ls -l /dev
cat /proc/mounts
lvm pvs
lvm vgs
lvm lvs
ifconfig
netstat -rn
lsmod
#ping -n -v -c 5 10.0.2.2
#ping -n -v -c 5 10.0.2.4
# Improve virtio-blk performance (RHBZ#509383).
for f in /sys/block/vd*/queue/rotational; do echo 1 > $f; done
if grep -sq guestfs_rescue=1 /proc/cmdline; then
bash -i
# http://kbase.redhat.com/faq/docs/DOC-5428
# Disabled this until https://bugzilla.redhat.com/show_bug.cgi?id=630583
# is fixed (broken in Linux 2.6.36).
#for f in /sys/block/[hsv]d*/queue/scheduler; do echo noop > $f; done
# These are useful when debugging.
if grep -sq guestfs_verbose=1 /proc/cmdline; then
ls -lR /dev
cat /proc/mounts
lvm pvs
lvm vgs
lvm lvs
ip a
ip r
lsmod
#hwclock -r
date
#ping -n -v -c 5 10.0.2.2
#ping -n -v -c 5 10.0.2.4
echo -n "uptime: "; cat /proc/uptime
fi
exec guestfsd -f
if ! grep -sq guestfs_rescue=1 /proc/cmdline; then
# Run the daemon under valgrind if ./configure --enable-valgrind-daemon
vg_channel=/dev/virtio-ports/org.libguestfs.valgrind
if [ -w $vg_channel ]; then
if [ -r /etc/guestfsd.suppressions ]; then
suppressions="--suppressions=/etc/guestfsd.suppressions"
fi
exec 3>$vg_channel
vg="valgrind --leak-check=full --log-fd=3 --error-exitcode=119 --max-stackframe=8388608 --child-silent-after-fork=yes $suppressions"
echo "enabling valgrind: $vg"
fi
# The host will kill qemu abruptly if guestfsd shuts down normally
$vg guestfsd
# Otherwise we try to clean up gracefully. For example, this ensures that a
# core dump generated by the guest daemon will be written to disk.
else
# Use appliance in rescue mode, also used by the virt-rescue command.
eval $(grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline)
PS1='><rescue> '
export TERM PS1
echo
echo "------------------------------------------------------------"
echo
echo "Welcome to virt-rescue, the libguestfs rescue shell."
echo
echo "Note: The contents of / are the rescue appliance."
echo "You have to mount the guest's partitions under /sysroot"
echo "before you can examine them."
echo
bash -i
echo
echo "virt-rescue: Syncing the disk now before exiting ..."
echo
fi
sync
reboot -f

View File

@@ -1,56 +0,0 @@
# List of kernel modules that we leave in the appliance. This has to
# include any dependencies needed by modules.
# Any kernel module not listed here is deleted from the appliance.
# Wildcards are permitted.
virtio*.ko
# We normally use virtio_net, but keep these in reserve.
8390.ko
ne2k-pci.ko
# drivers for QEMUs IDE/SCSI device emulation
cdrom.ko
i2c-piix4.ko
i2c-core.ko
ide-*.ko
libata.ko
piix.ko
scsi_transport_spi.ko
scsi_mod.ko
sd_mod.ko
sym53c8xx.ko
ext2.ko
ext3.ko
ext4*.ko
crc16.ko
jbd.ko
jbd2.ko
mbcache.ko
fuse.ko
vfat.ko
fat.ko
udf.ko
crc_itu_t.ko
nls_utf8.ko
nls_cp437.ko
nls_base.ko
dm-*.ko
cramfs.ko
squashfs.ko
hfsplus.ko
ufs.ko
exportfs.ko
xfs.ko
reiserfs.ko

View File

@@ -0,0 +1,163 @@
#!/bin/bash -
# @configure_input@
# libguestfs-make-fixed-appliance tool
# Copyright (C) 2012 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
unset CDPATH
program="libguestfs-make-fixed-appliance"
version="@PACKAGE_VERSION@"
TEMP=`getopt \
-o V \
--long help,version,xz \
-n $program -- "$@"`
if [ $? != 0 ]; then
echo "$program: problem parsing the command line arguments"
exit 1
fi
eval set -- "$TEMP"
usage ()
{
echo "Usage:"
echo " $program [--options] OUTPUTDIR"
echo " $program [--options] --xz"
echo
echo "Read $program(1) man page for more information."
exit $1
}
while true; do
case "$1" in
-V|--version)
echo "$program $version"
exit 0;;
--xz)
xz_mode=1
shift;;
--help)
usage 0;;
--)
shift
break;;
*)
echo "internal error ($1)"
exit 1;;
esac
done
# Either xz_mode or we expect one extra parameter (output directory).
if [ -n "$xz_mode" ]; then
if [ $# -gt 0 ]; then
echo "error: $program: extra parameters on the command line"
echo
usage 1
fi
else
if [ $# -ne 1 ]; then
echo "error: $program: missing output directory"
echo
usage 1
fi
outputdir="$1"
fi
# end of command line parsing
#----------------------------------------------------------------------
set -e
# The two ways to build the appliance are roughly the same, except for
# --xz we build into a temporary directory and tar it up at the end.
if [ -n "$xz_mode" ]; then
tmpdir="$(mktemp -d)"
outputdir="$tmpdir/appliance"
cleanup ()
{
rm -rf $tmpdir ||:
}
trap cleanup EXIT ERR
fi
# Create the output directory.
mkdir -p "$outputdir"
# Build the supermin appliance, if not already.
guestfish -a /dev/null run
# Find the location of the appliance.
if [ -n "$TMPDIR" ]; then
appliancedir="$TMPDIR/.guestfs-$(id -u)"
else
appliancedir="/var/tmp/.guestfs-$(id -u)"
fi
cp "$appliancedir/kernel" "$outputdir/kernel"
cp "$appliancedir/initrd" "$outputdir/initrd"
cp --sparse=always "$appliancedir/root" "$outputdir/root"
cat <<EOF >"$outputdir/README.fixed"
This is the "fixed appliance", a pre-built binary appliance for
libguestfs. This was built using $program.
Unpack the appliance directory:
tar -Jxvf appliance-<VERSION>.tar.xz
Then copy all four files:
* kernel
* initrd
* root
* README.fixed
into a directory somewhere, eg. /usr/local/lib/guestfs/appliance/
Then build libguestfs (>= 1.16.7 or >= 1.17.10) from source, disabling
the normal appliance and daemon:
./configure --disable-appliance --disable-daemon
make
sudo make install
Set LIBGUESTFS_PATH to the path where you unpacked these files, eg:
export LIBGUESTFS_PATH=/usr/local/lib/guestfs/appliance/
and run the libguestfs programs and virt tools in the normal way.
LICENSE
-------
This appliance contains software under a variety of open source
licenses. The software is from Fedora (https://fedoraproject.org/),
and to rebuild it you need to download Fedora 17+ and
libguestfs >= 1.17.10, and build libguestfs from source in the usual
way.
EOF
# If --xz, compress the result. Note -S option to preserve sparseness.
if [ -n "$xz_mode" ]; then
tar -C "$tmpdir" -S -cf - appliance | xz --best > "appliance-$version.tar.xz"
rm -rf "$tmpdir" ||:
trap - EXIT ERR
fi

View File

@@ -0,0 +1,174 @@
=encoding utf8
=head1 NAME
libguestfs-make-fixed-appliance - Make a "fixed appliance" for libguestfs
=head1 SYNOPSIS
libguestfs-make-fixed-appliance [--options] OUTPUTDIR
libguestfs-make-fixed-appliance [--options] --xz
=head1 DESCRIPTION
libguestfs-make-fixed-appliance lets you make a pre-built binary
appliance for libguestfs.
B<Note that ordinary users should not need to run this tool>. The
only reason to use it is if you want to make a self-contained
libguestfs appliance that can be copied to another machine or platform
that doesn't support L<febootstrap(8)>. To understand why you might
need to use this tool, read the section L</FIXED APPLIANCE> below.
Instead of running this tool, you can download fixed appliances from
L<http://libguestfs.org/download/binaries/appliance/>. These
appliances were made using this tool.
There are two ways to use this tool.
=over 4
=item *
Specify an output directory, for example:
libguestfs-make-fixed-appliance /usr/local/lib/guestfs/appliance
The output directory is created if it does not exist. Four files are
created in this directory:
<OUTPUTDIR>/kernel
<OUTPUTDIR>/initrd
<OUTPUTDIR>/root
<OUTPUTDIR>/README.fixed
Note that C<I<OUTPUTDIR>/root> is a sparse file, so take care when
copying it.
You can then run libguestfs (possibly after copying this directory to
another machine) by setting the environment variable LIBGUESTFS_PATH
to C<OUTPUTDIR>.
=item *
The alternative method is to use the I<--xz> option to create a
compressed tarball:
libguestfs-make-fixed-appliance --xz
This creates a tarball in the I<current> directory called:
appliance-<VERSION>.tar.xz
(where C<VERSION> is the version of libguestfs). The tarball contains
the four files:
appliance/kernel
appliance/initrd
appliance/root
appliance/README.fixed
Note that C<appliance/root> is a sparse file, so take care when
copying it.
=back
=head1 OPTIONS
=over 4
=item B<--help>
Display short usage information and exit.
=item B<-V>
=item B<--version>
Display the version number and exit.
=item B<--xz>
Instead of creating the appliance in an output directory, create a
compressed tarball of the appliance in the current directory called
C<appliance-I<VERSION>.tar.xz> where C<VERSION> is the version of
libguestfs.
Using I<--xz> can take some time. If working normally, the tool is
completely silent when it is running.
=back
=head1 FIXED APPLIANCE
When libguestfs (or libguestfs tools) are run, they search a path
looking for an appliance. The path is built into libguestfs, or can
be set using the C<LIBGUESTFS_PATH> environment variable.
Normally a supermin appliance is located on this path (see
L<febootstrap(8)/SUPERMIN APPLIANCE>). libguestfs reconstructs this
into a full appliance by running L<febootstrap-supermin-helper(8)>.
However, a simpler "fixed appliance" can also be used. libguestfs
detects this by looking for a directory on the path containing four
files called C<kernel>, C<initrd>, C<root> and C<README.fixed> (note
the C<README.fixed> file must be present as well).
If the fixed appliance is found, libguestfs skips febootstrap entirely
and just runs qemu with the kernel, initrd and root disk from the
fixed appliance.
Thus the fixed appliance can be used when a platform or Linux distro
does not support febootstrap. You build the fixed appliance on a
platform that does support febootstrap, and copy it over, and use that
to run libguestfs.
=head1 LICENSING
The fixed appliance is a complete Linux binary distro. If you
distribute it, you may need to distribute corresponding source files
to remain in legal compliance with the licenses of the software in the
appliance (such as the GNU General Public License).
=head1 EXIT STATUS
libguestfs-make-fixed-appliance returns I<0> if the appliance was
built without errors.
=head1 ENVIRONMENT VARIABLES
For the full list of environment variables which may affect
libguestfs, please see the L<guestfs(3)> manual page.
=head1 SEE ALSO
L<guestfs(3)>,
L<febootstrap(8)>,
L<febootstrap-supermin-helper(8)>,
L<xz(1)>,
L<http://libguestfs.org/>,
L<http://qemu.org/>.
=head1 AUTHORS
Richard W.M. Jones (C<rjones at redhat dot com>)
=head1 COPYRIGHT
Copyright (C) 2009-2012 Red Hat Inc.
L<http://libguestfs.org/>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

View File

@@ -1,86 +0,0 @@
#!/bin/bash -
# @configure_input@
# Copyright (C) 2009 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# Helper script which constructs the supermin appliance at runtime.
unset CDPATH
set -e
# Source directory containing the supermin input files.
sourcedir=$(cd "$1" > /dev/null; pwd)
# Output files.
kernel="$2"
initrd="$3"
# Kernel:
# Look for the most recent kernel named vmlinuz-*.<arch>* which has a
# corresponding directory in /lib/modules/. If the architecture is x86, look
# for any x86 kernel.
#
# RHEL 5 didn't append the arch to the kernel name, so look for kernels
# without arch second.
arch=$(echo "@host_cpu@" | sed 's/^i.86$/i?86/')
kernels=$(ls -1vr /boot/vmlinuz-*.$arch* 2>/dev/null | grep -v xen; ls -1vr /boot/vmlinuz-* 2>/dev/null | grep -v xen)
for f in $kernels; do
b=$(basename "$f")
b=$(echo "$b" | sed 's,vmlinuz-,,')
modpath="/lib/modules/$b"
if [ -d "$modpath" ]; then
ln -sf "$f" "$kernel"
break
fi
modpath=
done
if [ -z "$modpath" ]; then
echo "$0: failed to find a suitable kernel" >&2
exit 1
fi
# The initrd consists of these components:
# (1) The base skeleton appliance that we constructed at build time.
# name = initramfs.@REPO@.@host_cpu@.supermin.img
# format = compressed cpio
# (2) The modules from modpath which are on the module whitelist.
# format = plain cpio
# (3) The host files which match wildcards in *.supermin.hostfiles.
# format = plain cpio
cp "$sourcedir"/initramfs.@REPO@.@host_cpu@.supermin.img "$initrd"
# Kernel modules (2).
exec 5<"$sourcedir"/kmod.whitelist
whitelist=
while read kmod 0<&5; do
whitelist="$whitelist -o -name $kmod"
done
exec 5<&-
find "$modpath" \( -not -name '*.ko' $whitelist \) -a -print0 |
cpio --quiet -o -0 -H newc >> "$initrd"
# Host files (3).
(cd / && \
ls -1df $(
cat "$sourcedir"/initramfs.@REPO@.@host_cpu@.supermin.hostfiles
) 2>/dev/null |
cpio --quiet -o -H newc ) >> "$initrd"

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# @configure_input@
# Copyright (C) 2009 Red Hat Inc.
# Copyright (C) 2009-2012 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,138 +14,53 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# This is called from the Makefile to build the initramfs.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
unset CDPATH
set -e
set -x
if [ "@DIST@" = "REDHAT" ]; then
cd @top_builddir@
# Decide on names for the final output. These have to match Makefile.am.
output=appliance/initramfs.@REPO@.@host_cpu@.img
koutput=appliance/vmlinuz.@REPO@.@host_cpu@
rm -f $output
rm -f $koutput
# Turn excludelist file into command line arguments.
exec 5<excludelist
while read regexp <&5; do
excludes="$excludes --exclude $regexp"
done
exec 5<&-
# Create the basic initramfs.
exec 5<appliance/packagelist
packages=
while read pkg 0<&5; do
packages="$packages -i $pkg"
done
exec 5<&-
@FEBOOTSTRAP@ $packages -u @UPDATES@ @REPO@ initramfs @MIRROR@
# /sysroot is where the guest root filesystem will be mounted.
@FEBOOTSTRAP_RUN@ initramfs -- mkdir -p --mode=0777 /sysroot
# Create /tmp if it is missing.
@FEBOOTSTRAP_RUN@ initramfs -- mkdir -p --mode=0777 /tmp
# Create /selinux if it is missing.
@FEBOOTSTRAP_RUN@ initramfs -- mkdir -p --mode=0755 /selinux
# Nuke some stuff. The kernel pulls mkinitrd and plymouth which pulls in
# all of Python. Sheez.
(cd initramfs && find -name '*plymouth*' -print0) |
xargs -0 @FEBOOTSTRAP_RUN@ initramfs -- rm -rf
(cd initramfs && find -name '*python*' -print0) |
xargs -0 @FEBOOTSTRAP_RUN@ initramfs -- rm -rf
# In Fedora >= 11, it pulls in all of Perl from somewhere. Nuke from orbit.
@FEBOOTSTRAP_RUN@ initramfs -- rm -rf /usr/lib/perl5 /usr/lib64/perl5
# Anaconda? JPEG images?
@FEBOOTSTRAP_RUN@ initramfs -- rm -rf /usr/lib/anaconda-runtime
# Don't need any firmware.
@FEBOOTSTRAP_RUN@ initramfs -- rm -rf /lib/firmware
# Don't need any keyboard maps.
@FEBOOTSTRAP_RUN@ initramfs -- rm -rf /lib/kbd
# Remove anything in home directory. Because of the potential for disaster
# we don't put a slash before 'home'.
(cd initramfs && echo home/*) |
xargs @FEBOOTSTRAP_RUN@ initramfs -- rm -rf
# Remove /var/lib/yum stuff.
@FEBOOTSTRAP_RUN@ initramfs -- rm -rf /var/lib/yum
# Remove some unreadable binaries which are incompatible with
# the supermin appliance. Since these binaries can't be read
# from the host filesystem, they generate warnings like:
# cpio: ./usr/bin/chfn: Cannot open: Permission denied
# These binaries are not needed for operation of the appliance.
@FEBOOTSTRAP_RUN@ initramfs -- rm -f \
/usr/bin/chfn \
/usr/bin/chsh \
/usr/libexec/pt_chown \
/usr/sbin/groupdel \
/usr/sbin/groupadd \
/usr/sbin/useradd \
/usr/sbin/tzdata-update \
/usr/sbin/userdel \
/usr/sbin/usermod \
/usr/sbin/groupmod \
/usr/sbin/groupmems \
/sbin/unix_update \
/usr/sbin/tcpd \
$(cd initramfs && echo usr/sbin/glibc_post_upgrade.*)
# Kernel modules take up nearly half of the image. Only include ones
# which are on the whitelist.
exec 5<appliance/kmod.whitelist
whitelist=
while read kmod 0<&5; do
whitelist="$whitelist -a -not -name $kmod"
done
exec 5<&-
(cd initramfs && \
find lib/modules/*/kernel -name '*.ko' $whitelist -a -print0 ) |
xargs -0 febootstrap-run initramfs -- rm
# Pull the kernel out into the current directory. We don't want it in
# the initramfs image.
cp initramfs/boot/vmlinuz* $koutput
@FEBOOTSTRAP_RUN@ initramfs -- rm -rf boot
# Minimize the image.
@FEBOOTSTRAP_MINIMIZE@ initramfs
# Add some missing configuration files.
if [ ! -f initramfs/etc/hosts ]; then
cat > hosts.new <<'__EOF__'
127.0.0.1 guestfs localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
__EOF__
@FEBOOTSTRAP_INSTALL@ initramfs hosts.new /etc/hosts 0644 root.root
rm hosts.new
fi
if [ ! -f initramfs/etc/fstab ]; then
@FEBOOTSTRAP_RUN@ initramfs -- touch /etc/fstab
fi
echo nameserver 10.0.2.3 > resolv.conf.new
@FEBOOTSTRAP_INSTALL@ initramfs resolv.conf.new /etc/resolv.conf 0644 root.root
rm resolv.conf.new
ls -lh $koutput
# Now directly run the update script to copy/update the daemon in the
# initramfs.
cd appliance && bash update.sh
elif [ "@DIST@" = "DEBIAN" ]; then
cd @top_builddir@/appliance
debirf make -n debian
mkdir -p @top_builddir@/initramfs
touch @top_builddir@/initramfs/fakeroot.log
# Run febootstrap on the package list.
if [ "x@FEBOOTSTRAP_YUM_CONFIG@" != "xno" ]; then
extra="--yum-config @FEBOOTSTRAP_YUM_CONFIG@"
fi
echo @FEBOOTSTRAP@ -v -o supermin.d --names $(< packagelist ) $excludes $extra
@FEBOOTSTRAP@ -v -o supermin.d --names $(< packagelist ) $excludes $extra
# Remove some things that we don't want in the appliance. This is
# copied from the old febootstrap-minimize. However minimization is
# not so important now that we are caching the appliance.
< supermin.d/hostfiles \
grep -v '^/usr/lib/locale' |
grep -v '^/usr/share/locale' |
grep -v '^/usr/lib/gconv' |
grep -v '^/usr/lib64/gconv' |
grep -v '^/usr/bin/localedef' |
grep -v '^/usr/sbin/build-locale-archive' |
grep -v '^/usr/share/man/' |
grep -v '^/usr/share/doc/' |
grep -v '^/usr/share/info/' |
grep -v '^/usr/share/gnome/help/' |
grep -v '^/usr/share/cracklib/' |
grep -v '^/usr/share/i18n/' > supermin.d/hostfiles-t
# XXX resolv.conf? The old script had:
# echo nameserver 169.254.2.3 > resolv.conf
if ! grep -q /etc/resolv.conf supermin.d/hostfiles-t; then
echo /etc/resolv.conf >> supermin.d/hostfiles-t
fi
# Include any Augeas lenses from the host.
if grep -q /usr/share/augeas/lenses supermin.d/hostfiles-t; then
echo "/usr/share/augeas/lenses/*.aug" >> supermin.d/hostfiles-t
fi
mv supermin.d/hostfiles-t supermin.d/hostfiles

View File

@@ -5,41 +5,133 @@
* following symbols defined (depending on the distro):
*
* REDHAT=1 For Fedora, RHEL, EPEL and workalikes.
* DEBIAN=1 For Debian based distros.
* DEBIAN=1 For Debian.
* UBUNTU=1 For Ubuntu.
* ARCHLINUX=1 For Archlinux.
*
* There is also a list of packages which are excluded if they appear
* as dependencies of the packages below. See: excludelist.in
*/
#if REDHAT == 1
/* Basically the same with a few minor tweaks. */
#ifdef UBUNTU
#define DEBIAN 1
#endif
#ifdef REDHAT
augeas-libs
btrfs-progs
cryptsetup
cryptsetup-luks /* old name used before Fedora 17 */
diffutils
e2fsprogs
/* e4fsprogs only exists on RHEL 5, will be ignored everywhere else. */
e4fsprogs
gfs-utils
gfs2-utils
grub
hfsplus-tools
iputils
kernel
MAKEDEV
nilfs-utils
ntfsprogs
scrub
ntfs-3g
reiserfs-utils
libselinux
udev
systemd /* for /sbin/reboot */
util-linux-ng
#elif DEBIAN == 1
vim-minimal
xz
zfs-fuse
#endif /* REDHAT */
#ifdef DEBIAN
bsdmainutils
btrfs-tools
cryptsetup
diff
e2fsprogs
gfs-tools
gfs2-tools
grub-pc
hfsplus
iproute
libaugeas0
udev
linux-image
nilfs-tools
ntfs-3g
ntfsprogs
reiserfsprogs
ufsutils
util-linux
#endif
vim-tiny
xz-utils
zfs-fuse
#endif /* DEBIAN */
#ifdef ARCHLINUX
linux
vim
btrfs-progs-unstable
cryptsetup
diffutils
augeas
zfs-fuse
e2fsprogs
grub
iputils
nilfs-utils
ntfsprogs
ntfs-3g
reiserfsprogs
util-linux-ng
xz
#endif /* ARCHLINUX */
acl
attr
bash
binutils
bzip2
coreutils
cpio
dosfstools
file
grub
findutils
gawk
genisoimage
grep
gzip
iproute
jfsutils
libxml2
lsof
lsscsi
lvm2
lzop
mdadm
module-init-tools
net-tools
ntfs-3g
/*
Enabling this pulls out 140 extra packages
into the appliance:
ocfs2-tools
*/
parted
procps
psmisc
scrub
strace
tar
udev
#ifndef UBUNTU
/* on Ubuntu contains a file in /lib64 which conflicts with libc6 that has
* /lib64 as a symbolic link
*/
xfsprogs
#endif
zerofree
#ifdef VALGRIND_DAEMON
valgrind
#endif

View File

@@ -1,93 +0,0 @@
#!/bin/bash -
# @configure_input@
# Copyright (C) 2009 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# Decide which files will stay in the supermin appliance and which
# files will be pulled out of the host at runtime.
#
# Read the README file!
#
# The basic idea is that we create two output files, one containing
# the files that will stay, and the other listing the files that
# will be pulled from the host (ie. not go into the appliance now).
#
# The list of files that stay ('supermin.incfiles') is just a straight
# list of files and directories.
#
# The list of files that come from the host ('*.supermin.hostfiles')
# can include wildcards, to allow libraries to be upgraded on the
# host.
unset CDPATH
set -e
cd @top_builddir@/initramfs
incfiles=../appliance/supermin.incfiles
hostfiles=../appliance/initramfs.@REPO@.@host_cpu@.supermin.hostfiles
exec 5>$incfiles
exec 6>$hostfiles
# Note currently the initramfs contains ~2500 files, and none have
# "funny characters" in the names. So this is reasonable just to
# simplify the script.
for path in $(find -not -name fakeroot.log); do
dir=$(dirname "$path")
file=$(basename "$path")
# All we're going to keep are the special files /init, the daemon,
# configuration files (/etc), devices and modifiable stuff (/var).
if [ "$path" = "./init" -o "$file" = "guestfsd" ]; then
echo "$path" >&5
elif [[ "$path" =~ '^\./etc' || "$path" =~ '^./dev' || "$path" =~ '^\./var' ]]; then
echo "$path" >&5
# Kernel modules are always copied in from the host, including all
# the dependency files.
elif [[ "$path" =~ '^\./lib/modules/' ]]; then
:
elif [ -d "$path" ]; then
# Always write directory names to both output files.
echo "$path" >&5
echo "$path" >&6
# Some libraries need fixed version numbers replaced by wildcards.
elif [[ "$file" =~ '^ld-[.0-9]+\.so$' ]]; then
echo "$dir/ld-*.so" >&6
# libfoo-1.2.3.so
elif [[ "$file" =~ '^lib(.*)-[-.0-9]+\.so$' ]]; then
echo "$dir/lib${BASH_REMATCH[1]}-*.so" >&6
# libfoo-1.2.3.so.1.2.3 (but NOT '*.so.N')
elif [[ "$file" =~ '^lib(.*)-[-.0-9]+\.so\.([0-9]+)\.' ]]; then
echo "$dir/lib${BASH_REMATCH[1]}-*.so.${BASH_REMATCH[2]}.*" >&6
# libfoo.so.1.2.3 (but NOT '*.so.N')
elif [[ "$file" =~ '^lib(.*)\.so\.([0-9]+)\.' ]]; then
echo "$dir/lib${BASH_REMATCH[1]}.so.${BASH_REMATCH[2]}.*" >&6
else
# Anything else comes from the host directly.
echo "$path" >&6
fi
done

View File

@@ -1,48 +0,0 @@
#!/bin/bash -
# @configure_input@
# Copyright (C) 2009 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# Update the init script or daemon inside an existing initramfs.
# Avoids the timeconsuming rebuild.
unset CDPATH
set -e
if [ "@DIST@" = "REDHAT" ]; then
cd @top_builddir@
output=appliance/initramfs.@REPO@.@host_cpu@.img
# Create the init script.
@FEBOOTSTRAP_INSTALL@ initramfs appliance/@top_srcdir@/appliance/init /init 0755 root.root
# Copy the daemon into the filesystem.
@FEBOOTSTRAP_INSTALL@ initramfs daemon/guestfsd /sbin/guestfsd 0755 root.root
# Generate final image.
@FEBOOTSTRAP_TO_INITRAMFS@ initramfs > $output-t
mv $output-t $output
ls -lh $output
elif [ "@DIST@" = "DEBIAN" ]; then
cd @top_builddir@/appliance
output=initramfs.@REPO@.@host_cpu@.img
vmlinuz=vmlinuz.@REPO@.@host_cpu@
ln -sf debian/debirf-libguestfs_@REPO@*.cgz $output
ln -sf debian/vmlinuz-* $vmlinuz
fi

View File

@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Rebuild the autotools environment.
@@ -24,7 +24,7 @@ set -v
# Ensure that whenever we pull in a gnulib update or otherwise change to a
# different version (i.e., when switching branches), we also rerun ./bootstrap.
curr_status=.git-module-status
t=$(git submodule status)
t=$(git submodule status|sed 's/^[ +-]//;s/ .*//')
if test "$t" = "$(cat $curr_status 2>/dev/null)"; then
: # good, it's up to date
else
@@ -44,7 +44,7 @@ fi
# If no arguments were specified and configure has run before, use the previous
# arguments
if [ $# == 0 -a -x ./config.status ]; then
if test $# == 0 && test -x ./config.status; then
./config.status --recheck
else
$CONFIGUREDIR/configure "$@"

View File

@@ -3,90 +3,168 @@ def
[]
false
0
0
123
456
<61><62><63><00><61><62><63>
obool: true
oint: 1
oint64: unset
ostring: unset
abc
null
[]
false
0
0
123
456
<61><62><63><00><61><62><63>
obool: unset
oint: unset
oint64: 1
ostring: string
def
[]
false
0
0
123
456
<61><62><63><00><61><62><63>
obool: false
oint: unset
oint64: unset
ostring: unset
[]
false
0
0
123
456
<61><62><63><00><61><62><63>
obool: unset
oint: unset
oint64: unset
ostring: unset
abc
def
["1"]
false
0
0
123
456
<61><62><63><00><61><62><63>
obool: unset
oint: unset
oint64: unset
ostring: unset
abc
def
["1", "2"]
false
0
0
123
456
<61><62><63><00><61><62><63>
obool: unset
oint: unset
oint64: unset
ostring: unset
abc
def
["1"]
true
0
0
123
456
<61><62><63><00><61><62><63>
obool: unset
oint: unset
oint64: unset
ostring: unset
abc
def
["1"]
false
-1
-1
123
456
<61><62><63><00><61><62><63>
obool: unset
oint: unset
oint64: unset
ostring: unset
abc
def
["1"]
false
-2
-2
123
456
<61><62><63><00><61><62><63>
obool: unset
oint: unset
oint64: unset
ostring: unset
abc
def
["1"]
false
1
1
123
456
<61><62><63><00><61><62><63>
obool: unset
oint: unset
oint64: unset
ostring: unset
abc
def
["1"]
false
2
2
123
456
<61><62><63><00><61><62><63>
obool: unset
oint: unset
oint64: unset
ostring: unset
abc
def
["1"]
false
4095
4095
123
456
<61><62><63><00><61><62><63>
obool: unset
oint: unset
oint64: unset
ostring: unset
abc
def
["1"]
false
0
0
<61><62><63><00><61><62><63>
obool: unset
oint: unset
oint64: unset
ostring: unset
EOF

View File

@@ -26,51 +26,72 @@ git submodule init || exit $?
git submodule update || exit $?
GNULIB_SRCDIR=.gnulib
ls po/*.po 2>/dev/null | sed 's|.*/||; s|\.po$||' > po/LINGUAS
# Run autopoint, to get po/Makevars.template:
# Also, released autopoint has the tendency to install macros that have
# been obsoleted in current gnulib, so run this before gnulib-tool.
autopoint --force
# Autoreconf runs aclocal before libtoolize, which causes spurious
# warnings if the initial aclocal is confused by the libtoolized
# (or worse out-of-date) macro directory.
libtoolize --copy --install
# Create gettext configuration.
echo "$0: Creating po/Makevars from po/Makevars.template ..."
rm -f po/Makevars
sed '
/^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
/^MSGID_BUGS_ADDRESS *=/s/=.*/= '"$MSGID_BUGS_ADDRESS"'/
/^XGETTEXT_OPTIONS *=/{
s/$/ \\/
a\
'"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
}
' po/Makevars.template >po/Makevars
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
<$gnulib_tool || exit
(cd daemon && mkdir -p tests lib && ../$gnulib_tool --update)
modules='
accept4
arpa_inet
byteswap
c-ctype
cloexec
closeout
connect
dup3
error
filevercmp
fsusage
fts
full-read
full-write
futimens
getaddrinfo
getline
gitlog-to-changelog
glob
gnu-make
gnumakefile
hash
hash-pjw
human
ignore-value
lock
maintainer-makefile
manywarnings
mkdtemp
netdb
netinet_in
openat
perror
pread
progname
read-file
readlink
select
setenv
sleep
socket
strchrnul
strerror
strndup
symlinkat
sys_select
sys_wait
vasprintf
vc-list-files
warnings
xalloc
xalloc-die
xstrtol
xstrtoll
xvasprintf
'
$gnulib_tool \
@@ -79,6 +100,7 @@ $gnulib_tool \
--m4-base=m4 \
--source-base=gnulib/lib \
--tests-base=gnulib/tests \
--libtool \
--import $modules
# Disable autopoint and libtoolize, since they were already done above.

46
bugs-in-changelog.sh Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/bash -
# bugs-in-changelog.sh
# Copyright (C) 2009-2012 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Used when preparing the RELEASE-NOTES file. This script looks at
# the bugs noted in the git changelog since the last stable release
# (or any release). To use it, the only parameter should be the git
# commit range, eg:
#
# ./bugs-in-changelog.sh "1.0.89.."
if [ -z "$1" ]; then
echo "$0 git-commit-range"
exit 1
fi
# Comma-separated list of Bugzilla IDs.
bugids=$(
git log "$1" | egrep -o 'RHBZ#[0-9]+' |
sed 's/RHBZ#//' |
sort -u |
tr '\n' ',' |
sed 's/,$//'
)
#echo bugids "$bugids"
# Filter out any bugs which may still be in NEW or ASSIGNED:
bugzilla query -b "$bugids" \
-t MODIFIED,POST,ON_QA,PASSES_QA,VERIFIED,RELEASE_PENDING,CLOSED \
--outputformat=' - %{bug_id} %{short_desc}' |
sort -n -r

View File

@@ -1,62 +0,0 @@
# libguestfs
# Copyright (C) 2009 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
EXTRA_DIST = \
tests.c
# Tests. These are auto-generated from the test descriptions
# in the generator.
check_PROGRAMS = tests test-command
tests_SOURCES = tests.c
tests_CFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src \
$(WARN_CFLAGS) $(WERROR_CFLAGS)
tests_LDADD = $(top_builddir)/src/libguestfs.la
# Old version of e2fsprogs which didn't support UUIDs?
e2fs_uuid_not_supported := \
$(shell r=1; \
test -x ../initramfs/sbin/mkswap \
&& ../initramfs/sbin/mkswap --help 2>&1 | grep -sq -- -U \
&& r=1; \
echo $$r)
TESTS = tests
TESTS_ENVIRONMENT = \
SKIP_TEST_COMMAND=$(shell ldd test-command | grep -sq 'not a dynamic executable' || echo 1) \
SKIP_TEST_COMMAND_LINES=$(shell ldd test-command | grep -sq 'not a dynamic executable' || echo 1) \
SKIP_TEST_ZEROFREE=$(shell test -x ../initramfs/usr/sbin/zerofree || echo 1) \
SKIP_TEST_NTFS_3G_PROBE=$(shell test -x ../initramfs/bin/ntfs-3g.probe || echo 1) \
SKIP_TEST_CHECKSUM_8=$(shell if test `find ../initramfs -name squashfs.ko | wc -l` -eq 0; then echo 1; fi) \
SKIP_TEST_MKSWAP_U=$(e2fs_uuid_not_supported) \
SKIP_TEST_SWAPON_UUID=$(e2fs_uuid_not_supported) \
SKIP_TEST_MKE2JOURNAL_U=$(e2fs_uuid_not_supported) \
SKIP_TEST_SCRUB_FILE=$(shell test -x ../initramfs/usr/bin/scrub || echo 1) \
SKIP_TEST_SCRUB_DEVICE=$(shell test -x ../initramfs/usr/bin/scrub || echo 1) \
$(VG)
# Run the tests under valgrind.
valgrind:
$(MAKE) check VG="valgrind --quiet --leak-check=full"
# This binary must be statically linked. It is used for testing
# the "guestfs_command" and "guestfs_command_lines" functions.
test_command_SOURCES = test-command.c
test_command_LDFLAGS = -all-static

View File

@@ -1,5 +1,5 @@
# libguestfs virt-cat
# Copyright (C) 2009 Red Hat Inc.
# libguestfs virt-cat, virt-filesystems and virt-ls.
# Copyright (C) 2010-2012 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,36 +13,127 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = \
run-cat-locally \
virt-cat.pl
test-virt-cat.sh \
virt-cat.pod \
test-virt-filesystems.sh \
virt-filesystems.pod \
test-virt-ls.sh \
virt-ls.pod
if HAVE_CAT
CLEANFILES = stamp-virt-cat.pod stamp-virt-ls.pod stamp-virt-filesystems.pod
man_MANS = virt-cat.1
bin_PROGRAMS = virt-cat virt-filesystems virt-ls
noinst_DATA = @top_builddir@/html/virt-cat.1.html
SHARED_SOURCE_FILES = \
../fish/config.c \
../fish/inspect.c \
../fish/keys.c \
../fish/options.h \
../fish/options.c \
../fish/virt.c
virt-cat.1: virt-cat.pl
$(POD2MAN) \
--section 1 \
-c "Virtualization Support" \
--release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
$< > $@
virt_cat_SOURCES = \
$(SHARED_SOURCE_FILES) \
virt-cat.c
@top_builddir@/html/virt-cat.1.html: virt-cat.pl
mkdir -p @top_builddir@/html
cd @top_builddir@ && pod2html \
--css 'pod.css' \
--title 'virt-cat, display a file in a virtual machine' \
--htmldir html \
--outfile html/virt-cat.1.html \
cat/$<
virt_cat_CFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \
-I$(top_srcdir)/src -I$(top_builddir)/src \
-I$(top_srcdir)/fish \
-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(LIBCONFIG_CFLAGS)
install-data-hook:
mkdir -p $(DESTDIR)$(bindir)
install -m 0755 virt-cat.pl $(DESTDIR)$(bindir)/virt-cat
virt_cat_LDADD = \
$(LIBCONFIG_LIBS) \
$(top_builddir)/src/libguestfs.la \
../gnulib/lib/libgnu.la
endif
virt_filesystems_SOURCES = \
$(SHARED_SOURCE_FILES) \
virt-filesystems.c
virt_filesystems_CFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \
-I$(top_srcdir)/src -I$(top_builddir)/src \
-I$(top_srcdir)/fish \
-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(LIBCONFIG_CFLAGS)
virt_filesystems_LDADD = \
$(LIBCONFIG_LIBS) \
$(top_builddir)/src/libguestfs.la \
../gnulib/lib/libgnu.la
virt_ls_SOURCES = \
$(SHARED_SOURCE_FILES) \
virt-ls.c
virt_ls_CFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \
-I$(top_srcdir)/src -I$(top_builddir)/src \
-I$(top_srcdir)/fish \
-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(LIBCONFIG_CFLAGS)
virt_ls_LDADD = \
$(LIBCONFIG_LIBS) \
$(top_builddir)/src/libguestfs.la \
../gnulib/lib/libgnu.la
# Manual pages and HTML files for the website.
man_MANS = virt-cat.1 virt-filesystems.1 virt-ls.1
noinst_DATA = \
$(top_builddir)/html/virt-cat.1.html \
$(top_builddir)/html/virt-filesystems.1.html \
$(top_builddir)/html/virt-ls.1.html
virt-cat.1 $(top_builddir)/html/virt-cat.1.html: stamp-virt-cat.pod
stamp-virt-cat.pod: virt-cat.pod
$(top_builddir)/podwrapper.sh \
--man virt-cat.1 \
--html $(top_builddir)/html/virt-cat.1.html \
$<
touch $@
virt-ls.1 $(top_builddir)/html/virt-ls.1.html: stamp-virt-ls.pod
stamp-virt-ls.pod: virt-ls.pod
$(top_builddir)/podwrapper.sh \
--man virt-ls.1 \
--html $(top_builddir)/html/virt-ls.1.html \
$<
touch $@
virt-filesystems.1 $(top_builddir)/html/virt-filesystems.1.html: stamp-virt-filesystems.pod
stamp-virt-filesystems.pod: virt-filesystems.pod
$(top_builddir)/podwrapper.sh \
--man virt-filesystems.1 \
--html $(top_builddir)/html/virt-filesystems.1.html \
$<
touch $@
# Tests.
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
TESTS_ENVIRONMENT = \
MALLOC_PERTURB_=$(random_val) \
$(top_builddir)/run --test
if ENABLE_APPLIANCE
TESTS = test-virt-cat.sh test-virt-filesystems.sh test-virt-ls.sh
endif ENABLE_APPLIANCE

View File

@@ -1,52 +0,0 @@
#!/usr/bin/perl
# virt-cat
# Copyright (C) 2009 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# This script sets up the environment so you can run virt-cat in place
# without needing to do 'make install' first. You can also run virt-cat
# by creating a symlink to this script and putting it in your path.
#
# Use it like this:
# ./run-cat-locally [usual virt-cat args ...]
use strict;
use warnings;
use File::Basename qw(dirname);
use File::Spec;
use Cwd qw(abs_path);
my $path = $0;
# Follow symlinks until we get to the real file
while(-l $path) {
my $link = readlink($path);
if(File::Spec->file_name_is_absolute($link)) {
$path = $link;
} else {
$path = File::Spec->catfile(dirname($path), $link);
}
}
# Get the absolute path of the parent directory
$path = abs_path(dirname($path).'/..');
$ENV{LD_LIBRARY_PATH} = $path.'/src/.libs';
$ENV{LIBGUESTFS_PATH} = $path.'/appliance';
$ENV{PERL5LIB} = $path.'/perl/blib/lib:'.$path.'/perl/blib/arch';
exec('perl', $path.'/cat/virt-cat.pl', @ARGV);

14
cat/test-virt-cat.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash -
export LANG=C
set -e
# Read out the test files from the image using virt-cat.
if [ "$(./virt-cat ../tests/guests/fedora.img /etc/test1)" != "abcdefg" ]; then
echo "$0: error: mismatch in file test1"
exit 1
fi
if [ "$(./virt-cat ../tests/guests/fedora.img /etc/test2)" != "" ]; then
echo "$0: error: mismatch in file test2"
exit 1
fi

33
cat/test-virt-filesystems.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/bash -
export LANG=C
set -e
output="$(./virt-filesystems -a ../tests/guests/fedora.img | sort)"
expected="/dev/VG/LV1
/dev/VG/LV2
/dev/VG/LV3
/dev/VG/Root
/dev/sda1"
if [ "$output" != "$expected" ]; then
echo "$0: error: mismatch in test 1"
echo "$output"
exit 1
fi
output="$(./virt-filesystems -a ../tests/guests/fedora.img --all --long --uuid -h --no-title | awk '{print $1}' | sort -u)"
expected="/dev/VG
/dev/VG/LV1
/dev/VG/LV2
/dev/VG/LV3
/dev/VG/Root
/dev/sda
/dev/sda1
/dev/sda2"
if [ "$output" != "$expected" ]; then
echo "$0: error: mismatch in test 2"
echo "$output"
exit 1
fi

33
cat/test-virt-ls.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/bash -
export LANG=C
set -e
# Read out the test directory using virt-ls.
if [ "$(./virt-ls ../tests/guests/fedora.img /bin)" != "ls
test1
test2
test3
test4
test5
test6
test7" ]; then
echo "$0: error: unexpected output from virt-ls"
exit 1
fi
# Try the -lR option.
output="$(./virt-ls -lR ../tests/guests/fedora.img /boot | awk '{print $1 $2 $4}')"
expected="d0755/boot
d0755/boot/grub
-0644/boot/grub/grub.conf
d0700/boot/lost+found"
if [ "$output" != "$expected" ]; then
echo "$0: error: unexpected output from virt-ls -lR"
echo "output: ------------------------------------------"
echo "$output"
echo "expected: ----------------------------------------"
echo "$expected"
echo "--------------------------------------------------"
exit 1
fi

390
cat/virt-cat.c Normal file
View File

@@ -0,0 +1,390 @@
/* virt-cat
* Copyright (C) 2010-2012 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <unistd.h>
#include <getopt.h>
#include <locale.h>
#include <assert.h>
#include <libintl.h>
#include "progname.h"
#include "c-ctype.h"
#include "guestfs.h"
#include "options.h"
/* Currently open libguestfs handle. */
guestfs_h *g;
int read_only = 1;
int live = 0;
int verbose = 0;
int keys_from_stdin = 0;
int echo_keys = 0;
const char *libvirt_uri = NULL;
int inspector = 1;
static int is_windows (guestfs_h *g, const char *root);
static char *windows_path (guestfs_h *g, const char *root, const char *filename);
static inline char *
bad_cast (char const *s)
{
return (char *) s;
}
static void __attribute__((noreturn))
usage (int status)
{
if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
else {
fprintf (stdout,
_("%s: display files in a virtual machine\n"
"Copyright (C) 2010 Red Hat Inc.\n"
"Usage:\n"
" %s [--options] -d domname file [file ...]\n"
" %s [--options] -a disk.img [-a disk.img ...] file [file ...]\n"
"Options:\n"
" -a|--add image Add image\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" -d|--domain guest Add disks from libvirt guest\n"
" --echo-keys Don't turn off echo for passphrases\n"
" --format[=raw|..] Force disk format for -a option\n"
" --help Display brief help\n"
" --keys-from-stdin Read passphrases from stdin\n"
" -v|--verbose Verbose messages\n"
" -V|--version Display version and exit\n"
" -x Trace libguestfs API calls\n"
"For more information, see the manpage %s(1).\n"),
program_name, program_name, program_name,
program_name);
}
exit (status);
}
int
main (int argc, char *argv[])
{
/* Set global program name that is not polluted with libtool artifacts. */
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEBASEDIR);
textdomain (PACKAGE);
enum { HELP_OPTION = CHAR_MAX + 1 };
static const char *options = "a:c:d:vVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "connect", 1, 0, 'c' },
{ "domain", 1, 0, 'd' },
{ "echo-keys", 0, 0, 0 },
{ "format", 2, 0, 0 },
{ "help", 0, 0, HELP_OPTION },
{ "keys-from-stdin", 0, 0, 0 },
{ "verbose", 0, 0, 'v' },
{ "version", 0, 0, 'V' },
{ 0, 0, 0, 0 }
};
struct drv *drvs = NULL;
struct drv *drv;
const char *format = NULL;
int c;
int option_index;
g = guestfs_create ();
if (g == NULL) {
fprintf (stderr, _("guestfs_create: failed to create handle\n"));
exit (EXIT_FAILURE);
}
argv[0] = bad_cast (program_name);
for (;;) {
c = getopt_long (argc, argv, options, long_options, &option_index);
if (c == -1) break;
switch (c) {
case 0: /* options which are long only */
if (STREQ (long_options[option_index].name, "keys-from-stdin")) {
keys_from_stdin = 1;
} else if (STREQ (long_options[option_index].name, "echo-keys")) {
echo_keys = 1;
} else if (STREQ (long_options[option_index].name, "format")) {
if (!optarg || STREQ (optarg, ""))
format = NULL;
else
format = optarg;
} else {
fprintf (stderr, _("%s: unknown long option: %s (%d)\n"),
program_name, long_options[option_index].name, option_index);
exit (EXIT_FAILURE);
}
break;
case 'a':
OPTION_a;
break;
case 'c':
OPTION_c;
break;
case 'd':
OPTION_d;
break;
case 'h':
usage (EXIT_SUCCESS);
case 'v':
OPTION_v;
break;
case 'V':
OPTION_V;
break;
case 'x':
OPTION_x;
break;
case HELP_OPTION:
usage (EXIT_SUCCESS);
default:
usage (EXIT_FAILURE);
}
}
/* Old-style syntax? There were no -a or -d options in the old
* virt-cat which is how we detect this.
*/
if (drvs == NULL) {
/* argc - 1 because last parameter is the single filename. */
while (optind < argc - 1) {
if (strchr (argv[optind], '/') ||
access (argv[optind], F_OK) == 0) { /* simulate -a option */
drv = calloc (1, sizeof (struct drv));
if (!drv) {
perror ("malloc");
exit (EXIT_FAILURE);
}
drv->type = drv_a;
drv->a.filename = argv[optind];
drv->next = drvs;
drvs = drv;
} else { /* simulate -d option */
drv = calloc (1, sizeof (struct drv));
if (!drv) {
perror ("malloc");
exit (EXIT_FAILURE);
}
drv->type = drv_d;
drv->d.guest = argv[optind];
drv->next = drvs;
drvs = drv;
}
optind++;
}
}
/* These are really constants, but they have to be variables for the
* options parsing code. Assert here that they have known-good
* values.
*/
assert (read_only == 1);
assert (inspector == 1);
assert (live == 0);
/* User must specify at least one filename on the command line. */
if (optind >= argc || argc - optind < 1)
usage (EXIT_FAILURE);
/* User must have specified some drives. */
if (drvs == NULL)
usage (EXIT_FAILURE);
/* Add drives, inspect and mount. Note that inspector is always true,
* and there is no -m option.
*/
add_drives (drvs, 'a');
if (guestfs_launch (g) == -1)
exit (EXIT_FAILURE);
inspect_mount ();
/* Free up data structures, no longer needed after this point. */
free_drives (drvs);
unsigned errors = 0;
int windows;
char *root, **roots;
/* Get root mountpoint. See: fish/inspect.c:inspect_mount */
roots = guestfs_inspect_get_roots (g);
assert (roots);
assert (roots[0] != NULL);
assert (roots[1] == NULL);
root = roots[0];
free (roots);
/* Windows? Special handling is required. */
windows = is_windows (g, root);
for (; optind < argc; optind++) {
char *filename_to_free = NULL;
const char *filename = argv[optind];
if (windows) {
filename = filename_to_free = windows_path (g, root, filename);
if (filename == NULL) {
errors++;
continue;
}
}
if (guestfs_download (g, filename, "/dev/stdout") == -1)
errors++;
free (filename_to_free);
}
free (root);
guestfs_close (g);
exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
static int
is_windows (guestfs_h *g, const char *root)
{
char *type;
int w;
type = guestfs_inspect_get_type (g, root);
if (!type)
return 0;
w = STREQ (type, "windows");
free (type);
return w;
}
static void mount_drive_letter_ro (char drive_letter, const char *root);
static char *
windows_path (guestfs_h *g, const char *root, const char *path)
{
char *ret;
size_t i;
/* If there is a drive letter, rewrite the path. */
if (c_isalpha (path[0]) && path[1] == ':') {
char drive_letter = c_tolower (path[0]);
/* This returns the newly allocated string. */
mount_drive_letter_ro (drive_letter, root);
ret = strdup (path + 2);
if (ret == NULL) {
perror ("strdup");
exit (EXIT_FAILURE);
}
}
else if (!*path) {
ret = strdup ("/");
if (ret == NULL) {
perror ("strdup");
exit (EXIT_FAILURE);
}
}
else {
ret = strdup (path);
if (ret == NULL) {
perror ("strdup");
exit (EXIT_FAILURE);
}
}
/* Blindly convert any backslashes into forward slashes. Is this good? */
for (i = 0; i < strlen (ret); ++i)
if (ret[i] == '\\')
ret[i] = '/';
/* If this fails, we want to return NULL. */
char *t = guestfs_case_sensitive_path (g, ret);
free (ret);
ret = t;
return ret;
}
static void
mount_drive_letter_ro (char drive_letter, const char *root)
{
char **drives;
char *device;
size_t i;
/* Resolve the drive letter using the drive mappings table. */
drives = guestfs_inspect_get_drive_mappings (g, root);
if (drives == NULL || drives[0] == NULL) {
fprintf (stderr, _("%s: to use Windows drive letters, this must be a Windows guest\n"),
program_name);
exit (EXIT_FAILURE);
}
device = NULL;
for (i = 0; drives[i] != NULL; i += 2) {
if (c_tolower (drives[i][0]) == drive_letter && drives[i][1] == '\0') {
device = drives[i+1];
break;
}
}
if (device == NULL) {
fprintf (stderr, _("%s: drive '%c:' not found.\n"),
program_name, drive_letter);
exit (EXIT_FAILURE);
}
/* Unmount current disk and remount device. */
if (guestfs_umount_all (g) == -1)
exit (EXIT_FAILURE);
if (guestfs_mount_ro (g, device, "/") == -1)
exit (EXIT_FAILURE);
for (i = 0; drives[i] != NULL; ++i)
free (drives[i]);
free (drives);
/* Don't need to free (device) because that string was in the
* drives array.
*/
}

View File

@@ -1,196 +0,0 @@
#!/usr/bin/perl -w
# virt-cat
# Copyright (C) 2009 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
use warnings;
use strict;
use Sys::Guestfs;
use Sys::Guestfs::Lib qw(open_guest get_partitions resolve_windows_path
inspect_all_partitions inspect_partition
inspect_operating_systems mount_operating_system);
use Pod::Usage;
use Getopt::Long;
use Data::Dumper;
use File::Temp qw/tempdir/;
use XML::Writer;
use Locale::TextDomain 'libguestfs';
=encoding utf8
=head1 NAME
virt-cat - Display a file in a virtual machine
=head1 SYNOPSIS
virt-cat [--options] domname file
virt-cat [--options] disk.img [disk.img ...] file
=head1 DESCRIPTION
C<virt-cat> is a command line tool to display the contents of C<file>
where C<file> exists in the named virtual machine (or disk image).
C<virt-cat> can be used to quickly view a single file. For more
complex cases you should look at the L<guestfish(1)> tool.
=head1 EXAMPLES
Display C</etc/fstab> file from inside the libvirt VM called
C<mydomain>:
virt-cat mydomain /etc/fstab
List syslog messages from a VM:
virt-cat mydomain /var/log/messages | tail
Find out what DHCP IP address a VM acquired:
virt-cat mydomain /var/log/messages | grep 'dhclient: bound to' | tail
Find out what packages were recently installed:
virt-cat mydomain /var/log/yum.log | tail
Find out who is logged on inside a virtual machine:
virt-cat mydomain /var/run/utmp > /tmp/utmp
who /tmp/utmp
or who was logged on:
virt-cat mydomain /var/log/wtmp > /tmp/wtmp
last -f /tmp/wtmp
=head1 OPTIONS
=over 4
=cut
my $help;
=item B<--help>
Display brief help.
=cut
my $version;
=item B<--version>
Display version number and exit.
=cut
my $uri;
=item B<--connect URI> | B<-c URI>
If using libvirt, connect to the given I<URI>. If omitted, then we
connect to the default libvirt hypervisor.
If you specify guest block devices directly, then libvirt is not used
at all.
=back
=cut
GetOptions ("help|?" => \$help,
"version" => \$version,
"connect|c=s" => \$uri,
) or pod2usage (2);
pod2usage (1) if $help;
if ($version) {
my $g = Sys::Guestfs->new ();
my %h = $g->version ();
print "$h{major}.$h{minor}.$h{release}$h{extra}\n";
exit
}
pod2usage (__"virt-cat: no image, VM names or filenames to cat given")
if @ARGV <= 1;
my $filename = pop @ARGV;
my $g;
if ($uri) {
$g = open_guest (\@ARGV, address => $uri);
} else {
$g = open_guest (\@ARGV);
}
$g->launch ();
$g->wait_ready ();
# List of possible filesystems.
my @partitions = get_partitions ($g);
# Now query each one to build up a picture of what's in it.
my %fses =
inspect_all_partitions ($g, \@partitions,
use_windows_registry => 0);
my $oses = inspect_operating_systems ($g, \%fses);
my @roots = keys %$oses;
die __"no root device found in this operating system image" if @roots == 0;
die __"multiboot operating systems are not supported by virt-cat" if @roots > 1;
my $root_dev = $roots[0];
my $os = $oses->{$root_dev};
mount_operating_system ($g, $os);
# Allow this to fail in case eg. the file does not exist.
# NB: https://bugzilla.redhat.com/show_bug.cgi?id=501888
print $g->download($filename, "/dev/stdout");
=head1 SEE ALSO
L<guestfs(3)>,
L<guestfish(1)>,
L<Sys::Guestfs(3)>,
L<Sys::Guestfs::Lib(3)>,
L<Sys::Virt(3)>,
L<http://libguestfs.org/>.
=head1 AUTHOR
Richard W.M. Jones L<http://et.redhat.com/~rjones/>
=head1 COPYRIGHT
Copyright (C) 2009 Red Hat Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

272
cat/virt-cat.pod Executable file
View File

@@ -0,0 +1,272 @@
=encoding utf8
=head1 NAME
virt-cat - Display files in a virtual machine
=head1 SYNOPSIS
virt-cat [--options] -d domname file [file ...]
virt-cat [--options] -a disk.img [-a disk.img ...] file [file ...]
Old-style:
virt-cat domname file
virt-cat disk.img file
=head1 DESCRIPTION
C<virt-cat> is a command line tool to display the contents of C<file>
where C<file> exists in the named virtual machine (or disk image).
Multiple filenames can be given, in which case they are concatenated
together. Each filename must be a full path, starting at the root
directory (starting with '/').
C<virt-cat> can be used to quickly view a file. To edit a file, use
C<virt-edit>. For more complex cases you should look at the
L<guestfish(1)> tool (see L</USING GUESTFISH> below).
=head1 EXAMPLES
Display C</etc/fstab> file from inside the libvirt VM called
C<mydomain>:
virt-cat -d mydomain /etc/fstab
List syslog messages from a VM disk image file:
virt-cat -a disk.img /var/log/messages | tail
Find out what DHCP IP address a VM acquired:
virt-cat -d mydomain /var/log/messages | \
grep 'dhclient: bound to' | tail
Find out what packages were recently installed:
virt-cat -d mydomain /var/log/yum.log | tail
Find out who is logged on inside a virtual machine:
virt-cat -d mydomain /var/run/utmp > /tmp/utmp
who /tmp/utmp
or who was logged on:
virt-cat -d mydomain /var/log/wtmp > /tmp/wtmp
last -f /tmp/wtmp
=head1 OPTIONS
=over 4
=item B<--help>
Display brief help.
=item B<-a> file
=item B<--add> file
Add I<file> which should be a disk image from a virtual machine. If
the virtual machine has multiple block devices, you must supply all of
them with separate I<-a> options.
The format of the disk image is auto-detected. To override this and
force a particular format use the I<--format=..> option.
=item B<-c> URI
=item B<--connect> URI
If using libvirt, connect to the given I<URI>. If omitted, then we
connect to the default libvirt hypervisor.
If you specify guest block devices directly (I<-a>), then libvirt is
not used at all.
=item B<-d> guest
=item B<--domain> guest
Add all the disks from the named libvirt guest. Domain UUIDs can be
used instead of names.
=item B<--echo-keys>
When prompting for keys and passphrases, virt-cat normally turns
echoing off so you cannot see what you are typing. If you are not
worried about Tempest attacks and there is no one else in the room you
can specify this flag to see what you are typing.
=item B<--format=raw|qcow2|..>
=item B<--format>
The default for the I<-a> option is to auto-detect the format of the
disk image. Using this forces the disk format for I<-a> options which
follow on the command line. Using I<--format> with no argument
switches back to auto-detection for subsequent I<-a> options.
For example:
virt-cat --format=raw -a disk.img file
forces raw format (no auto-detection) for C<disk.img>.
virt-cat --format=raw -a disk.img --format -a another.img file
forces raw format (no auto-detection) for C<disk.img> and reverts to
auto-detection for C<another.img>.
If you have untrusted raw-format guest disk images, you should use
this option to specify the disk format. This avoids a possible
security problem with malicious guests (CVE-2010-3851).
=item B<--keys-from-stdin>
Read key or passphrase parameters from stdin. The default is
to try to read passphrases from the user by opening C</dev/tty>.
=item B<-v>
=item B<--verbose>
Enable verbose messages for debugging.
=item B<-V>
=item B<--version>
Display version number and exit.
=item B<-x>
Enable tracing of libguestfs API calls.
=back
=head1 OLD-STYLE COMMAND LINE ARGUMENTS
Previous versions of virt-cat allowed you to write either:
virt-cat disk.img [disk.img ...] file
or
virt-cat guestname file
whereas in this version you should use I<-a> or I<-d> respectively
to avoid the confusing case where a disk image might have the same
name as a guest.
For compatibility the old style is still supported.
=head1 WINDOWS PATHS
C<virt-cat> has a limited ability to understand Windows drive letters
and paths (eg. C<E:\foo\bar.txt>).
If and only if the guest is running Windows then:
=over 4
=item *
Drive letter prefixes like C<C:> are resolved against the
Windows Registry to the correct filesystem.
=item *
Any backslash (C<\>) characters in the path are replaced
with forward slashes so that libguestfs can process it.
=item *
The path is resolved case insensitively to locate the file
that should be displayed.
=back
There are some known shortcomings:
=over 4
=item *
Some NTFS symbolic links may not be followed correctly.
=item *
NTFS junction points that cross filesystems are not followed.
=back
=head1 USING GUESTFISH
L<guestfish(1)> is a more powerful, lower level tool which you can use
when C<virt-cat> doesn't work.
Using C<virt-cat> is approximately equivalent to doing:
guestfish --ro -i -d domname download file -
where C<domname> is the name of the libvirt guest, and C<file> is the
full path to the file. Note the final C<-> (meaning "output to
stdout").
The command above uses libguestfs's guest inspection feature and so
does not work on guests that libguestfs cannot inspect, or on things
like arbitrary disk images that don't contain guests. To display a
file from a disk image directly, use:
guestfish --ro -a disk.img -m /dev/sda1 download file -
where C<disk.img> is the disk image, C</dev/sda1> is the filesystem
within the disk image, and C<file> is the full path to the file.
=head1 SHELL QUOTING
Libvirt guest names can contain arbitrary characters, some of which
have meaning to the shell such as C<#> and space. You may need to
quote or escape these characters on the command line. See the shell
manual page L<sh(1)> for details.
=head1 EXIT STATUS
This program returns 0 if successful, or non-zero if there was an
error.
=head1 SEE ALSO
L<guestfs(3)>,
L<guestfish(1)>,
L<virt-copy-out(1)>,
L<virt-edit(1)>,
L<virt-tar-out(1)>,
L<http://libguestfs.org/>.
=head1 AUTHOR
Richard W.M. Jones L<http://people.redhat.com/~rjones/>
=head1 COPYRIGHT
Copyright (C) 2010-2012 Red Hat Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

1190
cat/virt-filesystems.c Normal file

File diff suppressed because it is too large Load Diff

420
cat/virt-filesystems.pod Executable file
View File

@@ -0,0 +1,420 @@
=encoding utf8
=head1 NAME
virt-filesystems - List filesystems, partitions, block devices, LVM in a virtual machine or disk image
=head1 SYNOPSIS
virt-filesystems [--options] -d domname
virt-filesystems [--options] -a disk.img [-a disk.img ...]
=head1 DESCRIPTION
This tool allows you to discover filesystems, partitions, logical
volumes, and their sizes in a disk image or virtual machine. It is a
replacement for L<virt-list-filesystems(1)> and
L<virt-list-partitions(1)>.
One use for this tool is from shell scripts to iterate over all
filesystems from a disk image:
for fs in $(virt-filesystems -a disk.img); do
# ...
done
Another use is to list partitions before using another tool to modify
those partitions (such as L<virt-resize(1)>). If you are curious
about what an unknown disk image contains, use this tool along with
L<virt-inspector(1)>.
Various command line options control what this program displays. You
need to give either I<-a> or I<-d> options to specify the disk image
or libvirt guest respectively. If you just specify that then the
program shows filesystems found, one per line, like this:
$ virt-filesystems -a disk.img
/dev/sda1
/dev/vg_guest/lv_root
If you add I<-l> or I<--long> then the output includes extra
information:
$ virt-filesystems -a disk.img -l
Name Type VFS Label Size
/dev/sda1 filesystem ext4 boot 524288000
/dev/vg_guest/lv_root filesystem ext4 root 10212081664
If you add I<--extra> then non-mountable (swap, unknown) filesystems
are shown as well:
$ virt-filesystems -a disk.img --extra
/dev/sda1
/dev/vg_guest/lv_root
/dev/vg_guest/lv_swap
/dev/vg_guest/lv_data
If you add I<--partitions> then partitions are shown instead of filesystems:
$ virt-filesystems -a disk.img --partitions
/dev/sda1
/dev/sda2
Similarly you can use I<--logical-volumes>, I<--volume-groups>,
I<--physical-volumes>, I<--block-devices> to list those items.
You can use these options in combination as well (if you want a
combination including filesystems, you have to add I<--filesystems>).
Notice that some items fall into several categories (eg. C</dev/sda1>
might be both a partition and a filesystem). These items are listed
several times. To get a list which includes absolutely everything
that virt-filesystems knows about, use the I<--all> option.
UUIDs (because they are quite long) are not shown by default. Add the
I<--uuid> option to display device and filesystem UUIDs in the long
output.
I<--all --long --uuid> is a useful combination to display all possible
information about everything.
$ virt-filesystems -a win.img --all --long --uuid -h
Name Type VFS Label Size Parent UUID
/dev/sda1 filesystem ntfs System Reserved 100M - F81C92571C92112C
/dev/sda2 filesystem ntfs - 20G - F2E8996AE8992E3B
/dev/sda1 partition - - 100M /dev/sda -
/dev/sda2 partition - - 20G /dev/sda -
/dev/sda device - - 20G - -
For machine-readable output, use I<--csv> to get Comma-Separated Values.
=head1 OPTIONS
=over 4
=item B<--help>
Display brief help.
=item B<-a> file
=item B<--add> file
Add I<file> which should be a disk image from a virtual machine. If
the virtual machine has multiple block devices, you must supply all of
them with separate I<-a> options.
The format of the disk image is auto-detected. To override this and
force a particular format use the I<--format=..> option.
=item B<--all>
Display everything. This is currently the same as specifying these
options: I<--filesystems>, I<--extra>, I<--partitions>,
I<--block-devices>, I<--logical-volumes>, I<--volume-groups>,
I<--physical-volumes>. (More may be added to this list in future).
See also I<--long>.
=item B<--blkdevs>
=item B<--block-devices>
Display block devices.
=item B<-c> URI
=item B<--connect> URI
If using libvirt, connect to the given I<URI>. If omitted, then we
connect to the default libvirt hypervisor.
If you specify guest block devices directly (I<-a>), then libvirt is
not used at all.
=item B<--csv>
Write out the results in CSV format (comma-separated values). This
format can be imported easily into databases and spreadsheets, but
read L</NOTE ABOUT CSV FORMAT> below.
=item B<-d> guest
=item B<--domain> guest
Add all the disks from the named libvirt guest. Domain UUIDs can be
used instead of names.
=item B<--echo-keys>
When prompting for keys and passphrases, virt-filesystems normally
turns echoing off so you cannot see what you are typing. If you are
not worried about Tempest attacks and there is no one else in the room
you can specify this flag to see what you are typing.
=item B<--extra>
This causes filesystems that are not ordinary, mountable filesystems
to be displayed. This category includes swapspace, and filesystems
that are empty or contain unknown data.
This option implies I<--filesystems>.
=item B<--filesystems>
Display mountable filesystems. If no display option was selected then
this option is implied.
With I<--extra>, non-mountable filesystems are shown too.
=item B<--format=raw|qcow2|..>
=item B<--format>
The default for the I<-a> option is to auto-detect the format of the
disk image. Using this forces the disk format for I<-a> options which
follow on the command line. Using I<--format> with no argument
switches back to auto-detection for subsequent I<-a> options.
For example:
virt-filesystems --format=raw -a disk.img
forces raw format (no auto-detection) for C<disk.img>.
virt-filesystems --format=raw -a disk.img --format -a another.img
forces raw format (no auto-detection) for C<disk.img> and reverts to
auto-detection for C<another.img>.
If you have untrusted raw-format guest disk images, you should use
this option to specify the disk format. This avoids a possible
security problem with malicious guests (CVE-2010-3851).
=item B<-h>
=item B<--human-readable>
In I<--long> mode, display sizes in human-readable format.
=item B<--keys-from-stdin>
Read key or passphrase parameters from stdin. The default is
to try to read passphrases from the user by opening C</dev/tty>.
=item B<-l>
=item B<--long>
Display extra columns of data ("long format").
A title row is added unless you also specify I<--no-title>.
The extra columns displayed depend on what output you select, and the
ordering of columns may change in future versions. Use the title row,
I<--csv> output and/or L<csvtool(1)> to match columns to data in
external programs.
Use I<-h> if you want sizes to be displayed in human-readable format.
The default is to show raw numbers of I<bytes>.
Use I<--uuid> to display UUIDs too.
=item B<--lvs>
=item B<--logvols>
=item B<--logical-volumes>
Display LVM logical volumes. In this mode, these are displayed
irrespective of whether the LVs contain filesystems.
=item B<--no-title>
In I<--long> mode, don't add a title row.
Note that the order of the columns is not fixed, and may change in
future versions of virt-filesystems, so using this option may give you
unexpected surprises.
=item B<--parts>
=item B<--partitions>
Display partitions. In this mode, these are displayed
irrespective of whether the partitions contain filesystems.
=item B<--pvs>
=item B<--physvols>
=item B<--physical-volumes>
Display LVM physical volumes.
=item B<--uuid>
=item B<--uuids>
In I<--long> mode, display UUIDs as well.
=item B<-v>
=item B<--verbose>
Enable verbose messages for debugging.
=item B<-V>
=item B<--version>
Display version number and exit.
=item B<--vgs>
=item B<--volgroups>
=item B<--volume-groups>
Display LVM volume groups.
=item B<-x>
Enable tracing of libguestfs API calls.
=back
=head1 COLUMNS
Note that columns in the output are subject to reordering and change
in future versions of this tool.
=over 4
=item B<Name>
The filesystem, partition, block device or LVM name.
For device and partition names these are displayed as canonical
libguestfs names, so that for example C</dev/sda2> is the second
partition on the first device.
If the I<--long> option is B<not> specified, then only the name column
is shown in the output.
=item B<Type>
The object type, for example C<filesystem>, C<lv>, C<device> etc.
=item B<VFS>
If there is a filesystem, then this column displays the filesystem
type if one could be detected, eg. C<ext4>.
=item B<Label>
If the object has a label (used for identifying and mounting
filesystems) then this column contains the label.
=item B<MBR>
The partition type byte, displayed as a two digit hexadecimal number.
A comprehensive list of partition types can be found here:
L<http://www.win.tue.nl/~aeb/partitions/partition_types-1.html>
This is only applicable for DOS (MBR) partitions.
=item B<Size>
The size of the object in bytes. If the I<--human> option is used
then the size is displayed in a human-readable form.
=item B<Parent>
The parent column records the parent relationship between objects.
For example, if the object is a partition, then this column contains
the name of the containing device. If the object is a logical volume,
then this column is the name of the volume group.
If there is more than one parent, then this column is (internal to the
column) a comma-separated list, eg. C</dev/sda,/dev/sdb>.
=item B<UUID>
If the object has a UUID (used for identifying and mounting
filesystems and block devices) then this column contains the UUID as a
string.
The UUID is only displayed if the I<--uuid> option is given.
=back
=head1 NOTE ABOUT CSV FORMAT
Comma-separated values (CSV) is a deceptive format. It I<seems> like
it should be easy to parse, but it is definitely not easy to parse.
Myth: Just split fields at commas. Reality: This does I<not> work
reliably. This example has two columns:
"foo,bar",baz
Myth: Read the file one line at a time. Reality: This does I<not>
work reliably. This example has one row:
"foo
bar",baz
For shell scripts, use C<csvtool> (L<http://merjis.com/developers/csv>
also packaged in major Linux distributions).
For other languages, use a CSV processing library (eg. C<Text::CSV>
for Perl or Python's built-in csv library).
Most spreadsheets and databases can import CSV directly.
=head1 SHELL QUOTING
Libvirt guest names can contain arbitrary characters, some of which
have meaning to the shell such as C<#> and space. You may need to
quote or escape these characters on the command line. See the shell
manual page L<sh(1)> for details.
=head1 EXIT STATUS
This program returns 0 if successful, or non-zero if there was an
error.
=head1 SEE ALSO
L<guestfs(3)>,
L<guestfish(1)>,
L<virt-cat(1)>,
L<virt-df(1)>,
L<virt-list-filesystems(1)>,
L<virt-list-partitions(1)>,
L<csvtool(1)>,
L<http://libguestfs.org/>.
=head1 AUTHOR
Richard W.M. Jones L<http://people.redhat.com/~rjones/>
=head1 COPYRIGHT
Copyright (C) 2010 Red Hat Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

1185
cat/virt-ls.c Normal file

File diff suppressed because it is too large Load Diff

527
cat/virt-ls.pod Executable file
View File

@@ -0,0 +1,527 @@
=encoding utf8
=head1 NAME
virt-ls - List files in a virtual machine
=head1 SYNOPSIS
virt-ls [--options] -d domname directory [directory ...]
virt-ls [--options] -a disk.img [-a disk.img ...] directory [directory ...]
Old style:
virt-ls [--options] domname directory
virt-ls [--options] disk.img [disk.img ...] directory
=head1 DESCRIPTION
C<virt-ls> lists filenames, file sizes, checksums, extended attributes
and more from a virtual machine or disk image.
Multiple directory names can be given, in which case the output from
each is concatenated.
To list directories from a libvirt guest use the I<-d> option to
specify the name of the guest. For a disk image, use the I<-a>
option.
C<virt-ls> can do many simple file listings. For more complicated
cases you may need to use L<guestfish(1)>, or write a program directly
to the L<guestfs(3)> API.
=head1 EXAMPLES
Get a list of all files and directories in a virtual machine:
virt-ls -R -d guest /
List all setuid or setgid programs in a Linux virtual machine:
virt-ls -lR -d guest / | grep '^- [42]'
List all public-writable directories in a Linux virtual machine:
virt-ls -lR -d guest / | grep '^d ...7'
List all Unix domain sockets in a Linux virtual machine:
virt-ls -lR -d guest / | grep '^s'
List all regular files with filenames ending in '.png':
virt-ls -lR -d guest / | grep -i '^-.*\.png$'
To display files larger than 10MB in home directories:
virt-ls -lR -d guest /home | awk '$3 > 10*1024*1024'
Find everything modified in the last 7 days:
virt-ls -lR -d guest --time-days / | awk '$6 <= 7'
Find regular files modified in the last 24 hours:
virt-ls -lR -d guest --time-days / | grep '^-' | awk '$6 < 1'
=head2 DIFFERENCES IN SNAPSHOTS AND BACKING FILES
Find the differences between files in a guest and an earlier snapshot
of the same guest.
virt-ls -lR -a snapshot.img / --uids --time-t > old
virt-ls -lR -a current.img / --uids --time-t > new
diff -u old new | less
The commands above won't find files where the content has changed but
the metadata (eg. file size and modification date) is the same. To do
that, you need to add the I<--checksum> parameter to both C<virt-ls>
commands. I<--checksum> can be quite slow since it has to read and
compute a checksum of every regular file in the virtual machine.
=head1 OUTPUT MODES
C<virt-ls> has four output modes, controlled by different
combinations of the I<-l> and I<-R> options.
=head2 SIMPLE LISTING
A simple listing is like the ordinary L<ls(1)> command:
$ virt-ls -d guest /
bin
boot
[etc.]
=head2 LONG LISTING
With the I<-l> (I<--long>) option, the output is like the C<ls -l>
command (more specifically, like the C<guestfs_ll> function).
$ virt-ls -l -d guest /
total 204
dr-xr-xr-x. 2 root root 4096 2009-08-25 19:06 bin
dr-xr-xr-x. 5 root root 3072 2009-08-25 19:06 boot
[etc.]
Note that while this is useful for displaying a directory, do not try
parsing this output in another program. Use L</RECURSIVE LONG LISTING>
instead.
=head2 RECURSIVE LISTING
With the I<-R> (I<--recursive>) option, C<virt-ls> lists the names of
files and directories recursively:
$ virt-ls -R -d guest /tmp
foo
foo/bar
[etc.]
To generate this output, C<virt-ls> runs the C<guestfs_find0> function
and converts C<\0> characters to C<\n>.
=head2 RECURSIVE LONG LISTING
Using I<-lR> options together changes the output to display
directories recursively, with file stats, and optionally other
features such as checksums and extended attributes.
Most of the interesting features of C<virt-ls> are only available when
using I<-lR> mode.
The fields are normally space-separated. Filenames are B<not> quoted,
so you cannot use the output in another program (because filenames can
contain spaces and other unsafe characters). If the guest was
untrusted and someone knew you were using C<virt-ls> to analyze the
guest, they could play tricks on you by creating filenames with
embedded newline characters. To B<safely> parse the output in another
program, use the I<--csv> (Comma-Separated Values) option.
Note that this output format is completely unrelated to the C<ls -lR>
command.
$ virt-ls -lR -d guest /bin
d 0555 4096 /bin
- 0755 123 /bin/alsaunmute
- 0755 28328 /bin/arch
l 0777 4 /bin/awk -> gawk
- 0755 27216 /bin/basename
- 0755 943360 /bin/bash
[etc.]
These basic fields are always shown:
=over 4
=item type
The file type, one of:
C<-> (regular file),
C<d> (directory),
C<c> (character device),
C<b> (block device),
C<p> (named pipe),
C<l> (symbolic link),
C<s> (socket) or
C<u> (unknown).
=item permissions
The Unix permissions, displayed as a 4 digit octal number.
=item size
The size of the file. This is shown in bytes unless I<-h> or
I<--human-readable> option is given, in which case this is shown as a
human-readable number.
=item path
The full path of the file or directory.
=item link
For symbolic links only, the link target.
=back
In I<-lR> mode, additional command line options enable the display of
more fields.
With the I<--uids> flag, these additional fields are displayed before
the path:
=over 4
=item uid
=item gid
The UID and GID of the owner of the file (displayed numerically).
Note these only make sense in the context of a Unix-like guest.
=back
With the I<--times> flag, these additional fields are displayed:
=over 4
=item atime
The time of last access.
=item mtime
The time of last modification.
=item ctime
The time of last status change.
=back
The time fields are displayed as string dates and times, unless one of
the I<--time-t>, I<--time-relative> or I<--time-days> flags is given.
With the I<--extra-stats> flag, these additional fields are displayed:
=over 4
=item device
The device containing the file (displayed as major:minor).
This may not match devices as known to the guest.
=item inode
The inode number.
=item nlink
The number of hard links.
=item rdev
For block and char special files, the device
(displayed as major:minor).
=item blocks
The number of 512 byte blocks allocated to the file.
=back
With the I<--checksum> flag, the checksum of the file contents is
shown (only for regular files). Computing file checksums can take a
considerable amount of time.
=head1 OPTIONS
=over 4
=item B<--help>
Display brief help.
=item B<-a> file
=item B<--add> file
Add I<file> which should be a disk image from a virtual machine. If
the virtual machine has multiple block devices, you must supply all of
them with separate I<-a> options.
The format of the disk image is auto-detected. To override this and
force a particular format use the I<--format=..> option.
=item B<--checksum>
=item B<--checksum=crc|md5|sha1|sha224|sha256|sha384|sha512>
Display checksum over file contents for regular files. With no
argument, this defaults to using I<md5>. Using an argument, you can
select the checksum type to use.
This option only has effect in I<-lR> output mode. See
L</RECURSIVE LONG LISTING> above.
=item B<-c> URI
=item B<--connect> URI
If using libvirt, connect to the given I<URI>. If omitted, then we
connect to the default libvirt hypervisor.
If you specify guest block devices directly (I<-a>), then libvirt is
not used at all.
=item B<--csv>
Write out the results in CSV format (comma-separated values). This
format can be imported easily into databases and spreadsheets, but
read L</NOTE ABOUT CSV FORMAT> below.
=item B<-d> guest
=item B<--domain> guest
Add all the disks from the named libvirt guest. Domain UUIDs can be
used instead of names.
=item B<--echo-keys>
When prompting for keys and passphrases, virt-ls normally turns
echoing off so you cannot see what you are typing. If you are not
worried about Tempest attacks and there is no one else in the room you
can specify this flag to see what you are typing.
=item B<--extra-stats>
Display extra stats.
This option only has effect in I<-lR> output mode. See
L</RECURSIVE LONG LISTING> above.
=item B<--format=raw|qcow2|..>
=item B<--format>
The default for the I<-a> option is to auto-detect the format of the
disk image. Using this forces the disk format for I<-a> options which
follow on the command line. Using I<--format> with no argument
switches back to auto-detection for subsequent I<-a> options.
For example:
virt-ls --format=raw -a disk.img /dir
forces raw format (no auto-detection) for C<disk.img>.
virt-ls --format=raw -a disk.img --format -a another.img /dir
forces raw format (no auto-detection) for C<disk.img> and reverts to
auto-detection for C<another.img>.
If you have untrusted raw-format guest disk images, you should use
this option to specify the disk format. This avoids a possible
security problem with malicious guests (CVE-2010-3851).
=item B<-h>
=item B<--human-readable>
Display file sizes in human-readable format.
This option only has effect in I<-lR> output mode. See
L</RECURSIVE LONG LISTING> above.
=item B<--keys-from-stdin>
Read key or passphrase parameters from stdin. The default is
to try to read passphrases from the user by opening C</dev/tty>.
=item B<-l>
=item B<--long>
=item B<-R>
=item B<--recursive>
Select the mode. With neither of these options, C<virt-ls> produces a
simple, flat list of the files in the named directory. See
L</SIMPLE LISTING>.
C<virt-ls -l> produces a "long listing", which shows more detail. See
L</LONG LISTING>.
C<virt-ls -R> produces a recursive list of files starting at the named
directory. See L</RECURSIVE LISTING>.
C<virt-ls -lR> produces a recursive long listing which can be more
easily parsed. See L</RECURSIVE LONG LISTING>.
=item B<--times>
Display time fields.
This option only has effect in I<-lR> output mode. See
L</RECURSIVE LONG LISTING> above.
=item B<--time-days>
Display time fields as days before now (negative if in the future).
Note that C<0> in output means "up to 1 day before now", or that the
age of the file is between 0 and 86399 seconds.
This option only has effect in I<-lR> output mode. See
L</RECURSIVE LONG LISTING> above.
=item B<--time-relative>
Display time fields as seconds before now (negative if in the future).
This option only has effect in I<-lR> output mode. See
L</RECURSIVE LONG LISTING> above.
=item B<--time-t>
Display time fields as seconds since the Unix epoch.
This option only has effect in I<-lR> output mode. See
L</RECURSIVE LONG LISTING> above.
=item B<--uids>
Display UID and GID fields.
This option only has effect in I<-lR> output mode. See
L</RECURSIVE LONG LISTING> above.
=item B<-v>
=item B<--verbose>
Enable verbose messages for debugging.
=item B<-V>
=item B<--version>
Display version number and exit.
=item B<-x>
Enable tracing of libguestfs API calls.
=back
=head1 OLD-STYLE COMMAND LINE ARGUMENTS
Previous versions of virt-ls allowed you to write either:
virt-ls disk.img [disk.img ...] /dir
or
virt-ls guestname /dir
whereas in this version you should use I<-a> or I<-d> respectively
to avoid the confusing case where a disk image might have the same
name as a guest.
For compatibility the old style is still supported.
=head1 NOTE ABOUT CSV FORMAT
Comma-separated values (CSV) is a deceptive format. It I<seems> like
it should be easy to parse, but it is definitely not easy to parse.
Myth: Just split fields at commas. Reality: This does I<not> work
reliably. This example has two columns:
"foo,bar",baz
Myth: Read the file one line at a time. Reality: This does I<not>
work reliably. This example has one row:
"foo
bar",baz
For shell scripts, use C<csvtool> (L<http://merjis.com/developers/csv>
also packaged in major Linux distributions).
For other languages, use a CSV processing library (eg. C<Text::CSV>
for Perl or Python's built-in csv library).
Most spreadsheets and databases can import CSV directly.
=head1 SHELL QUOTING
Libvirt guest names can contain arbitrary characters, some of which
have meaning to the shell such as C<#> and space. You may need to
quote or escape these characters on the command line. See the shell
manual page L<sh(1)> for details.
=head1 EXIT STATUS
This program returns 0 if successful, or non-zero if there was an
error.
=head1 SEE ALSO
L<guestfs(3)>,
L<guestfish(1)>,
L<virt-cat(1)>,
L<virt-copy-out(1)>,
L<virt-tar-out(1)>,
L<Sys::Guestfs(3)>,
L<Sys::Guestfs::Lib(3)>,
L<Sys::Virt(3)>,
L<http://libguestfs.org/>.
=head1 AUTHOR
Richard W.M. Jones L<http://people.redhat.com/~rjones/>
=head1 COPYRIGHT
Copyright (C) 2009-2012 Red Hat Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

38
cfg.mk
View File

@@ -27,47 +27,27 @@ url_dir_list = \
# Tests not to run as part of "make distcheck".
local-checks-to-skip = \
sc_po_check \
changelog-check \
check-AUTHORS \
makefile-check \
makefile_path_separator_check \
patch-check \
sc_GPL_version \
sc_always_defined_macros \
sc_cast_of_alloca_return_value \
sc_dd_max_sym_length \
sc_error_exit_success \
sc_file_system \
sc_immutable_NEWS \
sc_makefile_path_separator_check \
sc_obsolete_symbols \
sc_prohibit_S_IS_definition \
sc_prohibit_atoi_atof \
sc_prohibit_jm_in_m4 \
sc_prohibit_quote_without_use \
sc_prohibit_quotearg_without_use \
sc_prohibit_stat_st_blocks \
sc_prohibit_strcmp_and_strncmp \
sc_prohibit_strcmp \
sc_root_tests \
sc_space_tab \
sc_sun_os_names \
sc_system_h_headers \
sc_tight_scope \
sc_two_space_separator_in_usage \
sc_error_message_uppercase \
sc_program_name \
sc_require_test_exit_idiom \
sc_makefile_check \
$(disable_temporarily) \
sc_useless_cpp_parens
disable_temporarily = \
sc_makefile_check \
sc_unmarked_diagnostics \
sc_prohibit_ctype_h \
sc_prohibit_asprintf \
sc_m4_quote_check \
sc_avoid_ctype_macros \
sc_avoid_write
# Avoid uses of write(2). Either switch to streams (fwrite), or use
@@ -120,16 +100,16 @@ sc_avoid_ctype_macros:
1>&2; exit 1; } || :
sc_prohibit_virBufferAdd_with_string_literal:
@re='\<virBufferAdd *\([^,]+, *"[^"]' \
msg='use virBufferAddLit, not virBufferAdd, with a string literal' \
$(_prohibit_regexp)
@prohibit='\<virBufferAdd *\([^,]+, *"[^"]' \
halt='use virBufferAddLit, not virBufferAdd, with a string literal' \
$(_sc_search_regexp)
# Not only do they fail to deal well with ipv6, but the gethostby*
# functions are also not thread-safe.
sc_prohibit_gethostby:
@re='\<gethostby(addr|name2?) *\(' \
msg='use getaddrinfo, not gethostby*' \
$(_prohibit_regexp)
@prohibit='\<gethostby(addr|name2?) *\(' \
halt='use getaddrinfo, not gethostby*' \
$(_sc_search_regexp)
# Disallow trailing blank lines.
sc_prohibit_trailing_blank_lines:
@@ -152,7 +132,9 @@ ifeq (0,$(MAKELEVEL))
# submodule name. Contrast these:
# -b653eda3ac4864de205419d9f41eec267cb89eeb .gnulib
# b653eda3ac4864de205419d9f41eec267cb89eeb .gnulib (v0.0-2286-gb653eda)
_submodule_hash = sed 's/.//;s/ .*//'
# $ cat .git-module-status
# b653eda3ac4864de205419d9f41eec267cb89eeb
_submodule_hash = sed 's/^[ +-]//;s/ .*//'
_update_required := $(shell \
actual=$$(git submodule status | $(_submodule_hash)); \
stamp="$$($(_submodule_hash) $(_curr_status) 2>/dev/null)"; \

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,28 @@
centos5.3-libguestfs.spec
[REMOVED]
This used to be a centos5.3 specfile. Please use the specfile
from EL-5 here:
http://cvs.fedoraproject.org/viewvc/rpms/libguestfs/EL-5/
Random contributions and things which don't fit in anywhere else
----------------------------------------------------------------------
febootstrap/
An experimental, non-working attempt to use febootstrap
to install operating systems.
autobuild/
The autobuild script that we use to build and test the
tarballs on Debian and elsewhere.
fedora-libguestfs.spec
[REMOVED]
This used to be a Fedora 10+ specfile. Please use the specfile
from Fedora instead:
http://cvs.fedoraproject.org/viewvc/rpms/libguestfs/devel/
guestfsd-in-wine.sh
Run a Windows-compiled guestfsd under Wine. Read the
instructions at the top of this file carefully.
intro/ "Slides" for an intro to libguestfs. This is a short (10-15
min) talk that I give to introduce the main features of
libguestfs. The slides are in the form of a complete
self-contained HTML page with a handful images that can be
easily distributed before the talk.
make-check-on-installed.pl
This Perl script allows you to run the test suite (ie. 'make
check', 'make extra-tests' etc) on an installed RPM. This is
useful for adding another layer of testing to packages before
we release them. Note that a checked out copy of the source
from git is required. Read the top of the file before using.
visualize-alignment/
Tests for visualizing block device reads and writes and
alignment using a patched qemu. See the README file in that
directory.

109
contrib/autobuild/autobuild.sh Executable file
View File

@@ -0,0 +1,109 @@
#!/bin/bash -
# libguestfs autobuild script
# Copyright (C) 2009-2012 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# This script is used to download and test the latest tarball on
# Debian and other platforms. It runs from a cron job and sends email
# to the mailing list about the status.
set -e
# Subject line of email prefix.
prefix="${1:-[autobuild]}"
# Where we send mail.
mailto="rjones@redhat.com"
# Move to temporary directory for building.
tmpdir="$(mktemp -d --tmpdir=/var/tmp)"
cd "$tmpdir"
# The libguestfs index page contains some hidden fields to help us
# find the latest version programmatically.
version=$(wget --no-cache -O- -q http://libguestfs.org |
grep '^LATEST-VERSION:' | awk '{print $2}')
url=$(wget --no-cache -O- -q http://libguestfs.org |
grep '^LATEST-URL:' | awk '{print $2}')
filename=$(basename "$url")
directory=$(basename "$url" .tar.gz)
echo "--------------------------------------------------"
echo "prefix $prefix"
echo "libguestfs $version"
echo "url $url"
echo "build dir $tmpdir/$directory"
echo "--------------------------------------------------"
# Grab the latest tarball from upstream.
wget "$url"
# Unpack the tarball.
tar zxf "$filename"
# Enter directory.
cd "$directory"
# This function is called if any step fails.
failed ()
{
tail -100 ../build.log > ../build.log.tail
mutt -s "$prefix libguestfs $version FAILED $1" "$mailto" -a ../build.log.tail <<EOF
Autobuild failed. The last 100 lines of the build log are
attached.
For the full log see the build machine, in
$tmpdir/build.log
EOF
rm ../build.log.tail
}
# This function is called if the build is successful.
ok ()
{
mutt -s "$prefix libguestfs $version ok" "$mailto" <<EOF
Autobuild was successful.
For the full log see the build machine, in
$tmpdir/build.log
EOF
}
# Ensure that we get full debugging output.
export LIBGUESTFS_DEBUG=1
export LIBGUESTFS_TRACE=1
# Configure and build.
echo "configure"
./configure > ../build.log 2>&1 || {
failed "configure"
exit 1
}
echo "make"
make >> ../build.log 2>&1 || {
failed "make"
exit 1
}
# Run the tests.
echo "make check"
make check >> ../build.log 2>&1 || {
failed "make check"
exit 1
}
echo "finished"
ok

View File

@@ -1,21 +0,0 @@
<p>
This script shows how to make a fresh virtual machine, installing an
operating system like Fedora or some Red Hat-derived operating system
such as <a href="http://www.redhat.com/rhel/">Red Hat Enterprise
Linux</a> or <a href="http://centos.org/">CentOS</a>.
</p>
<p>
It's fairly easy to modify this script to install Debian derivatives
too (even from a Fedora host),
using <a href="http://packages.debian.org/stable/admin/debootstrap">debootstrap</a>.
</p>
<p>
<i>After</i> running the script, you can boot the new virtual
machine by doing:
</p>
<pre>
qemu-kvm -m 512 -hda /tmp/vm.img
</pre>

View File

@@ -1,39 +0,0 @@
#!/bin/sh -
#vm=/tmp/vm.img
vm=/mnt/share/tmp/vm.img
modules="--group-install Core -i kernel -i grub"
# Choose one:
#febootstrap $modules fedora-10 local
febootstrap $modules fedora-11 local
#febootstrap $modules centos-5 local http://mirror.centos.org/centos-5/5.3/os/i386/
tar zcf local.tar.gz local
#rm -rf local
guestfish <<EOF
#alloc $vm 8GB
add $vm
run
sfdisk /dev/sda 0 0 0 ',100 ,'
echo Size of /dev/sda1:
blockdev-getsize64 /dev/sda1
echo Size of /dev/sda2:
blockdev-getsize64 /dev/sda2
lvm-remove-all
pvcreate /dev/sda2
vgcreate VG /dev/sda2
lvcreate Root VG 6000
lvcreate Swap VG 500
mkfs ext3 /dev/sda1
mkfs ext3 /dev/VG/Root
mount /dev/VG/Root /
mkdir /boot
mount /dev/sda1 /boot
tgz-in local.tar.gz /
grub-install / /dev/sda
EOF
#rm local.tar.gz

View File

@@ -1 +0,0 @@
Fresh install of Fedora or a Red Hat-derived operating system

117
contrib/guestfsd-in-wine.sh Executable file
View File

@@ -0,0 +1,117 @@
#!/bin/bash -
# Copyright (C) 2009 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# INSTRUCTIONS
#----------------------------------------------------------------------
#
# This is a QEMU wrapper script that allows you to run a
# Windows-compiled guestfsd.exe (daemon) under Wine from a Linux main
# program. You need to read and understand all the instructions below
# before use.
#
# To understand how to compile the daemon for Windows, please read:
# http://www.redhat.com/archives/libguestfs/2009-November/msg00255.html
#
# Adjust the Wine configuration so it can find the libraries, as
# described here:
# http://fedoraproject.org/wiki/MinGW/Configure_wine
#
# On Fedora 13 there is a serious bug in Wine. See:
# https://bugzilla.redhat.com/show_bug.cgi?id=533806#c11
#
# If necessary, adjust the line 'guestfsd=...' below so it points to
# the correct location of the guestfsd.exe program. You can use an
# absolute path here if you want.
guestfsd=daemon/guestfsd.exe
#
# This script is a QEMU wrapper. It pretends to be qemu as far as
# libguestfs programs are concerned. Read this to understand the
# purpose of QEMU wrappers:
# http://libguestfs.org/guestfs.3.html#qemu_wrappers
#
# With this script, the qemu program is not actually run. Instead we
# pretend to be qemu, parse out the necessary parts of the long
# command line that libguestfs passes to qemu, and run the Windows
# daemon, under Wine, with the right command line. The Windows daemon
# then hopefully connects back to the libguestfs socket, and as far as
# the libguestfs program is concerned, it looks like a full appliance
# is running.
#
# To use this script, you must set the environment variable
# LIBGUESTFS_QEMU=/path/to/contrib/guestfsd-in-wine.sh (ie. the path
# to this script).
#
# You can then run libguestfs test programs, and (hopefully!) they'll
# use the Windows guestfsd.exe, simulating calls using Wine.
#
# For example from the top build directory:
#
# LIBGUESTFS_QEMU=contrib/guestfsd-in-wine.sh ./run ./fish/guestfish
#
# Another suggested environment variable is LIBGUESTFS_DEBUG=1 which
# will give you must more detail about what is going on. Also look at
# the contents of the log file 'guestfsd-in-wine.log' after each run.
#
#----------------------------------------------------------------------
# Note that stdout & stderr messages will get eaten by libguestfs
# early on in the process. Therefore write log messages to
# a log file.
exec 5>>guestfsd-in-wine.log
echo "Environment:" >&5
printenv | grep LIBGUESTFS >&5
echo "Command line:" >&5
echo " $@" >&5
# We're called several times, first with -help and -version, and we
# have to pretend to be qemu! (At least enough to trick libguestfs).
if [ "$1" = "-help" ]; then
echo -- " -net user "
echo -- " -no-hpet "
echo -- " -rtc-td-hack "
exit 0
elif [ "$1" = "-version" ]; then
echo -- "0.0.0"
exit 0
fi
# The interesting parameter is -append.
append=
while [ $# -gt 0 ]; do
if [ $1 = "-append" ]; then
append="$2"
shift
fi
shift
done
echo "Append parameter:" >&5
echo " $append" >&5
# guestfs_vmchannel parameter.
vmchannel_param=$(echo "$append" | grep -Eo 'guestfs_vmchannel=[^[:space:]]+')
echo "Vmchannel parameter:" >&5
echo " $vmchannel_param" >&5
# Port number.
port=$(echo "$vmchannel_param" | grep -Eo '[[:digit:]]+$')
echo "Port number:" >&5
echo " $vmchannel_param" >&5
# Run guestfsd.exe.
echo "Command:" >&5
echo " $guestfsd -f -v -c tcp:localhost:$port" >&5
$guestfsd -f -v -c tcp:127.0.0.1:$port

View File

@@ -0,0 +1,400 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<title>Short introduction to libguestfs</title>
<style>
body {
counter-reset: chapter;
}
body > p, body > img, body > pre, body > table {
margin-left: 2em;
}
h1 {
color: rgb(204,0,0);
font-size: 130%;
border-bottom: 1px solid rgb(204,0,0);
}
author {
display: block;
position: absolute;
right: 2em;
top: 1em;
font-size: 80%;
text-align: right;
}
h2 {
margin-top: 4em;
color: rgb(204,0,0);
counter-increment: chapter;
counter-reset: section;
}
h2:before {
font-size: 80%;
color: #666;
content: counter(chapter) " ... ";
}
pre {
background-color: #fcfcfc;
border-top: 1px dotted #eee;
border-bottom: 1px dotted #eee;
border-left: 2px solid rgb(204,0,0);
padding: 5px;
margin-left: 1em;
}
p.sourcelnk {
text-align: left;
font-size: 70%;
}
</style>
</head>
<body>
<h1>Short introduction to libguestfs</h1>
<author>by Richard W.M. Jones &lt;rjones@redhat.com&gt;</author>
<h2>The Idea</h2>
<p><b>Reuse qemu, Linux kernel and userspace tools</b> to read and
write disk images.</p>
<object type="image/svg+xml" data="overview.svg">
<img src="overview.png"/> <!-- fallback for lame IE -->
</object>
<h2>The Stable API</h2>
<pre>
/* get the Linux VFS type corresponding to a mounted device */
extern char *<b>guestfs_vfs_type</b> (guestfs_h *g, const char *device);
</pre>
<table style="margin-bottom: 4em;" width="100%">
<tr><td valign="top">Example using this API:</td><td>
<pre>
#include &lt;guestfs.h&gt;
char *fstype = <b>guestfs_vfs_type (g, "/dev/vda1")</b>;
printf ("%s\n", fstype);
free (fstype);
&rarr; <b>ntfs</b>
</pre>
<p class="sourcelnk"><a href="http://git.annexia.org/?p=libguestfs.git;a=blob;f=fish/inspect.c;h=2ca54d2296fce5370504c1085cbcd7ac1b51ad3a;hb=HEAD#l208">click&nbsp;to&nbsp;see&nbsp;a&nbsp;real&nbsp;example&nbsp;...</a></p>
</td>
</tr>
</table>
<table width="100%">
<tr><td valign="top">
<pre>
("<b>vfs_type</b>",
(RString "fstype",
[Device "device"], []),
198, [],
[ (* tests *) ],
"get the Linux VFS type corresponding to a mounted device",
"\
This command gets the filesystem type corresponding to
the filesystem on C&lt;device&gt;.
For most filesystems, the result is the name of the Linux
VFS module which would be used to mount this filesystem
if you mounted it without specifying the filesystem type.
For example a string such as C&lt;ext3&gt; or C&lt;ntfs&gt;.");
</pre>
<p class="sourcelnk"><a href="http://git.annexia.org/?p=libguestfs.git;a=blob;f=generator/generator_actions.ml;h=d3fa3e0b939eb047a5ff103a68f09c6898807748;hb=HEAD#l4775">full&nbsp;source&nbsp;...</a></p>
</td>
<td valign="top">
<pre>
char *
<b>do_vfs_type</b> (const char *device)
{
return get_blkid_tag (device, "TYPE");
}
static char *
get_blkid_tag (const char *device, const char *tag)
{
char *out, *err;
int r;
r = commandr (&amp;out, &amp;err,
"blkid",
"-c", "/dev/null",
"-o", "value", "-s", tag, device, NULL);
if (r != 0 &amp;&amp; r != 2) {
if (r &gt;= 0)
reply_with_error ("%s: %s (blkid returned %d)",
device, err, r);
else
reply_with_error ("%s: %s", device, err);
free (out);
free (err);
return NULL;
}
/* ... */
return out; /* caller frees */
}
</pre>
<p class="sourcelnk"><a href="http://git.annexia.org/?p=libguestfs.git;a=blob;f=daemon/blkid.c;hb=HEAD">full&nbsp;source&nbsp;...</a></p>
</td>
</tr>
</table>
<p>
Just these two fragments generate:
</p>
<ul>
<li> bindings in <a href="http://libguestfs.org/guestfs.3.html#api_overview">C</a>,
<a href="http://libguestfs.org/guestfs-perl.3.html">Perl</a>,
<a href="http://libguestfs.org/guestfs-python.3.html">Python</a>,
<a href="http://libguestfs.org/guestfs-ruby.3.html">Ruby</a>,
<a href="http://libguestfs.org/guestfs-java.3.html">Java</a>,
<a href="http://libguestfs.org/guestfs-ocaml.3.html">OCaml</a>,
PHP,
Haskell,
<a href="http://libguestfs.org/guestfs-erlang.3.html">Erlang</a>
and C# </li>
<li> <a href="http://libguestfs.org/guestfish.1.html">guestfish</a>
(shell script) </li>
<li> documentation in man pages and HTML </li>
<li> internal RPC code </li>
</ul>
<h2>Tools written around the API</h2>
<object type="image/svg+xml" data="tools.svg">
<img src="tools.png"/> <!-- fallback for lame IE -->
</object>
<table>
<tr><td valign="top" style="padding-bottom: 1.5em;" colspan="2">
<pre>
<b>guestfish -N bootrootlv:/dev/VG/LV:ext4:ext4:10G:256M &lt;&lt;EOF</b>
<font style="color: green;">mount-options "" /dev/VG/LV /
mkdir /boot
mount-options "" /dev/sda1 /boot
txz-in filesystem.tar.xz /
write /etc/HOSTNAME "test01.example.com\n"
upload /etc/resolv.conf /etc/resolv.conf</font>
<b>EOF</b>
<b>guestmount -a test1.img -i mnt/</b>
<b>ls mnt</b>
bin dev home lib mnt proc sbin tmp var
boot etc initrd.img lost+found old-root root sys usr vmlinuz
<b>cat mnt/etc/HOSTNAME</b>
test01.example.com
<b>fusermount -u mnt</b>
</pre>
<p class="sourcelnk"><a href="http://libguestfs.org/guestfish.1.html">manual&nbsp;for&nbsp;guestfish&nbsp;...</a> <br/>
<a href="http://libguestfs.org/guestmount.1.html">manual&nbsp;for&nbsp;guestmount&nbsp;...</a></p>
</td></tr>
<tr><td valign="top" style="padding-bottom: 1.5em;">
<pre>
<b>virt-df -a /dev/vg/F15x32 -h</b>
Filesystem Size Used Available Use%
F15x32:/dev/sda1 484M 31M 428M 7%
F15x32:/dev/vg_f15x32/lv_root 5.5G 3.4G 1.8G 63%
</pre>
<p class="sourcelnk"><a href="http://libguestfs.org/virt-df.1.html">manual&nbsp;...</a></p>
</td>
<td valign="top" style="padding-bottom: 1.5em;">
<pre>
<b>virt-cat -c qemu:///system -d WinXP 'c:\boot.ini'</b>
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS=
"Microsoft Windows XP Professional" /noexecute=optin
/fastdetect
</pre>
<p class="sourcelnk"><a href="http://libguestfs.org/virt-cat.1.html">manual&nbsp;...</a></p>
</td></tr>
<tr><td valign="top" style="padding-bottom: 1.5em;">
<pre>
<b>virt-edit -c qemu:///system -d F15x32 /etc/passwd</b>
<i>(launches text editor to edit guest /etc/passwd)</i>
<b>virt-edit -c qemu:///system -d F15x32 /etc/passwd \
-e 's/^root:.*?:/root::/'</b>
</pre>
<p class="sourcelnk"><a href="http://libguestfs.org/virt-edit.1.html">manual&nbsp;...</a></p>
</td><td valign="top" style="padding-bottom: 1.5em;">
<pre>
<b>virt-win-reg -c qemu:///system --unsafe-printable-strings \
Win7x32 'HKLM\SYSTEM\ControlSet001\Services\Tcpip\Parameters' \
| grep DhcpIPAddress</b>
"DhcpIPAddress"=str(1):"192.168.122.178"
</pre>
<p class="sourcelnk"><a href="http://libguestfs.org/virt-win-reg.1.html">manual&nbsp;...</a></p>
</td></tr>
</table>
<h2>Inspection</h2>
<pre>
$ <b>virt-filesystems -c qemu:///system -d Win7x32 --all --long -h --uuid</b>
Name Type VFS Label MBR Size Parent UUID
/dev/sda1 filesystem ntfs System Reserved - 100M - F81C92571C92112C
/dev/sda2 filesystem ntfs - - 20G - F2E8996AE8992E3B
/dev/sda1 partition - - 07 100M /dev/sda -
/dev/sda2 partition - - 07 20G /dev/sda -
/dev/sda device - - - 20G - -
</pre>
<p class="sourcelnk">
<a href="http://libguestfs.org/virt-filesystems.1.html">manual&nbsp;...</a>
</p>
<pre>
$ <b>virt-inspector -c qemu:///system -d Win7x32</b>
<font style="color: #888;">&lt;?xml version="1.0"?&gt;</font>
<font style="color: #888;">&lt;operatingsystems&gt;</font>
<font style="color: #888;">&lt;operatingsystem&gt;</font>
<font style="color: #888;">&lt;root&gt;</font>/dev/sda2<font style="color: #888;">&lt;/root&gt;</font>
<font style="color: #888;">&lt;name&gt;</font>windows<font style="color: #888;">&lt;/name&gt;</font>
<font style="color: #888;">&lt;arch&gt;</font>i386<font style="color: #888;">&lt;/arch&gt;</font>
<font style="color: #888;">&lt;distro&gt;</font>windows<font style="color: #888;">&lt;/distro&gt;</font>
<font style="color: #888;">&lt;product_name&gt;</font>Windows 7 Enterprise<font style="color: #888;">&lt;/product_name&gt;</font>
<font style="color: #888;">&lt;product_variant&gt;</font>Client<font style="color: #888;">&lt;/product_variant&gt;</font>
<font style="color: #888;">&lt;major_version&gt;</font>6<font style="color: #888;">&lt;/major_version&gt;</font>
<font style="color: #888;">&lt;minor_version&gt;</font>1<font style="color: #888;">&lt;/minor_version&gt;</font>
<font style="color: #888;">&lt;windows_systemroot&gt;</font>/Windows<font style="color: #888;">&lt;/windows_systemroot&gt;</font>
<font style="color: #888;">&lt;windows_current_control_set&gt;</font>ControlSet001<font style="color: #888;">&lt;/windows_current_control_set&gt;</font>
<font style="color: #888;">&lt;hostname&gt;</font>win7x32<font style="color: #888;">&lt;/hostname&gt;</font>
<i>... etc ...</i>
</pre>
<p class="sourcelnk">
<a href="win7.xml">full&nbsp;XML&nbsp;...</a> <br/>
<a href="http://libguestfs.org/virt-inspector.1.html">manual&nbsp;...</a>
</p>
<pre>
char **roots;
size_t i;
char *type, *distro, *product_name;
int major, minor;
roots = <b>guestfs_inspect_os</b> (g);
if (roots == NULL)
exit (EXIT_FAILURE);
if (roots[0] == NULL) {
fprintf (stderr, "no operating systems found\n");
exit (EXIT_FAILURE);
}
for (i = 0; roots[i] != NULL; ++i) {
type = <b>guestfs_inspect_get_type</b> (g, roots[i]);
distro = <b>guestfs_inspect_get_distro</b> (g, roots[i]);
product_name = <b>guestfs_inspect_get_product_name</b> (g, roots[i]);
major = <b>guestfs_inspect_get_major_version</b> (g, roots[i]);
minor = <b>guestfs_inspect_get_minor_version</b> (g, roots[i]);
printf ("Root: %s\n"
" Type: %s\n"
" Distro: %s\n"
" Version: %d.%d\n"
" Product name: %s\n\n");
roots[i],
type ? : "unknown", distro ? : "unknown", major, minor,
product_name ? : "");
free (type);
free (distro);
free (product_name);
free (roots[i]);
}
free (roots);
</pre>
<p class="sourcelnk"><a href="http://git.annexia.org/?p=libguestfs.git;a=blob;f=rescue/virt-rescue.c;h=0c0036460434f1365d9591d6b2b805d999b07056;hb=HEAD#l351">full&nbsp;source&nbsp;...</a></p>
<table>
<tr><td colspan="2" align="middle">
<small><i>Click to enlarge the images</i></small>
</td></tr>
<tr><td width="50%">
<a href="virt-manager.png"><img src="virt-manager-t.png"></a>
</td><td width="50%" align="middle" valign="top">
<a href="vmm-icons.png"><img src="vmm-icons-t.png"></a>
</td></tr>
</table>
<h2>Graphical browsers</h2>
<p>
<img src="https://rwmj.files.wordpress.com/2011/07/guestfs-browser1.png?w=438&h=450"/>
</p>
<p>
<img src="https://rwmj.files.wordpress.com/2011/07/guestfs-browser2.png?w=438&h=450"/>
</p>
<p>
<img src="https://rwmj.files.wordpress.com/2011/07/guestfs-browser3.png?w=366&h=450"/>
</p>
<p>
<img src="https://rwmj.files.wordpress.com/2011/07/guestfs-browser4.png?w=366&h=450"/>
</p>
<p class="sourcelnk"><a href="https://rwmj.wordpress.com/2011/07/29/some-screenshots-from-the-new-guest-filesystem-browser/">source&nbsp;...</a></p>
<p>
<img src="https://rwmj.files.wordpress.com/2009/11/file-browser.png?w=500"/>
</p>
<p class="sourcelnk"><a href="https://rwmj.wordpress.com/2009/11/03/browsing-guests-using-fuse/">source&nbsp;...</a></p>
<h2>Find out more ...</h2>
<p>
<a href="http://libguestfs.org/">libguestfs.org</a> is the
main website.
</p>
<p>
<a href="http://libguestfs.org/guestfs.3.html">guestfs(3)</a>
is the manual page documenting the C API and the internals.
</p>
<p>
There are manual pages
documenting <a href="http://libguestfs.org/guestfish.1.html">guestfish</a>, <a href="http://libguestfs.org/guestmount.1.html">guestmount</a>
and each virt tool. See
the <a href="http://libguestfs.org/">main website</a> or your
local man command.
</p>
<p>
For information about virt-v2v and virt-p2v, see
<a href="http://libguestfs.org/virt-v2v/">http://libguestfs.org/virt-v2v/</a>
</p>
<hr/>
<p style="font-size: 70%;">
This page &copy; 2011 Red Hat Inc. and distributed
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
</p>
</body>
</html>

BIN
contrib/intro/overview.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

524
contrib/intro/overview.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 281 KiB

162
contrib/intro/talk.txt Normal file
View File

@@ -0,0 +1,162 @@
This is a short (10-15 min) talk that I give to introduce the main
features of libguestfs. The "slides" are in the form of a complete
self-contained HTML page with a handful images that can be easily
distributed before the talk.
----------------------------------------------------------------------
[1 The Idea]
The "big idea" behind libguestfs is to read and write disk
images by reusing all the qemu, Linux kernel and userspace
code.
This gives us tremendous power in a relatively small
library: we can handle all Linux filesystems, all Windows
filesystems, LVM, BSD, containers like raw and qcow, CD ISOs,
USB keys, regular hard disks, and lots more.
If you give us a btrfs filesystem in a BSD partition wrapped
in a qcow2 file -- that is something we can handle.
libguestfs -- as the name suggests -- is a plain, ordinary
shared library written in C that you can link to C programs.
You're all very smart people and you will have guessed
already that we don't in fact run qemu as a library inside
libguestfs as this diagram suggests. Instead we fork
qemu or KVM, running a small "appliance" which has
the usual kernel, a small Linux distribution with tools
like mkfs, lvcreate and parted, and a libguestfs daemon.
The library and the daemon talk to each other over a
virtio-serial connection.
The qemu instance is connected to the disks we are
examining using the ordinary qemu -drive option.
[2 The Stable API]
Consider how you might send commands to the daemon.
Example: Create a filesystem (mkfs).
One thing you might do is to send shell commands over
the virtio-serial connection. It would send "mkfs -t ..."
This is something that is possible using the libguestfs
API, but we don't encourage it. There are three reasons
why we don't encourage and support this: one is that
because we're calling this from a C program, it's hard
to construct shell commands.
Secondly it's hard to parse the result from commands
(think about parted or lvs which are two commands that
produce quite complex output that is hard to parse).
Thirdly the command line isn't very long-term stable,
with some commands appearing and changing over time.
I'd emphasize again that we do let you send shell
commands over to the daemon if that's what you want to do.
What we support, though, is a long-term stable API and ABI.
It's slightly (but not very much) higher level than shell
commands.
I've got an example on the page. This is the guestfs_vfs_type
API which returns the name of the filesystem on a device.
Like libvirt, we are serious about the long term stability
of the API and ABI, and if you write your program against
this API, you'll never have to change the program or even
recompile it.
Because there are 100s of commands that you might want to
run, we made it exceptionally simple to add new APIs.
Shown below is the actual code used to implement "vfs-type".
On the right is the code fragment that runs in the daemon.
This is a short C function which handles constructing the
command line and parsing out the result. Although there
is parsing code here, the good thing is that it only exists
in one place, and we can update it from time to time if
the underlying shell commands change.
On the left is the metadata for this API function. It
has a description of the parameters and return value,
some tests (not shown), and a fragment of documentation.
That's ALL you have to write. From that, we generate
header files, bindings in all the different languages,
RPC for the virtio-serial connection, documentation, etc.
Currently we generate about a quarter of a million lines
of code and documentation.
[3 Tools written around the API]
Around this stable API, myself and the libguestfs team
have written a number of tools. There are also people
in the community writing other tools.
A few of them are shown on this diagram, in fact there
are many more than are shown here.
Starting at the top, "guestfish" is a shell for the API,
letting you write simple shell scripts. If you look at
the code examples below, you can see a small guestfish
script that creates a complete guest. Then we mount it on
the host using guestmount (FUSE) and browse around.
Going round clockwise:
The libguestfs API is a mix of high-level calls like
mkfs, lvremove, vfs-type; and also low level POSIX calls
like mkdir and writing to files.
"guestmount" lets you mount an existing filesystem from
a guest and access it as a regular mountpoint on the host.
guestmount intelligently caches and prefetches data so it's
quite usable and fast from the command line or graphical
programs like the GNOME Nautilus file browser.
"virt-rescue" lets you use the appliance directly, and
it's a useful way to rescue guests by hand.
"virt-win-reg" lets you read and write Windows Registry
entries. There is a rather complex example below right.
Now we come round to the "inspection" tools, and these
three tools let you inspect an unknown guest to find out
what operating system it contains, what applications are
installed, what filesystems, how the filesystems are used
and much more. I cover that in the next section, but if
you look below you'll see an example of running "virt-df".
Finally there are now tools to resize guests, make them
sparse, align them, and check their alignment. These
last tools are ones that we eventually hope will become
obsolete.
[4 Inspection]
Next I want to look at another aspect of the API which is
called "inspection".
Inspection means taking arbitrary disk images and finding
out what they contain, from just what partitions and filesystems
are in a disk image, to whether and what operating system(s)
it contains, to what applications are installed.
The two main command-line tools are virt-filesystems and
virt-inspector, and you can see the output from these tools.
However this information is also available through the
API. The example there shows getting operating system
inspection data from a C program. Programs can also get
inspection information, as you can see in the screenshots
from the latest virt-manager.
[5 Graphical browsers]
I've concentrated a lot on command line tools, but you can
also use libguestfs from graphical programs. I wrote an
experimental program called guestfs-browser, and there are
screenshots shown. But many people will simply want to mount
a filesystem on the host using guestmount, and then use
ordinary tools. At the bottom is a screenshot of GNOME
Nautilus browsing into a guest filesystem.

BIN
contrib/intro/tools.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

711
contrib/intro/tools.svg Normal file
View File

@@ -0,0 +1,711 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="629.526"
height="475.37674"
preserveAspectRatio="xMinYMin meet"
viewBox="0 0 630.14339 474.34607"
id="svg2"
version="1.1"
inkscape:version="0.48.1 r9760"
sodipodi:docname="libguestfs-tools.svg">
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="305.93218"
inkscape:cy="244.25314"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1400"
inkscape:window-height="833"
inkscape:window-x="26"
inkscape:window-y="31"
inkscape:window-maximized="0"
fit-margin-top="10"
fit-margin-left="10"
fit-margin-right="10"
fit-margin-bottom="10">
<inkscape:grid
type="xygrid"
id="grid3046"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<defs
id="defs4">
<marker
style="overflow:visible"
id="Arrow1Mend"
refX="0"
refY="0"
orient="auto"
inkscape:stockid="Arrow1Mend">
<path
transform="matrix(-0.4,0,0,-0.4,-4,0)"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
id="path4254"
inkscape:connector-curvature="0" />
</marker>
<marker
style="overflow:visible"
id="Arrow1Lend"
refX="0"
refY="0"
orient="auto"
inkscape:stockid="Arrow1Lend">
<path
inkscape:connector-curvature="0"
transform="matrix(-0.8,0,0,-0.8,-10,0)"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
id="path4149" />
</marker>
<inkscape:perspective
id="perspective3761"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 526.18109 : 1"
sodipodi:type="inkscape:persp3d" />
<marker
style="overflow:visible"
id="Arrow1LendR"
refX="0"
refY="0"
orient="auto"
inkscape:stockid="Arrow1LendR">
<path
inkscape:connector-curvature="0"
transform="matrix(-0.8,0,0,-0.8,-10,0)"
style="fill:#8c8989;fill-rule:evenodd;stroke:#8c8989;stroke-width:1pt;marker-start:none"
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
id="path4924" />
</marker>
<marker
style="overflow:visible"
id="Arrow1LendH"
refX="0"
refY="0"
orient="auto"
inkscape:stockid="Arrow1LendH">
<path
inkscape:connector-curvature="0"
transform="matrix(-0.8,0,0,-0.8,-10,0)"
style="fill:#888888;fill-rule:evenodd;stroke:#888888;stroke-width:1pt;marker-start:none"
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
id="path5584" />
</marker>
<marker
style="overflow:visible"
id="Arrow1Lendi"
refX="0"
refY="0"
orient="auto"
inkscape:stockid="Arrow1Lendi">
<path
inkscape:connector-curvature="0"
transform="matrix(-0.8,0,0,-0.8,-10,0)"
style="fill:#888888;fill-rule:evenodd;stroke:#888888;stroke-width:1pt;marker-start:none"
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
id="path5587" />
</marker>
<marker
style="overflow:visible"
id="Arrow1Lendn"
refX="0"
refY="0"
orient="auto"
inkscape:stockid="Arrow1Lendn">
<path
inkscape:connector-curvature="0"
transform="matrix(-0.8,0,0,-0.8,-10,0)"
style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
id="path5590" />
</marker>
<marker
style="overflow:visible"
id="Arrow1LendnS"
refX="0"
refY="0"
orient="auto"
inkscape:stockid="Arrow1LendnS">
<path
inkscape:connector-curvature="0"
transform="matrix(-0.8,0,0,-0.8,-10,0)"
style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
id="path5709" />
</marker>
<marker
style="overflow:visible"
id="Arrow1LendnS4"
refX="0"
refY="0"
orient="auto"
inkscape:stockid="Arrow1LendnS4">
<path
inkscape:connector-curvature="0"
transform="matrix(-0.8,0,0,-0.8,-10,0)"
style="fill:#888888;fill-rule:evenodd;stroke:#888888;stroke-width:1pt;marker-start:none"
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
id="path5832" />
</marker>
<marker
style="overflow:visible"
id="Arrow1MendG"
refX="0"
refY="0"
orient="auto"
inkscape:stockid="Arrow1MendG">
<path
transform="matrix(-0.4,0,0,-0.4,-4,0)"
style="fill:#ff0000;fill-rule:evenodd;stroke:#ff0000;stroke-width:1pt;marker-start:none"
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
id="path4721"
inkscape:connector-curvature="0" />
</marker>
</defs>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(-61.579184,-78.961745)"
id="layer1"
inkscape:groupmode="layer"
inkscape:label="Layer 1">
<text
sodipodi:linespacing="125%"
id="text3793"
y="269.36218"
x="306"
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
xml:space="preserve"><tspan
y="269.36218"
x="306"
id="tspan3795"
sodipodi:role="line" /></text>
<text
sodipodi:linespacing="125%"
id="text3797"
y="267.36218"
x="304"
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
xml:space="preserve"><tspan
y="267.36218"
x="304"
id="tspan3799"
sodipodi:role="line" /></text>
<g
id="g3942"
transform="matrix(0.72385693,0,0,0.72385693,134.30682,108.78183)">
<rect
style="fill:#ffdcdc;fill-opacity:1;stroke:#190000;stroke-width:2.94564199;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect2985"
width="294.189"
height="237.99187"
x="190.705"
y="154.46817" />
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
x="239"
y="201.36218"
id="text3757"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3759"
x="239"
y="201.36218">libguestfs</tspan></text>
<g
id="g4614"
transform="matrix(0.88003385,0,0,0.86189263,26.891233,24.839975)">
<rect
y="219.36218"
x="218"
height="40"
width="58"
id="rect3779"
style="fill:#fff6f6;fill-opacity:1;stroke:#190000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<text
sodipodi:linespacing="125%"
id="text3789"
y="247.36218"
x="223"
style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
xml:space="preserve"><tspan
y="247.36218"
x="223"
id="tspan3791"
sodipodi:role="line">mkfs</tspan></text>
</g>
<g
transform="matrix(0.87343177,0,0,0.83132964,36.681547,40.720104)"
id="g3077">
<rect
style="fill:#fff6f6;fill-opacity:1;stroke:#190000;stroke-width:1.2677021;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3781"
width="96.596542"
height="38.597645"
x="279.26575"
y="246.24846" />
<text
sodipodi:linespacing="125%"
id="text3801"
y="271.77777"
x="287.50287"
style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
xml:space="preserve"><tspan
y="271.77777"
x="287.50287"
id="tspan3803"
sodipodi:role="line">lvcreate</tspan></text>
</g>
<g
transform="matrix(0.9731636,0,0,0.89682062,-4.7939037,17.840053)"
id="g3072">
<rect
y="228.36218"
x="389"
height="40"
width="77.964508"
id="rect3783"
style="fill:#fff6f6;fill-opacity:1;stroke:#190000;stroke-width:1.15940309;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<text
sodipodi:linespacing="125%"
id="text3805"
y="256.36218"
x="396"
style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
xml:space="preserve"><tspan
y="256.36218"
x="396"
id="tspan3807"
sodipodi:role="line">parted</tspan></text>
</g>
<g
id="g3931">
<rect
style="fill:#fff6f6;fill-opacity:1;stroke:#190000;stroke-width:0.74572152;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3048"
width="264"
height="30.02943"
x="200.91432"
y="352.42081" />
<text
xml:space="preserve"
style="font-size:22px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
x="220.93394"
y="372.44043"
id="text3050"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3052"
x="220.93394"
y="372.44043">qemu</tspan></text>
<text
xml:space="preserve"
style="font-size:14.01373005px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Liberation Sans Narrow;-inkscape-font-specification:Sans"
x="371.08105"
y="372.44043"
id="text3054"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3056"
x="371.08105"
y="372.44043">raw</tspan></text>
<text
xml:space="preserve"
style="font-size:14.01373005px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Liberation Sans Narrow;-inkscape-font-specification:Sans"
x="421.1301"
y="372.44043"
id="text3058"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3060"
x="421.1301"
y="372.44043">qcow2</tspan></text>
<text
xml:space="preserve"
style="font-size:14.01373005px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Liberation Sans Narrow;-inkscape-font-specification:Sans"
x="323.02417"
y="372.91223"
id="text3062"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3064"
x="323.02417"
y="372.91223">vmdk</tspan></text>
</g>
<g
id="g3922">
<rect
y="292.36197"
x="200.91432"
height="54"
width="264"
id="rect3777"
style="fill:#fff6f6;fill-opacity:1;stroke:#190000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<text
sodipodi:linespacing="125%"
id="text3785"
y="326.63818"
x="220.52794"
style="font-size:22px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
xml:space="preserve"><tspan
y="326.63818"
x="220.52794"
id="tspan3787"
sodipodi:role="line">Linux kernel</tspan></text>
<text
xml:space="preserve"
style="font-size:14.01373005px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Liberation Sans Narrow;-inkscape-font-specification:Sans"
x="391.51471"
y="315.46762"
id="text3082"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3084"
x="391.51471"
y="315.46762">ext4</tspan></text>
<text
xml:space="preserve"
style="font-size:14.01373005px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:condensed;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Liberation Sans Narrow;-inkscape-font-specification:Sans"
x="426.90472"
y="333.87045"
id="text3086"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3088"
x="426.90472"
y="333.87045">btrfs</tspan></text>
</g>
</g>
<g
id="g3888"
transform="translate(-85.64383,133.06644)">
<rect
ry="9.1923885"
transform="matrix(1.0009807,0,0,1.0009807,10.718182,61.430592)"
y="19.7358"
x="163.34166"
height="31.819805"
width="145.66399"
id="rect3060"
style="fill:#cc0000;fill-opacity:1;stroke:none" />
<text
transform="matrix(1.0009807,0,0,1.0009807,10.718182,61.430592)"
sodipodi:linespacing="125%"
id="text3884"
y="40.241898"
x="178.89801"
style="font-size:16px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans Bold"
xml:space="preserve"><tspan
y="40.241898"
x="178.89801"
id="tspan3886"
sodipodi:role="line">virt-resize</tspan></text>
</g>
<g
transform="translate(268.25631,31.143212)"
id="g3901">
<rect
style="fill:#cc0000;fill-opacity:1;stroke:none"
id="rect3895"
width="145.66399"
height="31.819805"
x="163.34166"
y="19.7358"
ry="9.1923885"
transform="matrix(1.0009807,0,0,1.0009807,10.718182,61.430592)" />
<text
xml:space="preserve"
style="font-size:16px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans Bold"
x="178.89801"
y="40.241898"
id="text3897"
sodipodi:linespacing="125%"
transform="matrix(1.0009807,0,0,1.0009807,10.718182,61.430592)"><tspan
sodipodi:role="line"
id="tspan3899"
x="178.89801"
y="40.241898">guestmount</tspan></text>
</g>
<g
transform="translate(94.845234,16.279406)"
id="g3917">
<rect
ry="9.2014036"
y="72.692146"
x="110.51801"
height="31.851011"
width="145.80684"
id="rect3908"
style="fill:#cc0000;fill-opacity:1;stroke:none" />
<text
sodipodi:linespacing="125%"
id="text3910"
y="93.218353"
x="126.08962"
style="font-size:16.01569176px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans Bold"
xml:space="preserve"><tspan
y="93.218353"
x="126.08962"
id="tspan3912"
sodipodi:role="line">guestfish</tspan></text>
</g>
<g
id="g4006"
transform="translate(12.032604,19.818407)">
<rect
style="fill:#cc0000;fill-opacity:1;stroke:none"
id="rect3997"
width="145.80684"
height="31.851011"
x="523.87335"
y="229.11598"
ry="9.2014036" />
<text
xml:space="preserve"
style="font-size:16.01569176px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans Bold"
x="539.44495"
y="249.6422"
id="text3999"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4001"
x="539.44495"
y="249.6422">virt-rescue</tspan></text>
</g>
<g
transform="translate(-102.63104,181.19685)"
id="g4011">
<rect
style="fill:#cc0000;fill-opacity:1;stroke:none"
id="rect4013"
width="145.66399"
height="31.819805"
x="163.34166"
y="19.7358"
transform="matrix(1.0009807,0,0,1.0009807,10.718182,61.430592)"
ry="9.1923885" />
<text
xml:space="preserve"
style="font-size:16px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans Bold"
x="178.89801"
y="40.241898"
id="text4015"
sodipodi:linespacing="125%"
transform="matrix(1.0009807,0,0,1.0009807,10.718182,61.430592)"><tspan
sodipodi:role="line"
id="tspan4017"
x="178.89801"
y="40.241898">virt-sparsify</tspan></text>
</g>
<g
id="g4081"
transform="translate(-5.6624019,-29.72761)">
<rect
ry="9.2014036"
y="341.65622"
x="82.206001"
height="31.851011"
width="145.80684"
id="rect4021"
style="fill:#cc0000;fill-opacity:1;stroke:none" />
<text
transform="scale(0.97311457,1.0276282)"
sodipodi:linespacing="125%"
id="text4023"
y="352.44501"
x="87.536247"
style="font-size:15.58510303px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans Bold"
xml:space="preserve"><tspan
y="352.44501"
x="87.536247"
id="tspan4025"
sodipodi:role="line">virt-alignment-scan</tspan></text>
</g>
<g
id="g4038"
transform="translate(-7.7858026,8.4936029)">
<rect
style="fill:#cc0000;fill-opacity:1;stroke:none"
id="rect4029"
width="145.80684"
height="31.851011"
x="134.58322"
y="428.71567"
ry="9.2014036" />
<text
xml:space="preserve"
style="font-size:16.01569176px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans Bold"
x="150.15482"
y="449.24185"
id="text4031"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4033"
x="150.15482"
y="449.24185">virt-inspector</tspan></text>
</g>
<g
transform="translate(75.026826,46.714815)"
id="g4043">
<rect
ry="9.2014036"
y="428.71567"
x="134.58322"
height="31.851011"
width="145.80684"
id="rect4045"
style="fill:#cc0000;fill-opacity:1;stroke:none" />
<text
sodipodi:linespacing="125%"
id="text4047"
y="449.24185"
x="150.15482"
style="font-size:16.01569176px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans Bold"
xml:space="preserve"><tspan
y="449.24185"
x="150.15482"
id="tspan4049"
sodipodi:role="line">virt-filesystems</tspan></text>
</g>
<g
id="g4076"
transform="translate(38.929013,4.2468014)">
<rect
style="fill:#cc0000;fill-opacity:1;stroke:none"
id="rect4053"
width="102.63103"
height="31.851011"
x="265.52628"
y="508.69708"
ry="9.2014036" />
<text
xml:space="preserve"
style="font-size:16.01569176px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans Bold"
x="281.09787"
y="529.22327"
id="text4055"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4057"
x="281.09787"
y="529.22327">virt-df</tspan></text>
</g>
<g
id="g4108"
transform="translate(-7.0780024,24.773008)">
<rect
ry="9.2014036"
y="411.72845"
x="496.97693"
height="31.851011"
width="145.80684"
id="rect4061"
style="fill:#cc0000;fill-opacity:1;stroke:none" />
<text
sodipodi:linespacing="125%"
id="text4063"
y="432.25464"
x="512.54852"
style="font-size:16.01569176px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans Bold"
xml:space="preserve"><tspan
y="432.25464"
x="512.54852"
id="tspan4065"
sodipodi:role="line">virt-win-reg</tspan></text>
</g>
<text
xml:space="preserve"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
x="380.42343"
y="96.660439"
id="text4086"
sodipodi:linespacing="125%"
transform="matrix(1.0009807,0,0,1.0009807,64.410388,68.552031)"><tspan
sodipodi:role="line"
id="tspan4088"
x="380.42343"
y="96.660439">FUSE / POSIX</tspan></text>
<text
xml:space="preserve"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
x="180.31223"
y="81.811195"
id="text4090"
sodipodi:linespacing="125%"
transform="matrix(1.0009807,0,0,1.0009807,64.410388,68.552031)"><tspan
sodipodi:role="line"
id="tspan4092"
x="180.31223"
y="81.811195">shell scripts</tspan></text>
<text
xml:space="preserve"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
x="105.35891"
y="291.11481"
id="text4094"
sodipodi:linespacing="125%"
transform="matrix(1.0009807,0,0,1.0009807,64.410388,68.552031)"><tspan
sodipodi:role="line"
id="tspan4096"
x="105.35891"
y="291.11481">align &amp; resize</tspan></text>
<text
xml:space="preserve"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
x="247.48737"
y="384.45288"
id="text4098"
sodipodi:linespacing="125%"
transform="matrix(1.0009807,0,0,1.0009807,64.410388,68.552031)"><tspan
sodipodi:role="line"
id="tspan4100"
x="247.48737"
y="384.45288">inspection</tspan></text>
<text
xml:space="preserve"
style="font-size:14.01373005px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
x="500.41534"
y="405.25153"
id="text4102"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4104"
x="500.41534"
y="405.25153">Windows</tspan><tspan
sodipodi:role="line"
x="500.41534"
y="422.76868"
id="tspan4106">guests</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
contrib/intro/vmm-icons.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

164
contrib/intro/win7.xml Normal file
View File

@@ -0,0 +1,164 @@
<?xml version="1.0"?>
<operatingsystems>
<operatingsystem>
<root>/dev/sda2</root>
<name>windows</name>
<arch>i386</arch>
<distro>windows</distro>
<product_name>Windows 7 Enterprise</product_name>
<product_variant>Client</product_variant>
<major_version>6</major_version>
<minor_version>1</minor_version>
<windows_systemroot>/Windows</windows_systemroot>
<windows_current_control_set>ControlSet001</windows_current_control_set>
<hostname>win7x32</hostname>
<format>installed</format>
<mountpoints>
<mountpoint dev="/dev/sda2">/</mountpoint>
</mountpoints>
<filesystems>
<filesystem dev="/dev/sda2">
<type>ntfs</type>
<uuid>F2E8996AE8992E3B</uuid>
</filesystem>
</filesystems>
<drive_mappings>
<drive_mapping name="C">/dev/sda2</drive_mapping>
</drive_mappings>
<applications>
<application>
<name>Microsoft .NET Framework 4 Client Profile</name>
<display_name>Microsoft .NET Framework 4 Client Profile</display_name>
<version>4.0.30319</version>
<install_path>C:\Windows\Microsoft.NET\Framework\v4.0.30319\SetupCache\Client</install_path>
<publisher>Microsoft Corporation</publisher>
<url>http://go.microsoft.com/fwlink/?LinkId=164164</url>
</application>
<application>
<name>Mozilla Firefox (3.6.12)</name>
<display_name>Mozilla Firefox (3.6.12)</display_name>
<version>3.6.12 (en-GB)</version>
<install_path>C:\Program Files\Mozilla Firefox</install_path>
<publisher>Mozilla</publisher>
<url>http://www.mozilla.com/en-GB/</url>
<description>Mozilla Firefox</description>
</application>
<application>
<name>VLC media player</name>
<display_name>VLC media player 1.1.5</display_name>
<version>1.1.5</version>
<install_path>C:\Program Files\VideoLAN\VLC</install_path>
<publisher>VideoLAN</publisher>
<url>http://www.videolan.org/</url>
</application>
<application>
<name>{3C3901C5-3455-3E0A-A214-0B093A5070A6}</name>
<display_name>Microsoft .NET Framework 4 Client Profile</display_name>
<version>4.0.30319</version>
<publisher>Microsoft Corporation</publisher>
<url>http://go.microsoft.com/fwlink/?LinkId=164164</url>
</application>
<application>
<name>{3C3901C5-3455-3E0A-A214-0B093A5070A6}.KB2468871</name>
<display_name>Update for Microsoft .NET Framework 4 Client Profile (KB2468871)</display_name>
<version>1</version>
<publisher>Microsoft Corporation</publisher>
<url>http://support.microsoft.com</url>
<description>This update is for Microsoft .NET Framework 4 Client Profile.&#13;
If you later install a more recent service pack, this update will be uninstalled automatically.&#13;
For more information, visit http://support.microsoft.com/kb/2468871.</description>
</application>
<application>
<name>{3C3901C5-3455-3E0A-A214-0B093A5070A6}.KB2518870</name>
<display_name>Security Update for Microsoft .NET Framework 4 Client Profile (KB2518870)</display_name>
<version>1</version>
<publisher>Microsoft Corporation</publisher>
<url>http://support.microsoft.com</url>
<description>This security update is for Microsoft .NET Framework 4 Client Profile.&#13;
If you later install a more recent service pack, this security update will be uninstalled automatically.&#13;
For more information, visit http://support.microsoft.com/kb/2518870.</description>
</application>
<application>
<name>{3C3901C5-3455-3E0A-A214-0B093A5070A6}.KB2533523</name>
<display_name>Update for Microsoft .NET Framework 4 Client Profile (KB2533523)</display_name>
<version>1</version>
<publisher>Microsoft Corporation</publisher>
<url>http://support.microsoft.com</url>
<description>This update is for Microsoft .NET Framework 4 Client Profile.&#13;
If you later install a more recent service pack, this update will be uninstalled automatically.&#13;
For more information, visit http://support.microsoft.com/kb/2533523.</description>
</application>
<application>
<name>{3C3901C5-3455-3E0A-A214-0B093A5070A6}.KB2539636</name>
<display_name>Security Update for Microsoft .NET Framework 4 Client Profile (KB2539636)</display_name>
<version>1</version>
<publisher>Microsoft Corporation</publisher>
<url>http://support.microsoft.com</url>
<description>This security update is for Microsoft .NET Framework 4 Client Profile.&#13;
If you later install a more recent service pack, this security update will be uninstalled automatically.&#13;
For more information, visit http://support.microsoft.com/kb/2539636.</description>
</application>
</applications>
<icon>iVBORw0KGgoAAAANSUhEUgAAADYAAAA3CAIAAADIey4vAAAMo0lEQVRoge2YaViTVxbHMQlb
CCGCW6lVNinIYpURbQcqiiRAWILIIgLKLmEnkAQJa4CELYAJqwIadgFBVkHZEVAQQXZEwQVL
rdpxaVWgdY4ynQ/zzMwzIm0/DOc5H9577/n//ue5yXvfNxEQWI3VWI3VWI3/t0CJIDYqIZXw
KE07oW8cRPQCIOEChkhlPCxBwZ/WG2K9AkrD6ovD4eYR+ZzKntobd9pGHnZNzkHCBQwTK7oP
heVtPhwGZVD8hza3BrtJeK+9If109bXbE7NP7z56MjbzaPD2gxvj9/rGpiHhAoYweWf2ydjD
J5XdE/rULJCA8I9oD6l4YMdxVkPf5O2Hj6Gb1v6Jxt6x+p6R2q7hmq6hmqsfsmsIhjAJS1AA
ZZMPHtf3ToAQ5AD53dpDCglpWPmnVgzfne0YmKi+Olje1l/SdKPwcm9+4/W8hmv8Sz3/TBjC
JCxBAZRBMUhACHKACCAFf5f+MNouZ+t7rg1Plbf05Tf05NRezarqTK9sT7vQlnqhlVf+rwmT
sAQFUAbFIAEhyAECKACuWG+ioqJ4PEEaT85vvNbQPZhb3Z5a3pxcciWhsJHFr4s4UxGSWhyU
kk9LzjvJLQjNKIvKrWHlXWLnN0DGQhY0xBU0JhZdBgkIQQ4QQEkT3AEL8E/tb82aNd9++608
3pGdf+liay+3pDEur5aZUx2WXUXnFvsxuawAymknC/6hA3wjrRxrfZanm184JyApn5FZEXqm
+resCjtTHZ5TDUKQAwRQsQWXAAtwsPikFuXk5LQMLfB+py62XI87Vx2WWU5PLQ3glnon5lMo
YVV7dzYqS7fs2typvaX74NYegkw3fstlM3WOv/sJVo5vynk/bpk/70Nyyyjc90KQAwRQAAQs
wMFi+f2hUCh9ff3Nhj6ll7ujz1wITCn0jOe7x/Ld4vLsQ9MTbCyadmzp0pHpNZa7aaUwZKc4
4qg06qw0fEyh6YSBLZ3lEs2xDUt3YvNd4wvdIGPzXVhnnSIyncNTfWKzmVmlgAU4WIDR8rdQ
0+CIQ9RZTl6Vd2yOU2SWXVjm0fCso+FnSP7xJSZaXQdk+g8rjDgoTXptn6Kq3GWo3g1RmQne
Hu3n7ptI49Qf9ub4HaYyTSgJJEqiqV+siXeYsZeHGd3KISyIHJUBWICDxfI3UkdH53ND76zy
y+4xWUeDuebUZDMa1zQozTgoneQS1GG0vf+w/Jib8hRNZSZK9X6i2kOu2kOe6lzSTksPGvu8
b3a7aXIDIaKU6JthcTzOyjKGhGfq7ozQNjplQPTwtaZxAAtwsACj5fSHxWIPEs32eSSGphZZ
0ThGPnEE73i8XzI+MHW/b7KX7bE+823wsd4JUrkXqzabrj53Tv37IvXHpaoDSbp495NFPQHn
rzvyOy3Tmg2jqvA+BXjbLD2jFN2v2TqkaEttexrRmw1YgOt4JoIR2H10i7D56vpHvRLzHUO5
RC+WzolobXKslhdHy4+3243NtSIM2ipOUbbPsFRnM94396RK7ekltR+bVNIYNocC6Y3D4bU3
KWXXXc51WnKvGIRdIJDPESxTdfFJB/ABx/ccZwAQsAD35uSD0XI+aw0NjS8IbjRekTklfv+J
qL3OzN2ubA13zk5yyi47RrPlrlEXpekI1Udp6o9L1J81qv/YofZjl8rLDjVrd+/ANEbXZELT
UHhtv39Jj0N2GymulhBQSLDL0jXnETQdPXY5RAAQsACn8YrBCOw+usV9+/ZJG/kH8gqNfWK1
XJkajswdzmw1N46SK8fCynncRuGOs1zDCc0cd3wO+WAL7asn+TIvhxRnazUVbOj5HfF9d9I6
xmIbbzEqesl5V625lw0YpQSXHD3zRDPlI4HqjtEABCzAweJzY3+w++gW4SzAGVIdos6QKAna
J2LUjjPl7KKkbdlrrWK0zVzNzWzlTX2/sAyRs4uWOxa1/nCwvHlggptuNl1f4Ri1dyb75nRW
z2RSyzCzpt+/uNs+o8UospJA5uO/pR3daEaXs2MCELAABwswAruPbpFIJKJ0KVtJ/qrW9A1E
XxG8L8qAhjAJQxgzJCyi1nvzZZKum5TO+DQ8iu99nj70glp5U/UEB3uUrR9BH3mYNz7Lvz7F
axtl1d0MLLnmcLrVhFWDpxQbKhx3RhjQAAVAwAIcLMAI7JbVoh5VYI+9gKadgJYLQtcHRTyJ
MosUIYVsiO4QT+rdkX3LtmT8ZP1MRs/cxdFnLdMvWr9bkCbz1jvGaDG8c1qZ3be53ZNxV4aC
ynqd0lpIXgUG+0NI4uYBAAEUAAH7Hr7HHoyW0yLsvBCeioDmvnFA6rgj8RSUSSjKLGK9bezG
qDYcp2f76UGrojFqzfSpzkdlw0+b777gtN1XIEc3N3H/Qonf4MhU8qIdCPPRZ5K/prlucybL
2nhtsKSgLNkoq1hAARCwAAcLMFrOBw3fX3G8P0LHE/FXR+R+T6Q+FfpDkULlvHIlw5pw8V0y
GTeN8kc8K6dimh/k3nhcM/nS4lQ1MSjgl8el774/33TlVEByFDEoVD+Q7hzikRJnOXZ6Z3Cs
B+ooB2WTCCgAAhbgYAFGy7ld4BT4jEBG4AMRWk5IXW8kkY46FClIYsjQK9cGN0iyOtZz+77O
HbIrmaDWTie0z5658eKrQF5atuub7yp/vs9/PZ26MBX5btzz3YjZuwGNX9sVnxRLawVECx7j
oWxTUOZRAAQswMFCWp+8nEPnw9FtizCJRGi7IPV8kEbwRQyXtGZK0WpxtPp1kS1rE3tgI/H8
EcfSCVrddMDFB7LenOkuj9f3sl7fSXgzGf52zG9hxHbx1r7Fa6rz9dtaMvdscE0Rcs0WtOeh
LGIACFiAgwUYLefoXnoAIk2jEbpeCLwv0jgYZcJQcOchvSowlOr1jEapmA6plN5tWQN4/rBd
6W3D5JadtJh3k/5vJxhvxwPnR90Xhm0Wbuku9qm/bVZ+dX4LK8FJ1C1bhMwXPJ4G30gAAhbg
YLHMB6DAh9cIHDEAQWIi9LyRxgwUkaYSVLqGXC4cUC1Or8OFNGKj29Ym98pkDu4+O7GDcdYv
yf3Xcef5kWPzw0cWhowXB7UWe9XnW5ReX/zyae5nh0KZYr4lol6FQo4ZglZxSJMQwAIcRwzc
v3//cvqDkJeX1zQ8grRKRujD7czAWYVvpZULO2aKOKaLuZ7GkHNEPc8J+RSJhF/ZxBuVo2c2
Vxr8Mnxg8Zb2wsDexRtfLXRvf3tF6eeLiq8K5AbTlBQDMrHUKrRPiYhzpuCROJRpCGCR1slg
AUbLbHHplVbSiIqwSUIR6aIWTJEjbDHHVAm/4rUh9djoFgyrDRPViDl5YV3wReXwjHc9Kotd
ygtXt8+3K79tUnpd++Wrsm0v8uSeZ3yez9Ff61+EO1mH8T0v6pIlBC0aBQEWZ0T9pFfapY2E
d3eULU/QMkbYioV2zhT3LcYF1+Ni2sU5vRLcAVzakETqAJrXKxtfVJ6q97JKcb5m25sKhZ/P
y78qkH2Zu/V55pY53mZ3FlUiuBqE4r4laJcsYWs2AAEL8OVv4VL84+eVgasguUDEJh5axPqW
4Bj14uxObHIfLvUWLmtULHdSJG9K5NyoGK9Njx2TmGTRkaE5dFqtP31HXdI3kUxLAp2xLqxC
PKoFhCAHCKAEyYXyhq4r8PNK4LcfqRuMKaKB5WLOGVifIonQS5jYq9iUflz6sHj2OLrgLvrC
A7HaObG6R+jKO+iiQWx2x8a0unUptWhOMyahTYLTjeVcx7A7QQhygABqg3EAYNFo9Kf2txSS
kpIEojHONBgbUYejlonDLsZ3SXBvwhZi+FNiFx5gLn2PaX0mdvVvYl3P32fHM0zzD5i6R2Ll
96EAyqAYJCAEOTayHmfKACBgV6a/pZCWlsYbGm8ypkhE1WJTOsXjunC8AVzOOKZkBlM3h2l7
hrn2Qqz/FXrgJ0i4gOH7SVgqmYEyKAYJCEG+CfbP0BiAK9nfUkhJSR3UwysYOKN9z+IKbknl
jK7NncCU3xe/8gOm+7nYwE+io2+EJ95CwgUMYfL9Uvl9KINikKD9zoEcIIBa+f6WAr6X8LyH
21DKnIGNrpGsmMJdnpNofyre+xI9/Ebo9gJy+hdIuIAhTMISFEAZNqYWJCAE+Qr8SfLfA25A
eJ7CYbbb8Mg6Ek3YL1c0pwvTeg89/Fzo3jziu18h4QKGMAlLwv5npcxoUAwSOF9W4P79HwMO
2/f/pWhpweN1h76trIGbFCkQZx8p5MSBhAspMypMwhIUQBkUf9L5/CkhLCwsIyOjrq4OJxx8
iMYfAi5gCJOysrJQ8Od0thqrsRqrsRr/Ltb851zB+DtwIBrFFstMPwAAAABJRU5ErkJggg==</icon>
</operatingsystem>
</operatingsystems>

View File

@@ -0,0 +1,177 @@
#!/usr/bin/perl -w
# libguestfs
# Copyright (C) 2009-2012 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# This script allows you to run the test suite ('make check' etc) on
# an installed copy of libguestfs. Currently only RPM installs are
# supported, but adding support for dpkg would be relatively
# straightforward. It works by examining the installed packages, and
# copying binaries (eg. '/usr/bin/guestfish') and libraries into the
# correct place in the local directory.
#
# * You MUST have the full source tree unpacked locally. Either
# use the same source tarball as the version you are testing, or
# check it out from git and 'git-reset' to the right version tag.
#
# * You MUST do a successful local build from source before using
# this script (ie. './autogen.sh && make').
#
# Run the script from the top builddir. Usually:
#
# ./contrib/make-check-on-installed.pl
#
# If the script runs successfully, then run the test suite as normal:
#
# make check
# make extra-tests
#
# To switch back to running the test suite on the locally built
# version, do:
#
# make clean && make
use strict;
die "wrong directory -- read the file before running\n" unless -f "BUGS";
my $cmd;
# Remove all libtool crappage.
$cmd = "find -name 'lt-*' | grep -v '/tests/' | grep '/.libs/lt-' | xargs -r rm";
system ($cmd) == 0 or die "$cmd: failed\n";
$cmd = "find -name 'lib*.so*' | grep -v '/tests/' | grep '/.libs/lib' | xargs -r rm";
system ($cmd) == 0 or die "$cmd: failed\n";
# Map of installed file to local file. Key is a regexp.
# Remember that ONLY libraries and binaries need to be copied.
my %mapping = (
'/bin/erl-guestfs$' => "erlang",
'/bin/libguestfs-test-tool$' => "test-tool",
'/bin/guestfish$' => "fish",
'/bin/guestmount$' => "fuse",
'/bin/virt-alignment-scan$' => "align",
'/bin/virt-cat$' => "cat",
'/bin/virt-copy-in$' => "fish",
'/bin/virt-copy-out$' => "fish",
'/bin/virt-df$' => "df",
'/bin/virt-edit$' => "edit",
'/bin/virt-filesystems$' => "cat",
'/bin/virt-format$' => "format",
'/bin/virt-inspector$' => "inspector",
'/bin/virt-list-filesystems$' => "tools",
'/bin/virt-list-partitions$' => "tools",
'/bin/virt-ls$' => "cat",
'/bin/virt-make-fs$' => "tools",
'/bin/virt-rescue$' => "rescue",
'/bin/virt-resize$' => "resize",
'/bin/virt-sparsify$' => "sparsify",
'/bin/virt-sysprep$' => "sysprep",
'/bin/virt-tar$' => "tools",
'/bin/virt-tar-in$' => "fish",
'/bin/virt-tar-out$' => "fish",
'/bin/virt-win-reg$' => "tools",
# Ignore this because the daemon is included in the appliance.
'/sbin/guestfsd$' => "IGNORE",
'/erlang/lib/libguestfs-.*/ebin/guestfs\.beam$' => "erlang",
'/girepository-1\.0/Guestfs-1\.0\.typelib$' => "gobject",
'/gir-1.0/Guestfs-1.0.gir$' => "gobject",
'/guestfs/supermin.d/.*' => "appliance/supermin.d",
'/java/libguestfs-.*\.jar$' => "java",
'/libguestfs\.so.*' => "src/.libs",
'/libguestfs_jni\.so.*' => "java/.libs",
'/libguestfs-gobject-1\.0\.so.*' => "gobject/.libs",
'/ocaml/.*\.cmi$' => "IGNORE",
'/ocaml/.*\.cmo$' => "ocaml",
'/ocaml/.*\.cmx$' => "ocaml",
'/ocaml/.*\.cma$' => "ocaml",
'/ocaml/.*\.cmxa$' => "ocaml",
'/ocaml/.*\.a$' => "ocaml",
'/ocaml/.*\.so$' => "ocaml",
'/ocaml/.*\.so.owner$' => "IGNORE",
'/ocaml/.*META$' => "IGNORE",
'/ocaml/.*/guestfs\.mli$' => "IGNORE",
'/ocaml/.*/guestfs\.ml$' => "IGNORE",
'/perl5/.*/Guestfs\.so$' => "perl/blib/arch/auto/Sys/Guestfs",
'/perl5/.*/Guestfs.pm$' => "perl/blib/lib/Sys/Guestfs.pm",
'/perl5/.*/Lib.pm$' => "perl/blib/lib/Sys/Guestfs/Lib.pm",
'/php/modules/guestfs_php\.so$' => "php/extension/modules",
'/php/modules/guestfs_php\.so$' => "php/extension/.libs",
'/python.*/libguestfsmod\.so$' => "python/.libs",
'/python.*/guestfs\.py' => "IGNORE",
'/python.*/guestfs\.pyc$' => "python/guestfs.pyc",
'/python.*/guestfs\.pyo$' => "python/guestfs.pyo",
'/ruby/.*/_guestfs\.so$' => "ruby/ext/guestfs",
'/ruby/.*/guestfs\.rb$' => "IGNORE",
'/share/doc/' => "IGNORE",
'/share/javadoc/' => "IGNORE",
'/share/locale/' => "IGNORE",
'/share/man/' => "IGNORE",
'^/etc/' => "IGNORE",
'/systemd/' => "IGNORE",
'/include/guestfs\.h$' => "IGNORE",
'/include/guestfs-gobject\.h$' => "IGNORE",
'/libguestfs\.pc$' => "IGNORE",
);
# Get list of installed files.
$cmd = 'rpm -ql $(rpm -qa | grep -i guestf | grep -v debug) | sort';
my @files;
open CMD, "$cmd |" or die "$cmd: $!";
while (<CMD>) {
chomp;
push @files, $_;
}
close CMD;
# Now try to map (copy) installed files to the local equivalents.
foreach my $file (@files) {
my $match = 0;
foreach my $regexp (keys %mapping) {
if ($file =~ m/$regexp/) {
my $dest = $mapping{$regexp};
if ($dest ne "IGNORE") {
# Make destination writable if it's a file.
chmod 0644, "$dest" if -f "$dest" && ! -w "$dest";
# Copy file to destination.
$cmd = "cp '$file' '$dest'";
system ($cmd) == 0 or die "$cmd: failed\n";
print "$file => $dest\n";
}
$match++;
}
}
if ($match == 0) {
if (! -d $file) {
warn "WARNING: file '$file' is unmatched\n"
}
}
}

View File

@@ -0,0 +1,2 @@
*.eps
*.png

View File

@@ -0,0 +1,70 @@
This directory contains some experimental work for capturing traces of
block device operations while filesystem operations are performed.
You can trace any operation that libguestfs supports, including
partitioning, mkfs, LVM operations, and filesystem operations. You
can enable and disable tracing in order to capture single operations
such as a single write, or groups of operations. You can examine the
traces by hand (as text files) or turn them into graphical
visualizations.
IMPORTANT NOTE: This is not upstream (in qemu) nor integrated into
libguestfs. We should probably be using the 'blktrace' command
instead, or if that is not suitable, get a more reliable and useful
trace mechanism added to qemu (the current patch is not suitable for
upstreaming).
The *.qtr files are qemu trace files, produced using the unofficial
qemu patch in the current directory.
- guestfish-N-fs-10M.qtr
The command 'guestfish -N fs:ext2:10M' before we modified the
part-disk API to align the partition to 64 sectors.
- guestfish-N-fs-10M-aligned-part-disk.qtr
The command 'guestfish -N fs:ext2:10M' after we modified the
part-disk API to align the partition to 64 sectors.
- guestfish-add-mount.qtr
$ guestfish -a test1.img -m /dev/sda1
where test1.img was created by the previous command.
- guestfish-write-hello.qtr
$ guestfish -a test1.img -m /dev/sda1 \
debug qtrace "/dev/vda on" : \
write /hello "hello, world." : \
debug qtrace "/dev/vda off"
where test1.img was created by the command above.
This is just the creation of a new file with a small amount of content.
Within this trace file, the qtrace on/off commands appear as patterns
of reads. For on: 2, 21, 15, 2. For off: 2, 15, 21, 2.
- guestfish-lv-ext4-4k.qtr
$ guestfish \
alloc test1.img 40M : \
run : \
part-disk /dev/vda mbr : \
pvcreate /dev/vda : \
vgcreate VG /dev/vda : \
lvcreate LV VG 32 : \
mkfs-opts ext4 /dev/VG/LV blocksize:4096
Some points to note:
* an ext4 filesystem, so it has a journal and extents
* 4K block size, so we expect writes to be aligned
* located inside an LV, so more realistic
- guestfish-lv-ext4-4k-write-hello.qtr
$ guestfish -a test1.img -m /dev/VG/LV \
debug qtrace "/dev/vda on" : \
write /hello "hello, world." : \
debug qtrace "/dev/vda off"
where test1.img was created by the previous command.

View File

@@ -0,0 +1,122 @@
S 20480
R 0 1
R 0 8
R 8 8
R 20352 8
R 20464 8
R 0 8
R 8 8
R 20472 8
R 20216 8
R 20416 8
R 20224 8
R 20080 8
R 2048 8
R 24 8
R 56 8
R 120 8
R 16 8
R 128 8
R 64 8
R 512 8
R 32 8
R 4096 8
R 0 32
R 20352 8
R 20464 8
R 0 8
R 8 8
R 0 8
R 0 8
R 0 32
R 32 64
R 128 8
R 20456 8
W 0 24
W 20456 24
R 0 8
R 8 24
W 0 8
R 20352 8
R 20464 8
R 0 32
R 32 64
W 0 8
R 20472 8
R 20216 8
R 20472 8
R 20416 8
R 20224 8
R 20080 8
R 20464 8
R 8 8
R 0 8
R 2048 8
R 24 8
R 56 8
R 120 8
R 16 8
R 128 8
R 64 8
R 512 8
R 32 8
R 4096 8
R 20288 8
R 20400 8
R 64 8
R 72 8
R 20416 1
R 20160 8
R 20408 8
R 2112 8
R 88 8
R 120 8
R 184 8
R 80 8
R 192 8
R 128 8
R 576 8
R 96 8
R 4160 8
R 0 8
R 64 2
W 64 379
W 443 55
W 16450 4
W 16532 92
R 20416 1
R 20160 1
R 20161 1
R 20162 1
R 20163 5
R 2112 1
R 2113 1
R 2114 6
R 576 1
R 577 1
R 578 6
R 4160 1
R 4161 1
R 4162 6
R 0 8
W 16624 230
W 20288 128
W 66 2
R 20288 8
R 20400 8
R 64 8
R 72 8
R 20416 1
R 20160 8
R 20408 8
R 2112 8
R 88 8
R 120 8
R 184 8
R 80 8
R 192 8
R 128 8
R 576 8
R 96 8
R 4160 8
R 0 8

View File

@@ -0,0 +1,122 @@
S 20480
R 0 1
R 0 8
R 8 8
R 20352 8
R 20464 8
R 0 8
R 8 8
R 20472 8
R 20216 8
R 20416 8
R 20224 8
R 20080 8
R 2048 8
R 24 8
R 56 8
R 120 8
R 16 8
R 128 8
R 64 8
R 512 8
R 32 8
R 4096 8
R 0 32
R 20352 8
R 20464 8
R 0 8
R 8 8
R 0 8
R 0 8
R 0 32
R 32 64
R 128 8
R 20456 8
W 0 24
W 20456 24
R 0 8
R 8 24
W 0 8
R 20352 8
R 20464 8
R 0 32
R 32 64
W 0 8
R 20472 8
R 20216 8
R 20416 8
R 20224 8
R 20080 8
R 20464 8
R 8 8
R 0 8
R 2048 8
R 24 8
R 56 8
R 120 8
R 16 8
R 128 8
R 64 8
R 512 8
R 32 8
R 4096 8
R 20225 8
R 20457 8
R 1 8
R 9 8
R 20473 7
R 20217 8
R 20465 8
R 2049 8
R 25 8
R 57 8
R 121 8
R 17 8
R 129 8
R 65 8
R 513 8
R 33 8
R 4097 8
R 0 8
R 1 2
R 20225 8
W 1 436
W 16387 1
W 16388 3
W 16469 324
W 20225 248
R 20473 7
R 20217 8
R 2049 1
R 2050 1
R 2051 6
R 513 1
R 514 1
R 515 1
R 516 1
R 517 1
R 518 1
R 519 1
R 520 1
R 4097 1
R 4098 7
R 0 8
W 3 2
R 20225 8
R 20457 8
R 1 8
R 9 8
R 20473 7
R 20217 8
R 20465 8
R 2049 8
R 25 8
R 57 8
R 121 8
R 17 8
R 129 8
R 65 8
R 513 8
R 33 8
R 4097 8
R 0 8

View File

@@ -0,0 +1,72 @@
S 20480
R 0 1
R 0 8
R 20352 8
R 20464 8
R 0 8
R 8 8
R 20472 8
R 20216 8
R 20416 8
R 20224 8
R 20080 8
R 2048 8
R 24 8
R 56 8
R 120 8
R 16 8
R 128 8
R 64 8
R 512 8
R 32 8
R 4096 8
R 20288 8
R 20400 8
R 64 8
R 72 8
R 20416 1
R 20160 8
R 20408 8
R 2112 8
R 88 8
R 120 8
R 184 8
R 80 8
R 192 8
R 128 8
R 576 8
R 96 8
R 4160 8
R 0 8
R 0 32
R 20288 1
R 20400 1
R 64 1
R 72 1
R 64 4
R 64 4
R 20288 8
R 20400 8
R 64 8
R 72 8
R 20416 1
R 20160 8
R 20408 8
R 2112 8
R 88 8
R 120 8
R 184 8
R 80 8
R 192 8
R 128 8
R 576 8
R 96 8
R 4160 8
R 66 2
R 68 2
R 152 2
W 66 2
W 66 2
W 66 2
W 66 2
W 66 2

View File

@@ -0,0 +1,104 @@
S 81920
R 0 1
R 0 8
R 8 8
R 81792 8
R 81904 8
R 0 8
R 8 8
R 81912 8
R 81656 8
R 81856 8
R 81664 8
R 81520 8
R 0 32
R 81792 8
R 81904 8
R 0 8
R 8 8
R 0 8
R 8 8
R 8 8
R 8 8
R 8 8
R 8 8
R 8 8
R 0 8
R 8 8
R 8 8
R 8 8
R 0 8
R 8 8
R 8 8
R 8 8
R 8 8
R 8 8
R 8 8
R 65792 8
R 65904 8
R 384 8
R 392 8
R 65912 8
R 65656 8
R 65856 8
R 65664 8
R 65520 8
R 2432 8
R 408 8
R 440 8
R 504 8
R 400 8
R 512 8
R 448 8
R 896 8
R 416 8
R 4480 8
R 65792 8
R 65904 8
R 384 8
R 392 8
R 65912 8
R 65656 8
R 65856 8
R 65664 8
R 65520 8
R 2432 8
R 408 8
R 440 8
R 504 8
R 400 8
R 512 8
R 448 8
R 896 8
R 416 8
R 4480 8
R 386 2
R 384 8
R 392 8
R 664 8
R 456 8
W 384 8
R 2 1
R 21 1
R 15 1
R 2 1
R 416 8
R 536 8
R 664 8
R 408 8
W 456 8
W 464 8
W 10712 8
W 472 40
W 512 8
W 392 8
W 408 16
W 536 8
W 664 8
R 2 1
R 15 1
R 21 1
R 2 1
W 384 8
W 456 8
W 384 8

View File

@@ -0,0 +1,450 @@
S 81920
R 0 1
R 0 8
R 8 8
R 81792 8
R 81904 8
R 0 8
R 8 8
R 81912 8
R 81656 8
R 81856 8
R 81664 8
R 81520 8
R 2048 8
R 24 8
R 56 8
R 120 8
R 16 8
R 128 8
R 64 8
R 512 8
R 32 8
R 4096 8
R 0 32
R 81792 8
R 81904 8
R 0 8
R 8 8
R 0 8
R 0 8
R 0 32
R 32 64
R 128 8
R 81896 8
W 0 24
W 81896 24
R 81792 8
R 81904 8
R 0 32
W 0 8
R 32 8
R 40 56
R 81912 8
R 81656 8
R 81856 8
R 81664 8
R 81520 8
R 81904 8
R 32 8
R 0 32
W 0 8
R 2048 8
R 120 8
R 16 8
R 128 8
R 64 8
R 0 8
R 512 8
R 32 8
R 4096 8
R 81728 8
R 81840 8
R 64 8
R 72 8
R 81856 1
R 81600 8
R 81848 8
R 2112 8
R 88 8
R 120 8
R 184 8
R 80 8
R 192 8
R 128 8
R 576 8
R 96 8
R 4160 8
R 0 8
R 0 8
R 81792 8
R 81904 8
R 81792 8
R 81904 8
R 0 8
R 8 8
R 81912 8
R 81656 8
R 81856 8
R 81664 8
R 81520 8
R 2048 8
R 24 8
R 56 8
R 120 8
R 16 8
R 128 8
R 64 8
R 512 8
R 32 8
R 4096 8
R 0 8
R 8 8
R 0 8
R 8 8
R 24 8
R 120 8
R 8 8
R 81792 8
R 81904 8
R 0 8
R 8 8
R 81912 8
R 81656 8
R 81856 8
R 81664 8
R 81520 8
R 2048 8
R 24 8
R 56 8
R 120 8
R 16 8
R 128 8
R 64 8
R 512 8
R 32 8
R 4096 8
W 8 8
R 0 8
R 0 8
W 0 8
R 8 8
W 8 8
R 0 8
W 0 8
R 81792 8
R 81904 8
R 0 8
R 8 8
R 81912 8
R 81656 8
R 81856 8
R 81664 8
R 81520 8
R 0 8
R 8 8
R 81792 8
R 81904 8
R 0 8
R 8 8
R 81912 8
R 81656 8
R 81856 8
R 81664 8
R 81520 8
R 81792 8
R 81904 8
R 0 8
R 8 8
R 81728 1
R 81840 1
R 64 1
R 72 1
R 64 4
R 81792 8
R 81904 8
R 0 8
R 8 8
R 81912 8
R 81656 8
R 81856 8
R 81664 8
R 81520 8
R 81728 8
R 81840 8
R 64 8
R 72 8
R 81856 1
R 81600 8
R 81848 1
R 81849 1
R 81850 1
R 81851 1
R 81852 4
R 2112 1
R 2113 1
R 2114 1
R 2115 1
R 2116 1
R 2117 1
R 2118 1
R 2119 1
R 88 1
R 89 1
R 90 1
R 91 1
R 92 1
R 93 1
R 94 1
R 95 1
R 120 1
R 121 1
R 122 1
R 123 1
R 124 1
R 125 1
R 126 1
R 127 1
R 184 1
R 185 1
R 186 6
R 80 1
R 81 1
R 82 1
R 83 1
R 84 1
R 85 3
R 192 1
R 193 1
R 194 1
R 195 1
R 196 1
R 197 1
R 198 1
R 199 1
R 128 1
R 129 1
R 130 1
R 131 1
R 132 1
R 133 1
R 134 1
R 135 1
R 576 1
R 577 1
R 578 1
R 579 1
R 580 1
R 581 1
R 582 1
R 583 1
R 96 1
R 97 1
R 98 1
R 99 1
R 100 1
R 101 1
R 102 1
R 103 1
R 4160 1
R 4161 1
R 4162 1
R 4163 1
R 4164 1
R 4165 1
R 4166 1
R 4167 1
R 0 32
R 81792 8
R 81904 8
R 0 8
R 56 8
R 8 8
R 81728 1
R 81840 1
R 64 1
R 72 1
R 64 4
R 81728 8
R 81840 8
R 64 8
R 72 8
R 81856 1
R 81600 8
R 81848 8
R 2112 8
R 88 8
R 120 8
R 184 8
R 80 8
R 192 8
R 128 8
R 576 8
R 96 8
R 4160 8
R 0 8
R 0 8
R 24 8
R 56 8
R 8 8
R 0 8
R 8 8
R 81792 8
R 81904 8
R 8 8
R 0 8
R 81792 8
R 81904 8
R 0 8
R 8 8
R 0 8
R 8 8
R 81728 1
R 81840 1
R 64 1
R 72 1
R 64 1
R 65 3
R 81912 8
R 81656 8
R 81856 8
R 81664 8
R 81520 8
R 81728 8
R 81840 8
R 64 8
R 72 8
R 81856 1
R 81600 8
R 81848 8
R 2112 8
R 88 8
R 120 8
R 184 8
R 80 8
R 192 8
R 128 8
R 576 8
R 96 8
R 4160 8
R 8 8
R 8 8
W 8 8
R 8 8
R 8 8
W 8 8
R 8 8
R 8 8
W 8 8
R 81728 8
R 81840 8
R 64 8
R 72 8
R 81856 1
R 81600 8
R 81848 8
R 2112 8
R 88 8
R 120 8
R 184 8
R 80 8
R 192 8
R 128 8
R 576 8
R 96 8
R 4160 8
R 81792 8
R 81904 8
R 0 8
R 8 8
R 81912 8
R 81656 8
R 81856 8
R 81664 8
R 81520 8
R 0 8
R 8 8
R 8 8
R 8 8
R 64 4
R 8 8
R 8 8
R 8 8
R 8 8
R 8 8
R 8 8
W 8 8
R 8 8
R 8 8
R 8 8
W 8 8
R 8 8
R 8 8
R 8 8
W 8 8
R 0 8
R 8 8
R 8 8
R 8 8
R 8 8
R 8 8
R 8 8
R 81728 8
R 81840 8
R 64 8
R 72 8
R 81856 1
R 81600 8
R 81848 8
R 2112 8
R 88 8
R 120 8
R 184 8
R 80 8
R 192 8
R 128 8
R 576 8
R 96 8
R 4160 8
R 0 8
R 24 8
R 56 8
R 65792 8
R 65904 8
R 384 8
R 392 8
R 65912 8
R 65656 8
R 65856 8
R 65664 8
R 65520 8
R 2432 8
R 408 8
R 440 8
R 504 8
R 400 8
R 512 8
R 448 8
R 896 8
R 416 8
R 4480 8
R 384 8
W 384 8
R 81792 8
R 81904 8
R 8 8
R 81912 8
R 81656 8
R 81856 8
R 81664 8
R 81520 8
R 384 8
W 384 3032
W 3416 576
W 3992 1448
W 5440 1608
W 7048 3032
W 10080 632
W 65792 128
W 384 8
W 384 8

View File

@@ -0,0 +1,101 @@
S 20480
R 0 1
R 0 8
R 20352 8
R 20464 8
R 0 8
R 8 8
R 20472 8
R 20216 8
R 20416 8
R 20224 8
R 20080 8
R 2048 8
R 24 8
R 56 8
R 120 8
R 16 8
R 128 8
R 64 8
R 512 8
R 32 8
R 4096 8
R 20288 8
R 20400 8
R 64 8
R 72 8
R 20416 1
R 20160 8
R 20408 8
R 2112 8
R 88 8
R 120 8
R 184 8
R 80 8
R 192 8
R 128 8
R 576 8
R 96 8
R 4160 8
R 0 8
R 0 32
R 20288 1
R 20400 1
R 64 1
R 72 1
R 64 4
R 64 4
R 20288 8
R 20400 8
R 64 8
R 72 8
R 20416 1
R 20160 8
R 20408 8
R 2112 8
R 88 8
R 120 8
R 184 8
R 80 8
R 192 8
R 128 8
R 576 8
R 96 8
R 4160 8
R 66 2
R 68 2
R 152 2
W 66 2
W 66 2
W 66 2
W 66 2
R 2 1
R 21 1
R 15 1
R 2 1
W 66 2
W 66 2
W 66 2
R 470 2
R 150 2
R 154 2
R 148 2
W 470 2
W 11330 2
R 152 2
W 66 2
W 68 2
W 148 8
W 66 2
W 66 2
R 2 1
R 15 1
R 21 1
R 2 1
W 66 2
W 66 2
W 66 2
W 66 2
W 66 2
W 66 2
W 66 2

View File

@@ -0,0 +1,104 @@
From e04ef476fd330485e5a88c7018d29c55cf411fe2 Mon Sep 17 00:00:00 2001
From: Richard W.M. Jones <rjones@redhat.com>
Date: Tue, 5 Oct 2010 09:54:10 +0100
Subject: [PATCH] Trace reads and writes to qemu block devices.
NB: This patch is not suitable for nor intended to go upstream in
its current form.
When qemu opens a block device, this patch creates a trace file
in /tmp with a name related to the block device. Reads and writes
to the device cause lines to be written to the trace file:
S <total_sectors>
W <sector> <nb_sectors>
R <sector> <nb_sectors>
'S' is the summary line, printed first which just tells you how
many sectors are on the device.
'W' and 'R' are writes and reads, for the range <sector> through
to <sector> + <nb_sectors> - 1.
---
block.c | 29 +++++++++++++++++++++++++++++
block_int.h | 3 +++
2 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/block.c b/block.c
index ebbc376..26ead5b 100644
--- a/block.c
+++ b/block.c
@@ -474,6 +474,23 @@ static int bdrv_open_common(BlockDriverState *bs, const char *filename,
goto free_and_fail;
}
+ /* Open trace file in /tmp based on filename. XXX */
+ size_t len = strlen (filename);
+ char *trace_file = qemu_malloc (10 + len);
+ snprintf (trace_file, 10 + len, "/tmp/%s.qtr", filename);
+ size_t i;
+ for (i = 5; i < 5 + len; ++i) {
+ if (trace_file[i] == '/')
+ trace_file[i] = '_';
+ }
+ bs->trace_fp = fopen (trace_file, "w");
+ if (bs->trace_fp) {
+ setlinebuf (bs->trace_fp);
+ fprintf (bs->trace_fp, "S %" PRIi64 "\n", bs->total_sectors);
+ } else {
+ perror (trace_file);
+ }
+
#ifndef _WIN32
if (bs->is_temporary) {
unlink(filename);
@@ -665,6 +682,10 @@ void bdrv_close(BlockDriverState *bs)
bdrv_close(bs->file);
}
+ if (bs->trace_fp)
+ fclose (bs->trace_fp);
+ bs->trace_fp = NULL;
+
/* call the change callback */
bs->media_changed = 1;
if (bs->change_cb)
@@ -1995,6 +2016,10 @@ BlockDriverAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num,
/* Update stats even though technically transfer has not happened. */
bs->rd_bytes += (unsigned) nb_sectors * BDRV_SECTOR_SIZE;
bs->rd_ops ++;
+
+ if (bs->trace_fp)
+ fprintf (bs->trace_fp,
+ "R %" PRIi64 " %d\n", sector_num, nb_sectors);
}
return ret;
@@ -2028,6 +2053,10 @@ BlockDriverAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num,
if (bs->wr_highest_sector < sector_num + nb_sectors - 1) {
bs->wr_highest_sector = sector_num + nb_sectors - 1;
}
+
+ if (bs->trace_fp)
+ fprintf (bs->trace_fp,
+ "W %" PRIi64 " %d\n", sector_num, nb_sectors);
}
return ret;
diff --git a/block_int.h b/block_int.h
index e8e7156..03e7c9b 100644
--- a/block_int.h
+++ b/block_int.h
@@ -178,6 +178,9 @@ struct BlockDriverState {
uint64_t wr_ops;
uint64_t wr_highest_sector;
+ /* Trace to file. */
+ FILE *trace_fp;
+
/* Whether the disk can expand beyond total_sectors */
int growable;
--
1.7.3.1

View File

@@ -0,0 +1,423 @@
#!/usr/bin/ocamlrun /usr/bin/ocaml
(* Convert *.qtr (qemu block device trace) to Postscript.
* Copyright (C) 2009-2012 Red Hat Inc.
* By Richard W.M. Jones <rjones@redhat.com>.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
(* Note that we use ordinary OCaml ints, which means this program is
* limited to: ~1TB disks for 32 bit machines, or effectively unlimited
* for 64 bit machines. Also we make several 512 byte sector
* assumptions.
*)
#use "topfind";;
#require "extlib";;
open ExtList
open Scanf
open Printf
type op = Read | Write
(* If 'true' then print debug messages. *)
let debug = true
(* Width of each row (in sectors) in the output. *)
let row_size = 64
(* Desirable alignment (sectors). *)
let alignment = 8
(* Height (in 1/72 inch) of the final image. *)
let height = 6.*.72.
(* Width (in 1/72 inch) of the final image. *)
let width = 6.*.72.
(* Reserve at left for the sector number (comes out of width). *)
let sn_width = 36.
let input =
if Array.length Sys.argv = 2 then
Sys.argv.(1)
else
failwith "usage: tracetops filename.qtr"
(* Read the input file. *)
let nb_sectors, accesses =
let chan = open_in input in
let nb_sectors =
let summary = input_line chan in
if String.length summary < 1 || summary.[0] <> 'S' then
failwith (sprintf "%s: input is not a qemu block device trace file"
input);
sscanf summary "S %d" (fun x -> x) in
if nb_sectors mod row_size <> 0 then
failwith (sprintf "input nb_sectors (%d) not divisible by row size (%d)"
nb_sectors row_size);
(* Read the reads and writes from the remainder of the file. *)
let accesses = ref [] in
let rec loop () =
let line = input_line chan in
let rw, s, n = sscanf line "%c %d %d" (fun rw s n -> (rw, s, n)) in
let rw =
match rw with
| 'R' -> Read | 'W' -> Write
| c -> failwith
(sprintf "%s: error reading input: got '%c', expecting 'R' or 'W'"
input c) in
if n < 0 || s < 0 || s+n > nb_sectors then
failwith (sprintf "%s: s (%d), n (%d) out of range" input s n);
let aligned = s mod alignment = 0 && n mod alignment = 0 in
accesses := (rw, aligned, s, n) :: !accesses;
loop ()
in
(try loop () with
| End_of_file -> ()
| Scan_failure msg ->
failwith (sprintf "%s: error reading input: %s" input msg)
);
close_in chan;
let accesses = List.rev !accesses in
if debug then (
eprintf "%s: nb_sectors = %d, accesses = %d\n"
input nb_sectors (List.length accesses)
);
nb_sectors, accesses
(* If the accesses list contains any qtrace on/off patterns (in
* guestfish: debug "qtrace /dev/vda (on|off)") then filter out the
* things we want to display. Otherwise leave the whole trace.
*)
let accesses =
let contains_qtrace_patterns =
let rec loop = function
| [] -> false
| (Read, _, 2, 1) :: (Read, _, 21, 1) :: (Read, _, 15, 1) ::
(Read, _, 2, 1) :: _ -> true
| (Read, _, 2, 1) :: (Read, _, 15, 1) :: (Read, _, 21, 1) ::
(Read, _, 2, 1) :: _ -> true
| _ :: rest -> loop rest
in
loop accesses in
if contains_qtrace_patterns then (
if debug then eprintf "%s: contains qtrace on/off patterns\n%!" input;
let rec find_qtrace_on = function
| [] -> []
| (Read, _, 2, 1) :: (Read, _, 21, 1) :: (Read, _, 15, 1) ::
(Read, _, 2, 1) :: rest -> rest
| (Read, _, 2, 1) :: (Read, _, 15, 1) :: (Read, _, 21, 1) ::
(Read, _, 2, 1) :: rest ->
eprintf "ignored 'qtrace off' pattern when expecting 'qtrace on'\n";
find_qtrace_on rest
| _ :: rest -> find_qtrace_on rest
and split_until_qtrace_off = function
| [] -> [], []
| (Read, _, 2, 1) :: (Read, _, 15, 1) :: (Read, _, 21, 1) ::
(Read, _, 2, 1) :: rest -> [], rest
| (Read, _, 2, 1) :: (Read, _, 21, 1) :: (Read, _, 15, 1) ::
(Read, _, 2, 1) :: rest ->
eprintf "found 'qtrace on' pattern when expecting 'qtrace off'\n";
split_until_qtrace_off rest
| x :: ys ->
let xs, ys = split_until_qtrace_off ys in
x :: xs, ys
and filter_accesses xs =
let xs = find_qtrace_on xs in
if xs <> [] then (
let xs, ys = split_until_qtrace_off xs in
let ys = filter_accesses ys in
xs @ ys
) else
[]
in
filter_accesses accesses
) else
accesses
let ranges =
(* Given the number of sectors, make the row array. *)
let nr_rows = nb_sectors / row_size in
let rows = Array.make nr_rows false in
List.iter (
fun (_, _, s, n) ->
let i0 = s / row_size in
let i1 = (s+n-1) / row_size in
for i = i0 to i1 do rows.(i) <- true done;
) accesses;
(* Coalesce rows into a list of ranges of rows we will draw. *)
let rows = Array.to_list rows in
let rows = List.mapi (fun i v -> (v, i)) rows in
let ranges =
(* When called, we are in the middle of a range which started at i0. *)
let rec loop i0 = function
| (false, _) :: (false, _) :: (true, i1) :: []
| _ :: (_, i1) :: []
| (_, i1) :: [] ->
[i0, i1]
| (false, _) :: (false, _) :: (true, _) :: rest
| (false, _) :: (true, _) :: rest
| (true, _) :: rest ->
loop i0 rest
| (false, i1) :: rest ->
let i1 = i1 - 1 in
let rest = List.dropwhile (function (v, _) -> not v) rest in
(match rest with
| [] -> [i0, i1]
| (_, i2) :: rest -> (i0, i1) :: loop i2 rest)
| [] -> assert false
in
loop 0 (List.tl rows) in
if debug then (
eprintf "%s: rows = %d (ranges = %d)\n" input nr_rows (List.length ranges);
List.iter (
fun (i0, i1) ->
eprintf " %d - %d (rows %d - %d)\n"
(i0 * row_size) ((i1 + 1) * row_size - 1) i0 i1
) ranges
);
ranges
(* Locate where we will draw the rows and cells in the final image. *)
let iter_rows, mapxy, row_height, cell_width =
let nr_ranges = List.length ranges in
let nr_breaks = nr_ranges - 1 in
let nr_rows =
List.fold_left (+) 0 (List.map (fun (i0,i1) -> i1-i0+1) ranges) in
let nr_rnb = nr_rows + nr_breaks in
let row_height = height /. float nr_rnb in
let cell_width = (width -. sn_width) /. float row_size in
if debug then (
eprintf "number of rows and breaks = %d\n" nr_rnb;
eprintf "row_height x cell_width = %g x %g\n" row_height cell_width
);
(* Create a higher-order function to iterate over the rows. *)
let rec iter_rows f =
let rec loop row = function
| [] -> ()
| (i0,i1) :: rows ->
for i = i0 to i1 do
let y = float (row+i-i0) *. row_height in
f y (Some i)
done;
(* Call an extra time for the break. *)
let y = float (row+i1-i0+1) *. row_height in
if rows <> [] then f y None;
(* extra +1 here is to skip the break *)
loop (row+i1-i0+1+1) rows
in
loop 0 ranges
in
(* Create a hash which maps from the row number to the position
* where we draw the row. If the row is not drawn, the hash value
* is missing.
*)
let row_y = Hashtbl.create nr_rows in
iter_rows (
fun y ->
function
| Some i -> Hashtbl.replace row_y i y
| None -> ()
);
(* Create a function which maps from the sector number to the final
* position that we will draw it.
*)
let mapxy s =
let r = s / row_size in
let y = try Hashtbl.find row_y r with Not_found -> assert false in
let x = sn_width +. cell_width *. float (s mod row_size) in
x, y
in
iter_rows, mapxy, row_height, cell_width
(* Start the PostScript file. *)
let () =
printf "%%!PS-Adobe-3.0 EPSF-3.0\n";
printf "%%%%BoundingBox: -10 -10 %g %g\n"
(width +. 10.) (height +. row_height +. 20.);
printf "%%%%Creator: tracetops.ml (part of libguestfs)\n";
printf "%%%%Title: %s\n" input;
printf "%%%%LanguageLevel: 2\n";
printf "%%%%Pages: 1\n";
printf "%%%%Page: 1 1\n";
printf "\n";
printf "/min { 2 copy gt { exch } if pop } def\n";
printf "/max { 2 copy lt { exch } if pop } def\n";
(* Function for drawing cells. *)
printf "/cell {\n";
printf " newpath\n";
printf " moveto\n";
printf " %g 0 rlineto\n" cell_width;
printf " 0 %g rlineto\n" row_height;
printf " -%g 0 rlineto\n" cell_width;
printf " closepath\n";
printf " gsave fill grestore 0.75 setgray stroke\n";
printf "} def\n";
(* Define colours for different cell types. *)
printf "/unalignedread { 0.95 0.95 0 setrgbcolor } def\n";
printf "/unalignedwrite { 0.95 0 0 setrgbcolor } def\n";
printf "/alignedread { 0 0.95 0 setrgbcolor } def\n";
printf "/alignedwrite { 0 0 0.95 setrgbcolor } def\n";
(* Get width of text. *)
printf "/textwidth { stringwidth pop } def\n";
(* Draw the outline. *)
printf "/outline {\n";
printf " newpath\n";
printf " %g 0 moveto\n" sn_width;
printf " %g 0 lineto\n" width;
printf " %g %g lineto\n" width height;
printf " %g %g lineto\n" sn_width height;
printf " closepath\n";
printf " 0.5 setlinewidth 0.3 setgray stroke\n";
printf "} def\n";
(* Draw the outline breaks. *)
printf "/breaks {\n";
iter_rows (
fun y ->
function
| Some _ -> ()
| None ->
let f xmin xmax =
let yll = y +. row_height /. 3. -. 2. in
let ylr = y +. row_height /. 2. -. 2. in
let yur = y +. 2. *. row_height /. 3. in
let yul = y +. row_height /. 2. in
printf " newpath\n";
printf " %g %g moveto\n" xmin yll;
printf " %g %g lineto\n" xmax ylr;
printf " %g %g lineto\n" xmax yur;
printf " %g %g lineto\n" xmin yul;
printf " closepath\n";
printf " 1 setgray fill\n";
printf " newpath\n";
printf " %g %g moveto\n" xmin yll;
printf " %g %g lineto\n" xmax ylr;
printf " %g %g moveto\n" xmax yur;
printf " %g %g lineto\n" xmin yul;
printf " closepath\n";
printf " 0.5 setlinewidth 0.3 setgray stroke\n"
in
f (sn_width -. 6.) (sn_width +. 6.);
f (width -. 6.) (width +. 6.)
);
printf "} def\n";
(* Draw the labels. *)
printf "/labels {\n";
printf " /Courier findfont\n";
printf " 0.75 %g mul 10 min scalefont\n" row_height;
printf " setfont\n";
iter_rows (
fun y ->
function
| Some i ->
let sector = i * row_size in
printf " newpath\n";
printf " /s { (%d) } def\n" sector;
printf " %g s textwidth sub 4 sub %g moveto\n" sn_width (y +. 2.);
printf " s show\n"
| None -> ()
);
printf "} def\n";
(* Print the key. *)
printf "/key {\n";
printf " /Times-Roman findfont\n";
printf " 10. scalefont\n";
printf " setfont\n";
let x = sn_width and y = height +. 10. in
printf " unalignedwrite %g %g cell\n" x y;
let x = x +. cell_width +. 4. in
printf " newpath %g %g moveto (unaligned write) 0.3 setgray show\n" x y;
let x = x +. 72. in
printf " unalignedread %g %g cell\n" x y;
let x = x +. cell_width +. 4. in
printf " newpath %g %g moveto (unaligned read) 0.3 setgray show\n" x y;
let x = x +. 72. in
printf " alignedwrite %g %g cell\n" x y;
let x = x +. cell_width +. 4. in
printf " newpath %g %g moveto (aligned write) 0.3 setgray show\n" x y;
let x = x +. 72. in
printf " alignedread %g %g cell\n" x y;
let x = x +. cell_width +. 4. in
printf " newpath %g %g moveto (aligned read) 0.3 setgray show\n" x y;
printf "} def\n";
printf "\n"
(* Draw the accesses. *)
let () =
(* Sort the accesses so unaligned ones are displayed at the end (on
* top of aligned ones) and writes on top of reads. This isn't
* really perfect, but it'll do.
*)
let cmp (rw, aligned, s, n) (rw', aligned', s', n') =
let r = compare rw rw' (* Write later *) in
if r <> 0 then r else (
let r = compare aligned' aligned (* unaligned later *) in
if r <> 0 then r else
compare (n, s) (n', s')
)
in
let accesses = List.sort ~cmp accesses in
List.iter (
fun op ->
let col, s, n =
match op with
| Read, false, s, n ->
"unalignedread", s, n
| Write, false, s, n ->
"unalignedwrite", s, n
| Read, true, s, n ->
"alignedread", s, n
| Write, true, s, n ->
"alignedwrite", s, n in
for i = s to s+n-1 do
let x, y = mapxy i in
printf "%s %g %g cell\n" col x y
done;
printf "\n"
) accesses
(* Finish off the PostScript output. *)
let () =
printf "outline breaks labels key\n";
printf "%%%%EOF\n"

24
csharp/Makefile.am Normal file
View File

@@ -0,0 +1,24 @@
# libguestfs C# bindings
# Copyright (C) 2010 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include $(top_srcdir)/subdir-rules.mk
generator_built = \
Libguestfs.cs
EXTRA_DIST = \
$(generator_built)

32
daemon/.gitignore vendored
View File

@@ -1,32 +0,0 @@
build-aux
lib
link-warning.h
m4/00gnulib.m4
m4/errno_h.m4
m4/error.m4
m4/exitfail.m4
m4/extensions.m4
m4/gnulib-common.m4
m4/gnulib-comp.m4
m4/gnulib-tool.m4
m4/hash.m4
m4/include_next.m4
m4/inline.m4
m4/inttostr.m4
m4/longlong.m4
m4/manywarnings.m4
m4/multiarch.m4
m4/onceonly.m4
m4/stdbool.m4
m4/stddef_h.m4
m4/stdint.m4
m4/stdlib_h.m4
m4/strerror.m4
m4/string_h.m4
m4/unistd_h.m4
m4/warnings.m4
m4/wchar.m4
m4/wchar_t.m4
m4/wint_t.m4
m4/xalloc.m4
tests

226
daemon/9p.c Normal file
View File

@@ -0,0 +1,226 @@
/* libguestfs - the guestfsd daemon
* Copyright (C) 2011 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <fcntl.h>
#include "daemon.h"
#include "actions.h"
#define BUS_PATH "/sys/bus/virtio/drivers/9pnet_virtio"
static char *read_whole_file (const char *filename);
/* https://bugzilla.redhat.com/show_bug.cgi?id=714981#c1 */
char **
do_list_9p (void)
{
DECLARE_STRINGSBUF (r);
DIR *dir;
dir = opendir (BUS_PATH);
if (!dir) {
perror ("opendir: " BUS_PATH);
if (errno != ENOENT)
return NULL;
/* If this directory doesn't exist, it probably means that
* the virtio driver isn't loaded. Don't return an error
* in this case, but return an empty list.
*/
if (end_stringsbuf (&r) == -1)
return NULL;
return r.argv;
}
while (1) {
errno = 0;
struct dirent *d = readdir (dir);
if (d == NULL) break;
if (STRPREFIX (d->d_name, "virtio")) {
char mount_tag_path[256];
snprintf (mount_tag_path, sizeof mount_tag_path,
BUS_PATH "/%s/mount_tag", d->d_name);
/* A bit unclear, but it looks like the virtio transport allows
* the mount tag length to be unlimited (or up to 65536 bytes).
* See: linux/include/linux/virtio_9p.h
*/
char *mount_tag = read_whole_file (mount_tag_path);
if (mount_tag == 0)
continue;
if (add_string (&r, mount_tag) == -1) {
free (mount_tag);
closedir (dir);
return NULL;
}
free (mount_tag);
}
}
/* Check readdir didn't fail */
if (errno != 0) {
reply_with_perror ("readdir: /sys/block");
free_stringslen (r.argv, r.size);
closedir (dir);
return NULL;
}
/* Close the directory handle */
if (closedir (dir) == -1) {
reply_with_perror ("closedir: /sys/block");
free_stringslen (r.argv, r.size);
return NULL;
}
/* Sort the tags. */
if (r.size > 0)
sort_strings (r.argv, r.size);
/* NULL terminate the list */
if (end_stringsbuf (&r) == -1)
return NULL;
return r.argv;
}
/* Read whole file into dynamically allocated array. If there is an
* error, DON'T call reply_with_perror, just return NULL. Returns a
* \0-terminated string.
*/
static char *
read_whole_file (const char *filename)
{
char *r = NULL;
size_t alloc = 0, size = 0;
int fd;
fd = open (filename, O_RDONLY|O_CLOEXEC);
if (fd == -1) {
perror (filename);
return NULL;
}
while (1) {
alloc += 256;
char *r2 = realloc (r, alloc);
if (r2 == NULL) {
perror ("realloc");
free (r);
close (fd);
return NULL;
}
r = r2;
/* The '- 1' in the size calculation ensures there is space below
* to add \0 to the end of the input.
*/
ssize_t n = read (fd, r + size, alloc - size - 1);
if (n == -1) {
perror (filename);
free (r);
close (fd);
return NULL;
}
if (n == 0)
break;
size += n;
}
if (close (fd) == -1) {
perror (filename);
free (r);
return NULL;
}
r[size] = '\0';
return r;
}
/* Takes optional arguments, consult optargs_bitmask. */
int
do_mount_9p (const char *mount_tag, const char *mountpoint, const char *options)
{
char *mp = NULL, *opts = NULL, *err = NULL;
struct stat statbuf;
int r = -1;
ABS_PATH (mountpoint, , return -1);
mp = sysroot_path (mountpoint);
if (!mp) {
reply_with_perror ("malloc");
goto out;
}
/* Check the mountpoint exists and is a directory. */
if (stat (mp, &statbuf) == -1) {
reply_with_perror ("%s", mountpoint);
goto out;
}
if (!S_ISDIR (statbuf.st_mode)) {
reply_with_perror ("%s: mount point is not a directory", mountpoint);
goto out;
}
/* Add trans=virtio to the options. */
if ((optargs_bitmask & GUESTFS_MOUNT_9P_OPTIONS_BITMASK) &&
STRNEQ (options, "")) {
if (asprintf (&opts, "trans=virtio,%s", options) == -1) {
reply_with_perror ("asprintf");
goto out;
}
}
else {
opts = strdup ("trans=virtio");
if (opts == NULL) {
reply_with_perror ("strdup");
goto out;
}
}
r = command (NULL, &err,
"mount", "-o", opts, "-t", "9p", mount_tag, mp, NULL);
if (r == -1) {
reply_with_error ("%s on %s: %s", mount_tag, mountpoint, err);
goto out;
}
r = 0;
out:
free (err);
free (opts);
free (mp);
return r;
}

View File

@@ -1,5 +1,5 @@
# libguestfs-daemon
# Copyright (C) 2009 Red Hat Inc.
# Copyright (C) 2011 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,22 +13,92 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
ACLOCAL_AMFLAGS = -I m4
include $(top_srcdir)/subdir-rules.mk
SUBDIRS = lib tests .
libsrcdir = $(top_builddir)/src
noinst_PROGRAMS = guestfsd
guestfsd_SOURCES = \
generator_built = \
actions.h \
stubs.c \
names.c
BUILT_SOURCES = \
$(generator_built) \
guestfs_protocol.c \
guestfs_protocol.h \
errnostring_gperf.c \
errnostring_gperf.gperf \
errnostring.c \
errnostring.h
EXTRA_DIST = $(BUILT_SOURCES)
noinst_LIBRARIES = libprotocol.a
# This convenience library is solely to compile its generated sources with
# custom flags.
libprotocol_a_SOURCES = guestfs_protocol.c guestfs_protocol.h
libprotocol_a_CFLAGS = -Wall -Wno-unused -fno-strict-aliasing
guestfs_protocol.c: $(libsrcdir)/guestfs_protocol.c
rm -f $@
ln $< $@
guestfs_protocol.h: $(libsrcdir)/guestfs_protocol.h
rm -f $@
ln $< $@
$(libsrcdir)/guestfs_protocol.c: force
$(MAKE) -C $(libsrcdir) guestfs_protocol.c
$(libsrcdir)/guestfs_protocol.h: force
$(MAKE) -C $(libsrcdir) guestfs_protocol.h
# Build the errnostring perfect hash code. The generated code has lots
# of warnings so we must compile it in a separate mini-library.
noinst_LIBRARIES += liberrnostring.a
liberrnostring_a_SOURCES = \
errnostring_gperf.c \
errnostring.h \
errnostring.c
liberrnostring_a_CFLAGS =
errnostring_gperf.c: errnostring_gperf.gperf
rm -f $@
$(GPERF) -t $< > $@-t
mv $@-t $@
errnostring_gperf.gperf: $(libsrcdir)/errnostring_gperf.gperf
rm -f $@
ln $< $@
errnostring.c: $(libsrcdir)/errnostring.c
rm -f $@
ln $< $@
errnostring.h: $(libsrcdir)/errnostring.h
rm -f $@
ln $< $@
if INSTALL_DAEMON
sbin_PROGRAMS = guestfsd
else
noinst_PROGRAMS = guestfsd
endif
guestfsd_SOURCES = \
9p.c \
actions.h \
available.c \
augeas.c \
base64.c \
blkid.c \
blockdev.c \
btrfs.c \
checksum.c \
cmp.c \
command.c \
compress.c \
copy.c \
cpmv.c \
daemon.h \
dd.c \
debug.c \
devsparts.c \
df.c \
@@ -40,25 +110,40 @@ guestfsd_SOURCES = \
ext2.c \
fallocate.c \
file.c \
findfs.c \
fill.c \
find.c \
fsck.c \
fstrim.c \
glob.c \
grep.c \
grub.c \
guestfsd.c \
headtail.c \
hexdump.c \
htonl.c \
initrd.c \
inotify.c \
internal.c \
is.c \
isoinfo.c \
labels.c \
link.c \
ls.c \
luks.c \
lvm.c \
lvm-filter.c \
md.c \
mkfs.c \
mknod.c \
modprobe.c \
mount.c \
names.c \
ntfs.c \
ntfsclone.c \
optgroups.c \
optgroups.h \
parted.c \
pingdaemon.c \
proto.c \
readdir.c \
@@ -68,21 +153,35 @@ guestfsd_SOURCES = \
sfdisk.c \
sleep.c \
stat.c \
statvfs.c \
strings.c \
stubs.c \
swap.c \
sync.c \
tar.c \
truncate.c \
umask.c \
upload.c \
utimens.c \
wc.c \
xattr.c \
zero.c \
zerofree.c \
$(top_builddir)/../src/guestfs_protocol.h \
$(top_builddir)/../src/guestfs_protocol.c
zerofree.c
guestfsd_LDADD = \
liberrnostring.a \
libprotocol.a \
$(SELINUX_LIB) \
$(AUGEAS_LIBS) \
$(top_builddir)/gnulib/lib/.libs/libgnu.a \
$(GETADDRINFO_LIB) \
$(HOSTENT_LIB) \
$(INET_NTOP_LIB) \
$(LIBSOCKET) \
$(LIB_CLOCK_GETTIME) \
$(LIBINTL) \
$(SERVENT_LIB)
AM_CPPFLAGS = -I$(srcdir)/lib -Ilib
guestfsd_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
guestfsd_CPPFLAGS = -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib
guestfsd_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) $(AUGEAS_CFLAGS)
LDADD = lib/libgnu.a
.PHONY: force

View File

@@ -1 +0,0 @@
Please see README in the parent directory.

View File

@@ -13,7 +13,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <config.h>
@@ -29,6 +29,7 @@
#include "daemon.h"
#include "actions.h"
#include "optgroups.h"
#ifdef HAVE_AUGEAS
/* The Augeas handle. We maintain a single handle per daemon, which
@@ -36,7 +37,17 @@
* considerably.
*/
static augeas *aug = NULL;
#endif
/* Clean up the augeas handle on daemon exit. */
static void aug_finalize (void) __attribute__((destructor));
static void
aug_finalize (void)
{
if (aug) {
aug_close (aug);
aug = NULL;
}
}
#define NEED_AUG(errcode) \
do { \
@@ -47,11 +58,16 @@ static augeas *aug = NULL;
} \
while (0)
int
optgroup_augeas_available (void)
{
return 1;
}
/* We need to rewrite the root path so it is based at /sysroot. */
int
do_aug_init (const char *root, int flags)
{
#ifdef HAVE_AUGEAS
char *buf;
if (aug) {
@@ -74,26 +90,17 @@ do_aug_init (const char *root, int flags)
}
return 0;
#else
reply_with_error ("%s is not available", __func__);
return -1;
#endif
}
int
do_aug_close (void)
{
#ifdef HAVE_AUGEAS
NEED_AUG(-1);
aug_close (aug);
aug = NULL;
return 0;
#else
reply_with_error ("%s is not available", __func__);
return -1;
#endif
}
int
@@ -111,7 +118,7 @@ do_aug_defvar (const char *name, const char *expr)
}
return r;
#else
reply_with_error ("%s is not available", __func__);
reply_with_error ("function not available");
return -1;
#endif
}
@@ -120,20 +127,29 @@ guestfs_int_int_bool *
do_aug_defnode (const char *name, const char *expr, const char *val)
{
#ifdef HAVE_AUG_DEFNODE
static guestfs_int_int_bool r;
int created;
guestfs_int_int_bool *r;
int i, created;
NEED_AUG (NULL);
r.i = aug_defnode (aug, name, expr, val, &created);
if (r.i == -1) {
i = aug_defnode (aug, name, expr, val, &created);
if (i == -1) {
reply_with_error ("Augeas defnode failed");
return NULL;
}
r.b = created;
return &r;
r = malloc (sizeof *r);
if (r == NULL) {
reply_with_perror ("malloc");
return NULL;
}
r->i = i;
r->b = created;
return r;
#else
reply_with_error ("%s is not available", __func__);
reply_with_error ("function not available");
return NULL;
#endif
}
@@ -141,7 +157,6 @@ do_aug_defnode (const char *name, const char *expr, const char *val)
char *
do_aug_get (const char *path)
{
#ifdef HAVE_AUGEAS
const char *value = NULL;
char *v;
int r;
@@ -175,16 +190,11 @@ do_aug_get (const char *path)
}
return v; /* Caller frees. */
#else
reply_with_error ("%s is not available", __func__);
return NULL;
#endif
}
int
do_aug_set (const char *path, const char *val)
{
#ifdef HAVE_AUGEAS
int r;
NEED_AUG (-1);
@@ -196,16 +206,27 @@ do_aug_set (const char *path, const char *val)
}
return 0;
#else
reply_with_error ("%s is not available", __func__);
return -1;
#endif
}
int
do_aug_clear (const char *path)
{
int r;
NEED_AUG (-1);
r = aug_set (aug, path, NULL);
if (r == -1) {
reply_with_error ("Augeas clear failed");
return -1;
}
return 0;
}
int
do_aug_insert (const char *path, const char *label, int before)
{
#ifdef HAVE_AUGEAS
int r;
NEED_AUG (-1);
@@ -217,16 +238,11 @@ do_aug_insert (const char *path, const char *label, int before)
}
return 0;
#else
reply_with_error ("%s is not available", __func__);
return -1;
#endif
}
int
do_aug_rm (const char *path)
{
#ifdef HAVE_AUGEAS
int r;
NEED_AUG (-1);
@@ -238,16 +254,11 @@ do_aug_rm (const char *path)
}
return r;
#else
reply_with_error ("%s is not available", __func__);
return -1;
#endif
}
int
do_aug_mv (const char *src, const char *dest)
{
#ifdef HAVE_AUGEAS
int r;
NEED_AUG (-1);
@@ -259,16 +270,11 @@ do_aug_mv (const char *src, const char *dest)
}
return 0;
#else
reply_with_error ("%s is not available", __func__);
return -1;
#endif
}
char **
do_aug_match (const char *path)
{
#ifdef HAVE_AUGEAS
char **matches = NULL;
void *vp;
int r;
@@ -294,16 +300,11 @@ do_aug_match (const char *path)
matches[r] = NULL;
return matches; /* Caller frees. */
#else
reply_with_error ("%s is not available", __func__);
return NULL;
#endif
}
int
do_aug_save (void)
{
#ifdef HAVE_AUGEAS
NEED_AUG (-1);
if (aug_save (aug) == -1) {
@@ -312,10 +313,6 @@ do_aug_save (void)
}
return 0;
#else
reply_with_error ("%s is not available", __func__);
return -1;
#endif
}
int
@@ -331,7 +328,7 @@ do_aug_load (void)
return 0;
#else
reply_with_error ("%s is not available", __func__);
reply_with_error ("function not available");
return -1;
#endif
}
@@ -340,14 +337,15 @@ do_aug_load (void)
char **
do_aug_ls (const char *path)
{
#ifdef HAVE_AUGEAS
char **matches;
char *buf;
int len;
size_t len;
NEED_AUG (NULL);
ABS_PATH (path, return NULL);
/* Note that path might also be a previously defined variable
* (defined with aug_defvar). See RHBZ#580016.
*/
len = strlen (path);
@@ -357,9 +355,8 @@ do_aug_ls (const char *path)
return NULL;
}
if (len == 1)
/* we know path must be "/" because of ABS_PATH above */
matches = do_aug_match ("/");
if (STREQ (path, "/"))
matches = do_aug_match ("/*");
else {
len += 3; /* / * + terminating \0 */
buf = malloc (len);
@@ -378,8 +375,102 @@ do_aug_ls (const char *path)
sort_strings (matches, count_strings ((void *) matches));
return matches; /* Caller frees. */
#else
reply_with_error ("%s is not available", __func__);
return NULL;
#endif
}
#else /* !HAVE_AUGEAS */
/* Note that the wrapper code (daemon/stubs.c) ensures that the
* functions below are never called because optgroup_augeas_available
* returns false.
*/
int
optgroup_augeas_available (void)
{
return 0;
}
int
do_aug_init (const char *root, int flags)
{
abort ();
}
int
do_aug_close (void)
{
abort ();
}
int
do_aug_defvar (const char *name, const char *expr)
{
abort ();
}
guestfs_int_int_bool *
do_aug_defnode (const char *name, const char *expr, const char *val)
{
abort ();
}
char *
do_aug_get (const char *path)
{
abort ();
}
int
do_aug_set (const char *path, const char *val)
{
abort ();
}
int
do_aug_clear (const char *path)
{
abort ();
}
int
do_aug_insert (const char *path, const char *label, int before)
{
abort ();
}
int
do_aug_rm (const char *path)
{
abort ();
}
int
do_aug_mv (const char *src, const char *dest)
{
abort ();
}
char **
do_aug_match (const char *path)
{
abort ();
}
int
do_aug_save (void)
{
abort ();
}
int
do_aug_load (void)
{
abort ();
}
char **
do_aug_ls (const char *path)
{
abort ();
}
#endif

151
daemon/available.c Normal file
View File

@@ -0,0 +1,151 @@
/* libguestfs - the guestfsd daemon
* Copyright (C) 2009 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "c-ctype.h"
#include "guestfs_protocol.h"
#include "daemon.h"
#include "actions.h"
#include "optgroups.h"
int
do_available (char *const *groups)
{
int av;
size_t i, j;
for (i = 0; groups[i] != NULL; ++i) {
for (j = 0; optgroups[j].group != NULL; ++j) {
if (STREQ (groups[i], optgroups[j].group)) {
av = optgroups[j].available ();
if (!av) {
reply_with_error ("%s: group not available", optgroups[j].group);
return -1;
}
break; /* out of for (j) loop */
}
}
/* Unknown group? */
if (optgroups[j].group == NULL) {
reply_with_error ("%s: unknown group", groups[i]);
return -1;
}
}
return 0;
}
char **
do_available_all_groups (void)
{
size_t i;
DECLARE_STRINGSBUF (groups);
for (i = 0; optgroups[i].group != NULL; ++i) {
if (add_string (&groups, optgroups[i].group) == -1)
return NULL;
}
if (end_stringsbuf (&groups) == -1)
return NULL;
return groups.argv; /* caller frees */
}
/* Search for filesystem in /proc/filesystems, ignoring "nodev". */
static int
test_proc_filesystems (const char *filesystem)
{
size_t len = strlen (filesystem) + 32;
char regex[len];
char *err;
int r;
snprintf (regex, len, "^[[:space:]]*%s$", filesystem);
r = commandr (NULL, &err, "grep", regex, "/proc/filesystems", NULL);
if (r == -1 || r >= 2) {
fprintf (stderr, "grep /proc/filesystems: %s", err);
free (err);
return -1;
}
free (err);
return r == 0;
}
/* Do modprobe, ignore any errors. */
static void
modprobe (const char *module)
{
command (NULL, NULL, "modprobe", module, NULL);
}
/* Internal function for testing if a filesystem is available. Note
* this must not call reply_with_error functions.
*/
int
filesystem_available (const char *filesystem)
{
int r;
r = test_proc_filesystems (filesystem);
if (r == -1 || r > 0)
return r;
/* Not found: try to modprobe the module, then test again. */
if (optgroup_linuxmodules_available ()) {
modprobe (filesystem);
r = test_proc_filesystems (filesystem);
if (r == -1)
return -1;
}
return r;
}
int
do_filesystem_available (const char *filesystem)
{
size_t i, len = strlen (filesystem);
int r;
for (i = 0; i < len; ++i) {
if (!c_isalnum (filesystem[i]) && filesystem[i] != '_') {
reply_with_error ("filesystem name contains non-alphanumeric characters");
return -1;
}
}
r = filesystem_available (filesystem);
if (r == -1) {
reply_with_error ("error testing for filesystem availability; "
"enable verbose mode and look at preceeding output");
return -1;
}
return r;
}

151
daemon/base64.c Normal file
View File

@@ -0,0 +1,151 @@
/* libguestfs - the guestfsd daemon
* Copyright (C) 2010 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include "guestfs_protocol.h"
#include "daemon.h"
#include "actions.h"
static int
write_cb (void *fd_ptr, const void *buf, size_t len)
{
int fd = *(int *)fd_ptr;
return xwrite (fd, buf, len);
}
/* Has one FileIn parameter. */
int
do_base64_in (const char *file)
{
int err, r;
FILE *fp;
char *cmd;
if (asprintf_nowarn (&cmd, "base64 -d -i > %R", file) == -1) {
err = errno;
cancel_receive ();
errno = err;
reply_with_perror ("asprintf");
return -1;
}
if (verbose)
fprintf (stderr, "%s\n", cmd);
fp = popen (cmd, "w");
if (fp == NULL) {
err = errno;
cancel_receive ();
errno = err;
reply_with_perror ("%s", cmd);
free (cmd);
return -1;
}
free (cmd);
/* The semantics of fwrite are too undefined, so write to the
* file descriptor directly instead.
*/
int fd = fileno (fp);
r = receive_file (write_cb, &fd);
if (r == -1) { /* write error */
cancel_receive ();
reply_with_error ("write error on file: %s", file);
pclose (fp);
return -1;
}
if (r == -2) { /* cancellation from library */
/* This error is ignored by the library since it initiated the
* cancel. Nevertheless we must send an error reply here.
*/
reply_with_error ("file upload cancelled");
pclose (fp);
return -1;
}
if (pclose (fp) != 0) {
reply_with_error ("base64 subcommand failed on file: %s", file);
return -1;
}
return 0;
}
/* Has one FileOut parameter. */
int
do_base64_out (const char *file)
{
int r;
FILE *fp;
char *cmd;
char buf[GUESTFS_MAX_CHUNK_SIZE];
if (asprintf_nowarn (&cmd, "base64 %R", file) == -1) {
reply_with_perror ("asprintf");
return -1;
}
if (verbose)
fprintf (stderr, "%s\n", cmd);
fp = popen (cmd, "r");
if (fp == NULL) {
reply_with_perror ("%s", cmd);
free (cmd);
return -1;
}
free (cmd);
/* Now we must send the reply message, before the file contents. After
* this there is no opportunity in the protocol to send any error
* message back. Instead we can only cancel the transfer.
*/
reply (NULL, NULL);
while ((r = fread (buf, 1, sizeof buf, fp)) > 0) {
if (send_file_write (buf, r) < 0) {
pclose (fp);
return -1;
}
}
if (ferror (fp)) {
perror (file);
send_file_end (1); /* Cancel. */
pclose (fp);
return -1;
}
if (pclose (fp) != 0) {
perror (file);
send_file_end (1); /* Cancel. */
return -1;
}
if (send_file_end (0)) /* Normal end of file. */
return -1;
return 0;
}

250
daemon/blkid.c Normal file
View File

@@ -0,0 +1,250 @@
/* libguestfs - the guestfsd daemon
* Copyright (C) 2009 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include "daemon.h"
#include "actions.h"
static char *
get_blkid_tag (const char *device, const char *tag)
{
char *out, *err;
int r;
r = commandr (&out, &err,
"blkid",
/* Adding -c option kills all caching, even on RHEL 5. */
"-c", "/dev/null",
"-o", "value", "-s", tag, device, NULL);
if (r != 0 && r != 2) {
if (r >= 0)
reply_with_error ("%s: %s (blkid returned %d)", device, err, r);
else
reply_with_error ("%s: %s", device, err);
free (out);
free (err);
return NULL;
}
free (err);
if (r == 2) { /* means UUID etc not found */
free (out);
out = strdup ("");
if (out == NULL)
reply_with_perror ("strdup");
return out;
}
/* Trim trailing \n if present. */
size_t len = strlen (out);
if (len > 0 && out[len-1] == '\n')
out[len-1] = '\0';
return out; /* caller frees */
}
char *
do_vfs_type (const char *device)
{
return get_blkid_tag (device, "TYPE");
}
char *
do_vfs_label (const char *device)
{
return get_blkid_tag (device, "LABEL");
}
char *
do_vfs_uuid (const char *device)
{
return get_blkid_tag (device, "UUID");
}
/* RHEL5 blkid doesn't have the -p (low-level probing) option and the
* -i(I/O limits) option so we must test for these options the first
* time the function is called.
*
* Debian 6 has -p but not -i.
*/
static int
test_blkid_p_i_opt (void)
{
int r;
char *err;
r = commandr (NULL, &err, "blkid", "-p", "/dev/null", NULL);
if (r == -1) {
/* This means we couldn't run the blkid command at all. */
command_failed:
reply_with_error ("could not run 'blkid' command: %s", err);
free (err);
return -1;
}
if (strstr (err, "invalid option --")) {
free (err);
return 0;
}
free (err);
r = commandr (NULL, &err, "blkid", "-i", NULL);
if (r == -1)
goto command_failed;
if (strstr (err, "invalid option --")) {
free (err);
return 0;
}
free (err);
/* We have both options. */
return 1;
}
static char **
blkid_with_p_i_opt (const char *device)
{
size_t i;
int r;
char *out = NULL, *err = NULL;
char **lines = NULL;
DECLARE_STRINGSBUF (ret);
r = command (&out, &err, "blkid", "-c", "/dev/null",
"-p", "-i", "-o", "export", device, NULL);
if (r == -1) {
reply_with_error ("%s", err);
goto error;
}
/* Split the command output into lines */
lines = split_lines (out);
if (lines == NULL)
goto error;
/* Parse the output of blkid -p -i -o export:
* UUID=b6d83437-c6b4-4bf0-8381-ef3fc3578590
* VERSION=1.0
* TYPE=ext2
* USAGE=filesystem
* MINIMUM_IO_SIZE=512
* PHYSICAL_SECTOR_SIZE=512
* LOGICAL_SECTOR_SIZE=512
* PART_ENTRY_SCHEME=dos
* PART_ENTRY_TYPE=0x83
* PART_ENTRY_NUMBER=6
* PART_ENTRY_OFFSET=642875153
* PART_ENTRY_SIZE=104857600
* PART_ENTRY_DISK=8:0
*/
for (i = 0; lines[i] != NULL; ++i) {
char *line = lines[i];
/* Skip blank lines (shouldn't happen) */
if (line[0] == '\0') continue;
/* Split the line in 2 at the equals sign */
char *eq = strchr (line, '=');
if (eq) {
*eq = '\0'; eq++;
/* Add the key/value pair to the output */
if (add_string (&ret, line) == -1 ||
add_string (&ret, eq) == -1) goto error;
} else {
fprintf (stderr, "blkid: unexpected blkid output ignored: %s", line);
}
}
if (end_stringsbuf (&ret) == -1) goto error;
free (out);
free (err);
free_strings (lines);
return ret.argv;
error:
free (out);
free (err);
if (lines)
free_strings (lines);
if (ret.argv)
free_strings (ret.argv);
return NULL;
}
static char **
blkid_without_p_i_opt(const char *device)
{
char *s;
DECLARE_STRINGSBUF (ret);
if (add_string (&ret, "TYPE") == -1) goto error;
s = get_blkid_tag (device, "TYPE");
if (s == NULL) goto error;
if (add_string (&ret, s) == -1)
goto error;
if (add_string (&ret, "LABEL") == -1) goto error;
s = get_blkid_tag (device, "LABEL");
if (s == NULL) goto error;
if (add_string (&ret, s) == -1)
goto error;
if (add_string (&ret, "UUID") == -1) goto error;
s = get_blkid_tag (device, "UUID");
if (s == NULL) goto error;
if (add_string (&ret, s) == -1)
goto error;
if (end_stringsbuf (&ret) == -1) goto error;
return ret.argv;
error:
if (ret.argv)
free_strings (ret.argv);
return NULL;
}
char **
do_blkid (const char *device)
{
static int blkid_has_p_i_opt = -1;
if (blkid_has_p_i_opt == -1) {
blkid_has_p_i_opt = test_blkid_p_i_opt ();
if (blkid_has_p_i_opt == -1)
return NULL;
}
if (blkid_has_p_i_opt)
return blkid_with_p_i_opt (device);
else
return blkid_without_p_i_opt (device);
}

View File

@@ -13,7 +13,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <config.h>
@@ -38,7 +38,7 @@ call_blockdev (const char *device, const char *switc, int extraarg, int prints)
int64_t rv;
char *out, *err;
const char *argv[] = {
"/sbin/blockdev",
"blockdev",
switc,
NULL,
NULL,
@@ -46,6 +46,20 @@ call_blockdev (const char *device, const char *switc, int extraarg, int prints)
};
char buf[64];
/* 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 (from a previous operation) since it
* holds the device open and can cause other operations to fail,
* notably BLKRRPART.
*
* This is particularly a problem where we have just written to a
* device (eg. zeroing it) and immediately call blockdev --rereadpt.
*
* Therefore, wait for udev to finish all outstanding events before
* performing any blockdev command.
*/
udev_settle ();
if (extraarg > 0) {
snprintf (buf, sizeof buf, "%d", extraarg);
argv[2] = buf;
@@ -53,7 +67,7 @@ call_blockdev (const char *device, const char *switc, int extraarg, int prints)
} else
argv[2] = device;
r = commandv (&out, &err, (char **) argv);
r = commandv (&out, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s", argv[0], err);
@@ -68,11 +82,13 @@ call_blockdev (const char *device, const char *switc, int extraarg, int prints)
if (sscanf (out, "%" SCNi64, &rv) != 1) {
reply_with_error ("%s: expected output, but got nothing", argv[0]);
free (out);
free (err);
return -1;
}
}
free (out);
free (err);
return rv;
}
@@ -111,7 +127,7 @@ int
do_blockdev_setbsz (const char *device, int blocksize)
{
if (blocksize <= 0 /* || blocksize >= what? */) {
reply_with_error ("blockdev_setbsz: blocksize must be > 0");
reply_with_error ("blocksize must be > 0");
return -1;
}
return (int) call_blockdev (device, "--setbsz", blocksize, 0);

Some files were not shown because too many files have changed in this diff Show More