Compare commits

...

3654 Commits

Author SHA1 Message Date
Richard W.M. Jones
6d09ff3600 Version 1.27.51. 2014-09-22 18:28:07 +01:00
Richard W.M. Jones
7b428603e3 v2v: Windows: Uploading viostor driver needs upload method, not copy.
Thanks: Jeff Forbes
2014-09-22 18:25:51 +01:00
Richard W.M. Jones
1b12c6d46b fuse: Remove test-fuse.sh (rewritten script) from EXTRA_DIST.
This fixes commit aca076e2e2.
2014-09-22 18:25:26 +01:00
Richard W.M. Jones
1b9b4af724 Revert "v2v: -o rhev: Chown the image files and metadata after the upload."
This reverts commit dd58cde929.
2014-09-22 18:13:34 +01:00
Richard W.M. Jones
2e3e254e95 Revert "v2v: -o rhev: Use chown --reference instead of 36.36 (RHBZ#1143887)."
This reverts commit 70444670ac.
2014-09-22 18:13:22 +01:00
Hu Tao
cd86bc5100 resize: simplify the code to filter parts
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-22 16:48:18 +01:00
Richard W.M. Jones
cee9a4993d v2v: For grub legacy, edit grub config file instead of using grubby (RHBZ#1141145).
The old virt-v2v code would either edit the grub config file (grub
legacy) or use grubby --set-default (grub2).

When translating this code, I figured we could use grubby in both
cases, since grubby exists for grub legacy guests.

However it doesn't appear to work for grub legacy guests.  Use the
configuration file editing method for these, same as old virt-v2v.

Thanks: Tingting Zheng
2014-09-22 16:44:19 +01:00
Richard W.M. Jones
58eaf258c1 fuse: Enable futimens test (RHBZ#1144766). 2014-09-22 15:47:48 +01:00
Richard W.M. Jones
8664337cc3 New APIs: Implement stat calls that return nanosecond timestamps (RHBZ#1144891).
The existing APIs guestfs_stat, guestfs_lstat and guestfs_lstatlist
return a stat structure that contains atime, mtime and ctime fields
that store only the timestamp in seconds.

Modern filesystems can store timestamps down to nanosecond
granularity, and the ordinary glibc stat(2) wrapper will return these
in "hidden" stat fields:

  struct timespec st_atim;            /* Time of last access.  */
  struct timespec st_mtim;            /* Time of last modification.  */
  struct timespec st_ctim;            /* Time of last status change.  */

with the following macros defined for backwards compatibility:

  #define st_atime st_atim.tv_sec
  #define st_mtime st_mtim.tv_sec
  #define st_ctime st_ctim.tv_sec

It is not possible to redefine guestfs_stat to return a longer struct
guestfs_stat with room for the extra nanosecond fields, because that
would break the ABI of guestfs_lstatlist as it returns an array
containing consecutive stat structs (not pointers).  Changing the
return type of guestfs_stat would break API.  Changing the generator
to support symbol versioning is judged to be too intrusive.

Therefore this adds a new struct (guestfs_statns) and new APIs:

  guestfs_statns
  guestfs_lstatns
  guestfs_lstatnslist

which return the new struct (or array of structs in the last case).

The old APIs may of course still be used, forever, but are deprecated
and shouldn't be used in new programs.

Because virt tools are compiled with -DGUESTFS_WARN_DEPRECATED=1, I
have updated all the places calling the deprecated functions.  This
has revealed some areas for improvement: in particular virt-diff and
virt-ls could be changed to print the nanosecond fields.

FUSE now returns nanoseconds in stat calls where available, fixing
https://bugzilla.redhat.com/show_bug.cgi?id=1144891

Notes about the implementation:

- guestfs_internal_lstatlist has been removed and replaced by
  guestfs_internal_lstatnslist.  As the former was an internal API no
  one should have been calling it, or indeed can call it unless they
  start defining their own header files.

- guestfs_stat and guestfs_lstat have been changed into library-side
  functions.  They, along with guestfs_lstatlist, are now implemented
  as wrappers around the new functions which just throw away the
  nanosecond fields.
2014-09-22 15:47:48 +01:00
Richard W.M. Jones
aca076e2e2 fuse: Rewrite test-fuse.sh in C.
This gives us finer control over how system calls are done,
and also potentially lets us test more.

Currently two tests are disabled:

 - utimens because of https://bugzilla.redhat.com/show_bug.cgi?id=1144766

 - utimes because our stat call does not return the nanosecond fields
2014-09-21 22:15:37 +01:00
Richard W.M. Jones
5bb26dcd3c tests/data: Remove abssymlink.
This file causes the test ISO to be rebuilt every time.

Instead of including it as a Makefile dependency, create it just
before making the ISO, which has the same effect.

A test in fish/ also used this file.  Change it so it doesn't need it.
2014-09-20 17:32:18 +01:00
Richard W.M. Jones
5fa568f686 tests/guests: Don't calculate checksums of generated images.
Turns out not to be useful, and takes a long time.

This reverts commit 0c605eb94f.
2014-09-20 15:57:44 +01:00
Richard W.M. Jones
cd9c0fc9a4 v2v: Move mpstat type definition.
It's only used by the core v2v.ml code, so move it to that file.

This is just code motion.
2014-09-20 11:56:13 +01:00
Richard W.M. Jones
eed49ac897 v2v: Move target actual size computation into core v2v.ml code.
This was only calculated for RHEV, but might benefit other output
modes in future, and is generic code, so move it into the core code.
2014-09-20 11:56:12 +01:00
Richard W.M. Jones
c1a32f5c11 v2v: Clarify description of ov_sd field in comment. 2014-09-20 11:56:12 +01:00
Richard W.M. Jones
0869f579fd aarch64: Add support to file_architecture API.
Add support for aarch64 to the file_architecture API, so we can
detect aarch64 guests correctly.

Add a test binary and library.  These were generated on an aarch64
machine by doing:

  echo 'main(){}' > bin.c
  gcc bin.c -o bin-aarch64-dynamic
  strip --strip-all bin-aarch64-dynamic
  echo '' > lib.c
  gcc -shared lib.c -o lib-aarch64.so
  strip --strip-all lib-aarch64.so
2014-09-20 11:56:12 +01:00
Richard W.M. Jones
f61832b17a v2v: Remove source.s_arch field and find architecture through inspection.
Previously we required that the source hypervisor knew the
architecture of the guest, and passed that through to KVM.

However this was error-prone for several reasons:

 - OVF (-i ova) doesn't define the architecture

 - Disk images (-i disk) don't have an associated architecture

 - Libvirt XML sometimes lacks the <type arch=...> field, especially
   for RHEL 5-era libvirt.

 - It might not be set correctly for the guest.

We know the real architecture from inspection of the guest, so use
that instead.
2014-09-20 11:56:12 +01:00
Richard W.M. Jones
95b7e716ca v2v: Fix typo in comment. 2014-09-20 08:12:41 +01:00
Hilko Bengen
a36dde9889 appliance: Add libsystemd0 (and systemd as an alternative for sysvinit) on Debian-based systems 2014-09-19 20:52:43 +02:00
Richard W.M. Jones
b2a1d4ce45 Version 1.27.50. 2014-09-19 14:52:16 +01:00
Hu Tao
1e6dd6d2a3 resize: add function expand_partition_content
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-19 14:23:40 +01:00
Hu Tao
b9063b7c2f resize: add function set_partition_bootable_and_id
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-19 14:22:53 +01:00
Hu Tao
51f67a9c81 resize: add function copy_partition
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-19 14:21:52 +01:00
Hu Tao
4e6526c076 resize: add function print_summmary
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-19 14:03:25 +01:00
Hu Tao
d9f8746ea5 add function div_roundup64
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-19 13:54:44 +01:00
Hu Tao
b05b9ba8bf resize: convert sectsize to int64
Because sectsize is used as int64 everywhere.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-19 13:54:44 +01:00
Richard W.M. Jones
816d7cf941 fish: Restore text to default when exiting (RHBZ#1144201).
The escape sequence \e[0;30m sets the colour to black.  This is fine
if you use a black-on-white terminal, but fails rather badly if you
use a white-on-black terminal.

Instead use the escape sequence \e[0m which restores the terminal to
the defaults, and works in both cases.
2014-09-19 13:18:45 +01:00
Richard W.M. Jones
4aa38bba2c v2v: Clean the RPM database early on (RHBZ#1143866).
If the RPM database in the source guest is corrupt, then subsequent
operations will fail randomly.

Old virt-v2v appears to have avoided this by cleaning the RPM database
very early on.  When translating the code I inadvertantly moved this
cleanup to a later stage -- in particular, after inspection of kernels
was done which requires running rpm commands.  Move this back to the
start.
2014-09-19 12:37:28 +01:00
Richard W.M. Jones
6db2ff52f9 v2v: Move initialization of Augeas after inspection housekeeping.
Just cleanup, it should have no effect on the way that the
conversion works.
2014-09-19 12:37:28 +01:00
Pino Toscano
7d9db86cab appliance: move e2fsprogs as common for all distros
All distro-specific sections have it, so just make it really common.
2014-09-19 13:33:21 +02:00
Pino Toscano
70768239fd appliance: remove duplicate packages in OpenSUSE, Frugalware, Mageia
From some lists of distro-specific packages, remove the ones that
appear already in the common list.
2014-09-19 13:26:37 +02:00
Richard W.M. Jones
9572907956 Version 1.27.49. 2014-09-18 18:08:43 +01:00
Richard W.M. Jones
c573feb4d1 v2v: Print a message if the guest is virtio-capable after conversion. 2014-09-18 17:45:12 +01:00
Richard W.M. Jones
70444670ac v2v: -o rhev: Use chown --reference instead of 36.36 (RHBZ#1143887).
When chowning the final directories, instead of chowning them to 36.36
(ie. hard-coding those UID/GIDs), use a --reference chown so it should
take the ownership from the parent directory.

Unfortunately chowning is very complex because of:

 - NFSv3 vs NFSv4

 - root squash

 - idmap

which creates approximately 8 different ways for this to fail.
2014-09-18 15:07:32 +01:00
Richard W.M. Jones
035f47cdde v2v: Fix code for editing grub2 console=... parameter (RHBZ#1143883).
When presented with a RHEL 7 guest, virt-v2v would print the following
warning message:

  virt-v2v: warning: could not update grub2 console: aug_get: no matching
  node (ignored)

This happened because on RHEL 7, /etc/sysconfig/grub is a symlink to
/etc/default/grub, and the Augeas grub2 lens returns entries under
/files/etc/default/grub/*, but the code was checking for
/files/etc/sysconfig/grub/*.

The fix is to check all the possible Augeas paths until one matches.
(Only the first match gets updated however).

Also, don't rebuild the grub2 config unless we've actually changed it.
This avoids doing a potentially failure-prone operation when it's not
necessary.

I suspect that the old virt-v2v code did not work correctly for RHEL 7
guests, but old virt-v2v didn't print a warning here, it just failed
to update silently.
2014-09-18 14:55:33 +01:00
Richard W.M. Jones
e5dd3b08de customize: Make usage of --password-crypto option clearer (RHBZ#1143949). 2014-09-18 13:56:58 +01:00
Richard W.M. Jones
c68b510be2 Update release notes. 2014-09-18 13:36:41 +01:00
Richard W.M. Jones
32736857b3 v2v: Document the input: output: and convert: features in --machine-readable output. 2014-09-17 21:34:10 +01:00
Richard W.M. Jones
3562a81683 generator: Change type of 'tests' to 'c_api_tests'.
Just a code refactoring, has no functional effect.
2014-09-17 17:31:50 +01:00
Richard W.M. Jones
e85a976c5a tests: Don't use relative paths to binaries in tests.
All tests run under the ./run binary.  For a long time the ./run
binary has set the $PATH environment variable to contain all of the
directories with binaries in them.

Therefore there is no reason to use ../fish/guestfish instead of just
plain guestfish (and the same applies to other built binaries).
2014-09-17 17:31:50 +01:00
Richard W.M. Jones
bced8f5289 FAQ: Note that update-guestfs-appliance is not needed with libguestfs >= 1.26. 2014-09-17 16:33:55 +01:00
Richard W.M. Jones
58a285b5b3 Version 1.27.48. 2014-09-17 15:51:30 +01:00
Richard W.M. Jones
0fabe1a2ed daemon: parted: Fix error message when part-get-name is called on non-GPT (RHBZ#1142416).
The error message was bogus, fix it.

This fixes commit 0316d24770.

Found by: Lingfei Kong
2014-09-17 15:36:15 +01:00
Richard W.M. Jones
5fcc584c34 daemon: parted: Don't crash if part-get-name called on non-partitioned device (RHBZ#1142158).
If do_part_get_parttype returns NULL, then return from the function
instead of dereferencing the NULL pointer and crashing.  Note that
do_part_get_parttype has already called reply_with_error in this case.

This fixes commit 0316d24770.

Found by: Lingfei Kong
2014-09-17 15:34:03 +01:00
Richard W.M. Jones
0710510732 v2v: Reconfigure /etc/modprobe.conf (RHBZ#1141145).
More code that was omitted during the translation of old virt-v2v.
2014-09-17 15:13:33 +01:00
Richard W.M. Jones
f982ce2703 v2v: Rebuild initrd last.
Old virt-v2v rebuilt the initrd late.  Currently we rebuild the initrd
right after choosing a kernel, but it's best to update the initrd
at the end since mkinitrd may depend on other configuration files
that we are changing (especially see next commit).
2014-09-17 15:13:21 +01:00
Richard W.M. Jones
5fed8dfae1 v2v: -o rhev: Don't quote 'root' in error message. 2014-09-17 13:59:39 +01:00
Richard W.M. Jones
dd58cde929 v2v: -o rhev: Chown the image files and metadata after the upload. 2014-09-17 13:59:26 +01:00
Richard W.M. Jones
d5001304e4 v2v: Fix OVF VmType field, which should be 0 or 1 (RHBZ#1142008).
Thanks: Shahar Havivi.
2014-09-17 13:07:17 +01:00
Richard W.M. Jones
05f665166c v2v: Fix capitalization of ovf:volume-type (RHBZ#1142008).
Thanks: Shahar Havivi.
2014-09-17 13:07:17 +01:00
Richard W.M. Jones
fe36b2ce95 v2v: -o rhev/vdsm: Fix ovf:size and ovf:actual_size fields (RHBZ#1142008).
These are integers in gigabytes (2^30).

Thanks: Shahar Havivi.
2014-09-17 13:07:17 +01:00
Richard W.M. Jones
7739a6d357 v2v: If virtio is enabled, map device names to vd* (RHBZ#1142004).
The old virt-v2v code had:

    my $prefix;
    if ($virtio) {
        $prefix = 'vd';
    } elsif ($libata) {
        $prefix = 'sd';
    } else {
        $prefix = 'hd'
    }

The translated code dropped the test for virtio by accident, which
meant that device names would be mapped to sd* or hd* even if the
virtio-blk driver was enabled for the guest.

Thanks: Tingting Zheng
2014-09-17 12:13:42 +01:00
Richard W.M. Jones
4178bdc9b4 sysprep: Clarify the documentation for 'flag-reconfiguration'.
It was quite obscure what this actually did.  Make it clear
in the documentation.
2014-09-17 11:52:34 +01:00
Richard W.M. Jones
f722571c73 sysprep: Clarify when --mount-options is used and what it does (RHBZ#1142186). 2014-09-16 16:46:34 +01:00
Richard W.M. Jones
9aeaace779 Version 1.27.47. 2014-09-16 16:43:28 +01:00
Richard W.M. Jones
01b25d7fc6 v2v: Add xvda -> sda etc mappings (RHBZ#1142004).
For Xen guests, a device can be presented twice as (eg) xvda and sda,
and therefore we should map any otherwise unmapped xvdX.

For non-Xen guests, this should have no effect.
2014-09-16 16:20:15 +01:00
Richard W.M. Jones
d86016da8e v2v: Fix for 'grubby: bad argument --set-kernel: unknown option' (RHBZ#1141145).
I made a mistake while translating the Perl conversion code and
transcribed --set-default as --set-kernel.  grubby has no --set-kernel
option so it failed.

Thanks: Tingting Zheng
2014-09-16 15:49:34 +01:00
Richard W.M. Jones
a7147ce9ff run: Add p2v to the PATH. 2014-09-16 08:38:05 +01:00
Richard W.M. Jones
8856fadadb v2v: Prevent conversion of "blocked" and "paused" domains also.
Previously only "running" domains were blocked from conversion.
However "blocked" is essentially the same as running (on Xen it just
means the domain is running but waiting on an I/O resource).  And
"paused" domains probably shouldn't be converted either since their
disks are only crash-consistent.
2014-09-16 08:38:04 +01:00
Richard W.M. Jones
77b371b18b v2v: Clarify the missing input format error message (RHBZ#1141723). 2014-09-15 11:31:55 +01:00
Richard W.M. Jones
21c6c70378 Version 1.27.46. 2014-09-15 11:03:35 +01:00
Richard W.M. Jones
1dd485e500 v2v: Allow pool UUID to be used in -os parameter (RHBZ#1141631).
Thanks: Zhou Junqin.
2014-09-15 10:17:01 +01:00
Richard W.M. Jones
47251a3599 v2v: Allow domain UUID to be used in place of libvirt guest name (RHBZ#1141680).
Thanks: Zhou Junqin.
2014-09-15 10:15:54 +01:00
Richard W.M. Jones
a417287e0a v2v: domainxml: Rework libvirt error handling.
Don't rely on libvirt's implicit print-to-stderr.  Instead make sure
that libvirt error messages are raised in the exception message.

Also allow error strings to be translated.
2014-09-15 10:13:09 +01:00
Richard W.M. Jones
be1385d2cb Revert "v2v: -i libvirtxml: Give an error if local disks are not readable (RHBZ#1140946)."
This commit breaks remote disks.  See:
https://bugzilla.redhat.com/show_bug.cgi?id=1141654

This reverts commit 73c1f1cf7e.
2014-09-15 09:46:30 +01:00
Hilko Bengen
7039d0e7f6 Generate *.cmx targets only if a native OCaml compiler exists 2014-09-14 21:21:25 +02:00
Richard W.M. Jones
50d5d4b723 v2v: Add stringMap.mli (interface).
Hopefully this should fix the incorrect build problem.  See discussion
here:

https://www.redhat.com/archives/libguestfs/2014-September/msg00071.html

The interface was generated using 'ocamlc -i'.
2014-09-14 19:03:28 +01:00
Richard W.M. Jones
a18c2aca14 Revert "Use ocamldep -all option."
This reverts commit a3881445ef.

See discussion on the mailing list:

https://www.redhat.com/archives/libguestfs/2014-September/msg00069.html
2014-09-14 18:46:49 +01:00
Richard W.M. Jones
48604913db Version 1.27.45. 2014-09-14 14:02:12 +01:00
Richard W.M. Jones
4515413217 daemon: Run udev_settle after pwrite-device finishes (RHBZ#1141451).
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 mkfs.

(cherry picked from commit a9c8123c72)
2014-09-14 12:57:53 +01:00
Richard W.M. Jones
974c4cd015 appliance: Add comment with udev debugging option. 2014-09-14 12:26:37 +01:00
Richard W.M. Jones
88dea54803 v2v: -o rhev/vdsm: In --no-copy case, use estimate for ovf:actual_size (RHBZ#1140156). 2014-09-14 12:19:56 +01:00
Richard W.M. Jones
3e2f89a74f v2v: Fix variable name usage_mb -> usage_gb.
It's actually storing usage in gigabytes, not megabytes.
2014-09-14 12:19:56 +01:00
Richard W.M. Jones
5a620137bf v2v: Estimate the amount of space required on the target.
Estimate the amount of space required on the target by each source
disk after conversion.  The estimate is approximately a ceiling on
this, and actual use should be considerably lower.

Provide an extra output method (#check_target_free_space) which output
modules may use to check that there is sufficient free space to
proceed, before conversion starts.  None of the output modules
actually implement this at the moment.
2014-09-14 12:19:56 +01:00
Richard W.M. Jones
f084fec381 v2v: Introduce Types.mpstats struct storing mountpoint statistics.
This is just code refactoring.
2014-09-13 14:54:39 +01:00
Richard W.M. Jones
b7bdb63d89 tools: Check for dangling --format parameters (RHBZ#1140894).
In most C tools, virt-sysprep and virt-customize, you have to put the
--format parameter before the corresponding -a parameter.  ie.  The
following is correct:

  guestfish --format qcow2 -a disk1 -a disk2

But the following is incorrect.  The --format parameter is dangling
and prior to this commit would have been silently ignored:

  guestfish -a disk1 -a disk2 --format qcow2

After this change, dangling --format parameters now lead to an error:

  guestfish: --format parameter must appear before -a parameter

In virt-customize, also check that --attach-format parameter appears
before --attach parameter.

Thanks: Lingfei Kong
2014-09-13 10:49:58 +01:00
Richard W.M. Jones
7845bcc20f Version 1.27.44. 2014-09-12 22:44:07 +01:00
Richard W.M. Jones
764cbd5f69 sysprep: Use 'error' function consistently throughout the program. 2014-09-12 22:29:49 +01:00
Richard W.M. Jones
f1390d3d7a sysprep: Ensure error handler surrounds all the code so we catch and print all errors. 2014-09-12 22:20:17 +01:00
Richard W.M. Jones
7bd7dabbd7 v2v: esx: Clarify that username can be specified in vpx:// URI (RHBZ#1141113).
If there is an authentication error when getting the session cookie,
emphasize in the error message that the username can be specified in
the URI.

Unfortunately libvirt asks for the username previously, but we cannot
access that.
2014-09-12 22:06:06 +01:00
Richard W.M. Jones
7836aa523b v2v: Add -o null mode.
In theory this discards the output.  Unfortunately in practice we have
to write the output to a temporary file and delete it (because of
limitations in qemu-img convert).
2014-09-12 20:30:34 +01:00
Richard W.M. Jones
73c1f1cf7e v2v: -i libvirtxml: Give an error if local disks are not readable (RHBZ#1140946). 2014-09-12 19:37:03 +01:00
Richard W.M. Jones
3729bc1fe1 sysprep: Check --{keep,remove}-user-accounts parameters are not used when operation is disabled (RHBZ#1141157).
You will see an error like this:

$ virt-sysprep --remove-user-accounts foo,bar -a /dev/null
virt-sysprep: error: user-accounts: --remove-user-accounts parameter was
used, but the "user-account" operation is not enabled
2014-09-12 16:41:24 +01:00
Richard W.M. Jones
5066fde8f2 sysprep: Add an optional method for checking if unused arguments were passed to disabled operations. 2014-09-12 16:41:24 +01:00
Richard W.M. Jones
0513a91d2e sysprep: Replace --user-accounts option with --{remove,keep}-user-accounts.
The --user-accounts option, with its double-negative '-' prefix on
user names, is confusing.  Replace it with '--remove-user-accounts'
and '--keep-user-accounts' options.

This updates commit 128d474095.
2014-09-12 16:41:24 +01:00
Richard W.M. Jones
e1ed66e2b1 v2v: If non-Xen and Xen initrds match a kernel, take shortest name (RHBZ#1141145).
Thanks: Tingting Zheng.
2014-09-12 15:51:12 +01:00
Richard W.M. Jones
44907763a6 v2v: Fix --help documentation of -o glance option.
Thanks: Junqin Zhou
2014-09-12 12:41:26 +01:00
Richard W.M. Jones
8f1ce3a72f Version 1.27.43. 2014-09-11 19:38:10 +01:00
Richard W.M. Jones
b67da2524f v2v: Split off -o vdsm mode from -o rhev (RHBZ#1140156).
-o rhev: This is "traditional" output to a RHEV-M Export Storage Domain.
It requires no cooperation from RHEV itself, and in all other respects
works the same way as old virt-v2v did.

-o vdsm: This is the new mode which requires VDSM cooperation.  VDSM
manages the conversion, creating the directories, suggesting UUIDs,
and cleaning up on failure.  This allows direct import into a Data
Domain.

The --rhev* command arguments now only apply to -o vdsm, and therefore
have been renamed to --vdsm*

The --vmtype command line argument may be used with -o rhev or -o vdsm.
2014-09-11 19:38:00 +01:00
Richard W.M. Jones
4c25f48bba v2v: Move some utility functions into Lib_ovf module.
This is just code refactoring and has no functional effect.
2014-09-11 16:23:00 +01:00
Richard W.M. Jones
694dc695b8 v2v: Remove unused struct (Types.output_rhev_params). 2014-09-11 16:16:10 +01:00
Richard W.M. Jones
04206fb3c0 v2v: Rename module Output_RHEV to Output_rhev.
This is just code refactoring, and has no functional change to the
program.
2014-09-11 16:16:10 +01:00
Richard W.M. Jones
de3614e0ff builder: Fix documentation of --list --list-format option (RHBZ#1140547).
Also give an error if users use the incorrect one:

$ virt-builder --list --format json
virt-builder: virt-builder --list: use '--list-format', not '--format'.
2014-09-11 10:14:24 +01:00
Richard W.M. Jones
b047feafa9 Update BUGS file. 2014-09-10 22:31:06 +01:00
Richard W.M. Jones
4fb3009a42 Version 1.27.42. 2014-09-10 22:11:01 +01:00
Pino Toscano
c862dc3d20 fish: fix small memory leak in completion
Do not leak the small memory buffer with the path.
2014-09-10 18:47:51 +02:00
Pino Toscano
55f70c13e3 resize: print FSes which cannot be expanded
Should ease a bit the discovery of a filesystem which cannot be
expanded.
2014-09-10 18:47:51 +02:00
Pino Toscano
a67845bfa0 test-charset-fidelity: set iocharset in vfat/msdos FSes
The default charset for these filesystems depends on how the kernel was
configured with, so explicitly set the default one (as specified in
Linux sources), eventually setting later a new one for the tests.
2014-09-10 18:47:51 +02:00
Richard W.M. Jones
c49d35a919 v2v: Clearer error message if ssh-agent authentication is not set up (RHBZ#1139973). 2014-09-10 17:01:10 +01:00
Richard W.M. Jones
516faa1bcb v2v: Fall back to virDomainGetInfo if remote libvirtd does not support virDomainGetState (RHBZ#1138586).
RHEL 5 Xen doesn't support the relatively new virDomainGetState API.
Instead you will see a warning message on stderr:

  libvirt: Remote Driver error : unknown procedure: 212

If we detect that virDomainGetState is not supported, then fall back
to calling virDomainGetInfo instead, which works everywhere.

This updates commit 096c05a750.

See also:
https://bugzilla.redhat.com/show_bug.cgi?id=1139973#c2
https://bugzilla.redhat.com/show_bug.cgi?id=1138586
2014-09-10 16:35:58 +01:00
Richard W.M. Jones
b6099f4aee v2v: Report error when multiple conflicting command line options are used (RHBZ#1140050).
$ virt-v2v -i disk -i libvirt
virt-v2v: error: -i option used more than once on the command line
2014-09-10 11:24:25 +01:00
Richard W.M. Jones
a6279f5c7b v2v: List convert modules in --machine-readable output.
$ virt-v2v --machine-readable
[...]
convert:enterprise-linux
convert:windows
2014-09-10 11:16:59 +01:00
Richard W.M. Jones
3d2e2bb445 v2v: Abstract Convert_* modules from core v2v code.
Previously the core virt-v2v code had to know which Convert_* module
to call for each guest type (based on inspection).  After this change
the core code doesn't need to know that, but instead Convert_* modules
register their interest in particular guest types.
2014-09-10 11:16:59 +01:00
Richard W.M. Jones
102e9a8c05 sysprep: Don't use --option=arg in documentation.
Fedora patches OCaml's Arg module to support --option=arg.  Since this
won't work on other distros or upstream OCaml, don't include such
examples in the documentation.
2014-09-09 23:27:51 +01:00
Richard W.M. Jones
c22d86870c v2v: Allow -o local as an alias for -o disk.
This is symmetrical with -i disk / -i local.
2014-09-09 23:14:27 +01:00
Richard W.M. Jones
49fa6912ed v2v: Sort the -i options alphabetically in the man page. 2014-09-09 23:14:27 +01:00
Richard W.M. Jones
68e58e5814 v2v: Update documentation credits.
Shahar Havivi and Tingting Zheng for development & testing respectively.
2014-09-09 23:13:57 +01:00
Richard W.M. Jones
334dee64a2 FAQ: Repeat advice to use ./run.
The two adjacent sections can be read separately, and the second
section doesn't mention not using make install / using ./run, so
repeat it a second time.
2014-09-09 20:27:33 +01:00
Richard W.M. Jones
163eb3b7a1 resize: Support for expanding XFS filesystems. 2014-09-09 17:06:39 +01:00
Richard W.M. Jones
aebe00e5c6 Version 1.27.41. 2014-09-09 16:02:44 +01:00
Richard W.M. Jones
a2107981a6 daemon: Run 'udevadm settle' with debugging and warn if the command fails. 2014-09-09 15:48:41 +01:00
Richard W.M. Jones
6b379ab598 Version 1.27.40. 2014-09-09 15:42:05 +01:00
Richard W.M. Jones
59136518f1 v2v: Calculate dracut/mkinitrd kernel version correctly (RHBZ#1138182).
Thanks: Tingting Zheng.
2014-09-09 15:23:25 +01:00
Pino Toscano
e89ab6dde4 tests: sysprep: slightly improve output
Add minor spacing changes, and report the image being sysprep'ed, so it
is easier to spot which image caused some warning message.
2014-09-09 15:10:33 +02:00
Richard W.M. Jones
be1c696500 v2v: Check if there is sufficient free space for conversion (RHBZ#1139543).
Before trying to perform the conversion, estimate if there is
sufficient free space on the guest filesystem(s) for the conversion to
be successful.

If not, you will see an error similar to this one:

[   6.0] Checking for sufficient free disk space in the guest
virt-v2v: error: not enough free space for conversion on filesystem '/'.
4354048 bytes free < 20000000 bytes needed
2014-09-09 10:46:55 +01:00
Richard W.M. Jones
4fc333d0ef p2v: Use matchbox (window manager) in the virt-p2v ISO.
virt-p2v can run without a window manager.  However it then sits in
the top left corner of the screen.  Add a lightweight window manager
to the ISO so that position and geometry hints work.
2014-09-08 13:13:01 +01:00
Richard W.M. Jones
e52ec0a3df p2v: Whitespace change in options list. 2014-09-08 11:07:03 +01:00
Richard W.M. Jones
a12745a481 Version 1.27.39. 2014-09-06 20:51:55 +01:00
Richard W.M. Jones
0866d22381 p2v: Add scripts to make disk or kickstart-based P2V ISO.
Two scripts are added, replacing the make targets from the
previous commit:

virt-p2v-make-disk: Builds a virt-p2v disk or USB key using
virt-builder.

virt-p2v-make-kickstart: Builds a kickstart file (only) which can be
fed to livecd-creator or similar tools on Red Hat-derived distros.

Kickstart generation is slightly different: Instead of requiring the
downstream 'libguestfs-pvhelper' package, the kickstart now embeds the
virt-p2v binary(!) making it self-contained and downstream packaging
simpler.

In addition there are documentation changes.
2014-09-06 20:51:54 +01:00
Richard W.M. Jones
8e6478dc7d p2v: Remove p2v-iso directory.
As part of reworking the scripts that are used to build the P2V ISO,
first remove the separate p2v-iso directory.  Similar scripts and
documentation will be introduced back into the p2v/ directory in
following commits.
2014-09-06 19:50:38 +01:00
Richard W.M. Jones
e1ee037096 p2v: Temporarily remove Configure Network button.
We will ship 1.28 without the capability of configuring the network
(ie. DHCP will always be used).
2014-09-06 19:50:38 +01:00
Richard W.M. Jones
a743f57cb8 p2v: Ensure the current version of virt-p2v is always displayed.
This will help with debugging customer problems.
2014-09-06 19:50:37 +01:00
Richard W.M. Jones
d7edde6b6d p2v: Success message should have info logo, not error logo. 2014-09-06 13:49:42 +01:00
Richard W.M. Jones
d82cf08ce1 daemon: Check return value of end_stringsbuf.
Found by Coverity.
2014-09-05 20:05:40 +01:00
Richard W.M. Jones
255ec57875 Version 1.27.38. 2014-09-05 15:24:38 +01:00
Richard W.M. Jones
d85c38155a appliance: Add guestfs_shadow.aug to EXTRA_DIST.
Fixes commit 61917136f5.
2014-09-05 15:19:07 +01:00
Pino Toscano
553677398b customize: use augeas to change passwords
Make use of augeas to load and edit /etc/shadow, now that we have
(either from upstream or by ourselves) a lens handling it.
2014-09-05 15:57:56 +02:00
Pino Toscano
a0cf4b3407 sysprep: remove comment and notes about /etc/shadow lens
We are either using the upstream lens, or our copy of it, to handle
/etc/shadow, so now removing entries from it works.
2014-09-05 15:57:56 +02:00
Pino Toscano
61917136f5 appliance: daemon: import and use upstream shadow lens
Import the upstream lens for the shadow file, just with a different
identifier and not matching /etc/shadow by default. Instead, apply a
transformation to have it match /etc/shadow only if the version of
augeas is at least 1.2.1 [1].

[1] While the last upstream version is 1.2.0, all the development seems
to happen in master, so whatever the next version is going to be
numbered (e.g. 1.2.1 or 1.3.0), the check will be fine anyway.
2014-09-05 15:57:56 +02:00
Pino Toscano
d01fbe8666 daemon: add a way to check for the version of augeas
Query augeas for its version when required, i.e. only once when using
the new augeas_is_version function.
2014-09-05 15:57:56 +02:00
Richard W.M. Jones
54e32eb8e2 v2v: -i libvirt, -i libvirtxml: Print libvirt XML when debugging. 2014-09-05 14:44:48 +01:00
Richard W.M. Jones
35d49cd9de v2v: When locating initramfs, ignore kdump initramfs images (RHBZ#1138184).
Thanks: Tingting Zheng.
2014-09-05 14:13:34 +01:00
Richard W.M. Jones
096c05a750 v2v: -i libvirt: Check the domain is not running (RHBZ#1138586).
It will print an error like this:

  virt-v2v: error: internal error: invalid argument: libvirt domain 'windows'
  is running, it must be shut down in order to perform virt-v2v conversion

This only works for libvirt domains, and is explicitly disabled for
test:/// URIs since these domains are always "running", but we use
these URIs for testing.
2014-09-05 13:44:41 +01:00
Pino Toscano
de93b9060d daemon: make aug_close cleanup available for all
Just code motion, no behaviour changes.
2014-09-05 11:30:19 +02:00
Pino Toscano
a935db30e5 v2v: R_OK is in Unix module 2014-09-05 11:30:18 +02:00
Richard W.M. Jones
922da70651 v2v: -i disk: Add a clearer error message if the disk doesn't exist or is not readable. 2014-09-05 09:54:32 +01:00
Richard W.M. Jones
d12f1ee99c v2v: -i disk: Don't fail if filename has no extension.
Unhelpfully, Filename.chop_extension throws an exception if the
filename has no extension (instead of just returning the filename).
Therefore the -i disk option would fail if you passed any filename
that didn't have an extension.
2014-09-05 09:49:39 +01:00
Richard W.M. Jones
54995514cb Update gnulib to latest. 2014-09-04 16:14:35 +01:00
Pino Toscano
0fc7cbe99b v2v: skip test-v2v-i-ova.sh if rhsrvany.exe is not installed 2014-09-04 17:09:13 +02:00
Richard W.M. Jones
03c9834cf3 Version 1.27.37. 2014-09-04 14:58:04 +01:00
Richard W.M. Jones
c3b3f68397 v2v: Add test OVF file to EXTRA_DIST.
This fixes commit 90b1e9845f.
2014-09-04 14:57:35 +01:00
Pino Toscano
ba65af3435 customize: fix locking accounts with passwords
When setting the password for a locked account, make sure to still write
the password after the "!!" marker, otherwise the account will have no
password.
2014-09-04 15:31:02 +02:00
Richard W.M. Jones
5edb78d1ae v2v: docs: Clarify how ESX & Xen imports happen through libvirt. 2014-09-04 12:55:40 +01:00
Richard W.M. Jones
f243418d23 v2v: Add support for access to remote RHEL 5 Xen hosts over ssh. 2014-09-04 12:55:35 +01:00
Richard W.M. Jones
0c295c8e23 v2v: -i libvirtxml: Detect disk format using any <driver type=...> field.
Previously we only looked for <driver name=qemu type=...>.  However
for Xen imports, the name field could be name=tap (or other values in
fact).  Since there can only be one <driver/> element under <disk/>,
look for any <driver type=...> in order to get the disk format.

A further complication for Xen is that type=aio means "raw" (for
obscure historical reasons), so map that.

Thanks: Dan Berrangé.
2014-09-04 12:39:38 +01:00
Richard W.M. Jones
27a5ef9131 v2v: Move json-generating code into separate module.
Just code motion so we can reuse the same code for making
`json:' remote SSH URLs.
2014-09-04 12:09:02 +01:00
Richard W.M. Jones
d5662fe035 -i ova: Tidy up the description in the manual page.
This updates commit 90b1e9845f.
2014-09-04 11:19:24 +01:00
Shahar Havivi
90b1e9845f v2v: adding input -i ova
Adding ability for v2v to get Vmware ova file as an input.

Signed-off-by: Shahar Havivi <shaharh@redhat.com>
2014-09-04 09:59:14 +01:00
Richard W.M. Jones
44ca9d563a launch: libvirt / p2v: Fix empty_element macro.
The empty_element macro was not safe when used in a "naked" if
statement such as:

  if (config->flags & FLAG_ACPI) empty_element ("acpi");

Fix the macro so it uses do { ... } while (0) to make it safe here.
2014-09-03 14:01:20 +01:00
Richard W.M. Jones
5791197642 v2v: Don't hard-code list of -i and -o options in help output.
We can now get it from Modules_list.
2014-09-03 12:37:40 +01:00
Richard W.M. Jones
82b7385292 v2v: Update TODO. 2014-09-03 12:37:40 +01:00
Richard W.M. Jones
941ebaa5e4 mllib: error: Clearer message about how to enable debugging. 2014-09-03 12:37:40 +01:00
Richard W.M. Jones
711c32b0d9 mllib: Wrap errors at column 76 instead of column 72.
Allows for slightly wider, better looking error messages.
2014-09-03 12:37:40 +01:00
Richard W.M. Jones
bb362f6878 OCaml virt-* tools: Handle pretty printing of exceptions through a common library function. 2014-09-03 12:37:39 +01:00
Pino Toscano
e52742e6d3 sysprep: user-account: remove the correct home
Query using augeas for the home directory of an user, instead of
hardcoding /home/<username>.
2014-09-03 11:13:54 +02:00
Richard W.M. Jones
ee5470d083 v2v: Clarify documentation for -o local. 2014-09-02 23:40:28 +01:00
Richard W.M. Jones
11b1e2862b v2v: Update TODO. 2014-09-02 22:40:13 +01:00
Richard W.M. Jones
e0506486b0 v2v: Review 3-X comments in TODO file and remove any which are not short-term goals to fix. 2014-09-02 22:05:46 +01:00
Richard W.M. Jones
03ed5a790b p2v/v2v: List output drivers in `virt-v2v --machine-readable', and use that in virt-p2v.
The new output of virt-v2v --machine-readable now lists the input and
output drivers available in the binary:

  $ virt-v2v --machine-readable
  virt-v2v
  libguestfs-rewrite
  input:disk
  input:libvirt
  input:libvirtxml
  output:glance
  output:libvirt
  output:local
  output:rhev

With this information, we can now pre-populate the virt-p2v GUI
combo box.
2014-09-02 22:03:43 +01:00
Richard W.M. Jones
03d848ab68 Version 1.27.36. 2014-09-02 17:06:45 +01:00
Richard W.M. Jones
10f6206202 p2v: Support for interface to network map.
Instead of having all interfaces connect to the "default" network on
the hypervisor target, you can now create a map of interface to target
network, either on the kernel command line, eg:

  p2v.network=em1:rhevm
  p2v.network=em1:rhevm,em2:management,other

or through the GUI.
2014-09-02 16:51:02 +01:00
Richard W.M. Jones
1ce65eeaef p2v: Print config->output_connection field in conversion debug.
This fixes commit 81d3aee071.
2014-09-02 16:51:02 +01:00
Pino Toscano
128d474095 sysprep: user-account: select which users to remove or keep
Enhance the user-account sysprep operation, so it is possible to select
which user accounts should be removed only (instead of all), or which to
eventually keep.
2014-09-02 16:35:43 +02:00
Richard W.M. Jones
c902ede1cd p2v: Use libxml2 to write the libvirt XML document instead of printfs.
Solves quoting issues.  This is just code reorganization, there is no
substantive change in the output.
2014-09-02 15:03:25 +01:00
Richard W.M. Jones
fc52f98c76 v2v: Update TODO file. 2014-09-02 15:03:14 +01:00
Richard W.M. Jones
f0e1f580b1 p2v: Add some spacing on the conversion dialog. 2014-09-02 15:03:13 +01:00
Richard W.M. Jones
750e819034 p2v: Add GUI controls for -o, -oc etc options on virt-v2v command line. 2014-09-02 15:03:13 +01:00
Richard W.M. Jones
81d3aee071 p2v: Change p2v.output -> p2v.o etc and add p2v.oc
Name these the same as the virt-v2v options, so for example
'-oa' -> 'p2v.oa'.

Also add the missing p2v.oc (-oc) option.

This updates commit c516d2d07d.
2014-09-02 15:03:13 +01:00
Richard W.M. Jones
379f335059 v2v: Give a reasonable, early failure if output format is not raw or qcow2.
See comment in the code for reasoning.

Thanks: Shahar Havivi for discovering this.
2014-09-02 15:03:13 +01:00
Pino Toscano
c004e4648d appliance: exclude a lvm2 rule on Ubuntu (RHBZ#1111662).
On Ubuntu, exclude the Ubuntu-only 85-lvm2.rules since it causes the
automatic activation of volume groups on addition or change. This
interferes with libguestfs, as vgs which are disables suddently get
enabled.
2014-09-02 12:54:20 +01:00
Richard W.M. Jones
6582231510 generator: Don't use ocamldep -all option in this directory.
ocamldep -all (introduced in commit a3881445ef) creates a dependency
rule

  optgroups.cmi ... : utils.cmx ...

Because we never build a native code version of the generator,
utils.cmx can never be remade, and so this results in optgroups.cmi
being always rebuilt and hence rebuilding the whole directory.

It's unclear how to fix this, but reverting the ocamldep -all change
in this directory works around it.

Partially reverts commit a3881445ef.
2014-09-02 09:07:59 +01:00
Richard W.M. Jones
a3881445ef Use ocamldep -all option.
In v2v, 'stringMap.ml' has no corresponding *.mli file.  ocamldep does
not generate a *.cmi dependency for such modules, and this can result
in parallel builds failing rarely because:

 (1) stringMap.ml is built (which has the side-effect of generating
     stringMap.cmi)

 (2) at the same time, types.mli is compiled.  types.mli depends on
     stringMap.cmi, but it is half way through being created by (1).

There is no dependency to serialize (1) and (2).

The resulting error is:

  File "types.mli", line 1:
  Error: Corrupted compiled interface
  stringMap.cmi

Using 'ocamldep -all' generates extra deps for the *.cmi files, and
otherwise appears to be safe, so use it.

There are currently a few upstream OCaml bugs with dependencies and
parallel builds:

http://caml.inria.fr/mantis/view.php?id=3190
http://caml.inria.fr/mantis/view.php?id=4991
http://caml.inria.fr/mantis/view.php?id=5000

It's not clear which of these apply here.
2014-09-01 22:24:14 +01:00
Richard W.M. Jones
c435053b34 Improve diagrams on various manual pages using Unicode box drawing characters. 2014-09-01 21:29:13 +01:00
Richard W.M. Jones
3c1b81d2af Version 1.27.35. 2014-09-01 17:40:56 +01:00
Richard W.M. Jones
22a556099a p2v: Add a test of virt-p2v. 2014-09-01 17:26:27 +01:00
Richard W.M. Jones
c516d2d07d p2v: Add p2v.output* controls so we can control where the output ends up.
This still needs to be implemented through the GUI.
2014-09-01 17:26:27 +01:00
Richard W.M. Jones
b16e98ba14 p2v: Fix p2v.disks (etc) parsing on kernel command line.
The parsing of p2v.disks, p2v.removable and p2v.interfaces did not
correctly end at the first space, and therefore any other parameters
that happened to be on the command line afterwards would be consumed
as a list of disks or interfaces.
2014-09-01 17:26:27 +01:00
Richard W.M. Jones
0136f50f06 p2v: Add a status message for when we detect the control connection has been closed. 2014-09-01 17:20:08 +01:00
Richard W.M. Jones
04740c5a35 p2v: Send SIGHUP (not SIGTERM) to kill child process.
One reason is that when testing the child process will be bash (not
ssh), and bash is documented to ignore SIGTERM when it is running
interactively.
2014-09-01 17:20:08 +01:00
Richard W.M. Jones
b1125a9db7 p2v: Allow -EIO error when reading pty to mean the writer has closed the connection.
This is apparently normal behaviour for ptys.
2014-09-01 17:20:08 +01:00
Richard W.M. Jones
8e5233741f v2v: Update TODO file. 2014-09-01 17:19:26 +01:00
Richard W.M. Jones
9fb2b82dbe v2v: Add some defensive code to test for the broken qcow2 overlay bug.
In commit 53e0d3ea5f I fixed a cause of
disk corruption in the overlay file during conversion.

To ensure this doesn't occur again unexpectedly, add a simple test to
the virt-v2v code and to the tests.
2014-09-01 13:06:15 +01:00
Pino Toscano
431cdfd983 fish: edit: write to the real file name
When saving, resolve the path of the file being edited and use that as
real target to write to. Otherwise, if the file name is a symlink then
it will be replaced by a regular file with the new content, leaving the
old file untouched.

Extend test-edit.sh to check for this situation.
2014-09-01 11:46:57 +02:00
Pino Toscano
ca9930ef16 test-tool: stop printing the FEBOOTSTRAP_* envvars
Stop printing the FEBOOTSTRAP_* environment variables, since they are
not used anymore.
2014-09-01 10:28:00 +02:00
Pino Toscano
356fe582b8 fish: edit: centralize the EDITOR handling
Allow null as value for the editor parameter of edit_file_editor, which
will then get it from the EDITOR envvar (falling back on vi).

This is basically code motion from the two edit_file_editor users to it.
2014-09-01 10:19:10 +02:00
Pino Toscano
b1a6488875 fish: edit: factor out download and reupload phases
Share some code between edit_file_editor and edit_file_perl; mostly code
motion, with no actual behaviour change.
2014-09-01 10:19:09 +02:00
Richard W.M. Jones
510329939b v2v: -o glance: Write potentially huge temporary images to /var/tmp by default.
Instead of /tmp.  This can be controlled by setting
$LIBGUESTFS_CACHEDIR or $TMPDIR.
2014-08-31 14:09:51 +01:00
Richard W.M. Jones
705e4bfd11 builder: Add test of the --edit option. 2014-08-31 13:37:51 +01:00
Richard W.M. Jones
1fb19fcad3 customize: perl_edit: Type of Guestfs_val() param is a Guestfs.t not the object wrapper.
This fixes commit c6b7e6cdda.
2014-08-31 13:37:42 +01:00
Richard W.M. Jones
94cffee541 -o glance: Multiple fixes.
Now tested and working on a glance server.

This fixes commit f01f641fbb.
2014-08-31 11:36:57 +01:00
Richard W.M. Jones
5c487541be Version 1.27.34. 2014-08-29 22:43:10 +01:00
Richard W.M. Jones
0d2f4c5074 v2v: Minor correction to -o glance documentation.
This fixes commit f01f641fbb.
2014-08-29 21:14:49 +01:00
Richard W.M. Jones
f01f641fbb v2v: Output to OpenStack Glance (-o glance option). 2014-08-29 21:07:30 +01:00
Richard W.M. Jones
1ce930ed27 v2v: Use copy_on_read in the overlays.
To speed up conversions by storing everything we read during
conversion in the overlay instead of having to reread it from the
remote server during copying.

Thanks: Matthew Booth.
2014-08-29 18:27:34 +01:00
Richard W.M. Jones
180e3c30de Add support for qemu copy_on_read feature.
When drives are added with this flag, reads from the backing file are
copied into the overlay, improving performance of reads to the same
area of disk (at the expense of local storage).  This is excellent for
reading remote / slow sources like HTTP.
2014-08-29 18:27:34 +01:00
Richard W.M. Jones
6a3147a5a0 v2v: esx: Add note to documentation about being asked for the password twice. 2014-08-29 16:26:45 +01:00
Richard W.M. Jones
8aea6d8fac v2v: More esx:// -> vpx:// changes.
This updates commit 155a6f0482.
2014-08-29 11:28:44 +01:00
Pino Toscano
c6b7e6cdda customize: use the common perl file editing code
Wrap edit_file_perl to OCaml, and use it instead of the OCaml version
of it.
2014-08-29 11:30:17 +02:00
Pino Toscano
57b3a35764 fish: edit: add verbose parameter 2014-08-29 11:30:16 +02:00
Pino Toscano
2d217eb00e edit: switch to common editing functions
Switch virt-edit to the common edit_file_editor and edit_file_perl.
2014-08-29 11:30:16 +02:00
Pino Toscano
b53126efb0 fish: edit: add perl file editing
Add the perl file editing, mostly based in the virt-edit implementation.

This introduces a mild code duplication with edit_file_editor; will deal
with it in a later commit.
2014-08-29 11:30:16 +02:00
Pino Toscano
f1c6d5d7f2 fish: edit: bring the fast-time-edit protection
Bring from virt-edit the small hack of putting the ctime of the
temporary file few seconds back to notice file changes also on fast
editing.
2014-08-29 11:30:16 +02:00
Pino Toscano
c9b6c8dac1 fish: edit: return 1 for unchanged file
Change the return value of edit_file_editor to 1, in case the editor did
not change the (temporary) file.
2014-08-29 11:30:16 +02:00
Pino Toscano
f79ee54722 fish: edit: bring backup extension to file editing w/ editor
Bring the backup extension feature from the perl-like file mode
implementation, although currently not making use of it.
2014-08-29 11:30:16 +02:00
Pino Toscano
511275acb1 fish: edit: improve the editor execution
Dynamically allocate the buffer for the command, and check also its exit
status.

Improvements taken from the current implementation in virt-edit.
2014-08-29 11:30:16 +02:00
Pino Toscano
7b9f0cf777 fish: isolate file editing (w/ editor) code in own file
Move the implementation of file editing using editor to an own file, so
that can be shared by different tools.

Mostly code motion.
2014-08-29 11:30:16 +02:00
Pino Toscano
582a8fcd84 cat: use the common Windows path handling code 2014-08-29 11:30:16 +02:00
Pino Toscano
73ed3171be fish, edit: move the exit-on-case-sensitive-error behaviour to virt-edit
Do not unconditionally exit if guestfs_case_sensitive_path, but let
windows_path still return null. Make virt-edit then check for that, and
eventually exit on its own.
2014-08-29 11:30:16 +02:00
Pino Toscano
de62583529 fish, edit: specifies whether mount Windows as readonly 2014-08-29 11:30:16 +02:00
Pino Toscano
7523e308fa edit: move windows path code to common file
Move the code handling Windows paths from virt-edit to a common file,
so that can be shared by various tools.

Mostly code motion, with a minimum touch (the additional guestfs_h*
parameter in mount_drive_letter) to make it build and work.
2014-08-29 11:30:16 +02:00
Richard W.M. Jones
2ab7906f7c Version 1.27.33. 2014-08-29 09:50:40 +01:00
Richard W.M. Jones
ed6173f610 v2v: Fix real conversions test by setting architecture in libvirt XML. 2014-08-29 09:41:33 +01:00
Richard W.M. Jones
591911f4bf Add suppression for memory leak in libvirt testDomainGenerateIfnames.
See: https://bugzilla.redhat.com/show_bug.cgi?id=1135388
2014-08-29 09:09:32 +01:00
Richard W.M. Jones
620d20c4bb Version 1.27.32. 2014-08-28 22:00:33 +01:00
Richard W.M. Jones
d8e04d454a v2v: Fix bugs in conversion when uninstalling VMware drivers.
- Don't uninstall open-vm-tools (the old virt-v2v didn't).

 - Do fix the library replacement code so it works the same way as
   old virt-v2v.
2014-08-28 21:49:48 +01:00
Richard W.M. Jones
155a6f0482 v2v: esx: Add / fix ability to import guests from vCenter Server.
See additional information in the manual page for details.
2014-08-28 19:26:35 +01:00
Richard W.M. Jones
3fa4fff9b4 v2v: -i libvirt: Allow map_source* functions to map the format as well as the path.
For ESX we need to map the format (which is usually unspecified) to raw.
2014-08-28 15:09:33 +01:00
Richard W.M. Jones
04121c40a1 v2v: -i libvirt: Add whitespace to make the code clearer. 2014-08-28 14:59:45 +01:00
Richard W.M. Jones
abbb636e75 v2v: Display a %-done progress bar when copying the disk image to the target.
This isn't quite the progress bar we have in mind, but it's sufficient
for now.

When --quiet is used, the progress bar is not displayed.
2014-08-27 20:40:43 +01:00
Richard W.M. Jones
e3a02c4153 sparsify: Remove obsolete comment.
We don't need to use compat=1.1 with modern qemu, and
lazy_refcounts may be dangerous.
2014-08-27 20:30:40 +01:00
Richard W.M. Jones
53e0d3ea5f v2v: Remove lazy_refcounts option.
This seems* to cause disk corruption in the overlay files.  A
manifestation of this is that the qcow2 header is not written back
correctly to disk, resulting in the backing file of the overlay
"disappearing" and hence hardly any data being copied over to the
target.

* Note this could be for a variety of reasons and doesn't necessarily
indicate a fault in qemu or qcow2.
2014-08-27 20:30:39 +01:00
Richard W.M. Jones
7aced6ffb2 v2v: -i libvirt/libvirtxml: Check that domain type, name, arch are not missing.
This can lead to incorrect output.
2014-08-27 14:43:46 +01:00
Richard W.M. Jones
e112e9a7b2 v2v: -o libvirt: Fix <features> XML in output.
It was writing each feature as PCData (ie. text), not as a separate
element, resulting in corrupt <features> output.
2014-08-27 14:36:03 +01:00
Richard W.M. Jones
4132680aea v2v: -i libvirt: Don't access remote -ic URIs during object creation.
Previously if you used `-i libvirt -ic [a remote URI]' then the remote
URI would be opened during object creation, which occurs during
command line parsing.  The practical effect was that virt-v2v could
appear to hang or give an error (eg if the remote URI is inaccessible)
before printing any log messages.  This could be very confusing for
the user.

Split out -i libvirtxml into a separate module, containing the libvirt
XML to source parsing code as a function called
Input_libvirtxml.parse_libvirt_xml.

Modify -i libvirt so it does all initialization and calls the helper
function during the #source method, and not at object creation time.
2014-08-27 12:57:41 +01:00
Richard W.M. Jones
f54aff9e9f v2v: utils: Permit more safe/unquoted characters in url_quote function. 2014-08-26 22:57:18 +01:00
Richard W.M. Jones
a18629ce40 v2v: utils: Don't need to use module name (Common_utils.) here. 2014-08-26 22:54:45 +01:00
Richard W.M. Jones
715020e264 v2v: Remove bogus %systemroot%\Drivers path.
This was based an incorrect translation of what the old virt-v2v was
doing.  %systemroot%\Drivers is not expected to exist already, and
indeed does not exist in a real Windows 7 guest.
2014-08-26 22:54:45 +01:00
Richard W.M. Jones
f527c22b00 v2v: Implement binding for `virsh pool-dumpxml'.
Add a mini-binding to libvirt virStoragePoolGetXMLDesc to get the pool
XML directly using the libvirt API.  Change existing external calls to
`virsh pool-dumpxml' to use this API instead.
2014-08-26 17:49:24 +01:00
Richard W.M. Jones
8dc45325a6 v2v: Work around buggy `virsh dumpxml'.
The `virsh dumpxml' command doesn't work properly when the libvirt
source requires authentication.  This is because the authentication
prompts are sent to stdout, but stdout is also the place where we are
reading the output XML from.

Add a mini-binding to libvirt virDomainGetXMLDesc which avoids this,
getting the XML directly using the libvirt API.  Change existing
external calls to `virsh dumpxml' to use this API instead.
2014-08-26 17:49:23 +01:00
Richard W.M. Jones
53999bddf4 v2v: -o libvirt: Mistakenly we were calling virsh dumpxml' instead of virsh pool-dumpxml'. 2014-08-26 17:49:23 +01:00
Pino Toscano
c916ea5b68 daemon: lvm-filter: use augeas for setting the filter
The way to set the filter for lvm devices was to open lvm.conf, look
for uncommented "filter =" lines and replace the configuration there.
This had the issue that if there is no uncommented filter line, then the
filter cannot be changed at all; considering newer lvm2 releases ship a
sample configuration with no uncommented filter lines, then the old way
became wrong and not sufficient.

Instead, take a copy of the upstream lvm.aug lens, with a simple change
to allow parsing also negative values in configuration, and install it
in the daemon. When asking to change the lvm filter, use augeas making
sure to use this custom lens for the lvm.conf copy used within the
appliance.
2014-08-26 17:44:31 +02:00
Pino Toscano
abb0b47e3f daemon: move AUGEAS_ERROR to the common header
Other than for current aug_* API, it will be useful for further code
using augeas directly.
2014-08-26 17:44:31 +02:00
Pino Toscano
9b501fa5c6 daemon: add add_sprintf
Bring the add_sprintf function for stringsbuf from the library.
2014-08-26 17:44:31 +02:00
Shahar Havivi
b56b90bf6e v2v: add xmlXPathRegisterNs for libxml2 binding
Signed-off-by: Shahar Havivi <shaharh@redhat.com>
2014-08-26 16:04:48 +01:00
Richard W.M. Jones
3f315f54e8 Enable warnings in C code linked to virt-sparsify and virt-v2v.
The C code didn't have -Werror enabled (when configured) and didn't
enable the full set of warnings we would want.

However OCaml-C bindings commonly declare functions which are
called directly from OCaml, eg:

  external parse_memory : string -> doc = "v2v_xml_parse_memory"

  value v2v_xml_parse_memory (value xmlv)

These do not require prototypes as no other C code will call them, so
we have to switch off the GCC -Werror=missing-prototypes flag for
these files.

Also fixes some confusion between _CPPFLAGS and _CFLAGS.
2014-08-26 16:02:27 +01:00
Richard W.M. Jones
880bf5f2ef v2v: -i libvirtxml: Add example libvirt XML. 2014-08-26 15:45:11 +01:00
Richard W.M. Jones
8e7cf61a40 v2v: -o local: Use /var/tmp instead of /tmp for examples.
In case people are suffering from broken tmp-on-tmpfs setups.
2014-08-26 15:43:52 +01:00
Richard W.M. Jones
97f634e5fb v2v: Split Types.overlay into Types.target and Types.overlay structures.
Move the fields from Types.overlay which were related to the target
file out.  Now Types.overlay is only concerned with the actual qcow2
overlay files, not with a mixture of both files.

For every guest disk, there is one chain which looks like this:

   source_disk         overlay                 target
  +------------+      +----------------+      +---------------+
  | s_qemu_uri |<------ ov_source      |<------ target_overlay|
  | etc        |      | ov_overlay_file|      | target_file   |
  +------------+      | ov_sd          |      | target_format |
                      | ov_virtual_size|      +---------------+
                      +----------------+

   describes source    describes temp.         describes target
   disk file           overlay (qcow2)         file

This is just refactoring.
2014-08-26 08:48:52 +01:00
Richard W.M. Jones
29b8fb6c15 v2v: types.mli: Fix typo in comment. 2014-08-25 21:42:15 +01:00
Richard W.M. Jones
4d30b82ea3 v2v: Change "Trimming the filesystems" message to something less scary.
Avoid copying unused and blank areas.  Avoid alarm and support calls too.
2014-08-25 21:36:28 +01:00
Richard W.M. Jones
93943a0f77 v2v: Simplify conversion dispatch code.
Refactoring, no functional change.
2014-08-25 21:31:05 +01:00
Richard W.M. Jones
0f2b503394 v2v: Update TODO. 2014-08-25 20:35:55 +01:00
Richard W.M. Jones
862a27c92d v2v: Inline the initialize_target function.
This function had got smaller and smaller until now we might as well
just inline it.  Having it after the main function just obscured the
order that the code runs.

No functional change, just refactoring.
2014-08-25 20:31:27 +01:00
Richard W.M. Jones
5800d96e7a v2v: Remove the Types.overlay ov_source_format field.
Not used by anything and unlikely to be useful.
2014-08-25 20:27:44 +01:00
Richard W.M. Jones
938fe047d0 v2v: Remove Types.overlay ov_preallocation field.
The ov_preallocation field was essentially an implementation detail of
the V2v module.  There was no need to carry it around in the overlay
struct, and nothing else used it.  This also allows us to simplify
other code.
2014-08-25 20:22:19 +01:00
Richard W.M. Jones
4c492e21ac v2v: Add comments to DOM module. 2014-08-25 20:15:53 +01:00
Richard W.M. Jones
613ae49319 v2v: -o rhev: Move inspection functions.
This is pure refactoring, no functional change.
2014-08-25 20:08:56 +01:00
Richard W.M. Jones
86a1f55810 v2v: Trivial fix to documentation in internal interface to libxml2. 2014-08-25 15:45:38 +01:00
Richard W.M. Jones
ce59aa8c84 Version 1.27.31. 2014-08-24 21:21:10 +01:00
Richard W.M. Jones
066eb69625 v2v: int64 -> int fix for previous commit.
This fixes commit 318a1b17a6
(thanks Pino Toscano).
2014-08-22 09:47:09 +01:00
Richard W.M. Jones
318a1b17a6 v2v: -i libvirt: Select sensible defaults if <memory> or <vcpu> is missing from input XML.
If the <memory> or <vcpu> elements was missing from the source
metadata then we would choose useless defaults, resulting in (for
example) <vcpu>0</vcpu> being written to the output.

Choose sensible defaults for these integer values.
2014-08-21 23:38:34 +01:00
Richard W.M. Jones
78f725ffd5 v2v: Store original vnet, and add comment to output metadata when mapping it.
When we map the network or bridge names (using --network or --bridge
command line options), this commit keeps the original name and adds it
as a comment to the output metadata.

The comment will look something like this:

    <interface type='bridge'>
      <!-- bridge mapped from "VM Network" to "bridge1" -->
      <source bridge='bridge1'/>
      <model type='rtl8139'/>
    </interface>
2014-08-21 23:28:15 +01:00
Richard W.M. Jones
d629b5252b v2v: DOM: Add XML comments (<!-- .. -->) to the model.
This allows us to insert comments into the output libvirt XML or OVF.
2014-08-21 23:24:39 +01:00
Richard W.M. Jones
6e1e9604b6 v2v: Add a test of --network and --bridge command line options.
This enhances commit aaf84abca9.
2014-08-21 23:08:18 +01:00
Richard W.M. Jones
02b653496d v2v: -o rhev: Improve the error message when you pass a bogus -os parameter. 2014-08-21 22:37:05 +01:00
Richard W.M. Jones
9fa27d4f79 v2v: -o libvirt: <source file=...> must always be an absolute path. 2014-08-21 22:24:34 +01:00
Richard W.M. Jones
53e788890d v2v: DOM: Produce pretty-printed XML. 2014-08-21 22:22:24 +01:00
Richard W.M. Jones
1e1605d937 mllib: Export output_spaces function.
This was already in Common_utils, but was only used internally
not exported.
2014-08-21 22:22:24 +01:00
Richard W.M. Jones
b9e591f7f0 v2v: Tests can use guests.xml not guests-all-good.xml. 2014-08-21 21:46:45 +01:00
Richard W.M. Jones
350e3285f3 v2v: Update documentation for input & output classes. 2014-08-21 21:26:19 +01:00
Richard W.M. Jones
f71d62fa78 Version 1.27.30. 2014-08-21 19:38:27 +01:00
Richard W.M. Jones
4389702e5c v2v: Remove build path which inadvertently appeared in test data. 2014-08-21 19:28:41 +01:00
Richard W.M. Jones
1e1ceb5273 Version 1.27.29. 2014-08-21 17:08:35 +01:00
Richard W.M. Jones
1d0ef02b36 v2v: Fix check-valgrind on --print-source option.
This updates commit 3a6dc32342.
2014-08-21 17:06:53 +01:00
Richard W.M. Jones
f5fda273b1 v2v: Remove ov_vol_uuid hack.
Now that we're using classes for outputs, we can hide the RHEV volume
UUIDs in the output_rhev class.
2014-08-21 15:00:53 +01:00
Richard W.M. Jones
3903f97cb3 v2v: Replace strings with variants for extra type safety.
No functional change.
2014-08-21 14:49:43 +01:00
Richard W.M. Jones
c3dda31492 v2v: Pass verbose flag into every input and output subclass. 2014-08-21 13:37:41 +01:00
Richard W.M. Jones
d1c8240b76 v2v: Print log message when opening the source. 2014-08-21 13:37:41 +01:00
Richard W.M. Jones
ca05d757b0 v2v: Change input and output variants into classes.
Previously Types.input and Types.output were variants, resulting in
the main v2v.ml code having to have knowledge of all the input and
output types.  So you would end up with code in v2v.ml like:

  match output with
  | OutputLibvirt -> (* call some libvirt-specific code *)
  | OutputRHEV -> (* call some RHEV-specific code *)

This changes these types to be abstract superclasses, with specific
implementations provided by (and hidden inside) each input/output
module.  The above code in v2v.ml now becomes:

  output#call ... (* no backend-specific knowledge needed *)

Although this commit is very large, it is just refactoring.  There is
no functional change in the code.
2014-08-21 13:37:41 +01:00
Pino Toscano
c7e56a5306 appliance: add glibc-locale on OpenSUSE
Provides the gconv modules, needed for iconv to work.
2014-08-21 13:20:25 +02:00
Richard W.M. Jones
640109e1e5 v2v: Reorder sections in the manual more logically. 2014-08-21 11:02:37 +01:00
Richard W.M. Jones
3a6dc32342 v2v: Add --print-source option. 2014-08-21 11:02:15 +01:00
Richard W.M. Jones
aaf84abca9 v2v: Add --network and --bridge options to perform network name mapping. 2014-08-21 10:21:01 +01:00
Richard W.M. Jones
e787c7f213 v2v: Let source.s_name be the renamed guest name (in case we use -on option).
The original guest name is saved in s_orig_name, although I checked
all uses of s_name and nothing needs it at the moment.
2014-08-21 09:12:04 +01:00
Richard W.M. Jones
cf714fc08d v2v: Update TODO. 2014-08-20 22:24:12 +01:00
Richard W.M. Jones
ccb47f93ff v2v: Add support for remote ESX connections.
This allows `-ic esx://...' to work because we map the strange source
URI used by ESX to a remote HTTPS connection.

Example disk section that this handles:

    <disk type='file' device='disk'>
      <source file='[datastore1] Windows/Windows.vmdk'/>
      <target dev='sda' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
2014-08-20 22:24:11 +01:00
Richard W.M. Jones
0539c2044c v2v: VMware returns MAC all zeroes. Map this to None. 2014-08-20 22:24:11 +01:00
Richard W.M. Jones
bc037d9ded v2v: source_libvirt: Replace create_xml ?dir parameter hack.
Instead of the ?dir parameter which was essentially a hack, allow
callers of create_xml to provide functions that map
<source file="..."> or <source dev="..."> to qemu URIs.

The default for these mappings is the identity function.

For -i libvirtxml we replace the old absolute_path_of_disk function
with a source file mapping function which does the same thing.

There is no functional change in this patch.
2014-08-20 22:24:11 +01:00
Richard W.M. Jones
2fc9fdda98 v2v: Don't attempt to make block device paths absolute.
<source dev=...> in the libvirt XML should always refer to a block
device, eg. /dev/sda1.  Don't attempt to make these paths absolute
(they should already be absolute paths, and if they are not it's wrong
to try to make them).
2014-08-20 22:24:11 +01:00
Richard W.M. Jones
7800150d06 v2v: Add binding for libxml2 xmlParseURI.
There is already a partial binding for this in fish/uri.c &
mllib/uri-c.c.  However it is specialized to parsing the -a parameter
on the command line and we want access to the full underlying
functionality of xmlParseURI.
2014-08-20 22:24:11 +01:00
Pino Toscano
c5c3a23294 appliance: add mkisofs on OpenSUSE
Needed for isoinfo.
2014-08-20 18:56:39 +02:00
Pino Toscano
3ceff73915 appliance: add cdrkit-isotools and mtools for Mageia
- cdrkit-isotools provides isoinfo, used by the daemon
- mtools is used by syslinux without being a dependency
2014-08-20 18:51:39 +02:00
Richard W.M. Jones
b6ba844992 v2v: Add some examples to the manual page. 2014-08-19 22:24:45 +01:00
Richard W.M. Jones
bcce760166 Version 1.27.28. 2014-08-19 19:46:24 +01:00
Richard W.M. Jones
3d1cb74b3e v2v: Add display, removable disks, and network interfaces.
These are now collected from the source metadata and (where
possible) passed through to the destination.

For reference, see the metadata structure of the old virt-v2v (roughly
equivalent to Types.source in the new code):

https://git.fedorahosted.org/cgit/virt-v2v.git/tree/metadata-format.txt

As you can see the new code now covers all the metadata features of
the old code.
2014-08-19 16:51:13 +01:00
Richard W.M. Jones
df471095ef v2v: Update TODO file. 2014-08-19 16:51:13 +01:00
Richard W.M. Jones
8b3b7cc0da daemon: Fix echo-daemon so it doesn't fail on empty array input. 2014-08-19 16:51:13 +01:00
Pino Toscano
0ed91a7399 appliance: initial packagelist for OpenSUSE
Mostly complete and making most of the features work.

The notable lack is ntfsprogs and ntfs-3g, which due to the way
mount.ntfs is handled (i.e. using alternatives) do not work properly.
2014-08-19 17:11:05 +02:00
Pino Toscano
4a4256b807 tests: make the scratch disk used for scratch much larger
50M can be not enough when uploading various copies of unstripped
static binaries from the system, which can fill up such a small disk.
2014-08-19 17:11:05 +02:00
Pino Toscano
6b2bf2c7ac builder: do not use xz --block-size for the test images
Do not use the --block-size parameter of xz when compressing the test
images, as that option does not exist in xz < 5.1.
2014-08-19 14:22:07 +02:00
Richard W.M. Jones
0fd95e2b9f drives: Add comments about fragile string handling.
GC FTW.
2014-08-19 12:11:06 +01:00
Pino Toscano
b53286a643 drives: fix deletion of servers on error
Make sure to not skip any of the created server, and to always free
the "server" array.
2014-08-19 12:03:56 +01:00
Pino Toscano
06aa1bff0f daemon: zfile: call pclose instead of fclose
fp was opened with popen, so close it properly.
2014-08-18 11:18:23 +02:00
Richard W.M. Jones
54887a3eea v2v: Update instructions for uploading a volume.
The previous instructions didn't include the need to change
<disk type='file' ...> to  <disk type='volume' ...>
2014-08-15 20:02:50 +01:00
Richard W.M. Jones
1866fc47a2 v2v: Add some more man pages that may be relevant to "SEE ALSO" section. 2014-08-15 19:58:10 +01:00
Richard W.M. Jones
c5b0e59dcc v2v: Fix formatting of --vmtype option in the man page. 2014-08-15 19:57:52 +01:00
Richard W.M. Jones
0327036b2f v2v: Fix typo in manual page.
This fixes commit 7c7caae7c1.
2014-08-15 19:51:09 +01:00
Richard W.M. Jones
25b33344b9 v2v: Make -i local be an alias for -i disk.
Analogous to -o local.
2014-08-15 19:50:43 +01:00
Richard W.M. Jones
7c7caae7c1 v2v: Add new -i disk to allow direct import of disk images with no metadata.
This is simpler to use and more convenient than -i libvirtxml, because
users don't need to bother with writing libvirt XML.  However it is
less expressive because many source capabilities such as memory and
number of vCPUs cannot be specified this way.
2014-08-15 18:39:46 +01:00
Richard W.M. Jones
eaadf5c130 v2v: Rename -o (target) tests.
No functional change.
2014-08-15 18:39:46 +01:00
Richard W.M. Jones
cca6f25de9 Version 1.27.27. 2014-08-15 16:39:14 +01:00
Richard W.M. Jones
a5e2485426 website: Add virt-p2v(1) and guestfs-p2v-iso(1) to the website. 2014-08-15 16:38:48 +01:00
Pino Toscano
787c42d6eb tests/syslinux: add /usr/lib/syslinux/bios as directory for mbr.bin
On Archlinux that is the location of mbr.bin.
2014-08-15 16:24:09 +01:00
Pino Toscano
df88e30ff1 appliance: add mtools to Archlinux' packagelist
It is an optional dependency but syslinux uses it, so pull it always in
the appliance.
2014-08-15 16:24:09 +01:00
Richard W.M. Jones
3243da393b v2v: Add a test of -o libvirt target. 2014-08-15 15:04:11 +01:00
Richard W.M. Jones
e2fcc2304c v2v: Add -o libvirt target (creates guest directly in libvirt). 2014-08-15 15:02:06 +01:00
Richard W.M. Jones
8ba605cad0 v2v: Display message when intializing the target.
As initializing the target (-o ...) is a distinct operation, which can
fail if the user supplied the wrong command line arguments, make sure
we display an explicit message before we perform this step.

It prints something like this:

  [   5.0] Initializing the target -o libvirt -os default
2014-08-15 14:37:19 +01:00
Richard W.M. Jones
e95a1c75d8 v2v: Move libvirt XML generation into common module, and use DOM module.
Since `-o local' and `-o libvirt' both need to generate libvirt XML
they should share the same code to generate it.

Also generate it using the DOM module instead of printing the XML
directly.  This is cleaner and avoids quoting issues.

No functional change here.
2014-08-15 10:08:29 +01:00
Richard W.M. Jones
7ab495b458 v2v: When outputting XML, write "<element/>" for nodes with no children. 2014-08-15 10:07:27 +01:00
Richard W.M. Jones
5e872dbd2e v2v: Pass acpi, apic, pae features through to libvirt XML output.
Notes:

 - Drop the acpi feature for RHEL 3.  Old virt-v2v says there is
   a problem presenting ACPI to RHEL 3 guests although it is not
   specific about what this is.

 - Old virt-v2v does not pass features through to OVF at all.
2014-08-15 08:53:22 +01:00
Richard W.M. Jones
991c4e36dd p2v: Find ACPI, APIC and PAE flags and add them to target libvirt XML. 2014-08-15 08:53:22 +01:00
Richard W.M. Jones
9fa9d39d71 utils: Add new CLEANUP_PCLOSE cleanup. It calls pclose(3). 2014-08-15 08:53:22 +01:00
Richard W.M. Jones
93c7842367 p2v: Rewrite /proc/cmdline reading code to use getline. 2014-08-15 08:53:22 +01:00
Richard W.M. Jones
483b4b7bbd v2v: Update TODO. 2014-08-15 08:53:21 +01:00
Pino Toscano
ddfe82e823 configure: look for "java-default-runtime" as directory for Java
This seems to be the new way [1] in Archlinux to specify, as symlink,
the default version of Java.

Thanks to Peter Wu for the notice about it.

[1] https://wiki.archlinux.org/index.php/Java
2014-08-14 19:06:20 +02:00
Pino Toscano
1d9388b800 configure: add java-8-openjdk and java-7-openjdk as locations for java
This helps some distros (e.g. Archlinux) where openjdk is installed in
java-MAJOR-openjdk directories, without any "default version" symlink.
2014-08-14 18:40:52 +02:00
Richard W.M. Jones
9609521734 launch: direct: Only issue Debian /dev/kvm group warning if /dev/kvm wasn't openable (RHBZ#1130189).
This warning was meant for the case where /dev/kvm is inaccessible and
the user must add themselves to a special group.

However we didn't take into account whether /dev/kvm was openable in
this test.  If it's openable, no point issuing the warning.

Move the is_openable ("/dev/kvm") test earlier, and don't issue the
warning if that was successful.
2014-08-14 15:16:06 +01:00
Pino Toscano
c211763860 appliance: add libc-bin to Debian's packagelist
It provides libc binaries like ldconfig and its configuration.
2014-08-14 14:00:35 +02:00
Pino Toscano
d9a4c481c9 appliance: update distros in comments
Update the list of recognized names of distributions in the comments.

No functional changes.
2014-08-14 13:46:18 +02:00
Richard W.M. Jones
6f045f8401 v2v: Skip virt-v2v tests if rhsrvany.exe is not installed. 2014-08-14 10:02:33 +01:00
Richard W.M. Jones
6ae0e9641b Version 1.27.26. 2014-08-13 22:32:06 +01:00
Richard W.M. Jones
8a23c1d79e lib: Missing include of <locale.h>.
Required by setlocale.  For some reason you only see the error
when compiling with -O0.
2014-08-13 22:23:04 +01:00
Richard W.M. Jones
d1e56118dd Add a separate TODO file for virt-v2v and virt-p2v. 2014-08-13 22:10:31 +01:00
Richard W.M. Jones
ef10da8b3a v2v: Add tests.
The virt-v2v tests here are not meant to be thorough tests of guest
conversion.  There is a test suite used to test conversion which is
kept outside libguestfs because it contains lots of proprietary
unredistributable guests like Windows.

The tests here instead are testing:

- virt-v2v command line arguments
- virt-v2v reads and writes files to the correct places
- valgrind & memory leaks
- any conversion properties that can be tested using just the
  phony guests (but we don't go out of our way here)
- that up to date guests don't crash virt-v2v
2014-08-13 22:10:31 +01:00
Richard W.M. Jones
7beb9f2cb5 tests/guests: Add Windows/Drivers directory to phony Windows guest.
Allows virt-v2v to complete.
2014-08-13 22:10:31 +01:00
Richard W.M. Jones
5b6a2e68b8 tests/guests: Fix RPM database in phony Fedora guest.
Fix the Name and Packages database so it looks enough like a modern
RPM database to fool inspection.  I'm not sure whether or not the old
version ever worked, but it doesn't work now.

The format is not documented, but in brief:

The Name database contains (Name, link) pairs.  The link is an
arbitrary 32 bit integer.

The Packages database contains (link, RPM-blob) pairs.

The RPM-blob is a binary blob formatted like this:

 * Number of fields               4 bytes, big endian
 * Size in bytes of the store     4 bytes, big endian
 * Field descriptions:
     list of (RPMTAG, 0, offset in store, 0)
                                  4 * 4 * nr_fields bytes, big endian
 * The store                      binary data containing ASCIIZ strings

For the values of RPMTAG_* that we understand, see src/inspect-apps.c.
2014-08-13 22:10:31 +01:00
Richard W.M. Jones
f0b71818a6 v2v: Add fedora to "RHEL family".
The calling code allows Fedora guests to be used when calling
Convert_linux.  However Convert_linux itself would fail with an
assertion error when you did this.
2014-08-13 22:10:30 +01:00
Richard W.M. Jones
b743fe2c3e tests/guests: Define the disk format of our test guests in the test XML. 2014-08-13 22:10:30 +01:00
Richard W.M. Jones
89417216b9 v2v: Fix libvirt source to parse the format of a disk properly.
Missing '@' means it wasn't looking for the attribute.
2014-08-13 22:10:30 +01:00
Richard W.M. Jones
cec3b42ad6 v2v: Add --no-copy option.
This option allows callers to generate the metadata without copying
the disks.
2014-08-13 22:10:30 +01:00
Richard W.M. Jones
bfcda1ba6a v2v: Nothing uses ov_target_file_tmp, remove this.
Previous virt-v2v would write to a temporary destination file then
atomically rename everything at the end.

However this appears to be unnecessary since we write the OVF file
after copying the disks, so (I assume) RHEV-M won't see the disks
before then.

In any case nothing used ov_target_file_tmp so we can remove this
feature to simplify the code.
2014-08-13 22:10:30 +01:00
Richard W.M. Jones
295086e934 v2v: Allow RHEV UUIDs to be specified on the command line.
Currently various UUIDs used by `-o rhev' are generated randomly.
This means they are different on every run of the program.

Allow some of them to be specified on the command line.  (If not
specified they are still generated randomly).

This allows RHEV-M to run virt-v2v several times (eg to examine the
OVF output) while having paths to files and OVF be stable across runs.
2014-08-13 22:10:30 +01:00
Richard W.M. Jones
ba63916960 v2v: Combine miscellaneous RHEV command line options into a single structure.
At the moment there is just one "miscellaneous RHEV command line
option" (--vmtype), but we may add more in future.  Put them in a
single struct for convenience.

This is just code motion.
2014-08-13 22:10:30 +01:00
Richard W.M. Jones
83c314d5c0 v2v: -o rhev: Fix error message. 2014-08-13 22:10:30 +01:00
Richard W.M. Jones
3f53dc4680 v2v: -o ovirt' is an alias for -o rhev', document it. 2014-08-13 22:10:30 +01:00
Richard W.M. Jones
0a816c020c v2v: Don't disable trace/debug set by environment variables.
If the environment variables LIBGUESTFS_TRACE=1 or LIBGUESTFS_DEBUG=1
were set, then the current code would end up disabling trace/debug if
the command line arguments did not contain -x/-v.

Fix this so the effect of enabling trace/debug is cumulative.
2014-08-13 22:10:29 +01:00
Richard W.M. Jones
5d89c0fd14 p2v: Clean up and fix the code for excluding the root device. 2014-08-13 22:10:29 +01:00
Richard W.M. Jones
67da00d540 p2v: Call the remote libvirt XML file 'guest.xml'.
Previously it was called 'libvirt.conf' which is more than a little
bit confusing.

This is only an internal name, so there is no visible change in
functionality.
2014-08-13 22:10:29 +01:00
Pino Toscano
40fbd447ee build: manually drop flex-/bison-generated files from dist
It seems that Automake cannot handle properly the files generated by
flex and bison, leaving them in the dist tarball.

For now, add a dist-hook to manually prune them from distdir.
2014-08-13 16:43:19 +02:00
Pino Toscano
577ec51a4c fish: add test-invalid-params.sh to EXTRA_DIST
Followup of commit 7912759fc3.
2014-08-13 15:16:55 +02:00
Richard W.M. Jones
6a51ae503c builder: Missing include of <locale.h>.
Required by setlocale.  For some reason you only see the error
when compiling with -O0.
2014-08-13 13:52:48 +01:00
Richard W.M. Jones
34feb37879 lib: Typo in comment. 2014-08-13 13:52:48 +01:00
Pino Toscano
841b20c39c python: fix possible free on uninit memory with OStringList optargs
When using optional arguments of type OStringList, the code free'ing
the member in the optargs_s struct corresponding to that optional
argument would just check for a non-PyNone PyObject for that argument.
If before that optional argument there are other arguments which can
cause an earlier error return from that binding function, the free'ing
code will then act on garbage values.

Enhance the check by also checking whether the optargs struct has the
bitmask with the element for that argument, meaning that the
corresponding struct member was initialized.
2014-08-12 10:16:18 +02:00
Pino Toscano
abbbc832d5 p2v: check results of strndup and sscanf 2014-08-11 17:36:51 +02:00
Richard W.M. Jones
bbae6136ab p2v: Move libutils before libxml2 in the list of libraries (RHBZ#1102447).
The error is:

../src/.libs/libutils.a(
libutils_la-cleanup.o): In function `guestfs___cleanup_xmlBufferFree':
cleanup.c:(.text+0x79): undefined reference to `xmlBufferFree'
../src/.libs/libutils.a(libutils_la-cleanup.o): In function
`guestfs___cleanup_xmlFreeDoc':
cleanup.c:(.text+0x99): undefined reference to `xmlFreeDoc'
[etc.]

Thanks: Arnaud Gaboury
2014-08-11 14:53:19 +01:00
Pino Toscano
a26a9e6881 df: unlock retire_mutex on early exit
If pthread_cond_wait fails and the thread worker ends, make sure to
unlock retire_mutex, which has been locked for the condition.

The return value of pthread_mutex_unlock is ignored, as there's nothing
that can be done with it at that point.
2014-08-08 17:13:02 +02:00
Pino Toscano
bb12455215 daemon: use CLEANUP_CLOSE 2014-08-08 15:35:02 +02:00
Pino Toscano
4249ddd8bb daemon: add CLEANUP_CLOSE
Just call close on the specified fd, if valid.
2014-08-08 15:34:07 +02:00
Pino Toscano
ad4ba5997b daemon: blkid: fix memory issues in "no -p/-i" mode
Fix the memory issues in the implementation that uses no -p nor -i:
- use add_string_nodup to add results from get_blkid_tag (which returns
  new strings), so those strings are not leaked
- use free_stringslen to clean the hash on error, as in such case the
  stringbuf will not be terminated with a null entry, thus causing
  free_strings to crash
2014-08-08 14:58:08 +02:00
Pino Toscano
fef0881b3a tests: c-api: do not crash w/ missing hash entry
If an hash does not have the requested key, just error out cleanly
instead of crashing when trying to compare a null string.
2014-08-08 14:56:27 +02:00
Pino Toscano
8d23fb31f1 daemon: initialize memory when handling DeviceList params
When dealing with DeviceList parameters, the generator produces code
similar to the following:

  CLEANUP_FREE_STRING_LIST char **devices = NULL;
  [...]
  devices = malloc (sizeof (char *) * (args.devices.devices_len+1));
  {
    size_t i;
    for (i = 0; i < args.devices.devices_len; ++i)
      RESOLVE_DEVICE (args.devices.devices_val[i], devices[i],
                      , goto done);
    devices[i] = NULL;
  }

The block hidden within the RESOLVE_DEVICE macro is supposed to
assign something to devices[i]; on the other hand, the code in
RESOLVE_DEVICE can cause to just end (with an error) the current RPC,
which would cause the cleanup of the "devices" array... whose members
from the i-th to the (args.devices.devices_len-1)-th would be garbage
pointers, causing random memory to be free'd (and thus crashing the
daemon).

Avoid the access to garbage memory just by having a cleaned "devices"
array, so there will be always a NULL element after the initialized
members.

Add a test for vgcreate which passes a wrong device path causing the
situation above, to test that vgcreate would fail gracefully.
2014-08-08 13:49:59 +02:00
Pino Toscano
d1f580550b rescue: fix sscanf placeholders for --smp and --memsize
Use %d to parse them as int (since the variables for them as int)
instead of %u, even if they both need to be at least > 0; the library
will check for the validity of them anyway.
2014-08-08 11:20:19 +02:00
Pino Toscano
7912759fc3 src: always check value passed to set_memsize
Move the minimum memory check from the environment parsing to
set_memsize, so the limit is actually enforced also when using the API.

Adapt the rhbz557655.sh test to the invalid memsize values being
rejected now, and add a new test for checking invalid parameters
explicitly.
2014-08-08 11:20:12 +02:00
Pino Toscano
5fddd93205 lua: always return luaL_error in actions
Even if luaL_error is a "no return" function for the Lua runtime, adopt
also in action functions the "return" idiom recommeded for it.

This also helps code analyzers in not thinking that "g" might still be
null after the null check followed by luaL_error.
2014-08-08 09:48:36 +02:00
Richard W.M. Jones
5ce1234007 aarch64: Add common function for getting the CPU model.
And force a 64 bit CPU model when running on aarch64 with TCG.
2014-08-07 14:54:52 +01:00
Pino Toscano
f5c74637e3 daemon: add and use a reply_with_unavailable_feature macro
Handy macro to reply the right way for an unavailable feature.
While generally used so far in generated code, it can shorten that a
bit, and avoid copy&paste when wanting to do manual feature checking.
2014-08-07 10:45:04 +02:00
Richard W.M. Jones
59584e1814 Version 1.27.25. 2014-08-05 18:06:22 +01:00
Richard W.M. Jones
40cecb4b9c v2v: Add RHEV target.
Use:

  virt-v2v [..] -o rhev -os nfs:/export

or:

  virt-v2v [..] -o rhev -os /mountpoint

to write to a RHEV-M / oVirt Export Storage Domain.
2014-08-05 16:46:55 +01:00
Richard W.M. Jones
95c3b78f08 v2v: Keep more inspection data in the inspect struct.
Just code motion, no functional change.
2014-08-05 10:07:54 +01:00
Richard W.M. Jones
e82c0c5e55 v2v: Fix bytecode build. 2014-08-04 17:20:03 +01:00
Richard W.M. Jones
b6cb67d958 ./run: chcon the tmp directory in the builddir.
Not just some random tmp directory which happens to be in the
local directory.
2014-08-04 14:51:30 +01:00
Richard W.M. Jones
e1c508c29f launch: Close file descriptors after fork (RHBZ#1123007).
This refactors existing code to close file descriptors in the recovery
process, and also adds code to close file descriptors between the
fork() and exec() of QEMU or User-Mode Linux.

The reason is to avoid leaking main process file descriptors where the
main process (or other libraries in the main process) are not setting
O_CLOEXEC at all or not setting it atomically.  Python is a particular
culprit.

See also this OpenStack Nova bug report:
https://bugs.launchpad.net/nova/+bug/1313477

Thanks: Qin Zhao for identifying and characterizing the problem in Nova.

This is version 2 of this commit.  This commit is identical to the
reverted commit 115fcc3432 except that
we don't close stderr.
2014-07-30 14:24:46 +01:00
Richard W.M. Jones
e0ba7855f4 html: Don't build HTMLFILES for disabled features. 2014-07-30 14:19:30 +01:00
Richard W.M. Jones
286f116691 Revert "launch: Close file descriptors after fork (RHBZ#1123007)."
This attempted fix for RHBZ#1123007 causes the qemu command line to be
lost when verbose mode is enabled.  Since this is essential for
debugging many problems, I am reverting the patch.

This reverts commit 115fcc3432.
2014-07-29 22:27:29 +01:00
Richard W.M. Jones
1d596eb7e6 tests: qemu-speed-test: Allow test time to be adjusted with -t option.
This is useful when analysing with `perf' since it allows us to
increase the amount of time in the test versus the amount of time
spent starting the appliance.
2014-07-29 20:27:53 +01:00
Richard W.M. Jones
1c7da06327 tests: qemu-speed-test: Allow tests to be run selectively. 2014-07-29 12:36:43 +01:00
Richard W.M. Jones
f342cfc69d tests: qemu-boot: Error if extra command line arguments are given. 2014-07-29 12:36:43 +01:00
Pino Toscano
043cf4fbe3 launch: direct: check for null paths in make_uri
Some protocols may pass a null path to make_uri, so make sure to handle
that gracefully.
2014-07-28 19:29:14 +02:00
Pino Toscano
8ea6b3e03c make-fs: do not leak the fd from mkstemp 2014-07-28 17:27:30 +02:00
Pino Toscano
2fe93bda9f make-fs: respect libguestfs' temporary dir
Do not hardcode /tmp.
2014-07-28 17:24:02 +02:00
Richard W.M. Jones
50e3ef3357 Version 1.27.24. 2014-07-26 21:37:59 +01:00
Richard W.M. Jones
1b925a0efb build: Add `maintainer-commit' rule to create a new version commit. 2014-07-26 21:27:16 +01:00
Pino Toscano
08bfd9e41b p2v: close the mexp handle if mexp_spawnv fails 2014-07-26 18:24:52 +01:00
Pino Toscano
9c3ce6535c make-fs: use CLEANUP_FCLOSE 2014-07-26 18:24:52 +01:00
Pino Toscano
9e7f5300c9 cleanups: add CLEANUP_FCLOSE (fclose on FILE*) 2014-07-26 18:24:52 +01:00
Pino Toscano
d8b9ce65c2 p2v: properly call va_end 2014-07-26 18:24:52 +01:00
Richard W.M. Jones
7378edb9fa Add qemu-speed-test program to test speed of qemu.
Currently it tests the upload and download speed of virtio-serial and
the read and write speed of the block device (eg. virtio-scsi).
2014-07-25 22:48:09 +01:00
Richard W.M. Jones
115fcc3432 launch: Close file descriptors after fork (RHBZ#1123007).
This refactors existing code to close file descriptors in the recovery
process, and also adds code to close file descriptors between the
fork() and exec() of QEMU or User-Mode Linux.

The reason is to avoid leaking main process file descriptors where the
main process (or other libraries in the main process) are not setting
O_CLOEXEC at all or not setting it atomically.  Python is a particular
culprit.

See also this OpenStack Nova bug report:
https://bugs.launchpad.net/nova/+bug/1313477

Thanks: Qin Zhao for identifying and characterizing the problem in Nova.
2014-07-25 16:28:09 +01:00
Richard W.M. Jones
f18464995f tests: builder: Allow test to be skipped. 2014-07-25 16:06:46 +01:00
Richard W.M. Jones
81cafdcfd5 virt-resize: Unmount filesystem after testing size.
We were mounting different filesystems on top of each other.  In fact
this is not a problem, but it's nicer to unmount each filesystem
properly after examining it.
2014-07-25 16:04:18 +01:00
Richard W.M. Jones
fc7da04ccd daemon: Add extra debugging to umount_all command.
No functional change, just prints some more debug messages.
2014-07-25 16:03:09 +01:00
Richard W.M. Jones
146cc78b7d aarch64: Use a smaller test file for test-cancellation-upload-daemoncancels.sh
This test worked by uploading a 100MB file into a 100MB container and
seeing the inevitable crash.  Unfortunately virtio-mmio (used on
aarch64) is quite slow.  Since this test is not testing the speed of
virtio-mmio, use a smaller test file so the test finishes in a
reasonable time.
2014-07-25 15:28:46 +01:00
Richard W.M. Jones
d268de9394 tests: hotplug: Allow tests to be skipped.
They don't work on aarch64.
2014-07-25 14:43:06 +01:00
Richard W.M. Jones
64498034bb tests: lvm: Allow test to be skipped. 2014-07-25 10:04:44 +01:00
Richard W.M. Jones
7f826e1296 Version 1.27.23. 2014-07-23 17:40:16 +01:00
Richard W.M. Jones
d682dad186 aarch64: Add comment about efi-rtc=noprobe option.
This updates commit 5326689d50.
2014-07-23 17:09:59 +01:00
Richard W.M. Jones
bcdbe6405c v2v: Add support for converting Windows guests.
This completes commit f296d34f3b.
2014-07-23 17:02:49 +01:00
Richard W.M. Jones
f4698575cc customize: Add the ability to use --firstboot for Windows guests.
This allows you to add potentially multiple --firstboot
scripts to a Windows guest.
2014-07-23 17:02:49 +01:00
Richard W.M. Jones
199fa26950 mllib: Add regedit mini-library.
This library replaces Win::Hivex::Regedit, or at least enough for us
to be able to make the simple Registry modifications needed for
installing firstboot scripts.
2014-07-23 17:02:43 +01:00
Richard W.M. Jones
9c49590d42 customize: firstboot: Move Linux-specific functions into Linux submodule.
No functional change.
2014-07-23 15:09:56 +01:00
Richard W.M. Jones
12b54ef5e3 sparsify: Relax requirement that output device cannot be block device (RHBZ#1122557).
To fix RHBZ#1056290, I prevented virt-sparsify being used if the
output device is a block device.

I have now retested this scenario and it does work (in both copying
and in-place mode), and does not delete the output device, and
therefore we can relax this restriction so only char devices are
banned.

This is useful for oVirt which uses a qcow2 formatted block device to
store virtual machines.
2014-07-23 15:09:48 +01:00
Richard W.M. Jones
897b136aa8 Update translations from Transifex. 2014-07-22 19:10:22 +01:00
Richard W.M. Jones
e7ae071f60 Version 1.27.22. 2014-07-21 14:36:53 +01:00
Richard W.M. Jones
5326689d50 aarch64: efi-rtc=noprobe is needed to fix boot of upstream kernel on VM. 2014-07-21 13:54:43 +01:00
Pino Toscano
f4026d779e configure: look for "default-java" as directory for Java
In Debian-based systems, /usr/lib/jvm/default-java is a symlink
pointing to the location of the default Java version.
2014-07-18 09:57:04 +02:00
Richard W.M. Jones
de5924a229 tests: Add test program to run qemu/appliance repeatedly.
For example:

  $ time ./run ./tests/qemu/qemu-boot -n 100
  real 1m19.794s
  user 0m10.001s
  sys  0m5.928s

will run 100 appliance start/stops, from multiple threads.
2014-07-17 22:31:59 +01:00
Richard W.M. Jones
83790960d6 valgrind: Tweak the suppression matching OCaml leak in caml_search_in_path.
In OCaml 4.02 this still leaks, but the stack trace is slightly
different so the old suppression didn't match it.
2014-07-17 11:40:41 +01:00
Richard W.M. Jones
333ddf208b tests: Add a protocol regression test for long error messages. 2014-07-17 11:40:41 +01:00
Richard W.M. Jones
4106c97934 daemon: Truncate long error messages so XDR encoding doesn't fail. 2014-07-17 11:40:41 +01:00
Richard W.M. Jones
4d3953f092 Warn about large stack frames, and fix a few places with excessive stack usage. 2014-07-17 11:40:40 +01:00
Richard W.M. Jones
00c94d808b tests: Remove tests/protocol/test-qemudie-launchfail.sh
This test has not been run since 2012 as it depends on specifics of
how supermin and new-style appliances work (see
commit 2d89aef897).

This commit removes the test entirely.
2014-07-17 11:40:40 +01:00
Richard W.M. Jones
fa3d6e55b2 tests: qemu: Fix TCG test.
$guestfish was not defined, so the UML test/skip did not do anything.
2014-07-16 13:40:37 +01:00
Richard W.M. Jones
9cdaaeee40 tests: regressions: Allow non-exec stack test to be skipped.
Currently fails on aarch64 because of a buggy GCC.
2014-07-15 22:56:22 +01:00
Richard W.M. Jones
9e01541e48 tests: 9p: aarch64 also uses virtio-mmio (instead of virtio-pci). 2014-07-15 22:56:22 +01:00
Richard W.M. Jones
2d01e06fc9 tests: regressions: Skip test on aarch64 which also does not support IDE. 2014-07-15 22:56:22 +01:00
Richard W.M. Jones
fe9d3f7a90 ocaml: Ignore Warning 3: deprecated feature: String.* functions.
In OCaml 4.02, the 'string' type can be made immutable.  All String.*
functions that are concerned with creating or mutating strings now
give a warning like this:

  Warning 3: deprecated feature: String.unsafe_set

Disable this warning since we don't want to turn on immutable strings
yet.
2014-07-15 17:51:52 +01:00
Richard W.M. Jones
d71ec218ea aarch64: Add some earlyprintk debugging. 2014-07-15 17:44:37 +01:00
Richard W.M. Jones
57c7417f89 aarch64: Use console=ttyAMA0 instead of console=ttyS0.
This still only prints early console messages.  Output stops
after:

  bootconsole [earlycon0] disabled

but I have not found any way to get later kernel messages.
2014-07-15 17:44:37 +01:00
Richard W.M. Jones
9d8ede1ae4 sysprep: Standard exception handling, taken from virt-builder & virt-v2v. 2014-07-15 17:38:32 +01:00
Richard W.M. Jones
f913ca5ebc customize: Use Common_utils.error function instead of failwith.
This is just code refactoring.
2014-07-15 17:38:32 +01:00
Richard W.M. Jones
82cf3c9d68 customize: Update copyright messages.
No functional change.
2014-07-15 17:38:32 +01:00
Richard W.M. Jones
f955fec760 docs: Remove useless "SHELL QUOTING" section from manual pages. 2014-07-15 17:38:31 +01:00
Richard W.M. Jones
9b47a53a4b sparsify: Add --tmp prebuilt:file option.
This option allows oVirt to pass a prebuilt qcow2 file to use as the
temporary overlay.  The file must be qcow2, and must have indisk as a
backing file - the code does minimal checks to ensure this is correct.

Example usage:

  qemu-img create -f qcow2 -b indisk overlay.qcow2
  virt-sparsify indisk --tmp prebuilt:overlay.qcow2 outdisk

Note this only applies in copying mode.
2014-07-15 17:38:31 +01:00
Pino Toscano
66aa98265d appliance: init: run ldconfig
Run ldconfig early in the init script, so libraries outside standard
library paths but with a proper ld.so configuration file pointing at
them can be found.
2014-07-15 11:06:32 +02:00
Richard W.M. Jones
a791e08163 RHEL 6: p2v: Add fix for older PCRE.
RHEL 6 pcre did not define PCRE_PARTIAL_SOFT.  However PCRE_PARTIAL is
a synonym so use that.
2014-07-11 10:40:06 +01:00
Richard W.M. Jones
17bf3ce21c Version 1.27.21. 2014-07-08 14:11:57 +01:00
Richard W.M. Jones
f296d34f3b v2v: Add partial support for converting Windows guests.
This is not yet complete.
2014-07-08 14:11:48 +01:00
Richard W.M. Jones
2ee1fb6472 builder: CentOS 7.0 2014-07-08 10:12:10 +01:00
Pino Toscano
71ac957d4a Use Mkdtemp.temp_dir instead of Mkdtemp.mkdtemp 2014-07-07 19:33:44 +02:00
Pino Toscano
c8f3e99302 mllib: introduce Mkdtemp.temp_dir
Add a simple function to ease the usage of Mkdtemp.mkdtemp.
2014-07-07 19:30:29 +02:00
Pino Toscano
3fc6983b16 inspect: ignore /etc/fstab with no entries (RHBZ#1113156).
Just like no /etc/fstab is not an error, having one with no entries
shouldn't be an issue either.

With systemd, this could be a valid setup, with mount points set its own
way.
2014-07-07 11:40:19 +02:00
Richard W.M. Jones
3f2e18efde valgrind: Add suppress for libvirt memory leak in virFileFindResourceFull.
https://bugzilla.redhat.com/show_bug.cgi?id=1116427
2014-07-04 15:48:36 +01:00
Richard W.M. Jones
2fe74642f4 launch: direct: Use -cpu host when using KVM on x86.
This is the same as what the libvirt backend does.
2014-07-03 12:16:32 +01:00
Richard W.M. Jones
fc9647bb4d mllib: Remove trailing whitespace.
This fixes commit b24b0b17a8.
2014-07-02 23:09:53 +01:00
Richard W.M. Jones
bf47ed1b6a tests: qemu: Test force_tcg setting is effective. 2014-07-02 18:20:51 +01:00
Richard W.M. Jones
2369e9c2d6 log: Pass correct parameter to localtime_r on 32 bit platforms.
We were passing an int64_t which happens to be the same as time_t, but
only on 64 bit.  This didn't work on 32 bit (or rather, it works on
little endian, but only by accident).

This fixes commit fb546eaee0.
2014-07-02 16:51:36 +01:00
Richard W.M. Jones
a2747578eb journal: Fix binding of sd_journal_get_realtime_usec on 32 bit machines.
sd_journal_get_realtime_usec is defined as:

    int sd_journal_get_realtime_usec(sd_journal* j, uint64_t* usec);

Unfortunately we passed size_t* as the second argument.  This happened
to work on 64 bit machines because size_t is 64 bit there, but failed
on 32 bit machines, where we didn't pass a sufficiently large result
buffer.

This fixes commit 2d996df66c.
2014-07-02 16:51:36 +01:00
Richard W.M. Jones
1e1d7cf6af excludefiles: Exclude various common log files when building the appliance.
These log files can get pretty big, and that causes problems
like this one:

http://linuxforum.ru/viewtopic.php?id=35381

and this one:

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

In both cases the problem was /var/log/lastlog which is apparently a
large sparse file.  Supermin cannot cope with sparseness, so it copies
the whole file non-sparse.  But since this could affect other log
files this commit covers various common log file names and patterns.

Thanks: semperN
2014-07-02 14:27:53 +01:00
Richard W.M. Jones
f40e11ace4 Version 1.27.20. 2014-07-02 13:54:16 +01:00
Richard W.M. Jones
5d48f7a792 Update gnulib to latest version. 2014-07-02 13:22:18 +01:00
Richard W.M. Jones
144a86ac8c v2v: Change fstrim message to warning.
This also ensures it is flushed and translated.
2014-07-01 16:21:55 +01:00
Richard W.M. Jones
dbe0b69f24 v2v: Remap block device names in grub & /etc/fstab.
eg. Change /dev/hda to /dev/vda
2014-07-01 16:21:55 +01:00
Richard W.M. Jones
120d61cf56 v2v: Kill kudzu dead. 2014-07-01 16:21:55 +01:00
Richard W.M. Jones
838dce6557 v2v: When converting Linux guests, rebuild the initrd.
It probably needs to be rebuilt to add virtio drivers.
2014-07-01 16:21:55 +01:00
Richard W.M. Jones
a32d92e420 v2v: When inspecting Linux guests, collect kernel version & location of initrd file too. 2014-07-01 16:21:54 +01:00
Richard W.M. Jones
5cf5c3f1c7 v2v: Change source disk into a struct.
Simple code refactoring, allowing us to collect the target/@dev
attribute in this (now) structure.
2014-07-01 16:21:54 +01:00
Richard W.M. Jones
544b087d4b generator: Sort the structs.
Sort the structs when generating code.  Since the structs are
logically indepedent of each other, this should have no effect except
to make generated files list the structs in a different order.

However this also fixes the following build problem:

  File "convert_linux.ml", line 322, characters 43-50:
  Error: This expression has type G.stat = Guestfs.stat
    but an expression was expected of type G.dirent = Guestfs.dirent

It turns out the OCaml bindings don't like the fact that we have
two structs with a common field name (dirent.ino and stat.ino).

In OCaml < 4.01, this means that any attempt to reference stat.ino
would fail because dirent.ino appears second in the file, overriding
stat.ino.

Sorting the structs has the side effect of making stat.ino appear
second, thus resolving the build failure above.

In OCaml >= 4.01 the compiler now uses some disambiguation rules based
on the known types to resolve this problem, so accessing either field
would work no matter what order they are listed in.

See:

http://ocaml.org/releases/4.01.0.html
http://www.lexifi.com/blog/type-based-selection-label-and-constructors
http://www.lexifi.com/blog/ocaml-extensions-lexifi-overidding-record-labels-and-constructors
2014-07-01 16:21:54 +01:00
Richard W.M. Jones
16e817456c v2v: Modify conversion step to first do proper inspection and data
gathering about the guest.
2014-06-25 13:58:32 +01:00
Richard W.M. Jones
b6b9b90dd7 Use -v and -x flags consistently across OCaml virt-* tools.
virt-customize:
virt-sparsify:
virt-sysprep:
virt-v2v:
  - These tools consistently used -v to mean verbose/debugging
    and -x to mean enable libguestfs tracing.

virt-builder:
virt-resize:
  - These two tools did not recognize -x at all, and used -v
    to enable libguestfs tracing and general debugging.
  - This commit changes these two tools to consume -v/-x
    consistently with the other tools.

Unfortunately this has a cascade of effects through the code.
2014-06-24 16:54:32 +01:00
Richard W.M. Jones
5d3ec4474c mllib: Rewrite text wrapping function so it can handle newlines within the text. 2014-06-24 16:19:23 +01:00
Richard W.M. Jones
9aa0969d8d virt-cat, virt-ls, virt-edit: Fix typo in documentation.
This fixes the following:
 commit aad3c467fb
 commit de5e7331af
 commit 86706907af
2014-06-24 12:24:53 +01:00
Richard W.M. Jones
e46bbb45d1 Version 1.27.19. 2014-06-24 08:28:28 +01:00
Richard W.M. Jones
77a963886f v2v: Refactor common code for listing files in packages.
At some point we should make these into real libguestfs inspection
APIs.  However they are fairly hard to implement, at least for RPM.
2014-06-23 21:58:11 +01:00
Richard W.M. Jones
7a68afed14 v2v: Move app2_version comparison functions to utils.
Refactoring.
2014-06-23 21:58:11 +01:00
Richard W.M. Jones
5b29d9a1a8 v2v: Create apps_map when doing inspection step. 2014-06-23 21:58:11 +01:00
Richard W.M. Jones
6705be2379 v2v: Create a shared StringMap module. 2014-06-23 21:58:11 +01:00
Richard W.M. Jones
9975bf8eb3 v2v: Rename Convert_linux_enterprise -> Convert_linux.
Just module rename.
2014-06-23 21:58:11 +01:00
Richard W.M. Jones
76bf3f7289 v2v: Rename Convert_linux_common -> Lib_linux.
Just library name refactor.
2014-06-23 21:58:10 +01:00
Richard W.M. Jones
6f73266363 mllib: Add a common 'warning' utility function.
This commit changes many places in OCaml utilities that print
warnings to use the warning function instead.
2014-06-23 21:58:10 +01:00
Richard W.M. Jones
b24b0b17a8 mllib: Add an interface for Common_utils library.
It turned out that Common_utils was exporting the 'G' module (an alias
for Guestfs).  We want any code that uses G as a shortcut to declare:

  module G = Guestfs

at the top, since that avoids confusion for newbie (or experienced)
OCaml programmers.
2014-06-23 21:58:10 +01:00
Richard W.M. Jones
273f346465 v2v: Warn only if virtio packages are missing from the guest.
In this version of virt-v2v you have to install a virtio
capable kernel before doing the conversion.
2014-06-23 21:58:10 +01:00
Richard W.M. Jones
8ed27e7865 v2v: In convert function, add a hash of app name -> app structure.
For quicker lookups than searching the linear list.
2014-06-23 21:58:10 +01:00
Richard W.M. Jones
7b89f657c4 mllib: Move common code for comparing version strings to library. 2014-06-23 21:58:10 +01:00
Richard W.M. Jones
90bf3422c5 v2v: When parsing input libvirt XML, get correct disk image format.
Old Xen PV guests had:

      <driver name='tap' type='aio'/>

The previous xpath expression matched any driver type attribute in
order to pick up the format.  However we only want to match:

      <driver name='qemu' type='raw'/>

so we need to check the name attribute as well.
2014-06-23 21:58:09 +01:00
Richard W.M. Jones
af31670d03 v2v: Avoid segfault if xpath expression doesn't match any nodes.
I'm not sure if this indicates that the xpath expression is wrong, but
in any case it can be that xpathobj->nodesetval is NULL.  In this
case, return 0 from xpathobj_nr_nodes instead of segfaulting.
2014-06-23 21:58:09 +01:00
Richard W.M. Jones
877583a6f4 v2v: In -o local mode, name disks <name>-sda instead of disk-sda.
This allows us to use the same shared output directory for multiple
parallel tests.
2014-06-23 21:58:09 +01:00
Richard W.M. Jones
8ad5698d02 v2v: Print \n after warnings.
Using eprintf so this is not implicit (unlike 'error' function).
2014-06-23 21:58:09 +01:00
Richard W.M. Jones
beef28fe96 v2v: Dump out 'source' structure when debugging. 2014-06-23 21:58:09 +01:00
Richard W.M. Jones
2f61634215 v2v: string_of_overlay already has trailing \n, don't need to add one. 2014-06-23 21:58:09 +01:00
Richard W.M. Jones
437e387c4d v2v: Print qemu-img source overlay command when using -v. 2014-06-23 21:58:08 +01:00
Richard W.M. Jones
c62dbb8afd run: Add v2v/ subdirectory to $PATH. 2014-06-23 21:58:08 +01:00
Richard W.M. Jones
27e1b6ca8b v2v: Allow relative paths to appear in -i libvirtxml input.
When writing libvirt XML by hand, or for tests, this is
immensely useful.
2014-06-23 21:58:08 +01:00
Richard W.M. Jones
c3c659e996 rescue: Use guestfs_add_drive_scratch to implement the --scratch option. 2014-06-23 21:58:08 +01:00
Richard W.M. Jones
bb3ba0c43a options: Compile out part of union which cannot be used when not compiling guestfish. 2014-06-23 21:58:08 +01:00
Pino Toscano
86706907af edit: add -m option
Implement the -m/--mount as available in guestfish to override the
automatic introspection and specify which partitions to mount instead.
2014-06-23 15:56:15 +02:00
Pino Toscano
de5e7331af cat: add -m option
Implement the -m/--mount as available in guestfish to override the
automatic introspection and specify which partitions to mount instead.
2014-06-23 15:54:00 +02:00
Pino Toscano
aad3c467fb ls: add -m option
Implement the -m/--mount as available in guestfish to override the
automatic introspection and specify which partitions to mount instead.
2014-06-23 14:44:40 +02:00
Richard W.M. Jones
54c77f99cc builder: Update centos.sh to add CentOS 7 QA. 2014-06-20 11:08:24 +01:00
Richard W.M. Jones
8d6cbd05ca website: Install HTML version of the virt-log(1) man page on the website. 2014-06-17 17:40:48 +01:00
Richard W.M. Jones
cd111bd0e3 virt-v2v: Remove text from README, moved into test data repo.
There is (will be) a new repository containing the large/proprietary
test images.  Move the README related to this to the new repo.
2014-06-17 17:40:00 +01:00
Richard W.M. Jones
e6a067e183 Version 1.27.18. 2014-06-16 12:49:02 +01:00
Richard W.M. Jones
98a1392849 virt-log: Fix memory leak because of wrong type of CLEANUP_* function.
This fixes commit a3475cf9bbbbd3514b117d5edd75d9c0e239d43a.
2014-06-16 12:25:05 +01:00
Richard W.M. Jones
cd15b2ead6 Version 1.27.17. 2014-06-16 10:53:59 +01:00
Richard W.M. Jones
c1dd8e80ba tests/guests: Add new file debian-syslog to EXTRA_DIST.
This fixes commit 026342a7ee.
2014-06-16 10:50:58 +01:00
Richard W.M. Jones
0c38cd4d25 virt-log: Add support for displaying the Windows Event Log.
Uses the external program python-evtx, and this only works
for Windows >= Vista.
2014-06-16 10:32:10 +01:00
Richard W.M. Jones
d167da86d9 virt-log: do_log_journal: return instead of exiting immediately.
This cleans up commit a3475cf9bbbbd3514b117d5edd75d9c0e239d43a.
2014-06-16 10:32:10 +01:00
Richard W.M. Jones
fb546eaee0 New tool: virt-log: It lists log files from within the guest.
See 'TODO' file for suggested future improvements.
2014-06-14 13:58:45 +01:00
Richard W.M. Jones
026342a7ee tests: guests: Add a text syslog file to the phony Debian guest. 2014-06-14 13:38:56 +01:00
Richard W.M. Jones
2d996df66c New API: journal_get_realtime_usec
This adds a binding for sd_journal_get_realtime_usec(3).
2014-06-14 13:38:56 +01:00
Richard W.M. Jones
e5276e4455 Version 1.27.16. 2014-06-13 22:48:18 +01:00
Richard W.M. Jones
31c07bc9d8 podwrapper: Put =encoding line before first POD directive.
=head isn't always the first POD directive.

This fixes commit 1148bd91ce.
2014-06-13 22:44:38 +01:00
Richard W.M. Jones
1148bd91ce podwrapper: Put the =encoding line at the correct place in the input (RHBZ#1109174).
Commit c4dc70f8c4 broke the man pages
for the Perl scripts in the tools/ directory.

It inserted the =encoding line at the top of the file, instead of in
front of the first =head1 entry, and this meant that the #!/usr/bin/perl
and the prologue became a part of the POD, which was not intended.
2014-06-13 19:59:22 +01:00
Richard W.M. Jones
870c17e99a sparsify: Add --tmp option to allow specifying temp directory or block device.
Add the virt-sparsify --tmp option.

This works in two ways.  Either you can specify a temporary directory,
in which case it's just the same as setting $TMPDIR before:

  virt-sparsify indisk outdisk --tmp /var/tmp

Or, as a new feature, you can specify a block device which is directly
used (and OVERWRITTEN):

  virt-sparsify indisk outdisk --tmp /dev/sdX

This is useful for oVirt nodes, where there is limited temporary
space, but a block device can be assigned to the node.

In both cases it is only used in copying mode.  In-place
sparsification doesn't require large amounts of temporary space.
2014-06-13 19:59:22 +01:00
Richard W.M. Jones
893bfe2e36 mllib: Create a common utility function is_directory.
This is a wrapper around Sys.is_directory which doesn't throw
exceptions.
2014-06-13 19:59:22 +01:00
Richard W.M. Jones
9b5cdc8747 fuse: UID 0 should override all permissions checks (RHBZ#1106548).
Previously if you were root, and you tried to change directory into a
directory which was not owned by you and not readable (eg. 0700
bin:bin), it would fail.

This doesn't fail on regular directories because when you are root the
kernel just ignores permissions.

Although libguestfs in general tries not to duplicate kernel code, in
the case where we emulate the FUSE access(2) system call,
unfortunately we have to do it by stat-ing the object and performing
some (half-arsed) heuristics.

This commit modifies the FUSE access(2) system call, so root is now
able to chdir to any directory.

It also adds some debugging so we can debug these complex permissions
checks in the field if some other problem arises in future.
2014-06-13 19:59:22 +01:00
Richard W.M. Jones
87ac1c186e builder: Don't copy *.xz files to WEBSITEDIR. 2014-06-12 22:18:02 +01:00
Richard W.M. Jones
bacc7fd0a3 builder: Rebuild Fedora 19 disk image with Xen drivers. 2014-06-12 22:13:25 +01:00
Richard W.M. Jones
005316b7d8 builder: Get rid of remaining disk image signatures.
These were deprecated and replaced in virt-builder 1.24.1.
2014-06-12 15:48:55 +01:00
Richard W.M. Jones
58ea77e79b builder: Update Fedora 20 image, with Xen drivers.
This commit also removes the disk image signature.  These have not
been needed since virt-builder 1.24.1.  No one should be running that
version of virt-builder since there are newer 1.24 branch versions.
2014-06-12 15:48:55 +01:00
Richard W.M. Jones
0fa52e4e45 builder: Fedora: Enable Xen driver support.
See:
https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045

Notes:

(1) Edit dracut configuration to make sure the change is permanent, in
case kickstart, virt-builder or something else installs a kernel or
runs dracut.

(2) We need to run dracut on the just-installed kernel, not on the
running kernel.  The snippet to do this was copied from the Fedora
cloud kickstart.

Thanks: Olaf Hering, George Dunlap, Dario Faggioli.
2014-06-12 15:48:54 +01:00
Richard W.M. Jones
d4d6540b24 builder: virt-install now requires '--serial pty' parameter.
This updates commit 73ebaa3066.
2014-06-12 15:48:54 +01:00
Richard W.M. Jones
73ebaa3066 builder: virt-install now seems to require '--serial pty' option. 2014-06-11 12:43:03 +01:00
Richard W.M. Jones
99472ab2e9 builder: Further updates to RHEL 7 GA script.
The location of the trees have moved ... again.
2014-06-11 12:42:08 +01:00
Richard W.M. Jones
24800d2e96 builder: Update rhel.sh script for RHEL 7 GA.
Set the rootfs for RHEL 7.x to xfs.  (/boot is ext4)

Remove old RHEL 7 beta & rc releases.
2014-06-11 08:21:34 +01:00
Richard W.M. Jones
0dbdc470ed Version 1.27.15. 2014-06-10 21:10:27 +01:00
Richard W.M. Jones
7faa602e8f launch: libvirt: Only use serial BIOS (sgabios) on x86.
This device is not present at least on ARM.  Unfortunately libvirt
doesn't give us any way to query when the device is present.

This fixes commit bed592498d.
2014-06-10 19:31:06 +01:00
Pino Toscano
e6a858907f appliance: init: properly set PS1 and TERM for virt-rescue (RHBZ#812970).
Setting environment variables such as PS1 for bash before starting it
might not be effective when the startup scripts provided by the
distribution unconditionally change it.
Hence, set PS1 and TERM in a ~/.bashrc, which will be source'd last and
thus be able to set them the way we want.
2014-06-10 19:09:43 +01:00
Pino Toscano
844066597d daemon: grub: show grub-install's output on error if verbose 2014-06-10 19:09:43 +01:00
Pino Toscano
45db96b00d daemon: print parameters for vgchange in error messages 2014-06-10 19:09:43 +01:00
Pino Toscano
134ac97d22 daemon: retire the augeas feature
Augeas has been a mandatory dependency of libguestfs for quite some
time, so the aug_* functions could have been always called (without even
checking the augeas feature). Thus retire the feature, marking it as
always available with no more functions depending on it.
2014-06-10 11:15:50 +01:00
Pino Toscano
b28ef8791a builder: handle duplicated images (RHBZ#1092753).
Filter the available images, removing the versions with an older
revisions, and duplicates.
2014-06-10 11:14:04 +01:00
Pino Toscano
aeb8792474 inspect: tighten NetBSD detection
It seems recent (?) NetBSD versions have their kernel as /netbsd, so
also check for it to detect NetBSD installations.

The current detection so far basically relied on generic files and
directories which can potentially be in every UNIX system, misdetecting
them if a /etc/release file is present in them.
2014-06-10 11:12:35 +01:00
Pino Toscano
5efbc8922f fish: list also aliases in the guestfish help (RHBZ#1103877).
Output also the aliases (telling which function they refer to) in
`guestfish -h`, together with non-alias functions.
2014-06-10 11:08:28 +01:00
Pino Toscano
6577f34a68 appliance: remove extra comma in Mageia's list
Followup of commit 00d94d95c8.

Thanks Thierry Vignaud for the notice.
2014-06-09 09:59:20 +02:00
Richard W.M. Jones
0196724330 Version 1.27.14. 2014-05-30 18:08:26 +01:00
Pino Toscano
4d8ecb0d30 generator: fix daemon functions with optional params but no mandatory params
The
  struct guestfs_$function_args args;
declaration was not emitted in that case, leading to build failure.
2014-05-29 10:32:15 +02:00
Joseph Wang
00d94d95c8 appliance: Update packagelist for Mageia (RHBZ#1102448). 2014-05-29 08:46:20 +01:00
Richard W.M. Jones
ef49b297cc appliance: Increase udev timeout to 6000s (RHBZ#1096579).
If the image is located on NFS, and the NFS mount is performing a
large copy, then all other NFS operations stop.  This delay can be
large enough that we hit the current 10 minute timeout in udev.

Increasing this to 100 minutes is reported to cure the problem (in
reality we want udev to wait indefinitely).
2014-05-27 11:50:59 +01:00
Pino Toscano
917ca11a76 ruby: add :nodoc: comment for internal methods
This way they are ignored by rdoc.
2014-05-27 11:02:58 +02:00
Pino Toscano
e4005bd530 builder: support aliases for images (RHBZ#1098718). 2014-05-27 10:57:13 +02:00
Richard W.M. Jones
bed592498d launch: libvirt: Add -device sga (sgabios).
This feature was added to libvirt in 2011-07-08 so we can assume it
exists.

Thanks: Jiri Jaburek
2014-05-26 15:27:09 +01:00
Richard W.M. Jones
1fbf0a88f6 fuse: Make all the skip messages consistent in this test. 2014-05-25 22:34:51 +01:00
Richard W.M. Jones
f32aef2971 fuse: Skip test-fuse-umount-race.sh if backing file does not exist. 2014-05-25 22:34:04 +01:00
Richard W.M. Jones
068455f210 fuse: Skip guestmount --fd test if /dev/fuse does not exist.
When we run guestmount (eg. in Koji) it will fail anyway, so don't run
the test.
2014-05-25 22:28:27 +01:00
Richard W.M. Jones
2c460ac52f Version 1.27.13. 2014-05-24 19:17:46 +01:00
Richard W.M. Jones
32f5d99873 fuse: Add a test of guestmount --fd option (RHBZ#1100498). 2014-05-24 18:11:20 +01:00
Richard W.M. Jones
145c7ed5ee fuse: Add guestmount --fd option (RHBZ#1100498).
This implements the guestmount --fd option to allow you to run
guestmount captive under another process (typically using
`guestmount --fd=<FD> --no-fork').

See: https://bugzilla.redhat.com/show_bug.cgi?id=1100498
2014-05-24 18:11:20 +01:00
Hilko Bengen
a60212ee99 golang: Fix for out-of-tree builds
RWMJ:

This is half of a downstream Debian patch to fix out-of-tree builds
for golang.
2014-05-24 18:11:19 +01:00
Richard W.M. Jones
ee9981714f Version 1.27.12. 2014-05-23 11:04:20 +01:00
Pino Toscano
5d5e66ce33 daemon: scrub-file: resolve the path before calling scrub (RHBZ#1099490).
Resolve the given path within the chroot, so scrub can be invoked
outside the chroot on an already-resolved path.

Add few tests in scrub-file for this and other similar issues.
2014-05-21 15:03:17 +02:00
Pino Toscano
d7aec9c0d3 daemon: add sysroot_realpath
Similar to sysroot_path, but first resolves (using realpath) the given
path within sysroot.
2014-05-21 15:01:50 +02:00
Pino Toscano
05f84f4c21 Make realpath mandatory
commit a86eb0e0d2 made it an optional
feature, as on Windows it was not available; on the other hand, realpath
has been used unconditionally already for quite some time, so having
just the "realpath" command conditional on the presence of it does not
make much sense.

Drop the configure/build system handling of it, make the "realpath"
command no more optional, and keep the "realpath" feature as
unconditionally available now.
2014-05-21 14:58:40 +02:00
Pino Toscano
50ed922a02 generator: add always-available optgroups
Support the possibility to have optional groups always enabled (e.g.
because they were present in the past, and they need to be kept for
users).
Add and use few helper optgroups-related functions to deal also with
them.
2014-05-21 14:51:42 +02:00
Richard W.M. Jones
865f64006e ppc64: Use console=hvc0 console=ttyS0.
console=ttyS0 used to work.  Now it's broken again, and the correct
setting appears to be console=hvc0.  Since we can pass multiple
console settings, do that to try and catch the right console.
2014-05-21 09:36:34 +01:00
Richard W.M. Jones
84189b370a Update guestfs-release-notes.txt.
This updates commit a21dfc483c.
2014-05-20 13:13:39 +01:00
Pino Toscano
697b0d4678 fish: simplify output of 'supported'
Print each line at once, making use of the padding features of printf
instead of doing it manually.
2014-05-20 13:09:27 +01:00
Richard W.M. Jones
a21dfc483c Fix some spelling mistakes and typos in documentation (RHBZ#1099284). 2014-05-20 10:45:33 +01:00
Richard W.M. Jones
e014ef33ab Update BUGS. 2014-05-20 10:40:17 +01:00
Richard W.M. Jones
f49e003a87 p2v-iso: Add a kickstart target.
This also changes the old p2v-iso/README file into a POD file
which is installed as a manual page.
2014-05-19 22:26:53 +01:00
Richard W.M. Jones
1939cd4849 p2v-iso: unset CDPATH, set -e at the top of the virt-builder-target script. 2014-05-17 11:49:13 +01:00
Richard W.M. Jones
c65fbeebb8 configure: Move --with-default-backend test later in configure.ac.
For some reason this test was right at the top of the script.
2014-05-17 11:49:13 +01:00
Richard W.M. Jones
c5106511e0 build: Use AC_PROG_AWK to define the right awk to call.
We actually call plain 'awk' in many different scripts, but this
commit does not change all of those.
2014-05-17 11:49:13 +01:00
Richard W.M. Jones
044ecdb903 builder: Make the summary printed at the end easier to read.
This is just a whitespace change.  The new output looks like this:

                   Output file: fedora-20.img
                   Output size: 4.0G
                 Output format: raw
            Total usable space: 5.2G
                    Free space: 4.5G (86%)
2014-05-17 10:38:59 +01:00
Richard W.M. Jones
467bddd3b7 p2v-iso: Use xorg-x11-drivers meta-package to install Xorg drivers.
Thanks: Andrew Price.
2014-05-16 12:54:46 +01:00
Richard W.M. Jones
8e6ddbdf70 Version 1.27.11. 2014-05-16 11:10:06 +01:00
Richard W.M. Jones
a09146386c virt-p2v: Install the binary in libexecdir.
Previously it wasn't installed at all.  However it makes sense to
install it somewhere so that it can be placed in a package (a
requirement if we're going to create a kickstart).  By placing it in
libexecdir it is hopefully clear that it should not be used.

Note on Red Hat distros, libexecdir is usually /usr/libexec.  On
Debian it is usually /usr/lib/libguestfs.
2014-05-16 10:57:48 +01:00
Pino Toscano
45971ab952 build: bump the libsystemd-journal needed version to 196
Bump to >= v196 the minimum version of libsystemd-journal needed for the
journal integration, since that version provides
sd_journal_get_data_threshold and sd_journal_set_data_threshold.
2014-05-16 11:05:40 +02:00
Richard W.M. Jones
77166308fa Version 1.27.10. 2014-05-15 23:00:46 +01:00
Richard W.M. Jones
047b6d3050 Add p2v-iso directory containing scripts for building the virt-p2v ISO.
It is not possible to have the ISO be built automatically when the
user runs 'make'.  The README file describes how you should go about
building the ISO or disk image.
2014-05-15 22:05:39 +01:00
Richard W.M. Jones
fd82bb12fd New tool: virt-p2v.
This is a graphical standalone front-end to virt-v2v which can be run
on physical machines (usually linked into a ISO or PXE boot image) to
convert the physical machine to a virtual machine.
2014-05-15 22:05:39 +01:00
Richard W.M. Jones
0131d6f666 New tool: virt-v2v.
This is a rewrite of the original virt-v2v tool.  The original was
written by Matt Booth et al in Perl between 2009 and 2013.
2014-05-15 22:05:39 +01:00
Maros Zatko
40d9609b29 generator: Change link to OCaml tutorials. 2014-05-15 14:45:00 +01:00
Richard W.M. Jones
1a1cb1ec3c builder: Fix RHEL 5 download location.
This fixes commit 3bc9ba6c84.
2014-05-15 14:45:00 +01:00
Pino Toscano
d2bfe2cb24 builder: respect the proxy also when downloading images (RHBZ#1096465).
Missing from commit 87d79c2ee2.
2014-05-14 17:59:31 +02:00
Pino Toscano
b6c8afaee6 builder: save the proxy for each entry
Copy the information about the proxy of a source in all the entries of
that source; this way it is possible to use it later when accessing to
the actual image of an entry.
2014-05-14 17:28:13 +02:00
Richard W.M. Jones
3bc9ba6c84 builder: Fix RHEL script for RHEL 5.
Root partition is on /dev/sda2:

$ virt-filesystems -a rhel-5.10 --all --long -h
Name       Type        VFS   Label      MBR  Size  Parent
/dev/sda1  filesystem  ext2  /boot      -    510M  -
/dev/sda2  filesystem  ext4  /          -    4.5G  -
/dev/sda3  filesystem  swap  SWAP-hda3  -    1.0G  -
/dev/sda1  partition   -     -          83   510M  /dev/sda
/dev/sda2  partition   -     -          83   4.5G  /dev/sda
/dev/sda3  partition   -     -          82   1.0G  /dev/sda
/dev/sda   device      -     -          -    6.0G  -

It would be better if we could mount by label in guestfish ...

There is another problem with RHEL 5 guests in that the
yum URL is slightly wrong.
2014-05-10 20:20:56 +01:00
Hilko Bengen
75022489c8 appliance: update Debian-specific package list 2014-05-10 15:36:11 +02:00
Richard W.M. Jones
944a601020 builder: Add Ubuntu 14.04 disk image.
Also remove the Ubuntu 13.10 image, since it's not an LTS image.
2014-05-10 12:40:03 +01:00
Richard W.M. Jones
a1fcd2ca5f builder: ubuntu: Allow virt-install --os-variant to be specified on the command line.
Current virt-builder in F20 does not know about --os-variant=ubuntutrusty
so to build that you can now do:

  ./ubuntu.sh 14.04 trusty ubuntusaucy
2014-05-10 10:47:05 +01:00
Pino Toscano
c7888ac618 configure: always add the extra warnings
Get rid of --enable-gcc-warnings and just add all the warnings in any
case; they are tested anyway, so only warnings supported by the compiler
will be used.

Regarding -Werror, add a new --enable-werror which enables its use.
2014-05-09 15:06:50 +02:00
Pino Toscano
a880bc1eb0 tests/syslinux: add new syslinux 6+ path of mbr.bin
Reported in https://bugs.debian.org/746748.
2014-05-09 12:20:33 +02:00
Pino Toscano
f46d53be18 tests/syslinux: factorize search for mbr.bin 2014-05-09 12:19:47 +02:00
Richard W.M. Jones
5e574bb304 Version 1.27.9. 2014-05-07 14:56:15 +01:00
Pino Toscano
a651990fb1 test-charset-fidelity: allow to skip testing specific FSes
Allow to skip testing the filesystem "foo" if the environment variable
SKIP_TEST_CHARSET_FIDELITY_foo=1 is set. This way it possible to not
test one or more filesystems without disabling the test altogether.
2014-05-07 15:45:07 +02:00
Pino Toscano
3633109ff3 Fix handling of passwords in URLs
So far, passwords in URLs (eg http://user:password@host..) have been
handled as part of the username, and thus passing
  add-drive path username:username:password ...
instead of
  add-drive path username:username secret:password ...

Fix the parsing of URLs to handle passwords as separate elements,
properly passing it as "secret" parameter for add-drive, and properly
readd it when building URLs in the direct backend.

Furthmore, to keep curl- and ssh-based qemu drivers working with
authenticated resources, make sure they can accept secrets.

Reported in comment #1 of RHBZ#1092583.
2014-05-07 15:06:51 +02:00
Nikos Skalkotos
c24ce0811d inspect: Add support for Oracle Linux
Prior to this patch the library would return "rhel" instead of
"oraclelinux" for Oracle Linux OSes.
2014-05-07 10:03:00 +01:00
Richard W.M. Jones
9e82936393 New API: cpio-out converts a directory to cpio format.
This is useful for generating Linux initramfses from other types of
filesystems.  For example:

 guestfish --ro -a disk.img -i cpio-out / - | gzip -9 > initrd.img
2014-05-07 09:05:29 +01:00
Richard W.M. Jones
c67e16734c sparsify: Add a note about qcow2 internal snapshots not being copied (RHBZ#1094746). 2014-05-07 09:05:29 +01:00
Richard W.M. Jones
2bd75a1ea1 customize: random-seed file has moved again.
Thanks, systemd.
2014-05-07 09:02:21 +01:00
Pino Toscano
845daded5f lib: xmlParse{File,Memory} -> xmlRead{File,Memory}
Switch from xmlParse* to xmlRead* so we can explicitly specify parsing
flags, including no network usage and no entity resolution.
The two behaviours mentioned above were not done before either, so this
should not introduce behaviour changes in libguestfs.
2014-05-06 19:22:14 +02:00
Richard W.M. Jones
4dc42693f2 guestfs-recipes: Fix language. 2014-05-04 20:57:41 +01:00
Richard W.M. Jones
be874d7f50 Version 1.27.8. 2014-05-02 11:25:48 +01:00
Richard W.M. Jones
c2488b6ed8 builder: Add RHEL 7 signature to EXTRA_DIST.
This fixes commit fea553778a.
2014-05-02 11:25:48 +01:00
Richard W.M. Jones
0c1a4b1781 launch: direct: Turn gdb into a backend setting.
You can now use LIBGUESTFS_BACKEND_SETTINGS=gdb in order to enable gdb
debugging of the appliance.  This only works with the direct backend.
2014-05-02 11:25:48 +01:00
Hilko Bengen
c4a91a1866 launch: direct: Supply -M option when testing qemu for devices.
qemu-system-arm 2.0 as currently available through Debian/unstable
doesn't want to tell us anything about available devices unless we
specify a machine type.
2014-05-02 11:25:47 +01:00
Pino Toscano
1550a80d6c daemon: xattr: factorize do_getxattr and do_lgetxattr
Move all the common code to a new _getxattr function, much like done for
other xattrs operations.

Mostly code motion, no functional changes.
2014-04-30 15:52:49 +02:00
Richard W.M. Jones
fea553778a builder: Add RHEL 7RC disk image. 2014-04-29 23:00:40 +01:00
Richard W.M. Jones
df5bd5741b builder: Fix parallel builds of index-parse.o.
When parallel builds are enabled it was possible for index-parse.c to
be compiled before the file had been completely written by bison.  The
usual symptom was that the 'do_parse' symbol was missing -- this
simply happened because that symbol is defined at the end of this
file, and the compiler compiled the file before the end part was
written out.  But you could also see other strange & random compile
failures as you would expect.

This was tested by running this script on an 8 core server:

 cd builder/
 export MAKEFLAGS=-j9
 while make clean >/dev/null; make all V=1 >& /tmp/log; do echo -n . ; done

Previously it would fail after <= 5 iterations.  With this change it
runs for at least 100 iterations.
2014-04-29 15:43:20 +01:00
Richard W.M. Jones
50b207ca45 Add a regression test for RHBZ#1091803. 2014-04-28 09:52:22 +01:00
Richard W.M. Jones
efd159a063 tar-in: Fix places where we didn't cancel the receive (FileIn) correctly along error paths (RHBZ#1091803).
Thanks: Bo Fan.
2014-04-28 09:51:48 +01:00
Richard W.M. Jones
8df792d4a7 Version 1.27.7. 2014-04-23 19:50:37 +01:00
Pino Toscano
ae891bc5f5 builder: isolate all the cache handling to a new Cache module
While there is not that much in it, it groups together the small
scattered-around bits handling the cache directory.
2014-04-23 10:39:51 +02:00
Richard W.M. Jones
101d728e80 configure: Make sure grep matches qemu 2.x version string. 2014-04-22 22:47:06 -04:00
Pino Toscano
4f5dc4afdc builder: add "[ignored]" to parsing errors for .conf files
Parsing sources .conf files is not a fatal error (that file would just
be ignored), so explicitly state that such parsing errors are ignored.

This should address the last bit in RHBZ#1077817.
2014-04-22 17:58:27 +02:00
Pino Toscano
e7c746854b builder: add an optional suffix string for INI parsing errors 2014-04-22 17:57:05 +02:00
Richard W.M. Jones
3f4903e53a Version 1.27.6. 2014-04-22 14:14:12 +01:00
Richard W.M. Jones
b176bde942 FAQ: Describe better how to compile libguestfs from source using alternate qemu/supermin/kernel. 2014-04-22 13:32:49 +01:00
Pino Toscano
2f5e9066db ruby: tests: convert from Test::Unit to MiniTest (RHBZ#1085029)
Convert the tests to the MiniTest test framework, but keeping the usage
of the old Test::Unit as fallback in case MiniTest is not available.
In the latter case, use a bit of "glue" to make the old API look like
the new API, so we can just rely on the newer MiniTest API.
2014-04-22 14:02:35 +02:00
Pino Toscano
fbae7f3e69 ruby: tests: isolate boilerplate in common file
Isolate in a common file all the standard boilerplate in tests, i.e. the
import of the test framework and the guestfs module (including the
import path hack needed for the latter).

Thanks to Vít Ondruch for the precious hints and suggestions.
2014-04-22 14:02:29 +02:00
Pino Toscano
0316d24770 daemon: parted: part-get-name: switch from sgdisk to parted (RHBZ#1088424).
Use parted to get the name of partitions in GPT layouts instead of
sgdisk, to reduce the possible discrepancy between output of tools.

The actual case here is that recent parted versions fixed/improved their
UTF-16 handling of partition names in GPT, and sgdisk seems to not be
properly handling them, returning also unicode control bytes.
Since parted can provide partition names already, just make use of it.

Since sgdisk is no more needed for part_get_name, the function is no
more optional on it.
2014-04-22 13:59:59 +02:00
Richard W.M. Jones
909c10d758 sparsify: If using -v (verbose), ensure #disk_create runs verbose too. 2014-04-16 21:12:52 +01:00
Richard W.M. Jones
e1a82bb130 builder: If using -v (verbose), ensure #disk_create runs verbose too. 2014-04-16 21:12:30 +01:00
Richard W.M. Jones
9515345bbd builder: Suggest using virt-install --os-variant option in virt-builder man page. 2014-04-16 20:09:39 +01:00
Richard W.M. Jones
27355c9b0b disk-create: Fix this API so it works correctly with block devices (RHBZ#1088262).
When you call guestfs_disk_create on a block device with format=raw
then it will try to discard the blocks on the device.
2014-04-16 12:01:17 +01:00
Richard W.M. Jones
1898d457bd Version 1.27.5. 2014-04-15 23:29:03 +01:00
Richard W.M. Jones
3c260f23d4 configure: Fix tests of qemu on ARM.
qemu-system-arm now requires that you pass '-machine virt' (or some
-machine type) explicitly.

Change the configure test so it works on upstream ARM.
2014-04-15 18:13:43 -04:00
Pino Toscano
87d79c2ee2 builder: add per-repository proxy configuration
Add the possibility to configure the proxy in each repository .conf
file, specifying whether use no proxy at all, follow the system
configuration or use a specific proxy.
2014-04-15 15:55:51 +01:00
Richard W.M. Jones
040694ab79 Version 1.27.4. 2014-04-15 14:23:34 +01:00
Pino Toscano
8ae2a8a936 sysprep: remove also hidden files/dirs in temporary dirs
List manually and remove the content left (hidden files/directories) in
temporary directories after the glob listing & removal.
2014-04-14 14:18:41 +02:00
Richard W.M. Jones
8f3959e581 sparsify: Fix automake build.
Previous commit 97c57a8887 added a
potential bug in the sparsify build.  If virt-sparsify had used a
*.mli file then it would have tried to run a command like:

 ocamlc mlguestfs.cmxa -c foo.mli -o foo.cmi

This would fail because ocamlc doesn't know about native code
libraries (*.cmxa).  In fact virt-sparsify was not affected by this
because it doesn't use any *.mli files.

Fix this by adjusting the automake variables.
2014-04-14 11:42:33 +01:00
Pino Toscano
c78b932199 builder: set an empty XDG_CONFIG_HOME in tests
This way they are affected less by the environment.
2014-04-11 16:15:13 +02:00
Richard W.M. Jones
47ec61e9af listfs: If LDM not available, don't inhibit partition detection (RHBZ#1079182).
If a disk has type 0x42 partition (which would indicate LDM), but LDM
is not available then try parsing the partition anyway.  It might be
parseable as plain old NTFS.
2014-04-09 21:46:01 +01:00
Richard W.M. Jones
97c57a8887 sparsify: Use automake to build and link virt-sparsify binary.
There are two observations which make this possible: (1) virt-sparsify
contains at least one C unit, so automake thinks it is compiling a C
program.  (2) Automake lets us add a *_LINK rule to override linking.

We list the C sources of virt-sparsify as virt_sparsify_SOURCES, so
automake thinks it is building a C program as normal.

We override virt_sparsify_LINK to make it actually link an OCaml
program.

We add virt_sparsify_DEPENDENCIES listing the OCaml objects so that
they get built before linking.

We need a small linker script (link.sh) which adds some options at the
end of the linker command line which are impossible to add using pure
automake.

Inspired by the same idea in supermin:
https://github.com/libguestfs/supermin/blob/master/src/Makefile.am
2014-04-09 21:45:54 +01:00
Pino Toscano
65b8edda0a sysprep: remove ConsoleKit logs 2014-04-09 15:54:54 +02:00
Pino Toscano
54d1f6e611 sysprep: remove the exim logs 2014-04-09 15:54:54 +02:00
Pino Toscano
f7d2738902 sysprep: remove apt and aptitude logs 2014-04-09 15:54:54 +02:00
Pino Toscano
d413c94fa6 sysprep: remove debug, syslog and faillog logs 2014-04-09 15:54:53 +02:00
Pino Toscano
ccf84d7b80 sysprep: remove debian-installer files 2014-04-09 15:54:53 +02:00
Pino Toscano
b08955e76a sysprep: remove the lightdm logs 2014-04-09 15:54:53 +02:00
Pino Toscano
fc9a4221ba sysprep: remove more anaconda configs/logs 2014-04-09 15:54:53 +02:00
Pino Toscano
0c35c3addd sysprep: remove systemd journals 2014-04-09 15:54:53 +02:00
Richard W.M. Jones
ffffe71c16 build: Remove code coverage and code profiling options.
This reverts commit 5a2e320ec9.
2014-04-09 14:51:59 +01:00
Richard W.M. Jones
595bd5022a sparsify: Relax test constraint (RHBZ#1079210).
As long as over ~300MB is recovered, declare sparsification to be
successful in this test.

It looks as if the journal or other metadata takes up a variable
amount of space after sparsification.
2014-04-08 10:05:34 +01:00
Richard W.M. Jones
466885b226 configure: Add message about GNUlib tests.
Output was:

  yes

Now the output is:

  checking if we should run the GNUlib tests... yes
2014-04-07 13:18:34 +01:00
Pino Toscano
f63d827819 customize: add the chmod command
Add the chmod customize command to change the permissions of files.
2014-04-07 09:42:48 +02:00
Richard W.M. Jones
df0d197812 Version 1.27.3. 2014-04-06 16:19:33 +01:00
Richard W.M. Jones
7173883154 recipes: Update the section on installing packages.
Libguestfs >= 1.26 makes this easy.
2014-04-03 20:27:43 +01:00
Richard W.M. Jones
55437e459b mllib: utils: Add mapi function.
This is List.mapi from the stdlib.  RHEL 6 did not have this function.
2014-04-03 17:59:54 +01:00
Richard W.M. Jones
82b486a908 appliance: Avoid touching appliance/supermin.d directory.
We must avoid touching appliance/supermin.d unless it is necessary, so
that we avoid unnecessary rebuilds of the full appliance.
Unfortunately since we created temporary files there, even if we
didn't decide to keep those temporary files they would still end up
touching supermin.d.  To stop this, move the temporary files out.
2014-04-03 17:59:54 +01:00
Pino Toscano
b7ad029536 appliance: exclude pkg-config, doc-base, and reportbug stuff
Exclude the arch-independent pkg-config files (no pkg-config available
in the appliance).

Exclude also the doc-base and reportbug files, typically found in Debian
systems.
2014-04-03 15:26:26 +02:00
Richard W.M. Jones
d268cfd13e builder: Add test of virt-index-validate. 2014-04-03 08:58:46 +01:00
Richard W.M. Jones
358c6571d0 builder: Rearrange EXTRA_DIST in alphabetical order.
No functional change.
2014-04-03 08:45:31 +01:00
Richard W.M. Jones
795a162cee builder: Don't use configure to generate test-index file.
The file contained no replacement patterns so generating it
with configure did nothing.
2014-04-03 08:44:24 +01:00
Pino Toscano
9cbb619db2 builder: better handle some index parsing errors
Add a new lexer token, unused in the grammar, for the unknown lines in
index files; this should allow to better handle such kind of parsing
errors, removing the need to exit() directly (and leave things in an
unclean state).
2014-04-03 08:41:06 +01:00
Richard W.M. Jones
3fa5096f48 customize: Add a "finishing" message at the end.
Useful, mainly because it tells you the total time spent running.
2014-04-02 17:33:37 +01:00
Richard W.M. Jones
8c46a644bc customize: Add customize/*.ml files for translation. 2014-04-02 14:06:38 +01:00
Pino Toscano
84f646a41a src/launch: improve the addition of the no-hpet option
Since HPET is specific to x86, we can safely add it its option only on
x86 and x86_64 when creating the libvirt XML (no more hitting the
launching failures due to that on other architectures).

Regarding the direct qemu launch, since qemu 1.1 (which is our current
minimum) "-ho-hpet" appears in the help only where actually supported,
so we could just checking for it and adding it only if present. This
should fix the architecture issues on this backend as well.
2014-04-01 18:01:19 +02:00
Richard W.M. Jones
b03b3f6f46 sparsify: Reorder external programs in SEE ALSO section. 2014-04-01 14:56:32 +01:00
Richard W.M. Jones
07dff756a7 sparsify: Remove duplicate "EXIT STATUS" sections from man page. 2014-04-01 14:55:20 +01:00
Richard W.M. Jones
c58bef5125 Version 1.27.2. 2014-03-31 18:07:08 +01:00
Richard W.M. Jones
7c1d95cca0 rescue: Fix the --suggest regression test so it works when using UML backend.
The boot partition name is /dev/ubda1 in this case, so use a small sed
script to canonicalize it for the test comparison.

This fixes commit f6a37740f2.
2014-03-31 18:00:07 +01:00
Lee Yarwood
cf31656923 Add the now mandatory arch=ARCH field to the index file examples.
61323fa introduced a mandatory arch field within index files to
identify the architecture of the OS installed within a given template.
This change simply documents the requirement within the relevant
section of the virt-builder man page.

Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
2014-03-31 17:43:27 +01:00
Richard W.M. Jones
4916806bdf Version 1.27.1. 2014-03-31 15:13:16 +01:00
Richard W.M. Jones
957afde13b python: Add README.txt to EXTRA_DIST. 2014-03-31 15:13:16 +01:00
Richard W.M. Jones
0d9a61a91d src: Fix test-utils.c to test the validate_guid function again.
This fixes commit 768ab2e01d.
2014-03-31 14:21:45 +01:00
Richard W.M. Jones
7e39cd4600 Remove internal libvirt_setlinux* APIs and use backend settings instead.
This removes the internal APIs internal_set_libvirt_selinux_label and
internal_set_libvirt_selinux_norelabel_disks.  The communication
between the libvirt domain and the backend now uses the backend
settings.
2014-03-31 14:21:45 +01:00
Richard W.M. Jones
5d4e4e7eca ocaml: Add ESRCH to Guestfs.Errno module. 2014-03-31 14:21:45 +01:00
Richard W.M. Jones
d137ad52c5 New APIs: set-backend-setting, get-backend-setting, clear-backend-setting.
Currently the backend settings are treated as a list of strings.  You
can set the whole list (clearing any strings there previously), but
you cannot search for an individual string or replace an individual
string.

This adds further APIs allowing you to do that.  We treat the backend
settings as a list of environment-like strings (ie.  name=value), and
add the following functions:

 - set-backend-setting (name, value)

   Set name=value.  Any previous settings of name are cleared.

 - get-backend-setting (name)

   Search for name or name=value and return the value.

 - clear-backend-setting (name)

   Remove any name or name=value settings.

This also adds a regression test.
2014-03-31 13:33:53 +01:00
Richard W.M. Jones
1893eaded0 handle: Free g->backend_settings.
This was not being freed, resulting in a memory leak if you used
LIBGUESTFS_BACKEND_SETTINGS.

Found by valgrind.
2014-03-31 13:33:53 +01:00
Richard W.M. Jones
6af2306730 python: Remove unnecessary library dependencies.
We can remove the deps on libxml2, libvirt and gnulib, by only linking
with utils.o (instead of utils.a).
2014-03-29 18:52:32 +00:00
Richard W.M. Jones
fcbfc4775f python: Add a Python setup.py script.
This is not used by libguestfs right now, but it does allow you to
build a python "distribution" of libguestfs, like this:

  make -C python sdist

The distribution tarball will be in python/dist/

You can copy the distribution tarball somewhere, unpack it, and use
regular 'python setup.py' commands such as:

  python setup.py build
  python setup.py install [--prefix=...]
  python setup.py --name

In future we hope to be able to upload the distribution tarball to
PyPi, but licensing issues prevent this at present.
2014-03-29 17:36:16 +00:00
Richard W.M. Jones
768ab2e01d utils: Move guestfs___validate_guid out of utils.c.
guestfs___validate_guid was a new function added to utils.c in
commit beef77403c.

However utils.c should not include <guestfs-internal.h> since the
other functions in this file can be used by all front-end code, not
just libguestfs.so.

This function is only needed in libguestfs.so, so move it to another
source file, and remove include of <guestfs-internal.h> from utils.c.

Also: use 'size_t' for counting, not 'int'.

This fixes commit beef77403c.
2014-03-29 17:12:47 +00:00
Richard W.M. Jones
bc1a415794 utils: Remove for-loop variable decl.
Breaks Python distutils which doesn't use C99:

utils.c: In function ‘guestfs___copy_string_list’:
utils.c:79:7: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for (size_t j = 0; j < i; ++j)
       ^
utils.c:79:7: note: use option -std=c99 or -std=gnu99 to compile your code
2014-03-29 17:12:47 +00:00
Richard W.M. Jones
ebda77b647 virt-builder: Add --machine-readable option, as in virt-resize and virt-sparsify.
This makes it easier to query the virt-builder binary capabilities,
from external programs.
2014-03-29 15:09:19 +00:00
Richard W.M. Jones
30bdadf032 builder: Disable internal parallel xzcat on RHEL 6. 2014-03-29 14:55:01 +00:00
Richard W.M. Jones
eff7aed6cf builder: Remove recursive include of index-parse.h.
This breaks on Bison < 2.7, and seems unnecessary in any case since
the same file is included earlier.
2014-03-29 14:47:28 +00:00
Richard W.M. Jones
f6a37740f2 rescue: Add a regression test for virt-rescue --suggest option. 2014-03-28 14:38:06 +00:00
Richard W.M. Jones
c8657535fd rescue: Don't leak various variables when using --suggest option with multi-boot guests.
This fixes a leak which was introduced in
commit 4255db65e5.

Found by Coverity.
2014-03-28 14:37:58 +00:00
Richard W.M. Jones
15b06d6100 make-fs: Close FILE* along error path.
Found by Coverity.
2014-03-28 14:01:19 +00:00
Richard W.M. Jones
410aae4b6f make-fs: Check for error return from guestfs_statvfs.
Found by Coverity.
2014-03-28 13:59:56 +00:00
Richard W.M. Jones
4cea94a958 daemon: parted: part-get-name: Don't leak partition type string.
Found by './configure --enable-valgrind-daemon'.

This fixes commit 820b870167.
2014-03-28 12:35:25 +00:00
Richard W.M. Jones
a7a239f7ab builder: Use libgnu.la instead of -lgnu.
This updates commit effcb99f83.
2014-03-28 09:57:07 +00:00
Olaf Hering
effcb99f83 builder: Link virt-index-validate with gnulib.
[Gnulib tries to replace getopt because of the bug shown below.
However because -lgnu was not used in the Makefile, the replacement
failed. -- RWMJ]

from config.log:

             /* This code dumps core on glibc 2.14.  */
             {
               static char program[] = "program";
               static char w[] = "-W";
               static char dummy[] = "dummy";
               char *argv[] = { program, w, dummy, NULL };
               optind = opterr = 1;
               if (getopt (3, argv, "W;") != 'W')
                 result |= 64;
             }

gdb --quiet --readnow ./conftest -ex r -ex bt -ex detach -ex q
Reading symbols from /usr/src/packages/BUILD/libguestfs-1.26.0/conftest...expanding to full symbols...done.
Starting program: /usr/src/packages/BUILD/libguestfs-1.26.0/conftest
Missing separate debuginfo for /lib64/ld-linux-x86-64.so.2
Try: zypper install -C "debuginfo(build-id)=5d1a12e6f0e95331cc4e39df74ecbd5adb76a1f7"
Missing separate debuginfo for /lib64/libc.so.6
Try: zypper install -C "debuginfo(build-id)=a06caa12df8f953a453befa827c3145adaf6269a"
main(323) result 0
main(344) result 0
main(357) result 0
main(370) result 0

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b2dbf8 in _getopt_internal_r () from /lib64/libc.so.6
Detaching from program: /usr/src/packages/BUILD/libguestfs-1.26.0/conftest, process 31042

This change actually fixes build for me on sles11sp3 and 11.4.
2014-03-28 09:53:39 +00:00
Richard W.M. Jones
a78cd210c3 Version 1.27.0. 2014-03-27 15:47:16 +00:00
Richard W.M. Jones
996eca5da7 Version 1.26.0.
New stable version.
2014-03-27 12:04:44 +00:00
Richard W.M. Jones
a20e368fea fish: Check return values from a couple of API calls.
Found by Coverity.
2014-03-27 11:34:40 +00:00
Richard W.M. Jones
be250948bc fish: Ignore return value from guestfs_user_cancel.
As we are in a signal handler, there's nothing else we can do.

Found by Coverity.
2014-03-27 11:34:05 +00:00
Richard W.M. Jones
4099880643 examples: Check return value from guestfs_list_filesystems.
Found by Coverity.
2014-03-26 20:25:05 +00:00
Richard W.M. Jones
7792278e05 virt-diff: Free memory along error path.
Found by Coverity.
2014-03-26 20:23:19 +00:00
Richard W.M. Jones
8da50e5a3f daemon: md: Whitespace fix. 2014-03-26 20:08:36 +00:00
Richard W.M. Jones
4caa2ea5ff daemon: ldm: Initialize glob_t struct before passing to glob.
Some implementations of glob might use fields in the struct, although
not glibc as far as I know.

Issue identified by Coverity.
2014-03-26 20:07:43 +00:00
Richard W.M. Jones
fe97d5ed9c builder: pxzcat: Ignore return value from posix_fadvise.
Quiets warning from Coverity.
2014-03-26 20:03:15 +00:00
Richard W.M. Jones
21390bc4aa Pull latest translations from Transifex. 2014-03-26 16:53:37 +00:00
Richard W.M. Jones
f566f176c6 Remove the ROADMAP file.
I don't think it provides any value now.  There is a list of bugs in
'BUGS' and a set of ideas in 'TODO'.
2014-03-26 16:48:37 +00:00
Richard W.M. Jones
0febb59afa Final updates to release notes for 1.26. 2014-03-26 13:35:05 +00:00
Richard W.M. Jones
a9b62321b6 Version 1.25.49. 2014-03-26 10:28:36 +00:00
Richard W.M. Jones
90973755b2 customize: Use --no-network flag so test works under UML. 2014-03-26 10:21:38 +00:00
Richard W.M. Jones
63f0ee9c57 Version 1.25.48. 2014-03-26 00:05:45 +00:00
Richard W.M. Jones
218ac6996b Further updates to the release notes, for 1.26. 2014-03-25 23:53:11 +00:00
Richard W.M. Jones
36f4f10581 Further updates to release notes, for 1.26. 2014-03-25 23:31:39 +00:00
Richard W.M. Jones
cec31436f8 customize: Rename main.ml to customize_main.ml.
The OCaml compiler isn't happy when two modules have the same name in
different directories.  Since customize/ contains a library of modules
used in other directories, and since those directories may have
main.ml files too, we need to rename 'customize/main.ml' to
'customize/customize_main.ml'.
2014-03-25 22:41:19 +00:00
Richard W.M. Jones
1a4709147a customize: Add various options from virt-builder.
This adds the following options to virt-customize:

  --attach
  --attach-format
  -m / --memsize
  --network / --no-network
  --smp

This fixes commit 2b208d84db.
2014-03-25 22:21:40 +00:00
Richard W.M. Jones
87fcb4df03 Add customize subdirectory to ./run script.
This fixes commit 2b208d84db.
2014-03-25 22:09:14 +00:00
Richard W.M. Jones
36f179fdfa Begin working on release notes for libguestfs 1.26 release. 2014-03-25 16:06:25 +00:00
Richard W.M. Jones
a70dd85a17 aarch64: Use -M virt to specify virtual machine type.
Thanks: Paolo Bonzini
2014-03-25 14:54:40 +00:00
Richard W.M. Jones
d6072de4ff arm: Replace #ifdef with #if defined, etc.
No functional change.
2014-03-25 13:46:13 +00:00
Richard W.M. Jones
afb74f104d aarch64: Cannot emulate IDE, like all non-PC. 2014-03-25 13:46:13 +00:00
Richard W.M. Jones
219c2ddf1b aarch64: This has no working hpet emulation, like ARM 32 bit. 2014-03-25 13:46:13 +00:00
Richard W.M. Jones
f8c83e801a aarch64: This has no PCI, like ARM 32 bit. 2014-03-25 13:46:13 +00:00
Richard W.M. Jones
d396ccb470 Open release notes for 1.26 release. 2014-03-25 13:11:45 +00:00
Richard W.M. Jones
40cac10b62 Update TODO with Python bindings suggestion. 2014-03-25 13:11:45 +00:00
Richard W.M. Jones
3d79c51a28 Update API support. 2014-03-25 13:11:23 +00:00
Richard W.M. Jones
7ad1683dae Version 1.25.47. 2014-03-25 12:51:25 +00:00
Richard W.M. Jones
2b208d84db Add virt-customize standalone tool.
This includes some simple tests and a manual page.
2014-03-25 12:41:04 +00:00
Richard W.M. Jones
aa3bc8b65d sysprep: Remove the --autorelabel (and related) options.
The customize module includes an --selinux-label option which can run
'fixfiles restore' (on most SELinux guests) or set /.autorelabel (on
some older ones).

Commit 49014f81f3 renamed the old
--selinux-label option to --autorelabel, but note this was not
included in a stable version of libguestfs.

Note this change leaves a bunch of now redundant code for detecting if
we created a new file in the guest.
2014-03-25 12:41:04 +00:00
Richard W.M. Jones
ae6f726ecc sysprep: Use customize module for customizing the guest after sysprepping.
Note this removes the following modules (all replaced by 'customize'):

 - delete       [--delete, --scrub]
 - firstboot    [--firstboot]
 - hostname     [--hostname]
 - password     [--password, --password-crypto, --root-password]
 - random-seed
 - timezone     [--timezone]
2014-03-25 12:41:04 +00:00
Richard W.M. Jones
51834ad219 customize: Add a --password option for setting user passwords. 2014-03-25 12:41:04 +00:00
Richard W.M. Jones
4b0b3589e8 customize: Move virt-customize-related code to a separate directory.
Split virt-builder into build and customize steps, so that we can spin
off a separate tool called 'virt-customize'.  This commit does not in
fact create such a tool, but it moves all the common code into a
library, in the customize/ subdirectory of the source.

Although this is mostly refactoring, it does change the order in which
virt-builder command line arguments are processed, so they are now
processed in the order they appear, not the inflexible fixed order
used before.
2014-03-25 12:41:04 +00:00
Richard W.M. Jones
8e386fc1be sysprep: Pass debug and quiet flags to all modules.
Also use the Common_utils.make_message_function function to print
messages (same as virt-builder).
2014-03-25 12:41:04 +00:00
Richard W.M. Jones
1edfdcbd58 sysprep: Allow order of operations to be specified by modules. 2014-03-25 12:41:04 +00:00
Richard W.M. Jones
f450fb4106 sysprep: Perform operations in alphabetical order.
Previously we ran them in essentially a random order, although it
might have looked alphabetical in some cases because the modules are
loaded in order.
2014-03-25 12:41:04 +00:00
Hilko Bengen
4a9581668c appliance: Not all of Grub is needed, only grub-install 2014-03-25 12:01:00 +01:00
Richard W.M. Jones
0116a482fc Update gnulib to latest.
Includes a fix for the missing 'git-log-fix' file.
https://lists.gnu.org/archive/html/bug-gnulib/2014-03/threads.html#00019
2014-03-25 10:47:53 +00:00
Pino Toscano
f80fc724bc php: raise the per-test timeout to 300 secs
Some tests might spawn an appliance, which will take time on slower
architectures and on some virtualized environments.
Hence raise the per-test timeout from the default of 60s to 300s (which
should be hopefully enough for now).
2014-03-24 17:05:14 +01:00
Pino Toscano
483f0e3096 virt-sparsify --in-place: remove image if discard is not supported
No point leaving it around if the test has been skipped.
2014-03-24 17:05:14 +01:00
Richard W.M. Jones
08234a1c48 po-docs: Do not translate "__AVAILABILITY__" placeholder.
This fixes commit da122e382f.
2014-03-24 14:19:32 +00:00
Pino Toscano
ad2c6a13b3 docs: remove customize-related files
The work on them has not been committed yet.
2014-03-24 15:13:13 +01:00
Richard W.M. Jones
da5b8b6d61 appliance: Fix quoting so that DEBIAN isn't always defined.
Because of incorrect quoting previously, the DEBIAN symbol
was always defined.
2014-03-23 21:56:29 +00:00
Richard W.M. Jones
07bf740238 Update gnulib to latest version. 2014-03-23 19:40:44 +00:00
Richard W.M. Jones
26599da373 ocaml: Enable parallel builds.
Commit f75142c577 disabled parallel
builds in the ocaml subdirectory (which was the correct thing to do).
This made building the OCaml tests in particular very slow.  Therefore
fix things so that parallel builds can be used again.

See also discussion here about different approaches:

https://www.redhat.com/archives/libguestfs/2014-March/thread.html#00223

This reintroduces commit dce94f3e26.
2014-03-23 18:35:35 +00:00
Richard W.M. Jones
da122e382f Update Ukrainian translations.
Contributed by: Yuri Chornoivan (via Transifex)
2014-03-23 12:59:18 +00:00
Richard W.M. Jones
f42769f94b virt-make-fs: Fix typo in error string.
Thanks: Yuri Chornoivan
2014-03-23 12:09:01 +00:00
Richard W.M. Jones
20f412637e builder: Fix typo in string.
Thanks: Yuri Chornoivan
2014-03-22 14:08:45 +00:00
Pino Toscano
e589b6e823 builder: do not parse the same repository file name twice
When parsing the repository configuration files, track the file names
parsed, and in case of same file name in multiple location consider only
the one in the directory coming before others in the prioritised list of
paths.

This way it is possible to "shadow" a configuration file in a system
path with one with the same name in a local directory, for example.
2014-03-20 16:57:29 +01:00
Pino Toscano
603ad40c5a builder: allow the index parser to parse files with no sections
Gracefully handle files with no sections; extend the validate.sh test
to try to validate an empty file.
2014-03-20 16:39:40 +01:00
Pino Toscano
fa0fed8a2d builder: allow to run website tests under valgrind 2014-03-20 16:39:40 +01:00
Richard W.M. Jones
37ed019f53 Version 1.25.46. 2014-03-20 15:28:57 +00:00
Richard W.M. Jones
4edf659aa0 php: Include new location of tests in EXTRA_DIST.
This fixes commit 251a1934c9.
2014-03-20 15:24:34 +00:00
Pino Toscano
62875c88be builder: clean the parsing structs on error 2014-03-20 15:36:38 +01:00
Pino Toscano
c6c27620d0 builder: rename and make public the section/field free functions
They will be needed also elsewhere.
2014-03-20 15:36:38 +01:00
Pino Toscano
87ed6365e4 builder/virt-index-validate: try to cleanup in any occasion
Always close the file (ignoring its result) after a parsing, and cleanup
the parse_context object before any exit().

This eases the debugging of memory issues in the actual parser.
2014-03-20 15:36:38 +01:00
Richard W.M. Jones
c7639495d7 Revert "appliance: Remove genisoimage from packagelist."
This reverts commit cd996642e0.

The daemon uses 'isoinfo' which is part of this package.

Thanks: Pino Toscano.
2014-03-20 14:34:58 +00:00
Richard W.M. Jones
cd996642e0 appliance: Remove genisoimage from packagelist.
It is not used by the daemon as far as I can tell.
2014-03-20 13:49:19 +00:00
Richard W.M. Jones
c4dc70f8c4 podwrapper: Remove =encoding from input files and add it back in podwrapper.
This changes podwrapper so that the input (POD) files should not
contain an =encoding directive.  However they must be UTF-8.
Podwrapper then adds the '=encoding utf8' directive back during final
generation.

This in particular avoids problems with nested =encoding directives in
fragments.  These break POD, and are undesirable anyway.
2014-03-20 13:47:19 +00:00
Richard W.M. Jones
ad33a5434c po-docs: Filter the po4a warning and =encoding line. 2014-03-20 13:47:11 +00:00
Richard W.M. Jones
420d324555 po-docs: There are no *.pl files in the po-docs subdirectories any longer. 2014-03-20 13:47:00 +00:00
Richard W.M. Jones
01548fd5b7 generator: Generate copyright notice in generated POD fragments.
Using =begin comment ... =end comment.
2014-03-20 13:46:53 +00:00
Richard W.M. Jones
d4129988c1 podwrapper: Give an error if an --insert or --verbatim pattern is not found in the input. 2014-03-20 13:46:45 +00:00
Pino Toscano
121c2894bc tests/run-xml-to-junit.xsl: allow to define a different classname
Read and use the classname attribute in each test if present, falling
back to "TestSuite" (used so far).
2014-03-19 18:30:58 +01:00
Pino Toscano
7c70429e2e builder: show the application name in errors of the index parser 2014-03-19 16:48:20 +01:00
Pino Toscano
15f04f21b9 builder: show the file name in errors of the index parser 2014-03-19 16:14:34 +01:00
Pino Toscano
c871ed6b50 builder: make the C index parser reentrant
Switch the lex/yacc parser into reentrant mode, to ease the handling of
parsing-specific data; introduce a new parser_context struct for that,
which is added as extra data to the parser.

This should cause no behaviour changes in the parsing, just no more
global variables used for getting data in/out the parser.
2014-03-19 15:42:45 +01:00
Pino Toscano
251a1934c9 php: move tests under a tests subdirectory
This eases fixes the classname in the junit output of run-tests.php,
which now can be properly handled by junit XML consumers.
2014-03-18 15:12:26 +01:00
Pino Toscano
7fb823e427 php: make the test suite failures fatal
So far the failure of some test would have not reported a non-zero
return value by run-tests.php. Since now all the PHP tests pass, we can
ask for failures to be fatal, by exporting REPORT_EXIT_STATUS=1 for
run-tests.php.
2014-03-18 14:38:02 +01:00
Richard W.M. Jones
d521f7c2e3 build: Disable a couple more ineffective warnings. 2014-03-17 21:05:18 +00:00
Richard W.M. Jones
19dcc0de1f Annual scavange to find mixed declarations and statements.
Hopefully this is just code motion.
2014-03-17 19:54:16 +00:00
Richard W.M. Jones
6035c764e6 build: Remove -Wno-declaration-after-statement.
We have generally forbidden declaration-after-statement in our code
(although there are plenty of places that do it).  In any case this
warning is not in the default set, so we don't need to turn off the
warning.
2014-03-17 19:50:37 +00:00
Richard W.M. Jones
931aec5b88 virt-sparsify --in-place: Exit with code 3 if discard is not supported.
Also skip the test in this case instead of failing.
2014-03-17 12:36:43 +00:00
Richard W.M. Jones
5e1fc4640d mllib: Allow exit code to be specified when calling 'error' function. 2014-03-17 12:22:50 +00:00
Richard W.M. Jones
6e99530ea8 launch: Return errno == ENOTSUP if discard is not supported. 2014-03-17 12:22:50 +00:00
Richard W.M. Jones
0563405d2e ocaml: Add Guestfs.Errno submodule exposing useful raw errno numbers.
For use when calling G.last_errno.
2014-03-17 12:22:50 +00:00
Richard W.M. Jones
996c0a2868 Version 1.25.45. 2014-03-16 22:55:52 +00:00
Richard W.M. Jones
455ccc15c3 Add tests/run-xml-to-junit.* to EXTRA_DIST. 2014-03-16 22:55:24 +00:00
Richard W.M. Jones
7fe365eee6 tests/regressions/rhbz895904.sh: Rewrite without multi-line expression.
RHEL 6-era bash cannot handle the multi-line $(...) expression in the
original code.  Rewrite the test so it is semantically the same but
doesn't have the expression that old bash can't handle.
2014-03-16 22:45:30 +00:00
Richard W.M. Jones
93335b5c4a appliance: init: Remove unnecessary comment, whitespace changes. 2014-03-15 15:46:54 +00:00
Richard W.M. Jones
bae2134aef tests/discard: sync before close isn't necessary.
However we should be calling shutdown, since we're writing to the disk
and need to catch qemu errors.
2014-03-14 13:20:22 +00:00
Richard W.M. Jones
d46ceea601 tests: fstrim: Sync before running fstrim.
This makes fstrim work.  It's not clear why exactly.

Thanks: Paolo Bonzini.
2014-03-14 13:19:42 +00:00
Richard W.M. Jones
55730f6118 Revert "tests: fstrim: Remount the disk."
This reverts commit accf1b66aa.
2014-03-14 13:19:42 +00:00
Pino Toscano
56efdb29bf tests: skip the output of test-virt-rescue.pl from RUN_OUTPUT_FILE
The output of test-virt-rescue.pl contains non-ASCII chars which give
troubles when being XSLT-transformed, so just avoid its output to leave
the rest of the resulting XML well-formed.
2014-03-14 13:52:09 +01:00
Pino Toscano
38fbda9d37 tests: provide a simple way to extract the tests data from run
If the RUN_OUTPUT_FILE environment variable is set, "run" will output
to the file indicated by that snippets of XML with the results and
outputs of the tests run.

Together with the run-xml-to-junit.sh (and its associated
run-xml-to-junit.xsl style sheet) it is possible to convert that output
file to a jUnit-like XML file, which could be used in CI systems.
2014-03-14 13:52:09 +01:00
Richard W.M. Jones
accf1b66aa tests: fstrim: Remount the disk.
This makes fstrim work.  It's not clear why exactly.
2014-03-14 10:09:47 +00:00
Richard W.M. Jones
9b883d3c3e tests/discard: Ensure a significant number of blocks are freed up on the host.
It's reasonable to expect megabytes will be freed up and given back to
the host.  Previously we just tested that at least 1 block was
released.  This test checks that at least 1000 blocks are released
(since stat(2) returns blocks of 512 bytes: 512 bytes * 1000 = approx 0.5 MB).
2014-03-14 09:42:31 +00:00
Richard W.M. Jones
8584c8cadf gobject: Don't ignore old generated files.
This was ignoring an old generated file (gobject/guestfs-gobject.h)
which, if still around, would break the build.
2014-03-13 13:51:21 +00:00
Richard W.M. Jones
b96dfa60d3 gitignore: appliance: Don't ignore some files which are now obsolete and should be removed. 2014-03-13 13:01:14 +00:00
Richard W.M. Jones
bd226af94b Version 1.25.44. 2014-03-13 10:57:47 +00:00
Pino Toscano
083203c635 php: fix crash with OStringList optional arguments
Properly initialize the variables for them to NULL, so there is no crash
because of trying to use rubbish pointers.

Kind of followup of commit 289fd29f0b.
2014-03-13 11:43:25 +01:00
Pino Toscano
e411cf8269 php: remove the custom "env" loading in tests
Other than being too late for changing environment variables like
LD_LIBRARY_PATH, now it is no more needed.
2014-03-13 11:43:24 +01:00
Pino Toscano
5fbbfe7440 php: add a custom PHP runner for tests
Since the default PHP test runner ignores a good number of environment
variables to potentially tampering the test suite execution, create a
custom php-for-tests.sh script which does nothing more than sourcing the
custom environment that our run-php-tests.sh outputs and running the
actual "php" executable (the one found by configure).

This fixes the loading of the guestfs_php.so module in the test suite,
as the libguestfs.so.0 library can be found by that module.
2014-03-13 11:43:24 +01:00
Richard W.M. Jones
04aaa6ddfc appliance: Fix 'make clean' in appliance subdirectory.
Commit 71dfd73042 broke 'make clean' in
the appliance subdirectory, so it would remove all the supermin.d/*
files, but without removing stamp-supermin so you couldn't rebuild
supermin.d/ with a 'make' afterwards.

In any case, 'make clean' is not supposed to delete the appliance
(which is expensive to rebuild).

Fix this so that 'make clean' doesn't remove supermin.d/* files.
'make distclean' can be used to delete this, and since it also removes
stamp-supermin, it will be recreated properly by 'make'.
2014-03-13 10:38:41 +00:00
Richard W.M. Jones
a13109c260 FAQ: Make issues which will be fixed in libguestfs >= 1.26 / supermin >= 5. 2014-03-13 10:38:41 +00:00
Richard W.M. Jones
8df1c47269 FAQ: Remove section that only applied to obsolete Fedora & RHEL releases.
Since this is fixed in all currently supported versions of Fedora
& RHEL, there's no need to document the problem in the FAQ.
2014-03-13 10:38:40 +00:00
Richard W.M. Jones
80d77e934f FAQ: Document virt-sparsify >= 1.26 can do in-place sparsification. 2014-03-13 10:38:40 +00:00
Richard W.M. Jones
b7cec3e8f4 sparsify: Add a test of the virt-sparsify --in-place option. 2014-03-13 10:38:40 +00:00
Richard W.M. Jones
e3a32f95d0 sparsify: Add virt-sparsify --in-place mode. 2014-03-13 10:38:40 +00:00
Richard W.M. Jones
b48e885004 sysprep: Add disks with discard = "besteffort".
Since virt-sysprep tends to delete a lot of files, adding discard
support to it makes some sense.

Note that this probably won't have any effect for most filesystems
since:

(a) ext4 mounts also need to use -o discard,

(b) ext4, and maybe others, require you to call fstrim explicitly,
they don't discard automatically (except for userspace tools like
mkfs.ext4 but that doesn't apply in this case).
2014-03-13 10:38:40 +00:00
Richard W.M. Jones
fb3afdff47 virt-format: Discard the data on the disks.
If possible, this means that the host will be able to reclaim most of
the space used by formatted disks.
2014-03-13 10:38:40 +00:00
Richard W.M. Jones
93f1bfcad7 Pass discard parameter from add-domain to add-drive.
Allow callers to specify that all the disks from a domain are added
with a specific discard mode (instead of always having discard
disabled).
2014-03-13 10:38:40 +00:00
Richard W.M. Jones
3106789d81 Pass cachemode parameter from add-domain to add-drive.
Allow callers to specify that all the disks from a domain are added
with a specific cachemode (instead of always having to use the
default, writeback).
2014-03-13 10:38:40 +00:00
Richard W.M. Jones
a9fc09366a tests: Add tests of discard support.
Test that blkdiscard, -o discard, and fstrim work in reality, end-to-end.
2014-03-13 10:38:40 +00:00
Richard W.M. Jones
b408419791 New API: blkdiscardzeroes - do discarded blocks read back as zeroes? 2014-03-13 10:38:40 +00:00
Richard W.M. Jones
452b228b46 New API: blkdiscard - discard all blocks on a block device. 2014-03-13 10:38:40 +00:00
Richard W.M. Jones
499b9ee416 New API parameter: Add discard parameter to guestfs_add_drive_opts.
This adds a discard parameter to guestfs_add_drive_opts which
approximately maps to the discard=ignore|unmap parameter supported by
qemu.

If discard is set to "enable" then we force discard=unmap (and try to
fail if it is not possible).  If discard is set to the more useful
"besteffort" option, then we enable discard if possible.  The default
is "disable".
2014-03-13 10:38:40 +00:00
Pino Toscano
53afa03af9 builder: fix typo in comment
Followup of commit b1cf6246f3.
2014-03-12 16:07:55 +01:00
Richard W.M. Jones
2489692067 sparsify: Move copying-mode code to a separate file.
This is just code motion.
2014-03-12 14:21:30 +00:00
Richard W.M. Jones
a665a570a3 sparsify: Refactor command line parsing to pass back a mode.
This is just code motion, but sets the ground-work for adding a second
mode (in-place image modification).
2014-03-12 14:21:30 +00:00
Richard W.M. Jones
63e836881e sparsify: Move command line parsing code to separate file.
This is just code motion.
2014-03-12 14:21:30 +00:00
Richard W.M. Jones
d263a301bf sparsify: Remove unused 'open' directive. 2014-03-12 14:21:30 +00:00
Richard W.M. Jones
8df13884df sparsify: Capture any exceptions and display nicer error messages.
This is just code motion, there is no functional change.
2014-03-12 14:21:30 +00:00
Richard W.M. Jones
073f90e681 sparsify: Remove unused variable definition. 2014-03-12 14:21:30 +00:00
Richard W.M. Jones
2b4baf3478 launch: libvirt: Move the is_kvm flag (derived from libvirt capabilities) to backend data struct.
This is just rearranging the data between structs.  There should be no
functional change.
2014-03-12 14:08:22 +00:00
Richard W.M. Jones
5e105e06be daemon: fstrim: Fix fstrim so it trims the correct filesystem.
We didn't call sysroot_path, so it was trimming the appliance instead
of the guest filesystem.
2014-03-12 14:08:22 +00:00
Richard W.M. Jones
46e30c1f7c daemon: fstrim: When debugging, capture and print fstrim -v output. 2014-03-12 14:08:22 +00:00
Pino Toscano
b1cf6246f3 builder: complete architecture handling
Add the possibility to choose which architecture use to build the wanted
image (--arch). Since this implies that running commands on the guest is
usually not possible when the architecture is different than the host
one, virt-builder will nevertheless try to check whether the host is
compatible with the guest, allowing to run commands only in that case.

The caching scheme is adapted to account for the architecture (with
--print-cache showing the architecture as well).
2014-03-12 15:06:55 +01:00
Pino Toscano
cc495247f2 builder: show the architecture in the short --list output
Just like the other --list output formats provide the architecture, show
them also in the short format.
2014-03-12 15:05:24 +01:00
Pino Toscano
7942cbf537 drivers: group drive creation params in an own struct
Group together all the various parameters (except the guestfs handle)
passed to the create_drive_*, to avoid passing all of them at every
function call.

This is mostly an internal refatoring with no behaviour change.
2014-03-12 15:03:56 +01:00
Richard W.M. Jones
013ed9f94b appliance: Cosmetic rearrangement of supermin.d/* targets.
No functional change.
2014-03-11 22:40:22 +00:00
Richard W.M. Jones
71dfd73042 appliance: Don't rebuild everything if just the daemon changes. 2014-03-11 22:38:23 +00:00
Pino Toscano
72d1a6335e builder: add languages.ml to POTFILES-ml
Followup of commit 3cffc28834.
2014-03-11 15:57:35 +01:00
Pino Toscano
6379c85d1f builder: output translated notes also in --notes 2014-03-11 14:25:39 +01:00
Pino Toscano
3cffc28834 builder: move some language-related code into a Languages module
Mostly code motion, no behaviour changes.
2014-03-11 14:20:22 +01:00
Pino Toscano
8ba31e69dc builder: use Filename.check_suffix
... instead of manually extracting and checking the suffix by ourselves
2014-03-10 13:42:16 +01:00
Richard W.M. Jones
596955c1b5 Version 1.25.43. 2014-03-08 12:57:23 +00:00
Richard W.M. Jones
29440e2fbc java: Complete test suite. 2014-03-08 12:47:44 +00:00
Richard W.M. Jones
6fa9e5dac7 java: Document how to compile and run Java programs. 2014-03-08 12:29:00 +00:00
Richard W.M. Jones
2b3131cf40 java: Document how to use optional parameters in the guestfs-java(3) man page. 2014-03-08 12:13:46 +00:00
Richard W.M. Jones
1ba2e3e14a java: Add regression test for RStruct/RStructList (RHBZ#1073906). 2014-03-07 15:53:59 +00:00
Richard W.M. Jones
ebf8a3654a bindtests: Fill in all fields in dummy lvm_pv struct.
Used for testing RStruct/RStructList return values, but only
in GObject and Java bindings.
2014-03-07 15:53:59 +00:00
Richard W.M. Jones
dff35285e4 java: Use correct Set*Field JNI accessors to set fields of the appropriate type.
Using the wrong accessors (somehow - I have no idea how) caused other
fields in the struct to contain incorrect values.
2014-03-07 15:53:59 +00:00
Richard W.M. Jones
7a0e71f733 java: Factor out common field code in RStructList.
No functional change.
2014-03-07 15:53:59 +00:00
Richard W.M. Jones
8c219636a2 java: Split long lines in generated output, and add other whitespace.
No functional change.
2014-03-07 15:53:59 +00:00
Richard W.M. Jones
d00840d727 java: Fix bogus construction of all RStructList returned values (RHBZ#1073906).
Thanks Maarten on IRC for spotting the problem.
2014-03-07 15:53:59 +00:00
Richard W.M. Jones
6aa64ee3a3 java: run: Add java/.libs to LD_LIBRARY_PATH so JVM finds the right JNI file. 2014-03-07 15:53:59 +00:00
Hilko Bengen
16954981e2 Allow gnulib tests to be disabled.
RWMJ:

 - Patch taken from Debian downstream package.

 - The default in the original patch was to disable the tests.  I have
   changed this to default to enable them instead.

 - Removed AC_SUBST as the variable was not being used.
2014-03-07 15:53:48 +00:00
Richard W.M. Jones
96f6a8f57c Version 1.25.42. 2014-03-06 15:59:35 +00:00
Hilko Bengen
e1fdc43539 Remove two more files that are generated by configure 2014-03-05 18:31:02 +01:00
Richard W.M. Jones
5213d7b960 tests/md: Remove bogus test skip which tried to appliance hostfiles.
This file no longer exists since supermin >= 5.

Bug identified by Pino Toscano.
2014-03-05 16:13:49 +00:00
Hilko Bengen
bdcc37b888 Debian: Add systemd-related libraries (for guestfsd) to packagelist 2014-03-04 19:17:40 +01:00
Hilko Bengen
7c21e129c9 Do not ship test-qemu-drive-libvirt.xml with tarball as it is generated by configure 2014-03-04 18:56:07 +01:00
Hilko Bengen
b30e2cf122 Fix out-of-tree build: Do not accidentally build mllib components in srcdir 2014-03-04 00:06:09 +01:00
Hilko Bengen
d7e3aea7bc Fixes for various tests in out-of-tree builds 2014-03-04 00:06:09 +01:00
Hilko Bengen
0048b5dc32 Fix out-of-tree appliance build 2014-03-04 00:06:09 +01:00
Hilko Bengen
876983365a More fixes for situations where ocamlopt is not available
- run bindtests.opt only if available
- use ocamlc -custom
- Don't try to install native code if it hasn't been built (Thanks to Olaf Hering)
2014-03-04 00:06:07 +01:00
Richard W.M. Jones
0b285e07a0 Version 1.25.41. 2014-03-03 22:06:58 +00:00
Richard W.M. Jones
e87e377cfb appliance: Ensure that supermin.d directory is installed properly.
Commit 0a966727ab had a missing
backslash in the list of files, so that 'make install' didn't install
all the files.
2014-03-03 21:58:42 +00:00
Richard W.M. Jones
3acb4343ea Version 1.25.40. 2014-03-03 17:22:06 +00:00
Richard W.M. Jones
d37dd9b055 Add new logo to EXTRA_DIST.
This fixes commit d73531a0aa.
2014-03-03 17:22:06 +00:00
Richard W.M. Jones
0a966727ab appliance: Remove conditionals in appliance/Makefile.am.
If appliance is disabled, the whole appliance/ subdirectory is
skipped.

If appliance is enabled, we can assume that the daemon is enabled too
(see previous commit) so we don't need the conditional code.  That
conditional code didn't work since the supermin 5 rewrite.
2014-03-03 17:12:13 +00:00
Richard W.M. Jones
a6d72be984 build: Don't allow --disable-daemon and --enable-appliance together.
This makes no sense, since the daemon is contained in the appliance so
you cannot build a (meaningful) appliance without having a daemon.
2014-03-03 17:12:13 +00:00
Pino Toscano
631c7d9241 builder: install a $sysconfdir/virt-builder -> xdg-virt-builder symlink
This way "virt-builder" appears directly in the sysconfdir.
2014-03-03 16:28:14 +01:00
Pino Toscano
6a5052a409 run: add the builddir of inspector to $PATH 2014-03-03 14:25:12 +01:00
Hilko Bengen
31b16a9dda Debian: Strip Lintian overrides, initramfs-related stuff from appliance 2014-03-03 13:18:17 +00:00
Bastien ROUCARIÈS
7adc60d955 remove last trace of ntfsprogs 2014-03-03 13:18:17 +00:00
Hilko Bengen
2b4e2eb97d Fix for systemd-based Debian systems 2014-03-03 13:18:17 +00:00
Richard W.M. Jones
e0124b9a91 logo: Make the 5 years text larger and more readable for website.
This fixes commit d73531a0aa.
2014-03-03 12:19:06 +00:00
Richard W.M. Jones
d73531a0aa logo: Add fish logo with 5 years star. 2014-03-03 11:55:24 +00:00
Richard W.M. Jones
b88f98849a appliance: Cosmetic change to the order of command line arguments of 'supermin'. 2014-03-03 11:55:24 +00:00
Richard W.M. Jones
49209b3f96 Version 1.25.39. 2014-03-01 16:26:12 +00:00
Richard W.M. Jones
0c4fae7cb3 configure: supermin should be listed as AC_PATH_PROG, since it is used at run time.
See top of configure.ac:

 > # NB: AC_CHECK_PROG(S) or AC_PATH_PROG(S)?
 > # Use AC_CHECK_PROG(S) for programs which are only used during build.
 > # Use AC_PATH_PROG(S) for program names which are compiled into the
 > # binary and used at run time.  The reason is so that we know which
 > # programs the binary actually uses.
2014-03-01 15:49:54 +00:00
Richard W.M. Jones
01a018a9de mageia: Add distro setting and extra packages needed by Mageia. 2014-02-28 22:49:39 +00:00
Pino Toscano
962837650c builder: add libguestfs.gpg to EXTRA_DIST
It needs to be in EXTRA_DIST, otherwise it is not put in the dist.
2014-02-28 15:07:32 +01:00
Pino Toscano
12bdd94f7e tests/luks: disable if luks is not available 2014-02-28 15:07:32 +01:00
Hilko Bengen
f75142c577 Fix building on architectures where ocamlopt is not available 2014-02-28 14:01:25 +00:00
Richard W.M. Jones
a4be4231cc launch: libvirt: Fix unused variable when libselinux is not installed. 2014-02-28 13:36:05 +00:00
Richard W.M. Jones
7c8af23430 appliance: init: Don't write to /proc/sys/kernel/hotplug when starting udev (RHBZ#1020806).
/proc/sys/kernel/hotplug is an obsolete interface for processing
hotplug events.  It is not used by modern kernels, which should set
this path to the empty string (because they have
CONFIG_UEVENT_HELPER_PATH="").

Unfortunately our udev initialization code did:

  echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug

which was intended to set this file to \0 bytes.  However on Debian,
where /bin/sh is "dash", not "bash", this writes "-e" to this file,
which breaks udev events.

Thanks: Peter Rajnoha for solving this.

https://bugzilla.redhat.com/show_bug.cgi?id=1020806#c10
2014-02-27 12:36:13 +00:00
Pino Toscano
963b0341e2 builder: update documentation
Update the documentation according to the new .conf files structure, the
drop of VIRT_BUILDER_SOURCE and VIRT_BUILDER_FINGERPRINT, the drop of
hardcoded source and its key, etc.
2014-02-27 09:59:56 +00:00
Pino Toscano
47538865f2 builder: remove the default fingerprint/pubkey
Sigchecker can still import keys from the user's keyring, so there is no
need to hardcode fingerprint and key of the index hosted on
libguestfs.org (which is now pointed to using a .conf file).
2014-02-27 09:59:56 +00:00
Pino Toscano
573cae45c3 builder: remove VIRT_BUILDER_SOURCE and VIRT_BUILDER_FINGERPRINT
Drop these two environment variables, and the implicit hardcoded source
hosted at libguestfs.org.
This means all the sources must be provided as .conf files, or at each
invocation with --source.
2014-02-27 09:59:56 +00:00
Pino Toscano
f4990bef1c builder: switch sources to .conf files
Introduce and use simple .conf files to configure the sources of indexes
for virt-builder. The location of these files is in XDG_CONFIG_DIRS /
XDG_CONFIG_HOME, so it can be easily overridden.

There are three .conf(.in) files shipped with this commit:
- "test-index.conf.in" (in "test-config"), which points to the
  "test-index" index (used in tests only); the tests are adapted to
  point to the hierarchy containing this .conf
- "libguestfs.conf.in" (in "test-website"), which points to the local
  "index.asc" (i.e. the offline copy of the libguestfs.org index);
  run(.in) will point to the hierarchy providing this .conf
- "libguestfs.conf.in" (directly among the other sources), which points
  to the online "index.asc" and it is installed in sysconfdir, along
  with the key of this repository

The tests are adapted, other than to the different way to pick sources,
to the different output of --list, as "test-index" is not signed.
2014-02-27 09:59:56 +00:00
Pino Toscano
a3f1ac9a2d builder: extract the default key to file
This is basically default_pubkey from sigchecker.ml, just extracted as
file. Not used right now, but will be in the future.
2014-02-27 09:59:56 +00:00
Pino Toscano
a21da3c801 builder: add functions to read XDG_CONFIG_DIRS and XDG_CONFIG_PATH 2014-02-27 09:59:56 +00:00
Pino Toscano
ad38e68c34 builder: use Sigchecker.gpgkey_type for the fingerprint
Use Sigchecker.gpgkey_type instead of just string as type in the
sources list; adapt the listing code (and its expected output) to that.

No behaviour change which eases a bit the addition of new sources with
other key types.
2014-02-27 09:59:56 +00:00
Pino Toscano
c09f5bbc70 builder: allow "no key" as key in Sigchecker
Additional way to distinguish no actual key available for signature
checking; make sure to not allow signing in such situation.
2014-02-27 09:59:56 +00:00
Richard W.M. Jones
fbe4dad2de appliance: init: Initialize LVM in the same way as done on physical machines.
Running vgscan appears to be unnecessary.

The -aa option of vgchange activates LVs.

The --sysinit option disables locking.
2014-02-27 09:58:47 +00:00
Richard W.M. Jones
06011270ec Version 1.25.38. 2014-02-26 19:41:07 +00:00
Richard W.M. Jones
eb81df93d0 appliance: Initialize local variables because gcc cannot track that they are not used uninitialized. 2014-02-26 15:21:14 +00:00
Richard W.M. Jones
b13c22668d appliance: Use supermin >= 5.
This requires the new version of supermin (5.1.0).
2014-02-26 15:21:08 +00:00
Richard W.M. Jones
d353b4a3c8 builder: Add arch= entry for Cirros.
Thanks: Pino Toscano.
2014-02-24 20:13:41 +00:00
Richard W.M. Jones
9124730df2 builder: Add arch=x86_64 entries. 2014-02-24 15:43:13 +00:00
Pino Toscano
0f3898b2f5 sysprep: use Mkdtemp to create the temporary directory
Use the safer mkdtemp instead of manually creating a path.
2014-02-24 15:40:29 +01:00
Pino Toscano
8ed905c7e6 builder: split INI C <-> OCaml glue code in own module
Move in an own module the code which calls the C
virt_builder_parse_index and does the array -> list conversion of the
result. This way this code can be easily called also in places different
than Index_parser without the need to copy the types mapping, etc.

Just code motion, no actual behaviour changes.
2014-02-24 15:08:03 +01:00
Pino Toscano
61323fabaf builder: add a mandatory 'arch' key in index files
Introduce a mandatory arch= key in all the entries of index files, to
identify which architecture is each. Adapt the long and JSON list
outputs to print also this new field.

This introduces an incompatibility with index files created with
virt-builder < 1.26, as they will be rejected until entries will have
the arch= key added (which is ignored by older virt-builder, so adding
it will not create backward-compatibility issues).
2014-02-24 11:31:35 +01:00
Richard W.M. Jones
838a3c997c Version 1.25.37. 2014-02-21 16:46:14 +00:00
Pino Toscano
35e53c0381 builder: allow Sigchecker to import keys from file
Extend Sigchecker so it allows both fingerprints (to be imported from
user's keyring, as before) and keys stored in files. To simplify this
process (and have the fingerprint always around), the key is imported
on Sigchecker.create time, instead of lazily at the first verification.
2014-02-21 15:21:08 +01:00
Pino Toscano
dd03d38be3 builder: use a disposable GPG keyring for every Sigchecker
Create a temporary directory and tell gpg to use it as homedir, so
imported keys do not get into the user's keyring. This also avoid
importing the default key  when a different one is needed to check the
signature.

The only exception is when a non-default fingerprint is used: in this
case, that key is read from the user's keyring, since it is where it is.
2014-02-21 14:39:57 +01:00
Pino Toscano
c79c62a3b0 mllib: add a binding for mkdtemp
It seems OCaml has no way to safely create a temporary directory, so add
a new binding to C's mkdtemp which does that.
2014-02-21 14:34:36 +01:00
Richard W.M. Jones
7794d9a187 builder: Add ScientificLinux 6.5. 2014-02-21 08:35:49 +00:00
Pino Toscano
7f77f4fb28 mllib: add an hook to cleanup directories on exit
Much similar to unlink_on_exit, but recursively cleaning directories.
2014-02-20 16:33:19 +01:00
Pino Toscano
4c5a6afc84 builder: accept also '_' in group names 2014-02-19 16:40:00 +01:00
Richard W.M. Jones
482fefa5d8 ppc64: Don't add -no-hpet with the direct backend either.
Related changes in commit 479665e4fc
and commit 62cb3a606d.
2014-02-18 17:43:06 +00:00
Richard W.M. Jones
479665e4fc ppc64: Disable hpet fragment in libvirt XML.
Related change in commit 62cb3a606d.
2014-02-18 17:40:58 +00:00
Pino Toscano
bb35e72503 builder: move the XDG path handling in an own file
Just code motion and renaming, no actual behaviour changes.
2014-02-18 12:55:14 +01:00
Pino Toscano
8b1f1c15f5 fish: use XDG paths for the config file
Read the configuration file from XDG paths for both global and
user-local locations, keeping the old paths as fallback.
2014-02-18 10:44:49 +01:00
Richard W.M. Jones
62cb3a606d launch: libvirt: Don't include hpet XML fragment on ARM.
See comment and https://bugzilla.redhat.com/show_bug.cgi?id=1066145
for explanation.
2014-02-18 03:37:50 -05:00
Pino Toscano
8577aded98 fish: change order of config files being read
First read the global configuration and then the local one in user's
HOME, so the latter can really override system settings.
2014-02-17 16:24:41 +01:00
Pino Toscano
5d2b0d1366 fish: small refactor of config reading code
Even though so far there is just one possible setting to read, isolate
in an own function the code to parse a configuration file and read the
settings out of it.

Now there's a new config_t handle used every time, but since config_read
would reset an handle completely, there is no behaviour change.
2014-02-17 16:21:18 +01:00
Or Goshen
6b71b81a5f appliance: Use configurable separator character for LIBGUESTFS_PATH.
On Windows, the path separator character will be ';' instead.
2014-02-17 14:52:46 +00:00
Richard W.M. Jones
22f6c79b32 Version 1.25.36. 2014-02-17 10:08:38 +00:00
Richard W.M. Jones
360abeebda builder: Fix dependencies which are not generated correctly by automake.
See the error messages here:
https://www.redhat.com/archives/libguestfs/2014-February/msg00148.html

This fixes commit e2cc8b6465.
2014-02-17 09:53:25 +00:00
Richard W.M. Jones
8f767f4caa Version 1.25.35. 2014-02-16 22:34:56 +00:00
Richard W.M. Jones
b987be513a FAQ: Remove obsolete entry about libguestfs <= 1.13 and slow writes.
Long since not a problem.
2014-02-16 19:20:40 +00:00
Richard W.M. Jones
728ba9b33f FAQ: Add several common problems with opening disk images. 2014-02-16 19:15:49 +00:00
Richard W.M. Jones
c16d5d3de4 FAQ: Create new section about problems opening disk images.
Move the stuff about encoding problems here, because these are not
really common problems.
2014-02-16 19:15:49 +00:00
Richard W.M. Jones
6594e88d80 FAQ: Remove old RHEL 6.5 section. 2014-02-16 19:15:49 +00:00
Richard W.M. Jones
6cc521dc45 generator: Sort most output.
Look for use of external_functions and fish_functions and replace with
use of external_functions_sorted and fish_functions_sorted where
possible.  This ensures that the output of the generator is sorted as
far as possible.

I also checked for uses of internal_functions and documented_functions
but those are not used.  The *_sorted versions are always used
instead.
2014-02-15 20:27:12 +00:00
Hilko Bengen
bbfb9f9480 podwrapper: Recognize git-style dates in ChangeLog 2014-02-14 15:09:42 +01:00
Richard W.M. Jones
bf8d75590c test: Use = instead of == for testing string equality in bash script.
Found by make syntax-check.
2014-02-14 12:33:37 +00:00
Richard W.M. Jones
d56b8bcb2c Remove some unused header files.
Found by make syntax-check.
2014-02-14 12:33:37 +00:00
Richard W.M. Jones
f5de589966 src/drives.c: Remove useless if-before-free.
Found by make syntax-check.
2014-02-14 12:33:37 +00:00
Richard W.M. Jones
9018356a67 Use bindtextdomain in some programs where it was missing.
Found by make syntax-check.
2014-02-14 12:33:37 +00:00
Richard W.M. Jones
e3d23cccf4 builder: Suppress warning about unused yyunput.
CC       virt_index_validate-index-validate.o
index-scan.c:1270:17: warning: 'yyunput' defined but not used [-Wunused-function]
     static void yyunput (int c, register char * yy_bp )
                 ^
  CCLD     virt-index-validate

By using %option nounput we can prevent this from being generated in
the first place.
2014-02-14 12:33:37 +00:00
Richard W.M. Jones
9df9c87147 configure: Move ocaml-gettext writing boilerplate to separate m4 module.
This is just code motion.

NOTE that after this commit you have to do:

  aclocal -I m4
  autoconf

as 'make' may not do this automatically.
2014-02-13 21:07:40 +00:00
Richard W.M. Jones
e4fe09c5ae builder: pxzcat: Fix char * signedness warning. 2014-02-13 17:48:23 +00:00
Richard W.M. Jones
f8bac1329e mllib/uri-c.c: Remove unused variable. 2014-02-13 17:48:23 +00:00
Richard W.M. Jones
72713825c4 gobject: Remove some more warnings from session.c code. 2014-02-13 17:48:23 +00:00
Richard W.M. Jones
e74c957a2b gobject: Clean up some warnings about unused variables. 2014-02-13 17:48:23 +00:00
Richard W.M. Jones
23d6d53633 gobject: Don't direct error messages to /dev/null.
We might want to see them.
2014-02-13 17:48:23 +00:00
Richard W.M. Jones
99ce50e0a0 gobject: Use spaces between function name and call parameters.
This is just a whitespace change.

This was done by running the following command and then fixing a
couple of places where it got it wrong:

perl -pi.bak -e 'unless (m/#define/) { s/([a-zA-Z0-9])\(/$1 (/g }' \
  generator/gobject.ml
2014-02-13 17:48:23 +00:00
Richard W.M. Jones
cd9f741174 fish/uri: Initialize some variables to avoid a warning.
The warning only appears when we set CFLAGS to be the same as used by
RPM, which you can do by setting:

  CFLAGS="$(rpm --eval '%{__global_cflags}')"

before running ./configure.

FWIW the current value of that RPM expression (in Fedora 20) is:

  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches

It is not clear which option precisely enables the warning.
2014-02-13 17:48:23 +00:00
Richard W.M. Jones
2954541fdd java: Avoid warnings in the tests and examples.
Avoid warnings about missing serial version, and fix a warning about
raw types.
2014-02-13 17:48:23 +00:00
Pino Toscano
ab2df2e659 mllib: hostname: on Debian replace it also in /etc/hosts (RHBZ#953907).
In Debian/Ubuntu systems, read the previous hostname from /etc/hostname
before replacing it, and replace it in /etc/hosts with the new hostname.
2014-02-13 14:52:50 +01:00
Pino Toscano
4ca4eef0cc sysprep: remove RH subscription manager files
Add a new operation for it, which should do what
`subscription-manager clean` does.

Part of RHBZ#1063374.
2014-02-13 10:57:31 +01:00
Pino Toscano
f78877c77e sysprep: remove RH subscription manager log files
Part of RHBZ#1063374.
2014-02-13 10:50:15 +01:00
Richard W.M. Jones
dcd5edd5d4 Version 1.25.34. 2014-02-12 22:52:53 +00:00
Pino Toscano
3d4cc3cf57 mllib: hostname: add a newline in /etc/hostname
/etc/hostname usually has an ending newline, so add it when changing it.
2014-02-12 18:48:08 +01:00
Richard W.M. Jones
82a4a8f02c FAQ: Another common problem is permission denied errors when running as root. 2014-02-12 09:32:08 +00:00
Richard W.M. Jones
37aead588e FAQ: Add another common Ubuntu appliance problem. 2014-02-12 09:31:57 +00:00
Richard W.M. Jones
d70ceb4cbe list-filesystems: Do not segfault if guestfs_btrfs_subvolume_list returns an error (RHBZ#1064008).
If calling guestfs_list_filesystems with a disk image containing a
corrupt btrfs volume, the library would segfault.  There was a missing
check for a NULL return from guestfs_btrfs_subvolume_list.

This adds a check, returning the real error up through the stack and
out of guestfs_list_filesystems.

This is potentially a denial of service if processing disk images from
untrusted sources, but is not exploitable.

Thanks: Jeff Bastian for reporting the bug.
2014-02-11 20:14:01 +00:00
Pino Toscano
76e3e15d03 builder: do a copy when downloading local files
Instead of spawning curl even to "download" file:// URIs, just copy
them.
2014-02-11 12:52:10 +01:00
Pino Toscano
ba3569704c builder: prepare for different per-protocol download actions
Small refactor of Downloader.download_to to allow different download
actions depending on the protocol of the URI (which is now parsed).

No actual behaviour changes, just mostly code motion.
2014-02-11 12:39:56 +01:00
Pino Toscano
c66cec6ffa builder: isolate C libraries in an own OCAMLCLIBS
Just moving stuff within Makefile.am, no functional changes.
2014-02-11 10:40:31 +01:00
Pino Toscano
a948389ce9 actions/part_set_gpt_type: set type of "guid" parameter as "GUID" (RHBZ#1008417).
Switch the type of the "guid" parameter from "String" to "GUID"; this
adds the validation of the GUID as such, rejecting straight away invalid
GUIDs which otherwise could be handled badly by low-level tools (such as
sgdisk).

Add a couple of easy tests (taken from RHBZ#1008417) to
part_set_gpt_type about this.
2014-02-10 11:00:09 +01:00
Pino Toscano
775cad63a3 generator: generate code for parameter validation
Implemented only in the C output, since every binding uses it anyway,
and just for the "GUID" type (since its format is well-known).
2014-02-06 20:02:51 +01:00
Pino Toscano
b10dd601fb generator: add a GUID parameter type
At the moment it is basically the change as String, and it is mapped as
if it was such.
2014-02-06 17:43:04 +01:00
Pino Toscano
beef77403c utils: add a function to validate a GUID string 2014-02-06 15:57:09 +01:00
Richard W.M. Jones
ed912a54d6 libguestfs-make-fixed-appliance: All supported versions of libguestfs should work.
We're not supporting anything < 1.20 now.
2014-02-05 19:39:28 +00:00
Richard W.M. Jones
758d021b41 Version 1.25.33. 2014-02-05 15:18:49 +00:00
Pino Toscano
798b539a1f appliance/init: provide a symlink /var/lock
Provide /var/lock as symlink to /run/lock, as it might be used by
applications.
2014-02-05 11:42:17 +01:00
Pino Toscano
59eb9bff87 resize: preserve GPT partition names (RHBZ#1060404).
Save the partition names/labels of the source partitions, and restore
them after the partition copy.
2014-02-04 15:54:44 +01:00
Pino Toscano
820b870167 New API: part-get-name (RHBZ#593511).
Counterpart of part-set-name, it uses sgdisk (hence needs the "gdisk"
feature) to query for the label/name of a partition in a GPT layout.
2014-02-04 15:54:44 +01:00
Pino Toscano
78c21ce912 daemon: parted: refactor sgdisk info parsing code
Isolate in an own function the code that runs sgdisk and parse a field
of it (using an extraction function passed as parameter), using it for
the GUID type.

This is just code motion, no actual behaviour changes.
2014-02-04 15:54:44 +01:00
Richard W.M. Jones
170b64337d resize: Try to remove a few more _ -> .. cases.
This allows the compiler to catch missing cases more effectively,
especially if we update the types with more cases in future.
2014-02-04 13:27:34 +00:00
Pino Toscano
ef7ac043a6 resize: properly restore GPT partition types
If there is a GPT partition layout, then what should be read and
restored for each partition is the GPT type and not the MBR ID.

Related to RHBZ#1060404.
2014-02-04 13:32:28 +01:00
Richard W.M. Jones
eab810f778 Version 1.25.32. 2014-02-04 08:50:43 +00:00
Richard W.M. Jones
d5b540153f Remove bogus license file from daemon subdirectory.
It was left over from when the daemon was a separate autoconf
directory, and in any case the daemon has never been GPLv3 (it is
GPLv2+).
2014-02-03 13:57:33 +00:00
Richard W.M. Jones
d93e3c50eb fish: Additional GUESTFISH_* environment variables to control the prompt.
This adds:

 - GUESTFISH_INIT
 - GUESTFISH_OUTPUT
 - GUESTFISH_RESTORE

which along with existing GUESTFISH_PS1 allow you to fine control the
colour of the output.
2014-02-03 13:57:33 +00:00
Pino Toscano
bed8a168c0 builder: remove unused variables
Leftovers of the list_entries_short+list_entries_long split done in
commit 91aae893c7.
2014-01-30 17:06:42 +01:00
Pino Toscano
07ef60c63f builder: output translated notes
Output all the translations available for the notes in the "verbose"
output and the JSON output, while trying to match the system langauge in
the "show notes" output.

The JSON output is slightly changed to handle translations, with the
"untranslated" notes being matched as "C". The version is not bumped
though, since there have been no stable releases with the former output
yet.
2014-01-30 17:05:34 +01:00
Richard W.M. Jones
49014f81f3 sysprep: Deprecate --selinux-relabel in favour of --autorelabel.
virt-builder added a --selinux-relabel option with a slightly
different meaning.

This commit keeps the old --selinux-relabel / --no-selinux-relabel
options in virt-sysprep, but deprecates them and replaces them with
--autorelabel and --no-autorelabel.
2014-01-30 09:03:46 +00:00
Richard W.M. Jones
fc6d3e6a9a sysprep: Add a reference to virt-builder from the manual page.
The whole "COPYING AND CLONING" section really needs to be overhauled
too, but first we need to make virt-builder work properly for
customizing templates.
2014-01-30 09:03:46 +00:00
Richard W.M. Jones
5db1a28461 sysprep: Add --scrub option.
This works like the option in virt-builder with the same name.
2014-01-30 09:03:46 +00:00
Richard W.M. Jones
2595fa5069 builder: Move Perl_edit module into common code.
There is no functional change.
2014-01-29 14:04:40 +00:00
Richard W.M. Jones
c841d08d70 appliance: Create checksum file with mode 0644 instead of 0755.
Initial commit 4beb284409 used mode 0755
for no reason.  It seems to have been a mistake.
2014-01-29 09:31:24 +00:00
Richard W.M. Jones
f0f95bd038 perl: Data::Dumper and String::ShellQuote modules are no longer required.
They used to be used by old Perl virt-make-fs.  Nothing else uses
them.

This updates commit d3512deb67.
2014-01-29 08:45:19 +00:00
Richard W.M. Jones
32cbd7ca0d make-fs: Remove warning from man page about lone --partition argument.
C's getopt_long has no problem with this.
2014-01-29 08:20:38 +00:00
Richard W.M. Jones
a8a655a859 make-fs: Ensure --partition (on its own) creates an MBR partition.
This fixes commit d3512deb67.
2014-01-29 08:20:38 +00:00
Richard W.M. Jones
90d3378778 make-fs: Refactor debug stats code.
Code motion, no functional change.
2014-01-29 08:20:38 +00:00
Richard W.M. Jones
5bf8c81d7d make-fs: Use an anonymous pipe instead of a named pipe.
The previous translation from Perl slavishly followed the Perl code a
bit too much and used a named pipe to communicate between the
uncompressing subprocess and libguestfs tar-in.  From C we can use an
anonymous pipe instead.

This updates commit d3512deb67.
2014-01-29 08:20:18 +00:00
Richard W.M. Jones
c86fcc0fd4 make-fs: Make check-valgrind do something. 2014-01-29 08:00:55 +00:00
Richard W.M. Jones
f5bc913434 make-fs: Run virt-make-fs in test from builddir, not srcdir. 2014-01-29 08:00:30 +00:00
Richard W.M. Jones
59fce974e2 pod: Remove stray +x (executable) mode on various POD files.
find -name '*.pod' -perm /0111 -exec chmod -x {} \;
2014-01-28 22:17:12 +00:00
Richard W.M. Jones
1771e1f2b2 Version 1.25.31. 2014-01-28 22:10:25 +00:00
Richard W.M. Jones
233d5410e5 sysprep: Add script4.sh (test script) to EXTRA_DIST.
This fixes commit ce9d4d335b.
2014-01-28 21:56:18 +00:00
Richard W.M. Jones
dc91bf7231 Version 1.25.30. 2014-01-28 21:02:13 +00:00
Richard W.M. Jones
642cf4c5dc tests: Test --label and other options in virt-make-fs. 2014-01-28 21:02:11 +00:00
Richard W.M. Jones
d3512deb67 Rewrite virt-make-fs in C (originally Perl).
It should be very compatible with the Perl version.
2014-01-28 21:02:11 +00:00
Richard W.M. Jones
40512c66af daemon: Always pass -F option to mkfs.ntfs.
Otherwise it moans about:

  mkfs: ntfs: /dev/sda: /dev/sda is entire device, not just one partition.
  Refusing to make a filesystem here!

This has been happening for a while, so I don't know why we didn't
notice it before.  It even happens on RHEL 6.

A simple reproducer is:

  virt-make-fs -t ntfs any-tarball.tar.gz test.img
2014-01-28 21:02:11 +00:00
Richard W.M. Jones
9015d5ac14 virt-make-fs: Use disk-create API instead of calling qemu-img create.
Strictly speaking this reduces the number of formats that virt-make-fs
can output to, but it's likely that no one cares and if they do we can
add new formats in future.
2014-01-28 21:02:11 +00:00
Richard W.M. Jones
a594b7f90a sparsify: Use new disk-create API instead of calling qemu-img.
disk-create doesn't support the lazy_refcounts option.
2014-01-28 21:02:11 +00:00
Richard W.M. Jones
40261e4adc rescue: Note that we're not using add-drive-scratch here, and maybe we should be. 2014-01-28 21:02:11 +00:00
Richard W.M. Jones
f02fddc26b tests: Update miscellaneous tests to use disk-create API.
Instead of calling out to qemu-img / truncate.
2014-01-28 21:02:11 +00:00
Richard W.M. Jones
bd12e784e7 builder: Use disk-create API instead of calling qemu-img create. 2014-01-28 21:02:11 +00:00
Richard W.M. Jones
d60e6a23a6 examples: Update various examples to use new disk-create API. 2014-01-28 21:02:11 +00:00
Richard W.M. Jones
2794eac739 fish: Use disk-create API to implement guestfish 'alloc' and 'sparse' commands. 2014-01-28 21:02:11 +00:00
Richard W.M. Jones
1e5eb0aebb lib: Use disk-create API instead of qemu-img/truncate inside the library. 2014-01-28 21:02:11 +00:00
Richard W.M. Jones
588af1953e New API: disk-create for creating blank disks.
This is a wrapper around either 'qemu-img create' or calls to open,
truncate and posix_fallocate which litter and complicate existing
code.
2014-01-28 21:02:11 +00:00
Richard W.M. Jones
65fc841ea6 src/Makefile.am: Reorder SOURCES into alphabetical order. 2014-01-28 21:02:11 +00:00
Richard W.M. Jones
e3f72805d1 run: Actually use timeout --foreground option (RHBZ#1025269).
The following commit managed to not actually add the --foreground
option to the timeout command, just test for it.  Add it this time.

  commit 6814888774
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Thu Dec 19 08:21:53 2013 +0000

    run: Use timeout --foreground option.

    If timeout doesn't have this option (RHEL 6) don't use timeout at all.

    Attempt to fix RHBZ#1025269.
2014-01-28 21:02:11 +00:00
Richard W.M. Jones
d9cd2dc9b0 daemon: Add a note about how 'mount --rbind' doesn't work. 2014-01-28 21:02:11 +00:00
Richard W.M. Jones
9df50877f8 daemon: If /selinux exists in the guest, bind-mount /sys/fs/selinux to there.
Commit 72afcf450a was partially
incorrect.  If the guest userspace is expecting /selinux to exist,
then we should bind-mount /sys/fs/selinux from the appliance kernel
there.
2014-01-28 21:02:11 +00:00
Pino Toscano
ce9d4d335b builder, sysprep: initialise the random generator
virt-builder and virt-sysprep may make use of
Common_utils.string_random8 (which uses Random.int) for constructing
temporary paths; not initialising the random generator means that every
invocation will reuse the same name used previously (!).
Thus just call Random.self_init, just like virt-sparsify already does.

Expand the test-virt-sysprep-script.sh test to ensure that virt-sysprep
is not affected again by this issue.
2014-01-28 15:04:38 +01:00
Pino Toscano
95f8144cb6 tests/regressions: remove C part of rhbz1044014
All it did was checking for a libvirt version, which is what
libvirt-is-version now does; hence remove the C part, and use guestfish,
ignoring the launch failure (as the C test did).
2014-01-27 17:25:55 +01:00
Pino Toscano
4310f8f175 tests/disks: skip test-qemu-drive-libvirt.sh if libvirt is < 1.1.3
This test relies on the <test:runstate> element in the domain XML, which
has been introduced in libvirt 1.1.3.
2014-01-27 16:33:22 +01:00
Pino Toscano
c01fb37839 tests: add a a simple libvirt-is-version test tool
libvirt-is-version returns successfully in case the available version of
libvirt is greater or equal than the specified major/minor/release
values.
2014-01-27 16:31:32 +01:00
Pino Toscano
f66d6a85b6 tests/mountable: add missing space in test-mountable-inspect.sh
No actual behaviour, other than getting rid of a bash warning.
2014-01-27 14:25:47 +01:00
Richard W.M. Jones
de7a8336cd Version 1.25.29. 2014-01-25 12:04:37 +00:00
Richard W.M. Jones
4e18712562 tests/disks/test-qemu-drive-libvirt: Include test data.
This was inadvertantly deleted.

This fixes commit 01d27033bd.
2014-01-25 11:56:40 +00:00
Richard W.M. Jones
24e61492cc Version 1.25.28. 2014-01-25 10:59:03 +00:00
Richard W.M. Jones
080300dfec builder: Add documentation for enabling Puppet (agent) in a guest. 2014-01-25 09:41:10 +00:00
Richard W.M. Jones
90e23b4e56 builder: Add --selinux-relabel option to perform SELinux relabelling.
This adds the --selinux-relabel option which enables selinux in the
appliance and runs:

  if load_policy && fixfiles restore; then
    rm -f /.autorelabel
  else
    touch /.autorelabel
  fi

at the end of installation.

When possible this fixes SELinux labels in the guest and makes the
autorelabel step unnecessary.

Notes:

 - The previous commit is required so that load_policy works.

 - During the build, SELinux is enabled but no policy is loaded.  This
   works because SELinux is in permissive mode.

 - This flag does not work if the appliance kernel and the guest have
   greatly differing versions, eg. a RHEL 6 guest with a Fedora 20
   appliance.  This is because SELinux changes the policy format and
   breaks backwards compatibility.  You would see errors like this:

   libsepol.policydb_write: policy version 15 cannot support MLS
   libsepol.policydb_to_image: could not compute policy length
   libsepol.policydb_to_image: could not create policy image
   SELinux:  Could not downgrade policy file /etc/selinux/targeted/policy/policy.24, searching for an older version.
   SELinux:  Could not open policy file <= /etc/selinux/targeted/policy/policy.24:  No such file or directory

   These errors are ignored (they go to the log file) and relabelling
   is done at boot instead.

 - It's not clear if loading guest policy is safe.  You should trust
   the virt-builder templates and to use libguestfs confinement for
   additional protection.
2014-01-25 09:41:07 +00:00
Richard W.M. Jones
ab33653ef3 daemon: Bind-mount /sys/fs/selinux into sysroot when running commands.
Even though we are already bind-mounting /sys, it is necessary to also
bind-mount /sys/fs/selinux in order for SELinux commands (in
particular, 'load_policy') to work.

This fixes/reverts commit 7367729ec7.
2014-01-24 19:36:33 +00:00
Richard W.M. Jones
0e2489974b fuse: In mount-local-run, test if root filesystem has been mounted (RHBZ#1057504).
It is never normally valid to use the mount-local* APIs when you
haven't mounted some filesystems in the libguestfs namespace.

If you try it, it results in some odd errors.  The mount-local-run
call is successful, but subsequent operations fail:

$ mkdir -p /tmp/mnt
$ guestfish -x -N fs mount-local /tmp/mnt : mount-local-run
libguestfs: error: lstat: lstat_stub: you must call 'mount' first to mount the root filesystem
libguestfs: error: lstat: lstat_stub: you must call 'mount' first to mount the root filesystem

With this commit, the mount-local-run call gives an error:

libguestfs: error: you must call 'guestfs_mount' first to mount a filesystem on '/'.
Note: '/tmp/mnt' is still mounted.  Use 'guestunmount /tmp/mnt' to clean up.

The error is implemented by calling guestfs_exists (g, "/") which has
the side effect of running the NEED_ROOT macro in the daemon.  (There
is no simple equivalent of NEED_ROOT on the library side.)
2014-01-24 12:26:34 +00:00
Richard W.M. Jones
01d27033bd lib, fish: Handle Gluster, NBD, iSCSI and Sheepdog paths properly.
This fixes the handling of paths for the protocols named above, with
respect to leading '/' (or not) on the volume/export name.

See previous commits which did the same fixes for Ceph:
commit 53a3ff9c00
commit 992a6b2970
2014-01-23 21:49:16 +00:00
Richard W.M. Jones
870f076bdd Version 1.25.27. 2014-01-23 19:35:23 +00:00
Richard W.M. Jones
3331db84bc resize: Don't truncate libguestfs error messages.
If we rely on OCaml's internal exception printing, then it will
truncate error messages like this:

  Fatal error: exception Guestfs.Error("could not create appliance
  through libvirt.

  Try running qemu directly without libvirt using this environment
  variable: export LIBGUESTFS_BACKEND=direct

  Original error from libvirt: unable to set security context
  'unconfined_u:object_r:svi
note the truncation here ^^^^^^^

Instead of using the internal exception printing, wrap the whole
program in a 'main ()' function and add an exception handler.

This large change is non-functional apart from the addition of the
exception handlers at the end.
2014-01-23 15:08:52 +00:00
Richard W.M. Jones
e8c1067021 launch: direct: Stop using deprecated -no-kvm-pit-reinjection if qemu is new enough (RHBZ#1053847). 2014-01-23 14:46:03 +00:00
Richard W.M. Jones
1d6ba35e6f tests: Add a test of libvirt domain XML to qemu command line (RHBZ#1026688).
This tests that libvirt domain XML (ie. guestfish -d option) is parsed
correctly and results in the correct qemu command line when using the
direct backend.

This is a good end-to-end test of various layers.
2014-01-23 14:46:03 +00:00
Richard W.M. Jones
1ed0ce3ef8 libvirt domain: Allow network drives with no <source name="..."> attr.
This is valid for some network drives, for example:

  <source protocol='nbd'>
    <host name='foo' port='1234'/>
  </source>

We pass an empty string as path to the guestfs_add_drive_opts API in
this case.
2014-01-23 14:46:03 +00:00
Richard W.M. Jones
1d2e74414b libvirt-domain: Remove unnecessary and wrongly indented parens. 2014-01-23 14:46:03 +00:00
Richard W.M. Jones
58ada01783 libvirt domain: Allow network drives with no <host> elements.
This is valid for some network drives:

<source protocol='rbd' name='abc-def/ghi-jkl'/>

instead of this:

<source protocol='rbd' name='abc-def/ghi-jkl'>
  <host name='foo' port='1234'/>
</source>

Allow both forms.
2014-01-23 14:46:03 +00:00
Richard W.M. Jones
992a6b2970 fish: Handle Ceph/rbd URIs and convert them to paths properly (RHBZ#1026688).
The path at the API level (for guestfs_add_drive_opts) is:

  pool/disk

The URI syntax is either rbd:///pool/disk or rbd://server:port/pool/disk.
Because of the way URI parsing works we may need to remove a leading
'/' character before passing the path down to the API.
2014-01-23 14:46:03 +00:00
Richard W.M. Jones
53a3ff9c00 lib: Handle Ceph/rbd paths properly (RHBZ#1026688).
The path at the protocol level is:

  pool/disk

(with no leading '/' character).  This is now what you have to pass to
guestfs_add_drive_opts.

Also Ceph can be called with no explicit servers (it uses the contents
of /etc/ceph/ceph.conf instead).  So allow zero servers to be used.
2014-01-23 14:46:03 +00:00
Richard W.M. Jones
b93a1d50ad fish/uri: Tidy up error messages. 2014-01-23 14:46:03 +00:00
Pino Toscano
b7cd63fc1d builder: read all the available notes from the index
Switch the internal storage for the notes of each entry to a sorted list
with all the subkeys available (which should represent the translations
to various languages).
The current outputs are the same (i.e. still the untranslated notes), so
this is just internal refactoring/preparation.
2014-01-23 15:36:15 +01:00
Pino Toscano
958e84d699 builder: small code simplification
No actual behaviour changes, just remove extra match statements.
2014-01-23 10:19:16 +01:00
Richard W.M. Jones
2541563a18 Version 1.25.26. 2014-01-22 18:01:17 +00:00
Richard W.M. Jones
629cb87b6d tests/regressions: Don't include binaries in EXTRA_DIST.
Because EXTRA_DIST simply used $(TESTS), and because the list of tests
includes C binaries, these were included in the tarball (actually not
binaries, but libtool scripts, but it's still undesirable).
2014-01-22 17:13:00 +00:00
Richard W.M. Jones
7d8d065fee tests: Add a regression test for RHBZ#1054761. 2014-01-22 17:10:37 +00:00
Richard W.M. Jones
aa2ca8ba70 daemon: lvm2: Ignore "unknown device" output when a PV is missing (RHBZ#1054761). 2014-01-22 17:10:37 +00:00
Colin Walters
49c3d819c1 generator/set-uuid: Fix two typos in documentation 2014-01-22 15:47:34 +00:00
Pino Toscano
9e4357ca54 builder: fix small regression in subkey parsing
Introduced in 5cbdf35d65, it caused the
first character of the value to be skipped if the key has a subkey.
2014-01-22 15:34:22 +01:00
Richard W.M. Jones
13bca32e4e sparsify: Prevent overwriting block or char output devices (RHBZ#1056290).
virt-sparsify doesn't work if the output is a block device, and cannot
possibly work if the output is a char device.  Currently if you try
this it actually overwrites (deletes) the output device which is not
exactly desirable.  Therefore throw an error and exit.
2014-01-22 13:10:08 +00:00
Richard W.M. Jones
c6ec6cde27 builder: Add -monitor none to example command line. 2014-01-22 12:55:52 +00:00
Dan Lipsitt
873051e108 remove non-portable chmod
'chmod --reference' is not available on Mac OS X.

Keeping the original file and directing edits into it preserves permissions and removes the need to chmod.

(Tried 'sed -i' for inplace editing but unfortunately it isn't portable either.)
2014-01-21 20:26:32 +00:00
Richard W.M. Jones
ebb04b64a2 Version 1.25.25. 2014-01-21 18:37:26 +00:00
Pino Toscano
5cbdf35d65 builder: proper consider subkeys in index files
The index files already allowed the 'key[subkey]=...' syntax for keys,
but considering such string as whole key. Proper split the parsing and
the handling of the subkeys, so they can be searched a bit easier.

This causes no actual behaviour changes, it is just internal
micro-refactoring. (Thanks Rich for the hints, too.)
2014-01-21 19:19:22 +01:00
Richard W.M. Jones
20a4bfde96 builder: Add tip for how to relabel SELinux guest at build time.
Thanks: purpleidea/James.
2014-01-21 17:33:35 +00:00
Richard W.M. Jones
88094f3da4 builder: Clearer note in man page about SELinux and where /.autorelabel file comes from.
It's not added by virt-builder.  It is present in the templates (added
by virt-sysprep in fact).
2014-01-21 17:33:35 +00:00
Richard W.M. Jones
be5fd2fd34 builder: Add note about cloning to man page. 2014-01-21 17:33:35 +00:00
Richard W.M. Jones
3e3e7cf029 sysprep: Replace flags list with side_effects object.
Previously callbacks would return a list of flags, such as []
or [`Created_files].

In this commit we introduce two new objects, filesystem_side_effects
and device_side_effects (the latter is not used yet).

The callbacks that create files now need to call

  side_effects#created_file ()

instead of returning flags.

There is no functional change in this patch.
2014-01-21 17:33:35 +00:00
Richard W.M. Jones
11b4fc88fb sysprep: Update comments. 2014-01-21 17:33:35 +00:00
Pino Toscano
4505f61979 builder: allow more empty lines in index files
Improve the index grammar to allow more than one empty line between
sections, and to allow any number of empty lines at the end of the file
(after the last section).
2014-01-21 17:54:23 +01:00
Pino Toscano
e2cc8b6465 builder: add index-struct.h as dependency for index-parser-c.c
Just like with index-parse.h, also index-struct.h is a dependency of
index-parser-c.c which automake cannot generate correctly.
Thus, add it manually.
2014-01-21 13:47:29 +01:00
Richard W.M. Jones
10b20b7938 test-tool: Rearrange output into alphabetical order. 2014-01-21 11:07:03 +00:00
Pino Toscano
ffe1eaa11c Revert "Minimum libvirt version is >= 1.1.1."
0.10.2+ is still available on some recent-ish stable distros (like
Fedora 19, Ubuntu 13.04), and should work fine for guestfs.

This reverts commit 6b3e05e8da.
2014-01-20 16:10:43 +01:00
Richard W.M. Jones
a7b5be067e dist: Run 'git log' instead of custom script.
It's useful to see the complete SHA1's since that is how we refer to
fixes in Bugzilla.
2014-01-20 14:34:03 +00:00
Richard W.M. Jones
ee90a36521 tests: Add regression test for get-attach-method == "appliance".
This updates commit ecd31806a4.
2014-01-20 12:09:29 +00:00
Richard W.M. Jones
ecd31806a4 tests: Add a regression test for parsing LIBGUESTFS_BACKEND/LIBGUESTFS_ATTACH_METHOD (RHBZ#1055452). 2014-01-20 10:22:41 +00:00
Richard W.M. Jones
69267d8762 launch: Allow backend = "appliance" for backwards compatibility (RHBZ#1055452).
This fixes a regression which was introduced in
commit 0f26218905.
2014-01-20 10:22:41 +00:00
Richard W.M. Jones
d0c5450c45 daemon: Use wipefs_has_force_option to decide whether to add wipefs --force option. 2014-01-19 20:30:42 +00:00
Olaf Hering
d87cfefcdd daemon: add missing GUESTFSD_EXT_CMD usage
Signed-off-by: Olaf Hering <olaf@aepfle.de>
2014-01-19 20:30:42 +00:00
Richard W.M. Jones
badc4ffad5 Version 1.25.24. 2014-01-18 21:38:11 +00:00
Richard W.M. Jones
a1eacea572 init: Display clocksource (only when debugging is enabled). 2014-01-18 16:55:09 +00:00
Richard W.M. Jones
012b01a0fb launch: direct: Make sure we pass lpj= parameter when using TCG.
I have verified that 'refined-jiffies' is the clock source when using
TCG (ie. not kvm-clock which seems only to be used for KVM).
2014-01-18 16:52:58 +00:00
Richard W.M. Jones
26f7fb237b launch: libvirt: Add force_tcg backend setting.
By using:

  export LIBGUESTFS_BACKEND_SETTINGS=force_tcg

you can force the libvirt backend to use TCG (software emulation)
instead of KVM (hardware accelerated virtualization).
2014-01-18 16:36:14 +00:00
Richard W.M. Jones
11ac9f7024 launch: direct: Add force_tcg backend setting.
By using:

  export LIBGUESTFS_BACKEND=direct
  export LIBGUESTFS_BACKEND_SETTINGS=force_tcg

you can force the direct backend to use TCG (software emulation)
instead of KVM (hardware accelerated virtualization).

This is sometimes useful, especially if you are trying to use
nested KVM on Intel.
2014-01-18 16:32:03 +00:00
Richard W.M. Jones
1e4663858b New API: set-backend-settings, get-backend-settings.
Allow settings (an arbitrary list of strings) to be passed to the
current backend.  This will allow us to tweak how the backend works,
eg. by forcing TCG.
2014-01-18 16:32:03 +00:00
Richard W.M. Jones
815e739d12 utils: Add regression test for C utility functions. 2014-01-18 16:32:03 +00:00
Richard W.M. Jones
89a617c07d utils: Add utility function to split string into list of strings. 2014-01-18 16:32:03 +00:00
Richard W.M. Jones
693a21513b utils: Add utility function to copy string lists. 2014-01-18 16:32:03 +00:00
Richard W.M. Jones
20514fec25 test-tool: Use size_t instead of int for array index. 2014-01-18 16:32:03 +00:00
Richard W.M. Jones
3858eeb517 tests/nbd: Move wait for qemu-nbd to start up earlier.
tests/nbd/test-nbd.pl contains a hack (a call to sleep) to wait
for qemu-nbd to start up in another process.

This sleep was previously located before the call to $g->launch()
since that is where (previous to commit 4a0f5ed382) the backend would
have connected to the NBD server.

However in the new code, an initial NBD connection test is done when
the drive is added (ie. $g->add_drive (..., protocol=>"nbd")), which
duly failed intermittently because the qemu-nbd server had not opened
its socket yet.

Move the wait earlier -- just after the fork -- to avoid this.

This updates commit 4a0f5ed382.
2014-01-18 16:32:03 +00:00
Richard W.M. Jones
b6ff642168 Use recommended timer settings for KVM (RHBZ#1053847).
See: https://bugzilla.redhat.com/show_bug.cgi?id=1053847#c0

Thanks: Cole Robinson, and several QEMU developers.
2014-01-18 16:32:03 +00:00
Richard W.M. Jones
937c0313a0 launch: libvirt: Slightly simplify the XML generation code further.
This updates commit 96737fc5b7.
2014-01-18 11:40:30 +00:00
Richard W.M. Jones
e5190e0932 Version 1.25.23. 2014-01-17 19:32:05 +00:00
Richard W.M. Jones
c537b26f20 uml: Fix rule which disables relative-paths test on UML.
This fixes commit e22bd2dcd2.
2014-01-17 19:23:27 +00:00
Richard W.M. Jones
716f6e4275 Version 1.25.22. 2014-01-17 15:48:22 +00:00
Richard W.M. Jones
e22bd2dcd2 tests: Add a test of relative paths, to make sure we don't break them.
In some places we turn relative paths passed by the caller into
absolute paths: for example in the libvirt backend, all relative paths
to disk images have to be turned into absolute paths (by calling
realpath) because otherwise libvirt doesn't work.

This has the potential to break things, especially considering that
qemu uses the path passed to it in order to resolve the relative paths
of backing files.

For example consider the case where 'overlay' is a symbolic link to
/dev/dm-1, but /dev/dm-1 contains a qcow2 which references './backing'
as its backing file.  If we rewrote 'overlay' to '/dev/dm-1', then
qemu would try to look up '/dev/backing' for the backing file and
fail.

See also:

https://bugzilla.redhat.com/show_bug.cgi?id=1053684
https://www.redhat.com/archives/libguestfs/2014-January/thread.html#00087
2014-01-17 15:33:26 +00:00
Richard W.M. Jones
96737fc5b7 launch: libvirt: Use C macros to simplify XML generation.
This commit implements some hairy C macros to simplify
XML generation.

Given the target XML:

  <cpu mode="host-passthrough">
    <model fallback="allow"/>
  </cpu>

The old code would have looked like this:

   XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "cpu"));
   XMLERROR (-1,
            xmlTextWriterWriteAttribute (xo, BAD_CAST "mode",
                                         BAD_CAST "host-passthrough"));
   XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "model"));
   XMLERROR (-1,
            xmlTextWriterWriteAttribute (xo, BAD_CAST "fallback",
                                         BAD_CAST "allow"));
   XMLERROR (-1, xmlTextWriterEndElement (xo));
   XMLERROR (-1, xmlTextWriterEndElement (xo));

The new code looks like this:

   start_element ("cpu") {
     attribute ("mode", "host-passthrough");
     start_element ("model") {
       attribute ("fallback", "allow");
     } end_element ();
   } end_element ();
2014-01-17 12:16:31 +00:00
Richard W.M. Jones
f106b30c41 drives: Avoid double-free along error path.
This fixes commit 4a0f5ed382.

A simple test of this:

  guestfish <<EOF
  add-drive "" readonly:1 format:raw protocol:nbd server:localhost:10000
  EOF

which would core dump.
2014-01-17 12:15:40 +00:00
Richard W.M. Jones
6b3e05e8da Minimum libvirt version is >= 1.1.1.
Note this is the version in RHEL 7.
2014-01-16 20:00:03 +00:00
Richard W.M. Jones
4a0f5ed382 drives: Centrally create overlays for read-only drives.
qemu has broken snapshot=on ... again.

Change the way that drives are created so that the backend no longer
has to use snapshot=on, <transient/> (which never worked), or UML's
corresponding COW-creation feature (also broken).

Instead of that, the src/drives.c code will create overlays when
required by calling into a new backend operation 'create_cow_overlay'.
This operation runs 'qemu-img create -b' or 'uml_mkcow' as determined
by the backend, and returns the name of the overlay.

The format of the overlay is still backend-specific because qemu needs
to use qcow2 and UML needs to use COW.

This patch also includes some factorization of the libvirt XML code.

This also drops the drv->priv (private per-drive data) field, since it
is no longer used by any backend.

This also moves the guestfs___drive_source_qemu_param utility
function, used & shared by the direct & libvirt backends only, into
src/launch-direct.c (from src/drives.c).
2014-01-16 18:01:46 +00:00
Richard W.M. Jones
07e47513df fish: Fix tests that specified qcow2 format, but passed a raw format disk.
In some tests we were specifying qcow2 as the image format when adding
a disk, but actually passing a raw format image.

Libguestfs previously did not detect this until guestfs_launch, but it
was still a bug to pass an incorrect format to guestfs_add_drive_opts.

It only worked because these tests never call guestfs_launch.

A later commit in this series will cause this to be detected
(sometimes) during guestfs_add_drive_opts.
2014-01-16 18:01:46 +00:00
Richard W.M. Jones
b3cf877e58 builder: Fix unterminated I<...> in man page.
Thanks: Lukas Zapletal.
2014-01-16 18:01:46 +00:00
Pino Toscano
5b42351294 builder: add a JSON output for --list
Simple JSON output for sources and templates, to be able to query them
with no need to parse unstructured outputs like the "--list-format long"
one.
2014-01-16 14:58:25 +01:00
Pino Toscano
e45bfe0d36 builder: add --list-format
Add a --list-format which allows to choose which in format should be the
output of --list.
2014-01-16 12:34:48 +01:00
Pino Toscano
91aae893c7 builder: small refactor of the list output
Switch from a boolean for the short/long list output to labels for the
actual format. Also, split the output of each list format to an own
function for easier maintaineance.
2014-01-16 11:49:05 +01:00
Pino Toscano
99d6e2c84e fuse: clear stat structs (RHBZ#660687).
Not all the fields of struct stat are actually filled by us. This caused
rubbish to appear in the microseconds fields, which were then used as
base when changing atime/ctime (with e.g. touch), triggering EINVAL by
futimens/utimensat when those rubbish values were out of the range
allowed for microseconds.
2014-01-15 18:51:18 +01:00
Pino Toscano
8bbd22d373 fuse: remove extra trailing \n in debug messages
debug() adds it already.
2014-01-15 14:02:24 +01:00
Richard W.M. Jones
7c431d7030 builder: Add documentation for how to import images into OpenStack. 2014-01-14 17:30:40 +00:00
Pino Toscano
775c6daf22 builder: test-virt-builder: check some results
Check at least some basic modifications in the image created with
virt-builder.
2014-01-14 13:30:19 +01:00
Pino Toscano
b7bb1f6cee builder, edit, fish: use copy-attributes
Make use of the new copy-attributes command to properly copy all file
attributes from a file to the new version of it.
2014-01-14 11:08:25 +01:00
Richard W.M. Jones
4c4480de28 Version 1.25.21. 2014-01-13 22:12:37 +00:00
Richard W.M. Jones
aba64a0327 fish: Add test-file-attrs.sh to EXTRA_DIST.
This fixes commit efb5f18415.
2014-01-13 22:12:33 +00:00
Richard W.M. Jones
e664739a57 builder: planner: Whitespace change. 2014-01-13 20:58:08 +00:00
Richard W.M. Jones
69d9c8515c builder: For performance, recommend using the --no-sync option. 2014-01-13 20:42:48 +00:00
Richard W.M. Jones
5136de98e7 builder: Add --no-delete-on-failure option to aid debugging.
This lets you debug failures in virt-builder, especially when scripts
or installing packages fails.
2014-01-13 20:30:43 +00:00
Richard W.M. Jones
6879fdf989 builder: Minor documentation fix to manual page. 2014-01-13 20:16:27 +00:00
Richard W.M. Jones
e68baf1954 Update generated files for new copy-attributes API.
This updates commit efb5f18415.
2014-01-13 19:26:01 +00:00
Richard W.M. Jones
5fa55389d4 builder: Fix documentation for --attach option. 2014-01-13 19:25:34 +00:00
Richard W.M. Jones
d885d6f6a9 builder: Document how to set Japanese in Debian 7. 2014-01-13 16:20:11 +00:00
Pino Toscano
efb5f18415 New API: copy-attributes.
This allows one to copy attributes (like permissions, xattrs,
ownership) from a file to another.
2014-01-13 14:57:44 +01:00
Pino Toscano
418c064bc1 sysprep: add --operations
Add a new --operation parameter which, similarly to --enable, can be
used to enable operations, but also to remove them, and to add/remove
the default operations and all the available ones.
2014-01-13 14:57:00 +01:00
Richard W.M. Jones
0d1c00211b Version 1.25.20. 2014-01-12 18:07:21 +00:00
Richard W.M. Jones
ed43cc12c4 builder/website: Add CirrOS signature file to EXTRA_DIST.
This fixes commit 40b88fdbc7.
2014-01-12 18:06:26 +00:00
Richard W.M. Jones
7500ae3f75 builder: Fix virt-builder test.
Add Europe/London timezone to phony Fedora guest.

This fixes commit dd1bfea513.
2014-01-12 17:49:48 +00:00
Richard W.M. Jones
fcdea83c6b builder: Document how to set Japanese language support in Fedora 20.
This updates/fixes commit 7e8ad13e86.
2014-01-12 17:10:30 +00:00
Richard W.M. Jones
a8c9aedd51 builder: Document that SELinux guests will reboot for autorelabel. 2014-01-12 14:59:46 +00:00
Richard W.M. Jones
f40e44c2f9 builder: Document how to set up local mirrors for performance and reliability. 2014-01-12 14:59:46 +00:00
Richard W.M. Jones
7e8ad13e86 builder: Document how to change the language/locale of a new guest. 2014-01-12 14:59:46 +00:00
Richard W.M. Jones
6d4ac696e5 builder: Add --link option for creating symbolic links.
This is useful for configuring systemd services.
2014-01-10 21:25:19 +00:00
Richard W.M. Jones
39bc959c5b builder: List --install packages in the same order as on the command line.
Previously the list was reversed.  Note this doesn't have any effect
on how the packages are installed since the guest package manager
doesn't care about the order.
2014-01-10 21:20:36 +00:00
Richard W.M. Jones
8ae6b6c9ff builder: Document how to change keyboard layout.
This is too complex to implement directly in virt-builder.

Instead we just document how to do it for some common Linux distros
using --run-command, --edit etc.
2014-01-10 21:20:36 +00:00
Richard W.M. Jones
1e1b027c1b builder: docs: Remove confusing reference to timezone. 2014-01-10 21:20:36 +00:00
Richard W.M. Jones
dd1bfea513 sysprep, builder: Add --timezone option to set timezone of guest.
You can use it like this:

  virt-sysprep --timezone Europe/London ...
  virt-builder --timezone Europe/London ...
2014-01-10 21:20:36 +00:00
Richard W.M. Jones
cea270de3b daemon: xattr: Remove unused variable.
Revealed by using ./configure --enable-gcc-warnings.
2014-01-10 21:20:30 +00:00
Pino Toscano
59d8cf62cb daemon: xattr: move the listxattrs code in an own function
Move in an own function the code that does the (l)listxattrs allocating
the buffer of the right legth, as it will be useful later.

No functional changes, just code motion.
2014-01-10 15:10:03 +01:00
Pino Toscano
7630a7bbbd daemon: xattr: simplify the enabling of the linuxxattrs features
Instead of enable them when having one of the two headers for it but
still checking for the HAVE_* availability of each *xattr() function
used, just enable the linuxxattrs as a whole when having any of the
needed headers (like before) and all the needed functions.

This might cause the linuxxattrs to not be available anymore on systems
without the whole set of *xattr() functions implemented, but OTOH it
simplifies the xattr.c implementations.
2014-01-09 18:59:19 +01:00
Richard W.M. Jones
746a0b1f19 tests: Add a regression test for libvirt authentication (RHBZ#1044014).
This tests the virConnectAuthPtrDefault wrapper path.
2014-01-08 21:11:52 +00:00
Richard W.M. Jones
873db60c0e tests: Add a regression test of libvirt authentication events.
This requires a change to libvirt (in libvirt >= 1.2.1), see:

https://www.redhat.com/archives/libvir-list/2014-January/msg00378.html
2014-01-08 21:11:52 +00:00
Richard W.M. Jones
4125064554 libvirt-auth: Provide a friendlier wrapper around virConnectAuthPtrDefault (RHBZ#1044014). 2014-01-08 21:11:52 +00:00
Richard W.M. Jones
06f7bea148 builder: Fix handling of --size parameter.
It now matches the documentation:

  "Select the size of the output disk, [...]

  Virt-builder will resize filesystems inside the disk image
  automatically.

  If the size is not specified, then one of two things happens.  If
  the output is a file, then the size is the same as the template.  If
  the output is a device, partition, etc then the size of that device
  is used."

This also adds checks to make sure that users don't try to shrink a
disk (which is not possible), and they don't try to resize larger than
the output block device.
2014-01-07 17:32:04 +00:00
Richard W.M. Jones
a403febb8c mllib: Add library function to run external command and slurp up the output.
This also changes a couple of functions to use this new library
function.
2014-01-07 17:30:57 +00:00
Richard W.M. Jones
3e802605b5 builder: Pass ~prog global (program name) around. 2014-01-07 17:30:20 +00:00
Richard W.M. Jones
ac41f616db builder: Note in man page how to specify size in bytes. 2014-01-07 14:52:08 +00:00
Richard W.M. Jones
40b88fdbc7 builder: Add CirrOS 0.3.1 disk image. 2014-01-04 12:37:40 +00:00
Richard W.M. Jones
169a4a34e5 Version 1.25.19. 2014-01-02 17:06:10 +00:00
Richard W.M. Jones
6c971faecf Update copyright dates for 2014. 2014-01-02 16:53:34 +00:00
Richard W.M. Jones
883208284b Allow ./configure --without-qemu.
This means there will be no default hypervisor, and effectively the
user will always have to specify one (eg. by setting LIBGUESTFS_HV or
calling guestfs_set_hv).

This is useful on platforms where qemu doesn't work, or where qemu is
not needed (eg. if you want to use UML, or you just want to compile
libguestfs without using/testing it).
2014-01-02 16:24:26 +00:00
Richard W.M. Jones
ee4ce2a029 ruby: Fix .new method (RHBZ#1046509).
The .new method was unintentionally broken in
commit 9466060201.

This fixes the .new method and allows it to be called with multiple
parameters, so you can use:

  Guestfs::Guestfs.new
  Guestfs::Guestfs.new()
  Guestfs::Guestfs.new(:close_on_exit => false)
  etc.

For backwards compatibility, Guestfs::create may still be used.

This commit also adds regression tests:

 - Use .new method in regular tests.  (Because this was not done
   before, we didn't catch the breakage.)

 - Test that ::create still works.

 - Test that args can be passed to .new method.
2013-12-27 13:22:20 +00:00
Richard W.M. Jones
480bd3a6d8 RHEL 6: ruby: Fix fallback to rake/rdoctask for old rake. 2013-12-27 13:22:20 +00:00
Richard W.M. Jones
c16f2ea53d RHEL 6: builder: Use iteri instead of List.iteri.
RHEL 6 OCaml did not have List.iteri, so use the version from
Common_utils instead.
2013-12-27 12:58:57 +00:00
Pino Toscano
ac1d5ba77b tests/mountable: skip if btrfs is not available
This test uses btrfs, so skip it if either the "btrfs" feature or the
btrfs filesystem is not available.
2013-12-23 17:02:02 +01:00
Pino Toscano
d20289186d inspect: fix detection of newer CirrOS versions (RHBZ#1045450).
Add an own case for CirrOS, based on the /etc/cirros/version file
provided in newer version instead of the Buildroot-generated
/etc/br-version.
2013-12-20 15:00:09 +01:00
Richard W.M. Jones
1580d965cd builder: Add support for RHEL 7.0 beta 1 (public beta) to the script. 2013-12-20 12:52:48 +00:00
Pino Toscano
a13696e99c Re-add regression tests for rh#563450
Added in 2392fae680 and removed in
be025369ad622867ecf08d5c9170e8e59d2d6294; now they should work with any
backend, as the device names are normalised and not change the guestfish
output depending on the used backend.

Thanks Richard for the hints.
2013-12-20 11:38:52 +01:00
Richard W.M. Jones
8acb91a584 launch: libvirt: Clearer message when libvirt screws up.
Instead of:

libguestfs: error: could not create appliance through libvirt.
Try using the direct backend to run qemu directly without libvirt,
by setting the LIBGUESTFS_BACKEND=direct environment variable.: internal error: process exited while connecting to monitor: qemu-system-x86_64: -drive file=/tmp/libguestfs3RnJSd/snapshot2,if=none,id=drive-scsi0-0-0-0,format=qcow2,cache=writeback: could not open disk image /tmp/libguestfs3RnJSd/snapshot2: Could not open backing file: Could not open '/home/lsm5/fimagebuilder/fedora-imagebuilder/fedora-imagebuilder-sda.qcow2': Permission denied

it will now say:

libguestfs: error: could not create appliance through libvirt.

Try running qemu directly without libvirt using this environment variable:
export LIBGUESTFS_BACKEND=direct

Original error from libvirt: internal error: process exited while connecting to monitor: qemu-system-x86_64: -drive file=/tmp/libguestfs3RnJSd/snapshot2,if=none,id=drive-scsi0-0-0-0,format=qcow2,cache=writeback: could not open disk image /tmp/libguestfs3RnJSd/snapshot2: Could not open backing file: Could not open '/home/lsm5/fimagebuilder/fedora-imagebuilder/fedora-imagebuilder-sda.qcow2': Permission denied
2013-12-19 18:43:09 +00:00
Richard W.M. Jones
d16db5a618 launch: libvirt: Don't default to using NULL for libvirt connection URI (RHBZ#1045033).
NULL means that libvirt gets to guess what connection URI we meant.
Currently it guesses qemu:///session for non-root and qemu:///system
for root.  Except if LIBVIRT_DEFAULT_URI is set in which case this is
used even if it's not appropriate.  Except if Xen is installed in
which case it guesses xen:/// which is not helpful at all.

Instead use qemu:///session (or qemu:///system for root -- that's
likely to be wrong, but we can't help that).

If the user really wants to use NULL and let libvirt guess, then they
can now specify the libvirt:null backend.

See:

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

A good way to test this is:

LIBVIRT_DEFAULT_URI=iambroken libguestfs-test-tool

The libguestfs libvirt backend should (after this commit) ignore
LIBVIRT_DEFAULT_URI.  However other parts of libguestfs will still use
it, eg. guestfs_add_drive_opts, guestfish '-d' option.
2013-12-19 14:32:27 +00:00
Richard W.M. Jones
b46a5511b3 builder: Add --update option to update template/core packages. 2013-12-19 12:54:24 +00:00
Richard W.M. Jones
6814888774 run: Use timeout --foreground option.
If timeout doesn't have this option (RHEL 6) don't use timeout at all.

Attempt to fix RHBZ#1025269.
2013-12-19 08:21:53 +00:00
Richard W.M. Jones
05b3aefb8b Version 1.25.18. 2013-12-18 20:42:41 +00:00
Richard W.M. Jones
be025369ad tests/regressions: Remove regression tests rhbz563450*.
These two tests failed 'make check-release' (particularly the
UML tests).

This partially reverts commit 2392fae680.
2013-12-18 20:40:54 +00:00
Richard W.M. Jones
80d2677784 Version 1.25.17. 2013-12-18 18:38:40 +00:00
Richard W.M. Jones
70db54974b fish: Fix memory leak in inspect/-i code (detected by valgrind).
This only manifested in the new virt-diff tool.
2013-12-18 18:37:50 +00:00
Richard W.M. Jones
d08efbec83 Version 1.25.16. 2013-12-18 17:38:26 +00:00
Richard W.M. Jones
34cbde5b88 builder: Change how EXTRA_DIST is generated.
So that we don't need to change this every time we upload
a new operating system signature.
2013-12-18 17:37:56 +00:00
Richard W.M. Jones
308292e4fb Update to latest gnulib. 2013-12-18 16:19:08 +00:00
Richard W.M. Jones
1fcea09ee2 appliance: Create an /etc/resolv.conf file referring to qemu user network nameserver (RHBZ#1044585). 2013-12-18 16:03:43 +00:00
Richard W.M. Jones
1ee879f3e5 New tool: virt-diff.
This tool can be used to show the differences between two
disk images.
2013-12-18 15:15:53 +00:00
Richard W.M. Jones
c7a2dce607 daemon: Sort extended attributes when returning them.
A single file can have multiple xattrs.  Previously these were
returned in the same order as the kernel returns them.  However it is
more useful if they are sorted by attribute name.
2013-12-18 15:15:53 +00:00
Richard W.M. Jones
937ea7f16f virt-ls: visit: Fix a bug with handling of extended attributes.
The wrong pointer was passed to the visitor_function, resulting in it
seeing the placeholder xattr entry (the one which stores the length of
the list of xattrs - see
http://libguestfs.org/guestfs.3.html#guestfs_lxattrlist ).

virt-ls doesn't list xattrs at the moment, hence this bug was not seen
before.
2013-12-18 15:15:53 +00:00
Richard W.M. Jones
276ef546c4 virt-ls: visit: Add an opaque pointer to the visitor function.
Useful for passing around data, but not used by virt-ls.  It
will be used by virt-diff.
2013-12-18 15:15:53 +00:00
Richard W.M. Jones
a93d418c3e virt-ls: Move visit and other functions to common code library.
This will allow us to reuse these functions in virt-diff.
2013-12-18 15:15:53 +00:00
Richard W.M. Jones
2b674ccdd3 fish: options: Add alternate add_drives_handle and inspect_mount_handle.
These functions don't use the implicit 'g' global variable, but
take a handle argument instead.
2013-12-18 15:15:53 +00:00
Richard W.M. Jones
c513d3a6e5 fish: Add option parsing for -A and -D options.
Same as -a and -d except these add the drives to a second list
of drives (drvs2).
2013-12-18 15:15:53 +00:00
Richard W.M. Jones
28adf7cea6 fish: Move -d option parsing to common function.
This is essentially just code motion, except:

(1) It cleans up a few variable declarations which were implicitly
used by the old macro that aren't needed any more.

(2) The options are reordered alphabetically.
2013-12-18 15:15:52 +00:00
Richard W.M. Jones
d9826467c2 fish: Deprecate the -D option (prefer --no-dest-paths instead).
This option will now print a warning:
guestfish: warning: -D option is deprecated, use --no-dest-paths instead
2013-12-18 15:15:52 +00:00
Richard W.M. Jones
78b9229bc8 lib: Export guestfs_compare_* functions for comparing structs and lists of structs. 2013-12-18 15:15:52 +00:00
Richard W.M. Jones
3d398687be lib: Export guestfs_copy_* functions for copying structs and lists of structs.
These complement the guestfs_free_* functions.
2013-12-18 15:15:52 +00:00
Richard W.M. Jones
0f3489ba6b lib: Rename cleanup-structs.c -> structs-cleanup.c and free-structs.c -> structs-free.c.
Just renaming generated files, no other effects.
2013-12-18 15:15:52 +00:00
Richard W.M. Jones
193b81a633 daemon: Improve error message for readlink call. 2013-12-18 15:15:52 +00:00
Richard W.M. Jones
882b91cb48 generator: Fix bug in documentation of guestfs_free_* functions.
These appeared in the documentation as:

 void guestfs_free_int_bool (struct guestfs_free_int_bool *);
                                            ^^^^

which is obviously wrong.
2013-12-18 15:15:52 +00:00
Richard W.M. Jones
d39b4dc606 fish: Ensure print_inspect_prompt can only be called by guestfish.
Code clean-up.
2013-12-18 15:15:52 +00:00
Richard W.M. Jones
a4f4f9c075 inspector: Ensure low-level inspection functions can only be called by virt-inspector.
Code clean-up.
2013-12-18 15:15:52 +00:00
Richard W.M. Jones
d6e4709f5b fish: options: Fix incorrect comment. 2013-12-18 15:15:52 +00:00
Richard W.M. Jones
076d73696e virt-cat, virt-filesystems, virt-ls don't use libconfig.
So it doesn't need to be linked in.
2013-12-18 15:15:51 +00:00
Richard W.M. Jones
685a28eb2c tests: guests: Add /etc/motd test file to Fedora test image. 2013-12-18 15:15:51 +00:00
Richard W.M. Jones
c4646290d6 builder: no_proxy environment variable should be passed to the appliance. 2013-12-18 15:15:51 +00:00
Richard W.M. Jones
6f3ca3699d builder: Add Fedora 20 image. 2013-12-17 16:08:45 +00:00
Richard W.M. Jones
c4fdb4023e builder: Remove blank line. 2013-12-16 14:14:11 +00:00
Pino Toscano
2392fae680 drives: add CD-ROM disk images as read-only drives (RHBZ#563450).
The current add_cdrom way basically appends a new raw "-cdrom /path"
parameter to the qemu invocation (even when using libvirt as backend),
hence such images are seen as "CD-ROM drives" inside the appliance.
However, there is no need for such particular behaviour, as they need to
be handled as normal (read-only) drives.

Adding CD-ROM disk images as drives also changes the device names used
for them inside the appliance from /dev/srN to the usual e.g. /dev/sdX.

These changes fix different issues:
- it is possible to start guestfish without adding disks with -a, then
  just add-cdrom and run
- list-devices does not cause guestfsd to crash when sorting the list
  of devices (exposed by the test case in RHBZ#563450)
- the result of list-devices now reflects the order images were added
  (RHBZ#563450)

add_cdrom is still deprecated, but now in favour of add_drive_ro
(instead of add_drive), with its documentation reflecting that.

Add two small regression tests for the fixes described above.
2013-12-16 14:54:27 +01:00
Richard W.M. Jones
3cf5a25e3f builder: Refuse to write to a char device or /dev/null.
virt-builder --output /dev/null is tempting, but not possible, and
might result in /dev/null being deleted(!)  Check for this case and
prevent it happening.
2013-12-14 18:54:56 +00:00
Richard W.M. Jones
0037820ee0 builder: Only use virt-resize --no-sparse when writing to a block device.
Previously we would use the virt-resize --no-sparse option if the
final output file was a block device.  This is safe, but unnecessary
for example if virt-resize was used as an intermediate step.  So only
use this option if virt-resize is actually writing to the block
device.
2013-12-14 18:53:20 +00:00
Richard W.M. Jones
0cdc864588 Version 1.25.15. 2013-12-14 17:32:40 +00:00
Richard W.M. Jones
d5d1dac3ac builder: Add a link to blog posting about the planner.
http://rwmj.wordpress.com/2013/12/14/writing-a-planner-to-solve-a-tricky-programming-optimization-problem/
should help people to understand how this code works.
2013-12-14 16:43:40 +00:00
Richard W.M. Jones
6901cd2250 builder: tests: Add test-virt-builder-planner.sh to EXTRA_DIST.
This fixes commit a27963b67b.
2013-12-14 16:18:50 +00:00
Richard W.M. Jones
3f433d90f2 builder: tests: Fix virt-builder --list output.
This fixes commit a27963b67b.
2013-12-14 16:18:23 +00:00
Richard W.M. Jones
a27963b67b builder: Add a test of the planner.
This tries out many combinations of size/format and ensures
that the planner can deal with them.
2013-12-14 15:50:37 +00:00
Richard W.M. Jones
7af9cabade builder: Flush debug info after printing it. 2013-12-14 15:50:04 +00:00
Richard W.M. Jones
0af1e55e68 builder: planner: Handle no format= in source case correctly. 2013-12-14 15:49:25 +00:00
Richard W.M. Jones
62cc7d3361 builder: Use a planner to work out how to convert the template to the final image.
The original template might be, say, xz-compressed raw of a certain
size.  We need to work out how to convert it to, say, qcow2 with a
larger size, in as few operations as possible.

Instead of using a nasty aggregation of special cases to do this, use
a breadth-first search over all possible trees to try to find an
optimal plan.

(Actually the current implementation isn't optimal, but it's fine for
virt-builder.)
2013-12-14 13:21:26 +00:00
Richard W.M. Jones
81b4e5d5cd builder: Move is_block_device function into common utilities.
This is just code motion.
2013-12-14 13:21:26 +00:00
Richard W.M. Jones
d98fbf2071 resize: Move roundup64 function into common utilities.
This is just code motion.
2013-12-14 13:21:25 +00:00
Hilko Bengen
d57d8f22de golang: Don't run launch test if appliance has not been built. 2013-12-13 18:46:57 +01:00
Pino Toscano
30936f499e sysprep: remove some Pegasus files, like certs (RHBZ#1041552). 2013-12-13 11:04:30 +01:00
Richard W.M. Jones
3ae829d752 golang: Add note about difficulty of parsing go version numbers. 2013-12-13 08:46:04 +00:00
Richard W.M. Jones
29cfb10bd4 Version 1.25.14. 2013-12-12 16:18:37 +00:00
Pino Toscano
1877c10603 fuse: provide a stub "flush" implementation (RHBZ#660687).
It seems that FUSE can invoke flush to make sure the pending changes
(e.g. to the attributes) of a file are set. Since a missing flush
implementation is handled as if it were returning ENOSYS, this can cause
issues later.

To overcome this, just provide a stub implementation which does nothing,
since we have nothing to do and don't want to have FUSE error out.

Furthermore, uncomment the timestamp checks in test-fuse.sh, since now
they should be working fine.
2013-12-12 16:23:50 +01:00
Richard W.M. Jones
7775c121f7 recipes: Use new style -a/-d options in virt-edit example. 2013-12-11 19:22:12 +00:00
Hilko Bengen
0c0caaddb0 po: Create empty files to be edited by xgettext
This avoids:

    xgettext: error while opening "libguestfs.pot-t" for reading: No such file or directory

which I observed with xgettext (GNU gettext-tools) 0.18.3
2013-12-10 21:53:46 +01:00
Hilko Bengen
dabc7a4a56 Fix builder/website test in out-of-tree builds 2013-12-10 21:52:52 +01:00
Hilko Bengen
cbc0e79d38 Fix manpage generation in out-of-tree builds 2013-12-10 21:52:52 +01:00
Richard W.M. Jones
b121015221 daemon: mkfs: Use -I option to force mkfs.fat to write a filesystem over a whole device (RHBZ#1039995).
If you use virt-make-fs to create a partitionless FAT-formatted disk
image then currently you will get an error:

$ virt-make-fs --type=fat . /tmp/test.img
'mkfs' (create filesystem) operation failed.
Instead of 'fat', try 'vfat' (long filenames) or 'msdos' (short filenames).
mkfs: fat: /dev/sda: mkfs.fat: Device partition expected, not making filesystem on entire device '/dev/sda' (use -I to override) at /usr/bin/virt-make-fs line 508, <PIPE> line 1.
      ...propagated at /usr/bin/virt-make-fs line 518, <PIPE> line 1.

With this patch, the error goes away and partitionless disks can be
created.
2013-12-10 13:46:54 +00:00
Richard W.M. Jones
1f0e75213b proto: Remove another error message which hides earlier error.
When receive_file_data calls guestfs___recv_from_daemon, and that
function returns -1, it adds the following error to the handle:

  receive_file_data: parse error in reply callback

However this hides a more specific error message which was already
added by guestfs___recv_from_daemon.
2013-12-10 13:34:13 +00:00
Richard W.M. Jones
78df80d649 proto: Remove error message which hides earlier error.
When chunked encoding fails, the following error is added to
the handle:

  [filename]: error in chunked encoding

However all paths returning -1 from receive_file_data already set a
more specific error, which this error hides.
2013-12-10 13:34:13 +00:00
Pino Toscano
41729c6556 lib: fix newline in error output (RHBZ#923355). 2013-12-10 10:32:12 +01:00
Pino Toscano
1472fbd903 sysprep: mention globbing in help for --delete
Followup of ed4bcb119c.
2013-12-09 19:37:51 +01:00
Pino Toscano
ed4bcb119c sysprep: allow to specify globbing for --delete
Adapt the globbing part from the old --remote-path work previously
proposed for sysprep [1], allowing --delete to perform globbing when
deleting paths.

[1] https://www.redhat.com/archives/libguestfs/2013-October/msg00045.html
2013-12-09 15:26:43 +00:00
Pino Toscano
7a41f5c126 launch: switch from -nographic to -display none
The latter is a better way to disable the qemu display output as we
need to, without enabling extra devices (which are disabled already,
anyway).

Also, related to the change above, ban the -display parameter from the
ones that can be supplied by the user.
2013-12-09 15:26:43 +00:00
Pino Toscano
c89ffbc152 sysprep: remove more anaconda and tuned logs (RHBZ#1039540). 2013-12-09 15:26:43 +00:00
Richard W.M. Jones
a0c642c156 Version 1.25.13. 2013-12-08 12:43:02 +00:00
Hilko Bengen
3f44e09cb5 Fix virt-builder tests for out-of-tree build 2013-12-07 21:40:00 +01:00
Hilko Bengen
38410afc5a Fix installing man-pages from out-of-tree build 2013-12-07 21:40:00 +01:00
Richard W.M. Jones
f631770974 Add CentOS 6.5 image. 2013-12-07 10:30:14 +00:00
Richard W.M. Jones
5c76af3a95 recipes: Add a recipe for masking a systemd service. 2013-12-06 18:58:17 +00:00
Richard W.M. Jones
023128a0eb Revert half of "builder: translate more user-visible strings"
Don't change "os-version" to "OS version".  It's intended to be the
same as the virt-builder man page, which consistently calls this the
"os-version" string.

This partially reverts commit ee0e56f43e.
2013-12-06 15:03:41 +00:00
Richard W.M. Jones
915908fcdd launch: direct: Pass -enable-fips option if qemu supports it. 2013-12-05 22:43:53 +00:00
Pino Toscano
178bc878e1 po: fix dependencies for libguestfs.pot extraction
Fix the dependencies of the libguestfs.pot target: other than using the
right make variables holding the contents of the POTFILES, depend also
on the POTFILES themselves.
2013-12-05 18:59:21 +00:00
Pino Toscano
c60dc40fe4 fish: improve the command error messages
- when a command needs no parameters, tell that explicitly instead of
  "command should have 0 parameters"
- use gettext's plural form when printing the number of required
  arguments
- improve the error message for a variable number of parameters limited
  only in the maximum number of them, using also a plural form
2013-12-05 15:44:00 +00:00
Pino Toscano
1a9a8ab48f po: fix broken message extraction
Extracting separately the pot for the various languages and then
creating manually the global pot (by manually joining the above ones
after having stripped their headers) is wrong, since other than being
an hack it can create an invalid pot when the same message appears in
sources written in different languages.

Instead, a cleaner and safer solution is to first let ocaml-gettext
(if available) extract the messages for the ml files, and then use
xgettext to extract the messages for the other languages, joining the
new messages to the existing (or not) pot file.
2013-12-05 15:40:04 +00:00
Pino Toscano
ee0e56f43e builder: translate more user-visible strings
Translate also the "OS version" and "Notes" strings that appear in the
--long output.
2013-12-04 20:50:29 +00:00
Richard W.M. Jones
6739073757 Version 1.25.12. 2013-12-02 13:40:56 +00:00
Pino Toscano
7af3602f5f inspect: improve detection of FreeBSD install discs (RHBZ#1033207).
Check for /boot/loader.rc as "install disc" detection, using it to mark
FreeBSD install discs.
Also, check for /mfsroot.gz to see whether such disc is also a live one.

See also RHBZ#1033207.
2013-11-28 15:10:52 +00:00
Pino Toscano
e754add14c inspect: ignore special CD devices on FreeBSD install discs
/etc/fstab in installation discs of FreeBSD can have an entry pointing
to the mounted CD itself; skip it as it is done with other CD devices in
check_fstab.
2013-11-28 15:08:02 +00:00
Pino Toscano
75bf5cfebf inspect: recognise Debian live images as such
Check for filesystem.squashfs also in /live, since it is where
live-build places it.
2013-11-28 15:08:02 +00:00
Richard W.M. Jones
04769ad507 launch: direct: Whitespace fix. 2013-11-26 18:32:01 +00:00
Richard W.M. Jones
e7fa7f4d16 launch: Print program and version as part of standard debug output when launching the handle.
There are a lot of cases where people post debugging output, but we're
not sure precisely which version they are using.
2013-11-25 23:25:44 +00:00
Richard W.M. Jones
97ea81eb21 tests: Test that network drives are mapped to correct qemu -drive parameters.
Although this test only specifically tests the direct backend, the
same code is shared with the libvirt backend in some circumstances
(eg. creating readonly drives).  So this is testing a bit of both.
2013-11-25 22:58:23 +00:00
Richard W.M. Jones
45afcdb307 ocaml: Remove unused function prototype. 2013-11-25 20:07:37 +00:00
Richard W.M. Jones
1ea1646e6f po-docs: If *.pod files are missing, tell user to run 'make update-po'.
I'm now fairly convinced it's not possible to do this automatically.
However we should at least tell the user what needs to be done.
2013-11-25 18:27:00 +00:00
Richard W.M. Jones
d81c577eff Version 1.25.11. 2013-11-23 09:46:44 +00:00
Richard W.M. Jones
53e45c8280 sysprep: Fix broken test when backend is UML.
This fixes commit cc1888a497.
2013-11-23 09:37:17 +00:00
Richard W.M. Jones
78d452e9a6 Version 1.25.10. 2013-11-22 17:16:11 +00:00
Richard W.M. Jones
5ee193433a lua: Don't redefine lua_objlen if already defined.
lua 5.2.2 seems to define this symbol already.
2013-11-22 17:15:20 +00:00
Richard W.M. Jones
c90b0eff98 Version 1.25.9. 2013-11-22 16:39:46 +00:00
Richard W.M. Jones
cc1888a497 sysprep: Add a test suite for the --password option. 2013-11-22 15:10:44 +00:00
Richard W.M. Jones
3712249f96 builder/sysprep: Allow accounts to be locked (RHBZ#1028660).
This allows you to select both locked accounts and disabled
passwords.  The two are subtly different concepts.

A locked account [cf. passwd -l] puts "!!" at the beginning of the
shadow password field.  Locking is reversible, because the "!!"  can
be removed, restoring the original password.  Therefore "locked"
acts as a flag in front of an existing selector.

A disabled account has "*" in the password field.  Therefore it has no
password.

Note that an account may be both locked and disabled, although this is
probably not useful.  The shadow password field will contain "!!*".
2013-11-22 15:10:44 +00:00
Richard W.M. Jones
02b5f00b2b builder/sysprep: Allow 'random' as a password selector.
This chooses a random password.
2013-11-22 14:16:09 +00:00
Richard W.M. Jones
91450b5f9a mllib: password: Replace password string with password_selector type.
This is just code motion, there is no functional change.
2013-11-21 17:34:59 +00:00
Richard W.M. Jones
9186438937 builder/sysprep: Describe --password/--root-password option as "selector".
It now appears in the respective man pages as:

  --root-password selector

or:

  --password selector

This avoids confusion from people who think these command line options
take the password directly.
2013-11-21 17:13:37 +00:00
Richard W.M. Jones
c7b0457c32 ls: Note that you can use virt-cat or guestfish to show file differences. 2013-11-21 17:13:37 +00:00
Richard W.M. Jones
9024551245 ls: In image diff example, don't use --time-t.
It shows differences in file access times (atime) which is not
actually that useful for most people.
2013-11-21 17:13:37 +00:00
Richard W.M. Jones
2d9f69db61 FAQ: "execl: /init: Permission denied" error also caused by /init not being executable.
This updates commit 98cd329323.
2013-11-19 17:50:04 +00:00
Richard W.M. Jones
98cd329323 FAQ: Attempt to explain "execl: /init: Permission denied" error. 2013-11-19 16:59:34 +00:00
Richard W.M. Jones
acce28e887 lib: Make sure -lselinux is used when linking libguestfs.so.
If libselinux was detected, it was not added to the linker command
line.  This still worked (at least on Fedora) because some other
library pulls in the dependency implicitly, possibly libvirt.  However
this broke on Arch:

https://aur.archlinux.org/packages/libguestfs/

Reported by and thanks: Antoni Segura Puimedon.
2013-11-19 09:09:02 +00:00
Richard W.M. Jones
59596810b0 daemon: btrfs: Upstream 'btrfs device add' command now needs '--force' option to work.
However earlier versions didn't have the --force option, so we
have to detect it.
2013-11-15 09:05:43 +00:00
Richard W.M. Jones
64f93b36de Version 1.25.8. 2013-11-14 17:01:12 +00:00
Richard W.M. Jones
793a5677cb virt-win-reg: Allow URIs (RHBZ#912193). 2013-11-14 16:34:07 +00:00
Richard W.M. Jones
c032130226 perl: Give error instead of crashing if optarg is not an array reference.
$g->add_drive ("", server => 1);

would segfault.  Now it gives a nice error instead:

  array reference expected for 'server' argument at [line]
2013-11-14 15:45:23 +00:00
Török Edwin
6a1061663f Avoid modulo bias in random password generation
Char.code (input_char chan) mod nr_chars has modulo bias because
the original interval is not a multiple of the destination interval,
i.e. 256 mod nr_chars != 0.

One way to fix this is to keep generating random numbers until they fall outside
the interval where modulo bias occurs, that is accept only c=[256 % nr_chars, 256).
That interval maps back to [0, nr_chars), and has a length of
(256 - 256 % nr_chars), which is a multiple of nr_chars.

RWMJ:
 - Modify the code so it goes into a utility library.
 - Use the same code across virt-builder and virt-sysprep.
2013-11-14 10:52:16 +00:00
Richard W.M. Jones
f013b15fa1 mllib: Add a utility function for safely reading from /dev/urandom.
OCaml's buffered 'in_channel' has a 64k buffer, so using it to read a
few bytes from /dev/urandom removes a lot of the system's entropy (for
example /proc/sys/kernel/random/entropy_avail goes from ~3000 to 128).

This patch was originally by Edwin Török for builder.ml.  I
generalized it because there are two other places where we did
over-sized reads from /dev/urandom.
2013-11-14 10:52:16 +00:00
Richard W.M. Jones
544d6b25e3 builder: Clarify architecture section of the documentation.
I have checked and cross architecture builds work fine:

http://rwmj.wordpress.com/2013/11/09/virt-builder-running-on-arm/#content
2013-11-12 19:57:29 +00:00
Richard W.M. Jones
fb41ce252f Change supermin man pages section 8 to section 1.
Corresponding change in upstream supermin:
cb3f9e8bba
2013-11-12 08:49:45 +00:00
Richard W.M. Jones
edacd479fa podwrapper: virt-install is not a libguestfs page.
This now redirect to http://man.he.net/man1/virt-install, but this is
unfortunately a 404.

Incomplete fix for RHBZ#1029134.

Thanks: Paul Maunders.
2013-11-11 18:38:37 +00:00
Richard W.M. Jones
4b2e9c9264 builder: debian: Remove bogus proxy from apt configuration.
Thanks: Daniel Miranda
2013-11-11 13:35:17 +00:00
Richard W.M. Jones
50aca447ea builder: After building a template, print fields for index file. 2013-11-11 13:17:18 +00:00
Richard W.M. Jones
299e3153ee Version 1.25.7. 2013-11-08 16:14:41 +00:00
Richard W.M. Jones
300b357eb9 builder/website: Add some missing files to EXTRA_DIST. 2013-11-08 16:13:35 +00:00
Richard W.M. Jones
63ec023f19 builder: Allow /tmp or /Temp to be symlinks to a directory. 2013-11-07 15:30:13 +00:00
Richard W.M. Jones
7a8addb485 builder: Allow upload to directory when target is a symlink to a directory. 2013-11-07 15:29:51 +00:00
Richard W.M. Jones
e982c0a2f5 Update TODO: Remove some things that we've done. 2013-11-07 14:06:00 +00:00
Richard W.M. Jones
55795e652e builder/website: Add support for RHEL 5 releases to internal RHEL script. 2013-11-06 21:42:54 +00:00
Richard W.M. Jones
133ae6a34b builder/website: Don't use http_proxy in internal RHEL script. 2013-11-06 21:42:54 +00:00
Richard W.M. Jones
e906d30c62 builder: After compressing the template, calculate the SHA-512 hash. 2013-11-06 21:39:52 +00:00
Richard W.M. Jones
f459fe47f8 builder: Add a Scientific Linux 6 image. 2013-11-06 21:39:34 +00:00
Richard W.M. Jones
7147d41564 builder: Old OCaml didn't have List.iteri, so add a utility function. 2013-11-06 19:22:57 +00:00
Richard W.M. Jones
e9294668b4 builder: Add script for making Red Hat Enterprise Linux instances.
This uses some internal Red Hat repositories so it's not generally
useful, but could be easily adapted by users.
2013-11-06 16:54:20 +00:00
Richard W.M. Jones
b3a106cefc builder: Fail if lex is not installed.
This completes the fix for commit a4800e2d4f.
2013-11-06 15:08:08 +00:00
Richard W.M. Jones
4dd6e4328c builder: Use common code to sysprep, sparsify and compress images. 2013-11-06 13:42:58 +00:00
Adam Huffman
c76912cd77 builder: Add script for making Scientific Linux instances.
RWMJ:
 - Renamed the script from sl.sh -> scientificlinux.sh
 - The output file is called scientificlinux-$version
 - I fixed some whitespace issues so it's now similar to the CentOS script.
2013-11-06 13:32:32 +00:00
Richard W.M. Jones
f526fe1766 builder: Fail if bison is not installed.
This partially fixes commit a4800e2d4f.
2013-11-05 22:25:59 +00:00
Richard W.M. Jones
4339b55d10 builder: Add dependencies which automake doesn't generate correctly.
This is a further attempt, earlier commits:
commit e3ac293e86
commit dfe97b352d
2013-11-05 17:40:20 +00:00
Richard W.M. Jones
d669db7ff0 Update to latest gnulib to get hash relicensing change (thanks Jim Meyering). 2013-11-05 16:54:37 +00:00
Richard W.M. Jones
663012c5ff builder: Fix centos script - output filename was wrong.
This fixes commit 2f3fb2420e.
2013-11-05 16:51:08 +00:00
Richard W.M. Jones
6db81dc72e Version 1.25.6. 2013-11-05 16:13:17 +00:00
Richard W.M. Jones
e3ac293e86 builder: Add dependency from index-parse.h to index-validate.
For some reason automake doesn't get this dependency right,
resulting in occasional build failures if yacc races the
rest of the build.
2013-11-05 15:56:34 +00:00
Richard W.M. Jones
01551e5462 builder: Add some generated files to CLEANFILES.
This updates commit a4800e2d4f.
2013-11-05 15:43:27 +00:00
Richard W.M. Jones
dfe97b352d builder: Add missing dependency.
index-parser-c.c depends on index-parse.h being created first.
However without an explicit dependency, this is not done (and implicit
deps don't work because automake doesn't sufficiently understand OCaml
programs).

This fixes commit a4800e2d4f.
2013-11-05 15:42:05 +00:00
Richard W.M. Jones
96eab7cc00 Version 1.25.5. 2013-11-05 15:19:08 +00:00
Richard W.M. Jones
ab801c2657 Don't include email addresses in AUTHORS file.
Some authors had duplicate entries because they had multiple
email addresses.
2013-11-05 15:18:16 +00:00
Richard W.M. Jones
92206e8d09 builder/website: Add validate.sh test script to EXTRA_DIST.
This fixes commit 154bfb7dd4.
2013-11-05 15:15:17 +00:00
Richard W.M. Jones
2f3fb2420e builder: Replace centos-6.sh with a single script.
Just use:

  ./centos.sh 6

Note that you don't need to be root.
2013-11-05 14:25:24 +00:00
Richard W.M. Jones
af9e9299bf builder: Replace debian-<NN>.sh with a single script.
Just use:

  ./debian.sh 6 squeeze

Note that you don't need to be root.
2013-11-05 14:25:24 +00:00
Richard W.M. Jones
91b5e7fb37 builder: Replace ubuntu-<NN>.sh with a single script.
Just use:

  ./ubuntu.sh 10.04 lucid

Note that you don't need to be root.
2013-11-05 14:25:24 +00:00
Richard W.M. Jones
ade0f1a97d builder: Replace fedora-<NN> shell & kickstart with a single script.
Just use:

  ./fedora.sh 18

Note that you don't need to be root.
2013-11-05 14:25:24 +00:00
Richard W.M. Jones
681c88ef5d builder: Internal implementation of parallel xzcat (pxzcat).
Instead of calling out to the pxzcat program, use an internal
implementation.  This requires liblzma to be available at build time.
If it's not available, fall back to using regular xzcat.

It is intended that eventually this code will go away when regular
xzcat / unxz is able to use threads.
2013-11-05 12:45:42 +00:00
Nikos Skalkotos
7e2576a74a Fix fstab block device resolution for FreeBSD
The device name prefix for IDE hard drives used to be `ad' but now
is `ada' (http://www.freebsd.org/doc/handbook/disks-naming.html).
For virtio hard drives it is `vtbd'.

Under an MBR partition table a slice will be used, so the name of
the first partitions will be either `ada0s1a' or `vtbd0s1a'. Under a
GPT partition table, where no slice is needed, the name of the first
partition will be either `ada0p1' or `vtbd0p1'.

Signed-off-by: Nikos Skalkotos <skalkoto@grnet.gr>
2013-11-05 12:45:42 +00:00
Richard W.M. Jones
154bfb7dd4 builder/website: Add index validation test script. 2013-11-05 07:27:35 +00:00
Richard W.M. Jones
cd10f6f4db builder: Add an extra Makefile.am to builder/website. 2013-11-05 07:25:14 +00:00
Richard W.M. Jones
2035a75d66 builder: Fix missing files in EXTRA_DIST.
This fixes commit a4800e2d4f.
2013-11-05 07:15:19 +00:00
Richard W.M. Jones
004bf7c3db Version 1.25.4. 2013-11-04 22:33:48 +00:00
Richard W.M. Jones
2dca9d7194 builder: Fix 'check-valgrind' so it does something in this directory. 2013-11-04 22:13:23 +00:00
Richard W.M. Jones
a4800e2d4f builder: Add a real scanner/parser for index files.
This adds a tool called virt-index-validate to validate index files.
2013-11-04 21:49:01 +00:00
Richard W.M. Jones
3ffdddbedf builder: Don't use git tree / libguestfs.git to refer to the source.
git is just a VCS.
2013-11-04 21:36:22 +00:00
Richard W.M. Jones
50486232db df: Allow parallel test to be skipped.
It currently fails because of
https://bugzilla.redhat.com/show_bug.cgi?id=1025942
2013-11-02 08:31:27 +00:00
Richard W.M. Jones
5280e3031b builder: Only warn about unknown fields in the index if -v option is used.
Allows us to add new fields in future without having pointless
warnings from old versions of virt-builder.
2013-11-01 16:47:37 +00:00
Richard W.M. Jones
8d14abb0df builder: Allow checksum= as an alias for checksum[sha512]=.
This is for backwards compatibility with virt-builder 1.24.0 which
could not parse a key that contains square brackets and numbers.

This updates commit 4b73e0be29.
2013-11-01 16:45:52 +00:00
Richard W.M. Jones
5b9ac57d4e builder: Update TODO file with some more ideas. 2013-11-01 15:10:11 +00:00
Richard W.M. Jones
20ad6becd8 Version 1.25.3. 2013-11-01 14:45:46 +00:00
Richard W.M. Jones
e9d908929f builder: Add missing files to EXTRA_DIST. 2013-11-01 14:45:46 +00:00
Richard W.M. Jones
7113aee0b4 ./run: Disable timeouts in tests on RHEL 6.
Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1025269
2013-11-01 14:33:25 +00:00
Richard W.M. Jones
bb4e882d61 builder: Allow multiple source paths to be specified.
Users can now specify multiple source paths, eg:

  virt-builder --source http://example.com/foo \
    --source http://example.com/bar

to get templates from multiple places.

There is still only one built-in path, but we can add more later.
2013-11-01 14:16:34 +00:00
Richard W.M. Jones
b25e8da6d6 builder: When debugging, print curl command before running it. 2013-11-01 13:48:30 +00:00
Richard W.M. Jones
4b73e0be29 builder: index: Add checksum[sha512]=... option and deprecate template sigs.
We don't need to sign individual templates, provided the signed index
file contains the cryptographically secure checksums of the templates.
Since the index file cannot be interfered with and the checksums
cannot be spoofed, this is sufficient to ensure the integrity of the
templates.

Note the template signatures are now deprecated and will be removed in
libguestfs 1.26.  To avoid any backwards compatibility issues, I will
backport the relevant changes to the stable-1.24 branch.

Thanks Dennis Gilmore for pointing out that we could do this.
2013-11-01 08:21:52 +00:00
Richard W.M. Jones
3b746ee796 ./run: Fix massive thinko in $PATH setting.
This fixes commit 76c20d761b.
2013-11-01 08:21:52 +00:00
Richard W.M. Jones
984b024c5a builder: Whitespace change in error message. 2013-10-29 21:03:01 +00:00
Richard W.M. Jones
124f20a1ca builder: Be more careful about deleting temporary files on exit. 2013-10-29 21:02:39 +00:00
Richard W.M. Jones
9ac076c269 builder: Whitespace fix in Index_parser module. 2013-10-29 21:01:54 +00:00
Richard W.M. Jones
2191b9ae40 Version 1.25.2. 2013-10-29 19:45:23 +00:00
Wanlong Gao
e4c9212a8e sysprep: add feature of deleting specified paths
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
2013-10-29 19:24:08 +00:00
Richard W.M. Jones
42e445f986 builder: Add -m/--memsize and --smp command line options. 2013-10-29 19:23:33 +00:00
Richard W.M. Jones
eb4e356bc3 launch: direct: Add some code to enable qemu / gdb debugging.
See the comment for details.

Note this is disabled by default.  Developers can only enable it by
changing #if 0 -> #if 1.
2013-10-29 12:30:20 -04:00
Matthew Booth
12e0e3fb09 docs: guestfs_case_sensitive_path returns error on non-existent path 2013-10-29 14:29:34 +00:00
Daniel Exner
2f85affefb Initial FrugalWare support. 2013-10-29 13:14:06 +00:00
Richard W.M. Jones
276cde033c builder: Add CentOS 6.4 guest. 2013-10-27 18:53:17 +00:00
Richard W.M. Jones
2937c03595 builder: Add a section on performance to the manual. 2013-10-27 14:59:39 +00:00
Richard W.M. Jones
76c20d761b ./run: Adjust $PATH to include all libguestfs binaries.
Instead of typing:

  ./run ./fish/guestfish ...

you can now use:

  ./run guestfish ...

This is shorter, but there are also two good reasons for this change:
It never made any sense to run the system-installed guestfish (or
other) binary.  It would be unlikely to work.  Also binaries in
libguestfs should be able to call other binaries freely without adding
special exceptions (which we had before this change).
2013-10-26 20:23:22 +01:00
Richard W.M. Jones
f114e28cc8 firstboot: Send the output to the console as well as to the log file.
For systemd:
Currently stdout+stderr go to the journal (these are effectively
empty unless there are gross errors).  The output of the commands
goes to the log file.

With this change, the output goes to the journal, the console and
the log file.

For SysV-init:
Currently stdout+stderr go to the console (but these are effectively
empty).  The output of the commands goes to the log file.

With this change, the output goes to the console and the log file.
2013-10-26 17:39:23 +01:00
Richard W.M. Jones
8b34855684 builder: Document how to boot VMs directly in qemu or KVM. 2013-10-26 17:39:23 +01:00
Richard W.M. Jones
0520aa3c42 builder: Add --write option to write a literal file. 2013-10-26 15:31:41 +01:00
Richard W.M. Jones
10c849ed1c builder: Allow --upload to a directory.
Also set the owner and permissions on the destination file correctly.
2013-10-26 15:31:27 +01:00
Richard W.M. Jones
cede5316b0 Version 1.25.1. 2013-10-26 11:01:51 +01:00
Richard W.M. Jones
2add5c9295 builder: Don't fail if ~/.cache doesn't exist (RHBZ#1022431). 2013-10-25 14:25:03 +01:00
Richard W.M. Jones
dd5959cd88 builder: Copy-editing on documentation.
Plus some ideas added to TODO file.
2013-10-25 14:05:34 +01:00
Richard W.M. Jones
99840550d5 builder: Add --mkdir option to create directories. 2013-10-25 13:35:51 +01:00
Richard W.M. Jones
b3ab3b452a builder: Fix two problems in --help output. 2013-10-23 11:37:11 +01:00
Richard W.M. Jones
3f46a92ed5 builder: Add --no-sync option to avoid sync on exit. 2013-10-22 22:28:27 +01:00
Richard W.M. Jones
f59a404568 Revert "java: Remove version number from the jar file (RHBZ#1022184)."
This reverts commit 7330ccd288.

See comment in https://bugzilla.redhat.com/1022184
2013-10-22 17:56:11 +01:00
Richard W.M. Jones
7330ccd288 java: Remove version number from the jar file (RHBZ#1022184). 2013-10-22 17:44:33 +01:00
Richard W.M. Jones
d4450c6590 builder: Use pxzcat (optionally) to speed up xzcat step. 2013-10-22 14:52:52 +01:00
Richard W.M. Jones
0e18bccb64 builder: Make xzcat binary configurable and use AC_PATH_PROG. 2013-10-22 14:52:52 +01:00
Richard W.M. Jones
2f3a3e308a builder: Don't run virt-resize when not necessary.
If:
 - the output is a regular file
 - the output format is raw
 - the user didn't specify the --size option
then we don't need to run virt-resize.  Simply uncompress
the template directly to the output file.
2013-10-22 14:52:52 +01:00
Richard W.M. Jones
2a76aa22c7 build: xz is required.
It is needed for libguestfs-make-fixed-appliance and many other places.
2013-10-22 13:58:33 +01:00
Richard W.M. Jones
5b89dd4aa1 mllib: Create config.ml from configure and use it for --version options.
Also don't internationalize the output of the --version option, as
that isn't useful.
2013-10-22 13:48:41 +01:00
Richard W.M. Jones
d6e5a6546a configure: Use AC_PATH_PROG{,S} for external programs used by the library. 2013-10-19 22:27:52 +01:00
Richard W.M. Jones
a29777c111 Version 1.25.0. 2013-10-18 17:55:45 +01:00
Richard W.M. Jones
356e6a6504 Version 1.24.0.
New stable branch.
2013-10-18 17:38:46 +01:00
Richard W.M. Jones
3b69792cd5 appliance: When valgrinding daemon + error path, sleep so valgrind messages are seen. 2013-10-18 13:59:01 +01:00
Richard W.M. Jones
dfaf417fef appliance: Add comments to init script. 2013-10-18 13:59:01 +01:00
Richard W.M. Jones
1e24b88270 resize, builder: Improve speed by using cache=unsafe on newly created files.
However because qemu might open these files immediately afterwards
using cache=none, we have to sync the file before exiting.
2013-10-18 13:59:01 +01:00
Richard W.M. Jones
9a4bfb386e resize: Rearrange objects.
This is just build refactoring.
2013-10-18 13:33:32 +01:00
Richard W.M. Jones
18c93ac61f RHEL 5: Don't use 'truncate' command in tests.
Use 'guestfish sparse' instead, which is roughly equivalent.

See commit ef1514aa1e
and commit 39df80dcc0.
2013-10-18 09:09:59 +01:00
Richard W.M. Jones
b68a99b8e2 Finalize release notes for libguestfs 1.24 release. 2013-10-17 16:03:49 +01:00
Richard W.M. Jones
6611d45ab7 Update PO files from Transifex. 2013-10-17 15:49:20 +01:00
Richard W.M. Jones
bbac0beab9 Update ROADMAP. 2013-10-17 15:48:44 +01:00
Richard W.M. Jones
feaf871856 API support: Fix website directory for new location. 2013-10-17 15:47:56 +01:00
Richard W.M. Jones
ad82de35b7 Update API support. 2013-10-17 15:47:52 +01:00
Richard W.M. Jones
3cce894f1b Update TODO. 2013-10-17 15:42:38 +01:00
Richard W.M. Jones
24a315507d Add man page for /etc/libguestfs-tools.conf (RHBZ#1019889).
Add a man page to document this configuration file.  This is
required by some distros, eg. Debian and RHEL.
2013-10-17 15:23:40 +01:00
Richard W.M. Jones
13b79aacca Use qemu-img -o preallocation=metadata where possible.
When format is qcow2 and we're *not* using a backing disk, we can use
preallocation=metadata for better performance.
2013-10-17 15:03:37 +01:00
Richard W.M. Jones
54fb09e052 fish: CVE-2013-4419: Fix insecure temporary directory handling for remote guestfish (RHBZ#1016960).
When using the guestfish --remote or guestfish --listen options,
guestfish would create a socket in a known location
(/tmp/.guestfish-$UID/socket-$PID).

The location has to be a known one in order for both ends to
communicate.  However no checking was done that the containing
directory (/tmp/.guestfish-$UID) is owned by the user.  Thus another
user could create this directory and potentially modify sockets owned
by another user's guestfish client or server.

This commit fixes the issue by creating the directory unconditionally,
and then checking that the directory has the correct owner and
permissions, thus preventing another user from creating the directory
first.

If guestfish sees a suspicious socket directory it will print an error
like this and exit with an error status:

  guestfish: '/tmp/.guestfish-1000' is not a directory or has insecure owner or permissions

Thanks: Michael Scherer for discovering this issue.

Version 2:
 - Add assigned CVE number.
 - Update documentation.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
2013-10-17 12:54:06 +01:00
Richard W.M. Jones
34da8850bb builder: When doing maintainer test for new guests, test adding a user account. 2013-10-17 12:24:25 +01:00
Richard W.M. Jones
61306130f8 launch: libvirt: Add guestfs-<random> name to the handle.
This is so we can display the random name in debug messages.
2013-10-17 12:24:18 +01:00
Richard W.M. Jones
fc733cf943 FAQ: useradd -> usermod.
This fixes commit dd554d94ad.
2013-10-16 10:48:07 +01:00
Richard W.M. Jones
cb49299c13 Version 1.23.33. 2013-10-15 20:41:22 +01:00
Richard W.M. Jones
f08ef9778b builder: Add maintainer test for new guests.
This is not part of the automated test suite.  It's a manual test run
by the maintainer which must be run on each new guest to ensure that
all the virt-builder features work on the new guest.
2013-10-15 20:41:22 +01:00
Richard W.M. Jones
b816f29ada firstboot: Ensure firstboot scripts run in command line order.
Previously they ran in effectively random order.
2013-10-15 20:41:22 +01:00
Richard W.M. Jones
a3e5bc7bfa sysprep: firstboot: Don't set `Created_files flag unless files are created. 2013-10-15 20:41:22 +01:00
Richard W.M. Jones
356a749bba firstboot: Add some debugging to the control script.
For reasons unknown, firstboot does not work on Debian 6 & 7.
https://bugzilla.redhat.com/show_bug.cgi?id=1019388
2013-10-15 20:41:22 +01:00
Richard W.M. Jones
49e6ba51e3 sysprep: random seed: Try much harder to create a random seed file.
Since this is essential for security, be much more proactive about
trying to create a random seed file, even for guests which have buggy
installers that don't create this file during installation.
2013-10-15 20:41:22 +01:00
Richard W.M. Jones
862da5dd79 builder: Really force apt not to ask questions.
This fixes commit b812a0d459.
2013-10-15 15:33:02 +01:00
Richard W.M. Jones
8b977d152a builder: Remove capital O and lower case L from random root password.
They look too much like 0 and 1.
2013-10-15 14:46:40 +01:00
Richard W.M. Jones
70e660a157 builder: Wrap program in an exception handler which pretty-prints common exceptions.
This looks like a large change, but is mainly just reindenting
everything into a 'main ()' function.
2013-10-15 14:37:48 +01:00
Richard W.M. Jones
fd63d89644 builder: Remove nbdkit-xz-plugin support (it was disabled anyway).
We can re-add this later if libvirt gets fixed, but for now simplify
the code and concentrate on the one code path.
2013-10-15 14:19:53 +01:00
Richard W.M. Jones
d8499c428a builder: Move command line argument processing to separate source file.
This is just code motion.
2013-10-15 14:10:06 +01:00
Richard W.M. Jones
2bc223b6b2 firstboot: Fix test for installing sysvinit scripts.
This fixes commit 9aa13e0574.
2013-10-15 09:53:08 +01:00
Richard W.M. Jones
b812a0d459 builder: Try really hard to make apt non-interactive. 2013-10-14 23:25:31 +01:00
Richard W.M. Jones
ec6f9ee542 appliance: Remove cruft and run udevd directly.
This commit removes a lot of cruft from old RHEL which was required to
start udev.  Instead we run the daemon directly.

Also it removes the fallback path which created some device nodes in
/dev by hand.  This likely did not work.  This also removes the
dependency on MAKEDEV which is long gone from most distros.

This is required for Ubuntu, since the /etc/init.d/udev script didn't
actually work.  The most common symptom was that /dev/virtio-ports/*
was not created because udev didn't process the cold start events.
2013-10-14 23:22:26 +01:00
Richard W.M. Jones
c9f98011fc Version 1.23.32. 2013-10-14 18:25:45 +01:00
Richard W.M. Jones
d9008e141c build: Add missing EXTRA_DIST files. 2013-10-14 18:21:54 +01:00
Richard W.M. Jones
ec0d0e0f62 build: Add maintainer-check-extra-dist rule.
This is used by the maintainer to check for missing files
in EXTRA_DIST.
2013-10-14 18:21:54 +01:00
Richard W.M. Jones
56928b5381 build: Don't hard-code list of virt-builder templates in top level directory.
It's troublesome for maintenance.  Use a wildcard here.
2013-10-14 18:21:54 +01:00
Richard W.M. Jones
9c7497a1eb Update to latest gnulib. 2013-10-14 15:51:47 +01:00
Richard W.M. Jones
9aa13e0574 firstboot: Install both systemd and SysV init scripts.
This should be safe, and avoids the whole issue of whether a guest
uses systemd or not.  Also it is possible to switch init systems
(eg. by specifying init= on the command line) so it's not even clear
if a guest "is" systemd.

Thanks: Tom Gundersen on #systemd.

This updates/fixes commit 596de56a43.
2013-10-14 14:56:56 +01:00
Richard W.M. Jones
cff95392f5 firstboot: Start service after network only.
Not necessary to wait for syslog since (a) we do our own logging
to a file and (b) syslog might not be installed.
2013-10-14 14:56:13 +01:00
Richard W.M. Jones
596de56a43 firstboot: Fix firstboot scripts so they work on Ubuntu.
Ubuntu 13.10 has /etc/systemd but uses Upstart.  This confuses the
script because it assumed that if you have /etc/systemd then you are
using systemd.  Ubuntu includes systemd services (inherited from
Debian) but they just don't run.
2013-10-14 14:05:27 +01:00
Richard W.M. Jones
234c380128 builder: Add --notes option.
This displays the release notes.
2013-10-14 13:45:10 +01:00
Richard W.M. Jones
d0b62bd500 builder: Add short synopsis in --help output. 2013-10-14 13:44:41 +01:00
Richard W.M. Jones
cc15877f07 builder: Tidy up release notes for operating systems. 2013-10-14 13:44:06 +01:00
Richard W.M. Jones
7e7017957e builder: debian/ubuntu: Add notes about running dpkg-reconfigure.
Required to regenerate SSH host keys.
2013-10-14 13:40:57 +01:00
Richard W.M. Jones
6238cc84f6 builder: Fix typo in man page. 2013-10-14 13:27:07 +01:00
Richard W.M. Jones
22d182dbcb builder: Fix output to block devices.
If the output is a block device:

- Detect the size of the output device.

- Don't attempt to delete the output device on failure.

- Turn off sparse copying in virt-resize.
2013-10-14 13:26:37 +01:00
Richard W.M. Jones
fb4dd1b55a resize: Add --no-sparse flag to let you turn off sparse copying.
Useful when the target is a block device containing old data.
2013-10-14 13:26:37 +01:00
Richard W.M. Jones
ceaa1ef0b8 builder: Run 'apt-get update' before trying to install packages. 2013-10-14 13:26:37 +01:00
Richard W.M. Jones
dd554d94ad FAQ: Clearer instructions for Debian and Ubuntu users. 2013-10-14 12:32:04 +01:00
Richard W.M. Jones
b08d8e15bb builder: Kill any daemons started by installed packages.
Some --install requests may pull in packages that start daemons (dbus
being a favourite daemon apparently).  These daemons will prevent the
disks from being unmounted and everything being cleaned up at the end.
Add some experimental code to kill these daemons.
2013-10-13 19:57:25 +01:00
Richard W.M. Jones
e8e0d98ef8 builder: Add more templates to the list which is copied to the website. 2013-10-13 17:51:12 +01:00
Richard W.M. Jones
5d22ee8760 builder: Add the logo to the HTML manual page.
Unfortunately:

 - It appears below the TOC.  This is unavoidable because of the
   flow of the current HTML.

 - The logo is now duplicated in git.
2013-10-13 17:50:16 +01:00
Richard W.M. Jones
2224372016 Version 1.23.31. 2013-10-12 21:55:18 +01:00
Richard W.M. Jones
6e77422800 po: builder: Hack to remove duplicate message definition.
Because we're not running msgmerge but concatenating the PO files, you
can get duplicate messages (in this case "no"), resulting in this
error:

libguestfs.pot:6142: duplicate message definition...
libguestfs.pot:3285: ...this is the location of the first definition

Just work around this for now.
2013-10-12 21:54:47 +01:00
Richard W.M. Jones
f3484ff3b4 builder: Document how to enable virtual consoles on Debian guests. 2013-10-12 21:34:23 +01:00
Richard W.M. Jones
1df6905c80 builder: Add --edit option.
This allows you to use Perl to edit files in the guest.

This works very similarly to the 'virt-edit -e' (non-interactive
editing) function.
2013-10-12 21:34:23 +01:00
Richard W.M. Jones
c80dcc2da6 builder: Small copy-edit to the manual. 2013-10-12 20:32:05 +01:00
Richard W.M. Jones
04041f23d0 edit: Add virt-edit --edit as an alias for virt-edit -e.
This just adds the alias and does nothing else.
2013-10-12 20:26:03 +01:00
Richard W.M. Jones
a010ab5147 builder: Upcase --delete and --scrub option arguments in man page.
For consistency with other options.

This updates commit 7820aaf1f3.
2013-10-12 20:26:03 +01:00
Richard W.M. Jones
f7ca38b728 appliance: Disable LD_PRELOAD libSegFault in virt-rescue shell.
Commit c598e14052 exports
LD_PRELOAD=/lib64/libSegFault.so so that guestfsd and processes that
it runs will produce descriptive stack traces.

However it exports it to everything including the virt-rescue shell.
But if we are chrooting into a guest which doesn't have this file (or
indeed any guest) we should not use LD_PRELOAD.

Therefore unset LD_PRELOAD in the rescue shell.

See also related commit 21e5fc811e.
2013-10-12 20:10:34 +01:00
Richard W.M. Jones
5b49f8de27 builder: Add Debian 6 (Squeeze) guest template. 2013-10-12 19:03:09 +01:00
Richard W.M. Jones
c64214f2a4 builder: With -v option, dump out the log file.
Useful for debugging install errors.
2013-10-12 18:52:49 +01:00
Richard W.M. Jones
aec2e2edbf builder: Add comment about download /dev/stderr truncating redirection files. 2013-10-12 18:52:49 +01:00
Richard W.M. Jones
a43f5e57a8 builder: '@' (not '+') is used to install groups of packages in Fedora. 2013-10-12 18:52:43 +01:00
Richard W.M. Jones
17c2698617 builder: Print some stats about the generated image at the end.
It will print stats at the end like this:

  Output: fedora-18.img (8.0G)
  Free space: 3.2G (39%)
2013-10-12 16:44:36 +01:00
Richard W.M. Jones
7820aaf1f3 builder: Add --delete and --scrub options for deleting guest files. 2013-10-12 15:45:48 +01:00
Richard W.M. Jones
dc0ec4db21 builder: In documentation, use 'scrub log file' instead of 'wipe'.
Since we really do try to scrub the data.
2013-10-12 15:33:48 +01:00
Richard W.M. Jones
11f116f21e builder: Advice on setting environment variables to maximize caching. 2013-10-12 15:17:16 +01:00
Richard W.M. Jones
4bea0548c7 builder: Add --cache-all-templates option. 2013-10-12 15:13:56 +01:00
Richard W.M. Jones
fdd4d75b85 builder: Make --delete-cache obey the --cache option.
Previously a command such as:

  virt-builder --cache /tmp/cache --delete-cache

would delete ~/.cache/virt-builder (the default cachedir).

It's obviously meant to delete /tmp/cache, which this commit fixes.
2013-10-12 15:13:56 +01:00
Richard W.M. Jones
2eeaea6423 builder: Add --print-cache option. 2013-10-12 15:13:56 +01:00
Richard W.M. Jones
ff76d1abdb recipes: More recipes for virt-builder, syslinux, Xen partitionless guest conversion. 2013-10-12 12:58:49 +01:00
John Eckersberg
da85de8a42 btrfs: Fix improper memmove usage in do_btrfs_subvolume_list (RHBZ#1018149).
The third parameter (number of bytes to copy) was given as an offset
relative to dest, when it should be relative to src.  This fixes some
valgrind warnings I happened across.
2013-10-12 07:10:35 +01:00
Richard W.M. Jones
7d0d159bed Version 1.23.30. 2013-10-11 15:47:16 +01:00
Richard W.M. Jones
ff738d1480 debian: Warn if /dev/kvm is 0660 and user is not in the KVM group.
On Debian, /dev/kvm is mode 0660 and group kvm, so users need to add
themselves to the kvm group otherwise things are going to be very slow
(this is Debian bug 640328).
2013-10-11 15:34:23 +01:00
Richard W.M. Jones
92e1864913 events: Add a warning event and direct all warning messages through it.
This also causes warnings to be printed even in non-verbose mode,
which is useful.
2013-10-11 15:34:23 +01:00
Richard W.M. Jones
aada08a91c launch: libvirt: Suggest using the direct backend if libvirt fails. 2013-10-11 14:50:54 +01:00
Richard W.M. Jones
b4fea7592f builder: Avoid parallel cache downloads from stomping on each other.
This should let you run virt-builder instances in parallel.
2013-10-11 12:43:39 +01:00
Richard W.M. Jones
802c7f7376 daemon: Don't leak 'device' string in parse_btrfsvol.
Since 'device' is assigned repeatedly, and because
device_name_translation allocates a new string each time, we have to
free it in the loop and along error paths.

Found by ./configure --enable-valgrind-daemon.
2013-10-11 12:23:48 +01:00
Richard W.M. Jones
d8a8894cb2 daemon: xattr: Fix scope of cleanup buf to avoid memory leaks.
Found by ./configure --enable-valgrind-daemon.
2013-10-11 12:23:48 +01:00
Richard W.M. Jones
46304e9389 daemon: Fix macro definition.
Defined a bogus macro along an unused code path.
2013-10-11 11:13:18 +01:00
Richard W.M. Jones
c245b55707 daemon: parted: Fix memory leak of list of strings.
Found by ./configure --enable-valgrind-daemon.
2013-10-11 11:12:57 +01:00
Richard W.M. Jones
db0307b7e3 daemon: Fix scope of cleanup functions to avoid memory leaks.
Found by ./configure --enable-valgrind-daemon.
2013-10-11 11:12:27 +01:00
Richard W.M. Jones
237e1d41d7 daemon: Ignore memory leak in aug_setm.
(Found by ./configure --enable-valgrind-daemon)
2013-10-11 11:11:43 +01:00
Richard W.M. Jones
494c18802b daemon: When valgrinding the daemon, take steps to cleanly exit daemon.
This adds a new internal API: internal_exit

Only when valgrinding the daemon, have the library call internal_exit
along the close path, and close the sockets first.  This ensures we
will see normal valgrind messages (we were only seeing valgrind aborts
before).

Note this is not used in production builds.
2013-10-11 09:13:11 +01:00
Richard W.M. Jones
34a3ad9e2d Version 1.23.29. 2013-10-10 15:50:45 +01:00
Richard W.M. Jones
0f8db6185f inspector: Allow the test to be skipped by setting an environment variable. 2013-10-10 15:50:01 +01:00
Richard W.M. Jones
9f1bcbca55 fish: Use UNIX_PATH_MAX instead of hard-coded value for max length of socket buf. 2013-10-09 20:56:41 +01:00
Richard W.M. Jones
29003cf67f sparsify: Use Filename.temp_dir_name instead of Filename.get_temp_dir_name ().
The latter function is only available in OCaml >= 4.00 whereas
Filename.temp_dir_name has been around since OCaml 3.09.1.  In this
case it doesn't make any difference which one we use.
2013-10-09 20:55:28 +01:00
Richard W.M. Jones
b2baaa0029 generator: Change handling of C 'function(void)' to be simpler.
This also fixes an obscure case in daemon/optgroups.h.

The only difference in the generated output is:

--- daemon/optgroups.h.orig	     2013-10-09 20:42:02.479681861 +0100
+++ daemon/optgroups.h		     2013-10-09 20:42:10.563681858 +0100
@@ -149,7 +149,7 @@
   int optgroup_inotify_available (void) { return 0; }

 #define OPTGROUP_JOURNAL_NOT_AVAILABLE \
-  int __attribute__((noreturn)) do_internal_journal_get () { abort (); } \
+  int __attribute__((noreturn)) do_internal_journal_get (void) { abort (); } \
   int __attribute__((noreturn)) do_journal_close (void) { abort (); } \
   int64_t __attribute__((noreturn)) do_journal_get_data_threshold (void) { abort (); } \
   int __attribute__((noreturn)) do_journal_next (void) { abort (); } \
2013-10-09 20:43:25 +01:00
Richard W.M. Jones
b3d979c349 build: WEBSITEDIR has moved. 2013-10-08 18:39:18 +01:00
Richard W.M. Jones
57956ce790 Update TODO with more ideas. 2013-10-08 12:34:33 +01:00
Richard W.M. Jones
ae897e055a builder: Upload /etc/resolv.conf from the host when the network is enabled.
When the user has enabled the network (not the default) we upload
/etc/resolv.conf from the host to the appliance /etc/resolv.conf
so that programs in the appliance can contact nameservers.

Commit 9521422ce6 previously changed the
behaviour to copy /etc/resolv.conf into the sysroot when running
commands.
2013-10-08 12:33:16 +01:00
Richard W.M. Jones
74d9fdf56f df: parallel: Add a debug message when work function returns an error.
Further attempts to find out why this hangs under Koji.
2013-10-08 12:15:52 +01:00
Richard W.M. Jones
5c53b32669 launch: If launch takes longer than 20 minutes, time out.
Add a constant fixed timeout for launch (currently 20 minutes, we'll
make it configurable if needed in the future).  If the appliance takes
longer than this to connect back, we time out assuming that the kernel
has hung during boot.
2013-10-08 12:12:22 +01:00
Richard W.M. Jones
89b65b9779 launch: libvirt: Clarify comment. 2013-10-08 11:58:26 +01:00
Richard W.M. Jones
4fc44a0157 blockdev: Deprecate blockdev_setbsz and make it do nothing (RHBZ#624334).
This call never did anything.  Don't use it.  Also I have submitted a
patch upstream to remove the corresponding option from blockdev.

See RHBZ#1002825 for an explanation of why this call was always
useless.

Thanks: Masayoshi Mizuma
2013-10-08 10:04:27 +01:00
Richard W.M. Jones
f5ba136359 Version 1.23.28. 2013-10-08 09:09:49 +01:00
Richard W.M. Jones
9521422ce6 daemon: command: Copy appliance /etc/resolv.conf in before running commands.
When you try to run commands for an Ubuntu guest, they fail because in
Ubuntu /etc/resolv.conf is a symlink to /run/...  and this turns out
to be a dangling symlink when the Ubuntu guest is mounted up under the
appliance.

Therefore even if the network is enabled, any command which tries to
do name resolution will fail.

Ideally we would like to bind-mount the appliance /etc/resolv.conf
into the sysroot.  However this is not possible because mount is buggy
(see comment).  So instead we use a complex hack to achieve the same
ends.

Note this is only done if the network is enabled and if /etc in the
guest actually exists.  The original /etc/resolv.conf is restored
as soon as the command has run.
2013-10-07 22:01:02 +01:00
Richard W.M. Jones
b8b1b0296b daemon: Refactor bind-mount code.
This is just code motion.
2013-10-07 21:51:29 +01:00
Richard W.M. Jones
93793db049 daemon: 'exists' API should not follow broken symlinks.
Using guestfs_exists on a symlink which existed but pointed to a
non-existent file was returning false.  However exists obviously
should not be following the symlink in the first place.
2013-10-07 17:10:14 +01:00
Richard W.M. Jones
894488c442 sysprep: ubuntu: Use secure SHA-512 crypt back to Ubuntu 10.04. 2013-10-07 15:59:37 +01:00
Richard W.M. Jones
5a71a2ddaf builder: Add Ubuntu 10.04LTS, 12.04LTS and 13.10 templates. 2013-10-07 15:47:10 +01:00
Richard W.M. Jones
22fc66f6b2 sysprep: Fix documentation for --mount-options. 2013-10-07 14:27:32 +01:00
Richard W.M. Jones
dfa52c63b1 sysprep: Don't remove /var/cache/apt/archives/partial directory.
Removing this directory breaks Ubuntu guests.

This change adds a utility function which removes only files from a
directory.  This is a safer way to clean cache directories etc.
2013-10-07 14:19:38 +01:00
Richard W.M. Jones
c8080e53ea builder: network: Note that only outgoing connections are allowed. 2013-10-07 10:51:28 +01:00
Richard W.M. Jones
7dfc67cb12 builder: Add section on debugging and other documentation fixes. 2013-10-07 10:02:57 +01:00
Richard W.M. Jones
10a821553e Version 1.23.27. 2013-10-05 22:34:46 +01:00
Richard W.M. Jones
e79c99f58c perl: valgrind: Renamed function requires different valgrind suppression.
Seems to be a difference in Perl 5.18.
2013-10-05 22:28:00 +01:00
Richard W.M. Jones
d746d01b81 builder: logo: Small adjustments. 2013-10-05 20:11:33 +01:00
Richard W.M. Jones
e9e6f60ef1 builder: Document how to import disk images to other tools.
Thanks: Kashyap Chamarthy
2013-10-05 18:13:27 +01:00
Richard W.M. Jones
424549c23f builder: Display the output filename.
Thanks: Kashyap Chamarthy
2013-10-05 18:12:49 +01:00
Richard W.M. Jones
3d5ed2584c Version 1.23.26. 2013-10-05 17:48:58 +01:00
Richard W.M. Jones
80da8b19e0 builder: Use progress bar for large template downloads that are not in the cache. 2013-10-05 16:00:21 +01:00
Richard W.M. Jones
7b82580352 builder: Create an install log file, and dump the full log on error.
This should make debugging much simpler, and also provides a
build log in the guest once it's built.
2013-10-05 15:19:06 +01:00
Richard W.M. Jones
cc37490e05 builder: Tidy up error messages. 2013-10-05 15:00:36 +01:00
Richard W.M. Jones
f93968d6fa builder: Clean up messaging.
Ensure every significant action gets a message.
2013-10-05 14:25:07 +01:00
Richard W.M. Jones
d55edbd8fb Add virt-builder logo. 2013-10-05 13:48:43 +01:00
Richard W.M. Jones
bdd5a9a894 Update release notes with dependency changes since 1.22. 2013-10-05 11:54:01 +01:00
Richard W.M. Jones
f532ca96dc todo: Some items to do in virt-builder. 2013-10-05 11:54:01 +01:00
Richard W.M. Jones
39ee0d13db builder: docs: Minor copy-edits of the man page. 2013-10-04 14:04:52 +01:00
Richard W.M. Jones
be8ccedaf1 Update release notes. 2013-10-04 13:44:39 +01:00
Richard W.M. Jones
05e8410e0e Update API support. 2013-10-04 13:44:23 +01:00
Richard W.M. Jones
d6f87fe6be Version 1.23.25. 2013-10-04 12:01:18 +01:00
Richard W.M. Jones
8f5dd4ed02 builder: docs: Add sections on architecture, security, UML. 2013-10-04 11:43:31 +01:00
Richard W.M. Jones
64bef381f6 uml: Fix virt-builder test.
Note comment in the test about networks.
2013-10-04 08:48:26 +01:00
Richard W.M. Jones
fe7f88a35d builder: Fix --format/--output-format arguments to virt-resize subcommand.
The 'virt-builder --format' option translates to the
'virt-resize --output-format' option, because it specifies the output
format.

On the contrary, the 'virt-resize --format' option (the input format)
is always 'raw'.
2013-10-04 08:42:20 +01:00
Richard W.M. Jones
dd410e1165 builder: Add -v option to test so we get all debugging output. 2013-10-04 08:31:53 +01:00
Richard W.M. Jones
a914889b1d tests/nbd: Avoid warning when tests are skipped.
Since END{} clause is always called,  might not be defined if
we exit early.  Move the whole clause to the top.
2013-10-04 08:26:00 +01:00
Richard W.M. Jones
e9f35e26c5 builder: Add test *.xz files to CLEANFILES. 2013-10-04 08:25:14 +01:00
Richard W.M. Jones
0373f4ce68 Version 1.23.24. 2013-10-03 22:07:28 +01:00
Richard W.M. Jones
967668f7a8 website: Make the rule install builder files to website. 2013-10-03 22:02:47 +01:00
Richard W.M. Jones
a80f0f40b1 website: Add HTMLSUPPORTFILES to rule. 2013-10-03 22:02:47 +01:00
Richard W.M. Jones
a0d73b7e21 builder: Add Debian 7 template + scripts used to create it. 2013-10-03 22:02:47 +01:00
Richard W.M. Jones
c975d9e53b builder: Implement --hostname (set hostname of guest).
This also makes a minor rearrangement so that the random seed, root
password, hostname setting all happen before package installation.
This keeps these configuration changes together and means that the
packages that are installed can act differently based on hostname
(which is conceivable).
2013-10-03 22:02:47 +01:00
Richard W.M. Jones
08b7c90228 sysprep: Refactor hostname code into a common library. 2013-10-03 22:02:47 +01:00
Richard W.M. Jones
7e824a1015 builder: Add tests. 2013-10-03 22:02:44 +01:00
Richard W.M. Jones
9ba6717e94 New tool: virt-builder: For quickly building virtual machine images.
On baremetal you can build and customize a new guest in under 2
minutes.  For example:

$ virt-builder fedora-19 \
    --root-password password:test \
    --install minicom \
    --firstboot-command 'yum -y update' \
    --firstboot-command 'useradd -m -p "" rjones ; chage -d 0 rjones'
[     0.0] Downloading: file:///home/rjones/d/libguestfs/builder/website/fedora-19.xz
[     1.0] Uncompressing: file:///home/rjones/d/libguestfs/builder/website/fedora-19.xz
[    24.0] Running virt-resize to expand the disk to 4.2G
[    77.0] Opening the new disk
[    81.0] Installing packages: minicom
[    94.0] Installing firstboot command: [001] yum -y update
[    94.0] Installing firstboot command: [002] useradd -m -p "" rjones ; chage -d 0 rjones
[    94.0] Finishing off
2013-10-03 22:02:16 +01:00
Richard W.M. Jones
6203c50479 sysprep: Refactor setting random seed code into a common library.
This is just code motion.
2013-10-03 21:42:05 +01:00
Richard W.M. Jones
da1d0da429 firstboot: Invoke firstboot.sh script with 'start' parameter.
.. else the systemd script does not run.
2013-10-03 21:42:05 +01:00
Richard W.M. Jones
147b4ee87e sysprep: Refactor firstboot code into a common library. 2013-10-03 21:42:05 +01:00
Richard W.M. Jones
ff9bc90e63 resize: Don't add mllib/* sources to 'SOURCES'.
This was a mistake in commit 2a6ce79320.
2013-10-03 21:42:05 +01:00
Richard W.M. Jones
e8a092ae87 sysprep: Refactor password handling code into a common library.
Also the crypt binding is moved to mllib because this is a dependency
of the password library.

This is just code motion.
2013-10-03 21:42:04 +01:00
Richard W.M. Jones
748ab33969 mllib: Rename parse_size to parse_resize.
This is just code motion, but it reduces a source of confusion.
2013-10-03 21:42:04 +01:00
Richard W.M. Jones
98d56bb102 mllib: error function has ~prog parameter, instead of assuming virt-resize.
$ virt-sparsify a a
  virt-resize: error: you cannot use the same disk image for input and
  output
  If reporting bugs, run virt-resize with the '-d' option and include the
  complete output.

Note (a) it assumes the program is called "virt-resize" which it
isn't, and (b) it assumes the program has a debug option -d which it
doesn't.

This commit changes the error message and adds a -v option to
virt-resize.
2013-10-03 21:42:04 +01:00
Richard W.M. Jones
e1d7fb406b resize, sparsify: Small argument parser refactoring.
Factor out a common string.
2013-10-03 21:42:04 +01:00
Richard W.M. Jones
21e5fc811e daemon: Don't set LD_PRELOAD for guestfsd children.
Commit c598e14052 exports
LD_PRELOAD=/lib64/libSegFault.so so that guestfsd and processes that
it runs will produce descriptive stack traces.

However if we chroot into /sysroot (ie. CHROOT_IN/CHROOT_OUT) and if
the libSegFault.so library does not exist inside the chroot (as is the
case on Debian guests) then we cannot run any processes.  In any case
we *don't* want to necessarily run this library from the guest.

The proper way to fix this is to confine all chrooting to a
subprocess, but that's a big change to guestfsd which we'll have to do
one day.  For now, unset LD_PRELOAD once guestfsd starts up.
2013-10-03 21:42:04 +01:00
Richard W.M. Jones
8abd0a83b3 daemon: Fix xfs_info parser because of new format.
The old parser had several problems: firstly it called the error path
sometimes without calling reply_with_error causing a protocol hang.
More seriously it had hard-coded line numbers, and since Fedora 21 the
output of xfs_info has changed, moving lines around.

Change the parser to be more robust against added fields by using the
first name on the line as the section name, thus 'bsize=' is
interpreted differently depending on whether it appears in the "data"
section or the "naming" section.

Ensure also that we don't call the error path without calling
reply_with_error, which is a side-effect of the above change.
2013-10-03 18:17:39 +01:00
Cole Robinson
216cb004ae launch: libvirt: Set attribute present=yes to enable kvmclock. 2013-10-03 15:06:40 +01:00
Richard W.M. Jones
0fbd645cb9 Version 1.23.23. 2013-09-27 17:15:39 +01:00
Richard W.M. Jones
a2a7ba5051 Update BUGS file. 2013-09-26 22:11:01 +01:00
Richard W.M. Jones
dc0052381e Update PO files. 2013-09-26 22:01:41 +01:00
Richard W.M. Jones
93dbeb6b6c tools: Generate a special POTFILES-pl and dump symlink hack in tools directory. 2013-09-26 22:01:41 +01:00
Richard W.M. Jones
e2895b19bb appliance: Create /dev/loop-control and similar devices.
When 'mount -o loop' and similar commands are used, the loop module is
loaded automatically by the kernel when /dev/loop-control is accessed.

/dev/loop-control is created semi-statically by an unholy and
overcomplex combination of kmod static-nodes and systemd-tmpfiles
(instead of using, say, just udev or even just a simple series of
mknod commands).
2013-09-26 10:51:56 +01:00
Richard W.M. Jones
d0ef2ff9b6 appliance: If --enable-valgrind-daemon then increase minimum memory to 768 MB.
tests/c-api would fail from time to time if --enable-valgrind-daemon
was configured.  There was no obvious memory leak.  It looks as if the
overhead of valgrind was sufficient to break long-running tests such
as this one.
2013-09-25 16:00:38 +01:00
Richard W.M. Jones
2f4f7726e8 launch: libvirt: Use host-passthrough instead of host-model.
<cpu model="host-passthrough"> really passes -cpu host to qemu, which
is what we want since we don't care about live migration or ABI
stability.

This should avoid http://bugzilla.redhat.com/870071 .

Note this "taints" the libvirt domain.  We don't particularly care
about that, and the reason for the tainting doesn't seem to make much
sense anyway.

This updates commit 6f76fdb41e.
2013-09-25 12:50:13 +01:00
Richard W.M. Jones
ae2dd1a9e7 sparsify: Fix incorrect reference to documentation from tool. 2013-09-24 14:18:54 +01:00
Richard W.M. Jones
48b0d15749 mllib: Ensure that mllib is included in POTFILES-ml.
This updates commit 2a6ce79320.
2013-09-24 14:18:54 +01:00
Richard W.M. Jones
09a4f42861 uri: Fix two compiler warnings.
We have to include the right header so that guestfs___free_string_list
is declared.  Unfortunately that means ensuring -I src is passed to
the compiler in every tool subdirectory.

Also fix (bogus) compiler warning about incorrect type of the
parameter to caml_copy_string_array.
2013-09-24 13:41:35 +01:00
Richard W.M. Jones
2a6ce79320 tools: Move shared OCaml code to mllib/ directory.
Previously a lot of shared code lived in the resize/ directory for no
particular reason.

This is just code motion.
2013-09-24 13:41:35 +01:00
Richard W.M. Jones
dbbdaebe22 resize: Allow the input file to be a URI.
This lets you use nbd as a source for resizing, eg:

  virt-resize nbd://example.com outfile
2013-09-23 15:22:24 +01:00
Richard W.M. Jones
4cdb5bcc5e sysprep: Fix option quoting in manual page.
This fixes commit b65c1c667b.
2013-09-23 13:49:21 +01:00
Richard W.M. Jones
5971fb2a70 virt-df: parallel: Send debugging messages to stderr.
Not stdout (ordinary program output) since that gets eaten by
the tests.

This fixes commit 67b9469754.
2013-09-12 09:16:31 +01:00
Richard W.M. Jones
54f1492615 arm: Drop kernel_irqchip=off hack.
Was only required because of the previous use of vexpress-a9.  With
vexpress-a15 should no longer be needed.
2013-09-11 18:44:11 +01:00
Richard W.M. Jones
f4b3f84409 arm: Switch to using Versatile Express A15 machine.
This is the machine which qemu actually emulates these days.
2013-09-11 14:52:37 +01:00
Richard W.M. Jones
577330d5e5 Remove incorrect comment.
qemu does in fact fix up the device tree with the correct memory size
supplied by -m <ramsize> so the comment was incorrect.

This updates commit 8d273a2715.
2013-09-11 14:42:45 +01:00
Richard W.M. Jones
8d273a2715 arm: Pass mem= parameter on Linux command line.
It is thought that qemu-system-arm -m <ramsize> could conflict with
the actual memory that Linux thinks is available (from the device tree).

Thanks: Marc Zyngier
2013-09-11 14:37:51 +01:00
Richard W.M. Jones
27cfd77df9 arm: Don't bother supplying guest architecture.
libvirt seems to do the right thing without this.
2013-09-11 11:57:40 +01:00
Richard W.M. Jones
c3f8b441fd arm: Add notes about machine types.
Thanks: Marc Zyngier from ARM, Andre Przywara from Linaro for
patiently explaining this to me.
2013-09-11 11:53:18 +01:00
Richard W.M. Jones
2913c499cf launch: Centrally define machine type and DTB wildcard.
This avoids a bit of arch-specific #ifdef.
2013-09-11 11:51:18 +01:00
Richard W.M. Jones
4d955be4fb Version 1.23.22. 2013-09-11 10:44:08 +01:00
Richard W.M. Jones
ccc9a891df docs: Remove misleading / outdated section about other arches from README. 2013-09-10 23:31:58 +01:00
Richard W.M. Jones
aee6fc4863 ppc: inspection: Use iconv "UTF-16LE" instead of "UTF-16".
See commit message:
8e31fd84cb
2013-09-10 22:39:00 +01:00
Richard W.M. Jones
bae6d5cc63 inspection: Don't print a warning if \Windows\explorer.exe does not exist.
guestfs_case_sensitive_path does not test for file existence.  We have
to test for it explicitly.

This updates commit 9ea6e97014.  See the
description of that commit for more details.
2013-09-10 11:58:22 +01:00
Richard W.M. Jones
74938b895c ppc: Disallow ide interface.
qemu-system-ppc64 lets you add the IDE interface to the appliance, but
the appliance kernel ignores it (and consequently can't find the
appliance disk so it all goes wrong).  Best to just disallow this.

Also skip tests that try using iface = 'ide'.
2013-09-10 10:41:37 +01:00
Richard W.M. Jones
aee17de30a ppc: Use a larger default memory size on ppc64.
Without this, test-max-disks fails when creating device nodes.
2013-09-10 10:09:01 +01:00
Richard W.M. Jones
7f90aa0998 ppc: launch: direct: Use -M pseries. 2013-09-09 22:54:09 +01:00
Richard W.M. Jones
2bf082d908 arm: launch: direct: Use correct device name for virtio-scsi when detecting. 2013-09-09 12:23:26 +01:00
Richard W.M. Jones
415d74d0b8 tests: Add a regression test that ensure the network can be added.
This was only tested before (implicitly) by the rsync test in
tests/rsync.  It's better to have an explicit test of this
functionality.
2013-09-09 12:22:08 +01:00
Richard W.M. Jones
c6dc813420 arm: launch: libvirt: Use virtio-net-{pci,device} instead of hard-coding virtio-net-pci.
This is so it works on virtio-mmio platforms such as ARM.
2013-09-09 11:57:20 +01:00
Richard W.M. Jones
f8d89bc42f arm: launch: libvirt: Set kernel_irqchip=off for KVM to work around buggy qemu/kernel. 2013-09-09 09:02:59 +01:00
Richard W.M. Jones
37e1e0da5a arm: launch: libvirt: Force <emulator>.
This is a temporary hack, because otherwise libvirt tries to use
/usr/bin/qemu-kvm even though this is ARM.
2013-09-08 23:25:52 +01:00
Richard W.M. Jones
06e43a3359 arm: launch: libvirt: Use vexpress-a9 machine type. 2013-09-08 23:25:51 +01:00
Richard W.M. Jones
cd16380a83 arm: launch: libvirt: Don't try setting a cpu model on ARM.
One day we may be able to make this work, but presently libvirt says:

  CPU specification not supported by hypervisor
2013-09-08 23:25:51 +01:00
Richard W.M. Jones
bb616a42d2 launch: libvirt: 'is_custom_hv' instead of 'is_custom_qemu'.
Just code motion related to the changed from LIBGUESTFS_QEMU
to LIBGUESTFS_HV.

This updates commit 78dbd08dd2.
2013-09-08 23:09:34 +01:00
Richard W.M. Jones
1cfdb4d9a7 arm: tests: 9p: Modify name of virtio-9p-pci device when using virtio-mmio.
It's called virtio-9p-device on virtio-mmio.
2013-09-08 20:50:54 +01:00
Richard W.M. Jones
9d97b86ee8 arm: Error if iface=ide and skip tests that use iface=ide.
ARM doesn't support IDE.  (Well, that's not entirely true as I found a
reference to one extremely obscure ARM board that had IDE disks, but
qemu-system-arm doesn't appear to support them).
2013-09-08 16:21:17 +01:00
Richard W.M. Jones
25cce50a2b launch: direct: Handle iface=virtio using virtio-blk path.
iface=virtio means use (old) virtio-blk.  Since there's an existing
path for using virtio-blk, use that instead of adding if=virtio (which
will fail on ARM).
2013-09-08 16:19:24 +01:00
Richard W.M. Jones
6e498461f6 arm: launch: direct: Add kernel_irqchip=off to make ARM KVM work.
See:
https://lists.fedoraproject.org/pipermail/arm/2013-September/006758.html
2013-09-07 08:41:19 -04:00
Richard W.M. Jones
af229ebd62 Version 1.23.21. 2013-09-07 13:06:21 +01:00
Richard W.M. Jones
3f9f6235ec arm: appliance: Add support for device trees (dtb's).
If supermin-helper >= 4.1.5 is found, use the new-style syntax and if
the architecture requires it (only ARM for now) implement device
trees.

This means we pass a supermin-helper --dtb option to find the right
device tree (currently Versatile Express A9, since that's what we pass
to qemu in the -M option).  This makes supermin-helper find a
compatible device tree file.

Also that we pass the corresponding dtb file to qemu via the qemu -dtb
option, or to libvirt via the <dtb> element.
2013-09-06 18:38:36 +01:00
Richard W.M. Jones
284fdfe2c5 sysprep: Update POTFILES-ml.
This updates commit ea7088b5ca.
2013-09-06 09:09:34 +01:00
Wanlong Gao
ea7088b5ca sysprep: remove tmp files
This removes tmp files under /tmp and /var/tmp.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2013-09-06 09:08:14 +01:00
Richard W.M. Jones
2550971d72 launch: direct: Set QEMU_AUDIO_DRV=none to stop qemu opening audio devices.
Libvirt does the same thing, and it definitely has an effect
on ARM at least.
2013-09-05 18:42:40 -04:00
Richard W.M. Jones
52cbb0a323 arm: launch: direct: Use virtio-net-device instead of virtio-net-pci on ARM.
This updates commit 9274992411.
2013-09-05 18:02:33 -04:00
Richard W.M. Jones
9274992411 arm: launch: direct: Use virtio-mmio devices on ARM.
Devices such as virtio-blk are (implicitly) PCI devices.  They don't
work on ARM.  You have to use the alternate names like
'virtio-blk-device' instead.
2013-09-05 17:52:59 -04:00
Richard W.M. Jones
b46291a74c arm: launch: direct: Specify a -M (machine type).
Currently this uses the Versatile Express A9 (vexpress-a9) machine
type, which is not ideal long-term.  However it includes such things
as virtio-mmio and so virtio things should work.

Note that -M vexpress-a15 does not work with qemu (from git on
2013-09-05 + Fedora kernel 3.11.0).  There are no boot messages.
2013-09-05 17:33:42 -04:00
Richard W.M. Jones
f3710a43d4 arm: launch: direct: Don't use -cpu flag.
We have no idea what the right choice is, so don't choose anything at all.
2013-09-05 13:51:26 -04:00
Richard W.M. Jones
931182598d arm: configure: Search correctly for qemu-system-arm binary. 2013-09-05 13:51:26 -04:00
Richard W.M. Jones
a6f2efe9b9 launch: direct: Always use -drive ...,iface=none.
For virtio-scsi, this is the same as always:

  -drive ...,iface=none -device scsi-hd

For virtio-blk, this now uses:

  -drive ...,iface=none -device virtio-blk
2013-09-05 18:47:00 +01:00
Richard W.M. Jones
011c963926 launch: direct: Always use cache=unsafe for the appliance.
The code to select writeback was redundant, because current
qemu always supports cache=unsafe.
2013-09-05 18:45:24 +01:00
Richard W.M. Jones
30c0457978 launch: direct: Refactor -drive parameter for virtio-blk/virtio-scsi.
This is a straightforward refactoring of the code for generating
-drive and/or -device parameters for virtio-blk and virtio-scsi.
2013-09-05 18:39:46 +01:00
Wanlong Gao
bbd936d32b sysprep: remove firewall rules
If we do not want to keep the original firewall rules, enable
this operation to remove these rules automatically.

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

RWMJ:

 - Updated po-file.

 - Change documentation to note that it's disabled by default
   and in theory could make the guest exploitable.
2013-09-05 13:10:00 +01:00
Martin Kletzander
475f5ce6a4 Get rid of gnulib error
Even though this doesn't stop the compile phase, I find it a bit
distracting that this is what I get with bootstrap:

../.gnulib/gnulib-tool: *** cannot find ./configure.ac - make sure you
run gnulib-tool from within your package's directory
../.gnulib/gnulib-tool: *** Stop.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2013-09-05 10:19:01 +01:00
Martin Kletzander
012d8ebf02 Don't redefine _FORTIFY_SOURCE
The macro _FORTIFY_SOURCE might be already defined by environment in
which case it shouldn't be overriden (might be if it has lower value).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2013-09-05 10:19:01 +01:00
Wanlong Gao
efcf474d42 sysprep: remove log file of ntp
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2013-09-05 10:09:58 +01:00
Wanlong Gao
c76dabf9ec sysprep: remove log file of gdm
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2013-09-05 10:09:58 +01:00
Wanlong Gao
1baf716a7e sysprep: remove log file of sysstat
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2013-09-05 10:09:58 +01:00
Wanlong Gao
e02c4e519e sysprep: remove /var/log/audit/audit.log
audit.log is already included in /var/log/audit/*.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2013-09-05 10:09:58 +01:00
Richard W.M. Jones
67b9469754 virt-df: parallel: Compile debugging messages in always.
Enable debugging messages whenever LIBGUESTFS_DEBUG=1 / -v option, so
that we can track down possible race condition seen in Koji.
2013-09-03 14:58:15 +01:00
Richard W.M. Jones
091eb07803 daemon: augeas: Don't test if AUG_NO_ERR_CLOSE is defined.
It's an enum, not a macro, and in any case it has been present in
augeas.h since 0.10.0, and the minimum version that libguestfs
requires is 1.0.0.

This fixes commit 3d132f2920.
2013-09-02 19:37:57 +01:00
Richard W.M. Jones
3d132f2920 daemon: augeas: Enhance error reporting for aug_init failures.
Thanks: Dominic Cleal.
2013-09-02 19:23:36 +01:00
Richard W.M. Jones
e690b737fe Version 1.23.20. 2013-09-01 16:36:25 +01:00
Richard W.M. Jones
912943034e drives: Don't need to call free_drive_servers since preceding code checks servers == NULL. 2013-09-01 13:47:51 +01:00
Richard W.M. Jones
3f0748f1fc rescue: Use cachemode "unsafe" for the virt-rescue --scratch option. 2013-09-01 13:47:51 +01:00
Richard W.M. Jones
f3a9c9f867 sparsify: Use cachemode "unsafe" for the overlay disk. 2013-09-01 13:47:51 +01:00
Richard W.M. Jones
96cd7fcecb drives: Ensure all scratch drives use cachemode "unsafe".
They are _scratch_ drives so any data on them doesn't matter and can
be reconstructed in the event of a host system crash.
2013-09-01 13:47:51 +01:00
Richard W.M. Jones
749e947bb0 add_drive: Introduce 'cachemode' parameter to control drive caching.
This commit adds an optional 'cachemode' parameter to the 'add_drive'
API to control caching.  This corresponds approximately to the
'-drive ...,cache=' parameter in qemu, but the choices are much more
restrictive, just 'writeback' or 'unsafe', for reasons outlined below.

The caching modes supported by recent QEMU are:

  writeback:
   - Reports data writes completed when data is present in the host
     page cache.
     Only safe provided guest correctly issues flush operations.

  writethrough:
   - Reports data writes completed only when each write has been
     flushed to disk.  Performance is reported as not good.

  none:
   - Uses O_DIRECT (avoids all interaction with host cache), but does
     not ensure every write is flushed to disk.
     Only safe provided guest correctly issues flush operations.

  directsync:
   - Uses O_DIRECT (avoids all interaction with host cache), and
     ensures every write has been flushed to disk.

  unsafe:
   - No special handling.

Since the libguestfs appliance kernel always issues flush operations
(eg. for filesystem journalling and for sync) the following modes can
be ignored: 'directsync', 'writethrough'.

That leaves 'writeback', 'none' and 'unsafe'.  However 'none' is both
a constant source of pain (RHBZ#994517), is inefficient because it
doesn't use the host cache, and does not give us any safety guarantees
over and above 'writeback'.  Therefore we should ignore 'none'.

This leaves 'writeback' (safe) and 'unsafe' (fast, useful for scratch
disks), which is what we implement in this patch.

Note that the previous behaviour was to use 'none' if possible, else
to use 'writeback'.  The new behaviour is to use 'writeback' only
which is (in safety terms) equivalent to 'none', and also faster and
less painful (RHBZ#994517).

This patch also allows you to specify a cache mode for network drives
which also previously defaulted to 'writeback'.

There is a considerable performance benefit to using unsafe (for
scratch disks only, of course).  The C API tests only use scratch
disks (since they are just tests, the final state of the disk doesn't
matter), and this decreases total run time from 202 seconds to 163
seconds, about 25% faster.
2013-09-01 13:46:24 +01:00
Richard W.M. Jones
6e84861179 sparsify: Test for qcow2 features instead of keying off qemu-img version.
Test whether qcow2 features are possible in qemu-img instead of
assuming they are by keying off the version.

Also use the 'lazy_refcounts' flag, if available.  It may make writing
to the overlay file marginally faster (however I tested it and there
was no measurable difference).
2013-08-31 21:29:16 +01:00
Richard W.M. Jones
13f3b4a83d sparsify: Fix signal handling.
If you don't have a ^C (SIGINT) signal handler at all, then at_exit
handlers are not called so you end up leaving the large temporary
overlay file lying around.  That was fixed, incorrectly, by
commit 7283a5a276.

However the code now would delete the overlay file in the SIGINT
handler but otherwise continue running until basically it tries to
read the overlay file (now deleted) and fails.  So it kind of worked,
by accident.

Fix this so that the signal handler calls exit, thus ensuring both
that the exit handler is called (to delete the file) and that the
program actually exits as soon as possible.

This also refactors the unlink_on_exit function into a utility.
2013-08-31 21:29:16 +01:00
Richard W.M. Jones
950afbb705 daemon: Add comment about how zero_free_space would be better if we could do cancellation. 2013-08-31 21:29:16 +01:00
Richard W.M. Jones
a1f9fb88ae configure: Fix stupid typo which caused compressed images to always be used.
Libguestfs won't work if you try to use it with supermin < 4.1.4
because the logic for detecting if compressed images can be used was
wrong (it was always enabled, instead of disabled for supermin < 4.1.4).
2013-08-30 13:50:25 +01:00
Richard W.M. Jones
72b0831ffa Rename virt-{cat,edit,filesystems,inspector,ls,rescue}.c to *.c.
This is just renaming of files.
2013-08-29 21:25:57 +01:00
Richard W.M. Jones
5fd5cf7fdb Version 1.23.19. 2013-08-29 18:32:12 +01:00
Richard W.M. Jones
6e9440ced8 uml: Skip tests/md/test-inspect-fstab-md.sh
Hangs at various places during the test, eg. running mdadm, mounting
MD filesystem.  Seems to be a bug in UML/MD.
2013-08-29 17:26:59 +01:00
Richard W.M. Jones
1c8986e45c mke2fs: Document that too small blockscount will result in ext2 filesystem (RHBZ#1002032). 2013-08-29 13:59:14 +01:00
Richard W.M. Jones
c04fbbda3e rsync: Document use of glob + rsync-out in guestfish (RHBZ#1001876). 2013-08-29 13:49:26 +01:00
Richard W.M. Jones
1b34d6171b Add a regression test of tar-out excludes option (RHBZ#1001875). 2013-08-29 13:36:56 +01:00
Richard W.M. Jones
91c162586c daemon: tar: Use a temporary file to pass excludes to tar command (RHBZ#1001875).
Use tar -X option instead of tar --exclude=... option.
2013-08-29 13:27:40 +01:00
Richard W.M. Jones
a75ca610b8 daemon: Allow labels to be set on DOS filesystems using 'dosfslabel'.
You can now use virt-format or virt-make-fs --label option to set a
label for a DOS filesystem:

$ ./run ./format/virt-format -a /tmp/test.img --filesystem=vfat --label=BOOT
$ ./run ./cat/virt-filesystems -a /tmp/test.img --all --long -h
Name       Type        VFS   Label  MBR  Size  Parent
/dev/sda1  filesystem  vfat  BOOT   -    1.0G  -
/dev/sda1  partition   -     -      0b   1.0G  /dev/sda
/dev/sda   device      -     -      -    1.0G  -

This also contains a small code refactoring.

Thanks: Gerd Hoffmann (kraxel)
2013-08-29 11:43:31 +01:00
Richard W.M. Jones
e17cd73fb7 virt-make-fs: Add --label option for setting filesystem label.
$ ./run ./tools/virt-make-fs /tmp/supermin-4.1.4.tar.gz /tmp/test.img
$ ./run ./cat/virt-filesystems -a /tmp/test.img --all --long -h
Name      Type        VFS   Label  MBR  Size  Parent
/dev/sda  filesystem  ext2  -      -    3.7M  -
/dev/sda  device      -     -      -    3.7M  -

$ ./run ./tools/virt-make-fs /tmp/supermin-4.1.4.tar.gz /tmp/test.img --label=BOOT
$ ./run ./cat/virt-filesystems -a /tmp/test.img --all --long -h
Name      Type        VFS   Label  MBR  Size  Parent
/dev/sda  filesystem  ext2  BOOT   -    3.7M  -
/dev/sda  device      -     -      -    3.7M  -

Thanks: Gerd Hoffmann (kraxel)
2013-08-29 11:38:09 +01:00
Richard W.M. Jones
c46e41cb3c format: Add --label option for setting filesystem label.
$ ./run ./format/virt-format -a /tmp/test.img --filesystem=ext2 --label=BOOT
$ ./run ./cat/virt-filesystems -a /tmp/test.img --all --long -h
Name       Type        VFS   Label  MBR  Size  Parent
/dev/sda1  filesystem  ext2  BOOT   -    1.0G  -
/dev/sda1  partition   -     -      83   1.0G  /dev/sda
/dev/sda   device      -     -      -    1.0G  -

Thanks: Gerd Hoffmann (kraxel)
2013-08-29 11:38:06 +01:00
Richard W.M. Jones
d432ab2b5a format: Set MBR partition type byte appropriately (RHBZ#1000428).
Windows won't see a filesystem unless the MBR partition type
byte is set correctly.

$ ./run ./format/virt-format -a /tmp/test.img
$ ./run ./cat/virt-filesystems -a /tmp/test.img --all --long -h
Name       Type        VFS      Label  MBR  Size  Parent
/dev/sda1  filesystem  unknown  -      -    1.0G  -
/dev/sda1  partition   -        -      83   1.0G  /dev/sda
/dev/sda   device      -        -      -    1.0G  -

$ ./run ./format/virt-format -a /tmp/test.img --filesystem=ntfs
$ ./run ./cat/virt-filesystems -a /tmp/test.img --all --long -h
Name       Type        VFS   Label  MBR  Size  Parent
/dev/sda1  filesystem  ntfs  -      -    1.0G  -
/dev/sda1  partition   -     -      07   1.0G  /dev/sda
/dev/sda   device      -     -      -    1.0G  -

$ ./run ./format/virt-format -a /tmp/test.img --filesystem=vfat
$ ./run ./cat/virt-filesystems -a /tmp/test.img --all --long -h
Name       Type        VFS   Label  MBR  Size  Parent
/dev/sda1  filesystem  vfat  -      -    1.0G  -
/dev/sda1  partition   -     -      0b   1.0G  /dev/sda
/dev/sda   device      -     -      -    1.0G  -

$ ./run ./format/virt-format -a /tmp/test.img --lvm --filesystem=vfat
$ ./run ./cat/virt-filesystems -a /tmp/test.img --all --long -h
Name        Type        VFS   Label  MBR  Size   Parent
/dev/VG/LV  filesystem  vfat  -      -    1020M  -
/dev/VG/LV  lv          -     -      -    1020M  /dev/VG
/dev/VG     vg          -     -      -    1020M  /dev/sda1
/dev/sda1   pv          -     -      -    1020M  -
/dev/sda1   partition   -     -      8e   1.0G   /dev/sda
/dev/sda    device      -     -      -    1.0G   -

Thanks: Gerd Hoffmann (kraxel)
2013-08-29 11:24:00 +01:00
Richard W.M. Jones
ca4b408968 appliance: Use gzip-compressed cpio files if supermin-helper supports it.
supermin-helper >= 4.1.4 has new support for compressed cpio files
(not hostfiles).  Detect if this is supported, and use it.
2013-08-28 22:48:57 +01:00
Richard W.M. Jones
532117de29 javadoc: Install javadoc in $(datadir)/javadoc/libguestfs (without -java-$(version)).
Apparently this is the normal place for javadoc, and not
where we installed it before.
2013-08-28 18:45:14 +01:00
Richard W.M. Jones
b1919066ca Initialize CLEANUP_* stack variables with NULL in various places.
Code like:

  CLEANUP_FREE char *buf;
  /* some code which might return early */
  buf = malloc (10);

is a potential bug because the free (*buf) might be called when buf is
an uninitialized pointer.  Initialize buf = NULL to avoid this.

Several of these are bugs, most are not bugs (because there is no
early return statement before the variable gets initialized).

However the compiler can elide the initialization, and even if it does
not the performance "penalty" is miniscule, and correctness is better.
2013-08-22 19:48:05 +01:00
Richard W.M. Jones
fc2947b112 daemon: sh: Fix missing initializer which caused segfault (RHBZ#1000121).
Thanks: Olaf Hering.
2013-08-22 19:39:25 +01:00
Olaf Hering
4fdf05e199 lib: avoid pragma usage in journal.c
journal.c: In function 'guestfs__journal_get':
journal.c:120:9: error: #pragma GCC diagnostic not allowed inside functions
journal.c:121:9: error: #pragma GCC diagnostic not allowed inside functions
journal.c:123:9: error: #pragma GCC diagnostic not allowed inside functions
make[3]: *** [libguestfs_la-journal.lo] Error 1

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2013-08-20 18:29:52 +01:00
Richard W.M. Jones
d188594b11 daemon: hivex: Define empty hivex_finalize function in case !HAVE_HIVEX.
Thanks: Olaf Hering (see previous commit).
2013-08-20 18:28:25 +01:00
Olaf Hering
8590ec9b56 daemon: fix build without systemd-journal
Fix typo in OPTGROUP_JOURNAL_NOT_AVAILABLE
Define empty journal_finalize, called by mount.c

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2013-08-20 18:28:02 +01:00
Richard W.M. Jones
c2232321b6 daemon: Document guestfs_verbose=1 and guestfs_channel=<PATH> in man page. 2013-08-20 11:42:18 +01:00
Olaf Hering
cb7b1c56b7 tests: change noinst to check
This change avoids the hard requirement for qemu-tools during package
build.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2013-08-19 19:24:23 +01:00
Richard W.M. Jones
d408931bba Version 1.23.18. 2013-08-19 19:01:37 +01:00
Richard W.M. Jones
835e11c892 uml: Remove unused function is_numeric.
This fixes commit b607f86288.
2013-08-19 15:45:35 +01:00
Richard W.M. Jones
7e39695461 fish: Document that guestfish --remote --add won't work as expected (RHBZ#998513). 2013-08-19 14:17:55 +01:00
Richard W.M. Jones
a843b5e5e3 launch: direct: Don't try to wait for qemu if parent process forked (RHBZ#998482).
When using guestfish --remote, libguestfs is not the parent of qemu,
so waitpid is expected to return -ECHILD.  And indeed guestfish --remote
would print a bogus error message in this case:

  libguestfs: error: waitpid (qemu): No child processes

If the parent process forked into the background, then it should have
called 'set_recovery_proc 0' so we can use this to determine if we
need to wait for qemu.

Thanks: Kazuya Saito for reporting and identifying the issue.
2013-08-19 13:54:37 +01:00
Richard W.M. Jones
b607f86288 uml: Remove kill_vmlinux subprocess, problem fixed upstream.
Note you need to apply these patches to the Linux kernel to get
User-Mode Linux to work with libguestfs:

http://marc.info/?l=user-mode-linux-devel&m=137682544009451&w=2
http://marc.info/?l=user-mode-linux-devel&m=137682543809449&w=2
http://marc.info/?l=user-mode-linux-devel&m=137682544209452&w=2
http://marc.info/?l=user-mode-linux-devel&m=137682543809448&w=2
2013-08-19 10:37:35 +01:00
Richard W.M. Jones
7cdd96323c uml: Exit status 1 is a normal exit code for vmlinux subprocess.
Note you need to apply these patches to the Linux kernel
to get User-Mode Linux to work with libguestfs:

http://marc.info/?l=user-mode-linux-devel&m=137682544009451&w=2
http://marc.info/?l=user-mode-linux-devel&m=137682543809449&w=2
http://marc.info/?l=user-mode-linux-devel&m=137682544209452&w=2
http://marc.info/?l=user-mode-linux-devel&m=137682543809448&w=2
2013-08-19 10:31:27 +01:00
Or Goshen
18b40a8892 Fix to src/proto.c in libguestfs so it will compile with portablexdr under mingw. 2013-08-19 10:08:34 +01:00
Nikita Menkovich
f33343a5c1 sysprep: added --mount-options option to mount selected partitions with options. 2013-08-19 08:31:55 +01:00
Richard W.M. Jones
abc59d776a FAQ: Replace the debugging section (again) with a checklist of information we need to start to fix bugs. 2013-08-16 13:38:04 +01:00
Richard W.M. Jones
0a484e868f FAQ: Move #debug anchor back to the right place.
This was accidentally moved by this commit:

  commit b8b5ed65c2
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Wed May 23 11:46:23 2012 +0100

    FAQ: Add section about using libguestfs in closed source programs.
2013-08-16 13:24:19 +01:00
Richard W.M. Jones
937a9a3532 FAQ: Delete section about Ubuntu 10.04.
The link was broken, and we don't support Ubuntu 10.04 (maybe the
'oldlinux' branch does).
2013-08-16 12:00:06 +01:00
Richard W.M. Jones
f68d5ee16c cleanups: Use correct types for some cleanup functions. 2013-08-16 09:13:59 +01:00
Richard W.M. Jones
bcd7e6d879 uml: Add uml_mkcow requirement to README.
This fixes commit 858d6e7176.
2013-08-15 22:31:30 +01:00
Richard W.M. Jones
0875592763 launch: Create the direct & uml command lines safely.
Refactor the direct & uml backends to safely create the qemu & vmlinux
command lines.

Don't do malloc-after-fork, which is not safe.  Do all the allocation
in the main process before the fork.

Use stringsbuf to simplify the code.
2013-08-15 22:22:45 +01:00
Richard W.M. Jones
0f26218905 Refactor backends so they are modular.
Instead of hard-coding the list of backends into the core of
libguestfs in many places, make each backend into a true module which
registers itself with the core when the library is loaded.

This is a step towards making backends into loadable modules, but it
doesn't actually do that.

This is just code motion.
2013-08-15 22:22:45 +01:00
Richard W.M. Jones
9b720899fc launch: libvirt: Move internal_set_libvirt_selinux_* APIs to common launch code.
This is just code motion, but means the libvirt backend no longer has
to export those two internal APIs.
2013-08-15 22:22:45 +01:00
Richard W.M. Jones
d2ae632d3b lib: Use stringsbuf at various places in the library to simplify the code.
This is just code refactoring.
2013-08-15 22:22:45 +01:00
Richard W.M. Jones
35278e4c18 lib: Add stringsbuf mini-library for constructing lists of strings.
This is modelled on similar code in the daemon that we have used
successfully for a long time.
2013-08-15 22:21:45 +01:00
Richard W.M. Jones
f1d2934216 list-filesystems: Don't fail if there are no filesystems found (RHBZ#995711).
list-filesystems was returning NULL (but not setting an error) if no
filesystems were found.  Instead return an empty list.
2013-08-15 21:50:36 +01:00
Richard W.M. Jones
d0a2057786 cmd: Better type checking in CLEANUP_CMD_CLOSE macro. 2013-08-15 18:43:45 +01:00
Richard W.M. Jones
00cbb5c185 utils: Move guestfs___drive_name function to the utilities library.
For some historical reason, it was stuck in src/launch-direct.c and
the comment referred to launch-appliance.c!
2013-08-15 11:33:55 +01:00
Richard W.M. Jones
bd30d3a61c podwrapper: guestunmount is a libguestfs page, don't link it to he.net. 2013-08-15 09:12:44 +01:00
Richard W.M. Jones
d63325f6a1 Version 1.23.17. 2013-08-14 23:30:30 +01:00
Richard W.M. Jones
b1a8733511 Remove contrib file from EXTRA_DIST.
This fixes commit 36d29700dc.
2013-08-14 23:28:11 +01:00
Richard W.M. Jones
55ee0329c5 guestfs-performance: Add a section on the performance of UML. 2013-08-14 18:52:01 +01:00
Richard W.M. Jones
78dbd08dd2 Rename 'qemu' as 'hv', 'LIBGUESTFS_QEMU' as 'LIBGUESTFS_HV'. 2013-08-14 17:25:34 +01:00
Richard W.M. Jones
46763bcc0b launch: libvirt: Don't enable <cpu mode="host-model"> on TCG.
It's fairly pointless to do this with TCG, since all we would be doing
is emulating a more complicated processor slowly.  Also it may be the
cause of subtle problems we see during testing.

This updates commit 6f76fdb41e.
2013-08-14 17:25:34 +01:00
Richard W.M. Jones
c53b459fdd launch: direct: Don't use -cpu host on TCG.
qemu -cpu \? documents this as:

host  KVM processor with all supported host features (only available in KVM mode)

And indeed if you try it with TCG you'll get this error:

Unable to find CPU definition: host

This fixes commit 038ed0a08e.
2013-08-14 17:25:34 +01:00
Richard W.M. Jones
08f605c073 tests: Add a test that console log messages make it up to events.
In Rawhide, the console was briefly broken although it "fixed itself"
when libvirtd was restarted.
2013-08-14 17:25:11 +01:00
Richard W.M. Jones
36d29700dc Remove contrib/guestfsd-in-wine.sh.
Added in 2009, unlikely it still works since I doubt it has been
compiled since then.
2013-08-13 21:45:29 +01:00
Richard W.M. Jones
4a873ee966 uml: Change (temporary) path to UML binary. 2013-08-13 21:31:12 +01:00
Richard W.M. Jones
0a9f1fe8d6 Version 1.23.16. 2013-08-13 19:07:53 +01:00
Richard W.M. Jones
5094b42197 uml: Add check-uml and check-valgrind-uml to release tests. 2013-08-13 15:46:55 +01:00
Richard W.M. Jones
23ad2c6071 uml: tests: Add 'make check-uml' and 'make check-valgrind-uml' rules.
These run the test suite using User-Mode Linux.  Currently you have to
set LIBGUESTFS_QEMU to point to the vmlinux binary, but perhaps we
can solve that in future.
2013-08-13 15:46:55 +01:00
Richard W.M. Jones
b922f6521e uml: virt-make-fs: Modify test so it doesn't use qcow2 under UML.
Modify the test so it doesn't try to test qcow2 format when the
backend is User-Mode Linux which doesn't support qcow2.
2013-08-13 15:46:55 +01:00
Richard W.M. Jones
003e854b98 uml: sparsify: Skip test since it needs qcow2. 2013-08-13 15:46:55 +01:00
Richard W.M. Jones
2d758d548b uml: resize: Skip test since it needs qcow2. 2013-08-13 15:46:55 +01:00
Richard W.M. Jones
ca5ecf2e76 uml: fuse: Skip test since it needs qcow2. 2013-08-13 15:46:55 +01:00
Richard W.M. Jones
574a7ad04c uml: tests: edit: Skip test since it needs qcow2. 2013-08-13 15:46:55 +01:00
Richard W.M. Jones
d25732f852 uml: tests/qemu: Fix tests so they work without support for qcow2. 2013-08-13 15:46:55 +01:00
Richard W.M. Jones
1d20770d41 uml: tests/md: Skip test-inspect-fstab.sh since it needs qcow2. 2013-08-13 15:46:55 +01:00
Richard W.M. Jones
e9d2508694 uml: tests/md: Fix test to cope with /dev/ubd* device names. 2013-08-13 15:46:55 +01:00
Richard W.M. Jones
73e959e1ee uml: tests/luks: Fix assumption that broke /dev/ubd* device names. 2013-08-13 15:46:54 +01:00
Richard W.M. Jones
9c3d1efcaa uml: tests/lvm: Fix assumption that broke /dev/ubd* device names. 2013-08-13 15:46:54 +01:00
Richard W.M. Jones
f622d854a7 uml: tests/mountable: Skip tests that need qcow2. 2013-08-13 15:46:54 +01:00
Richard W.M. Jones
4d64dbfe48 uml: tests/disks: Fix test so it can cope with /dev/ubd* device names. 2013-08-13 15:46:54 +01:00
Richard W.M. Jones
8d5a0d77fb uml: tests: Skip some tests which cannot work with the UML backend. 2013-08-13 15:46:54 +01:00
Richard W.M. Jones
4c66cbc3be uml: Fix race when multiple handles are used in parallel.
See comment for explanation.
2013-08-13 15:46:54 +01:00
Richard W.M. Jones
3e4d55a6f9 uml: Fix maximum number of disks. 2013-08-13 15:46:54 +01:00
Richard W.M. Jones
ed3c98434f uml: Fix guestfs_canonical_device_name API to understand /dev/ubd* paths. 2013-08-13 15:46:54 +01:00
Richard W.M. Jones
4275404626 virt-list-filesystems: Fix to use $g->canonical_device_name instead of homebrew function.
The homebrew function didn't recognize /dev/ubd* device names, and in
any case using the API function is shorter and clearer.
2013-08-13 15:46:54 +01:00
Richard W.M. Jones
90cafed4c2 daemon: list-md-devices: Check if a /dev/md<X> device is valid before returning it.
For reasons not fully understood, if md is linked into the kernel (and
not a module), a /dev/md0 device node is created.  However this is not
a real RAID device.  For example running mdadm --detail /dev/md0 will
fail on it.

Check the /dev/md<X> devices are real RAID devices before returning
them from the list-md-devices API.
2013-08-13 15:46:54 +01:00
Richard W.M. Jones
52188f1ea3 daemon: md: Whitespace fixes. 2013-08-13 15:46:54 +01:00
Richard W.M. Jones
8ad634877c daemon: If /proc/modules doesn't exist, linuxmodules optgroup is disabled.
It likely means the kernel was compiled without modules support.
2013-08-13 15:46:54 +01:00
Richard W.M. Jones
071d7fb6d7 tests/regressions: Allow regression test for bug 914931 to be skipped. 2013-08-13 15:46:53 +01:00
Richard W.M. Jones
42abbf0969 tests/md: Fix error path to display the correct output. 2013-08-12 18:45:49 +01:00
Richard W.M. Jones
4cc99ea2e9 docs: The old make check-with-appliance/etc rules were renamed.
This fixes commit 68990840b6.
2013-08-12 16:00:59 +01:00
Richard W.M. Jones
8b43767b7c tests: c-api: Fix device name comparison when using User-Mode Linux.
This updates commit 858d6e7176.
2013-08-12 14:27:01 +01:00
Richard W.M. Jones
ab797f7e47 docs: Clearer documentation for User-Mode Linux.
This updates commit 858d6e7176.
2013-08-12 13:41:53 +01:00
Richard W.M. Jones
19ee64303e launch: direct: Print \n after printing qemu command line.
This makes it easier to see error messages printed by qemu.
2013-08-12 13:41:24 +01:00
Richard W.M. Jones
e037f0d26b daemon: compare_device_names: Fix typo in this function.
This would have broken the function if we were comparing mixed
/dev/sda and /dev/ubda (ie different length) strings.  Which we never
normally do, luckily.
2013-08-12 13:40:24 +01:00
Richard W.M. Jones
c09a2b5faf Version 1.23.15. 2013-08-11 23:38:34 +01:00
Richard W.M. Jones
29d8658311 daemon: Ensure CLEANUP_FREE* variables are initialized with NULL.
Otherwise an early exit from the function will cause an uninitialized
pointer to be freed.

This fixes commit 1d7c3a2782.
2013-08-11 23:38:34 +01:00
Richard W.M. Jones
858d6e7176 Add experimental User-Mode Linux backend. 2013-08-11 20:47:16 +01:00
Richard W.M. Jones
9a6cc3c927 daemon: Recognize /dev/ubd[a-] as a valid device name. 2013-08-11 19:49:46 +01:00
Richard W.M. Jones
f55a1a1fe7 daemon: Allow guestfs_channel to override the virtio-serial channel.
Also if /dev/ttyS* is specified, make sure the serial port is set to
raw mode.
2013-08-11 19:49:45 +01:00
Richard W.M. Jones
236415e339 conn: Make sure we display all log messages when qemu goes away.
If qemu goes away it is (more in theory than in reality) possible for
log messages to be lost in the kernel's socket buffer.

This turns out to matter more for User-Mode Linux.
2013-08-11 19:49:45 +01:00
Richard W.M. Jones
3620ca1339 appliance/init: Allow guestfs_noreboot=1 flag to avoid reboot at end of /init script. 2013-08-11 19:49:45 +01:00
Richard W.M. Jones
e5285cc421 lib: Turn 'random_chars' function used by libvirt backend into utility function. 2013-08-11 19:49:45 +01:00
Richard W.M. Jones
467fd96e7e utils: Remove duplicate inclusion of <string.h>. 2013-08-11 19:49:45 +01:00
Richard W.M. Jones
2089f7a21a daemon: ldm: Don't return an error if /dev/mapper doesn't exist. 2013-08-11 17:41:09 +01:00
Richard W.M. Jones
1d7c3a2782 daemon: Device name translation now allocates a new string.
Previously device name translation worked on the string in-place.

This worked fine because the device strings always come from XDR where
they are dynamically allocated.  However it wouldn't work if the
translated name had to be longer than the original, specifically for
/dev/sd -> /dev/ubd (for User Mode Linux).

Therefore this commit changes the generator so that
device_name_translation and parse_btrfsvol (which depends on it)
allocate the new device name instead of overwriting it.
2013-08-11 17:39:57 +01:00
Richard W.M. Jones
89cf1c1163 daemon: Move all RESOLVE macros to daemon/stubs.c.
These macros are pretty horrible to use, with unexpected side-effects.
Move them exclusively into the generated code and rewrite the one
place in the general C code which used them.

There's no functional change in this code.
2013-08-11 17:39:57 +01:00
Richard W.M. Jones
d969436205 tests/mountable: Better error messages.
Better error messages (for diagnosis) when this test fails.  Also this
fixes the line endings which were broken before.
2013-08-11 17:39:57 +01:00
Richard W.M. Jones
94872348e8 Fix --enable-valgrind-daemon so it doesn't break valgrind of the library.
Using ./configure --enable-valgrind-daemon breaks valgrinding of the
library because guestfs_close wouldn't call guestfs_shutdown in that
case, resulting in some resources owned by the backend being leaked.

After this commit, --enable-valgrind-daemon will shut down the handle
normally.

This updates commit 55e3b8711f.
2013-08-11 17:39:57 +01:00
Richard W.M. Jones
e7b06f7cf8 Print an error message if valgrind failure is detected in the daemon.
This updates commit 55e3b8711f.
2013-08-11 12:08:35 +01:00
Richard W.M. Jones
7367729ec7 daemon: Remove unnecessary sysroot_path (selinux).
This fixes commit 72afcf450a.
2013-08-10 23:02:42 +01:00
Richard W.M. Jones
55e3b8711f Fix --enable-valgrind-daemon option.
Don't add the "valgrind channel" to the appliance.

Just dump out the valgrind.log to stderr while the daemon is running.

Ensure that if valgrind tests fail in the appliance, that we don't
exit with success in the library by checking for a canary message in
the verbose daemon logs.

This allows the option to be used routinely by developers.
2013-08-10 22:21:22 +01:00
Richard W.M. Jones
26309a1c3a proto: Fix --enable-packet-dump mode.
This was broken when we rearranged the socket code.
2013-08-09 22:34:28 +01:00
Richard W.M. Jones
6c2fad11ac appliance/init: Display uname -a in debug output.
Useful for debugging kernel / architecture issues.  Note this
has no effect if debugging is disabled.
2013-08-09 17:34:00 +01:00
Richard W.M. Jones
ce6e5738fc daemon: Close augeas, hivex, journal handles in unmount_all.
This is also called implicitly from internal_autosync, ensuring that
exit won't fail because of an open handle.

libguestfs: error: internal_autosync: umount: /sysroot: umount: /sysroot: target is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
2013-08-07 14:54:10 +01:00
Paul Mackerras
7c535c501b Fix parsing of boot flag in do_part_get_bootable()
The code in do_part_get_bootable() assumes that if a partition has the
bootable flag set, then that is the only flag.  It compares the entire
flags field with the string "boot".  However, the boot flag isn't
always the only flag.  For instance, POWER systems typically have a
bootable partition of type 0x41 (PPC PReP boot), which parted -m
displays as:

# parted -m -- f18.img unit b print
BYT;
/root/f18.img:16106127360B:file:512:512:msdos::;
1:1048576B:5242879B:4194304B:::boot, prep;

That is, the flags field contains "boot, prep", and thus libguestfs
fails to see that this partition is bootable.  Ultimately this causes
virt-resize to fail to set the bootable flag on the boot partition of
the destination image, resulting in an image that won't boot.

This patch fixes the problem by searching for the string "boot" within
the flags field, instead of comparing the whole flags field.
2013-08-07 12:28:10 +01:00
Richard W.M. Jones
5b278937df sparsify: Advertize in --machine-readable that we support --check-tmpdir option.
This lets programs add the --check-tmpdir=[ignore|continue|fail]
option to avoid interactivity.

This fixes commit 7c463ac477.
2013-08-06 18:20:44 +01:00
Richard W.M. Jones
12b740fbe0 Version 1.23.14. 2013-08-06 16:29:02 +01:00
Richard W.M. Jones
1ef79b7f1f Pull latest translations from Transifex. 2013-08-06 14:43:56 +01:00
Richard W.M. Jones
56f613b130 Update Transifex domain name from .net -> .com. 2013-08-06 14:34:48 +01:00
Richard W.M. Jones
3197a2687c Update gnulib to latest version. 2013-08-06 14:31:48 +01:00
Richard W.M. Jones
7c463ac477 sparsify: Get free space on TMPDIR and give a warning if we estimate it is too little. 2013-08-06 13:23:04 +01:00
Richard W.M. Jones
f6b2efcdff Update TODO file. 2013-08-06 12:20:31 +01:00
Richard W.M. Jones
c4a3e8112a New APIs: aug-setm and aug-label.
Bindings for the aug_setm and aug_label APIs in Augeas.
2013-08-06 11:47:21 +01:00
Richard W.M. Jones
f26a0407d2 augeas: Improve error reporting.
Display all the information from the handle about errors.
2013-08-06 11:47:21 +01:00
Richard W.M. Jones
a709b10bb6 launch: libvirt: Enable kvmclock.
This enables stable guest clocks.
2013-08-05 18:06:24 +01:00
Richard W.M. Jones
6f76fdb41e launch: libvirt: Enable <cpu mode=host-model>.
This may still cause problems on some CPUs because of a bug
in libvirt.  See:
https://bugzilla.redhat.com/show_bug.cgi?id=870071
2013-08-05 16:51:51 +01:00
Richard W.M. Jones
038ed0a08e launch: direct: Specify -cpu host,+kvmclock.
'-cpu host' makes the CPU look like the host CPU.  This is useful
because it means the appliance can use all the host CPU's features,
eg. for fast checksumming or MD XORing.

'kvmclock' is the paravirtualized clock for qemu/KVM.  It's much more
stable than relying on tsc or a virtualized device such as HPET, and
clock instability is one of the problems we have encountered when
running libguestfs on a heavily loaded machine, especially in a nested VM.

Note that we require qemu >= 1.2 (and have for a while) which has long
supported both of these options.
2013-08-05 16:39:24 +01:00
Richard W.M. Jones
568368cdf5 launch: direct: Add drives after machine parameters.
This is just code motion.  It should affect the semantics of the code,
nor how the appliance VM is created.
2013-08-05 16:35:15 +01:00
Richard W.M. Jones
8d68f1c5ce ./run: Omit timeout -k option on RHEL 6.
If timeout doesn't have the -k option, don't use it.
2013-08-05 15:45:33 +01:00
Richard W.M. Jones
82a6563414 Version 1.23.13. 2013-08-03 12:45:55 +01:00
Richard W.M. Jones
93f8baeb9a sysprep: Add "notes" field for notes on shortcomings, bugs, etc.
Instead of keeping this information as comments in the source, put it
into the virt-sysprep(1) man page.
2013-08-03 10:59:48 +01:00
Richard W.M. Jones
4cdbae926b sysprep: Various code refactorings of the operations.
- Use 'op' instead of 'xxx_op' for operation table.
 - Add a 'defaults' for the operation table and remove any default
   values.

This is just code motion and there is no functional change.
2013-08-03 10:25:19 +01:00
Richard W.M. Jones
67fd809ca3 resize: Mark progress bar functions as "noalloc".
Avoids GC overhead and turns these into simple C calls.  See:
http://camltastic.blogspot.co.uk/2008/08/tip-calling-c-functions-directly-with.html
2013-08-03 10:04:29 +01:00
Richard W.M. Jones
3d39549ded resize: Mark isatty function as "noalloc".
This turns it into an ordinary C call without the unnecessary [in this
case] GC frame overhead.  See:
http://camltastic.blogspot.co.uk/2008/08/tip-calling-c-functions-directly-with.html
2013-08-03 10:01:34 +01:00
Richard W.M. Jones
0c512a52bd FAQ: Tips about using direct backend and fixed appliance on Fedora/RHEL. 2013-08-03 09:20:41 +01:00
Richard W.M. Jones
9268f14879 FAQ: Common problem with Debian is not running update-guestfs-appliance. 2013-08-03 09:19:57 +01:00
Richard W.M. Jones
44df867382 sysprep: Allow root and non-root passwords to be set.
This adds a virt-sysprep 'password' operation which adds the
following command line options:

  --root-password     Set the guest's root password.
  --password          Set any guest password.
2013-08-02 15:37:30 +01:00
Richard W.M. Jones
5deea7fce6 sysprep: Disable fs-uuids operation by default.
Disable this operation because it is more likely than not to break
Linux guests.

To fix this properly will involve finding all the places in the guest
where the UUIDs are used to locate and mount filesystems,
eg. /etc/fstab and possibly initramfs.

This updates commit 8965368eb8.
2013-08-02 15:17:24 +01:00
Richard W.M. Jones
a89675ee5c journal: Fix incorrect printf format specifier for 32-bit.
journal.c: In function 'do_journal_skip':
journal.c:134:5: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'int64_t' [-Werror=format=]
     reply_with_perror_errno (-r, "failed to skip %zd journal entries", skip);
     ^

This fixes commit 5cb7f294f6.
2013-07-31 22:37:57 +01:00
Richard W.M. Jones
6a46bd9a86 arm: Avoid cast-align warning.
Note the 64-bit int field really isn't aligned.  We hope that the ARM
kernel this is running on will do the appropriate fix ups.
2013-07-31 22:37:57 +01:00
Nicholas Strugnell
94e5ea6b5e sysprep: rhn_systemid: delete osad-auth.conf file in RHN configuration 2013-07-31 16:33:17 +01:00
Richard W.M. Jones
a1e8acc736 Version 1.23.12. 2013-07-30 18:16:30 +01:00
Richard W.M. Jones
65b4ab11e1 tests: fish: Add valgrind testing to various existing tests.
This involves running ./guestfish under $VG (== valgrind + options,
defined only when check-valgrind is run).
2013-07-30 16:27:55 +01:00
Richard W.M. Jones
23d429ff84 fish: Add a test for -a URI options. 2013-07-30 16:15:04 +01:00
Richard W.M. Jones
e3df223a5a fish: Fix guestfish so it can recognize sheepdog://... as a valid URI.
Because "sheepdog" is 8 characters, it wasn't recognized before.
2013-07-30 16:13:24 +01:00
Richard W.M. Jones
b65c1c667b sysprep: Allow -a URI options to be used (RHBZ#968875).
This allows you to sysprep a remote guest by doing eg:

  virt-sysprep -a ssh://remote.example.com/disk.img
2013-07-30 15:37:16 +01:00
Richard W.M. Jones
406522d1d2 resize: Add bindings for the guestfish -a URI parsing mini-library.
This allows -a options to be parsed from OCaml programs, reusing
the same code that is being used by C.
2013-07-30 15:37:16 +01:00
Richard W.M. Jones
4d7c14fdbb fish: Split off URI handling (for -a argument) from general options parsing.
This is so we will be able to reuse the same code in the OCaml tools.

This is just code motion.
2013-07-30 15:37:16 +01:00
Richard W.M. Jones
671be806ae fish: options: Fix optarg -> arg.
Don't read the global variable optarg.  Read arg instead.
(In all cases they are the same, so this bug made no difference).
2013-07-30 13:49:49 +01:00
Richard W.M. Jones
a3891430bc fish: Don't store xmlURIPtr directly in the drive struct.
Original drv_uri fields:

      xmlURIPtr uri;        /* URI */
      char *socket;         /* ?socket parameter from URI. */
      const char *format;   /* format (NULL == autodetect) */

New drv_uri fields:

      char *path;           /* disk path */
      char *protocol;       /* protocol (eg. "nbd") */
      char **server;        /* server(s) - can be NULL */
      char *username;       /* username - can be NULL */
      const char *format;   /* format (NULL == autodetect) */
      const char *orig_uri; /* original URI (for error messages etc.) */

This is just code motion.
2013-07-30 12:17:22 +01:00
Richard W.M. Jones
0e1ba00059 internal: Add CLEANUP_XMLFREEURI (cleanup function for xmlURIPtr). 2013-07-30 12:16:38 +01:00
Richard W.M. Jones
b56990ddf8 resize: Move isatty_stdout function to separate module (TTY.isatty_stdout).
It was jammed into the Progress module just for convenience.
2013-07-30 11:46:22 +01:00
Richard W.M. Jones
c663ab3bb9 daemon: cap-get-file: Return empty string if no capability on file (RHBZ#989356).
Return an empty string (instead of an error) if no capabilities are
set on a file, and document that in the API.
2013-07-29 14:37:50 +01:00
Richard W.M. Jones
fb282e677c resize: Link to information about dracut-modules-growroot. 2013-07-29 13:52:16 +01:00
Richard W.M. Jones
a1236b7251 tests/mount-local: Fix test of parallel mount-local.
This fixes commit 14fabcd88e.

Bug found by Kashyap Chamarthy.
2013-07-29 11:58:48 +01:00
Richard W.M. Jones
7a6968f1e4 Version 1.23.11. 2013-07-29 08:58:41 +01:00
Richard W.M. Jones
ebf477107d tests: Add tests for the new journal APIs (RHBZ#988100).
This relies on the test data from
commit b502197ec4.
2013-07-28 19:16:04 +01:00
Richard W.M. Jones
5cb7f294f6 New APIs: Add systemd journal support (RHBZ#988100).
This adds simple support for reading the journal files from guests
that use the systemd journal.

The new APIs are:

  journal-open
  journal-close
  journal-next
  journal-skip
  journal-get
  journal-get-data-threshold
  journal-set-data-threshold
  internal-journal-get

More complex journal support (eg. for seeking within the journal,
support for cursors) could be added later.
2013-07-28 19:16:03 +01:00
Richard W.M. Jones
b502197ec4 tests/guests: Add some systemd journal data to the Fedora test images.
The journal data blob comes from a real Fedora 20 (x86-64) machine.
2013-07-27 18:16:42 +01:00
Richard W.M. Jones
1937108a4a src/file.c: Be sure to call guestfs___lazy_make_tmpdir before using g->tmpdir.
Although g->tmpdir is always set after launch, and none of these calls
should be used before launch, it's always possible that a caller would
use one of these APIs before launching the handle.

If guestfs___lazy_make_tmpdir is not called, then g->tmpdir is NULL,
and the constructed filename would look like "(null)/...".

In fact it's possible to observe this error (although it seems to have
no especially bad effects):

  $ strace guestfish ls / |& fgrep '(null)'
  unlink("(null)/ls1")     = -1 ENOENT (No such file or directory)
2013-07-27 16:45:37 +01:00
Richard W.M. Jones
e31c32ce1b generator: Fix the case where a daemon function has one FileIn/FileOut parameter and no other parameters.
The FileIn/FileOut parameters are not passed through to the daemon.
Previously we generated incorrect RPC code (an empty 'struct
guestfs_<fn>_args') because we didn't account for these FileIn/FileOut
parameters correctly.
2013-07-27 16:45:37 +01:00
Richard W.M. Jones
559bd48960 generator: Fix whitespace. 2013-07-27 15:58:32 +01:00
Richard W.M. Jones
44c5026d9e sysprep: On RHEL, firstboot script should be called S99... not 99.
Thanks: Nicholas Strugnell
2013-07-26 15:42:36 +01:00
Richard W.M. Jones
4d2c63a9bc Version 1.23.10. 2013-07-23 12:23:51 +01:00
Richard W.M. Jones
4180abcc1f tests: Use unique or temporary names for temporary files.
Review every test(!) to ensure that it:

 - Doesn't use a generic name (eg. "test1.img", "test.out") for any
   temporary file it needs.

 - Does instead use a unique name or a temporary name (eg. a name like
   "name-of-the-test.img", or a scratch disk).

 - Does not use 'rm -f' to clean up its temporary files (so we can
   detect errors if the wrong temporary file is created or removed).

This allows tests to be run in parallel, so they don't stomp on each
other's temporary files.
2013-07-23 10:16:00 +01:00
Richard W.M. Jones
ccd069f859 fish: For -N option, add drive with explicit format = "raw".
Although autodetecting is safe (we always have just created a drive),
it saves a little bit of time if we don't have to run qemu-img to
detect the disk format with the libvirt backend.

Note that for prepared drives the format is always raw and we don't
anticipate creating drives in other formats.
2013-07-23 09:44:32 +01:00
Richard W.M. Jones
7c8c6e0760 fish: Allow -N filename=type to use 'filename' instead of 'test1.img' (etc.)
So:

  guestfish -N fs

is equivalent to:

  guestfish -N test1.img=fs
2013-07-22 15:45:06 +01:00
Richard W.M. Jones
3c94f02456 fish: Split up long line in --help output. 2013-07-22 15:24:52 +01:00
Richard W.M. Jones
a8b03201f0 fish: Clarify documentation.
It's not "the guest" which is launched, but the libguestfs appliance.
2013-07-22 15:16:39 +01:00
Richard W.M. Jones
8965368eb8 sysprep: Add new fs-uuids operation.
This creates new random UUIDs for all filesystems in a guest.
2013-07-22 13:52:23 +01:00
Richard W.M. Jones
df02c2471f docs: Document labels and UUIDs in the API overview section. 2013-07-22 13:52:23 +01:00
Richard W.M. Jones
8580ef7d0f New API: Implement set-uuid for ext2/3/4 and XFS (RHBZ#986877).
Also includes tests.
2013-07-22 13:52:23 +01:00
Richard W.M. Jones
091d22f49e daemon: Implement set-label for XFS and fix it for btrfs (RHBZ#986875).
Implement 'set-label' for XFS filesystems.

Fix the call for btrfs.  Previous
commit d5817537fa added some bogus
documentation implying this call would work for btrfs, but it did
not.

Add tests.
2013-07-22 13:52:23 +01:00
Richard W.M. Jones
5724efa69f tools: 'test.img' is no longer used.
This probably used to be a temporary file used for testing.
2013-07-20 16:31:42 +01:00
Richard W.M. Jones
14fabcd88e tests: Use new guestfs_add_drive_scratch API where possible in tests.
Replaces code such as:

  fd = open "test1.img"
  ftruncate fd, size
  close fd
  g.add_drive "test1.img"

with the shorter and simpler:

  g.add_drive_scratch size
2013-07-20 16:31:42 +01:00
Richard W.M. Jones
57064c12ae fish: Link to the new 'scratch' command from the old 'sparse' command. 2013-07-20 16:31:42 +01:00
Richard W.M. Jones
0d97bcf8ae tests/lvm: Remove some commented out debugging code. 2013-07-20 16:31:42 +01:00
Richard W.M. Jones
0f7642674b tests/c-api: Use guestfs_add_drive_scratch API to create scratch drives.
Replaces the old custom code for making and deleting the drives.
2013-07-20 16:31:42 +01:00
Richard W.M. Jones
1b11a83d52 New API: add-drive-scratch.
This adds a temporary scratch drive to the handle.
2013-07-20 16:31:42 +01:00
Richard W.M. Jones
ecce45acc4 Revert "tests: Add a regression test for all disk_* info commands (RHBZ#981663)."
This reverts commit 2311fb0632.

This is no longer needed, since now the disk_* info functions
are being properly tested by the C API tests.
2013-07-20 16:31:42 +01:00
Richard W.M. Jones
8a3ecfc04e tests/c-api: Remove 'GETKEY:' hack since it's no longer used anywhere. 2013-07-20 16:31:42 +01:00
Richard W.M. Jones
89865011e4 tests: Better testing of guestfs_disk_* functions using blank disks from tests/data directory. 2013-07-20 16:31:42 +01:00
Richard W.M. Jones
48ed7abc21 tests/data: Add some blank disks in various sizes and formats for testing. 2013-07-20 16:31:42 +01:00
Richard W.M. Jones
b1d1a18af9 ocaml: Rewrite TESTS rule to be compatible with automake 1.13 parallel-tests.
Because of this bug in automake:

  https://lists.gnu.org/archive/html/bug-automake/2013-01/threads.html#00103

this requires that we duplicate the lists of bytecode (bc) and native
code (opt) tests because we cannot use ordinary GNU make macros to
construct these lists.
2013-07-20 16:31:42 +01:00
Richard W.M. Jones
7867c7cd8e FAQ: Add section about different packaging strategies for libguestfs. 2013-07-20 16:31:41 +01:00
Richard W.M. Jones
ec4498fec1 Update API support. 2013-07-19 12:00:03 +01:00
Richard W.M. Jones
0fbd5703c8 Version 1.23.9. 2013-07-19 10:06:31 +01:00
Richard W.M. Jones
3201e75564 mkfs: Use -b size=<size> for xfs (RHBZ#981715). 2013-07-18 14:36:25 +01:00
Richard W.M. Jones
2311fb0632 tests: Add a regression test for all disk_* info commands (RHBZ#981663). 2013-07-18 13:59:51 +01:00
Richard W.M. Jones
28e0877682 info: Fix double-call to error function when qemu-img info command fails (RHBZ#981663).
Previously if the 'qemu-img info --output json' command failed, then
the stdout callback would be called first with a zero-length buffer.
Since a zero-length buffer cannot be valid JSON (in this context)
don't produce a separate error message.

However do catch the case when qemu-img info might produce no output
and no error (if that were to happen -- it does not happen at the
moment).
2013-07-18 13:59:51 +01:00
Richard W.M. Jones
d50cb7bbb4 info: disk-format et al: Fix error message when no file exists (RHBZ#981663).
$ guestfish disk-format /etc/nosuchfile

Instead of this obscure double error message:

  libguestfs: error: qemu-img info: JSON parse error: parse error: premature EOF
                       (right here) ------^
  libguestfs: error: qemu-img info: /etc/nosuchfile: qemu-img info exited with error status 1.
  To see full error messages you may need to enable debugging.
  See http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs

You will now see this simpler error:

  libguestfs: error: disk info: /etc/nosuchfile: No such file or directory

Thanks: Bo Fan.
2013-07-18 13:59:51 +01:00
Richard W.M. Jones
aecb5f4b33 cmd: Allow callers to override file-closing behaviour after fork.
This allows us to send file descriptors directly to child processes,
eg. using /dev/fd/<N>.
2013-07-18 13:59:51 +01:00
Richard W.M. Jones
758a2262f5 acls: Improve documentation for acl_set_file (RHBZ#985269).
Thanks: Bo Fan.
2013-07-18 10:03:13 +01:00
Richard W.M. Jones
ea817cdc60 library: Fix a few direct calls to perror(3).
Mainly in the FUSE code, left over from when this code lived in the
standalone guestmount program.
2013-07-17 17:00:01 +01:00
Richard W.M. Jones
ed2351e137 tests: Improve the testing of acl_set_file function.
See also: https://bugzilla.redhat.com/show_bug.cgi?id=985269
2013-07-17 12:52:41 +01:00
Richard W.M. Jones
a7b9d61cde ./run: Increase default timeout from 1h -> 4h.
1 hour was not long enough for the C API tests when run in Koji.

This update commit caab9f1e6f.
2013-07-11 21:05:56 +01:00
Richard W.M. Jones
ae78381287 launch: appliance: Fix a double-free if kernel linking fails (RHBZ#983218).
This also simplifies the code which takes the building_lock around
guestfs___build_appliance.

Thanks Attila Fazekas for the detailed bug report.
2013-07-11 19:15:56 +01:00
Richard W.M. Jones
caab9f1e6f ./run: Timeout tests after 1 hour.
No single test should run longer than 1 hour even on the slowest of
hardware.  We are having a problem in Koji where a test hangs and then
we end up losing the output completely, so a timeout + print the log
to that point is much better.
2013-07-11 12:58:45 +01:00
Richard W.M. Jones
745e507c2f ./run: Add a better comment describing --test mode.
This is just code motion, there is no functional change.
2013-07-11 12:53:28 +01:00
Richard W.M. Jones
7e134f865f Remove more temporary ($builddir/tmp) files when doing 'make clean'. 2013-07-09 14:32:14 +01:00
Richard W.M. Jones
0bc729e85b golang: Fix it so it builds if libguestfs is not installed.
It was using the installed copy of libguestfs not the local copy.

We can't encode the paths in guestfs.go, since this source file gets
copied into the install directory where those paths would not make
sense.  Instead we have to use CGO_CFLAGS and CGO_LDFLAGS to
communicate the right flags to go when doing the local build and test.
2013-07-09 14:11:12 +01:00
Richard W.M. Jones
2624315bf1 Version 1.23.8. 2013-07-09 11:59:04 +01:00
Richard W.M. Jones
d457df7dc2 tests: Add test for aug_ls. 2013-07-06 21:05:13 +01:00
Richard W.M. Jones
bf838e3333 tests: Test aug_insert, aug_clear and aug_save. 2013-07-06 20:56:11 +01:00
Richard W.M. Jones
48c16e5ef1 tests: Test aug_set. 2013-07-06 20:46:45 +01:00
Richard W.M. Jones
535963bac3 tests: Test result of aug_get properly.
Don't just check aug_get runs, check the resulting string is correct.
2013-07-06 20:46:45 +01:00
Richard W.M. Jones
86ca8af9f1 tests: c-api: Add a cleanup function for tests.
By specifying a cleanup function we can ensure that Augeas and hivex
functions can be tested.

There is no functional change here, verified by diffing the generated
file tests/c-api/tests.c before and after.
2013-07-06 20:46:45 +01:00
Richard W.M. Jones
b5a938f464 tests: Fix mix up of actual/expected in error messages. 2013-07-06 20:46:45 +01:00
Richard W.M. Jones
02123b7242 FAQ: Fix typo. 2013-07-06 15:08:13 +01:00
Richard W.M. Jones
4b838a4b28 FAQ: Explain qemu-nbd & libguestfs better. 2013-07-06 15:07:58 +01:00
Richard W.M. Jones
31ce47fe48 tests: Add basic Augeas tests. 2013-07-05 15:07:34 +01:00
Richard W.M. Jones
8c9a5d623e hivex: Add some simple tests of the hivex_* APIs.
These are by no means comprehensive, but cover the basics.

The 'minimal' hive comes from hivex.
2013-07-05 14:58:26 +01:00
Richard W.M. Jones
c8f0a2eb76 daemon: hivex: Check that hivex_commit is passed an absolute path (RHBZ#981683).
You will now get an error like:

libguestfs: error: hivex_commit: do_hivex_commit: path must start with a / character
2013-07-05 14:27:38 +01:00
Richard W.M. Jones
280dbed9aa filesystem-available: Clarify documentation for this test.
See:
https://bugzilla.redhat.com/show_bug.cgi?id=980358#c1

Thanks Bo Fan.
2013-07-05 13:59:21 +01:00
Richard W.M. Jones
06f2c1ad70 golang: Add examples and guestfs-golang(3) man page. 2013-07-04 15:48:47 +01:00
Richard W.M. Jones
43121a02e7 golang: Don't try to free the result of guestfs_last_error.
The return value is a constant string, part of the handle, and
it must not be freed by the golang code.
2013-07-04 15:29:02 +01:00
Richard W.M. Jones
bb09c4a448 golang: tests: Call or defer g.Close(). 2013-07-04 14:52:44 +01:00
Richard W.M. Jones
58b51f5921 golang: Add bindtests. 2013-07-04 14:01:27 +01:00
Richard W.M. Jones
d48e4400fc golang: Map OptString to *string, not string (since string is not nullable). 2013-07-04 14:01:27 +01:00
Richard W.M. Jones
86c1e53ee6 golang: Capitalize fields in OptArgs* structs.
Otherwise those fields aren't accessible outside the package.  We
didn't catch this because all tests run in the same package.
2013-07-04 13:49:01 +01:00
Richard W.M. Jones
a31926bd75 golang: If 'go run' command fails, log the error message in config.log. 2013-07-04 13:12:00 +01:00
Richard W.M. Jones
8f504539f2 java: Fix typo in comment. 2013-07-04 13:11:45 +01:00
Richard W.M. Jones
4bb3aa7dde Version 1.23.7. 2013-07-03 15:02:57 +01:00
Richard W.M. Jones
b6f01f3260 Add Go (language) bindings. 2013-07-03 15:02:57 +01:00
Richard W.M. Jones
667b303c9a java: Fix comment in test script. 2013-07-01 15:27:22 +01:00
Richard W.M. Jones
cd9f40945d configure: python: RHEL 6 doesn't have sysconfig, use distutils.sysconfig instead.
This works on recent Python as well.
2013-06-28 12:57:07 +01:00
Richard W.M. Jones
7f4048f9d5 Version 1.23.6. 2013-06-26 19:02:16 +01:00
Richard W.M. Jones
fb0bd82dbe daemon: Verify ext2/3/4 filesystem name before passing to mke2fs (RHBZ#978302).
Add a utility function (fstype_is_extfs) to match ext2/3/4 filesystem
names.  This is used in a couple of places.

When passing the mke2fs -t parameter, verify that the request is for
an ext2/3/4 filesystem.  Previously we did not check this, and neither
did mke2fs when the -F flag was also used.
2013-06-26 14:37:26 +01:00
Richard W.M. Jones
dd21bec400 sysprep: New operation to remove RPM database files.
See:
https://lists.fedoraproject.org/pipermail/devel/2013-June/184389.html
2013-06-24 21:06:58 +01:00
Richard W.M. Jones
a7aa47f4de virt-resize: Add notes about Windows and disk consistency (RHBZ#975753).
Also group the Windows-related notes together.
2013-06-20 09:13:41 +01:00
Richard W.M. Jones
b730bc0c46 virt-resize: Take into account large start offset of the first partition when calculating overhead (RHBZ#974904).
Since we don't usually move the first partition, if the first
partition has an unusually large offset from the start of the disk,
then the unpartitioned space in front of that partition counts as
partitioning overhead.  However the previous surplus calculation was
not taking that into account.

This was a problem for certain Ubuntu images which are partitioned
with an 8 MB gap before the first partition.

Thanks: David Hart.
2013-06-19 19:03:21 +01:00
Richard W.M. Jones
07f3e5ae5c virt-resize: Add some more debugging messages.
These are only printed when using the --debug flag and are
helpful for diagnosing problems.
2013-06-19 19:02:48 +01:00
Richard W.M. Jones
7949fd3949 virt-resize: Fix minor typo in error message. 2013-06-19 19:02:15 +01:00
Richard W.M. Jones
d8a3185823 tests: Add a regression test for iface launch hangs (RHBZ#975797). 2013-06-19 16:21:32 +01:00
Richard W.M. Jones
f7fe7e8db0 launch: direct: Calculate appliance root correctly when iface drives are added (RHBZ#975797).
This also changes guestfs___appliance_command_line to allow
appliance_dev parameter to be NULL.  Previously a bogus root=
parameter could be passed.
2013-06-19 16:21:31 +01:00
Richard W.M. Jones
e7f83f2ecc tests/regressions: Remove duplicate test skip code. 2013-06-19 13:21:10 +01:00
Richard W.M. Jones
cf0dcb6a0b Version 1.23.5. 2013-06-18 19:36:27 +01:00
Richard W.M. Jones
d88f6c0ba6 tests: inspection: Add example and test XML to EXTRA_DIST.
This fixes commit a86cb71fca.
2013-06-18 19:32:03 +01:00
Richard W.M. Jones
0ff0454c59 tests: inspection: Don't complain because NTFS UUID changes between test runs.
This fixes commit a86cb71fca.
2013-06-18 18:01:04 +01:00
Richard W.M. Jones
a86cb71fca inspector: Add a real test of inspection.
Verify that the output from inspection doesn't change, in order to
catch regressions such as RHBZ#975412.
2013-06-18 17:12:31 +01:00
Richard W.M. Jones
d7bc1dd922 inspection: Replace phony XML with virt-inspector output from real guests.
Also add an example from a real RHEL 6 guest.

Remove rules for building these XML files which are no longer
relevant.  These files were built by running virt-inspector on real
guests, and then edited to remove excessive <application> sections.
2013-06-18 17:01:53 +01:00
Richard W.M. Jones
2343840936 inspection: Fix hostname inspection because of faulty Augeas path expression (RHBZ#975412). 2013-06-18 15:34:01 +01:00
Richard W.M. Jones
2c4e7ad135 Augeas >= 1.0.0 is now required. 2013-06-18 15:34:01 +01:00
Richard W.M. Jones
2ee4d5e059 utils: Add utility functions guestfs___concat_strings and guestfs__join_strings.
These concatenate strings or join them with a separator in between.
2013-06-18 15:34:01 +01:00
Richard W.M. Jones
3a5b0f1787 Version 1.23.4. 2013-06-14 13:20:26 +01:00
Richard W.M. Jones
7f228489d0 inspection: Fix inspection of Fedora guests (RHBZ#974489).
Commit e71b2c11f5 broke inspection of
Fedora guests because guestfs_is_file returns false for
/etc/redhat-release (it's a symlink to a file, not a file).

We fix this by using the new followsymlinks flag added in the
previous commit.  Thus guestfs_is_file becomes
guestfs_is_file_opts (g, filename, GUESTFS_IS_FILE_OPTS_FOLLOWSYMLINKS, 1, -1)
which checks if it's a file or a symlink to a file.

This fixes commit e71b2c11f5.
2013-06-14 11:03:24 +01:00
Richard W.M. Jones
ef107448e8 Add followsymlinks flag to is-file, is-dir, is-blockdev, is-chardev, is-fifo and is-socket APIs.
This adds an extra optional boolean 'followsymlinks' flag to those 6
is-* APIs.  If the flag is true, then symlinks are followed, ie. we
use stat instead of lstat in the test.

For the rationale behind this change, see:
https://bugzilla.redhat.com/show_bug.cgi?id=974489
2013-06-14 10:53:17 +01:00
Richard W.M. Jones
3cf442872b FAQ: Developer questions about committing and forking. 2013-06-11 13:09:09 +01:00
Richard W.M. Jones
372217c375 FAQ: Emphasize that we don't accept github pull requests. 2013-06-11 13:08:49 +01:00
Richard W.M. Jones
d2c05c96ca FAQ: Put B<> bold section around "Note"s in the text. 2013-06-11 12:56:47 +01:00
Richard W.M. Jones
0e652c11be FAQ: RHEL 6.5 will fix the buildnet problem. 2013-06-11 12:55:46 +01:00
Richard W.M. Jones
32fe7fd853 FAQ: Indent Ubuntu releases in list. 2013-06-11 12:54:29 +01:00
Richard W.M. Jones
3b109ff207 FAQ: RHEL 7 is based on libguestfs 1.22. 2013-06-11 12:53:25 +01:00
Richard W.M. Jones
58519bbe9c FAQ: Add link to RHEL 6.5 preview repository. 2013-06-11 12:53:08 +01:00
Richard W.M. Jones
b30647cd23 Version 1.23.3. 2013-06-10 19:33:53 +01:00
Richard W.M. Jones
ef4969c2ce build: Fix 'make distclean' (again).
So it doesn't break after the generator has been deleted by
a previous distclean rule.
2013-06-10 18:09:43 +01:00
Richard W.M. Jones
546b3f3fce txz-out: Fix this API to produce xz files again (RHBZ#972775).
Commit 864ef706a8 (in Aug 2012) broke
the deprecated txz-out API.  Because of a thinko during this commit,
instead of producing xz files it produces bzip2 files.

Fix this API again.

Thanks: Bo Fan / Red Hat QA team.
2013-06-10 16:08:05 +01:00
Matthew Booth
21f427801c inspect: Fix bogus warning for partitions without /boot.ini
Fix a bogus warning introduced by
5abb196de8. If a non-windows partition
hasn't been detected as something else and falls through to windows
detection, inspection would display a bogus warning about missing
/boot.ini.

RWMJ: Test if guestfs_is_file > 0, in case it returns an error.
2013-06-07 12:20:35 +01:00
Richard W.M. Jones
9585077202 inspection: Reformat is_systemroot declaration.
Just code motion.
2013-06-05 17:29:43 +01:00
Matthew Booth
5abb196de8 inspect: Partial support for non-standard windows system root
Support arbitrary windows system root for pre-vista systems where
boot.ini is on the same partition as the system root.
2013-06-05 17:24:10 +01:00
Matthew Booth
83b7d0a66e inspect: Add internal match6 function 2013-06-05 17:24:10 +01:00
Matthew Booth
f1385192ad inspection: Refactor windows systemroot detection to allow re-use
This change refactors guestfs___has_windows_systemroot to
guestfs___get_windows_systemroot. The new function returns a
dynamically allocated char * which must be freed.

The new function is no less efficient than before, as it returns the
result of guestfs___case_sensitive_path_silently, which is required
anyway. The new code is slightly more efficient than before, as it
re-uses the result of this testing in guestfs___check_windows_root
rather than running it again.
2013-06-05 17:24:09 +01:00
Olaf Hering
5add9cbe78 Set DISTRO to SUSE if /etc/SuSE-release exists
Signed-off-by: Olaf Hering <olaf@aepfle.de>
2013-06-04 15:43:46 +01:00
Richard W.M. Jones
012a4a5eb5 ocaml: Build dependencies for tests too. 2013-06-04 12:41:11 +01:00
Richard W.M. Jones
49bdaabc7d build: Add common-rules.mk, common rules for all Makefiles.
This file is mainly a central place to:

 - include localenv if it exists, and

 - define the RHEL 5 backwards compatibility macros, instead of
   spreading them over every other file.
2013-06-04 12:41:11 +01:00
Richard W.M. Jones
76321709d6 build: Don't include subdir-rules.mk in top level Makefile.am.
Also there are no generated files at the top level, so no need to
mention $(generator_built) in this file.
2013-06-04 12:41:11 +01:00
Richard W.M. Jones
94dbcb107f Quote ./configure --help output (options) properly. 2013-06-04 12:41:11 +01:00
Richard W.M. Jones
44b453d6fb build: Simplify and speed up expression that generates po/POTFILES.
This has to run on every build, so:

- Use two grep commands instead of lots.

- Remove unnecessary use of sed.

- Remove some obsolete directories that haven't existed for a long time.
2013-06-04 12:41:11 +01:00
Richard W.M. Jones
074e3b5c67 generator: Don't always recurse into the generator directory.
Previously, every subdirectory that contained generated files would
cause a recursion into the ../generator directory.  This was slow and
unnecessary.  Only recurse if the generator actually needs to be
rerun.

Note this changes the semantics slightly: For example if you added a
new action and just ran `make -C ocaml' then previously the generator
would be rerun, but now it would not.  However I'm not convinced the
previous semantics were that useful, particularly considering that
with this change a simple `make' is much faster.
2013-06-04 12:41:11 +01:00
Richard W.M. Jones
edf9d3c7f0 ocamldoc: Depend directly on guestfs.mli, guestfs.ml files, not wildcards. 2013-06-04 12:41:11 +01:00
Hilko Bengen
b7cd34eb77 python: Build extension with PEP-3149 compliant suffix if defined. 2013-06-04 00:31:57 +02:00
Hilko Bengen
7912e2936b perl: Use symlink hack from hivex 2013-06-04 00:21:39 +02:00
Hilko Bengen
cdc4413dac Revert "perl: Fix build and test to work with separated builds."
This reverts commit 4ea016dae9.
2013-06-04 00:21:39 +02:00
Richard W.M. Jones
222a7b56f3 Version 1.23.2. 2013-06-03 13:25:47 +01:00
Richard W.M. Jones
731d0e1bf6 docs: Updated release versions which fix CVE-2013-2124. 2013-06-03 11:50:11 +01:00
Richard W.M. Jones
c2dcd10964 inspection: Add a fuzz-test of inspection. 2013-06-03 08:59:11 +01:00
Richard W.M. Jones
e8af0982da perl: Add rules + environment variables so Perl code can be valgrinded. 2013-06-02 18:55:53 +01:00
Richard W.M. Jones
e71b2c11f5 inspection: Use guestfs_is_{dir,file} in preference to guestfs_exists.
Where possible, using this is more accurate, and it helps when
trying to do fuzz testing.
2013-06-02 18:55:53 +01:00
Richard W.M. Jones
b4d8757dad events: Avoid event handler limit if program allocates and deallocates handlers. 2013-06-02 18:55:53 +01:00
Richard W.M. Jones
2019d0e9c7 New API: remount: Allow rw flag to be adjusted on mounted filesystem. 2013-06-02 18:55:53 +01:00
Richard W.M. Jones
697b0f89fe proto: Fix for rare FileIn hangs. (RHBZ#969845).
Yet another protocol bug!

If the daemon cancels, then the library should send a cancellation
chunk.  It normally does this during the loop where it is uploading a
file.  However due to an oversight or possibly a regression when we
modularized the socket code, the library did not send a cancellation
chunk if the daemon cancelled just before the end of file was sent.

This commit fixes this.
2013-06-02 18:55:53 +01:00
Richard W.M. Jones
1c9dfd079a inspection: Correct fix for segfault if /etc/SuSE-release is an empty file.
The test was the wrong way round.

See: CVE-2013-2124.

This fixes commit ae8bb84ecd.
2013-06-01 14:12:46 +01:00
Richard W.M. Jones
823628d41f lib: Don't call directly from one guestfs__* function to another.
The public-facing functions like 'guestfs_*' are implemented as
wrappers around implementation functions like 'guestfs__*' (for
library-side functions only).

Don't call from one 'guestfs__*' function to another.  It prevents
ENTER events from being caught, especially where a deprecated function
calls another implementation.

Most code was not doing this, but there were still some places left
where it was done.
2013-05-31 12:17:49 +01:00
Richard W.M. Jones
e86459e501 events: Use bool for flag. 2013-05-31 11:29:15 +01:00
Richard W.M. Jones
75cf879613 events: Refactor code to make the common path clear. 2013-05-31 11:28:54 +01:00
Richard W.M. Jones
ae8bb84ecd inspection: Don't segfault if /etc/SuSE-release is an empty file.
Related to CVE-2013-2124.

Thanks: Olaf Hering.
2013-05-31 08:37:44 +01:00
Richard W.M. Jones
36d6df671e tests/http: Add a test of HTTP protocol.
Disabled for various reasons.  See comment in Makefile.am.
2013-05-30 16:08:24 +01:00
Richard W.M. Jones
b3e5ed69b5 release notes: Recompile so that long URLs aren't broken in text output. 2013-05-30 11:48:05 +01:00
Richard W.M. Jones
aab882a3a6 podwrapper: Set Text::Wrap::huge property to "overflow".
This stops long URLs from being broken in the text output mode.

See:
https://www.redhat.com/archives/libguestfs/2013-May/thread.html#00088
2013-05-30 11:47:26 +01:00
Richard W.M. Jones
b0bd0bba93 security: Centralize CVE information in one place (in guestfs(3)). 2013-05-29 19:22:31 +01:00
Richard W.M. Jones
ee9f1abe7f security: Add documentation for CVE-2013-2124. 2013-05-29 19:15:35 +01:00
Richard W.M. Jones
1766ff1177 appliance: Add sensible disk optimizations.
The timeout lets us read remote images without timing out.

The noop scheduler lets the host do scheduling.  This generally makes
sense for mixed workloads because the host has a global view of the
system, and often has more compute power too.
2013-05-29 16:25:39 +01:00
Richard W.M. Jones
da764805ba appliance: Remove dead code which (if not dead) would have set disk scheduler to noop. 2013-05-29 16:25:39 +01:00
Richard W.M. Jones
52eb691e0b appliance: Don't set 'rotational' on virtio-blk devices.
virtio-blk is obsolete so we don't need to bother optimizing it.
People should use virtio-scsi instead.

Also virtio-blk should choose the optimal settings itself.

This was originally added to fix this bug:
https://bugzilla.redhat.com/show_bug.cgi?id=509383
2013-05-29 16:25:39 +01:00
Richard W.M. Jones
9df4e51f65 generator: Set builddir for old RHEL 5 which didn't have this. 2013-05-29 16:25:39 +01:00
Richard W.M. Jones
1d08ea938f generator: Set abs_srcdir for old RHEL 5 which didn't have this. 2013-05-29 16:25:38 +01:00
Richard W.M. Jones
06291ce0dd generator: Set abs_builddir for old RHEL 5 which didn't have this. 2013-05-29 14:37:08 +01:00
Richard W.M. Jones
809a7012de tests: Add 'make check-release' rule.
This is a subset of tests which will be required to pass before a
tarball can be released by the maintainer.
2013-05-28 21:38:23 +01:00
Richard W.M. Jones
0a60332e1b tests: Add new 'make check-all' rule.
This runs all of the check* rules.  Since this includes 'make check',
'make check-all' is not quite equivalent to the old 'make extra-tests'
which was removed in the previous commit.
2013-05-28 21:33:56 +01:00
Richard W.M. Jones
ffde7b4d71 tests: Remove 'make extra-tests' rule. 2013-05-28 21:33:26 +01:00
Richard W.M. Jones
57e83615f0 Version 1.23.1. 2013-05-28 17:22:58 +01:00
Richard W.M. Jones
fa6a76050d inspection: Fix double-free when certain guest files are empty.
The following commit:

  commit 5a3da36626
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Thu Jan 24 17:07:38 2013 +0000

      inspect: Use CLEANUP_* macros in inspection code.

can cause a double-free along an error path when certain guest files
are empty where we expected those files to contain at least one line.

This causes virt-inspector to crash when run on these guests.

The following is a test case which demonstrates the crash.
`f20rawhidex64' is a Fedora guest, but with small adjustments to the
test you could use any Linux guest for this test.

  $ qemu-img create -f qcow2 -b f20rawhidex64 /tmp/test.qcow2
  Formatting '/tmp/test.qcow2', fmt=qcow2 size=21474836480 backing_file='f20rawhidex64' encryption=off cluster_size=65536 lazy_refcounts=off
  $ guestfish -i -a /tmp/test.qcow2 -- rm /etc/redhat-release : touch /etc/redhat-release
  $ virt-inspector /tmp/test.qcow2
  *** glibc detected *** virt-inspector: double free or corruption (fasttop): 0x00007f18bc9925a0 ***
  ======= Backtrace: =========
  /lib64/libc.so.6(+0x34ecc7ca8e)[0x7f18b8e64a8e]
  /lib64/libguestfs.so.0(+0x3f91898078)[0x7f18ba13c078]
  /lib64/libguestfs.so.0(+0x3f91899761)[0x7f18ba13d761]
  /lib64/libguestfs.so.0(+0x3f91896d12)[0x7f18ba13ad12]
  /lib64/libguestfs.so.0(+0x3f91894140)[0x7f18ba138140]
  /lib64/libguestfs.so.0(guestfs_inspect_os+0x35)[0x7f18ba0bcc35]
  virt-inspector(main+0x547)[0x7f18ba7c57d7]
  /lib64/libc.so.6(__libc_start_main+0xf5)[0x7f18b8e09a05]
  virt-inspector(+0x6665)[0x7f18ba7c7665]

This is a denial of service, but not likely to be exploitable.

(Found by Coverity)
2013-05-28 16:20:09 +01:00
Richard W.M. Jones
1e7f2b29c4 rbd: Fix overallocation because of incorrect 'sizeof'.
(Found by Coverity)
2013-05-28 16:04:06 +01:00
Richard W.M. Jones
9854d1f08d conn-socket: Don't leak 'conn' on error paths.
(Found by Coverity)
2013-05-28 16:02:24 +01:00
Richard W.M. Jones
0e756842f6 erlang: Don't leak (some) strings along error paths.
This fixes several string leaks along error paths which
were found by Coverity.

However this is not a complete fix.
2013-05-28 15:59:54 +01:00
Richard W.M. Jones
e52a6b56f4 fish: Check for out of memory failure.
(Found by Coverity)
2013-05-28 15:48:42 +01:00
Richard W.M. Jones
a9a191d20e inspection: Test for failure from match1 function.
(Found by Coverity)
2013-05-28 15:48:23 +01:00
Richard W.M. Jones
49cb55146f drives: Don't call `close (-1)'.
(Found by Coverity)
2013-05-28 15:41:32 +01:00
Richard W.M. Jones
c7531fea6e guestfs-testing: Add tests for various new features added since 1.14.
In particular, test remote access using guestfish if they
have libguestfs >= 1.22.

Also add some diagnosis tips.
2013-05-28 14:49:17 +01:00
Richard W.M. Jones
ada943b949 syntax-check: HAVE_DECL_* macros are always defined.
These macros are always defined to 0|1.  We don't need to
check if they are defined.
2013-05-24 14:20:51 +01:00
Richard W.M. Jones
2ed3a383b4 syntax-check: Remove trailing whitespace. 2013-05-24 14:20:51 +01:00
Richard W.M. Jones
a787d2565f syntax-check: Use newline before EOF in these text files. 2013-05-24 14:20:51 +01:00
Richard W.M. Jones
5c80f22b64 syntax-check: Remove unused ``#includes''. 2013-05-24 14:20:51 +01:00
Richard W.M. Jones
014bc5f398 syntax-check: Use exit (EXIT_*) macros instead of hard-coded 0|1.
These are defined in <stdlib.h> which the test program already includes.
2013-05-24 14:20:51 +01:00
Richard W.M. Jones
77d08060b4 syntax-check: Ignore more syntax-check problems.
For some reason maint.mk doesn't process all of these regexps,
or perhaps the regexps are not well-formed.
2013-05-24 14:20:45 +01:00
Richard W.M. Jones
2bc1d522db Ignore various intermediate files left around by 'make syntax-check'. 2013-05-24 14:20:45 +01:00
Richard W.M. Jones
42e268a2b4 make help: Suggest using -j1 -k options with make syntax-check.
This lets you see all the output, not interleaved.
2013-05-24 14:20:45 +01:00
Richard W.M. Jones
afd6512536 Version 1.23.0. 2013-05-23 12:49:09 +01:00
Richard W.M. Jones
fca2dc9d0d Version 1.22.0. 2013-05-23 12:28:27 +01:00
Richard W.M. Jones
9d1c95281e build: Set 'stable' or 'development' in commit tag automatically.
This sets two macros: BRANCH_NUMBER and BRANCH_TYPE.
2013-05-23 12:28:26 +01:00
Richard W.M. Jones
455c277f96 release notes: Get ready for 1.22 release. 2013-05-23 11:51:46 +01:00
Richard W.M. Jones
3147500f15 tests/mountable/test-internal-parse-mountable.c: Hoist variable decls to top. 2013-05-22 14:20:53 +01:00
Richard W.M. Jones
553ffd7a94 tests/mountable/test-internal-parse-mountable.c: Don't fully allocate 1GB disk.
This test required 1 GB of free space since it used posix_fallocate
instead of creating a sparse disk.  Use truncate instead.
2013-05-22 14:19:57 +01:00
Hilko Bengen
72afcf450a Fix for changed selinux mountpoint
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=707217
2013-05-21 19:23:14 +01:00
Richard W.M. Jones
6e20440fb1 Version 1.21.40. 2013-05-21 18:28:48 +01:00
Richard W.M. Jones
fb5cc99f9e release notes: Don't document new internal APIs. 2013-05-21 18:28:48 +01:00
Richard W.M. Jones
4db269cfe6 appliance: Use 'rm -f' on files which might have been moved so might not exist.
This partially reverts commit fae4a2cfb9.
2013-05-21 18:28:48 +01:00
Richard W.M. Jones
cfa0ec55ce Update gnulib to latest version. 2013-05-21 17:14:32 +01:00
Richard W.M. Jones
a53d6a40a7 docs: Add notes about how various check-* targets are implemented. 2013-05-21 17:11:23 +01:00
Richard W.M. Jones
930c3bc91d Update translations from Transifex. 2013-05-21 14:17:54 +01:00
Richard W.M. Jones
aa7f953a2e Update ROADMAP for 1.24.
That will be the next stable release after 1.22.
2013-05-21 14:12:49 +01:00
Richard W.M. Jones
69f73cd8f5 release notes: Update list of bugs. 2013-05-21 14:11:23 +01:00
Richard W.M. Jones
5a69428f5e sysprep: Be prepared for CentOS etc. 7 which will act the same way as RHEL 7. 2013-05-21 13:59:54 +01:00
Richard W.M. Jones
d2abdddf61 sysprep: Update /etc/machine-info on Fedora 18+, RHEL 7+ (RHBZ#890027). 2013-05-21 13:59:54 +01:00
Richard W.M. Jones
0daa83cc91 sysprep: Refactor code, introducing a function to replace a line in a file. 2013-05-21 13:59:54 +01:00
Richard W.M. Jones
3f0b54395c Update API support. 2013-05-21 13:26:49 +01:00
Richard W.M. Jones
87ba073dd5 guestfs-recipes: Two more recipes from my blog. 2013-05-20 22:20:44 +01:00
Richard W.M. Jones
c74f7f15cb examples: If user does 'mount-local --help' don't create a disk image called '--help'. 2013-05-20 21:46:49 +01:00
Richard W.M. Jones
49979931f6 fuse: Reimplement umount-local using guestunmount.
Instead of repeating the same code calling fusermount -u, retrying, etc.
2013-05-20 21:42:52 +01:00
Richard W.M. Jones
e37de54929 gluster: Normal port number (assuming 1 brick) is 24007. 2013-05-20 15:43:49 +01:00
Richard W.M. Jones
0ff8b315f5 gluster: Note that client needs to run as root. 2013-05-20 15:42:56 +01:00
Richard W.M. Jones
dcff65722f gluster: Force exportname to begin with a '/' character. 2013-05-20 15:27:57 +01:00
Richard W.M. Jones
f3bbd1f4dd gluster: Don't force gluster port number to be specified.
Gluster can choose its own port number.
2013-05-20 15:27:36 +01:00
Richard W.M. Jones
40691b7167 launch: libvirt: Allow port to be optional.
Actually if you don't specify the port, currently libvirt gives
an error:

  libguestfs: error: could not create appliance through libvirt: XML
  error: missing port for host [code=27 domain=20]

However I think that is a bug in libvirt:

  https://bugzilla.redhat.com/show_bug.cgi?id=965142
2013-05-20 15:13:09 +01:00
Richard W.M. Jones
fae4a2cfb9 appliance: Don't use 'rm -f' on files which ought to exist. 2013-05-20 09:00:16 +01:00
Hilko Bengen
40a0e08619 fish/test-events.sh: ignore "trace get_path" line
The test would fail when LIBGUESTFS_PATH was not set.
2013-05-19 21:55:29 +02:00
Hilko Bengen
b862d95c47 ./run: Turn error message about missing LIBGUESTFS_PATH into warning; output to STDERR
The previous behavior caused the build to abort when trying to build
the sysprep documentation -- without much of a hint of what went
wrong.
2013-05-19 21:55:26 +02:00
Richard W.M. Jones
95ed4949f2 README: Clarify that building from git needs './autogen.sh'. 2013-05-19 16:40:19 +01:00
Richard W.M. Jones
2147d9d6cd daemon: Don't install man page for guestfsd(8) if --disable-install-daemon. 2013-05-18 07:43:43 +01:00
Richard W.M. Jones
f9eee0ad8d php: Work around buggy PHP returning array as long.
Because OStringList is an optarg, we must specify "a!"  to
zend_parse_parameters.

However zend_parse_parameters still returns this as a *long* rather
than a NULL (or empty array) so positively check that it has returned
an array.
2013-05-17 11:54:07 +01:00
Richard W.M. Jones
6d87aaefa0 php: Fix comment in run-php-tests.sh.
This updates commit cd40cf7139.
2013-05-17 11:53:45 +01:00
Richard W.M. Jones
2d58c42ab8 Update release notes. 2013-05-17 11:13:07 +01:00
Matthew Booth
f7c312ba6b Fix compiler warning when libselinux is not present
static function selinux_warning() isn't used if HAVE_LIBSELINUX isn't
defined, which results in a warning.
2013-05-17 10:27:57 +01:00
Hilko Bengen
e5f0dfb6e3 Use pkg-config for Python
At least libpython2.7-dev and libpython3.3-dev on current
Debian/unstable ship with pkg-config files. As with the pkg-config
check for Lua, we check for versioned and an unversioned .pc files.
2013-05-17 08:51:38 +01:00
Richard W.M. Jones
7865f82537 appliance: Run lvmetad if it exists.
This daemon is used by newer LVM to interface with udev events.
2013-05-16 11:11:39 +01:00
Richard W.M. Jones
ef199cf66e Version 1.21.39. 2013-05-15 13:00:09 +01:00
Richard W.M. Jones
e70927a5e5 drives: Fix rules for quoting files that contain ':'.
The test was backwards.

This fixes commit a95214b198.
2013-05-13 15:51:54 +01:00
Richard W.M. Jones
11774eeb80 faq: Update documentation for Debian Squeeze (thanks Hilko Bengen). 2013-05-13 10:08:15 +01:00
Richard W.M. Jones
dee7ab1b79 http: Fix typo in documentation.
This fixes commit 83f74f5c56.
2013-05-11 20:14:26 +01:00
Richard W.M. Jones
83f74f5c56 Add support for qemu's curl driver (ie. FTP, FTPS, HTTP, HTTPS, TFTP). 2013-05-11 18:49:15 +01:00
Richard W.M. Jones
e3c2397165 iscsi: Document that one server must be passed, and that username may be passed.
This fixes commit 8b271101a1.
2013-05-11 18:09:30 +01:00
Richard W.M. Jones
be05a036e2 drives: Fix typo in error message.
This fixes commit 0a065c4574.
2013-05-11 18:04:25 +01:00
Richard W.M. Jones
af0f2cc9e5 Version 1.21.38. 2013-05-11 15:54:09 +01:00
Richard W.M. Jones
0a1111391b build: Add 'make maintainer-tag' rule for tagging HEAD with current version. 2013-05-11 15:54:09 +01:00
Richard W.M. Jones
ec3d3a809a tests/regressions: Remove bogus comment in test.
This updates commits a95214b198.
2013-05-11 15:51:12 +01:00
Richard W.M. Jones
a95214b198 drives: Remove check for ':' in filename (RHBZ#811649).
Modern qemu can now handle this properly.  ':' is only special if what
precedes it looks like a transport, so:

  qemu-system-x86_64 -drive foo:bar     .. fails
  qemu-system-x86_64 -drive ./foo:bar   .. works

Thus by adding ./ in front of relative paths that contain ':' we can
work around this.

In addition, this broke iscsi:// URIs because iSCSI target names
routinely contain ':' characters.
2013-05-11 13:47:27 +01:00
Richard W.M. Jones
0a065c4574 drives: ceph/gluster/iscsi/sheepdog/ssh: Force the disk name to begin with a '/'.
This avoids confusion when using URIs in guestfish, since the path
will always start with a '/', and we don't otherwise know if we should
remove it or not.  By forcing the '/' to always be there, we deal with
this problem in the API instead.
2013-05-11 13:33:36 +01:00
Richard W.M. Jones
914d3e68ec drives: Use libxml2 to construct safely quoted URIs for qemu. 2013-05-11 13:23:48 +01:00
Richard W.M. Jones
8b271101a1 Add support for iSCSI. 2013-05-10 22:24:24 +01:00
Richard W.M. Jones
7a9ebd757c src/inspect-fs.c: Don't segfault if internal_parse_mountable returns NULL (RHBZ#961812). 2013-05-10 14:23:08 +01:00
Richard W.M. Jones
6a1c76807e ./run: Don't set LIBGUESTFS_PATH if --disable-appliance.
Thanks Dave Vasilevsky for spotting this problem.
2013-05-09 18:52:01 +01:00
Richard W.M. Jones
55eae0af3b recipes: Add link to script for converting Windows DVD to bootable USB key. 2013-05-09 15:35:46 +01:00
Richard W.M. Jones
d661456225 New API: cp-r
This runs 'cp -rP' and is useful for copying when the target
doesn't support file owners or permissions (ie. FAT).
2013-05-09 15:35:08 +01:00
Richard W.M. Jones
e7e8a1bfef Version 1.21.37. 2013-05-09 10:22:44 +01:00
Richard W.M. Jones
3287f177e0 fish/options.c: Whitespace changes. 2013-05-09 08:52:40 +01:00
Dave Vasilevsky
a820e9e3bd fuse: Document the fstype parameter 2013-05-09 08:42:55 +01:00
Dave Vasilevsky
f83df69bec fuse: Allow specifying the fstype of a mount 2013-05-09 08:42:55 +01:00
Richard W.M. Jones
bec7888be3 rbd: Miscellaneous stylistic changes, no functional change. 2013-05-08 11:50:31 +01:00
Richard W.M. Jones
51f7c6bb82 Use size_t for loop iterators. 2013-05-08 11:50:09 +01:00
Richard W.M. Jones
97274c7f75 src/libvirt-domain.c: Cast constant strings to avoid warning about signedness. 2013-05-08 11:46:20 +01:00
Richard W.M. Jones
afc870dd76 src/drives.c: 'auth' string is const.
This fixes commit f3e01b69e0.
2013-05-08 11:45:27 +01:00
Mike Kelly
3e76844bc1 rbd: Support using a custom secret 2013-05-08 11:18:03 +01:00
Mike Kelly
75c203facb libvirt: extract usernames for network disks 2013-05-08 11:18:03 +01:00
Mike Kelly
f3e01b69e0 rbd: support usernames, for cephx authentication 2013-05-08 11:18:03 +01:00
Mike Kelly
1806828885 libvirt: initial support for networked disks 2013-05-08 11:18:03 +01:00
Mike Kelly
2ce06ec808 rbd: send mon_host for rbd drives
This is how the servers are passed to kvm.
2013-05-08 11:18:03 +01:00
Hilko Bengen
13fba490cd Fix rpcgen call for separated builds. 2013-05-02 22:47:59 +02:00
Hilko Bengen
66145799cb perl: Fix install target for separated builds. 2013-05-02 22:47:59 +02:00
Richard W.M. Jones
34b106c391 Version 1.21.36. 2013-05-02 14:28:00 +01:00
Richard W.M. Jones
333337b6a9 debian: Add OCaml .depend files to DISTCLEANFILES.
Otherwise debuild complains that these files have been created after
it does a 'make distclean'.
2013-05-02 13:18:12 +01:00
Richard W.M. Jones
5faba45fe1 tests/c-api: Various code refactorings.
- Don't use fixed names for the disks.  This will allow us to
  parallelize this test.

- Add a new "GETKEY:<key>" String parameter which can retrieve keys
  from the handle.  The temporary disk names are stored as keys.

- Don't test the close callback.  However this uses the close callback
  mechanism to delete the temporary disks, and in any case close
  callbacks are well tested by the language binding tests.

- The generated code now produces a static array of tests (instead of
  a 'perform_tests' function), making it possible to parallelize.
2013-05-01 11:13:31 +01:00
Richard W.M. Jones
f003c50c52 tests/c-api: Remove global guestfs handle.
This will allow us to parallelize these tests.
2013-05-01 09:34:39 +01:00
Richard W.M. Jones
76950a0e8d tests/c-api: Warn about deprecated functions in main program.
And replace deprecated guestfs_set_close_callback with
non-deprecated guestfs_set_event_callback.
2013-05-01 09:33:51 +01:00
Richard W.M. Jones
9d5236d73c tests/c-api: Factor out common init_* into separate functions. 2013-05-01 09:09:55 +01:00
Richard W.M. Jones
02fbf566e8 java: Standardize Java test numbering. 2013-05-01 08:38:40 +01:00
Mike Kelly
ad1e9e7eac ssh: fix setting the username part
Right now, we'd always be setting a NULL username.
2013-04-30 22:32:43 +01:00
Richard W.M. Jones
3c43019f8d ruby: Standardize test names and numbering. 2013-04-30 17:47:11 +01:00
Richard W.M. Jones
a24639d7d3 python: Standardize test numbering. 2013-04-30 17:34:22 +01:00
Richard W.M. Jones
897a69604d perl: Make the 030-create-flags test same as canonical OCaml version. 2013-04-30 15:42:31 +01:00
Richard W.M. Jones
dc3b783b51 ocaml: Set close-on-exit flag to true in this test so handle is cleaned up.
Otherwise the valgrind test fails since the handle resources
are leaked.
2013-04-30 15:41:08 +01:00
Richard W.M. Jones
a2a6cfba56 Version 1.21.35. 2013-04-30 15:08:58 +01:00
Richard W.M. Jones
1623f540b1 erlang: Make separated builds work correctly.
Set ERL_LIBS and also create a phony 'ebin' directory for the
guestfs.beam (library) so that the tests run against the local copy
not the installed version, and so that separated builds work.
2013-04-30 13:54:15 +01:00
Richard W.M. Jones
327403f3ac erlang: Add a CLEANFILES rule. 2013-04-30 13:54:15 +01:00
Richard W.M. Jones
d9f5829ebe python: Fix for separated builds.
Ensure that ./run sets PYTHONPATH to include the Python source
directory (location of guestfs.py).
2013-04-30 13:54:14 +01:00
Richard W.M. Jones
4ea016dae9 perl: Fix build and test to work with separated builds.
This is inspired largely by Hilko Bengen's equivalent
hivex patch here:

887466794a
2013-04-30 13:54:14 +01:00
Richard W.M. Jones
440183b440 perl: run-bindtests: Don't set PERL5LIB.
This environment variable should already be set properly
by 'run', there is no need to set it from this test script.
2013-04-30 12:52:44 +01:00
Richard W.M. Jones
21dd1c50c9 ./run: Set s= (srcdir). Use absolute paths. 2013-04-30 12:50:25 +01:00
Richard W.M. Jones
93e64b4448 tests/mountable: Fix incorrect use of inspect-os API (RHBZ#957380). 2013-04-29 19:25:14 +01:00
Mike Kelly
4e5ed8ff7b Make a 1G test image instead, avoiding a size bug
mkfs_btrfs: /dev/vda2: device /dev/vda2 is too small (must be at least
256 MB) at .../libguestfs/tests/guests/guest-aux/make-fedora-img.pl line
140.
2013-04-29 18:00:49 +01:00
Mike Kelly
0da34f968c Refactor image partition sizing 2013-04-29 18:00:49 +01:00
Richard W.M. Jones
852beefc4c Version 1.21.34. 2013-04-29 16:41:06 +01:00
Richard W.M. Jones
d02af3a311 perl: Almost standardize the Perl tests.
This needs more work, but brings them mostly up to the same
standard form as the OCaml tests and the test documentation.
2013-04-29 16:10:49 +01:00
Richard W.M. Jones
f82a9dbf0f ocaml: Standardize the test sequence for all bindings; implement this for OCaml.
The idea behind this change is to have a consistent set of
tests across all bindings, while at the same time saving time.
For background see:

https://www.redhat.com/archives/libguestfs/2013-April/thread.html#00069
2013-04-29 15:57:25 +01:00
Richard W.M. Jones
cc93840d31 tests: Add a regression test for RHBZ#957772. 2013-04-29 15:28:13 +01:00
Richard W.M. Jones
c5f356a603 daemon: Properly quote arguments for tar-out, base64-out commands (RHBZ#957772).
This fixes commit c78ec7e085
which was an attempt to fix RHBZ#908322.
2013-04-29 15:27:21 +01:00
Richard W.M. Jones
79688aff74 ./run: ruby: Set $RAKE and fix Ruby tests.
This wasn't set which caused Ruby tests to silently not run
without any indication.
2013-04-25 20:10:37 +01:00
Richard W.M. Jones
0d989d52a6 ruby: Fix segfault in regression test.
This was revealed by the regression test for RHBZ#664558.
Unfortunately because Ruby tests had been silently disabled,
this regression test was never run.
2013-04-25 20:10:34 +01:00
Richard W.M. Jones
2ea9d82a23 ruby: Fix optargs test. 2013-04-25 20:10:34 +01:00
Richard W.M. Jones
cd4c2c6caa Version 1.21.33. 2013-04-25 14:59:19 +01:00
Richard W.M. Jones
a30b41f735 tools: The programs are located in the source directory. 2013-04-25 14:21:55 +01:00
Richard W.M. Jones
9e9be1cee7 python: Test programs are located in the source directory. 2013-04-25 14:21:55 +01:00
Richard W.M. Jones
a9c81f1919 fish: Add $srcdir in several places where test files exist in the source directory. 2013-04-25 14:21:55 +01:00
Richard W.M. Jones
7af69445f2 tests/rsync: This test only copies generated files. 2013-04-25 14:21:55 +01:00
Richard W.M. Jones
5057a8f344 tests: Add $srcdir in several places for test files located in source directory. 2013-04-25 14:21:55 +01:00
Richard W.M. Jones
073da79e5b tests/xml: Get XML data file from source directory. 2013-04-25 14:21:55 +01:00
Richard W.M. Jones
423a2d9dde tests/btrfs: Get data files from source directory. 2013-04-25 14:21:55 +01:00
Richard W.M. Jones
59b9ee181b tests/selinux: Pick up run-test.pl script from source directory. 2013-04-25 14:21:55 +01:00
Richard W.M. Jones
86025d33a8 tests/guests: Various fixes for separated builds.
This now correctly builds all the phony guests when
builddir != srcdir.
2013-04-25 14:21:55 +01:00
Richard W.M. Jones
5d6a08e2c8 tests/guests: Don't include fake Windows binary hive files in git.
This means that people compiling from git will be required to have the
'hivexregedit' command (from hivex).
2013-04-25 14:21:51 +01:00
Richard W.M. Jones
c0d1a74023 tests/guests: Ensure hard to generate files are cleaned by 'make distclean'.
This allows us to switch from non-separated to separated builds
without breaking (the user must do 'make distclean' between the
switch).
2013-04-25 12:33:31 +01:00
Richard W.M. Jones
c3bf39a1f9 perl: Fix 'make check' to find bindtests.pl in source directory.
Despite this change, separated builds are still broken, apparently
because ExtUtils::MakeMaker doesn't support this sort of
configuration, or else we're using it wrong.
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
b7da435003 tests/c-api: Allow FileIn paths to be prefixed by "$srcdir".
Since tests involving FileIn will often wish to read from local files,
it makes sense that they would want to open files in $srcdir.

Therefore allow such paths to be prefixed by "$srcdir" which is
substituted at run time by the same named environment variable (set by
automake).

This fixes separated builds in tests/c-api directory.
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
a1e51676fd Remove many uses of $(builddir).
"$(builddir)" is always "."

Therefore most uses of $(builddir) are suspect and should be
removed or replaced with "."
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
c1898ee996 appliance: Fix rule for building supermin.d/init.img.
Use a temporary directory instead of copy hack.
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
b426540b7f tests/data: Add a comment noting a bug in the Makefile.
abssymlink is an intentionally dangling symlink, but this confuses
make which thinks it has to rebuild the rule every time.
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
71ca0f8ece tests/data: Don't prepend build paths with $(builddir).
It's both unnecessary and confuses make.
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
618a4372cf tests/data: Fix initrd when doing separated builds.
Otherwise the initrd contains paths like '../../tests/data/empty'
which obviously causes the tests to fail.
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
0ec2726a52 php: Disallow separated builds.
As it stands, this will just break.  Until it is fixed, give a
diagnostic message.
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
13c0b780a3 gobject: Fix separated builds. 2013-04-25 12:22:31 +01:00
Richard W.M. Jones
a8b26aaab9 haskell: Fix separated builds. 2013-04-25 12:22:31 +01:00
Richard W.M. Jones
aab50b9c50 java: Allow source directory to be prepended by make.
Fix for separated builds.
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
1d252d7149 java: Bindtests.java is generated in the source directory.
Fix for separated builds.
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
5ab516d068 ocaml: bindtests.ml is generated in the source directory.
This seems to be necessary because separated builds don't recognize
the *.ml file as being a source file (unlike, for example, *.c files).
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
fdbe6d81f4 generator: Place generator, stamp-generator, build files into builddir.
Previously the generator binary was (deliberately) placed into the
source directory.  However there was no real reason for this to
happen.  Always put the build products into the builddir.
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
e72855e4fa generator: Make stamp-generator in the Makefile.
Since stamp-generator is a Makefile thing, make it in the Makefile,
not in the generator itself.

Also this ensures stamp-generator is created in the builddir, not in
the source directory (fixing separated builds).
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
88271bab7c configure: Make sure that certain build directories exist.
When builddir != srcdir, this ensures that certain build directories
which might not exist are created by configure.
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
c4255fd0e3 tests/data: Ensure all generated image files are removed by 'make clean'.
Otherwise the build breaks if you switch from a non-separated build to
a separated build.
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
3f450de0a9 Fix 'make distclean'.
Because the generator subdirectory is cleaned first, and other
directories recurse into the generator directory, 'make distclean'
would fail (because generator/Makefile would be deleted by that
point).

Change subdirs-rules.mk so it doesn't fail if generator/Makefile has
been deleted already.
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
88b59ea92f subdirs-rules: Remove 'appliance' rule.
It was used in only one place (perl/Makefile.am).

If users want to build just the appliance, then they could do 'make -C
appliance'.
2013-04-25 12:22:07 +01:00
Richard W.M. Jones
1add24e774 configure: Create resize/ subdirectory if building in a different builddir. 2013-04-24 16:24:09 +01:00
Richard W.M. Jones
6c71ab2208 Version 1.21.32. 2013-04-23 11:07:05 +01:00
Richard W.M. Jones
d99e26d2f3 tests/guests: Add make-guests-all-good.pl to EXTRA_DIST.
This fixes commit 2ae72dcaf8.
2013-04-23 11:06:48 +01:00
Richard W.M. Jones
83659caadb release notes: Fix unterminated C<...> sequence in POD. 2013-04-23 11:06:43 +01:00
Richard W.M. Jones
fecc74e080 tests: sysprep: Specify list of operations explicitly.
This commit makes no functional change on its own, but it allows us to
filter out failing operations on Ubuntu.
2013-04-22 16:18:19 +01:00
Richard W.M. Jones
50003c8cba grub-install: Change test to use /dev/sda instead of /dev/vda.
The previous test for grub-install hard-coded /dev/vda (ie. assuming
virtio-blk instead of more modern virtio-scsi).

This changes the test to hard-code /dev/sda instead.  However this
change is still not correct since /dev/sda will be adjusted by block
device name translation in the call to grub-install, but not what is
written to /boot/grub/device.map.

Since we no longer support grub-install on Fedora, this won't affect
things, but Ubuntu still has a 'grub-install' command (although it's
actually from grub2).
2013-04-22 14:02:05 +01:00
Richard W.M. Jones
2e6e77fd02 gobject: Link libguestfs-gobject library with GIO.
So that we get the g_cancellable_* symbols.
2013-04-19 16:05:48 +01:00
Richard W.M. Jones
1eaf338acd gobject: Link libguestfs-gobject library with GOBJECT_LIBS.
There's no such thing as a _LIBS variable in automake, so
this line was effectively being ignored.
2013-04-19 15:52:54 +01:00
Richard W.M. Jones
6a5495ea3c virt-ls: Use string instead of small array.
This works around the following warning:

virt-ls.c: In function 'show_file':
virt-ls.c:574:1: error: stack protector not protecting function: all local arrays are less than 4 bytes long [-Werror=stack-protector]
2013-04-19 15:37:40 +01:00
Richard W.M. Jones
2da8d49590 examples: Don't ignore return value of chdir.
GCC 4.7.3 whinges about this.
2013-04-19 15:29:50 +01:00
Richard W.M. Jones
2ae72dcaf8 tests: guests: Auto-generated guests-all-good.xml.
Only include guests which we successfully created, so for example if
there's no NTFS support then the Windows guest won't be included.
2013-04-17 20:35:36 +01:00
Richard W.M. Jones
0c605eb94f tests: guests: Display some information about each phony guest for debugging.
This adds debugging output like this:

  fedora-btrfs.img: file size bytes: 536870912
  fedora-btrfs.img: allocated bytes: 12963840
  fedora-btrfs.img: MD5 hash:        7e8eded44fc832b0f88b0dc5eebf490c
2013-04-17 18:00:18 +01:00
Richard W.M. Jones
b7ccdd7cf3 tests: Mark 'skipped' function with __attribute__((printf)).
With recent GCC, you get this warning:

tests-main.c: In function 'skipped':
tests-main.c:256:3: error: function might be possible candidate for 'gnu_printf' format attribute [-Werror=suggest-attribute=format]
2013-04-17 17:03:13 +01:00
Richard W.M. Jones
6af706846f Version 1.21.31. 2013-04-17 08:55:28 +01:00
Richard W.M. Jones
3b0e432875 fish: options: Allow Unix domain sockets to be specified in --add URIs.
You can now use a URI such as:

 guestfish -a nbd://?socket=/tmp/sock

(a NBD connection to Unix domain socket /tmp/sock).
2013-04-16 23:25:36 +01:00
Richard W.M. Jones
44092e06ce fish: options: Format server name as "tcp:host[:port]".
This is safer, because otherwise a URI could contain some clever
"unix:..." string as the hostname, tricking qemu into opening a Unix
domain socket at an uncontrolled location.

This fixes commit 349300af08.
2013-04-16 19:37:20 +01:00
Richard W.M. Jones
87690b10ff df: Move variable decl to top of function.
Since this code is no longer conditional, we don't need to have the
extra { ... } inside the case statement.

This tidies up commit 2f0a4d7c18.
2013-04-16 19:37:20 +01:00
Richard W.M. Jones
f5544e8c93 Version 1.21.30. 2013-04-16 18:41:32 +01:00
Richard W.M. Jones
2f0a4d7c18 Require libxml2.
libxml2 is very commonly available on Linux distros and has also been
ported (and is widely available) on Mac OS X and Windows.  Therefore
simply require libxml2, and remove a lot of conditional code.
2013-04-16 16:46:01 +01:00
Richard W.M. Jones
349300af08 fish: Add -a URI (add remote storage) to options.
Add a remote drive by doing:

 guestfish -a ssh://example.com/path/to/disk.img

There are several different protocols supported, as explained in the
man page.

This affects all virt-* tools that use the common guestfish options
parsing code.
2013-04-16 15:28:31 +01:00
Richard W.M. Jones
b48e416d27 fish: options: Whitespace change. 2013-04-16 13:57:01 +01:00
Richard W.M. Jones
cfda2693c6 Add support for SSH (Secure Shell) block device. 2013-04-16 09:13:07 +01:00
Richard W.M. Jones
ca11cd104d FAQ: Add a quick summary to the debugging section of the FAQ. 2013-04-15 09:51:24 +01:00
Richard W.M. Jones
848db89b7f Version 1.21.29. 2013-04-13 10:48:08 +01:00
Richard W.M. Jones
288a24eebe tests: Split C API tests into regular C file + generated tests file. 2013-04-13 07:26:46 +01:00
Richard W.M. Jones
883aea9b1d tests: Replace TestOutputHashtable with TestResult and C test. 2013-04-13 07:26:02 +01:00
Richard W.M. Jones
c43f762257 tests: Replace TestOutputBuffer with TestResult and C test. 2013-04-13 07:26:02 +01:00
Richard W.M. Jones
424fe36d32 tests: Replace TestOutputFileMD5 with TestResult and C test. 2013-04-13 07:26:02 +01:00
Richard W.M. Jones
0a49838135 tests: Remove TestOutputLength (not used by any tests). 2013-04-13 07:26:02 +01:00
Richard W.M. Jones
685c5fb3b1 tests: Replace TestOutput/TestOutputDevice with TestResult{String,Device}. 2013-04-13 07:26:02 +01:00
Richard W.M. Jones
45840581d6 tests: Replace TestOutputList{,OfDevices} with TestResult.
This adds helper C functions 'is_string_list' and 'is_device_list'
allowing these tests to be carried out in generic C code instead of as
specialized tests.
2013-04-13 07:25:57 +01:00
Richard W.M. Jones
45599a8895 tests: Replace TestOutputStruct with TestResult. 2013-04-12 21:26:23 +01:00
Richard W.M. Jones
24fdf05d30 tests: Replace TestOutputInt{,Op} with TestResult. 2013-04-12 21:26:23 +01:00
Richard W.M. Jones
c9ef854f83 tests: Replace TestOutputTrue/False with TestResultTrue/False. 2013-04-12 21:26:23 +01:00
Richard W.M. Jones
008be5dbfa tests: More flexible re-implementation of C API tests.
Instead of using the various 'TestOutput', 'TestOutputList' etc
macros, it makes better sense to let the tests contain fragments of C
code to perform the checks.

Several new macros are added:

- 'TestResult': This macro takes a C expression which is evaluated to
test the result of commands.  For example to compare if a string
result has some value:

   TestResult (* command sequence *), "STREQ (ret, \"abcd\")"

The variable "ret" contains the result from the last command in the
sequence.  But also, variables "ret1", "ret2", etc contain the results
from the last but one command, the command before that, and so forth,
allowing much more flexible tests to be written.

- 'TestResultTrue', 'TestResultFalse': Wrappers that test the last
command for true/false.
2013-04-12 21:26:23 +01:00
Richard W.M. Jones
e327351304 tests: 'If' and 'Unless' conditions never used, so remove them. 2013-04-12 21:26:23 +01:00
Richard W.M. Jones
09b4cc45a3 is_lv: Does not need to depend on lvm2.
It only uses 'stat', not any lvm binaries.
2013-04-12 21:26:23 +01:00
Richard W.M. Jones
e4ef9a8281 valgrind suppressions: Suppress libmagic leaks. 2013-04-12 21:26:23 +01:00
Richard W.M. Jones
a7107854ba debian: packagelist: Add mtools. 2013-04-11 23:23:20 +01:00
Olaf Hering
3acf6768f0 add --with-supermin-extra-options configure option
Useful to pass --use-installed and other options to supermin.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2013-04-11 22:20:55 +01:00
Richard W.M. Jones
c2013308ed Update translations from Transifex. 2013-04-11 14:42:54 +01:00
Richard W.M. Jones
f4d5f3d6a2 Update gnulib to latest. 2013-04-11 14:42:54 +01:00
Richard W.M. Jones
142b874ce8 Remove use of gnulib progname module.
It's simpler to use the glibc 'program_invocation_short_name(3)'
feature, and fall back to a generic solution.  Also remove risky
assignments to argv[0].
2013-04-11 14:42:54 +01:00
Richard W.M. Jones
f2b90b374f New APIs: set-program, get-program.
These set or get the program name in the handle.  Most programs
will never need to call this, since we set this, if possible,
using the glibc 'program_invocation_short_name(3)' feature.
2013-04-11 12:52:54 +01:00
Richard W.M. Jones
1a06ac25f5 fish: Add help for prepared disk images to the man page.
Also the long description for each prepared disk image can now contain
Perl POD markup.
2013-04-10 12:28:14 +01:00
Richard W.M. Jones
b72daebaf4 inspection: Don't fail if libosinfo database is not found (RHBZ#948324). 2013-04-10 10:01:17 +01:00
Richard W.M. Jones
2cf0b5c19b fish: welcome message: guestfish can edit disk images. 2013-04-09 23:26:39 +01:00
Richard W.M. Jones
abe07ce2ca "guestfish" now means the "guest filesystem shell".
Remove the word "interactive" which implies that guestfish can only
(or often) be used interactively.
2013-04-09 23:21:42 +01:00
Richard W.M. Jones
6a7327dfa9 Version 1.21.28. 2013-04-09 18:45:15 +01:00
Richard W.M. Jones
c396d4cd32 examples: Update debug-logging.c example.
This updates commit e3546ad2ce.
2013-04-09 17:30:16 +01:00
Richard W.M. Jones
e3546ad2ce examples: Add example program showing enabling debugging and capturing log messages. 2013-04-08 20:10:37 +01:00
Richard W.M. Jones
6582d4ad9f Update release notes for future 1.22 release. 2013-04-05 10:33:58 +01:00
Richard W.M. Jones
a3de6eddd4 pod: Fix "wide character in print" warnings by declaring encoding correctly. 2013-04-05 10:33:25 +01:00
Richard W.M. Jones
dfa25a46e3 Fix typo in extlinux documentation.
This fixes commit dee1dd64c3.
2013-04-04 22:14:25 +01:00
Richard W.M. Jones
f9f3c7c5ac Version 1.21.27. 2013-04-04 21:04:32 +01:00
Richard W.M. Jones
dee1dd64c3 New APIs: Add support for syslinux and extlinux (bootloaders).
This also adds tests of SYSLINUX and EXTLINUX which create bootable
guests.
2013-04-04 18:31:41 +01:00
Richard W.M. Jones
e73cd348c8 Don't delete iconv locale data from the appliance.
- /usr/lib{,64}/gconv/*:

This is the iconv data, required for APIs like iconv_open to work.  In
particular, the mtools 'mcopy' program fails completely if it cannot
use iconv.  'mcopy' is used by SYSLINUX to copy files to the disk.

The error you would have seen is:

  Error converting to codepage 850 Invalid argument
  Cannot initialize 'S:'
  Bad target s:/ldlinux.sys

- /usr/bin/localedef and /usr/sbin/build-locale-archive:

These are not really needed, but both are simply small binaries so we
might as well not delete them.
2013-04-04 18:23:32 +01:00
Richard W.M. Jones
3cdca7616a daemon/copy: Ensure errno is preserved along error paths. 2013-04-04 14:58:32 +01:00
Richard W.M. Jones
33c087ea9c Add 'sparse' option to copy-{device,file}-to-{device,file} calls.
Setting the 'sparse' optional boolean causes writes to be omitted if
the block to be written contains all zero bytes.

This should help with sparse backing files (eg. raw, qcow2, dm-thin, etc).

Also, modify virt-resize to use this option by default when copying
devices.  The savings in virt-resize can be quite startling, eg
'du -sh' (ie. true size) of a resized disk image:

8.1G      /tmp/f15x32-resized.img    # before this change
3.2G      /tmp/f15x32-resized.img    # after this change
2013-04-04 14:58:32 +01:00
Richard W.M. Jones
289fd29f0b php: Fix segfault when function has an OStringList optional argument.
How this PHP/Zend stuff is supposed to work is not documented, but at
least with these changes it no longer segfaults.
2013-04-04 11:49:27 +01:00
Richard W.M. Jones
ba0199c487 python: Let RHashtable be returned as a Python dict.
The initial proposal was suggested by Matt Booth and discussed on the
mailing list here:

https://www.redhat.com/archives/libguestfs/2013-April/msg00007.html
2013-04-03 19:18:07 +01:00
Richard W.M. Jones
3dcb572bda Better error messages for FUSE and other things not supported.
The bare message "FUSE not supported" wasn't actionable.
2013-04-03 12:33:24 +01:00
Richard W.M. Jones
d0a8cca9a1 FAQ: In Fedora >= 19, the RPM detects if it can access the network when building. 2013-04-02 15:53:37 +01:00
Richard W.M. Jones
387b232126 Version 1.21.26. 2013-04-02 15:29:59 +01:00
Richard W.M. Jones
667482ca9a perl: Remove Sys::Guestfs::Lib.
See announcement on the mailing list for more details about this change:

https://www.redhat.com/archives/libguestfs/2013-April/msg00001.html
2013-04-02 15:26:05 +01:00
Richard W.M. Jones
2287b988ee perl: Remove use of Sys::Guestfs::Lib::open_guest function.
This obsolete function does all sorts of libvirt/XML things, which can
now be replaced by using ordinary API calls; especially $g->add_domain.
2013-04-02 13:30:19 +01:00
Richard W.M. Jones
ecda39bed4 tests/data: Update README and comments about initrd binary files.
These are used for testing the C, not Perl, file_architecture API.
2013-04-02 13:06:10 +01:00
Richard W.M. Jones
1cb38ab924 New API: feature-available.
This API is an easier to use version of the existing guestfs_available,
because the new API returns true/false instead of throwing an error
when a feature from the list is not available.

In truth we've had this implementation internally in the library
and several tools and in Sys::Guestfs::Lib for a long time.  This
change just turns it into a publicly consumable API.
2013-04-02 12:38:50 +01:00
Richard W.M. Jones
288b2b2d4f virt-ls, virt-edit: Remove references to Sys::Guestfs::Lib and other irrelevant Perl libraries. 2013-04-02 10:15:25 +01:00
Richard W.M. Jones
6fa1177b0a java: Make test cases depend on jar file.
This fixes parallel builds.  The error you would have seen was:

  error: error reading libguestfs-1.21.25.jar; zip file is empty
2013-04-01 20:29:17 +01:00
Richard W.M. Jones
1a2e03c323 java: 'make clean' should remove whole api/ directory.
This directory (containing HTML documentation) can be removed
completely when making clean.  CLEANFILES cannot recursively remove a
directory, so use a clean-local rule instead.
2013-04-01 20:28:16 +01:00
Richard W.M. Jones
ce49e1fdc0 build: Change various check rules so they implicitly act like 'make -k'.
Rules such as 'make check-valgrind' are implemented using a for-loop.
They would always exit after the first error, even if 'make -k' was
used at the top-level.  Since 'make -k'-style behaviour is generally
more useful, change these for-loops so they run all the tests, and
report errors at the end.
2013-04-01 13:32:15 +01:00
Richard W.M. Jones
599f5d7ddc make clean: Remove *~ (editor backup) files. 2013-04-01 13:32:15 +01:00
Richard W.M. Jones
5f5ce4f59f make clean: Clean contents of tmp directory. 2013-04-01 11:40:35 +01:00
Richard W.M. Jones
b050d7e4bf valgrind: Write separate log files in tmp/valgrind-<DATE>-<PID>.log
Current code wrote a single valgrind.log in the top-level directory.
This was overwritten with each valgrinded program, which wasn't much
use.  The new version writes multiple separate valgrind-*.log files
containing the date and PID (so each is unique).

It would nice if valgrind could delete log files that don't contain
errors, but this doesn't appear to be possible.
2013-04-01 11:35:26 +01:00
Richard W.M. Jones
68990840b6 "attach method" is from now on known as "backend".
This large, but mainly mechanical commit, renames "attach method"
everywhere to "backend".

Backwards compatibility of the API (guestfs_{set,get}_attach_method)
and environment (LIBGUESTFS_ATTACH_METHOD) is maintained, but in new
code use guestfs_{set,get}_backend and LIBGUESTFS_BACKEND instead.

The default backend (launching qemu directly) is now called 'direct'
instead of 'appliance', although you can still use 'appliance' as a
synonym.
2013-04-01 11:16:18 +01:00
Richard W.M. Jones
f2b1a01e76 build: Clarify output of 'make help'. 2013-04-01 11:16:18 +01:00
Richard W.M. Jones
72f5a6b004 Version 1.21.25. 2013-03-30 22:57:29 +00:00
Richard W.M. Jones
75f2fcd687 docs: Remove obsolete sections from libguestfs gotchas.
These refer to old behaviour in long-unsupported versions
of libguestfs.
2013-03-30 19:44:39 +00:00
Richard W.M. Jones
806289ec66 docs: Refresh API overview section. 2013-03-30 19:43:52 +00:00
Richard W.M. Jones
b2eef58571 docs: Alternate ways to list filesystems through the API. 2013-03-30 19:28:29 +00:00
Richard W.M. Jones
8e76cb4512 FAQ: Update distro support section. 2013-03-30 19:09:12 +00:00
Richard W.M. Jones
02a4e5ac6a debian: Allow test-virt-alignment-scan-guests.sh test to be skipped. 2013-03-30 18:17:09 +00:00
Richard W.M. Jones
2a090e0667 tests/guests: Add 'guests-all-good.xml{.in}' libvirt test guest set.
This differs from 'guests.xml' in that there are no guests with
missing disks, etc., so we can use this to test virt-alignment-scan
accurately.
2013-03-30 16:33:08 +00:00
Richard W.M. Jones
429ffda329 parallel: Propagate errors from worker threads and exit with error code.
In virt-df and virt-alignment-scan, ensure that errors that happen in
worker threads are propagated all the way up and result in
exit(EXIT_FAILURE).

Note that this makes the align/test-virt-alignment-scan-guests.sh test
fail (for a genuine reason).  This is fixed in the following commit.

This updates commit 8b90f55dc7.
2013-03-30 16:33:08 +00:00
Richard W.M. Jones
30702c7f54 Version 1.21.24. 2013-03-29 22:07:18 +00:00
Richard W.M. Jones
f55a2dbf29 java: Make bindtests depend on jar file so parallel builds work.
This fixes commit c36ced5e21.
2013-03-29 22:02:46 +00:00
Richard W.M. Jones
8b90f55dc7 virt-alignment-scan: Don't call exit(3) from this multi-threaded program.
For more information see:
https://bugzilla.redhat.com/show_bug.cgi?id=790837#c2
2013-03-29 21:28:49 +00:00
Richard W.M. Jones
d6ea2f5911 daemon: file: Remove extraneous space after output of 'file' command (RHBZ#928995). 2013-03-29 20:04:11 +00:00
Richard W.M. Jones
a9ad3088bf daemon: parse_btrfsvol: Perform device name translation before trying to stat the device.
If using (eg) virtio-blk, the canonical name won't work unless device
name translation is done first.

This fixes commit 47b929b7893b3a76ff22760d245cb80720ae6345..
2013-03-29 10:50:28 +00:00
Richard W.M. Jones
bb276e8a26 daemon: parse_btrfsvol: Move variable decls to top, whitespace fixes.
This fixes commit 47b929b789.
2013-03-28 23:30:51 +00:00
Richard W.M. Jones
a28a430b10 daemon: Fix parse_btrfsvol to use STRPREFIX instead of bogus strncmp.
This fixes commit 47b929b789.
2013-03-28 23:30:51 +00:00
Richard W.M. Jones
c50cde67cc java: Format CLEANFILES rule. 2013-03-28 20:24:25 +00:00
Richard W.M. Jones
c36ced5e21 java: Enable parallel builds.
This reverts commit 89404ec0ba.
2013-03-28 20:20:09 +00:00
Richard W.M. Jones
6185aa4e38 ocaml tools: Enable parallel builds.
In particular, building virt-sysprep is slow because there are so many
modules.  Enable parallel builds.  If it breaks, we should fix it, not
work around it.
2013-03-28 20:15:51 +00:00
Richard W.M. Jones
dce94f3e26 ocaml: Fix and enable parallel builds.
We only have to serialize the two calls to ocamlmklib, since both will
try to create a file called 'libmlguestfs.a'.  Apart from that,
parallel builds here should be fine.
2013-03-28 20:13:36 +00:00
Richard W.M. Jones
b13c935bbd ocaml: Break circular dependency of mlguestfs.cma{,x} <-> guestfs.cm{o,x} 2013-03-28 20:12:47 +00:00
Richard W.M. Jones
3c34db9808 Use new-style demand-loaded bash-completion scripts. 2013-03-28 18:46:06 +00:00
Richard W.M. Jones
df7f57a193 Version 1.21.23. 2013-03-28 15:18:43 +00:00
Richard W.M. Jones
924aa44c1f bash completion: Extend this script to work with other virt tools. 2013-03-28 15:15:45 +00:00
Richard W.M. Jones
6c9a7fe561 Add --long-options option to most tools.
For example:

$ guestfish --long-options
--add
--cmd-help
--connect
--csh
--domain
--echo-keys
[etc.]

The idea of this is to make it easier to write a bash completion
script that accurately expands --<TAB> options for each command.
2013-03-28 14:46:20 +00:00
Richard W.M. Jones
b98de580c9 fish: Better tab completion for guestfish. 2013-03-28 14:00:42 +00:00
Richard W.M. Jones
05ba393724 OCaml tools: Use Common_gettext and Common_utils modules.
Share these modules across all three tools virt-resize, virt-sparsify
and virt-sysprep.

This is mostly code motion.
2013-03-28 14:00:42 +00:00
Richard W.M. Jones
69e0f86cab osinfo: Fix declaration of guestfs___osinfo_map to work when libxml2 is not installed. 2013-03-23 18:57:39 +00:00
Richard W.M. Jones
186bb67c6e Add support for: Gluster, Ceph (rbd), Sheepdog.
These are not tested at all, and so probably won't work.  However the
code and infrastructure is in place so we can fix bugs easily as they
arise.
2013-03-19 12:39:51 +00:00
Richard W.M. Jones
97be29893e build: Add 'make check-valgrind-with-appliance'. 2013-03-19 12:24:40 +00:00
Richard W.M. Jones
62d940d2dd build: Small rearrangement of Makefile.am check-slow rule. 2013-03-19 12:24:40 +00:00
Richard W.M. Jones
55ce68784f build: Fix 'make extra-tests' to call 'check-valgrind' instead of rule that doesn't exist. 2013-03-19 12:24:40 +00:00
Richard W.M. Jones
71de9ef039 build: Turn off warning about overlength-strings.
ISO apparently specified a limit of 4096 bytes/characters for strings.
The description of the guestfish command 'add-drive' is now longer
than this limit, causing this warning.

Turn off this warning, since GCC has no problems with these strings.
2013-03-19 12:24:37 +00:00
Richard W.M. Jones
a535befbeb nbd: Update and clarify the documentation for NBD. 2013-03-18 22:35:43 +00:00
Richard W.M. Jones
66df6ae908 drives: Make parse_servers return an int (number of servers).
This is just a code refactoring.
2013-03-18 22:35:24 +00:00
Richard W.M. Jones
f8941b09e6 Version 1.21.22. 2013-03-18 19:46:24 +00:00
Richard W.M. Jones
dc4c959ce1 nbd: Allow 'unix' transport & socket to be specified.
This allows the server string to contain "unix:/path/to/socket",
thus using a Unix domain socket to connect to the NBD server.
2013-03-18 17:59:19 +00:00
Richard W.M. Jones
43b6d75a08 tests: nbd: Ensure qemu-nbd subprocess is always killed.
Even if the test fails/dies for some other reason.
2013-03-18 16:45:55 +00:00
Richard W.M. Jones
f750c3e72d drives: Factor out common code for making a file= qemu parameter. 2013-03-18 16:45:55 +00:00
Richard W.M. Jones
9c32c73afd drives: Allow multiple servers to be passed to add_drives.
This changes the existing (non-published-in-stable) API for
add_drives{_opt} so that instead of having separate 'server' and
'port' parameters, now we have a single 'server' parameter which is a
list of strings.

This is so we will be able to cope with protocols such as Ceph which
allows multiple servers, or Sheepdog which can use an implicit local
server (ie. zero servers specified).

NBD still requires exactly one server.
2013-03-18 16:45:55 +00:00
Richard W.M. Jones
766393d854 inspection: Remove unused #includes. 2013-03-18 15:47:34 +00:00
Richard W.M. Jones
6641758221 drives: Add a common guestfs___free_drive_source function.
This refactors the code to introduce a common function.
2013-03-18 14:58:50 +00:00
Richard W.M. Jones
612a3f06b4 drives: Whitespace change. 2013-03-18 14:58:36 +00:00
Richard W.M. Jones
cec0c55a35 drives: Change internal struct drive_source.
This is just code refactoring.
2013-03-18 12:04:24 +00:00
Richard W.M. Jones
856c2f6a47 nbd: Note that readonly connections are not supported by the appliance attach-method.
This documents the problem and links to the upstream bug.
2013-03-18 09:55:36 +00:00
Richard W.M. Jones
ae3011d518 lib: Remove -Wswitch-default.
This warning is actively dangerous.  Because it forces you to use a
'default:' case in every switch statement, it means you can no longer
detect missing cases in enums.
2013-03-16 21:22:03 +00:00
Richard W.M. Jones
bf1c3196b5 lib: Add missing cases in switch statements.
These were being hidden by misguided use of the dangerous
-Wswitch-default flag.
2013-03-16 20:23:14 +00:00
Richard W.M. Jones
2af946b3bf Version 1.21.21. 2013-03-15 22:42:38 +00:00
Richard W.M. Jones
af1c53d104 appliance: Make sure cachedir has mode 0755 (RHBZ#921292).
See https://bugzilla.redhat.com/show_bug.cgi?id=921292#c4
2013-03-15 22:40:06 +00:00
Richard W.M. Jones
e7c78881fc appliance: Use ignore_value() macro instead of casting return to (void). 2013-03-15 22:39:45 +00:00
Richard W.M. Jones
c83221a869 drives: add_drive was only called from one place, so inline it.
This is just code motion.
2013-03-15 20:47:55 +00:00
Richard W.M. Jones
694a091d3f lib: Add direct support for the NBD (Network Block Device) protocol.
You can now add remote NBD drives using:

 ><fs> add-drive "" format:raw protocol:nbd server:localhost

(Note that you also need to add port:NNNN if the server is running on
a non-standard port).

The corresponding qemu-nbd service can be started by doing:

 qemu-nbd disk.img -t

This commit also adds a test.
2013-03-15 20:47:54 +00:00
Richard W.M. Jones
e7e2b56569 drives: Make drv->readonly flag into a bool. 2013-03-14 22:34:56 +00:00
Richard W.M. Jones
b1df9a9df1 drives: Refactor code to separate 'struct drive' creation from adding drives. 2013-03-14 22:28:22 +00:00
Richard W.M. Jones
33ec3eca29 launch: Move code concerned with adding drives to 'src/drives.c'.
Apart from adding a few comments, this is entirely code motion.
2013-03-14 22:06:16 +00:00
Richard W.M. Jones
a2b88b8637 Add ./configure --with-extra-packages="..." option.
This adds extra packages to the appliance.  It's useful for adding
debugging packages.
2013-03-14 13:50:49 +00:00
Hilko Bengen
85dd52f470 Mount /run as tmpfs inside appliance (workaround for febootstrap's /init) 2013-03-14 13:01:07 +00:00
Richard W.M. Jones
e29a130d8f erlang: Use $(ERLANG_LIB_DIR) to get Erlang libdir.
Instead of previous custom hack which didn't work properly on Debian.

Thanks: Hilko Bengen.
2013-03-14 12:47:40 +00:00
Richard W.M. Jones
04acc32abf README: Discourage general users from doing 'make install'.
It causes plenty of problems with people have multiple parallel
versions of libguestfs installed, and there's no benefit because you
can easily run libguestfs and tools from the build directory.
2013-03-14 12:20:52 +00:00
Richard W.M. Jones
87c9ec881c ruby: Support 'make INSTALLDIRS=vendor install' for Ruby as well as Perl.
As with Perl, you can now set INSTALLDIRS to control where Ruby places
its files (ie. in the site dir, which is the default, or in the vendor
dir).

The difference in file layout between 'make install' and
'make INSTALLDIRS=vendor install' is shown below (for Fedora 18).

--- /tmp/site	2013-03-14 12:14:35.740015694 +0000
+++ /tmp/vendor	2013-03-14 12:14:13.668093944 +0000
@@ -119,21 +119,20 @@
 ./usr/lib64/ocaml/guestfs/mlguestfs.cmxa
 ./usr/lib64/ocaml/stublibs/dllmlguestfs.so
 ./usr/lib64/ocaml/stublibs/dllmlguestfs.so.owner
-./usr/lib64/perl5/auto/Sys/Guestfs/Guestfs.bs
-./usr/lib64/perl5/auto/Sys/Guestfs/Guestfs.so
-./usr/lib64/perl5/auto/Sys/Guestfs/.packlist
 ./usr/lib64/perl5/perllocal.pod
-./usr/lib64/perl5/Sys/bindtests.pl
-./usr/lib64/perl5/Sys/Guestfs/Lib.pm
-./usr/lib64/perl5/Sys/Guestfs.pm
+./usr/lib64/perl5/vendor_perl/auto/Sys/Guestfs/Guestfs.bs
+./usr/lib64/perl5/vendor_perl/auto/Sys/Guestfs/Guestfs.so
+./usr/lib64/perl5/vendor_perl/auto/Sys/Guestfs/.packlist
+./usr/lib64/perl5/vendor_perl/Sys/bindtests.pl
+./usr/lib64/perl5/vendor_perl/Sys/Guestfs/Lib.pm
+./usr/lib64/perl5/vendor_perl/Sys/Guestfs.pm
 ./usr/lib64/php/modules/guestfs_php.so
 ./usr/lib64/pkgconfig/libguestfs-gobject-1.0.pc
 ./usr/lib64/pkgconfig/libguestfs.pc
 ./usr/lib64/python2.7/site-packages/guestfs.py
 ./usr/lib64/python2.7/site-packages/libguestfsmod.la
 ./usr/lib64/python2.7/site-packages/libguestfsmod.so
-./usr/local/lib64/ruby/site_ruby/_guestfs.so
-./usr/local/share/ruby/site_ruby/guestfs.rb
+./usr/lib64/ruby/vendor_ruby/_guestfs.so
 ./usr/sbin/libguestfs-make-fixed-appliance
 ./usr/share/doc/libguestfs/example-debian-netinst-cd.xml
 ./usr/share/doc/libguestfs/example-debian.xml
@@ -406,3 +405,4 @@
 ./usr/share/man/uk/man3/guestfs-perl.3
 ./usr/share/man/uk/man3/guestfs-python.3
 ./usr/share/man/uk/man3/guestfs-ruby.3
+./usr/share/ruby/vendor_ruby/guestfs.rb

For prompting me to fix this, thanks: Hilko Bengen.
2013-03-14 12:19:22 +00:00
Richard W.M. Jones
0fd925da77 launch: Print attach-method, tmpdir, umask, euid when launching.
These are only printed when debugging is enabled, but should help
debugging hard-to-pin-down permissions problems.
2013-03-14 10:47:00 +00:00
Richard W.M. Jones
df656c9d5a tests: Make it easier to grep failures out of the log file. 2013-03-14 08:56:29 +00:00
Richard W.M. Jones
3e4d3f415c Version 1.21.20. 2013-03-13 18:45:30 +00:00
Richard W.M. Jones
1b644ad64e utils: Fix error messages for external commands that fail (RHBZ#921040).
This adds a common utility function (guestfs___exit_status_to_string)
and a common error function (guestfs___external_command_failed), and
uses them all over the library and tools when converting exit status
in error messages etc.
2013-03-13 18:34:17 +00:00
Richard W.M. Jones
50a3fa5f42 lib: Move common errors to src/errors.c.
This is just code motion.
2013-03-13 17:20:41 +00:00
Richard W.M. Jones
e9d3074294 rescue: Remove dead code.
This pty code was defended by #if 0 ... #endif and was dead code.
2013-03-13 17:20:41 +00:00
Richard W.M. Jones
368b4c6480 Ignore case when generating AUTHORS file. 2013-03-13 10:57:36 +00:00
infernix
b17c3a7eb3 launch: appliance: Add custom parameters last.
This allows custom parameters to modify parameters added by
libguestfs, eg. by doing:

  -set drive.hd0.file=rbd:foo/bar

[infernix adds the comment below:]

This works for recent versions of QEMU. The way to use this is:

guestfish
><fs> add-drive /dev/null
><fs> config -set drive.hd0.file=rbd:pool/volume
><fs> run

This will probably work for more types (sheepdog, iscsi et al), but
with the caveat that the libguestfs layers are bypassed so you'll
*always* end up directly accessing the disk in rw mode.
2013-03-12 17:58:32 +00:00
Richard W.M. Jones
0b285cd8a6 docs: Update documentation on attach-methods.
Add better instructions for getting the default attach-method.

Update libguestfs-test-tool(1) to show how to enable and disable
libvirt.
2013-03-12 13:19:26 +00:00
Richard W.M. Jones
6e4f9be492 php: Pass all libvirt environment variables down to PHP test scripts.
Including LIBVIRTD_* and VIRTLOCKD_*.

This updates commit cd40cf7139.
2013-03-12 12:35:17 +00:00
Richard W.M. Jones
49622ab63b Version 1.21.19. 2013-03-11 23:03:38 +00:00
Richard W.M. Jones
5e5026b730 qemu-img info: Use --output json and YAJL (JSON parser) to safely parse output (RHBZ#920225).
The old parser is still used if either YAJL is not available or
qemu-img info doesn't support the --output json option.
2013-03-11 19:10:04 +00:00
Richard W.M. Jones
2f8960f784 qemu-img info: Prefix parsing functions as old_parser_*.
Prefix functions in this file with old_parser_... to make it clear
this is the old / slightly unsafe human output parser, which is
shortly to be replaced by a safer JSON parser.

This is just code motion.
2013-03-11 16:27:13 +00:00
Richard W.M. Jones
cd40cf7139 php: Fix tests.
- Use ./run script to run the tests.
- Set environment variables correctly, including $PATH.
- Test the locally built, not installed, copy of libguestfs.
2013-03-11 16:04:17 +00:00
Richard W.M. Jones
becc4fecf4 php: Revise README-PHP documentation. 2013-03-11 14:29:13 +00:00
Richard W.M. Jones
c64e99782f docs: Note that $PATH affects libguestfs.
If $PATH is not set, libguestfs and/or libvirt tend to break.
2013-03-11 14:28:40 +00:00
Richard W.M. Jones
350c478d7b launch: libvirt: Unset $PATH can cause libvirt launch to fail.
Note this fact in the error message that is printed in this situation.
2013-03-11 14:27:56 +00:00
Richard W.M. Jones
02159e9aa8 launch: libvirt: Print proper dotted libvirt version. 2013-03-11 14:05:33 +00:00
Richard W.M. Jones
fe3798f366 php: Print libguestfs error string if test fails. 2013-03-11 13:44:50 +00:00
Richard W.M. Jones
d44752a110 php: Fix test, /dev/null format must be "raw". 2013-03-11 13:44:33 +00:00
Richard W.M. Jones
7a968beb46 lib: Give values for each state in 'enum state'.
The values of CONFIG, LAUNCHING and READY and (kind of) exposed
through the API so shouldn't change.

Use a bad sentinel for NO_HANDLE since that indicates a serious error.
2013-03-11 12:34:22 +00:00
Richard W.M. Jones
99e5ffd1de lib: Add comment for libguestfs handle. 2013-03-11 12:32:30 +00:00
Richard W.M. Jones
d9efcfb556 RHEL 5: tests/xml: Define O_CLOEXEC in LD_PRELOAD library. 2013-03-11 11:04:38 +00:00
Richard W.M. Jones
1b5b397da8 RHEL 5: tests: Use gnulib.
Gnulib defines O_CLOEXEC which is missing on RHEL 5.
2013-03-10 20:08:59 +00:00
Richard W.M. Jones
d16bb6b70c RHEL 5: Replacement for 'Unix.isatty stdout' for old OCaml versions.
Unix.isatty missing on RHEL 5-era OCaml 3.09.3.
2013-03-09 22:32:30 +00:00
Richard W.M. Jones
e73944faf4 RHEL 5: gnulib: Use module mkstemps.
RHEL 5 glibc doesn't have this function.
2013-03-09 18:53:51 +00:00
Richard W.M. Jones
bb0617859f RHEL 5: inspect: Add macro for be32toh if one is not defined in the header files. 2013-03-09 18:53:51 +00:00
Richard W.M. Jones
74297e6109 Add suppression for memory leak in libmagic. 2013-03-08 17:03:37 +00:00
Richard W.M. Jones
52c3edd5e0 filearch: Use a more logical way to construct the cpio command. 2013-03-08 14:02:19 +00:00
Richard W.M. Jones
801487f2a7 filearch: Don't print errno if cpio command fails, print command status instead.
errno is meaningless here.
2013-03-08 13:51:18 +00:00
Richard W.M. Jones
22d82d00b4 generator: Small fix for OCaml 3.12.1.
OCaml 3.12.1 (unlike 4.00.1) doesn't let you use printf formatters
in this way:

  printf (if foo then "&%s" else "%s") str
2013-03-08 13:17:45 +00:00
Hilko Bengen
0ee24ccf8a Move Ruby-related checks from autoconf to extconf.rb; add extra check for rb_alloc_func_t
Ruby ships its own config.h which may or may not define the same
relevant constants as our autoconf-generated config.h. Instead of
trying to specify the exact path to the wanted header file we may just
as well simply use Ruby's autoconf-inspired checks and macros.
2013-03-08 12:47:24 +00:00
Richard W.M. Jones
3a895ba794 df/parallel.c: Fix if libvirt is not available at compile time. 2013-03-07 23:29:21 +00:00
Richard W.M. Jones
ef33ea359d Version 1.21.18. 2013-03-07 21:53:16 +00:00
Hilko Bengen
6557d0c082 out-of-tree build: Fix link creation 2013-03-07 21:26:05 +00:00
Hilko Bengen
a568dec4cf Still build the libguestfs-specific parts when --disable-appliance is passed to configure 2013-03-07 21:26:03 +00:00
Hilko Bengen
43b37d02a1 out-of-tree build: Fix localized manpages 2013-03-07 21:17:30 +00:00
Hilko Bengen
0a50e64435 out-of-tree build: don't distribute extconf.rb.in template, use generated exconf.rb
Apparently, the file will only be autogenerated in $(builddir) if it
is not already present in $(srcdir).
2013-03-07 21:14:11 +00:00
Richard W.M. Jones
bb1f665d7f protocol: Handle log messages from connection layer centrally.
Previously described as a "gross hack and massive layering violation".
2013-03-07 18:23:45 +00:00
Richard W.M. Jones
ed41fcd75c protocol: Abstract out socket operations from protocol code.
This creates an abstract layer below the protocol code which handles
the socket operations.  This will make it easier to introduce libvirt
virSocketPtr operations in future.

In the handle, g->conn contains the connection to the appliance.
g->conn is NULL when we're not connected.

poll(2) is used instead of select(2).

All error messages about launch failing or the appliance unexpectedly
dying are handled by two common error message functions, and these
contain a better explanation of what to do.
2013-03-07 18:15:09 +00:00
Richard W.M. Jones
06b39b8098 protocol: Remove message_summary code.
Produces lots of output, and not very helpful.
2013-03-07 16:29:12 +00:00
Richard W.M. Jones
2c8e7ba9b4 launch: unix: Set g->daemon_sock = -1 after closing it.
This ensures we don't accidentally use the closed fd.
2013-03-07 11:40:44 +00:00
Richard W.M. Jones
9ae639948a lib: Rename g->fd to console_sock and g->sock to daemon_sock.
This just renames the fields in the handle to more descriptive names.
There is no functional change.
2013-03-07 11:39:44 +00:00
Richard W.M. Jones
f9381847f1 launch: appliance: Set FD_CLOEXEC flag on console socket.
The earlier (pipe-based) code never set this flag, but that was a bug,
potentially allowing the file descriptor to be leaked to subprocesses.

Set the FD_CLOEXEC flag, but also ensure it is cleared in the child
process just before qemu is exec'd (otherwise qemu would not have a
console).
2013-03-07 11:12:04 +00:00
Richard W.M. Jones
6e7cbb09a9 launch: appliance: Use socketpair instead of pipe for qemu stdin/stdout.
The libvirt backend already uses a Unix socket for the appliance
console, and so for the libvirt backend the fields g->fd[0] == g->fd[1].

Change the appliance backend to use a socketpair, so we need just a
single file descriptor for qemu stdin/stdout (ie. appliance console).

Consequently we can remove the array int fd[2] in the handle and
replace it with a single file descriptor.
2013-03-07 09:50:36 +00:00
Richard W.M. Jones
8136ca3719 proto: send_to_daemon is not an exported function.
This function is only used inside src/proto.c, so rename
it from guestfs___send_to_daemon to just send_to_daemon.
2013-03-06 21:13:14 +00:00
Richard W.M. Jones
7de25c2bca valgrind: Add suppression for memory leak found in libselinux. 2013-03-06 14:39:07 +00:00
Richard W.M. Jones
c44c5ee268 debug: Add command to generate lots of debug messages. 2013-03-06 11:18:14 +00:00
Richard W.M. Jones
ba08a51094 launch: libvirt: When debugging, print permissions of appliance and sockets.
When debugging is enabled, this prints out the permissions (ie.
ls -laZ) of the appliance and sockets directories.  This should be
helpful for debugging RHBZ#913774.
2013-03-05 17:03:21 +00:00
Richard W.M. Jones
59f01c4a70 launch: libvirt: Rename 'is_root' as 'current_proc_is_root', and documentation. 2013-03-05 16:49:46 +00:00
Richard W.M. Jones
ed354e8f8b launch: libvirt: When root, set socket permissions to 0660 (vs 0775).
Since qemu connects to both, there was no point at all in having these
sockets be readable by other, nor executable by anyone.

The sockets should now end up as:

  srw-rw---- root.qemu
2013-03-05 16:49:46 +00:00
Richard W.M. Jones
a4a2a181c2 fuse: tests: Set FD_CLOEXEC flag on file descriptor.
This is not required here, but it helps if the test code matches what
the documentations says you should do.
2013-03-05 15:26:41 +00:00
Richard W.M. Jones
f7789acdab Version 1.21.17. 2013-03-05 14:47:10 +00:00
Richard W.M. Jones
6039689344 guestmount: Add --no-fork flag.
This prevent guestmount from daemonizing.
2013-03-05 14:40:27 +00:00
Richard W.M. Jones
0120a087f4 Add guestunmount.1.html to the website.
This fixes commit 3e9e40aee3.
2013-03-05 14:05:35 +00:00
Richard W.M. Jones
3e9e40aee3 fuse: Add guestunmount program to handle unmounting (RHBZ#916780). 2013-03-05 13:12:25 +00:00
Richard W.M. Jones
09442d0588 fuse: guestfs_umount_local is not thread-safe.
Despite what the documentation may have said, it certainly was not
safe to call guestfs_umount_local from another thread.

guestfs_umount_local could generate events, call the error handler, or
access other fields in the handle, with no locking at all.

We should aim to make guestfs_umount_local thread-safe in future.

See also:
https://bugzilla.redhat.com/show_bug.cgi?id=917706
2013-03-04 15:31:41 +00:00
Richard W.M. Jones
d08f5ebd9a generator: Generate guestfs_user_cancel.
This function is now generated, so bindings in various languages
are made automatically.

Note that the function previously returned void, but now it returns
int (although always 0).  We don't believe that this is an ABI break
since existing programs will continue to work.
2013-03-04 15:24:26 +00:00
Richard W.M. Jones
ac2f6c4ef2 generator: Add 'wrapper' flag to control when wrapper is generated.
Non-daemon functions normally have a wrapper function called
eg. guestfs_name.  The "real" (ie. hand-written) function is called
eg. guestfs__name.  The wrapper deals with checking parameters and
doing trace messages.

This commit allows the wrapper function to be omitted.  The reason is
so that we can handle a few functions that have to be thread-safe
(currently just: guestfs_user_cancel).  The wrapper is not thread safe
because it can call events and/or the error handler.
2013-03-04 15:24:05 +00:00
Richard W.M. Jones
4236929fbb generator: Typo in comment: "Checking" -> "Check". 2013-03-04 15:07:50 +00:00
Richard W.M. Jones
9b7de52d58 threads: Note that even innocent-looking functions need a mutex.
RWMJ was caught out by this one ...
2013-03-04 15:07:50 +00:00
Richard W.M. Jones
66351f7494 trace: Put trace buffer on the stack instead of in the handle.
This makes more sense, and makes the code slightly closer to being
thread safe (although it's still NOT thread safe).
2013-03-04 15:07:50 +00:00
Richard W.M. Jones
8e2b920fe6 FAQ: Add question about running fsck on live filesystems. 2013-03-01 16:25:41 +00:00
Richard W.M. Jones
7d8b97559b Version 1.21.16. 2013-03-01 15:55:18 +00:00
Richard W.M. Jones
7f5bedd53b lib: Check calls to xmlXPathEvalExpression for nodesetval == NULL.
libxml2 xmlXPathEvalExpression can return an unusual nodeset:

  $1 = {type = XPATH_NODESET, nodesetval = 0x0, boolval = 0, floatval = 0,
    stringval = 0x0, user = 0x0, index = 0, user2 = 0x0, index2 = 0}

Note that the nodeset is non-NULL, but the nodesetval is NULL.

Check every call site and fix those that don't deal with this
correctly.
2013-03-01 14:44:51 +00:00
Richard W.M. Jones
3adb0d6d01 add-domain: Move 'connect_live' function.
This is just code motion.
2013-03-01 14:12:47 +00:00
Richard W.M. Jones
e78a2c5df3 add-domain: Pass SELinux label from guest to appliance (RHBZ#912499).
When adding a domain (ie. guestfs_add_domain), read the SELinux
<label/> and <imagelabel/> from the guest and use them for the
appliance.  The appliance is statically labelled the same as the
guest, so it is able to read its disks.

However tell libvirt not to try relabelling the disks, to prevent
libvirt from disturbing the existing labels on the disks (in
particular when the libvirt connection is closed, we don't want
libvirt to try to restore some other label on the disks).

Updated with feedback from Matthew Booth.
2013-03-01 14:12:33 +00:00
Richard W.M. Jones
26df366d3b launch: libvirt: Allow the SELinux label to be set on qcow2 overlay files.
When a disk is opened readonly, the libvirt attach-method privately
creates a qcow2 overlay on top.

This commit lets that overlay get an SELinux label, and sets it to the
imagelabel specified by guestfs_internal_set_libvirt_selinux_label.

The above only applies to the libvirt attach-method.
2013-02-28 15:49:28 +00:00
Richard W.M. Jones
b9ee8baa49 New internal API: internal_set_libvirt_selinux_norelabel_disks.
If set, this causes <seclabel model=selinux relabel=no> to be added to
the disk element in the libvirt XML.

It has no effect *except* on the libvirt attach method when SELinux
and sVirt is being used.
2013-02-28 15:49:27 +00:00
Richard W.M. Jones
617eb88c5e New internal API: internal_set_libvirt_selinux_label
This internal API sets two SELinux labels in the handle (the process
label and the image label -- they are closely related).

If using the libvirt attach-method with SELinux and sVirt, then this
will cause the following XML to be added to the appliance definition:

<seclabel type=static model=selinux relabel=yes>
  <label>[LABEL HERE]</label>
  <imagelabel>[IMAGELABEL HERE]</imagelabel>
</seclabel>

It is ignored by other attach-methods.
2013-02-28 15:49:27 +00:00
Richard W.M. Jones
a6a703253b add-domain: Refactor domain XML parsing code.
This is just code motion.
2013-02-28 15:49:27 +00:00
Richard W.M. Jones
d01ac17559 test-tool: Give an error if there are extra arguments on the command line. 2013-02-28 15:22:06 +00:00
Richard W.M. Jones
3f1e7f1078 launch: libvirt: Refactor SELinux warning code.
This is just code motion.
2013-02-28 13:38:25 +00:00
Richard W.M. Jones
93feaa4ae8 parallel: Don't access the global handle from multiple threads.
libguestfs handles are not thread safe, and it's not safe even to read
settings from the handle from multiple threads (eg. guestfs_get_trace).
Stop doing this in the parallel library.  This caused fairly
reproducible segfaults when you enabled '-x' and/or '-v'.

This fixes commit 34e77af1bf.
2013-02-28 13:38:25 +00:00
Richard W.M. Jones
ce7cffa85a libutils: Don't include "guestfs-internal.h".
This mini-library shouldn't access library-internal stuff.  It should
only use the "guestfs-internal-frontend.h" header.
2013-02-27 14:07:25 +00:00
Richard W.M. Jones
1ea7752e95 lib: Move 'for_each_disk' function back into libvirt-domain.c.
This function is no longer called from anywhere outside the library,
or even outside libvirt-domain.c.

This is just code motion, except for the size_t changes which are
required in order to avoid signed overflow optimization error:

  assuming signed overflow does not occur when simplifying conditional
  to constant [-Werror=strict-overflow]
2013-02-27 11:33:05 +00:00
Richard W.M. Jones
4c5c555eeb generator: Line up GUESTFS_EVENT_ALL. 2013-02-26 22:11:40 +00:00
Richard W.M. Jones
c29660588f generator: Remove "deprecated macros for internal functions".
No need for these since these are internal functions that only code
under our control should have been calling.
2013-02-26 22:08:53 +00:00
Richard W.M. Jones
1ea73f4bdf Version 1.21.15. 2013-02-26 18:48:15 +00:00
Richard W.M. Jones
db30fe0cb0 lib: Fix memory leak in guestfs_list_filesystems.
This fixes commit 6e7f052ef4.
2013-02-26 18:48:15 +00:00
Richard W.M. Jones
b6cbd980fb tests: Add tests of guests to virt-df and virt-alignment-scan. 2013-02-26 18:48:14 +00:00
Richard W.M. Jones
5ff3845d28 tests: guests: Add blank disks plus libvirt test:// XML.
You can now run virt-df and virt-alignment-scan on all of the test
guests by doing:

./run ./df/virt-df -c test:///path/to/tests/guests/guests.xml
./run ./align/virt-alignment-scan -c test:///path/to/tests/guests/guests.xml

which is kinda cool.
2013-02-26 18:48:14 +00:00
Richard W.M. Jones
fe939cf842 lib: Turn guestfs___for_each_disk back into an internal library function.
Since the refactoring of virt-df and virt-alignment-scan, those
tools no longer use this function.
2013-02-26 17:02:32 +00:00
Richard W.M. Jones
6e3aab2f0c Partial rewrite of virt-alignment-scan to use parallel threads.
See previous commit (virt-df equivalent change) for the rationale.
2013-02-26 17:02:32 +00:00
Richard W.M. Jones
34e77af1bf Partial rewrite of virt-df to use parallel threads instead of single appliance.
Previously when you asked virt-df to show stats for all your libvirt
guests, it used a single appliance and tried to attach as many disks
as possible to it, even disks from different guests.

However this has been problematic: Not only is the code to do this
horrendously complex, but it's also insecure, and it doesn't interact
well with sVirt labels (see RHBZ#912499 comment 7).

In the meantime we discovered that running parallel appliances gives
you most of the performance of using a single appliance, but with a
lot less complexity and better guest isolation (see the documentation
in commit 680450f3b4).

Therefore this is a partial rewrite of virt-df so that in this case it
now uses parallel appliances.

Notes:

The '--one-per-guest' option is now the default and only way to do
things; this option now does nothing.

By default, the amount of parallelism to use is controlled by the
amount of free memory seen when virt-df starts up (subject to some
minima and maxima).  The user can control this through new command
line option '-P'.
2013-02-26 17:02:32 +00:00
Richard W.M. Jones
76266be549 lib: Export guestfs___add_libvirt_dom for use by virt-df and virt-alignment-scan.
See the comment in guestfs-internal-frontend.h in this commit.
2013-02-26 17:02:32 +00:00
Richard W.M. Jones
556e109765 tools: Introduce a mini-library for estimating max threads based on free memory.
This mini-library runs the 'free -m' command and greps the output to
estimate the max. number of libguestfs appliances we could run in
parallel in the remaining free memory.
2013-02-26 17:02:23 +00:00
Richard W.M. Jones
f8b92c0668 df: Always have TESTS= line even if appliance is disabled. 2013-02-26 17:02:23 +00:00
Richard W.M. Jones
a885dd025d virt-alignment-scan: Set LANG=C in test. 2013-02-26 17:02:23 +00:00
Richard W.M. Jones
4a6c8021b5 lib: Add a global MIN macro to guestfs-internal-all.h. 2013-02-26 10:13:00 +00:00
Richard W.M. Jones
d02610853d Version 1.21.14. 2013-02-25 17:39:11 +00:00
Hilko Bengen
ff0269e80f out-of-tree build: fix test-tool
(Not entirely sure whether using Gnulib to replace standard functions
is a good idea at all.)

link with libgnu:
  CCLD   libguestfs-test-tool
libguestfs_test_tool-test-tool.o: In function `main':
/home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:103: undefined reference to `rpl_getopt_long'
/home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:113: undefined reference to `rpl_optarg'
/home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:125: undefined reference to `rpl_optarg'
/home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:126: undefined reference to `rpl_optarg'
/home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:109: undefined reference to `rpl_optarg'
libguestfs_test_tool-test-tool.o: In function `set_qemu':
/home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:382: undefined reference to `rpl_perror'
/home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:366: undefined reference to `rpl_perror'
libguestfs_test_tool-test-tool.o: In function `make_files':
/home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:416: undefined reference to `rpl_perror'
/home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:428: undefined reference to `rpl_perror'
2013-02-25 16:21:48 +00:00
Hilko Bengen
cd1558b89e out-of-tree build: fix daemon
CC     guestfsd-9p.o
In file included from ../../../daemon/9p.c:32:0:
../../../daemon/daemon.h:33:34: fatal error: guestfs-internal-all.h: No such file or directory
2013-02-25 16:21:48 +00:00
Richard W.M. Jones
680450f3b4 docs: Update guestfs-performance with parallel scaling numbers and test script. 2013-02-25 16:01:15 +00:00
Olaf Hering
ff80a54011 lib: avoid pragma usage in inspect-fs-windows
pragma GCC diagnostic is a gcc 4.6+ feature, compilation fails with
older compilers:

inspect-fs-windows.c: In function 'map_registry_disk_blob':
inspect-fs-windows.c:502: error: #pragma GCC diagnostic not allowed inside functions
inspect-fs-windows.c:503: error: #pragma GCC diagnostic not allowed inside functions
inspect-fs-windows.c:505: error: #pragma GCC diagnostic not allowed inside functions
make[3]: *** [libguestfs_la-inspect-fs-windows.lo] Error 1

Use memcpy instead of pragma to fix compile error.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2013-02-25 11:18:36 +00:00
Richard W.M. Jones
455d6b1845 recipes: Add example converting from one format/filesystem to another. 2013-02-23 20:59:26 +00:00
Richard W.M. Jones
fadec0687f daemon: protocol: Fix memory leak when receiving FileIn file (RHBZ#914934).
This fixes commit 950951c67d.
2013-02-23 20:32:33 +00:00
Richard W.M. Jones
4136850f3c tests: Add a regression test for RHBZ#914931.
This involves adding a new test API which crashes the appliance in the
middle of a simulated upload, then a test which uses that API to test
for the libguestfs (library-side) crash.
2013-02-23 20:23:51 +00:00
Richard W.M. Jones
7953128ca6 protocol: Don't segfault if appliance crashes during FileIn upload (RHBZ#914931).
Instead of the segfault you now get a more informative error:

*stdin*:0: libguestfs: error: connection to daemon was closed unexpectedly.
This usually means the libguestfs appliance crashed.  Please enable
debugging (LIBGUESTFS_DEBUG=1) and rerun the command, then look at the
debug messages output prior to this error.
libguestfs: error: /dev/stdout: write: Broken pipe
libguestfs: error: file receive cancelled by daemon
2013-02-23 20:23:39 +00:00
Richard W.M. Jones
d950e1a3bc run: Refer to README and correct documentation for linking to script.
Any link works, even a hard link.
2013-02-23 08:19:10 +00:00
Richard W.M. Jones
1ca842d98b run: Relicense as LGPLv2+.
To allow reuse in other projects and because of the equivalent change
made by Eric Blake to the libvirt 'run' script.
2013-02-23 08:15:23 +00:00
Richard W.M. Jones
37796d70bf Update API support. 2013-02-20 23:20:45 +00:00
Richard W.M. Jones
b49eefdb15 Version 1.21.13. 2013-02-20 22:23:20 +00:00
Richard W.M. Jones
9d6aa8b537 Use guestfs___count_strings instead of custom versions in various places. 2013-02-20 22:18:10 +00:00
Richard W.M. Jones
907fbfff53 python: Use guestfs___free_string_list instead of custom version. 2013-02-20 22:18:10 +00:00
Richard W.M. Jones
4ede94ab7b ocaml: Use guestfs___free_string_list instead of custom-coded one.
It should be possible to add the guestfs___free_string_list to
dllmlguestfs.so, but I cannot work out exactly how to do this.  As a
result we end up using src/utils.c directly.
2013-02-20 22:18:10 +00:00
Richard W.M. Jones
6ee164d47a ocaml: Missing #include <config.h> in generated file. 2013-02-20 22:18:10 +00:00
Richard W.M. Jones
27e6347b75 lua: Use guestfs___free_string_list instead of custom-coded version. 2013-02-20 22:18:09 +00:00
Richard W.M. Jones
0b7acf50b6 fish: Use guestfs___{free_string_list,count_strings} utility functions.
Instead of custom-coded versions.
2013-02-20 19:32:11 +00:00
Richard W.M. Jones
e27295c578 libutils: Add guestfs___count_strings utility function to common library. 2013-02-20 19:24:21 +00:00
Richard W.M. Jones
7ef461948e erlang: Use guestfs___free_string_list from libutils, instead of custom version. 2013-02-20 19:16:47 +00:00
Richard W.M. Jones
04723b4dd1 lib: Create libutils convenience library.
The libutils convenience library is a place for code shared between
the main library, language bindings and virt tools.  Note that the
code is statically linked into both the library, each binding and each
tool, but this is an improvement because (a) the source is shared and
(b) libguestfs.so can export fewer private functions.

Currently it contains the cleanup functions, and the functions
guestfs___free_string_list function and guestfs___for_each_disk.

guestfs___for_each_disk has changed so that it no longer
unconditionally sets the error in the guestfs handle.  Instead callers
can control error handling.
2013-02-20 19:15:05 +00:00
Richard W.M. Jones
a4953090e1 lib: Rename guestfs_error_errno as guestfs___error_errno, etc.
These are internal functions.  Very old versions of libguestfs used to
export them, but they haven't been (and shouldn't be) exported for a
long time.

Also remove the unused guestfs_error function.
2013-02-20 17:09:52 +00:00
Richard W.M. Jones
1a2465c187 build: Remove long and mostly irrelevant comment about libtool versioning. 2013-02-20 16:05:11 +00:00
Richard W.M. Jones
2101324965 build: Rearrange src/Makefile.am into a more logical order.
This is just code motion.
2013-02-20 16:03:14 +00:00
Richard W.M. Jones
6566621345 tests: Add valgrind suppression for libvirt 1.0.2 memory leak.
Leak reported as RHBZ#913145.
2013-02-20 14:20:08 +00:00
Richard W.M. Jones
b7ab6de628 tests: Add valgrind suppression variant for new manifestation of an old libvirt memory leak. 2013-02-20 14:19:37 +00:00
Richard W.M. Jones
61162bdce1 lib: Use CLEANUP_* macros to simplify XPath query code. 2013-02-20 13:50:43 +00:00
Richard W.M. Jones
b10a6cfe24 rescue: Improve error messages in the test script. 2013-02-20 11:28:50 +00:00
Richard W.M. Jones
175d6ba432 faq: Add section for developers, including how to send patches and propose features. 2013-02-20 10:30:44 +00:00
Richard W.M. Jones
065861ce6b docs: Rewrite security section (thanks Dan Berrange). 2013-02-20 10:08:21 +00:00
Richard W.M. Jones
8671cfa343 Version 1.21.12. 2013-02-19 19:19:29 +00:00
Richard W.M. Jones
a1c89bf03d build: Only add 'serial-tests' for automake >= 1.12 (thanks Hilko Bengen).
Earlier versions of automake complain if they get a configuration
parameter which they don't understand.  The error is:

configure.ac:27: error: option 'serial-tests' not recognized

Use some m4 hackery to work around this.
2013-02-19 19:19:22 +00:00
Richard W.M. Jones
c7ba91761c handle: Define DEFAULT_MEMSIZE, MIN_MEMSIZE constants.
This is just code motion.
2013-02-19 14:30:20 +00:00
Richard W.M. Jones
70514c7f7e ruby: Add binding for guestfs_event_to_string. 2013-02-19 13:41:58 +00:00
Richard W.M. Jones
0f849029d1 python: Add binding for guestfs_event_to_string. 2013-02-19 13:41:58 +00:00
Richard W.M. Jones
e9d83e94a2 perl: Add binding for guestfs_event_to_string. 2013-02-19 13:41:58 +00:00
Richard W.M. Jones
7e71c9fb34 java: Use guestfs_event_to_string instead of generated code. 2013-02-19 13:41:58 +00:00
Richard W.M. Jones
2a8de9001e fish: Use guestfs_event_to_string instead of guestfish-specific generated functions. 2013-02-19 13:41:57 +00:00
Richard W.M. Jones
5c513060b1 ocaml: Add binding for Guestfs.event_to_string and use it in events test. 2013-02-19 13:41:57 +00:00
Richard W.M. Jones
b793fafcb7 New C only API: guestfs_event_to_string. 2013-02-19 13:41:57 +00:00
Richard W.M. Jones
6902f093ff handle: Translatable string in guestfs_parse_environment. 2013-02-18 14:02:21 +00:00
Richard W.M. Jones
0e0eec76d9 generator: Whitespace changes. 2013-02-18 13:04:24 +00:00
Richard W.M. Jones
cbfa394bfc lib: Fix memory leak when the 'lpj' setting is read from dmesg.
It was failing to clean up and close the 'struct command' buffer,
because commit 94d90f03e2 added an
incomplete patch to use CLEANUP_CMD_CLOSE.

This fixes commit 94d90f03e2.
2013-02-15 14:44:22 +00:00
Richard W.M. Jones
5c6895bda1 java: Print a better error message when JVM version is too old.
This fixes commit 87d1f7714f.
2013-02-15 14:25:25 +00:00
Richard W.M. Jones
87d1f7714f java: Note that JVM >= 1.6 is now required. 2013-02-15 12:57:19 +00:00
Richard W.M. Jones
c598e14052 appliance: Use a glibc trick to try to display a stack trace if a program in the appliance segfaults. 2013-02-14 22:15:25 +00:00
Richard W.M. Jones
989d3c7691 Version 1.21.11. 2013-02-14 18:10:02 +00:00
Richard W.M. Jones
9021351c8e tests: mountable: Add test-mountable-inspect.sh to EXTRA_DIST.
This fixes commit 7d976657e6.
2013-02-14 16:33:29 +00:00
Matthew Booth
52b7418670 Fix API doc errors 2013-02-13 10:38:59 +00:00
Matthew Booth
f0f8d7ce78 gobject: Fix doc generation of L<guestfs(3)/CVE-2010-3851> 2013-02-13 10:30:51 +00:00
Richard W.M. Jones
23f8bd4fac daemon: Fix RESOLVE_MOUNTABLE, internal_parse_mountable.
- The mountable->volume field was not being initialized on the
  device path.

- XDR string fields cannot be NULL.

This fixes commit 7d976657e6.
2013-02-12 17:09:44 +00:00
Richard W.M. Jones
db554cf271 tests: mountable: Print error message if guestfs_create fails. 2013-02-12 17:02:33 +00:00
Richard W.M. Jones
4f7d1b3ae7 tests: Add Fedora btrfs phony guest to target list.
This fixes commit 754e819438.
2013-02-12 17:01:44 +00:00
Richard W.M. Jones
77c57ab843 tests: Reorder the tests so test guest is created before it's used by mountable test.
This fixes commit 7d976657e6.
2013-02-12 17:00:10 +00:00
Richard W.M. Jones
1399005d7e examples: Ensure each example program is documented. 2013-02-12 16:31:10 +00:00
Richard W.M. Jones
e84d6e6102 examples: Rename example programs, replacing '_' with '-'. 2013-02-12 16:31:10 +00:00
Matthew Booth
4215d0ca68 mountable: Test inspection of fedora image 2013-02-12 15:51:15 +00:00
Matthew Booth
7ba0e10501 inspect: Update inspect_os to use mountables
This fixes inspection of guests which use btrfs subvolumes.
2013-02-12 15:51:15 +00:00
Matthew Booth
7d976657e6 New internal API: internal_parse_mountable 2013-02-12 15:51:06 +00:00
Matthew Booth
b0abf10b9f build: Minor cleanup in daemon/Makefile.am 2013-02-12 15:29:19 +00:00
Matthew Booth
754e819438 btrfs: Make a stub Fedora btrfs guest for inspection testing 2013-02-12 13:49:26 +00:00
Matthew Booth
6e7f052ef4 mountable: Make list-filesystems return btrfsvols 2013-02-12 13:45:54 +00:00
Matthew Booth
bcb933a0c1 btrfs: Update btrfs_subvolume_list to take Mountable_or_Path
btrfs_subvolume_list can now take either the path of a mounted btrfs
filesystem, or a mountable describing the location of a btrfs
filesystem, or one of its volumes. In the latter case, the filesystem
will be automatically mounted outside of /sysroot before running the
btrfs tool, and unmounted afterwards.
2013-02-12 13:39:14 +00:00
Matthew Booth
72aaf56fed mount: Add mount_vfs_nochroot
This internal function allows mounting a mountable outside /sysroot.
2013-02-12 13:38:51 +00:00
Richard W.M. Jones
ec6a4de37a faq: Add common questions about virt-resize/virt-sparsify in place support. 2013-02-12 12:04:35 +00:00
Richard W.M. Jones
954e315d21 faq: Fix some small typos in section on virt-sparsify. 2013-02-12 11:56:16 +00:00
Richard W.M. Jones
6c5577e403 faq: Update RHEL information. 2013-02-12 11:55:45 +00:00
Richard W.M. Jones
cd47df1fe5 test-tool: Point to SELinux documentation for further information. 2013-02-12 10:55:26 +00:00
Richard W.M. Jones
0e79b9dd03 examples: Add all the C examples to the guestfs-examples(3) man page. 2013-02-11 21:44:39 +00:00
Richard W.M. Jones
09c4f94c9d build: Separate out *_CPPFLAGS from *_CFLAGS.
This is pretty pointless.
2013-02-11 21:36:27 +00:00
Richard W.M. Jones
bbb637f962 test-tool: Get rid of the "=== Test starts here ===" banner.
It confuses things, because that is not always the start
of the output.
2013-02-11 21:22:25 +00:00
Richard W.M. Jones
ee61d16e3e test-tool: Display SELinux status in output of libguestfs-test-tool. 2013-02-11 21:21:01 +00:00
Richard W.M. Jones
45b4271579 Version 1.21.10. 2013-02-11 19:38:55 +00:00
Richard W.M. Jones
05444da983 tests: Add a regression test for stack overflow in events (RHBZ#909624).
Note this is a check-slow test since generating 1,000,000 progress
events take a few minutes.
2013-02-11 18:15:48 +00:00
Richard W.M. Jones
b3cf5d1d96 proto: Fix stack overflow when there are many progress events (RHBZ#909624).
Thanks: Eric Blake.
2013-02-11 18:15:48 +00:00
Richard W.M. Jones
a43f88b1c5 daemon: Allow rate to be specified in 'debug progress'.
There are now two forms of the 'debug progress' command:

(1) debug progress <n> (the original form) generates ordinary
rate-limited progress messages for <n> seconds.

(2) debug progress <n> <rate> generates progress messages every <rate>
microseconds for <n> seconds.

The second form omit the usual rate-limiting, and so wouldn't
be generated like this from an ordinary API call.  However this
is useful for testing events (see RHBZ#909624).
2013-02-11 18:02:55 +00:00
Matthew Booth
942e139562 mountable: Implement Mountable_or_Path
A Mountable_or_Path argument is passed as a mountable_t. A new type is
added to mountable_t to handle already mounted paths.
2013-02-11 16:54:42 +00:00
Richard W.M. Jones
93d4fddaef lib: Add format attribute for GCC 4.8 in two places. 2013-02-11 16:10:17 +00:00
Richard W.M. Jones
984431a9ef daemon: Force disable -Wsuggest-attribute=format warning around asprintf_nowarn, for GCC 4.8. 2013-02-11 16:10:17 +00:00
Richard W.M. Jones
f226133c1a lib: Define GUESTFS_GCC_VERSION in the internal header.
Note that you have to use this as follows:

#if defined(__GNUC__) && GUESTFS_GCC_VERSION >= x0y0z /* gcc >= x.y.z */

since GUESTFS_GCC_VERSION is not defined unless it's GCC.
2013-02-11 16:10:17 +00:00
Matthew Booth
ef2276654e generator: Create Mountable_or_Path, initially identical to Dev_or_Path 2013-02-11 15:43:53 +00:00
Matthew Booth
47b929b789 mountable: Implement Mountable support for all apis which take it
A Mountable is passed from the library to the daemon as a string. The daemon
stub parses it into a mountable_t, which it passes to the implementation.

Update all implementations which now take a mountable_t.
2013-02-11 15:42:58 +00:00
Matthew Booth
d5817537fa generator: Convert relevant arguments from Device to Mountable
This change updates the api style of all apis which should take Mountable
descriptions rather than block devices. It also updates the documentation
accordingly, but doesn't implement any functional changes.
2013-02-11 15:39:31 +00:00
Richard W.M. Jones
007c2f236d test-tool: Document how to change SELinux settings. 2013-02-11 14:14:36 +00:00
Richard W.M. Jones
b1a89d3b1c test-tool: Document how to run with alternate libvirt. 2013-02-11 14:13:44 +00:00
Richard W.M. Jones
3877cab329 test-tool: exec qemu in the wrapper script.
This ensures that libvirt can control qemu directly, eg. being able to
send it signals.
2013-02-11 13:41:40 +00:00
Richard W.M. Jones
20fd81147d test-tool: On i386, upstream qemu program is now called 'qemu-system-i386'.
For a while, the upstream qemu i386 emulator has been called
'qemu-system-i386' (instead of just 'qemu').  Fix test-tool so it
calls the right program.
2013-02-11 13:21:51 +00:00
Richard W.M. Jones
df983d1994 test-tool: Don't call guestfs_set_qemu before guestfs handle is initialized (RHBZ#909836).
Because of evolution of the code, if the user used the --qemu or
--qemudir options, libguestfs-test-tool would segfault because
guestfs_set_qemu was being called before the guestfs handle was
opened.

Change the code so this doesn't happen, and also remove the global 'g'
variable to make the code a bit more robust.

Bug found by Amit Shah.
2013-02-11 13:21:51 +00:00
Richard W.M. Jones
e4495b24bc daemon: link: Remove use of PATH_MAX.
Replace readlink calls with gnulib areadlink function.
2013-02-11 13:21:51 +00:00
Richard W.M. Jones
c3afef3eec daemon: xattr: Remove use of PATH_MAX. 2013-02-11 13:21:51 +00:00
Richard W.M. Jones
09f3913734 daemon: realpath: Remove use of both PATH_MAX and NAME_MAX. 2013-02-11 13:21:51 +00:00
Richard W.M. Jones
9c9ceec6b7 daemon: initrd: Remove use of PATH_MAX and other cleanups.
- Move variables to the top.
- Rearrange comments to make more sense.
2013-02-11 13:21:51 +00:00
Richard W.M. Jones
1703c6841b daemon: find0: Remove use of PATH_MAX. 2013-02-11 13:21:51 +00:00
Richard W.M. Jones
e527aed895 getline: Rename &n parameter as &allocsize.
The second parameter passed into getline(3) is the size of the
allocated buffer, *NOT* the length of the returned line.  This can be
confusing, so rename this parameter as 'allocsize' consistently
throughout the code.

This is just code motion.
2013-02-11 13:21:51 +00:00
Richard W.M. Jones
e0a3a7c1e5 docs: Improve reasons for using libguestfs-make-fixed-appliance.
Thanks: Richard Harman.
2013-02-09 22:38:24 +00:00
Richard W.M. Jones
d6c0ff055d launch: libvirt: Make it clear that setsockcreatecon debug message is just a warning.
This was disturbing to some users, but other users saw the warning
when it was really something they should pay attention to.  Make it
clear that it's a warning, unless people are really using SELinux +
sVirt.

Thanks: Richard Harman.
2013-02-09 21:29:35 +00:00
Richard W.M. Jones
8ad8e1075b Version 1.21.9. 2013-02-09 21:02:11 +00:00
Richard W.M. Jones
d538af8a0a rescue: Count the mountable filesystems when displaying the 'suggest' message. 2013-02-09 20:53:18 +00:00
Richard W.M. Jones
4255db65e5 tools: Use CLEANUP_* macros in several C tools. 2013-02-09 20:37:03 +00:00
Richard W.M. Jones
20a562321c generator: Export libxml2 CLEANUP_* macros unconditionally.
These call abort() if libxml2 is not actually installed, but that
should never happen inside the library or tools.
2013-02-09 17:49:11 +00:00
Richard W.M. Jones
94d90f03e2 lib: Define CLEANUP_CMD_CLOSE macro and use it throughout the library. 2013-02-08 18:14:41 +00:00
Richard W.M. Jones
59b296fecc tools, tests: Use "guestfs-internal-frontend.h" header.
Instead of redefining STREQ, etc.
2013-02-08 16:15:25 +00:00
Richard W.M. Jones
30029b7ffb lib: Use CLEANUP_FREE_<struct>, CLEANUP_FREE_<struct>_LIST macros in a few places in the library. 2013-02-08 16:12:04 +00:00
Richard W.M. Jones
5f54da6fdf lib: Add CLEANUP_FREE_<struct>, CLEANUP_FREE_<struct>_LIST macros for API structs.
For example:

 {
   CLEANUP_FREE_STAT struct guestfs_stat *stat = guestfs_stat (g, "/foo");

   // stat is freed automatically when we leave the scope.
 }

The new header file "guestfs-internal-frontend-cleanups.h"
includes definitions for these.  It should not be included
directly.
2013-02-08 16:12:04 +00:00
Richard W.M. Jones
5e770c8f6a lib: Allow guestfs_free_* functions to be safely called with a NULL pointer.
This is so they work just like 'free'.
2013-02-08 16:12:04 +00:00
Richard W.M. Jones
7b7cfa62e3 lib: Remove explicit defines of _BSD_SOURCE.
An equivalent is defined already in <config.h>.
2013-02-08 16:12:04 +00:00
Richard W.M. Jones
cab1a0c1d9 generator: Add #ifndef defense around guestfs-internal-actions.h file. 2013-02-08 15:48:52 +00:00
Matthew Booth
8fb2306be4 generator: Add new Mountable argument type
This type is initially identical to Device.
2013-02-08 14:59:00 +00:00
Matthew Booth
6e7f95b669 inspect: Fix improperly ignored error in check_filesystem 2013-02-08 14:53:05 +00:00
Matthew Booth
7d6b5bb837 inspect: Don't re-implement list_filesystems in inspect_os 2013-02-08 14:42:37 +00:00
Matthew Booth
dd58db7329 Fix bogus partition number passed to guestfs___check_for_filesystem_on
Partition number was being passed to guestfs___check_for_filesystem_on
based on an index in list_partition. However, this ignores the
possibility of multiple block devices.

This change makes guestfs___check_for_filesystem_on examine the
passed-in device directly to determine if it is a whole device, or
what its partition number is.
2013-02-08 14:42:37 +00:00
Matthew Booth
a7d7e8176f New API: is_whole_device 2013-02-08 14:42:37 +00:00
Matthew Booth
3045c0cbaf btrfs: Fix btrfs_subvolume_list on F18 (RHBZ#903620).
The output of btrfs subvolume list has changed in F18 to include generation,
which breaks the parsing in btrfs_subvolume_list. This change replaces sscanf
with a more robust regular expression. The new regular expression should also
handle the addition of future unexpected columns.
2013-02-08 09:09:25 +00:00
Richard W.M. Jones
c78ec7e085 daemon: Check parameter of base64-out and tar-out before running external command (RHBZ#908322).
For base64-out, check the filename parameter exists and is not a
directory.

For tar-out, check the dir parameter exists and is a directory.
2013-02-06 14:56:56 +00:00
Matthew Booth
ca056d53bd generator: Add visibility to action struct
The visibility field in action replaces in_fish, in_docs and internal.
The defined types are:

VPublic:
  A public API. This is exported and documented in all language
  bindings, and in guestfish.

VStateTest:
  A public API which queries the library state machine. It is exported
  and documented in all language bindings, but not guestfish.

VBindTest:
  An internal API used only for testing language bindings. It is
  guarded by GUESTFS_PRIVATE in the C api, but exported by all other
  language bindings as it is required for testing. If language
  bindings offer any way to guard use of these apis, that mechanism
  should be used. It is not documented anywhere.

VDebug:
  A debugging API. It is exported by all language bindings, and in
  guestfish, but is not documented anywhere.

VInternal:
  An internal-only API. It is guarded by GUESTFS_PRIVATE in the C api,
  and not exported at all in any other language binding. It is not
  documented anywhere.
2013-02-06 13:53:28 +00:00
Richard W.M. Jones
f9bafde5e7 daemon: download: Add extra check that download file is not a directory (RHBZ#908321). 2013-02-06 13:27:26 +00:00
Richard W.M. Jones
f473a173b8 daemon: Add more information to certain calls to perror.
Replace selected calls to 'perror (filename)' with:

  fprintf (stderr, "syscall: %s: %m\n", filename);

so that more information is available about precisely which syscall
failed.

Note this is *not* reply_with_perror.  These messages are only printed
in verbose output, for the benefit of debugging.
2013-02-06 13:14:07 +00:00
Richard W.M. Jones
f631e84102 9p: Missing call to reply_with_perror. 2013-02-06 12:59:00 +00:00
Richard W.M. Jones
c98ef8d089 Version 1.21.8. 2013-02-05 20:27:25 +00:00
Richard W.M. Jones
a0a4ee5245 Use 'supermin' and 'supermin-helper' in preference to febootstrap.
Febootstrap has been renamed upstream to 'supermin':
https://www.redhat.com/archives/libguestfs/2013-February/msg00004.html

This commit changes libguestfs so it can use either program to build
the supermin appliance.
2013-02-05 15:31:05 +00:00
Richard W.M. Jones
72dd398679 daemon: Call wipefs before mkfs to work around pathological behaviour in btrfs.
See: RHBZ#907554, http://www.spinics.net/lists/linux-btrfs/msg21197.html
2013-02-04 21:54:15 +00:00
Richard W.M. Jones
7e25e0780e FAQ: Update section on sVirt. 2013-02-04 21:54:08 +00:00
Richard W.M. Jones
4075ed9247 build: Add src/guestfs-internal-{all,frontend}.h to EXTRA_DIST.
This fixes commit ec3b75e5ff.
2013-02-04 13:12:28 +00:00
Richard W.M. Jones
776ffbfaec Version 1.21.7. 2013-02-04 13:03:25 +00:00
Richard W.M. Jones
4940bd9a9e fish: Be stricter about boolean values.
Previously I noticed that bfan used this command without any error:

><fs> hivex-open /WINDOWS/system32/config/software write:ture
                                                   ^^^^^^^^^^

This was because the code allowed any string to be evaluated as a
boolean.

The new code is stricter.  It allows the following strings only case
insensitive (everything else is an error):

  1
  true
  t
  yes
  y
  on

  0
  false
  f
  no
  n
  off
2013-02-04 12:45:02 +00:00
Richard W.M. Jones
d012b729fa ruby: Include "guestfs-internal-frontend.h" in extension.
Also undefine '_' symbol defined by Ruby's internal headers.

This fixes commit ec3b75e5ff.
2013-02-04 12:17:52 +00:00
Richard W.M. Jones
9e27a1556c perl: Include "guestfs-internal-frontend.h" in XS file.
Also undefine '_' symbol defined by Perl's internal headers.

This fixes commit ec3b75e5ff.
2013-02-04 11:49:04 +00:00
Richard W.M. Jones
5e4f03ccf2 README: Format the list of requirements better. 2013-02-02 15:24:23 +00:00
Richard W.M. Jones
0d18a8b407 Update copyright dates for 2013. 2013-02-02 13:56:19 +00:00
Richard W.M. Jones
791ad3e9e6 fish: Use CLEANUP_* macros in a lot of places. 2013-02-01 16:18:42 +00:00
Richard W.M. Jones
6c1aca5ae2 fish: Use CLEANUP_FREE in parse_config. 2013-02-01 15:54:13 +00:00
Richard W.M. Jones
4b20a20d33 Remove TMP_TEMPLATE_ON_STACK macro. 2013-02-01 14:48:35 +00:00
Richard W.M. Jones
42bffcd00a Remove all occurrences of the bad_cast (lowercase) function.
Not to be confused with the libxml2 macro 'BAD_CAST' which converts
from 'signed char *' to 'unsigned char *'.

The 'bad_cast' function was defined and used all over the place as a
replacement for a '(char *)' cast.  I think it is better to make these
casts explicit, instead of hiding them in an obscure function.
2013-02-01 14:16:51 +00:00
Richard W.M. Jones
ec3b75e5ff Rearrange internal header files.
This commit rearranges the internal header files.

"src/guestfs-internal.h" is just for the library, as before.

"src/guestfs-internal-frontend.h" is for use by all library, bindings,
tools C code, but NOT the daemon.

"src/guestfs-internal-all.h" is for use by all C code including the
daemon.

This is just code motion, but it has some important consequences:

(1) We can use the CLEANUP_* macros in bindings and tools code.

(2) We can get rid of TMP_TEMPLATE_ON_STACK.

(3) We will (in future) be able to stop bindings and tools code from
using the safe_* allocation functions (which are NOT safe to use
outside the library alone).
2013-02-01 14:07:25 +00:00
Cole Robinson
63c324e6c4 tests: Handle changing QEMUDIR
qemu-wrapper isn't regenerated if QEMUDIR is changed, so just
delete it and force regeneration.

Additionally we can drop the silent binary check, since
check-with-upstream-qemu-1 already does a similar test with --version
that will actually report an error to the user.
2013-01-31 16:30:28 +00:00
Matthew Booth
27b995c841 Make internal-only functions and structures private
Certain functions are intended to be internal only, but we currently
export them anyway. This change moves them into a separate section of
guestfs.h protected by a GUESTFS_PRIVATE variable. This change also
enables private structs, but doesn't implement any.

This change only affects the C api. Language bindings aren't affected,
but probably should be in the future.
2013-01-30 17:27:01 +00:00
Matthew Booth
1dd9bf73b7 build: Fix haskell dependencies and parallel build
Without this change all the tests in the haskell bindings are rebuilt
every time. The primary motivation for this change is to fix this.

The fix for the above also allows parallel builds to be re-enabled.
2013-01-30 10:53:02 +00:00
Matthew Booth
63c50c7847 build: Add common rule for sources shared between daemon and library 2013-01-29 16:24:08 +00:00
Richard W.M. Jones
be4a3d77c4 daemon: hivex: Rewrite filename param of hivex_commit to include sysroot (RHBZ#905341). 2013-01-29 10:21:51 +00:00
Richard W.M. Jones
908c45567c Version 1.21.6. 2013-01-28 18:42:05 +00:00
Richard W.M. Jones
950951c67d daemon: Use the new CLEANUP_* macros to simplify code. 2013-01-28 18:01:43 +00:00
Richard W.M. Jones
233055974d daemon: Add CLEANUP_* macros which automatically free memory when leaving scope.
cf commit 98b64650c8
2013-01-28 18:01:39 +00:00
Richard W.M. Jones
071de5ccfb daemon: Allow free_strings (NULL) and free_stringslen (NULL, ..).
Equivalent to free (NULL).
2013-01-28 18:01:20 +00:00
Richard W.M. Jones
3a8a62c3e4 lib: Further use of CLEANUP_* macros. 2013-01-28 18:01:19 +00:00
Richard W.M. Jones
cd3b626a33 launch: libvirt: Use CLEANUP_* macros.
Also implement macros for cleaning up libxml2 objects.
2013-01-28 18:01:19 +00:00
Richard W.M. Jones
5a3da36626 inspect: Use CLEANUP_* macros in inspection code. 2013-01-28 18:01:19 +00:00
Richard W.M. Jones
98b64650c8 lib: Add CLEANUP_* macros which automatically free things when leaving scope.
Use the macro like this to create temporary variables which are
automatically cleaned up when the scope is exited:

  {
    CLEANUP_FREE char *foo = safe_strdup (bar);
    ...
    // no need to call free (foo)!
  }

The following code is also valid.  The initialization of foo as 'NULL'
prevents any chance of free being called on an uninitialized pointer.
It may not be required in all cases.

  {
    CLEANUP_FREE char *foo = NULL;
    ...
    foo = safe_malloc (100);
    ...
    // no need to call free (foo)!
  }

This is also valid:

  {
    CLEANUP_FREE char *foo = ..., *bar = ...;
    ...
    // no need to call free (foo) or free (bar)!
  }

The CLEANUP_FREE_STRING_LIST macro calls guestfs___free_string_list
on its argument.  The argument may be NULL.

The CLEANUP_HASH_FREE macro calls hash_free on its argument.  The
argument may be NULL.

Important implementation note:
------------------------------

On GCC and LLVM, this is implemented using __attribute__((cleanup(...))).

There is no known way to implement this macro on other C compilers, so
this construct will cause a resource leak.

Important note about close/fclose:
----------------------------------

We did NOT implement 'CLEANUP_CLOSE' or 'CLEANUP_FCLOSE' macros.  The
reason is that I am not convinced that these can be used safely.  It
would be OK to use these to collect file handles along failure paths,
but you would still want a regular call to 'close'/'fclose' since you
must test for errors, and so you end up having to do:

  if (close (fd) == -1) {
    // failure case
    // avoid double-close in cleanup handler:
    fd = -1;
    ...
  }
  // avoid double-close in cleanup handler:
  fd = -1;
  ...
2013-01-28 18:01:19 +00:00
Richard W.M. Jones
acb85dafb1 Allow guestfs___free_string_list (NULL).
Equivalent to free (NULL).
2013-01-28 18:01:19 +00:00
Richard W.M. Jones
aab796c608 perl, python, ruby: Add definition of EVENT_ALL in these languages. 2013-01-28 18:01:19 +00:00
Richard W.M. Jones
27c81f3175 generator: Define all_events_bitmask.
In the C bindings, use this more accurate mask instead of 'all bits
set'.

In the Java bindings, use this instead of open coding.
2013-01-28 18:01:19 +00:00
Richard W.M. Jones
ded72a96f0 header: Minor whitespace fix. 2013-01-28 18:01:19 +00:00
Richard W.M. Jones
f3976de591 header: Deprecate LIBGUESTFS_HAVE_* in favour of GUESTFS_HAVE_*. 2013-01-28 18:01:19 +00:00
Richard W.M. Jones
d3068a3aff header: Link to guestfs-examples(3) man page from header file. 2013-01-28 18:01:19 +00:00
Matthew Booth
a0d874725d Update vim line length to 70
Apparently this makes it the same as emacs or something.
2013-01-24 15:00:49 +00:00
Richard W.M. Jones
abb1d46636 python: Inherit from 'object' base class.
This fixes the following Debian bug:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=698771

For an overview, see this question and the links from there:
http://stackoverflow.com/questions/4015417/python-class-inherits-object
2013-01-24 13:09:16 +00:00
Richard W.M. Jones
ec8939fd47 launch: libvirt: Add 'is_root' flag to the params struct.
This is just code motion, but it allows us to read this flag inside
the 'construct_libvirt_xml_seclabel' function in future (as a possible
way to fix RHBZ#890291).
2013-01-22 14:43:37 +00:00
Richard W.M. Jones
085b86a95a libvirt: Add debugging when opening libvirt handle.
When debugging is enabled, this produces output like below.  This is
useful when diagnosing what URI libguestfs is using.

libguestfs: opening libvirt handle: URI = NULL, auth = virConnectAuthPtrDefault, flags = 0
libguestfs: successfully opened libvirt handle: conn = 0xb05580
2013-01-22 13:50:57 +00:00
Richard W.M. Jones
875dc11364 launch: libvirt: Refactor seclabel code.
This is just code motion.
2013-01-22 13:45:11 +00:00
Richard W.M. Jones
ed5a083891 Version 1.21.5. 2013-01-21 22:16:07 +00:00
Richard W.M. Jones
4d8bdf0357 fuse: Use guestfs_rename to implement rename(2) syscall (RHBZ#895910). 2013-01-21 17:00:04 +00:00
Richard W.M. Jones
159e8f8c3a New API: rename: Rename file within the same filesystem (RHBZ#895910). 2013-01-21 17:00:04 +00:00
Matthew Booth
f956457b5d docs: Fix cut/paste error in pread_device 2013-01-21 15:57:23 +00:00
Richard W.M. Jones
28e34290ff fuse: If guestfs_last_errno returns 0, don't return no error to FUSE layer.
guestfs_last_errno (g) == 0 doesn't mean "no error".  It means the
errno was not captured.  In this case we have to substitute some sort
of errno, so choose EINVAL arbitrarily.
2013-01-21 14:42:48 +00:00
Richard W.M. Jones
533082e282 daemon: Change ln, ln-f (hard-link) APIs to use link(2) instead of external ln (RHBZ#895905).
The reasons to do this are twofold:

(a) It's probably a tiny bit faster.

(b) It lets us capture the real errno if the link(2) syscall fails.

The errno is also passed through guestmount, fixing RHBZ#895905:

+ guestmount -a test1.img -m /dev/sda1:/ -m /dev/sda2:/boot /tmp/mnt
+ touch /tmp/mnt/foo
+ cd /tmp/mnt
+ ln foo boot/foo
ln: failed to create hard link ‘boot/foo’ => ‘foo’: Invalid cross-device link
2013-01-21 14:23:07 +00:00
Richard W.M. Jones
ebc86ae6d7 Fix checksums-out command (RHBZ#895904).
This was broken by the earlier
commit 0306c98d31.

This commit also adds a regression test.
2013-01-21 11:14:56 +00:00
Richard W.M. Jones
e18e20793f tests: virt-make-fs: Allow btrfs to be skipped. 2013-01-21 08:15:54 +00:00
Richard W.M. Jones
2974b5d666 tests/qemu: Don't require LVM for these tests. 2013-01-18 17:23:43 +00:00
Richard W.M. Jones
64b229e8ff Version 1.21.4. 2013-01-18 08:18:24 +00:00
Richard W.M. Jones
d8f14591d1 daemon: lvm: Fix various paths relative to new lvm_system_dir.
This fixes commit 9fd41abd40.
2013-01-18 07:13:54 +00:00
Richard W.M. Jones
312d02afe4 tests: Don't construct the guests in parallel.
In automake 1.13, check_DATA is now built in parallel, resulting in it
trying to build 4 or 5 guests in parallel.
2013-01-18 07:13:53 +00:00
Hilko Bengen
aa83e7c7b8 Fix packagelist for current Debian-based systems 2013-01-18 07:02:15 +00:00
Hilko Bengen
111f444d69 inspector: Fix tests for out-of-tree builds 2013-01-18 07:01:09 +00:00
Hilko Bengen
9637bddc33 erlang: fix bindtests for out-of-tree build 2013-01-18 07:01:07 +00:00
Richard W.M. Jones
24c4178749 appliance: Add libcap to the appliance (thanks Skippy VonDrake). 2013-01-18 06:42:13 +00:00
Richard W.M. Jones
2c68aca9d7 automake: Force serial-tests.
automake 1.13 started to use stupid parallel tests by default,
breaking everything.
2013-01-17 18:21:20 +00:00
Richard W.M. Jones
9c8e47247b FAQ: Document "Could not allocate dynamic translator buffer" and how to fix it. 2013-01-17 18:10:14 +00:00
Matthew Booth
c61b589f9b gobject: Add pkg-config for gobject bindings 2013-01-17 15:06:09 +00:00
Olaf Hering
9fd41abd40 daemon: copy entire lvm directory
cp will fail if /etc/lvm is an empty directory. Copy the entire
directory and adjust environment variable.

Signed-off-by: Olaf Hering <olaf@aepfle.de>

RWMJ:
 - Fixed a couple of whitespace issues.
2013-01-17 14:13:03 +00:00
Richard W.M. Jones
a710c42f0f Version 1.21.3. 2013-01-17 09:43:59 +00:00
Richard W.M. Jones
a0e9d310d1 ruby: Use updated package names, but allow fallback to the old names (RHBZ#894545).
Thanks Dominic Cleal.
2013-01-16 14:33:49 +00:00
Richard W.M. Jones
d4763a2e24 daemon: Suppress two false positives from Coverity.
Using // coverity[...] or /* coverity[...] */ comments in the source
it is possible to suppress specific Coverity errors.  The suppressed
error should occur in the line following the comment.

In this case I have suppressed two false positives from Coverity:

(a) We deliberately assign to a NULL pointer in order to cause a
segfault, for testing how the library reacts when this happens.
Coverity flags this, but it is not an error in this case.

(b) Coverity does not model global variables (a known shortcoming).
Therefore the code 'errno = posix_memalign (...)' cannot be modelled
by Coverity, even though the code is correct.  Coverity raises a false
positive about this.

(Thanks Kamil Dudka, Coverity)
2013-01-16 11:30:07 +00:00
Richard W.M. Jones
ce828c6afc podwrapper: Refresh podwrapper man page.
This also adds a rule so you can do:

 make podwrapper.1

if you want to read the documentation as a man page.
2013-01-15 18:40:17 +00:00
Richard W.M. Jones
0d2d26d8e7 java: Implement the event API. 2013-01-15 18:40:17 +00:00
Richard W.M. Jones
3f08d50863 java: Use defined constants for flags in call to guestfs_create_flags. 2013-01-15 18:40:17 +00:00
Richard W.M. Jones
05a67bcc25 java: Change synopsis in man page to show use of add_drive. 2013-01-15 18:40:16 +00:00
Richard W.M. Jones
7d89baa3e9 java: Tidy up javadoc. 2013-01-15 18:40:16 +00:00
Richard W.M. Jones
f58b6c5953 Refresh README file. 2013-01-15 18:40:16 +00:00
Richard W.M. Jones
20e23ab2a3 Update copyright dates for 2013.
On generated files in git and README.
2013-01-15 18:40:16 +00:00
Richard W.M. Jones
e051b270a2 haskell: Use unused bogus data types. 2012-12-29 14:28:47 +00:00
Richard W.M. Jones
bff29314df haskell: Typo in man page, lists -> list. 2012-12-29 13:57:24 +00:00
Richard W.M. Jones
60d744e32f haskell: Implement 'head' and 'tail' by hiding the Prelude functions. 2012-12-29 13:38:13 +00:00
Richard W.M. Jones
406e372469 haskell: Use 'import Guestfs as G' in test code.
The code is equivalent but shorter.
2012-12-29 13:35:07 +00:00
Richard W.M. Jones
67d59d0153 haskell: Document current state of Haskell bindings. 2012-12-29 13:26:38 +00:00
Richard W.M. Jones
1881be1e56 haskell: Fix RHashtable in the generator. 2012-12-29 13:16:07 +00:00
Richard W.M. Jones
3a72944597 haskell: Use .NOTPARALLEL in this directory. 2012-12-29 13:16:07 +00:00
Richard W.M. Jones
7718cb5afe haskell: Fix RStringList in generator. 2012-12-28 21:36:07 +00:00
Richard W.M. Jones
5ede0b21b0 haskell: Add tests of config functions. 2012-12-28 20:44:36 +00:00
Richard W.M. Jones
c9e0ff8831 haskell: Allow non-appliance tests to run when !ENABLE_APPLIANCE. 2012-12-28 20:19:20 +00:00
Richard W.M. Jones
604f9a79db haskell: Renumber tests according to Perl scheme. 2012-12-28 20:17:31 +00:00
Richard W.M. Jones
3e7dcc384a haskell: Enable RString, RConstString in generator. 2012-12-28 20:11:23 +00:00
Richard W.M. Jones
beebade874 haskell: Enable RBool in generator. 2012-12-28 19:59:31 +00:00
Richard W.M. Jones
11e111ec01 haskell: Replace deprecated INCLUDE directive.
The INCLUDE directive is obsolete.  You must now put the name of the
include file before the C function name.
2012-12-28 19:55:01 +00:00
Richard W.M. Jones
9ae248e03f arm: Recomment vexpress-a15 instead of vexpress-a9.
Neither works (because of lack of PCI) but A15 emulation is probably
better than A9 emulation.
2012-12-27 20:02:31 +00:00
Richard W.M. Jones
6c9aaf394f launch: appliance: Fix parsing of QEMU_OPTIONS.
If there was no quoting character, the options could run off the end
of the string and into whatever string which happened to be following
in memory.

This bug was revealed when libguestfs was compiled on arm.
2012-12-27 20:01:15 +00:00
Richard W.M. Jones
bcdaa46313 launch: appliance: Small refactoring of virtio-scsi detection code.
This is just code motion.
2012-12-27 19:36:33 +00:00
Richard W.M. Jones
a9d70d1ae4 Fix whitespace in configure.ac.
Standardize on 4 spaces for indentation in configure.ac file.
This is just a change of whitespace.
2012-12-27 18:55:34 +00:00
Richard W.M. Jones
364ee94b8d arm: Prevent -Wcast-align warnings.
See link below for a general description of the problem:

f8b62e4cd2
2012-12-27 18:08:55 +00:00
Richard W.M. Jones
5af94b5692 arm: Only use -device sga if qemu supports this device.
qemu-system-arm does not have the sgabios device.
2012-12-27 15:57:15 +00:00
Richard W.M. Jones
741c8606db lib: Remove useless cast.
'strings' is declared as char **, so the return type of
this expression will already be char *.  The cast is both
useless and potentially hides errors.
2012-12-27 15:27:20 +00:00
Richard W.M. Jones
4a877452f5 build: Fix ./configure --with-febootstrap-yum-config option.
This fixes commit bfddae7cee.

Also tested that all variants actually work.
2012-12-24 09:48:41 +00:00
Richard W.M. Jones
4b5d27869f Version 1.21.2. 2012-12-22 22:42:29 +00:00
Richard W.M. Jones
bfddae7cee build: Change --with-febootstrap-yum-config to --with-febootstrap-packager-config
For the rationale behind this renaming, see:
b8cbe191d0

You can still, for the time being, use
./configure --with-febootstrap-yum-config
but it's preferred to switch to the new option.  The new option is
identical, just renamed.

Qe still pass the deprecated --yum-config option to febootstrap
itself, since both old and new febootstrap support this.
2012-12-22 17:28:10 +00:00
Richard W.M. Jones
e73cf67762 inspection: Set fs->device field on swap devices.
For some reason the fs->device field was not set for swap devices.

Apparently this did not matter before (this bug has existed since at
least libguestfs 1.16), but in commit 6ee80b8dac we started to depend
on the fs->device field being non-NULL.  This resulted in segfaults
when inspecting any guest which had a swap device, eg:

 #0  __strcmp_sse42 () at ../sysdeps/x86_64/multiarch/strcmp-sse42.S:164
 #1  0x00007ffff7d740cb in parent_device_already_probed (g=0x703a70,
                        partition=0x6f79b0 "/dev/vda4") at inspect.c:156
 #2  0x00007ffff7d73e00 in guestfs__inspect_os (g=0x703a70) at inspect.c:83
 #3  0x00007ffff7cee11d in guestfs_inspect_os (g=0x703a70) at actions-1.c:397

This commit sets fs->device to the device name.

(Thanks Matthew Booth for first noticing this problem.)
2012-12-20 15:36:36 +00:00
Richard W.M. Jones
6628cc7ef6 Pass noapic on i686 kernel command line.
qemu 1.2 i686 TCG is buggy and hangs when emulating APIC.
https://bugzilla.redhat.com/show_bug.cgi?id=857026
2012-12-20 12:09:49 +00:00
Richard W.M. Jones
eca01c3105 faq: Suggest 'approx' (apt proxy) to speed up Debian builds.
Thanks Hilko Bengen.
2012-12-18 20:39:46 +00:00
Richard W.M. Jones
d1ad89520e tests: Skip windows.img tests if it is zero-sized.
If ntfs-3g is not installed, then tests/guests creates a 'windows.img'
file which is zero-sized.

This is problematical because other tests which use this image will
fail at best, or hit RHBZ#847549 (qemu/virtio-scsi bug) at worst.

Change the tests which use windows.img so they skip if 'windows.img'
has zero size.
2012-12-18 17:35:51 +00:00
Richard W.M. Jones
a34072e25b build: Add 'make print-subdirs' rule, useful for selectively running tests.
If you want to selectively run tests, or if the test suite fails half
way through, use:

  make print-subdirs

to print the subdirectories, select the ones you want to run / the
remaining ones, and do:

  make check SUBDIRS="..."
2012-12-18 16:28:23 +00:00
Richard W.M. Jones
fa162417ed daemon: Make gdisk into an optional dependency and optgroup.
Also document that gdisk is a dependency at all.

This fixes commit 956e30effa.
2012-12-18 11:52:41 +00:00
Richard W.M. Jones
2434a86da4 lua: tests: If $LUA is not set, set it to 'lua' instead of '/usr/bin/lua'. 2012-12-18 08:55:06 +00:00
Richard W.M. Jones
3f88f88c80 lua: Fix misapplied patch.
This fixes commit 5b70120293.
2012-12-18 08:53:34 +00:00
Richard W.M. Jones
8be9743e74 ruby: Disable -Wstrict-prototypes warning for Ruby headers. 2012-12-18 08:43:52 +00:00
Richard W.M. Jones
034d393bb1 docs: Properly document attach methods in the guestfs(3) man page. 2012-12-17 23:01:56 +00:00
Richard W.M. Jones
62f98d64a5 lua: Fix Lua configure test on Fedora.
On Debian, the lua pkg-config file is called "lua5.1.pc" (etc)
whereas on Fedora it's called "lua.pc" for all versions.
2012-12-17 23:01:56 +00:00
Hilko Bengen
5b70120293 lua: Use correct binary for tests 2012-12-17 22:24:53 +01:00
Hilko Bengen
f07e89c5f9 lua: Add ifdefs for Lua 5.2 compatibility 2012-12-17 22:24:53 +01:00
Hilko Bengen
05103cc693 lua: Use pkg-config to determine Lua version, parameters 2012-12-17 22:24:52 +01:00
Richard W.M. Jones
8237ac89c5 daemon: Use pvcreate --force option (RHBZ#887971).
pvcreate fails if the partition contains a swap space signature.  Use
more force to stop it from complaining.
2012-12-17 19:27:12 +00:00
Richard W.M. Jones
4ad6b28d83 Version 1.21.1. 2012-12-17 12:49:32 +00:00
Richard W.M. Jones
eab324bbbb list-filesystems: Ignore MBR type 0x42 (Windows dynamic disks) (RHBZ#887520). 2012-12-17 12:39:55 +00:00
Richard W.M. Jones
6f02e33c6f sparsify: Document that virt-sparsify doesn't work well on multi-disk VMs.
See: http://bugzilla.redhat.com/887826
2012-12-17 12:24:29 +00:00
Richard W.M. Jones
79339798b3 launch: libvirt: Improve loop invariant from previous commit.
This fixes commit 11b6293d1b.
2012-12-16 21:29:35 +00:00
Richard W.M. Jones
11b6293d1b launch: libvirt: Parse capabilities XML and fail early if qemu/KVM not supported (RHBZ#886915). 2012-12-16 20:56:39 +00:00
Richard W.M. Jones
c4ad2c0ce3 daemon: Fold stdout on stderr when running e2fsck.
User Phill Bandelow noted that virt-resize fails with an e2fsck error
on a host where the system clock had been accidentally set in the
past.

Unfortunately this was hard to diagnose because guestfsd 'ate' the
stdout of the e2fsck program.  I have verified by code inspection that
e2fsck prints messages on stdout.

Thus this changes the daemon to fold stdout and stderr together so we
get to see all error messages from e2fsck when it fails.
2012-12-16 18:38:41 +00:00
Richard W.M. Jones
22fe98ad9f build: Improve 'make help' output description of 'make extra-tests'. 2012-12-15 20:20:38 +00:00
Richard W.M. Jones
eca2dd2e8c build: Better formatting for 'make help' output.
This is just whitespace changes.
2012-12-15 20:15:12 +00:00
Richard W.M. Jones
486efb002a build: Show 'make -k check' as a possibility in 'make help' output.
Thanks to Cole Robinson for this suggestion.
2012-12-15 20:10:25 +00:00
Richard W.M. Jones
448a02373d ruby: Enable C compiler warnings.
This has the desirable side effect that the correct CFLAGS get passed
to the C compiler when building the Ruby extension.
2012-12-15 19:42:02 +00:00
Richard W.M. Jones
1571aef9cc python: Enable C compiler warnings. 2012-12-15 19:42:02 +00:00
Richard W.M. Jones
62e775c350 Change the handling of private functions, safe_malloc etc.
Rename guestfs_safe_malloc et al to guestfs___safe_malloc etc.

To use the private functions, code now has to define
-DGUESTFS_PRIVATE_FUNCTIONS=1.  This will make it easier for us in
future to work out which programs are using these functions and to
minimize both the number of programs and the functions they are
calling.

Note that the Perl, Python, OCaml, Ruby and Java bindings use
guestfs_safe_* calls.  None of the other bindings do.  This is a bug
(in the bindings using those functions): these functions will call the
out of memory callback on failure.  This function defaults to abort(),
and since this happens from a language binding, there is no way to
change this default.
2012-12-15 19:41:29 +00:00
Richard W.M. Jones
27f6878e2a guestfs.h: Fix use of __attribute__ and GCC < 4.
I guess no one uses GCC 3 any more, because if they did, including
<guestfs.h> would not work since GUESTFS_DLL_PUBLIC would not have
been defined.

At the same time, ensure that __attribute__((noreturn)) is only used
when the compiler is GCC >= 3.1.
2012-12-15 17:03:11 +00:00
Richard W.M. Jones
95df8a7c0c inspection: Don't call guestfs_hivex_close if previous guestfs_hivex_open call failed.
(Thanks Skippy VonDrake)
2012-12-14 22:04:25 +00:00
Matthew Booth
a9051eb98e daemon: Add sentinel attribute to commandf and commandrf
Causes a compiler warning to be emitted if you omit the trailing NULL argument.
2012-12-14 16:58:05 +00:00
Matthew Booth
956e30effa Add support for getting and setting GPT partition type GUIDs
New APIs:
  part_set_gpt_type
  part_get_gpt_type
2012-12-14 16:58:05 +00:00
Matthew Booth
2aa731e7c4 daemon: Remove redundant fork in commandrvf
Currently the code is doing a redundant fork when passed the
COMMAND_FLAG_CHROOT_COPY_FILE_TO_STDIN flag. The additional
sub-process does a chroot() which has no effect because all file
handles are already open at that point, then simply copies its input
to its output.

This change simply replaces the above with a dup2 of the passed file
handle to STDIN of the command process.

RWMJ:
  Don't initialize 'pid' variable.
2012-12-14 16:21:58 +00:00
Richard W.M. Jones
d7a806ca1a configure: Change minor from .20 to .21 for new development branch. 2012-12-13 17:53:36 +00:00
Matthew Booth
e92f9666de daemon: NFC Use symbolic names in commandrvf
Improve readability of commandrvf() by replacing bare int values for
file descriptors with their symbolic names STD{IN,OUT,ERR}_FILENO.

Also add PIPE_READ and PIPE_WRITE for referencing relevant ends of a pipe.
2012-12-13 17:53:20 +00:00
Matthew Booth
52cd07a0ac daemon: fix directory outside current root when executing commands
When executing a command, we temporarily chroot, fork and exec the
command, then chroot back. We intentionally don't chdir in the parent
process so that we can 'jailbreak' the chroot later. However, this has
the effect that commands are executed with a current working directory
which is outside the current root.  This unusual state can cause
errors in executed commands which don't anticipate it.

This change does a chdir("/") before executing and command. This
happens inside the fork, so the jailbreak isn't affected in the
parent.
2012-12-13 17:15:01 +00:00
Richard W.M. Jones
f784c87859 Version 1.20.0. 2012-12-13 14:18:30 +00:00
Richard W.M. Jones
25652a6d5c proto: Free drives array when qemu subprocess dies abruptly.
Commit ed7fda161e changed the g->drives
linked list into an array, and also made a subtle change to the
(undocumented) semantics of drives in the rare case when qemu is
relaunched.

Every time we go back to the CONFIG state, we should free the drives
array.  However there was one place where this was not happening.
This was caught by the tests of the protocol, but only when using the
default (appliance) method, not the libvirt method which we were more
interested in testing in Fedora.

When testing on Debian using the appliance method, we therefore hit
this bug for the first time.

This relates to or fixes the following commits:
  commit 9df159b34a
  commit 33f49d85c2
  commit ed7fda161e
2012-12-13 11:50:08 +00:00
Richard W.M. Jones
585dd44e17 debian: Allow test-disk-labels test to be skipped. 2012-12-13 11:50:08 +00:00
Richard W.M. Jones
14c7e9e52a launch: appliance: Disable virtio-scsi if qemu <= 1.1.
Debian Wheezy (7) ships with old qemu 1.1 which claims to support
virtio-scsi but in reality it's broken.

Disable virtio-scsi in this case.
2012-12-13 11:50:08 +00:00
Richard W.M. Jones
9508b750fd launch: appliance: Parse qemu version. 2012-12-13 10:38:45 +00:00
Richard W.M. Jones
c6558c75dd docs: Add website index.html.in to stable release documentation. 2012-12-13 08:50:12 +00:00
Richard W.M. Jones
5a293885a3 release notes: Update bugs list because one more bug was fixed. 2012-12-12 17:36:26 +00:00
Richard W.M. Jones
903e4864c0 Update gnulib to latest version for libguestfs 1.20 release. 2012-12-11 23:24:00 +00:00
Richard W.M. Jones
668683bd3d docs: Add gnulib update to stable release documentation. 2012-12-11 22:00:19 +00:00
Richard W.M. Jones
29cec9e235 build: Fix 'make help' output.
check-valgrind-local-tests -> check-valgrind-local-guests
2012-12-11 21:55:58 +00:00
Richard W.M. Jones
1a70df0ba6 Update API support ready for libguestfs 1.20 release. 2012-12-11 21:21:16 +00:00
Richard W.M. Jones
858bd9ffe0 launch: libvirt: Label sockets with svirt_socket_t (RHBZ#853393). 2012-12-11 20:33:28 +00:00
Richard W.M. Jones
966ebadb14 Update AUTHORS and BUGS files. 2012-12-11 17:16:13 +00:00
Richard W.M. Jones
436593f81f Push and pull latest translations from Transifex. 2012-12-11 17:15:49 +00:00
Richard W.M. Jones
557b8c6a0d Update ROADMAP for libguestfs 1.20 release. 2012-12-11 17:02:04 +00:00
Richard W.M. Jones
aeff59daa8 Update release notes and get ready for the libguestfs 1.20 release. 2012-12-11 16:58:57 +00:00
Richard W.M. Jones
0efe61b19d Add support for Windows dynamic disks (libldm / ldmtool) (RHBZ#782167).
New APIs:

  list-ldm-volumes
  list-ldm-partitions
  ldmtool-create-all
  ldmtool-remove-all
  ldmtool-scan
  ldmtool-scan-devices
  ldmtool-diskgroup-name
  ldmtool-diskgroup-volumes
  ldmtool-diskgroup-disks
  ldmtool-volume-type
  ldmtool-volume-hint
  ldmtool-volume-partitions
2012-12-11 15:20:19 +00:00
Matthew Booth
a93ea64959 inspect: Remove unused is_mountable field from filesystem struct 2012-12-11 15:20:19 +00:00
Matthew Booth
66ada9ed31 inspect: Remove unused is_swap field from filesystem struct 2012-12-11 15:20:19 +00:00
Matthew Booth
4fd5b89e36 inspect: Remove unused content field from filesystem struct
RWMJ: Don't remove entire if-clauses.
2012-12-11 15:20:09 +00:00
Richard W.M. Jones
91b3233e4a docs: Copy-edit documentation of the private data area. 2012-12-10 19:58:38 +00:00
Richard W.M. Jones
b554d7de82 guestfs-performance: Some copy-editing. 2012-12-10 17:23:57 +00:00
Richard W.M. Jones
7d2ae9f30f daemon: Generate the code when libraries are statically not available.
Since we as developers rarely test the case where some library is
statically not available, that side of the code was hardly tested,
except by unfortunate users in the field who often hit cases where
functions were missing or misdeclared.  In fact, when making this
change I noticed several bugs like that.

Change it so that this code is autogenerated, and therefore always
correct and up to date.

Previous code which looked like this:

  int
  optgroup_acl_available (void)
  {
    return 0;
  }

  char * __attribute__((noreturn))
  do_acl_get_file (const char *path, const char *acltype)
  {
    abort ();
  }

  /* etc */

is replaced by a single line:

  OPTGROUP_ACL_NOT_AVAILABLE
2012-12-10 16:20:34 +00:00
Richard W.M. Jones
5802b30ae5 generator: Change optgroups so second element is a list of functions.
Before this commit it was a list of function names (ie. strings)
making it hard if you wanted to get back to the original function
definition.
2012-12-10 16:14:42 +00:00
Richard W.M. Jones
2a2719d889 generate: Simplify generate_prototype ~single_line feature.
This is just code refactoring.
2012-12-10 16:13:15 +00:00
Richard W.M. Jones
74763eafa7 daemon: Make sure *.h files have guards against double-inclusion.
This is just code cleanup.
2012-12-10 15:49:48 +00:00
Richard W.M. Jones
82344085aa erlang: Add more tests.
Since I made lots of changes to the Erlang bindings (prompted by
Coverity), I wasn't confident that something didn't break because
there were no real tests before.
2012-12-10 13:21:06 +00:00
Richard W.M. Jones
bc05e91f0e ./run: Add Erlang support to run script. 2012-12-10 12:41:47 +00:00
Cole Robinson
cac8c56423 tests: Fix qemu-wrapper.sh generation 2012-12-09 12:12:04 +00:00
Richard W.M. Jones
6ab4d505f1 launch: libvirt: Avoid double-close of console socket on error path (found by Coverity). 2012-12-08 16:42:38 +00:00
Richard W.M. Jones
98391ab9c6 xfs: Remove potential double-free of 'buf' in multiple places (found by Coverity). 2012-12-08 16:42:38 +00:00
Richard W.M. Jones
ac6f94fb3e lua: Add comment about unsolved, hard to fix race (found by Coverity). 2012-12-08 16:42:38 +00:00
Richard W.M. Jones
0c6bc2f42f erlang: Avoid unintentional sign extension (found by Coverity).
Comment from Coverity:

  libguestfs-1.19.66/erlang/erl-guestfs-proto.c:115: sign_extension:
  Suspicious implicit sign extension: "buf[0]" with type "unsigned char"
  (8 bits, unsigned) is promoted in "(buf[0] << 24) | (buf[1] << 16) |
  (buf[2] << 8) | buf[3]" to type "int" (32 bits, signed), then
  sign-extended to type "unsigned long" (64 bits, unsigned).  If
  "(buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]" is greater
  than 0x7FFFFFFF, the upper bits of the result will all be 1.
2012-12-08 16:42:38 +00:00
Richard W.M. Jones
96e59eee66 lib: 'tmpfile' is never NULL (found by Coverity). 2012-12-08 16:42:38 +00:00
Richard W.M. Jones
359c8f8902 fish: Close 'sock' in remote control code (found by Coverity). 2012-12-08 16:42:38 +00:00
Richard W.M. Jones
b18a1b4e66 md: Free up 'ret' along error path (found by Coverity). 2012-12-08 16:42:38 +00:00
Richard W.M. Jones
a23d065c49 lib: Free up the right list if guestfs_internal_lstatlist returns an error (found by Coverity).
We were freeing up a list, but not the right list.
2012-12-08 16:42:38 +00:00
Richard W.M. Jones
6d94de3f20 fish: Don't leak stdout_saved_fd on error path (found by Coverity). 2012-12-08 16:42:38 +00:00
Richard W.M. Jones
855f023d2e lua: Don't leak memory for returned objects (found by Coverity). 2012-12-08 16:42:38 +00:00
Richard W.M. Jones
9733665bc6 python: Don't leak memory along error paths (found by Coverity). 2012-12-08 16:42:38 +00:00
Richard W.M. Jones
a1e37b7ea5 perl: Use safe_malloc instead of malloc (found by Coverity). 2012-12-08 16:42:37 +00:00
Richard W.M. Jones
3fe5f0a971 php: Return SUCCESS from PHP_MINIT_FUNCTION (found by Coverity). 2012-12-08 16:42:37 +00:00
Richard W.M. Jones
489cb059c2 fish: Don't segfault here is 'words' happens to be NULL (found by Coverity). 2012-12-08 16:42:37 +00:00
Richard W.M. Jones
40bfce7629 lib: Avoid segfault if guestfs_internal_readlinklist returns an error (found by Coverity). 2012-12-08 16:42:37 +00:00
Richard W.M. Jones
42e0cf77f3 inspect: Remove dead code (found by Coverity). 2012-12-08 16:42:37 +00:00
Richard W.M. Jones
9df159b34a launch: appliance: Really add dummy appliance slot (found by Coverity).
In the previous code, appliance was unconditionally set to NULL and so
we never added the dummy appliance slot to g->drives.  This probably
doesn't matter, since hotplugging doesn't work for the 'appliance'
attach-method.  Despite that, it's better to get this right.

This fixes commit ed7fda161e.
2012-12-08 16:42:37 +00:00
Richard W.M. Jones
e9e5a0f94e daemon: Fix error checking in function (found by Coverity). 2012-12-08 16:42:37 +00:00
Richard W.M. Jones
7941f6785e fish: copy-out: Fail on some errors when creating output directory (found by Coverity).
However it's not an error if the output directory already exists.
2012-12-08 16:42:37 +00:00
Richard W.M. Jones
15d5c94377 daemon: Explicitly ignore return value from modprobe command (found by Coverity). 2012-12-08 16:42:37 +00:00
Richard W.M. Jones
baf5a06224 fish: Ignore failure of mkdir (noted by Coverity). 2012-12-08 16:40:54 +00:00
Richard W.M. Jones
091b98a9ea tmpdirs: Explicitly ignore return value from guestfs___cmd_run to keep Coverity happy.
We don't care if this command fails.
2012-12-08 13:26:04 +00:00
Richard W.M. Jones
aa785c85d9 lib: Explicitly ignore return value from guestfs_parse_environment in guestfs_create (found by Coverity).
The purpose of adding guestfs_create_flags was so that users could
check for errors from guestfs_parse_environment if they need to.
2012-12-08 13:26:04 +00:00
Richard W.M. Jones
59b51274eb Check for error from some guestfs_set_* calls (found by Coverity).
For some guestfs_set_* calls, add checks for error, when error might
possibly occur.  eg. It's plausible that guestfs_set_network might
fail if the attach-method being used doesn't support it (although this
doesn't happen at the moment).

In other cases, don't check for errors, eg. if the error doesn't
matter or there's nothing we could plausibly do about it.
2012-12-08 13:25:59 +00:00
Richard W.M. Jones
8331d46384 virt-rescue: Document a method to capture core dumps from within the rescue environment. 2012-12-07 15:25:04 +00:00
Richard W.M. Jones
bb0de6938a daemon: Fix noreturn error in acl and capabilities code.
This is an improvement over the original fix in
commit fe4cdb2a47.
2012-12-07 15:24:49 +00:00
Richard W.M. Jones
f5e9e2780b configure.ac: Fix comment.
I spent a lot of time looking at how gnulib "manywarnings" works, and
this comment reflects my improved understanding.
2012-12-07 15:24:18 +00:00
Richard W.M. Jones
47511ddbc9 Add NOT_SUPPORTED macro to daemon and library.
This convenience macro returns errno == ENOTSUP.
2012-12-07 15:24:06 +00:00
Richard W.M. Jones
77e9b1a9e8 appliance: Add (default commented out) section containing debugging tools. 2012-12-07 12:09:20 +00:00
Richard W.M. Jones
52744cc232 tests: charset: Fix broken Makefile.am escaping.
This fixes commit 5a2e320ec9.
2012-12-04 15:21:49 +00:00
Richard W.M. Jones
5a2e320ec9 configure: Add --enable-code-profiling and --enable-code-coverage flags.
These configure flags enable code profiling (with gprof) and code
coverage (with gcov) respectively.

Although this is a nice idea, it's not currently very useful.

Libtool mangles filenames in such a way that gcov cannot locate its
datafiles.

Profiling is of dubious utility with libguestfs which is not CPU-bound
and relies extensively on running external programs (oprofile-like
system profiling that took into account libguestfs + qemu or
libguestfs + qemu + the appliance + filesystem tools *would* be
useful).

Also neither flag will help in capturing data from the appliance.
2012-12-04 14:11:14 +00:00
Evaggelos Balaskas
f92b4a7d83 packagelist.in for archlinux
latest archlinux has some small changes:

btrfs-progs-unstable --> btrfs-progs
genisoimage --> cdrkit
iproute --> iproute2
module-init-tools --> kmod
procps --> procps-ng
udev --> systemd
util-linux-ng --> util-linux

and could you plz add the below packages

lrzip
less
sed

RWMJ: I took this opportunity to make some general cleanups to the file:

- add 'less' and 'sed' for everyone
- 'module-init-tools' & 'kmod'[1]
- 'procps' & 'procps-ng'[1]
- 'util-linux' & 'util-linux-ng'[1]
- sort the ArchLinux packages into order

[1] Note that febootstrap is supposed to ignore packages it doesn't
know about.
2012-12-03 22:15:39 +00:00
Richard W.M. Jones
57009f0136 build: Make 'check-valgrind' fail noisily if valgrind is not installed.
The way the existing configure script worked, @VG@ would be empty, and
it would run all the way through the check-valgrind rule successfully
without actually running anything under valgrind.
2012-12-03 18:45:59 +00:00
Richard W.M. Jones
3cced0950c docs: Minor copyedits to the release notes. 2012-12-01 19:01:31 +00:00
Richard W.M. Jones
e35045720b Update release notes. 2012-12-01 14:56:25 +00:00
Richard W.M. Jones
443ea95faf Version 1.19.66. 2012-12-01 13:38:58 +00:00
Richard W.M. Jones
b57ab59b8e doc: Document problems with hibernated Windows guests and Windows 8 "fast startup" (RHBZ#882299). 2012-12-01 13:25:56 +00:00
Richard W.M. Jones
921b716b0b test-tool: Parse the environment separately.
This lets us report bugs when parsing the environment.
2012-12-01 12:04:13 +00:00
Richard W.M. Jones
e8d6d6f737 test-tool: Create the handle later.
Although this leads to a small amount of code duplication with the -V
option, the overall effect is cleaner.

This is just code motion.
2012-12-01 12:04:13 +00:00
Richard W.M. Jones
6b5f9221b4 tmpdirs: Make relative TMPDIR (etc) absolute, and check it's a directory (RHBZ#882417).
This fixes commit 1efed122c0.
2012-12-01 12:04:09 +00:00
Richard W.M. Jones
575895d8b0 test-tool: Print tmpdir properly.
It was actually printing cachedir.

This fixes commit f9ab256f0e.
2012-12-01 11:14:57 +00:00
Richard W.M. Jones
3d59ed5458 inspection: Get icon for Windows 8 (RHBZ#801117). 2012-12-01 09:41:33 +00:00
Richard W.M. Jones
c08fbc9cb4 contrib: Useful script to extract all logos/icons from a Windows guest. 2012-12-01 09:09:56 +00:00
Richard W.M. Jones
160977987f inspection: Temporary logo for Windows 8.
See the comment from the code:

  NB about Windows 8: No location we've found so far contains a
  suitable icon for Win8.  In particular, explorer.exe definitely
  does *not* contain any Windows logo as a resource (I checked).
  Therefore the "basket icon" that this produces is just a stand-in
  until we have a better idea for solving this problem.

and:

  https://bugzilla.redhat.com/show_bug.cgi?id=801117
2012-11-30 23:00:33 +00:00
Richard W.M. Jones
f5ae46dca7 inspection, virt-sysprep: Use /etc/hostname on F18+, RHEL7+ (RHBZ#881953, RHBZ#858696). 2012-11-30 12:37:48 +00:00
Richard W.M. Jones
fe4cdb2a47 daemon: Avoid gcc warning about noreturn function in acl & cap code.
acl.c: In function 'do_acl_get_file':
acl.c:158:1: error: function might be candidate for attribute 'noreturn' [-Werror=suggest-attribute=noreturn]
2012-11-30 09:01:05 +00:00
Richard W.M. Jones
a8f6e06b30 Version 1.19.65. 2012-11-29 19:40:00 +00:00
Richard W.M. Jones
6ee80b8dac inspection: Don't probe partitions when we've probed the whole device (RHBZ#798979).
So we don't get multiple <operatingsystem> entries, particularly for
install ISOs.
2012-11-29 18:27:26 +00:00
Richard W.M. Jones
90e7981082 inspection: Read libosinfo database in order to inspect OS install CD/DVD/ISOs (RHBZ#803650, RHBZ#805417). 2012-11-29 18:22:00 +00:00
Richard W.M. Jones
31101db4c7 lib: Indent CFLAGS in Makefile.am.
This is just a whitespace change.
2012-11-29 17:07:39 +00:00
Richard W.M. Jones
5693799614 inspection: Move variable decls to top of function.
This is just code motion.
2012-11-29 17:07:39 +00:00
Richard W.M. Jones
fc6f34d5cd inspection: Implement "openbsd" type and distro. 2012-11-29 17:07:39 +00:00
Richard W.M. Jones
0e5eef87d0 daemon: isoinfo: Fix parsing of bogus dates.
eg:

$ isoinfo --debug -d -i ubuntu-12.04-desktop-amd64.iso
CD-ROM is in ISO 9660 format
System id:
Volume id: Ubuntu 12.04 LTS amd64
Volume set id:
Publisher id:
[...]
Creation Date:     2012 04 25 16:13:46.00
Modification Date: 2012 04 25 16:13:46.00
Expiration Date:                :  :  .
Effective Date:                 :  :  .
[...]
2012-11-29 17:07:39 +00:00
Richard W.M. Jones
380ce2eeaa fish: Make type == drv_N field private to guestfish.
The -N option / drv_N type only makes sense when we are compiling
guestfish, and just serves to complicate non-guestfish code.
2012-11-29 11:45:39 +00:00
Richard W.M. Jones
9e7daf2ee8 virt-df: Better output when multiple -a/-d options are specified (RHBZ#880801).
This is very well explained in the bugzilla comments:
https://bugzilla.redhat.com/show_bug.cgi?id=880801#c1

With this change, the disk name has a one or more plus signs ('+')
appended to show that there are additional disks:

  $ virt-df -a Win7x32TwoDisks-a -a Win7x32TwoDisks-b
  Filesystem                   1K-blocks    Used  Available  Use%
  Win7x32TwoDisks-a+:/dev/sda1    102396   24712      77684   25%
  Win7x32TwoDisks-a+:/dev/sda2  12478460 7403416    5075044   60%
  Win7x32TwoDisks-a+:/dev/sdb1    521212   55728     465484   11%
2012-11-29 11:45:39 +00:00
Richard W.M. Jones
6255cc8343 Add .mailmap to EXTRA_DIST. 2012-11-27 08:48:39 +00:00
Wanlong Gao
36232b0bbe Add the .mailmap and change the method to generate AUTHORS
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-11-27 08:45:23 +00:00
Richard W.M. Jones
567747f78e lib: lpj: Refactor code.
Only run one grep command to grep any number of files.
2012-11-26 09:37:58 +00:00
Richard W.M. Jones
8243c0c6f6 lib: lpj: Only return first match in read_all function.
If there where several lpj=.. matches then the earlier matches would
be leaked.  Only return the first one and don't leak memory.
2012-11-26 08:58:26 +00:00
Richard W.M. Jones
d2c75dd0ff lib: Get lpj= from /var/log/boot.msg (thanks Olaf Hering). 2012-11-25 18:11:19 +00:00
Richard W.M. Jones
d7517360f2 Version 1.19.64. 2012-11-24 15:11:28 +00:00
Richard W.M. Jones
a4c0d7a82a launch: appliance: Handle non-\0 terminated buffer correctly.
The read_all function is used as a callback for

  guestfs___cmd_set_stdout_callback (cmd, read_all, [str],
                                     CMD_STDOUT_FLAG_WHOLE_BUFFER);

As noted in the documentation for CMD_STDOUT_FLAG_WHOLE_BUFFER, the
buffer returned is not \0-terminated, and so using memdup will create
an unterminated string, and therefore potentially a memory overrun
when reading or searching the string.

Use strndup instead so the final string is \0-terminated.
2012-11-24 14:17:35 +00:00
Richard W.M. Jones
aeea803ad0 appliance: Pass lpj=... on the appliance command line (thanks Marcelo Tosatti).
Try to get the host's loops_per_jiffy value and pass this on the
command line to the guest.  In theory this should avoid the appliance
having to recalculate this value in a VM with TCG (which is generally
error-prone).  This should avoid timing issues.

We only do this when we are certain that the guest will be TCG.
Currently we only have enough information to do this from the libvirt
attach-method.  So mostly this will only affect people using Fedora in
a VM.

The host loops_per_jiffy value is not exported by the kernel.  It is
only printed by the kernel early during boot, so if boot messages have
"scrolled off" the kernel ring buffer, it won't be available.  Some
operating systems save early kernel messages in /var/log/dmesg but (a)
Fedora 18+ seem to have abandoned this file and (b) on Ubuntu this
file is unreadable for spurious "security" reasons.

I have submitted a patch to make lpj available through /proc/cpuinfo.
2012-11-24 14:17:08 +00:00
Richard W.M. Jones
62895440bc launch: libvirt: Refactor parameter passing to construct_libvirt_xml* functions.
This is just code motion.
2012-11-24 13:09:53 +00:00
Olaf Hering
e987c038ea lua: fix build error due to LUA_GLOBALSINDEX usage
lua 5.2 changed API, LUA_GLOBALSINDEX is no longer available.
http://www.lua.org/manual/5.2/manual.html#8.3

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2012-11-23 21:42:49 +00:00
Richard W.M. Jones
12acff5f56 Version 1.19.63. 2012-11-23 17:33:00 +00:00
Richard W.M. Jones
1ef9af9acb daemon: Ignore lvresize error "New size..matches existing size" (RHBZ#834712).
The lvresize command unnecessarily gives an error if you don't
change the size of the LV.  Suppress this error.
2012-11-23 17:17:57 +00:00
Richard W.M. Jones
dd4038c8a4 test-tool: Don't print banner when using --help, -V, etc options (RHBZ#879416). 2012-11-23 14:50:54 +00:00
Richard W.M. Jones
2272cccfd4 launch: Refactor duplicate code which constructs the appliance command line.
Move this into a common file.
2012-11-23 13:17:05 +00:00
Richard W.M. Jones
a6a0b9ba16 lib: Fix memory leak and simplify command code.
Fix the following memory leak found by valgrind:

==13629== 498 (112 direct, 386 indirect) bytes in 1 blocks are definitely lost in loss record 99 of 110
==13629==    at 0x4A06B2F: calloc (vg_replace_malloc.c:593)
==13629==    by 0x4CA564E: guestfs_safe_calloc (alloc.c:71)
==13629==    by 0x4CA9B02: guestfs___new_command (command.c:143)
==13629==    by 0x4CA66E9: guestfs___build_appliance (appliance.c:690)
==13629==    by 0x4CBD1B9: launch_libvirt (launch-libvirt.c:188)
==13629==    by 0x402E7E: main (virt-filesystems.c:349)

Also adjust the command code in several places to make it simpler.  We
can almost always call guestfs___cmd_close right after
guestfs___cmd_run, avoiding any need to close the handle along error
paths.

Tested by running the test suite under valgrind.
2012-11-23 12:12:33 +00:00
Richard W.M. Jones
fae8d7cafb New APIs: Implement Linux filesystem capabilities.
This adds the following new APIs:
 - cap_get_file
 - cap_set_file
2012-11-22 16:45:32 +00:00
Richard W.M. Jones
218b39acae New APIs: Implement POSIX ACLs.
This adds the following new APIs:
 - acl_get_file
 - acl_set_file
 - acl_delete_def_file
2012-11-22 16:19:21 +00:00
Richard W.M. Jones
784e53287e fish: Fix test-remote-events test.
Because the shell script was missing a space, the final output test
was failing, although for some reason this didn't cause the whole test
to fail.

Fixing the missing space also revealed a bug in the test output, which
is also fixed.
2012-11-22 09:56:01 +00:00
Wanlong Gao
9fb5a3ceaf sysprep: remove crash data generated by kexec-tools
Remove the kdump generated kernel crash data.

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

RWMJ:
 - Added /var/log/dump/* path for SLES (thanks Olaf Hering).
 - Update po/POTFILES-ml.
2012-11-22 08:30:21 +00:00
Richard W.M. Jones
30f202da43 Update API support. 2012-11-20 19:53:18 +00:00
Richard W.M. Jones
8ae8f1453b Update PO files from transifex. 2012-11-20 19:51:45 +00:00
Richard W.M. Jones
20d524f4fa Version 1.19.62. 2012-11-20 19:43:18 +00:00
Richard W.M. Jones
d0f89fed85 ./run: Ensure all paths are built up cumulatively. 2012-11-20 18:40:54 +00:00
Richard W.M. Jones
12905a9bbb lua: valgrinding Lua code doesn't work.
See comment.
2012-11-20 18:31:45 +00:00
Richard W.M. Jones
1e321b883b valgrind: Ignore init_libguestfs symbol.
It's not relevant, since the memory leak begins in libvirt.
2012-11-20 18:31:16 +00:00
Richard W.M. Jones
0ff561f332 lua: Replace internal lua_guestfs_* functions with guestfs_lua_*.
This is just code motion.  It just ensures there is no possible
conflict with lua_* symbols.
2012-11-20 17:34:23 +00:00
Richard W.M. Jones
1f98450995 lua: Attach __tostring functions exceptions.
This includes a test.
2012-11-20 17:32:37 +00:00
Richard W.M. Jones
4749bff379 lua: Fix whitespace. 2012-11-20 16:42:40 +00:00
Richard W.M. Jones
ca488a6d7b lua: Various fixes to the bindings (thanks Jerome Vuarand).
See http://article.gmane.org/gmane.comp.lang.lua.general/95065

Note that this is incompatible with existing code.  You
have to do:

  local G = require "guestfs"
  local g = G.create ()

ie. give the module your own name ("G" in that example).
2012-11-20 16:34:23 +00:00
Richard W.M. Jones
8f80f9fdae lua: Print the error thrown by callbacks. 2012-11-20 14:24:42 +00:00
Richard W.M. Jones
efb2d07ad6 lua: Add comment (not fix) for incorrect 'g' argument in callbacks.
Thanks Jerome Vuarand.
2012-11-20 14:15:45 +00:00
Richard W.M. Jones
7f1f7dd44f lua: Add bindtests. 2012-11-20 14:11:47 +00:00
Richard W.M. Jones
b19f007bd2 lua: Use lua_rawgeti to read elements from lists of strings.
This is faster, but more importantly it avoids the strange error
'lua: attempt to index a string value' which appears with (some)
single element lists.
2012-11-20 14:11:47 +00:00
Richard W.M. Jones
69c5f3045a lua: Add LuaStyle of commenting to the generator. 2012-11-20 13:55:50 +00:00
Richard W.M. Jones
74105fdab1 lua: Allow regular int to be passed as a 64 bit integer. 2012-11-20 13:45:34 +00:00
Richard W.M. Jones
3454cfb73c daemon: wipefs: Use --force option if available.
See https://bugzilla.redhat.com/show_bug.cgi?id=872831
and https://bugzilla.redhat.com/show_bug.cgi?id=865961
2012-11-20 10:44:10 +00:00
Richard W.M. Jones
b5b475ab82 lua: Simplify get_event function.
Use luaL_checkoption which is designed for this purpose.
2012-11-20 09:10:15 +00:00
Richard W.M. Jones
fdfdc883fc lua: Document Guestfs.event_all. 2012-11-19 18:19:29 +00:00
Richard W.M. Jones
e866ee7c79 erlang, lua: Fix links in man pages. 2012-11-19 18:16:08 +00:00
Richard W.M. Jones
556fc92e8a lua: Test globals in Guestfs.* namespace. 2012-11-19 17:13:14 +00:00
Richard W.M. Jones
bc03a48c71 lua: Add global Guestfs.event_all (list of all events). 2012-11-19 17:11:27 +00:00
Richard W.M. Jones
36e71e0cf4 Version 1.19.61. 2012-11-19 14:46:59 +00:00
Richard W.M. Jones
f77ddb9e11 lua: Various fixes and enhancements:
- add support for events (with test)
- test progress messages
- update documentation to describe events
- refactor handle closing code
- refactor error code
- use 'assert' in test code instead of 'if ... then error end'
2012-11-19 14:01:40 +00:00
Richard W.M. Jones
d14557d434 perl: Add test of multiple independent handles. 2012-11-19 09:39:30 +00:00
Richard W.M. Jones
6e5916e0f4 lua: examples: Boolean true shouldn't have quotes around it. 2012-11-18 19:24:20 +00:00
Richard W.M. Jones
6483c506b9 lua: Add another test to prove that the handles are really independent. 2012-11-18 16:45:44 +00:00
Richard W.M. Jones
6710296b7a lua: Don't use %m since Lua string formatter doesn't understand it.
Use %s + strerror as a replacement.
2012-11-18 16:45:08 +00:00
Richard W.M. Jones
4ba8b5a00d lua: Add some missing features.
- Remove default error handler.
- User cancel.
- Add the errno to the object which is thrown on error.

Still no events.
2012-11-17 21:28:43 +00:00
Richard W.M. Jones
a9c4efdcfd Version 1.19.60. 2012-11-17 20:03:57 +00:00
Richard W.M. Jones
ff8bfd3e92 Add Lua bindings.
These are relatively complete, although only lightly tested.  Missing:

 - events
 - last_errno
 - user_cancel
2012-11-17 20:02:42 +00:00
Richard W.M. Jones
4a2e8e8957 perl: Clean up and update the tests. 2012-11-17 18:14:20 +00:00
Richard W.M. Jones
3d0e937b84 perl: Small test of create with flags. 2012-11-17 17:55:06 +00:00
Richard W.M. Jones
43369e1bd4 sparsify: Better error when user specifies --compress + raw output (RHBZ#852194). 2012-11-15 16:37:23 +00:00
Richard W.M. Jones
2f321ced21 todo: We must implement ACLs and filesystem capabilities for SCAP.
Thanks Steve Grubb.
2012-11-15 15:35:46 +00:00
Richard W.M. Jones
a41629deb9 daemon: Perform device name translation on mke2fs journaldevice (RHBZ#876579).
Also various fixes:

 - remove fixed-size buffer
 - change if (err) free (err) -> free (err).
2012-11-15 10:16:28 +00:00
Richard W.M. Jones
5d9f10c312 recipes: Add sections about hexdumping, hexediting sectors. 2012-11-15 09:01:15 +00:00
Richard W.M. Jones
fd81d3f9b2 recipes: Add recipe for diffing two guests. 2012-11-14 22:34:06 +00:00
Richard W.M. Jones
5638cd3024 Version 1.19.59. 2012-11-13 15:36:30 +00:00
Richard W.M. Jones
e8ad3efbc4 dist: Add miscellaneous files to the tarball.
Lots of these had been omitted over time.
2012-11-13 15:26:29 +00:00
Richard W.M. Jones
2d89aef897 tests/protocol: Add test-qemudir-launchfail.sh to tarball (but don't run it).
This file was present in git, but missing from the tarball.

Don't actually run the test: it depends on details of how the
appliance is constructed which would fail for old-style appliances.
2012-11-13 15:26:29 +00:00
Richard W.M. Jones
715afda341 fish: Add test for remote events.
This test was present in git, but not included in the tarball,
nor in the tests that guestfish actually runs.

This fixes commit 17182af3a6.
2012-11-13 15:26:29 +00:00
Richard W.M. Jones
5c44c691f2 tests: Add a parallel launch test.
This is designed to reveal libvirt race conditions such as
bug 875741.

This is a "slow test" so it only runs if you do 'make check-slow'.
2012-11-13 15:26:29 +00:00
Richard W.M. Jones
ee5f18293b tests: Add 'make check-slow' rule to recursively run slow/long-running tests. 2012-11-13 15:26:29 +00:00
Richard W.M. Jones
cb4284b9e3 Add 'make help' rule.
This gives a short overview of the make targets.
2012-11-13 15:26:29 +00:00
Richard W.M. Jones
3636c5fcff tests: Replace 'make extra-tests' with individual tests.
'make extra-tests' was a monolithic set of tests that did all sorts of
things: valgrind, tests over local guests, tests with upstream qemu,
tests with upstream libvirt, tests with the appliance attach method.

This made it hard to perform individual tests, eg. just valgrind
testing.  It was also hard to maintain because the tests were not
located in the same directories as the programs and sometimes
duplicated tests that were run elsewhere.

This commit splits up 'make extra-tests' into 5 separate targets:

 make check-valgrind              # run a subset of tests under valgrind
 make check-valgrind-local-guests # test under valgrind with local guests
 make check-with-appliance        # test with attach-method == appliance
 make check-with-upstream-qemu    # test with an alternate/upstream qemu
 make check-with-upstream-libvirt # test with an alternate/upstream libvirt

(You can also still run 'make extra-tests' which is now simply
a rule that runs the above 5 targets in order).

This replaces everything that was in the tests/extra directory,
so that has now gone.
2012-11-13 15:26:29 +00:00
Richard W.M. Jones
c4a3ea066b extra-tests: Add $(libvirt_ro_uri) substitution to configure.
This is essentially just code motion.
2012-11-13 15:26:29 +00:00
Richard W.M. Jones
765d14dc05 Define whole valgrind command (as @VG@) in the configure script.
This is mostly just code motion, but it also changes the default
location where valgrind.log is written to be the top build directory
(instead of tests/extra/valgrind.log).
2012-11-13 15:26:29 +00:00
Richard W.M. Jones
ab360c48d4 align: Add a test for virt-alignment-scan. 2012-11-13 15:26:29 +00:00
Richard W.M. Jones
ac2ddfd90a fish: Add simple tests of starting up, inspection, using the prepared disks. 2012-11-13 15:26:29 +00:00
Richard W.M. Jones
73631705cf inspector: Add some real virt-inspector tests. 2012-11-13 15:26:29 +00:00
Richard W.M. Jones
e884abfd06 extra-tests: Move valgrind suppressions file to top source directory.
This is just code motion.
2012-11-12 15:49:08 +00:00
Richard W.M. Jones
b2663be064 Various fixes to API support script.
Remove internal structures, fix it so it works with the new
code layout under src/
2012-11-12 13:40:43 +00:00
Richard W.M. Jones
02ecd048d3 lib: Split up huge src/guestfs.c into logical compilation units.
This file had grown by accretion to include:

 - code related to handles (now in src/handle.c)

 - safe allocation (src/alloc.c)

 - debug, errors, warnings (src/errors.c)

 - private data (src/private-data.c)

 - miscellaneous functions (src/canonical-name.c, src/utils.c)

This commit also removes about a dozen #include files which were
probably not really used.

This is just code motion.
2012-11-12 13:40:25 +00:00
Richard W.M. Jones
f9ab256f0e test-tool: Print cachedir and tmpdir.
This fixes commit 1efed122c0.
2012-11-10 22:03:25 +00:00
Richard W.M. Jones
2c9e532566 Update release notes. 2012-11-10 14:04:09 +00:00
Richard W.M. Jones
17090bd09f Version 1.19.58. 2012-11-10 11:25:26 +00:00
Richard W.M. Jones
fcf8032cbd lib: Fix memory leak in tmpdir/cachedir code (found by valgrind).
This fixes commit 1efed122c0.
2012-11-10 08:55:38 +00:00
Richard W.M. Jones
99377e2748 tests: Remove double-test for availability.
If you have a function which is in the X optgroup, and also has
IfAvailable X, then two tests for the optgroup are added to the
output.

Check for this case and give an error.

This also fixes existing APIs.
2012-11-09 22:48:47 +00:00
Richard W.M. Jones
a74f168168 tests: More efficient use of strings in the object code.
No functional change.
2012-11-09 22:48:47 +00:00
Richard W.M. Jones
a270faefef tests: Use guestfs_{push,pop}_error_handler.
Replace the custom error handler with calls to
guestfs_{push,pop}_error_handler only where necessary.  This
simplifies the generated code.
2012-11-09 22:48:47 +00:00
Richard W.M. Jones
2deb235cf4 tests: Cleanup code that prints each test name.
This is just code motion.
2012-11-09 22:48:47 +00:00
Richard W.M. Jones
56c7967cad tests: Change code for printing warnings about untested functions.
Just code cleanup, no functional change.
2012-11-09 20:19:30 +00:00
Richard W.M. Jones
04a8cffee7 tests: Remove dead code in generated output. 2012-11-09 20:19:08 +00:00
Richard W.M. Jones
599a1930b0 tests: Format the generated code properly.
This is just whitespace changes in the output.
2012-11-09 20:18:54 +00:00
Richard W.M. Jones
25ff0db3b4 fuse: Use guestfs_{push,pop}_error_handler so we can see errors in shutdown.
In the fork (usual) case, we still won't see any errors since stderr
has been redirected to /dev/null, but this way is still a little more
correct.
2012-11-09 19:53:39 +00:00
Richard W.M. Jones
2d220f5da2 tools: Modify existing tools to use guestfs_{push,pop}_error_handler.
This is a shorter and more convenient way to disable errors
temporarily across calls.
2012-11-09 19:51:09 +00:00
Richard W.M. Jones
b460d9f32e lib: Modify library code to use guestfs_{push,pop}_error_handler.
This is less efficient than directly manipulating g->error_cb, but
easier to maintain.
2012-11-09 19:51:08 +00:00
Richard W.M. Jones
a3b6751863 lib: Add new C API calls: guestfs_push_error_handler,
guestfs_pop_error_handler.

The addition of these calls makes it much simpler to temporarily
disable or ignore errors:

 guestfs_push_error_handler (g, NULL, NULL);
 guestfs_mkdir (g, "/foo"); /* We don't care if this fails. */
 guestfs_pop_error_handler (g);

Note these calls are used by the C API only.  They are not necessary
in other languages, because those map errors to exceptions.

The subsequent commits change existing code to use push/pop instead of
laboriously saving and restoring the error handler.
2012-11-09 19:50:57 +00:00
Richard W.M. Jones
2013e005bd lib: Break long line in definition of guestfs_set_error_handler.
This is just a whitespace change.
2012-11-09 19:50:57 +00:00
Richard W.M. Jones
692701f382 examples: Copy-editing instructions printed by the mount-local program. 2012-11-09 19:50:57 +00:00
Richard W.M. Jones
dedf10aaa9 header: Define LIBGUESTFS_HAVE_CREATE_FLAGS=1.
This fixes commit 9466060201.
2012-11-09 17:15:50 +01:00
Richard W.M. Jones
1586bbb951 fish: Update documentation for environment variables.
This fixes commit 1efed122c0.
2012-11-09 13:34:45 +00:00
Richard W.M. Jones
1efed122c0 lib: Rework temporary and cache directory code.
New APIs: set-tmpdir, get-tmpdir, set-cachedir, get-cachedir.

The current code has evolved over time and has a number of problems:

(a) A single environment variable ($TMPDIR) controls the
location of several directories.

(b) It's hard for the library user to predict which directory
libguestfs will use, unless the user simulates the same internal steps
that libguestfs performs.

This commit fixes these issues.

(a) Now three environment variables control the location of all small
temporary files, and the appliance cache:

  For temporary files: $LIBGUESTFS_TMPDIR or $TMPDIR or /tmp.

  For the appliance cache: $LIBGUESTFS_CACHEDIR or $TMPDIR or /var/tmp.

The user can also set these directories explicitly through API calls
(guestfs_set_tmpdir and guestfs_set_cachedir).

(b) The user can also retrieve the actual directories that libguestfs
will use, by calling guestfs_get_tmpdir and guestfs_get_cachedir.
These functions are also used internally.

This commit also:

 - reworks the internal tmpdir code

 - removes the internal (undocumented) guestfs_tmpdir call (replacing
   it with calls to the documented guestfs_get_tmpdir API instead)

 - changes the ./run script to set LIBGUESTFS_TMPDIR and
   LIBGUESTFS_CACHEDIR

 - adds a test

 - fixes a few places like libguestfs-make-fixed-appliance which
   depended on $TMPDIR
2012-11-09 13:11:53 +00:00
Richard W.M. Jones
e8d937bd73 lib: When parsing environment, handle LIBGUESTFS_TRACE first.
So that we can trace all the later calls.
2012-11-09 13:09:04 +00:00
Richard W.M. Jones
ebe5ca7771 Version 1.19.57. 2012-11-07 20:29:59 +00:00
Richard W.M. Jones
101fd44fc5 format: Allow virt-format test to be skipped by setting SKIP_TEST_VIRT_FORMAT_SH=1. 2012-11-06 13:05:49 +00:00
John Eckersberg
3b06bee2fb lib: debian support for package arch inspection 2012-11-05 16:20:26 +00:00
Richard W.M. Jones
6ac943fbef tests: wipefs: Don't try to wipe mounted filesystem.
Previously wipefs (the utility) allowed this, but it's obviously a bad
thing to do and the new wipefs gives an error if you try it:

wipefs: error: /dev/VG/LV: probing initialization failed: Device or resource busy
2012-11-03 10:16:01 +00:00
Richard W.M. Jones
4bd61ed322 fish: Fix documentation quit | exit -> separate exit & quit headings. 2012-11-02 22:15:29 +00:00
Richard W.M. Jones
4f6060b9d9 fish: Clean up prompt documentation. 2012-11-02 22:13:22 +00:00
Richard W.M. Jones
46449f6894 fish: Use Unicode LOWER ONE QUARTER BLOCK to represent cursor.
'ls' (with no argument) is not a valid command.

This fixes commit bad5c7d5a5.
2012-11-02 22:05:43 +00:00
Richard W.M. Jones
6c539fa0a6 Version 1.19.56. 2012-11-02 14:45:11 +00:00
Richard W.M. Jones
9a1a0c67ac generator: Split up huge src/actions.c into separate files.
Split the functions according to a simple hash across
C.nr_actions_files files (this number can be increased later if
necessary).

This is just code motion.
2012-11-02 14:38:03 +00:00
Richard W.M. Jones
58720cc968 generator: actions: Move variant functions to a separate file.
This is just code motion.
2012-11-02 14:36:36 +00:00
Richard W.M. Jones
6f34b81321 generator: actions: Move 3 helper functions to a separate file.
This is just code motion.
2012-11-02 14:36:31 +00:00
Richard W.M. Jones
f56bc8edd5 New API: mklost_and_found 2012-11-02 14:35:41 +00:00
Richard W.M. Jones
4cfc277674 todo: General updates. 2012-11-02 14:09:28 +00:00
Richard W.M. Jones
f39478424f ROADMAP: Remove some completed items. 2012-11-02 14:09:28 +00:00
Richard W.M. Jones
226457de3d sysprep: Don't fail when trying to remove /var/spool/at/spool (directory).
This fixes commit 1949016e89.
2012-11-01 19:31:17 +00:00
John Eckersberg
dd9bbeb060 inspect: Use new inspect_list_applications2 API call
RWMJ:
 - Update virt-inspector.rng.
2012-11-01 18:22:08 +00:00
John Eckersberg
bafd822914 lib: Add inspect_list_applications2 method (RHBZ#859949)
RWMJ:
- Fix memory leak in guestfs__inspect_list_applications wrapper.
- Don't document app2_spare* fields.
2012-11-01 18:22:01 +00:00
Hilko Bengen
4c285dd8f6 message catalogs don't need to be executable 2012-11-01 12:25:56 +00:00
Richard W.M. Jones
6871400223 Version 1.19.55. 2012-10-30 14:35:25 +00:00
Richard W.M. Jones
de129a1363 build: Source 'localenv' in top-level Makefile.
Also document 'local*' files.
2012-10-30 13:19:53 +00:00
Richard W.M. Jones
f5194e6b0a tests: Allow more tests to be skipped.
Specifically tests which involve btrfs, because btrfs is
currently broken upstream (RHBZ#863978).
2012-10-30 12:56:06 +00:00
Richard W.M. Jones
eb185eef29 generator: Use an OCaml struct to store the structs.
This just makes it simpler to add extra fields to each struct.

This is code motion.
2012-10-30 12:32:30 +00:00
Richard W.M. Jones
72e19deee7 lib: Force visibility default on public actions.
This is currently done implicitly because of the linker script.
However in order to do symbol versioning, we will have to do
this explicitly at each definition instead.
2012-10-30 10:32:57 +00:00
Richard W.M. Jones
8c66ba455d generator: Move struct-freeing functions to a separate source file.
This is just code motion.
2012-10-30 10:32:57 +00:00
Richard W.M. Jones
ccf5c6ae56 sysprep: Move a comment.
No change.
2012-10-30 08:31:38 +00:00
Wanlong Gao
f491f3a958 sysprep: remove man pages cache
Remove the cache files generated by man-db.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-10-30 07:59:49 +00:00
Wanlong Gao
3884bc7d7a sysprep: remove fontconfig cache
Remove the cache files generated by fontconfig.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-10-30 07:59:49 +00:00
John Eckersberg
63a091e21d lib: update inspect_list_applications to return all installed RPMs (RHBZ#859885).
Note that because of RHBZ#859949, this will return two identical
entries for RPMs which differ only by arch.
2012-10-29 21:56:45 +00:00
Richard W.M. Jones
269460770d build: Remove 'make bindist' rule.
We've not distributed binaries for quite a long time, and possibly
this is not advisable.
2012-10-29 15:40:33 +00:00
Richard W.M. Jones
e6f8a589ee Version 1.19.54. 2012-10-29 15:22:23 +00:00
Richard W.M. Jones
dd09744432 guestfs-testing: Use L<> around links. 2012-10-29 15:12:54 +00:00
Richard W.M. Jones
bad5c7d5a5 fish: Add GUESTFISH_PS1 environment variable to control prompt. 2012-10-29 12:49:21 +00:00
Richard W.M. Jones
9de4dfddc7 fish: Make progress bars slightly lighter. 2012-10-27 16:19:53 +01:00
Richard W.M. Jones
3c1d85ae95 docs: Review and clarify ERROR HANDLING section of guestfs(3). 2012-10-25 22:23:49 +01:00
Richard W.M. Jones
7271c9146d launch: libvirt: Disable CPU host-model.
See the comment in the change.

This "fixes" commit f7a67914c0.
2012-10-25 16:16:17 +01:00
Richard W.M. Jones
835ae2c43c gitignore: Ignore config.cache file. 2012-10-25 14:23:00 +01:00
Richard W.M. Jones
f7a67914c0 launch: libvirt: Fix <cpu> element.
Use <cpu mode="host-model"> (not model=... which was a typo).

Also set fallback=allow so that libvirt knows it can use another
CPU model if it wants.

This fixes commit 890a4fbc87.
2012-10-25 14:13:42 +01:00
Richard W.M. Jones
5c8f073786 daemon: Mark some functions as attribute((noreturn)). 2012-10-25 14:13:42 +01:00
Richard W.M. Jones
91c07d2a06 fish: Fix test-events.sh because of new debug message.
Commit 2e90f43129 added a debug message
which isn't filtered out by the set of grep -v's in this test.
Therefore this test would fail when run with LIBGUESTFS_DEBUG=1.
2012-10-24 11:16:55 +01:00
Richard W.M. Jones
a66fd2fac2 resize: Depend explicitly on Unix module.
Commit a0722c7ad8 introduced a
dependency on the Unix module.  This was not listed in the list of
'-package's, but as long as you had ocaml-gettext installed it would
still work because that pulled in Unix implicitly.

Thanks Olaf Hering.
2012-10-22 12:20:27 +01:00
Richard W.M. Jones
6e63636869 Version 1.19.53. 2012-10-19 11:08:08 +01:00
Richard W.M. Jones
0e0bea70dd filearch: Use command mini-library to run external cpio command. 2012-10-18 22:12:28 +01:00
Richard W.M. Jones
af5ec9381e fuse: Use command mini-library to run the fusermount command. 2012-10-18 22:11:54 +01:00
Richard W.M. Jones
95b83ef9d4 info: Use command mini-library to run 'qemu-img info' commands. 2012-10-18 22:11:53 +01:00
Richard W.M. Jones
a3598aa257 inspect: Use command mini-library to parse the output of db_dump command. 2012-10-18 22:11:53 +01:00
Richard W.M. Jones
019b840e47 inspect: Change icon code to use command mini-lib instead of system(3). 2012-10-18 22:11:53 +01:00
Richard W.M. Jones
7917e55ddb launch: libvirt: Use command mini-library to run qemu-img create command. 2012-10-18 22:11:53 +01:00
Richard W.M. Jones
a0ead23016 launch: appliance: Use command mini-library to parse output of qemu -help etc. 2012-10-18 22:11:52 +01:00
Richard W.M. Jones
8d4f3f85f2 appliance: Use command mini-library to run febootstrap-supermin-helper (RHBZ#713678) 2012-10-18 22:11:52 +01:00
Richard W.M. Jones
fa209341f8 lib: Change guestfs___remove_tmpdir function to use command mini-library. 2012-10-18 22:11:49 +01:00
Richard W.M. Jones
2e90f43129 lib: Add a new 'command' mini-library for running external commands.
This is a wrapper or mini-library for running external command,
loosely based on libvirt's virCommand interface.

Amongst the advantages are:

 - Can redirect errors into the error log (RHBZ#713678).
 - Can redirect output into a callback function.
 - Handles shell quoting properly.
 - Safely resets signal handlers, closes file descriptors, etc.
 - Single place where we can implement other improvements in future.
2012-10-18 21:52:08 +01:00
Richard W.M. Jones
2dab72794e valgrind: Add suppression for memory leak in libdl:_dl_init function. 2012-10-18 17:43:38 +01:00
Wanlong Gao
773fa61141 NEW API: mktemp
Used to create temporary directory or file with an optional suffix.

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

RWMJ:

 - Split this out into a new file (daemon/mktemp.c).

 - I don't see a reason to deprecate the mkdtemp function which
   works fine.  Instead remove complex dir-making code from the
   new function.

 - Test and fix the patch (missing close(fd)).
2012-10-17 11:12:07 +01:00
Richard W.M. Jones
67e483689c configure: Add db5.1_dump, db5.1_load for Debian Wheezy. 2012-10-17 10:31:54 +01:00
Wanlong Gao
978d16ec76 TODO: remove the already implemented yum cache clean feature
The cleanup of package managers cache is already implemented
by sprep_operation_package_manager_cache.ml, so remove this
TODO item.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-10-17 10:27:38 +01:00
Richard W.M. Jones
25ec619a46 todo: Implement Ruby blocking calls. 2012-10-16 09:12:18 +01:00
Richard W.M. Jones
99bd15ad0e generator: Add 'blocking' flag to marking blocking (long-running) functions.
In languages like Python where we release a global lock around
long-running libguestfs functions, it is also useful to *not* release
this lock for small, non-blocking functions.

Therefore mark all functions with a 'blocking' boolean flag.  It
defaults to true, and is true by definition for all daemon functions.
For non-daemon functions, I have classified them manually.

Only when the blocking flag is set do we generate the code to release
and reacquire the lock around libguestfs calls.
2012-10-15 22:38:27 +01:00
Richard W.M. Jones
3d46f7dc03 ocaml: Get rid of CAMLprim.
It's wrong to use it, and in any case it doesn't do anything on Linux.
2012-10-15 22:38:27 +01:00
Richard W.M. Jones
8a89c72821 Update release notes. 2012-10-15 18:04:54 +01:00
Richard W.M. Jones
c164cc9bea lib: Add a test for environment parsing functions.
This updates commit 9466060201.
2012-10-15 16:35:13 +01:00
Richard W.M. Jones
ec1d239872 lib: Fix guestfs_create_flags example program in man page.
This fixes commit 9466060201.
2012-10-15 16:34:23 +01:00
Richard W.M. Jones
a0722c7ad8 resize, sparsify: Suppress progress bar when output is not a tty. 2012-10-15 15:51:55 +01:00
Richard W.M. Jones
c9acb029ed sparsify: Fix dependencies so they include resize/progress.*
This fixes commit 91b2238fc8.
2012-10-15 15:51:21 +01:00
Richard W.M. Jones
471f4e64d3 libvirt: auth: Some clarifications of the API from Dan Berrange.
This updates commit d83d17e9db.
2012-10-15 15:44:15 +01:00
Richard W.M. Jones
9466060201 New APIs: guestfs_create_flags, guestfs_parse_environment,
guestfs_parse_environment_list.

Add a new function for creating a handle:

 guestfs_h *guestfs_create_flags (unsigned flags [, ...]);

This variant lets you supply flags and extra arguments, although extra
arguments are not used at the moment.

Of particular interest is the ability to separate the creation of the
handle from the parsing of environment variables like
LIBGUESTFS_DEBUG.  guestfs_create does both together, which prevents
us from propagating errors from parsing environment variables back to
the caller (guestfs_create has always printed any errors on stderr and
then just ignored them).

If you are interested in these errors, you can now write:

 g = guestfs_create_flags (GUESTFS_CREATE_NO_ENVIRONMENT);
 if (!g)
   exit (EXIT_FAILURE);
 r = guestfs_parse_environment (g);
 if (!r)
   exit (EXIT_FAILURE);

Also you can *omit* the call to guestfs_parse_environment, which
creates a handle unaffected by the environment (which was not possible
before).

This commit also includes new (backwards compatible) changes to the
OCaml, Perl, Python, Ruby and Java constructors that let you use the
flags.
2012-10-15 15:04:43 +01:00
Richard W.M. Jones
389cb608df ruby: Add RUBYLIB to run script. 2012-10-15 14:51:40 +01:00
Richard W.M. Jones
f65c9bfcf2 Version 1.19.52. 2012-10-14 13:39:18 +01:00
Richard W.M. Jones
1c1630bb23 Update PO files from Transifex.
Also run 'make update-po'.
2012-10-14 13:39:08 +01:00
Richard W.M. Jones
c36456cf03 Update API support. 2012-10-14 13:23:00 +01:00
Richard W.M. Jones
626ca8e74f valgrind: Fix FUSE memory leak suppression. 2012-10-14 12:54:02 +01:00
Richard W.M. Jones
d83d17e9db New APIs: Model libvirt authentication events through the API.
This commit models libvirt authentication events through the API,
adding one new event (GUESTFS_EVENT_LIBVIRT_AUTH) and several new
APIs:

  guestfs_set_libvirt_supported_credentials
  guestfs_get_libvirt_requested_credentials
  guestfs_get_libvirt_requested_credential_prompt
  guestfs_get_libvirt_requested_credential_challenge
  guestfs_get_libvirt_requested_credential_defresult
  guestfs_set_libvirt_requested_credential

See the documentation and example which shows how to use the new API.

This commit also changes existing calls to virConnectOpen* within the
library so that the new API is used.

Also included is an example (but not a test, because it's hard to see
how to automatically test the libvirt API).
2012-10-13 20:54:07 +01:00
Richard W.M. Jones
07d0546f5d configure: Add --without-libvirt option.
Normally we check if libvirt is installed, and the default is still to
do this.

However having this option makes it simpler to check if a change to
the code has broken the case where libvirt is not installed.

In fact, this change revealed one such place, which is also fixed in
this commit.
2012-10-13 20:52:31 +01:00
Richard W.M. Jones
085bf7c97a docs: Make 'EVENTS' into its own =head1 section.
For some reason it was stuck under "CALLS WITH OPTIONAL ARGUMENTS",
which made no sense.
2012-10-13 16:04:21 +01:00
Richard W.M. Jones
96a76c79e4 launch: libvirt: Make handle data conditional on HAVE_LIBVIRT.
This means that we can use virConnectPtr and virDomainPtr instead of
using void* types.  In the case where libvirt support is disabled or
not present, effectively nothing changes.
2012-10-13 16:04:21 +01:00
Richard W.M. Jones
325d67c615 lib: Rename src/libvirtdomain.c -> src/libvirt-domain.c.
No change, just code motion.
2012-10-13 16:04:18 +01:00
Richard W.M. Jones
64e8e0011c lib: Pointer arg to safe_memdup function should be const. 2012-10-13 15:35:47 +01:00
Richard W.M. Jones
bdfe221671 configure: Fix capitalization in configure script.
Just make the output of ./configure --help and the <config.h>
file consistent.
2012-10-12 22:03:11 +01:00
Richard W.M. Jones
467fb589b9 configure: Fix C++ compiler test so it doesn't print random junk. 2012-10-12 22:02:55 +01:00
Richard W.M. Jones
e6e999eac2 Version 1.19.51. 2012-10-11 17:12:51 +01:00
Richard W.M. Jones
15b9ed3ed2 daemon: Call udev-settle at the start of the daemon. 2012-10-11 17:12:21 +01:00
Richard W.M. Jones
67e9572286 launch: libvirt: Always set <qemu:env> TMPDIR.
If TMPDIR is not set, we must choose one, because otherwise libvirt
will use a random TMPDIR: http://bugzilla.redhat.com/865464

The convenient guestfs___persistent_tmpdir function does everything
needed in this case.
2012-10-11 15:50:41 +01:00
Richard W.M. Jones
911a16a9fa fish: progress bar: Send interactive progress bar output to /dev/tty (RHBZ#859875). 2012-10-11 13:53:12 +00:00
Richard W.M. Jones
91b2238fc8 sparsify: Re-use progress bar wrapper code from virt-resize.
The code was identical -- just copied with s/resize/sparsify/.
Instead of duplicating identical code, cause the Makefile.am to use
the code from the ../resize/ directory.

Unfortunately because there are two Utils modules (which are
different), this means we had to rename those modules to Resize_utils
and Sparsify_utils respectively.  So this is a rather larger change
than intended.  However it's just code motion.
2012-10-11 13:37:35 +00:00
Richard W.M. Jones
f4a2aecd5f fish: inspect: Canonicalize paths for printing (RHBZ#859876). 2012-10-11 13:18:46 +00:00
Richard W.M. Jones
c34dcf184e fish: inspect: Move variable decls to top of function.
This is just code motion.
2012-10-11 13:12:26 +00:00
Richard W.M. Jones
77ce157db8 Version 1.19.50. 2012-10-10 21:22:43 +00:00
Richard W.M. Jones
316c2a6fc7 docs: Fix documentation about hotplugging. 2012-10-10 21:11:17 +00:00
Richard W.M. Jones
2e388e8a37 launch: Add warning not to avoid calling launch twice on the same handle.
For more information on this topic, see:
https://www.redhat.com/archives/libguestfs/2012-October/msg00045.html
2012-10-10 21:05:52 +00:00
Richard W.M. Jones
7376811983 Revert "btrfs: Add a workaround for btrfs failures seen with kernel 3.7.0."
Revert "btrfs: Add an extended workaround for btrfs failures seen with kernel 3.7.0."

Reverted these workaround, since we may have found a fix for the btrfs
bug itself (for details see RHBZ#863978).

This reverts commit d9e5b514aa
and commit a03f536f0d.
2012-10-10 18:26:18 +01:00
Richard W.M. Jones
33f49d85c2 tests: Fix test-qemudie-* so they re-adds the disk on second launch.
Commit ed7fda161e changed the
way that the drives are handled across appliance shutdowns.

Previously during the following sequence of calls:

  create the handle
  add drive(s)
  launch
  kill subprocess
  launch

the added drives are still in the handle at the second launch.

After the above commit, the added drives are removed from the handle,
which means the second launch happens with no drives (which could be
an error).

This was never actually defined either way, so in this case fix the
test to re-add the drive before the second launch.

Since hotplugging was added, it isn't really feasible to return to the
original semantics, since users might remove drives, in which case we
have lost information about those drives so we cannot restore them on
the second launch.

NOTE: PLEASE CALLERS DON'T DO THIS!  Always use a new handle for each
launch of the appliance.
2012-10-10 16:46:35 +00:00
Richard W.M. Jones
a03f536f0d btrfs: Add an extended workaround for btrfs failures seen with kernel 3.7.0.
See:
https://bugzilla.redhat.com/show_bug.cgi?id=863978
and:
http://thread.gmane.org/gmane.comp.file-systems.btrfs/20257

This extends the fix in commit d9e5b514aa
because I missed the case where mkfs.btrfs is called directly.
2012-10-10 11:15:39 +01:00
Richard W.M. Jones
0032c60336 docs: Fully document all subdirectories of the source. 2012-10-09 21:58:21 +01:00
Richard W.M. Jones
b54fa22cd0 docs: Add overview to guestfs(3)/EXTENDING LIBGUESTFS. 2012-10-09 21:57:54 +01:00
Richard W.M. Jones
e10647e334 appliance: Add 99-guestfs-serial.rules to EXTRA_DIST.
This fixes commit 7786d56db8.
2012-10-09 12:06:03 +01:00
Richard W.M. Jones
e4bca563b4 Version 1.19.49. 2012-10-09 11:21:17 +01:00
Richard W.M. Jones
d9e5b514aa btrfs: Add a workaround for btrfs failures seen with kernel 3.7.0.
See:
https://bugzilla.redhat.com/show_bug.cgi?id=863978
and:
http://thread.gmane.org/gmane.comp.file-systems.btrfs/20257
2012-10-09 11:09:17 +01:00
Olaf Hering
45c9fbd6f5 launch: appliance is optional
# virt-filesystems -v -d 6326ad4e-5805-2ab4-1338-d1dad8c76162 --all
libguestfs: libvirt version = 10002
libguestfs: [00000ms] connect to libvirt
libguestfs: [00001ms] get libvirt capabilities
libguestfs: [00234ms] build appliance
libguestfs: [00234ms] create libvirt XML
libguestfs: error: error constructing libvirt XML at "xmlTextWriterWriteAttribute (xo, BAD_CAST "file", BAD_CAST appliance)": No such file or directory
libguestfs: closing guestfs handle 0x656270 (state 0)

 # ls -lh /usr/lib64/guestfs/*
-rw-r--r-- 1 root root  13M Oct  8 16:15 /usr/lib64/guestfs/initramfs.x86_64.img
-rw-r--r-- 1 root root 3.7M Oct  6 09:25 /usr/lib64/guestfs/vmlinuz.x86_64

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2012-10-09 09:45:42 +01:00
Richard W.M. Jones
0a85fbc946 Add support for hotplugging (removing disks).
New API: remove-drive.

Note because of a bug in fuser, this only works with psmisc >= 22.20.

This also updates the hotplugging tests.
2012-10-09 09:45:42 +01:00
Richard W.M. Jones
18b7f09f36 Add support for hotplugging (adding disks) to the libvirt attach-method.
When libvirt is used, we can allow disks to be hotplugged.
guestfs_add_drive can be called after launch to hot-add a disk.

When a disk is hot-added, we first ask libvirt to add the disk to the
appliance, then we make an internal call into the appliance to get it
to wait for the disk to appear (ie. udev_settle ()).

Hot-added disks are tracked in the g->drives array.

This also adds a test.
2012-10-08 20:04:53 +01:00
Richard W.M. Jones
7786d56db8 launch: Add add_drive 'label' option.
New API: list-disk-labels

Allow the user to pass an optional disk label when adding a drive.

This is passed through to qemu / libvirt using the disk serial field,
and from there to the appliance which exposes it through udev,
creating a special alias of the device /dev/disk/guestfs/<label>.
Partitions are named /dev/disk/guestfs/<label><partnum>.

virtio-blk and virtio-scsi limit the serial field to 20 bytes.  We
further limit the name to maximum 20 ASCII characters in [a-zA-Z].

list-devices and list-partitions are not changed: these calls still
return raw block device names.  However a new call, list-disk-labels,
returns a hash table allowing callers to map between disk labels, and
block device and partition names.

This commit also includes a test.
2012-10-08 20:04:47 +01:00
Richard W.M. Jones
3ad44c8660 launch: libvirt: Create qcow2 overlays for read-only drives and the appliance.
Instead of adding the snapshot=on option via <qemu:arg>, create qcow2
overlays for any read-only drives and the appliance using 'qemu-img
create' + a temporary file.

This is a workaround for missing support for <transient/> in libvirt's
qemu driver.  Also for the unpredictable way that libvirtd handles
$TMPDIR: we want to control where the temporary disk is created.

Currently it is also much slower, because qemu-img is slow.  However
we hope to fix qemu upstream.
2012-10-08 14:41:20 +01:00
Richard W.M. Jones
ed7fda161e launch: Make g->drives into an array (was a linked list).
Using an array simplifies the implementation of hotplugging.
2012-10-08 14:38:50 +01:00
Richard W.M. Jones
8354dc46fd Version 1.19.48.
We need to regenerate the tarball because the previous one
had the guestfsd man page missing.  Hence bumped version
number.
2012-10-07 11:58:36 +01:00
Richard W.M. Jones
62e56876c8 daemon: Add guestfsd.pod to EXTRA_DIST.
This fixes commit df2469a48f.
2012-10-07 11:55:01 +01:00
Richard W.M. Jones
63eae6fa6f Version 1.19.47. 2012-10-06 23:35:14 +01:00
Richard W.M. Jones
9f24ac2db0 launch: Add private data pointer to the struct drive.
This can be used by the attach-method, eg. for libvirt-only data.
2012-10-06 23:19:21 +01:00
Richard W.M. Jones
6867b0a3fb launch: add_null_drive: Force null drive to be writable.
Because we create a special file, there is no point forcing qemu
to create an overlay as well.  Save time by setting readonly = 0.
2012-10-06 23:19:20 +01:00
Richard W.M. Jones
328510121a launch: Rearrange code for adding drives to the g->drives list in the handle.
This is just code motion.
2012-10-06 23:15:49 +01:00
Richard W.M. Jones
92feed7d66 build: Use 'tmp-d' as name of temporary directory instead of 'tmp'.
When building supermin.d/daemon.img, use 'tmp-d' instead of 'tmp'
as the name of the temporary directory.

This is just code motion.
2012-10-06 23:15:49 +01:00
Richard W.M. Jones
1467ea00b8 docs: add_drive: Clean up documentation of the 'filename' parameter.
Also, remove duplicate documentation of using '/dev/null' as the
filename.
2012-10-06 23:15:48 +01:00
Richard W.M. Jones
013fb91a69 tests: Fix rhbz690819.sh to skip when attach-method is libvirt.
This sets the iface parameter (implicitly), which is not supported yet
by the libvirt backend.

This updates commit 8e198dc1c5.
2012-10-06 23:15:48 +01:00
Richard W.M. Jones
9bd3d5bc6d FAQ: Document debug* and internal* functions in the FAQ. 2012-10-06 17:42:05 +01:00
Richard W.M. Jones
8e198dc1c5 launch: libvirt: The drive 'iface' parameter is not yet supported.
We could add support, but at the moment return an error
if the user tries to use the iface parameter.
2012-10-03 11:15:30 +01:00
Richard W.M. Jones
60650da1ed docs: Minor cleanup of documentation for add_drive 'name' parameter. 2012-10-03 11:15:30 +01:00
Richard W.M. Jones
4a4ca0c01d syntax: Use __PATTERNS__ instead of @PATTERNS@ in podwrapper man pages.
It is slightly dangerous to use @PATTERNS@, since these might
be substituted by autoconf when they appear in Makefile.am files.
2012-10-03 09:22:45 +01:00
Richard W.M. Jones
df2469a48f docs: Add guestfsd(8) man page. 2012-10-03 08:55:24 +01:00
Richard W.M. Jones
378e5d6722 Version 1.19.46. 2012-10-01 13:36:43 +01:00
Richard W.M. Jones
572291c64e configure: Rearrange build options report in ./configure output.
This had accreted over a long period of time, so it wasn't
arranged very logically.
2012-10-01 13:36:42 +01:00
Richard W.M. Jones
6f53d49a27 daemon: When sorting devices, don't fail on mix of /dev/sd and /dev/vd
(RHBZ#858128).

If compare_device_names was given two devices with devices with
different interfaces (eg. /dev/sda and /dev/vda) then it would try to
compare the partition numbers, and fail when it could parse them.

It's arguable what we should be doing in this case (except for
strongly discouraging people from using the interface feature), but
let's at least not cause the daemon to assert-fail.

Found by Red Hat QA, thanks Mohua Li.
2012-09-28 15:09:51 +01:00
Richard W.M. Jones
9ea6e97014 inspection: Fix calls to case_sensitive_path (RHBZ#858126).
Don't assume that if guestfs_case_sensitive_path returns NULL, that it
means the file does not exist.

The (previously undefined) behaviour of case_sensitive_path was that a
NULL return meant "either the file doesn't exist or some other error".
However in commit 973581780d this was
changed so that if the last element of the path didn't exist, it was
assumed to be a new file and the (non-NULL) path of the new file is
returned.

This change breaks code (including in libguestfs) which tries to use
case_sensitive_path as a dual-purpose call to fix-up a path for
Windows and test if the file exists.  Such code should be rewritten so
that it explicitly tests for file existence after calling
case_sensitive_path.

I examined all the calls to case_sensitive_path in libguestfs and
modified them where necessary.
2012-09-28 15:09:50 +01:00
Richard W.M. Jones
55b7c4df78 virt-edit: If case_sensitive_path returns an error, exit.
The 'windows_path' function was blindly copied from virt-cat.  In
virt-cat, errors are checked by the caller to 'windows_path'.  But
virt-edit lacks this check.  Change the function in virt-edit to add a
check and exit on error.
2012-09-28 15:09:50 +01:00
Richard W.M. Jones
6cd040fcdf Version 1.19.45. 2012-09-26 21:21:02 +01:00
Richard W.M. Jones
8d63edaa93 sysprep: Typo in man page: resets -> reset. 2012-09-26 21:16:14 +01:00
Richard W.M. Jones
91617069b9 run: Label tmp directory.
There's not really any point just documenting that people
should label the tmp directory, when we can just label it.
So change the ./run script so it calls chcon.

However it's not a failure if chcon doesn't work.  If SELinux
is not installed or is disabled, then labelling will fail.
2012-09-26 21:03:37 +01:00
Richard W.M. Jones
f7e138835a recipes: Add a section about diagnosing hanging guests. 2012-09-26 20:56:44 +01:00
Richard W.M. Jones
4f3048c6be test-tool: Add prominent warning about including complete output.
Everyone ignores the documentation.  Everyone ignores me even
when I specifically tell them to include the complete output.

Place a prominent notice at the beginning of the output.
2012-09-26 12:26:33 +01:00
Richard W.M. Jones
ca2e65275d test-tool: guestfs_get_path might return NULL.
It would almost certainly indicate a bug if it happens, but
don't rely on printf not segfaulting if it did happen.
2012-09-26 12:26:28 +01:00
Richard W.M. Jones
b44d82ec8d Revert "test-launch-race: Add SELinux label to $TMPDIR."
Because RHBZ#860235 has been fixed in selinux-policy 3.11.1-25.fc18.

This reverts commit 7fc838cca3.
2012-09-26 12:04:02 +01:00
Richard W.M. Jones
9b7813c5bd guestfs-testing(1): Start by running libguestfs-test-tool. 2012-09-26 12:03:16 +01:00
Wanlong Gao
f7f746a98e remove the useless "h" option
"h" option is not enabled in virt-cat, remove it.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-09-26 10:26:01 +01:00
Richard W.M. Jones
19b29c3637 FAQ: Miscellaneous cleanups.
- Use S<...> for non-breaking spaces.
- Arrange the builds section better.
- Add a section on enabling sVirt.
- Other small fixes.
2012-09-25 19:00:50 +01:00
Richard W.M. Jones
d19e557df5 docs: Link to guestfs-recipes(1) from intro in guestfs(3). 2012-09-25 18:30:36 +01:00
Richard W.M. Jones
a8056050c0 gobject: No need to remove old API files.
In commit 3d84ca76fe we changed the
generator so it now automatically removes old API files.
2012-09-25 14:26:38 +01:00
Richard W.M. Jones
7fc838cca3 test-launch-race: Add SELinux label to $TMPDIR.
This is a temporary workaround for
https://bugzilla.redhat.com/show_bug.cgi?id=860235
which can be removed once this bug is fixed.
2012-09-25 12:16:25 +01:00
Richard W.M. Jones
b3bf53714b libvirt >= 0.10.2 required for libvirt backend. 2012-09-24 21:25:31 +01:00
Richard W.M. Jones
c9cccb776e Version 1.19.44. 2012-09-24 17:00:03 +01:00
Wanlong Gao
45d459f402 Fix tests/bigdirs/test-big-dirs.pl to use mke2fs
Let tests/bigdirs/test-big-dirs.pl uses mke2fs to create small
inode ratio files.

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

RWMJ:
 - Fix invocation of mke2fs with optional arguments.
 - Run the test to check it works.
2012-09-24 16:41:07 +01:00
Wanlong Gao
0c2aab966a NEW API:ext:mke2fs
New api mke2fs for full configuration of filesystem.

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

RWMJ:
 - Update description.
 - Run and fix the tests.
 - Remove bogus filename from po/POTFILES.
2012-09-24 16:40:46 +01:00
Richard W.M. Jones
a297a9348f tests/bigdirs: Add empty TESTS= rule.
Without this empty rule, automake doesn't generate the rest of the
testing infrastructure, so you can't enable the test yourself by doing
'make check TESTS=test-big-dirs.pl'.
2012-09-24 16:40:46 +01:00
Richard W.M. Jones
790c1a0c7b generator: xdr: Re-code procedure table.
This is just code motion.
2012-09-24 09:46:24 +01:00
Richard W.M. Jones
db6a851240 generator: Tidy up comments in guestfs_protocol.x. 2012-09-24 09:46:14 +01:00
Richard W.M. Jones
a95d4261b8 generator: Allow an optional emacs-mode at the top of generated files. 2012-09-24 09:34:37 +01:00
Richard W.M. Jones
a3d7f5bc17 generator: The default input files are 'generator/ *.ml' [sic].
Since generator source files were renamed, the comment at the
top of each generated file was wrong.

Unfortunately we cannot allow /* to appear within a comment,
so the space is necessary.
2012-09-24 09:34:33 +01:00
Olaf Hering
1949016e89 sysprep: handle at jobs in cron-spool operation
cron-spool claims to remove at jobs, but it has no code to actually do
that. Add patterns to remove files in known at spool locations.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2012-09-22 12:58:13 +01:00
Olaf Hering
55fef0e4e6 sysprep: handle distro specific sysv scripts
Currently firstboot would only work on redhat-based images.
Handle redhat-based, suse-based and debian guests, error out in case of an
unknown distro.
Update firstboot.sh:
 - make sure scripts exists and can be executed
 - add LSB header to avoid insserv warnings later on
 - run script only if called with "start"
Update functions, pass only required options.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2012-09-22 12:58:08 +01:00
Richard W.M. Jones
09c372ea25 test-launch-race: Add comment. 2012-09-22 10:47:11 +01:00
Richard W.M. Jones
ab0610d752 Version 1.19.43. 2012-09-21 16:31:05 +01:00
Olaf Hering
0e7d3de002 sysprep: handle suse-based in hostname operation
Signed-off-by: Olaf Hering <olaf@aepfle.de>
2012-09-21 14:09:10 +01:00
Richard W.M. Jones
1b364d74a8 launch: Handle guestfs_config qemu_value == NULL.
The second parameter to 'config' may be NULL.

In commit 52fa23d74f (refactoring of
guestfs_config) the code this got lost, and guestfs_config would
segfault if qemu_value was NULL.

Also this fixes the libvirt method to handle the same case.

I checked libguestfs-1.18 and -1.16 branches, and this problem does
NOT affect them.
2012-09-21 12:57:11 +01:00
Olaf Hering
763ec36cf0 Update SuSE Linux detection.
Update SuSE Linux detection. Up to now everything with a
/etc/SuSE-release file was treated as openSuSE. With this change SLES
based distributions such as "SUSE Linux Enterprise Server", "SUSE
Linux Enterprise Desktop" and "Novell Linux Desktop" will show up as
"sles". The 'opensuse' detection was updated to handle older openSuSE
releases as well as the well known SuSE Linux releases, starting from
6.0. Everything else with a /etc/SuSE-release file will show up as
"suse-based".

Here is a collection of release files:

==> Dist/6.0/etc/SuSE-release <==
SuSE Linux 6.0 (i386)
VERSION = 6.0

==> Dist/6.1/etc/SuSE-release <==
SuSE Linux 6.1 (i386)
VERSION = 6.1

==> Dist/6.2/etc/SuSE-release <==
SuSE Linux 6.2 (i386)
VERSION = 6.2

==> Dist/6.3/etc/SuSE-release <==
SuSE Linux 6.3 (i386)
VERSION = 6.3

==> Dist/6.4/etc/SuSE-release <==
SuSE Linux 6.4 (i386)
VERSION = 6.4

==> Dist/7.0/etc/SuSE-release <==
SuSE Linux 7.0 (i386)
VERSION = 7.0

==> Dist/7.1/etc/SuSE-release <==
SuSE Linux 7.1 (i386)
VERSION = 7.1

==> Dist/7.2/etc/SuSE-release <==
SuSE Linux 7.2 (i386)
VERSION = 7.2

==> Dist/7.3/etc/SuSE-release <==
SuSE Linux 7.3 (i386)
VERSION = 7.3

==> Dist/8.0/etc/SuSE-release <==
SuSE Linux 8.0 (i386)
VERSION = 8.0

==> Dist/8.1/etc/SuSE-release <==
SuSE Linux 8.1 (i386)
VERSION = 8.1

==> Dist/8.2/etc/SuSE-release <==
SuSE Linux 8.2 (x86-64)
VERSION = 8.2

==> Dist/9.0/etc/SuSE-release <==
SuSE Linux 9.0 (x86-64)
VERSION = 9.0

==> Dist/9.1/etc/SuSE-release <==
SuSE Linux 9.1 (x86-64)
VERSION = 9.1

==> Dist/9.2/etc/SuSE-release <==
SuSE Linux 9.2 (x86-64)
VERSION = 9.2

==> Dist/9.3/etc/SuSE-release <==
SuSE Linux 9.3 (x86-64)
VERSION = 9.3

==> Dist/10.0/etc/SuSE-release <==
SUSE LINUX 10.0 (X86-64) OSS
VERSION = 10.0

==> Dist/10.1-remastered/etc/SuSE-release <==
SUSE LINUX 10.1 (X86-64)
VERSION = 10.1

==> Dist/10.1/etc/SuSE-release <==
SUSE Linux 10.1 (X86-64) Beta8
VERSION = 10.1

==> Dist/10.2/etc/SuSE-release <==
openSUSE 10.2 (X86-64)
VERSION = 10.2

==> Dist/10.3/etc/SuSE-release <==
openSUSE 10.3 (X86-64)
VERSION = 10.3

==> Dist/11.0/etc/SuSE-release <==
openSUSE 11.0 (X86-64)
VERSION = 11.0

==> Dist/11.1/etc/SuSE-release <==
openSUSE 11.1 (x86_64)
VERSION = 11.1

==> Dist/11.2/etc/SuSE-release <==
openSUSE 11.2 (x86_64)
VERSION = 11.2

==> Dist/11.3/etc/SuSE-release <==
openSUSE 11.3 (x86_64)
VERSION = 11.3

==> Dist/11.4/etc/SuSE-release <==
openSUSE 11.4 (x86_64)
VERSION = 11.4
CODENAME = Celadon

==> Dist/12.1/etc/SuSE-release <==
openSUSE 12.1 (x86_64)
VERSION = 12.1
CODENAME = Asparagus

==> Dist/12.2/etc/SuSE-release <==
openSUSE 12.2 (x86_64)
VERSION = 12.2
CODENAME = Mantis

==> Dist/sles8/etc/SuSE-release <==
SuSE SLES-8 (AMD64)
VERSION = 8.1

==> Dist/sles9/etc/SuSE-release <==
SUSE LINUX Enterprise Server 9 (x86_64)
VERSION = 9

==> Dist/sles9sp2/etc/SuSE-release <==
SUSE LINUX Enterprise Server 9 (x86_64)
VERSION = 9
PATCHLEVEL = 2

==> Dist/sles9sp3/etc/SuSE-release <==
SUSE LINUX Enterprise Server 9 (x86_64)
VERSION = 9
PATCHLEVEL = 3

==> Dist/sles9sp4/etc/SuSE-release <==
SUSE LINUX Enterprise Server 9 (x86_64)
VERSION = 9
PATCHLEVEL = 4
==> Dist/sled10/etc/SuSE-release <==
SUSE Linux Enterprise Desktop 10 (x86_64)
VERSION = 10

==> Dist/sled10sp1/etc/SuSE-release <==
SUSE Linux Enterprise Desktop 10 (x86_64)
VERSION = 10
PATCHLEVEL = 1

==> Dist/sled10sp2/etc/SuSE-release <==
SUSE Linux Enterprise Desktop 10 (x86_64)
VERSION = 10
PATCHLEVEL = 2

==> Dist/sled10sp3/etc/SuSE-release <==
SUSE Linux Enterprise Desktop 10 (x86_64)
VERSION = 10
PATCHLEVEL = 3

==> Dist/sled10sp4/etc/SuSE-release <==
SUSE Linux Enterprise Desktop 10 (x86_64)
VERSION = 10
PATCHLEVEL = 4

==> Dist/sled11/etc/SuSE-release <==
SUSE Linux Enterprise Desktop 11 (x86_64)
VERSION = 11
PATCHLEVEL = 0

==> Dist/sled11sp1/etc/SuSE-release <==
SUSE Linux Enterprise Desktop 11 (x86_64)
VERSION = 11
PATCHLEVEL = 1

==> Dist/sled11sp2/etc/SuSE-release <==
SUSE Linux Enterprise Desktop 11 (x86_64)
VERSION = 11
PATCHLEVEL = 2

==> Dist/sles10/etc/SuSE-release <==
SUSE Linux Enterprise Server 10 (x86_64)
VERSION = 10

==> Dist/sles10sp1/etc/SuSE-release <==
SUSE Linux Enterprise Server 10 (x86_64)
VERSION = 10
PATCHLEVEL = 1

==> Dist/sles10sp2/etc/SuSE-release <==
SUSE Linux Enterprise Server 10 (x86_64)
VERSION = 10
PATCHLEVEL = 2

==> Dist/sles10sp3/etc/SuSE-release <==
SUSE Linux Enterprise Server 10 (x86_64)
VERSION = 10
PATCHLEVEL = 3

==> Dist/sles10sp4/etc/SuSE-release <==
SUSE Linux Enterprise Server 10 (x86_64)
VERSION = 10
PATCHLEVEL = 4

==> Dist/sles11/etc/SuSE-release <==
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 0

==> Dist/sles11sp1/etc/SuSE-release <==
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 1

==> Dist/sles11sp2/etc/SuSE-release <==
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 2

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2012-09-21 11:43:48 +01:00
Hilko Bengen
71f87d9a8f ./run: Keep gnome-keyring from disturbing test script output 2012-09-20 21:12:38 +01:00
Hilko Bengen
e5d01c21d7 ./run: Make sure that the temporary directory exists so test scripts can produce output files 2012-09-20 21:12:38 +01:00
Hilko Bengen
e482f2faf0 python: PyInt_* no longer exists in python3, replace with PyLong_* 2012-09-20 21:12:38 +01:00
Olaf Hering
b36b44af9e rename local variable to avoid clash with match macro
match will expand to guestfs___match, rename the local variable to avoid clash.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2012-09-20 21:08:22 +01:00
Richard W.M. Jones
64cc0dafd0 docs: Add links to various guestfs-* man pages from guestfs(3). 2012-09-20 17:56:40 +01:00
Richard W.M. Jones
8aa8eb205b recipes: Add section about uploading raw filesystem content. 2012-09-20 17:56:10 +01:00
Richard W.M. Jones
840deea120 launch: Make the "launched failed" message more explanatory.
Since this is the most common error seen by people who have
installation problems, buggy qemu, etc, and since no one reads the
FAQ, describe in this error message what resources are available to
debug launch problems.
2012-09-20 11:41:16 +01:00
Olaf Hering
181de70feb sysprep: handle SuSE in random-seed operation
Signed-off-by: Olaf Hering <olaf@aepfle.de>
2012-09-19 21:05:29 +01:00
Olaf Hering
d6c11b0a3d sysprep: add zypper to package-manager-cache operation
libzypp and zypper store their cache files in
/var/cache/zypp/{packages,raw,solv}/ and /var/cache/zypper/RPMS/
Add a single pattern to match both cases.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2012-09-19 21:05:29 +01:00
Olaf Hering
245608a735 sysprep: remove apache2, audit and ntp in logfile operation
Add more entries to the dump ground of logfile patterns.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2012-09-19 21:05:29 +01:00
Olaf Hering
ae0f60744b sysprep: handle SuSE in hostname operation
SuSE based installations store the hostname in /etc/HOSTNAME.
Add code to handle both opensuse and sles. Code to properly detect
the latter will be added with another patch.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2012-09-19 18:18:29 +01:00
Richard W.M. Jones
88c406feba sysprep: Create /etc/sysconfig/network file if it doesn't exist (RHBZ#858696). 2012-09-19 17:34:58 +01:00
Richard W.M. Jones
aeb2f76a58 extra-tests: Re-run the tests against upstream libvirt. 2012-09-18 12:52:37 +01:00
Richard W.M. Jones
157b5006db extra-tests: Clean up some comments about the upstream qemu tests. 2012-09-18 12:48:36 +01:00
Richard W.M. Jones
7e4b197cb6 extra-tests: Add scripts used by these tests to EXTRA_DIST. 2012-09-18 12:47:50 +01:00
Richard W.M. Jones
e4ef926d6f Version 1.19.42. 2012-09-17 23:06:44 +01:00
Richard W.M. Jones
a3ce000599 tmp: Ignore libguestfsXXXXXX temporary files in tmp dir. 2012-09-17 22:52:53 +01:00
Richard W.M. Jones
5479b8db58 ./run: Write temporary file in tmp directory.
We have a new 'tmp' directory under the top level dir for temporary
files.  Use it for the temporary output from the ./run script.
2012-09-17 22:52:40 +01:00
Richard W.M. Jones
f9f0767e20 launch: libvirt: Pass TMPDIR to qemu subprocess. 2012-09-17 16:34:59 +01:00
Richard W.M. Jones
a2dc3dbad0 New API: rm-f: remove a file, ignoring errors if it doesn't exist. 2012-09-17 16:25:53 +01:00
Richard W.M. Jones
74283d58cf inspect: Fix segfault and error caused by earlier code cleanups.
This fixes commit e128a627fb.
2012-09-17 14:50:31 +01:00
Richard W.M. Jones
2e17d78178 launch: libvirt: Disable sVirt if using a custom qemu (ie. setting <emulator>).
See:
https://bugzilla.redhat.com/show_bug.cgi?id=857659
especially Dan's comment 4.
2012-09-17 13:45:19 +01:00
Richard W.M. Jones
e128a627fb Fix multiple errors where jump skips variable initialization.
<file>: error: jump skips variable initialization [-Werror=jump-misses-init]

This has only just appeared, possibly related to previous gnulib
update.  In any case, this is just code motion / cleanup.
2012-09-17 13:37:06 +01:00
Richard W.M. Jones
c387b69cba daemon: stubs: Move all arg decls to top of function.
For some reason, argument declarations were handled
inconsistently for strings and non-string arguments.
Non-string arguments were all declared at the top of the
function stub, where as string arguments were declared
in place.

Be consistent.

This is just code motion.
2012-09-17 13:32:49 +01:00
Jim Meyering
176bd182d3 maint: remove a subsumed syntax-check rule
* cfg.mk (sc_prohibit_trailing_blank_lines): Remove rule.  It is now
subsumed by the much more efficient sc_prohibit_empty_lines_at_EOF
rule in gnulib's maint.mk.
2012-09-17 11:05:34 +01:00
Richard W.M. Jones
3988dec9b7 syntax: Exclude examples and test program from <config.h> requirement
(thanks Jim Meyering).
2012-09-17 10:15:43 +01:00
Richard W.M. Jones
72ab351ace syntax: Allow strncpy in launch-*.c files (thanks Jim Meyering).
We use strncpy, justifiably, to copy the socket name into
the fixed length Unix domain sun_path buffer.
2012-09-17 10:13:16 +01:00
Richard W.M. Jones
369709177e syntax: Exclude examples from strcmp and strncmp checks (thanks Jim Meyering). 2012-09-17 10:11:13 +01:00
Richard W.M. Jones
552576c7f9 syntax: Ignore documentation when testing for magic number exit() calls (thanks Jim Meyering). 2012-09-17 10:07:32 +01:00
Richard W.M. Jones
2100ba14fb syntax: Exclude PO files from doubled words test (thanks Jim Meyering). 2012-09-17 10:07:31 +01:00
Richard W.M. Jones
cb13ffe190 syntax: Remove definitions of O_CLOEXEC, except in examples (thanks Jim Meyering).
The gnulib <fcntl.h> replacement header will now define this symbol if
it's not defined already.
2012-09-17 10:07:31 +01:00
Richard W.M. Jones
2337b9ccd7 syntax: Exclude period in error message checks from PHP programs (thanks: Jim Meyering). 2012-09-17 10:07:31 +01:00
Richard W.M. Jones
fbdcfe2b77 syntax: Disable cast arg to free test (thanks Jim Meyering). 2012-09-17 10:07:31 +01:00
Richard W.M. Jones
b95fff1357 syntax: Exclude certain files from bindtextdomain test (thanks Jim Meyering). 2012-09-17 10:07:31 +01:00
Richard W.M. Jones
e942c02a2e Update to latest gnulib. 2012-09-17 10:07:27 +01:00
Richard W.M. Jones
946ae89a78 Version 1.19.41. 2012-09-16 13:35:07 +01:00
Richard W.M. Jones
e6bd0b87eb extra-tests: Write a qemu wrapper script on the fly.
Passing the $upstream_qemu environment variable is not reliable when
libvirt is involved: Environment variables are passed to the first
instance of the session libvirtd, but because libvirt reuses the
session libvirtd, subsequent environment variable settings are lost
(this is filed as RHBZ#856619).

Bypass all of this by writing a custom qemu-wrapper.sh which contains
the hard-coded values we want.
2012-09-15 17:36:15 +01:00
Richard W.M. Jones
2fd51c28fd extra-tests: Rerun extra tests with regular appliance attach method.
If libvirt is being used as the backend, rerun all the extra-tests
again using the regular appliance backend.
2012-09-15 14:41:06 +01:00
Richard W.M. Jones
509dd90c43 extra-tests: The upstream qemu test now reruns all the extra tests. 2012-09-15 14:41:06 +01:00
Richard W.M. Jones
eeb0c598ec extra-tests: Fix libvirt URI so we can run tests with libvirt attach-method. 2012-09-15 14:41:06 +01:00
Richard W.M. Jones
2cac8d490e syntax: Remove trailing whitespace.
Found by 'make syntax-check'.
2012-09-15 13:36:02 +01:00
Richard W.M. Jones
44a11e955b generator: Remove inaccurate comment.
The correct way to extend functions is documented in generator/README.
This comment was no longer accurate.
2012-09-15 13:27:50 +01:00
Richard W.M. Jones
6361810b53 syntax: Replace test == with = or -eq as appropriate.
Found by 'make syntax-check'.
2012-09-15 13:21:55 +01:00
Richard W.M. Jones
d26f402361 syntax: xfs: Rewrite split_strdup function to avoid use of strncpy.
Found by 'make syntax-check'.
2012-09-15 13:19:12 +01:00
Richard W.M. Jones
b0cefb417d syntax: Use STREQ/STRNEQ in place of strcmp.
Found by 'make syntax-check'.
2012-09-15 13:11:45 +01:00
Richard W.M. Jones
90b7c53b70 syntax: Remove include <signal.h> in file that doesn't use it.
Found by 'make syntax-check'.
2012-09-15 13:08:08 +01:00
Richard W.M. Jones
2383d7a78e syntax: Remove PATH_MAX-sized buffers allocated on the stack.
On Linux PATH_MAX is 4096, but on some platforms it can be much larger
or even not defined (ie. unlimited).  Therefore using a PATH_MAX-sized
stack buffer is not a great idea for portable programs.

This change removes use of PATH_MAX-sized stack-allocated buffers.

This change only applies to the library and standalone programs.
Inside the daemon, memory allocation is much more complicated so I
have not changed those (yet).

Found by 'make syntax-check'.
2012-09-15 13:01:10 +01:00
Richard W.M. Jones
a67129b0fb syntax: Remove gnulib "ignore-value.h" in files that don't use it.
Found by 'make syntax-check'.
2012-09-15 12:38:07 +01:00
Richard W.M. Jones
d6bb49a172 syntax: Remove include <dirent.h> in files that don't use it.
Found by 'make syntax-check'.
2012-09-15 12:35:59 +01:00
Richard W.M. Jones
9fce75aa13 syntax: Remove gnulib c-ctype.h in files that don't use it.
Found by 'make syntax-check'.
2012-09-15 12:34:41 +01:00
Richard W.M. Jones
6272e49f51 syntax: Remove include <assert.h> where assert is not used.
Found by 'make syntax-check'.
2012-09-15 12:32:41 +01:00
Richard W.M. Jones
da75618fb2 lib: Rearrange headers.
This is just code motion.
2012-09-15 12:31:07 +01:00
Richard W.M. Jones
8747ff7432 lib: Remove unused headers <arpa/inet.h> and <netinet/in.h>
These were used back in the day when we used TCP for the
communications channel with the guest.
2012-09-15 12:30:12 +01:00
Richard W.M. Jones
dec73f70fc syntax: Remove HAVE_*_H tests which are always true.
Gnulib supplies replacements for these headers, so there
is no need to test.
2012-09-15 12:25:28 +01:00
Richard W.M. Jones
cd8976a5b5 perl: Add <stdio.h> and <stdlib.h> for printf and malloc. 2012-09-15 12:22:44 +01:00
Richard W.M. Jones
188b44ee45 perl: Include <inttypes.h> and assume it always defines PRId64 and PRIu64.
If these are not defined in the header files, it's a problem on
the platform which we should fix with gnulib.  Our replacement
definitions might be wrong here.
2012-09-15 12:22:00 +01:00
Richard W.M. Jones
5a46eadd3d lib: These optargs structures are not modified, hence const. 2012-09-15 12:15:47 +01:00
Richard W.M. Jones
ae137124ca syntax: Remove test for TAB indentation.
Nothing particularly wrong with using TABs for indentation,
and this test also has a lot of false positives.
2012-09-15 11:54:17 +01:00
Richard W.M. Jones
57d089fd6d syntax: xfs: Remove useless if before free.
Found by running 'make syntax-check'.
2012-09-15 11:54:03 +01:00
Richard W.M. Jones
6951becfdb docs: Fix documentation of syntax-check target, add extra-tests. 2012-09-15 11:54:03 +01:00
Richard W.M. Jones
244e9a2ac4 faq: Make the legal section less unnecessarily legalistic. 2012-09-14 23:06:16 +01:00
Richard W.M. Jones
19da851610 faq: Tidy up headings. 2012-09-14 23:06:13 +01:00
Richard W.M. Jones
2c59af7754 faq: Add more answers about read-only disks. 2012-09-14 22:57:02 +01:00
Richard W.M. Jones
6575ac4c61 launch: libvirt: Enable sVirt. 2012-09-14 16:46:37 +01:00
Richard W.M. Jones
5b02c8d0bc test-9p: Disable this test with libvirt.
This test doesn't work with sVirt if SELinux is enforcing, because
qemu won't be able to access the 9p-exported directory on the host.
2012-09-14 16:46:37 +01:00
Richard W.M. Jones
834747a85d build: Create new 'tmp' directory for tests.
Having a separate directory means:

(1) It's easy to clean up orphaned temporary files, the appliance,
    etc.

(2) You can put an SELinux label on this directory so that qemu can
    write to it when you're using sVirt and SELinux is enforcing:

    chcon --reference=/tmp tmp
2012-09-14 15:53:53 +01:00
Richard W.M. Jones
aa9e0057b1 launch: libvirt: Mark appliance disk as <shareable/> (thanks Dan Berrange).
This is a fix for multiprogramming: If two instances of libguestfs
share the same appliance disk, then libvirt would unlabel the disk
when one of the instances closes the handle, resulting in the other
qemu being unable to continue accessing the appliance.

Adding the flag makes libvirt understand that the disk is shared so it
doesn't do this, and it apparently handles locking correctly too if we
were using sanlock.
2012-09-14 15:52:42 +01:00
Richard W.M. Jones
281b155800 test-tool: Print more environment variables.
This prints LIBVIRT_*, LIBVIRTD_*, LD_* and PATH, since these are all
useful for debugging and could affect libguestfs in some way.
2012-09-14 11:35:23 +01:00
Richard W.M. Jones
8acdc23622 fish: Replace '_' with '-' in deprecation cross-refs (thanks Olaf Hering). 2012-09-13 19:32:47 +01:00
Richard W.M. Jones
d9a98dc1cd lib: guestfs_disk_format: Set LC_ALL=C instead of LANG=C.
LC_ALL takes precedence over LANG.  See:

http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html
2012-09-12 21:40:03 +01:00
Richard W.M. Jones
97a1439d90 release-notes: Add 'draft' background image. 2012-09-06 12:46:57 +01:00
Richard W.M. Jones
81c682f129 extra-tests: Don't use $QEMU as a variable.
Since 'QEMU' is set (overwritten) by the autoconf-generated Makefile,
this test would always test installed qemu, not upstream qemu,
making it pretty useless.  Use another name for this variable.
2012-09-05 13:56:34 +01:00
Richard W.M. Jones
3d84ca76fe generator: Remove generated and unused files from previous runs of the generator.
If you go back in time in git (eg. git reset, git bisect) then you can
end up in a situation where a file that was generated by a later
version is left around unused in the earlier version.

This isn't a problem for most things, but gobject documentation
generation picks up any file in a directory, even unreferenced ones,
and breaks.  So the correct thing to do is to remove these files.
2012-09-05 11:45:41 +01:00
Richard W.M. Jones
169ac913e9 generator: gobject: Use a more normal way to output files.
The generator output is identical, verified by comparing the
output files before and after the change.
2012-09-05 11:26:52 +01:00
Richard W.M. Jones
dc8aca2cf9 Version 1.19.40. 2012-09-04 23:16:47 +01:00
Richard W.M. Jones
9c4097dfd8 sparsify: Fix use of closed handle (thanks Olaf Hering).
This fixes commit faaedeb343.

Also contains an update to the test which tests the format
auto-detect path.
2012-09-04 22:29:48 +01:00
Olaf Hering
bdb5689f58 fix fuse_opt_add_opt_escaped return type
I: Program returns random data in a function
E: libguestfs no-return-in-nonvoid-function guestmount.c:75

The function fuse_opt_add_opt_escaped has only one caller and a return
code is not checked.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2012-09-04 17:26:04 +01:00
Richard W.M. Jones
853feb971f Version 1.19.39. 2012-09-04 17:10:23 +01:00
Richard W.M. Jones
c4171ad58f shutdown: Add 'check_for_errors' hint along the shutdown path.
This hint tells the backend whether anyone cares about errors when the
appliance is shut down.

Currently this only has any effect on the libvirt backend, where it
controls whether or not we use the VIR_DOMAIN_DESTROY_GRACEFUL flag.
2012-09-04 15:36:29 +01:00
Richard W.M. Jones
cc4b3139d1 launch: libvirt: Add VIR_DOMAIN_DESTROY_GRACEFUL flag.
We want libvirt to report failures when destroying the guest.  See:

https://bugzilla.redhat.com/show_bug.cgi?id=853369#c12
2012-09-04 15:36:06 +01:00
Richard W.M. Jones
05beac65e5 rescue: Add an expect-driven test for the virt-rescue command.
This command was not tested at all.  As a result we didn't notice that
it was broken for a long time (RHBZ#853159).

This adds a test that drives the command through a pty.  It uses the
perl 'Expect' module, although this is not required.
2012-09-04 14:43:26 +01:00
Richard W.M. Jones
8248a346d7 proto: Don't set g->fd[] to /dev/null in direct mode, fixing virt-rescue (RHBZ#853159).
https://bugzilla.redhat.com/show_bug.cgi?id=853159

git bisect pointed to the following commit:

  commit ec8e3b6cad
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Fri Jul 20 14:24:10 2012 +0100

    launch: Abstract attach method operations.

    g->attach_ops points to a structure which contains the
    operations supported by each attach method backend
    (ie. appliance, unix, etc.).

Since that commit was essentially just code motion, it wasn't clear
why virt-rescue should be affected by it.

In fact the reason is as follows:

(1) In direct mode, we don't need g->fd[] (which would normally be
connected to the stdin/stdout of qemu).  So we opened them on
/dev/null so they had some value.

(2) accept_from_daemon / read_log_message_or_eof reads from g->fd[1].
Since this is connected to /dev/null, it always reads EOF.

(3) This would cause child_cleanup to be called.  This is completely
unintentional: we don't want to cleanup the child at this point, even
in direct mode.

(4) Prior to the commit above, child_cleanup first waited for the
process to exit (ie. waitpid).  This happened to work, since we are
effectively waiting for the user to exit virt-rescue.

(5) After the commit above, the order of operations was changed so
that we first killed qemu before waiting for it.  This broke
virt-rescue.

The fix is to change direct mode so that it leaves g->fd[]'s as -1.
The rest of the protocol code can deal with this situation -- it
ignores the log fd instead of trying to read from it.
2012-09-04 14:43:26 +01:00
Richard W.M. Jones
2e36adf83c rescue: If attach-method is 'libvirt', force it to be 'appliance'.
The libvirt backend currently doesn't support direct mode.  We should
make that work in future.  As a workaround, force the attach-method to
be 'appliance' in this case.
2012-09-04 12:04:31 +01:00
Richard W.M. Jones
6fdf1f40fa rescue: If -v / debugging enabled, don't mask error messages.
We set the error handler to NULL in order to mask "normal" error
messages that we expect to see because of the unusual way that
virt-rescue runs the appliance.  However if the user selected -v /
enabled debugging, then it is reasonable to expect they want to see
every message, so do not mask anything.
2012-09-04 11:56:20 +01:00
Richard W.M. Jones
77f70a5f7c launch: libvirt: Direct mode flag is not (yet) supported, so give an error in this case.
We definitely intend to support this in future.
2012-09-04 11:55:35 +01:00
Richard W.M. Jones
381c067d54 Update release notes (text file).
This updates commit 9e4ac650e4.
2012-09-04 11:55:35 +01:00
Richard W.M. Jones
9e4ac650e4 Update release notes. 2012-09-04 11:31:28 +01:00
Richard W.M. Jones
d03361b1af lib: Add tests to the disk-{format,virtual-size,has-backing-file} APIs. 2012-09-04 10:02:57 +01:00
Richard W.M. Jones
4ed981bd5f New APIs: disk-virtual-size and disk-has-backing-file. 2012-09-04 10:02:53 +01:00
Richard W.M. Jones
e388c4f3fd lib: Reimplement qemu-img info parser for flexibility.
This allows other fields from the output of 'qemu-img info'
to be parsed out.

This updates commit 20902e7ce0.
2012-09-04 09:41:29 +01:00
Richard W.M. Jones
1030e8aba0 Fix guestfs_disk_image API to work with relative paths.
guestfs_disk_image makes a symbolic link to the real filename in order
to sanitize the filename.  However this fails if the filename is a
relative path.  Call realpath(3) to make the filename canonical.

This fixes commit 20902e7ce0.
2012-09-04 09:41:26 +01:00
Richard W.M. Jones
26732678c6 Version 1.19.38. 2012-09-03 18:35:17 +01:00
Olaf Hering
47ddb77fb1 daemon: provide list of checksum commands
While adding the list of external commands I missed the
various checksum tools.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2012-09-03 17:45:14 +01:00
Richard W.M. Jones
faaedeb343 sparsify: Use guestfs_disk_format to autodetect input format (RHBZ#853762). 2012-09-03 17:45:14 +01:00
Richard W.M. Jones
9f8ba4e8d1 launch: libvirt: Use guestfs_disk_format API to autodetect input format. 2012-09-03 17:45:14 +01:00
Richard W.M. Jones
efdc2bae40 guestfs(3): Document disk image formats and how to detect them. 2012-09-03 17:45:10 +01:00
Richard W.M. Jones
20902e7ce0 New API: guestfs_disk_format
Detect the disk image format of a file, in a secure way.
2012-09-03 17:43:19 +01:00
Olaf Hering
b6413f8dbe daemon: remove call to obsolete udevsettle
udevadm is included in all reasonable recent distributions.
This avoids 'command not found' errors in verbose mode.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2012-09-03 11:02:05 +01:00
Wanlong Gao
c659cf8ea6 TODO: remove the implemented hostname removing feature
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-09-03 10:32:18 +01:00
Wanlong Gao
98bf41d80d sysprep: remove hostname from ifcfg-*
Remove hostname from network interface configuration.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-09-03 09:39:48 +01:00
Richard W.M. Jones
3820a2578c generator: Test zero args, one optarg; and 63 optargs.
This just generates the code; it's not called.
2012-09-03 09:36:04 +01:00
Richard W.M. Jones
f65dee769d java: Fix >= 32 optargs (thanks Wanlong Gao). 2012-09-03 09:36:04 +01:00
Richard W.M. Jones
d331fd70e2 generator: Rename 'generator_*' as '*'.
This is a simple renaming of the files/modules.

Note that in OCaml, module names are derived from filenames by
capitalizing the first letter.  Thus the old module names had the form
"Generator_api_versions".  The new modules names have the form
"Api_versions".
2012-09-02 19:47:33 +01:00
Richard W.M. Jones
11d655ab83 TODO: Suggest removing hostname from ifcfg-eth* files. 2012-09-02 19:47:33 +01:00
Richard W.M. Jones
b799bc58a8 recipes: Checksum file/device. Download to stdout. 2012-09-02 16:33:59 +01:00
Richard W.M. Jones
a1d981edea tests: Attach copyright and license (GPLv2+) notices to various test scripts.
For some reason these tests did not have license notices.
2012-08-31 19:12:27 +01:00
Richard W.M. Jones
d754f4a5a3 tests/rsync: Allow rsync test to be skipped by setting SKIP_TEST_RSYNC_SH=1. 2012-08-31 19:06:38 +01:00
Richard W.M. Jones
42b892a8c5 Version 1.19.37. 2012-08-31 18:34:24 +01:00
Richard W.M. Jones
3ed3e23ed0 Copy the kernel so that libvirt can add an SELinux label to it. NB. This requires febootstrap >= 3.20 with --copy-kernel flag. 2012-08-31 16:17:24 +01:00
Richard W.M. Jones
3728c122f1 guestfs-internal.h: Organize functions by file.
This is almost just code motion.  While doing this I discovered two
prototypes for functions which no longer exist:

  * guestfs___launch_appliance
  * guestfs___launch_unix

so these prototypes have been removed.  The rest are rearranged more
logically.
2012-08-31 15:14:51 +01:00
Richard W.M. Jones
b17d189616 tests: Make mkswap and tar tests conditional on linuxfsuuid and xz features. 2012-08-31 14:31:22 +01:00
Richard W.M. Jones
87cb154976 tests/mount-local: Link test program with gnulib. 2012-08-31 10:26:40 +01:00
Richard W.M. Jones
4e6bf1ed65 src/dbdump.c: Shouldn't depend on HAVE_HIVEX (thanks Tao Zhou). 2012-08-31 09:53:44 +01:00
Olaf Hering
0306c98d31 daemon: collect list of called external commands
guestfsd calls many different tools. Keeping track of all of them is
error prone. This patch introduces a new helper macro to put the command
string into its own ELF section:

GUESTFSD_EXT_CMD(C_variable, command_name);

This syntax makes it still possible to grep for used command names.

The actual usage of the collected list could be like this:

  objcopy -j .guestfsd_ext_cmds -O binary daemon/guestfsd /dev/stdout |
  tr '\0' '\n' | sort -u

The resulting output will be used to tell mkinitrd which programs to
copy into the initrd.

Signed-off-by: Olaf Hering <olaf@aepfle.de>

RWMJ:
 - Move str_vgchange at request of author.
 - Fix snprintf call in daemon/debug.c
2012-08-30 20:57:07 +01:00
Richard W.M. Jones
4aa1464d42 launch: appliance: app.virtio_scsi must not be bool.
This is used to store values 0..3, so it mustn't be a bool.  Ooops.

RHEL 5's gcc revealed this bug.
2012-08-30 20:09:16 +01:00
Richard W.M. Jones
163e030ee1 daemon: Remove e2prog hack (only needed for RHEL 5).
Instead this patch will be carried out of tree in the oldlinux branch.
2012-08-30 17:29:36 +01:00
Richard W.M. Jones
0573c19950 Version 1.19.36. 2012-08-30 16:39:48 +01:00
Richard W.M. Jones
c945609ac9 launch: libvirt: Remove code for creating sockdir.
Create the sockets in g->tmpdir as usual.  It's a bug in libvirt that
it doesn't label the sockets correctly no matter where they are
located.
2012-08-30 15:35:16 +01:00
Richard W.M. Jones
a7de51b3c8 launch: libvirt: Avoid memory leak if sockdir is not created (found by valgrind). 2012-08-30 15:28:19 +01:00
Richard W.M. Jones
8af32b9d5f FAQ: Remove link to old RHEL 6.3 preview repo. 2012-08-30 13:29:49 +01:00
Wanlong Gao
7036a3bccf NEW API:xfs:xfs_repair
Add a new api xfs_repair for repairing an XFS filesystem.

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

RWMJ:
  - Fix non-error return path so it doesn't send two replies.
  - Document return code.
2012-08-30 10:47:26 +01:00
Richard W.M. Jones
bcbad66b18 docs: Add guestfs-release-notes.txt to Makefile deps. 2012-08-30 10:47:26 +01:00
Richard W.M. Jones
2d6bf3ba70 tests/big-dirs: Don't run this test by default. 2012-08-30 08:58:00 +01:00
Richard W.M. Jones
8742713050 run: Make --test flag print the time taken to run the test.
This is useful because it lets us see which tests take
the longest.
2012-08-29 20:59:06 +01:00
Richard W.M. Jones
1ac36e4f36 Version 1.19.35. 2012-08-29 19:00:02 +01:00
Richard W.M. Jones
9ef22fa921 python: Convert OInt64 using PyLong_AsLongLong so 64 bit ints work correctly.
This avoids the following error on 32 bit machines:

  OverflowError: Python int too large to convert to C long
2012-08-29 18:36:17 +01:00
Richard W.M. Jones
b2378a81bb Update inspection and example programs to use new hivex* APIs (RHBZ#852394).
I tested this by comparing the output of virt-inspector over Windows
guests before and after the change, which was identical:

$ md5sum `ls -1 /tmp/*.before /tmp/*.after`
c292d6629b5a761eccb4a279754399b4  /tmp/Win2003.after
c292d6629b5a761eccb4a279754399b4  /tmp/Win2003.before
eb1e1ff29208a9ee46e9c100dfec26b2  /tmp/Win2012.after
eb1e1ff29208a9ee46e9c100dfec26b2  /tmp/Win2012.before
d060a95d7ffe5dce6c4e66feb80c2837  /tmp/Win7x32.after
d060a95d7ffe5dce6c4e66feb80c2837  /tmp/Win7x32.before
8914eee70ac4f8a0317659e09e00dcdc  /tmp/Win7x32Dynamic.after
8914eee70ac4f8a0317659e09e00dcdc  /tmp/Win7x32Dynamic.before
a2dcdfc0f9d64054640875aa791889e0  /tmp/Win7x32TwoDisks.after
a2dcdfc0f9d64054640875aa791889e0  /tmp/Win7x32TwoDisks.before
5ed49568a5147dce7517c99de41ebf2e  /tmp/Win8previewx64.after
5ed49568a5147dce7517c99de41ebf2e  /tmp/Win8previewx64.before
fdfc7d272b79a665ae3313ae1ae30660  /tmp/WinXP.after
fdfc7d272b79a665ae3313ae1ae30660  /tmp/WinXP.before
3c705444be664f1316b21c5d8d3cb0be  /tmp/WinXPRecConsole.after
3c705444be664f1316b21c5d8d3cb0be  /tmp/WinXPRecConsole.before
2012-08-29 17:08:01 +01:00
Richard W.M. Jones
288cc74d77 New API: guestfs_hivex_value_utf8
A convenience function that reads a value from the registry
and returns it as UTF-8.
2012-08-29 17:08:01 +01:00
Richard W.M. Jones
8a723ca62e New APIs: hivex_*
Transscribe many hivex(3) APIs into the libguestfs API.

There is one hive handle per libguestfs handle, as with Augeas.

Note that hivex uses iconv_open for some APIs (eg. hivex_value_string).
But since we delete all the i18n files from the appliance, this
doesn't work -- iconv_open returns EINVAL.  Therefore hivex APIs which
require iconv cannot be bound in the daemon.
2012-08-29 17:08:01 +01:00
Richard W.M. Jones
228d49bb84 lib: Remove AUGEAS_CFLAGS, AUGEAS_LIBS.
The library doesn't actually use libaugeas, except indirectly via the
libguestfs API.  The libguestfs API implements this in the daemon, so
there's no need for the library to link to augeas at all.
2012-08-29 17:08:01 +01:00
Olaf Hering
044c5b26d7 remove ulockmgr from fuse LDFLAGS
libguestfs fails to build with --enable-fuse on openSuSE 11.4 and
earlier because the included fuse version does not include
libulockmgr.so. configure already used pkgconfig to retrieve the correct
CFLAGS, so there is no need to hardcode -lulockmgr.
With this change the build succeeds again.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2012-08-29 16:42:51 +01:00
Richard W.M. Jones
684efb3706 java: Further java/java-home fixes.
In particular the JVM executable is now called $JAVA_EXE.

This fixes commit 40b9c14ca9.
2012-08-29 14:24:37 +01:00
Richard W.M. Jones
15cd9dde5e perl: bindtests: Fix 64 bit integers on input on 32 bit Perl interpreter. 2012-08-29 05:33:09 -04:00
Wulf C. Krueger
40b9c14ca9 Fix Java detection and rename --with-java-home to --with-java.
Without this patch, if JAVAC points to a valid executable, --with-java-home=no
is not respected but the build simply fails.
Furthermore, --with{,out}-java is a more common form and more in-line with all
other options.
2012-08-28 13:24:35 -04:00
Richard W.M. Jones
9ef36632ca launch: libvirt: Don't crash if shutdown_libvirt is called early in launch.
The assert (conn != NULL) was being triggered with this
stack trace:

    at launch-libvirt.c:1305
    fd=<optimized out>, error_if_eof=error_if_eof@entry=0) at proto.c:222
    size_rtn=size_rtn@entry=0x7fffffffdb34,
    buf_rtn=buf_rtn@entry=0x7fffffffdb58) at proto.c:548
    libvirt_uri=<optimized out>) at launch-libvirt.c:391
2012-08-28 17:49:46 +01:00
Wulf C. Krueger
cab48ce73c Fix disabling the Perl bindings.
--disable-perl isn't currently respected because $PERL correctly points
to the perl executable and $missing_perl_modules doesn't prevent the
perl parts to be installed either. Thus, a check for $enable_perl is
needed.
2012-08-28 10:20:47 -04:00
Richard W.M. Jones
81709b5b70 Version 1.19.34. 2012-08-28 13:31:09 +01:00
Richard W.M. Jones
512f21c965 po-docs: Copy all *.1 and *.3 files to the install dir. 2012-08-28 13:18:47 +01:00
Richard W.M. Jones
67a803e1f2 po-docs: Update the list of man pages. 2012-08-28 13:18:47 +01:00
Richard W.M. Jones
ddc67d94f3 po-docs: Fix podwrapper so it works on translated POD files.
These don't contain literal strings like "AUTHORS" (they have the
translated versions instead) and so checking for these English strings
is rather useless.

Also we don't usually have the '--license' parameter conveniently
around so don't enforce this section.
2012-08-28 13:18:47 +01:00
Richard W.M. Jones
540fbfcf34 po-docs: Don't output translated virt-sysprep page as HTML. 2012-08-28 13:18:47 +01:00
Richard W.M. Jones
23b7fe09e1 tools: Fix podwrapper errors in tools directory.
This also makes the test for license "code" less strict, so it should
only match POD, not Perl comments.

This fixes commit 2f97bf873b.
2012-08-28 13:18:40 +01:00
Masami HIRATA
0a275bd090 Mac OS X: Fixed combination of running autogen.sh on Linux and building on Mac OS X
Signed-off-by: Masami HIRATA <msmhrt@gmail.com>
2012-08-28 05:10:15 -04:00
Richard W.M. Jones
d555a68ca6 podwrapper: Ignore $parser->html_charset if it fails (thanks Wulf C. Krueger).
This method was added in Pod::Simple 3.16 so earlier versions of Perl
won't have it.  It's not the end of the world if we don't set it.
2012-08-28 04:46:04 -04:00
Richard W.M. Jones
f23a5c468e Modified API: mkswap now takes optional arguments.
Add optional label and uuid arguments, and deprecate mkswap-L and
mkswap-U.

This also adds a call to udev_settle after creating the swap device.
This is an attempt to workaround the following problem seen in Koji
and Rawhide:

libguestfs: trace: mkswap_L "swapit" "/dev/sda1"
libguestfs: send_to_daemon: 72 bytes: 00 00 00 44 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 83 | 00 00 00 00 | ...
guestfsd: main_loop: proc 210 (part_disk) took 2.28 seconds
guestfsd: main_loop: new request, len 0x44
mkswap -f -L swapit /dev/sda1
libguestfs: recv_from_daemon: 40 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 83 | 00 00 00 01 | 00 12 37 cf | ...
libguestfs: trace: mkswap_L = 0
libguestfs: trace: swapon_label "swapit"
libguestfs: send_to_daemon: 56 bytes: 00 00 00 34 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 ae | 00 00 00 00 | ...
guestfsd: main_loop: proc 131 (mkswap_L) took 0.77 seconds
guestfsd: main_loop: new request, len 0x34
swapon -L swapit
swapon: cannot find the device for swapit
guestfsd: error: swapit: swapon: cannot find the device for swapit
libguestfs: recv_from_daemon: 100 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 ae | 00 00 00 01 | 00 12 37 d0 | ...
libguestfs: trace: swapon_label = -1 (error)
swapon_label: swapit: swapon: cannot find the device for swapit
test_swapon_label_0 FAILED
2012-08-28 04:44:05 -04:00
Richard W.M. Jones
c2ac512f12 docs: Revise README file. 2012-08-25 17:28:37 -04:00
Masami HIRATA
670e4f7f12 python: Fixed syntax errors in python/guestfs-py.c
Signed-off-by: Masami HIRATA <msmhrt@gmail.com>
2012-08-25 10:56:13 -04:00
Richard W.M. Jones
c638e1f03d docs: Use man page name as default title in HTML output. 2012-08-21 22:02:21 +01:00
Richard W.M. Jones
52a60349ab release-notes: Add more visible separation between sections in the source file. 2012-08-21 21:12:47 +01:00
Richard W.M. Jones
20ba04d83e Update release notes. 2012-08-21 20:53:09 +01:00
Richard W.M. Jones
2f97bf873b podwrapper: Add --license parameter, which is required.
This adds standard LICENSE and BUGS sections to all of the man pages
that are processed by podwrapper.

Modify all the calls to $(PODWRAPPER) to add the right --license
parameter according to the content.  Note that this relaxes the
license on some code example pages, making them effectively BSD-style
licensed.
2012-08-21 20:33:21 +01:00
Richard W.M. Jones
f1d98bbc79 man pages: Ensure consistent copyright/author sections, remove license
section.

Ensure each man page contains consistent COPYRIGHT and AUTHOR
sections.

Remove the LICENSE section.  We will add that back in podwrapper in a
later commit.
2012-08-21 20:16:29 +01:00
Richard W.M. Jones
e89e180d2b podwrapper: Ensure the input file is printed in some error messages. 2012-08-21 20:11:15 +01:00
Richard W.M. Jones
e1e8b3a1cf docs: Document null disks.
It's always been possible to use /dev/null as a disk image.
Document this formally in the API.
2012-08-21 17:44:42 +01:00
Richard W.M. Jones
e3bb1f7c92 launch: libvirt: Always create /var/run/libguestfs.
This directory won't necessarily exist (esp. if /var/run is
really /run).  So create it each time.
2012-08-21 16:50:08 +01:00
Richard W.M. Jones
dcd35cb55c Version 1.19.33. 2012-08-21 13:56:18 +01:00
Richard W.M. Jones
984044043d FAQ: Re-add #backup anchor for section on backups. 2012-08-21 13:21:55 +01:00
Richard W.M. Jones
52e38c7bdc recipes: Update dumping filesystem content to mention that we now support MD/RAID. 2012-08-21 13:19:50 +01:00
Richard W.M. Jones
1e4c6e36a6 recipes: Refer to virt-format, virt-make-fs for creating disk images. 2012-08-21 13:19:50 +01:00
Richard W.M. Jones
5f234548ed recipes: Cloning Windows: plans for virt-sysprep. 2012-08-21 13:19:50 +01:00
Richard W.M. Jones
9fd4d16819 recipes: For auditing for setuid files, point to virt-ls examples. 2012-08-21 13:19:50 +01:00
Richard W.M. Jones
0d2e70b1c7 recipes: For sparsifying guests, point to virt-sparsify. 2012-08-21 13:19:50 +01:00
Richard W.M. Jones
d944a491ac recipes: For listing files, point to virt-ls. 2012-08-21 13:19:50 +01:00
Richard W.M. Jones
ad6870102f recipes: Mention virt-sysprep firstboot feature. 2012-08-21 13:19:50 +01:00
Richard W.M. Jones
87cf749cde recipes: Most guests now use grub2, so change the example. 2012-08-21 13:19:50 +01:00
Richard W.M. Jones
10d48bef30 recipes: Add a section on deleting a file and other common file operations. 2012-08-21 13:19:47 +01:00
Richard W.M. Jones
1454751b73 recipes: Update cloning section. 2012-08-21 13:13:41 +01:00
Richard W.M. Jones
9f59d11625 launch: libvirt: Minimum libvirt version is now 0.10.0. 2012-08-21 12:29:25 +01:00
Wanlong Gao
faf548a4bd xfs_growfs: drop the unstructed output
Just drop the unstructed output since we can get the structed info
from xfs_info instead.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-08-21 10:19:01 +01:00
Wanlong Gao
11b78a7107 New API: xfs: xfs_admin
Add new api xfs_admin to change parameters of an XFS filesystem.

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

RWMJ:
 - Remove printuuid, printlabel, since they don't change any settings.
 - Adjusted the documentation.
 - Fix the tests.
2012-08-21 10:18:23 +01:00
Richard W.M. Jones
5e67277463 run: Disable 'memory optimizations' in glib programs, for valgrind (thanks Dan Berrange). 2012-08-20 16:46:09 +01:00
Richard W.M. Jones
cd1627e804 FAQ: virt-sparsify and raw sparse output. 2012-08-19 15:35:14 +01:00
Richard W.M. Jones
d67e6ea75d Replace mount-options with mount where appropriate.
Since our minimum supported version is now 1.16 and mount was fixed in
1.13.16, it is now safe to replace mount-options + empty options with
mount wherever it occurs.
2012-08-18 22:08:29 +01:00
Richard W.M. Jones
781d72f558 Update API support. 2012-08-18 13:09:27 +01:00
Richard W.M. Jones
64098f18d0 Version 1.19.32. 2012-08-18 12:09:47 +01:00
Richard W.M. Jones
8f3c0fd98d sysprep: docs: virt-sysprep can now be used to customize a guest. 2012-08-18 11:47:23 +01:00
Richard W.M. Jones
99cfc1f36e sysprep: Add --firstboot functionality.
This allows you to add scripts that run in the context of
the guest the first time it boots.
2012-08-18 11:47:19 +01:00
Richard W.M. Jones
99759da25c docs: Rewrite section on protocol limits again.
This updates commit 92e241440d.
2012-08-17 17:30:48 +01:00
Richard W.M. Jones
92e241440d docs: Update documentation to reflect no 2/4 MB protocol limits. 2012-08-17 16:08:14 +01:00
Richard W.M. Jones
d6e1d82267 todo: Suggest full mke2fs API call. 2012-08-17 16:08:14 +01:00
Richard W.M. Jones
92a0ac5037 tests: Add a test for large directories.
This also tests the reimplemented APIs:
 - ls
 - lstatlist
 - lxattrlist
 - readlinklist
2012-08-17 16:08:14 +01:00
Richard W.M. Jones
07eb702163 New API: fill-dir: Fill a directory with files (for testing). 2012-08-17 16:08:14 +01:00
Richard W.M. Jones
6952505694 guestfs_readdir: Note that this suffers from protocol limits. 2012-08-17 16:08:14 +01:00
Richard W.M. Jones
a69f44f56f guestfs_ls: Reimplement to avoid protocol limits. 2012-08-17 16:08:13 +01:00
Richard W.M. Jones
1b4d8e2cca New API: ls0 - List files, separated by \0 characters.
This API is not especially useful on its own.  It will be used to
reimplement guestfs_ls to work without protocol limits.
2012-08-17 16:08:13 +01:00
Richard W.M. Jones
8ee5190768 guestfs_readlinklist: Reimplement to avoid protocol limits. 2012-08-17 16:08:13 +01:00
Richard W.M. Jones
dc66dd32c2 guestfs_lstatlist, guestfs_lxattrlist: Reimplement to avoid protocol limits.
Note that the code to do this was already in virt-ls, so this is
change is mostly just moving the code into the core library.
2012-08-17 16:08:13 +01:00
Richard W.M. Jones
118932fbea guestfs_write, guestfs_write_append: Reimplement to avoid protocol limits.
Note that we keep the old daemon calls, but rename them as
"internal_write" and "internal_write_append".  This lets us implement
the new library-side calls more efficiently in the common case when
the uploaded content is smaller than the message buffer.  In most
cases the new calls won't end up using a temporary file.
2012-08-17 16:08:13 +01:00
Richard W.M. Jones
735ce57cda guestfs_read_lines: Reimplement to avoid protocol limits.
This also makes a larger test suite for this command.
2012-08-17 16:08:13 +01:00
Richard W.M. Jones
96d3ac28d6 guestfs_read_file: Reimplement to avoid protocol limits. 2012-08-17 16:08:13 +01:00
Richard W.M. Jones
9d85eba3c3 guestfs_find: Reimplement to avoid protocol limits.
This also reimplements the virt-ls -R option to use the replacement
guestfs_find API, which is simpler (though actually less efficient).
2012-08-17 16:08:13 +01:00
Richard W.M. Jones
294bee38bc guestfs_cat: Reimplement to avoid protocol limits. 2012-08-17 16:08:13 +01:00
Richard W.M. Jones
50d904c018 generator: Fix error message in checks of proc_nr. 2012-08-17 13:00:13 +01:00
Richard W.M. Jones
0f33a1d90c sysprep: Improve error messages. 2012-08-16 18:21:07 +01:00
Richard W.M. Jones
6f5447abe3 Update TODO. 2012-08-16 18:21:07 +01:00
Richard W.M. Jones
e9ef74ebc2 Version 1.19.31. 2012-08-15 17:57:40 +01:00
Richard W.M. Jones
856e78a2ce subdir-rules.mk: Remove rules that recursively build src/ and daemon/.
These are unnecessary, and slow down the whole build.
2012-08-15 17:49:49 +01:00
Richard W.M. Jones
cc25afcc35 gobject: Disable bindtests.
- gint64 cannot be reliably sent.  It seems to try to convert it
  via a 32 bit int, and fails if it overflows.

- OStringList is not implemented yet.
2012-08-15 17:49:48 +01:00
Richard W.M. Jones
5abd7bfc4c launch: For /dev/null drives, create a temporary disk.
This is a workaround for a bug with virtio-scsi in qemu 1.2:
https://bugzilla.redhat.com/show_bug.cgi?id=847549
2012-08-15 17:49:48 +01:00
Richard W.M. Jones
7f9f281865 test-launch-race: Use /dev/null instead of hand-made zero-length file.
There seems to be no reason why creating a zero-length
file is necessary for this test.
2012-08-15 17:49:48 +01:00
Richard W.M. Jones
46cf4a7e87 launch: Move code to add a drive to the list to separate add_drive utility function.
This is just code motion / simplification.
2012-08-15 17:49:48 +01:00
Richard W.M. Jones
4b8ac43729 launch: Add utility function guestfs___lazy_make_tmpdir.
This lets us create g->tmpdir lazily earlier if needed.

This commit is just code motion.
2012-08-15 17:49:48 +01:00
Richard W.M. Jones
22607a97cd lib: Add 'g->unique' to handle, for making unique IDs. 2012-08-15 17:49:48 +01:00
Richard W.M. Jones
8fd6f1bebe inspect: Clarify comment about uniqueness of cache. 2012-08-15 17:49:48 +01:00
Richard W.M. Jones
ba61236d0d close: Check if g->tmpdir is non-NULL before removing tmpdir.
This happens, by chance, to work.
2012-08-15 17:49:48 +01:00
Richard W.M. Jones
16f22d89eb bindtests: Test sending min and max 64 bit integers. 2012-08-15 17:49:48 +01:00
Richard W.M. Jones
704e46af9c java: Fix bindtests when passing 64 bit integer literals. 2012-08-15 17:49:48 +01:00
Richard W.M. Jones
9526f632d8 ocaml: Fix bindtests when passing negative optional arguments. 2012-08-15 17:49:48 +01:00
Richard W.M. Jones
f6de298d04 erlang: Add tests.
Add bindtests and general tests for Erlang.
2012-08-15 17:49:48 +01:00
Richard W.M. Jones
bd35b3c055 erlang: Fix 64 bit integers in parameters. 2012-08-15 17:49:48 +01:00
Richard W.M. Jones
e3f356bda1 erlang: Fix BufferIn parameters.
These would break if the buffer contained a \0 character.
2012-08-15 17:49:48 +01:00
Richard W.M. Jones
fad0f53dc8 New internal APIs: internal-test-set-output, internal-test-close-output.
These internal (testing) APIs allow the bindtests output to
be sent to some other place than stdout.

This is necessary for Erlang, since stdout is used to communicate with
the Erlang interpreter.
2012-08-15 17:49:48 +01:00
Richard W.M. Jones
7dd2389359 python: Fix comment referring to Perl(!) 2012-08-15 17:49:48 +01:00
Richard W.M. Jones
449bd4b50f generator: Allow permission of output files to be specified. 2012-08-15 17:49:48 +01:00
Hilko Bengen
3234a1f903 Even on Debian, the package containing the diff binary it has been diffutils for two years.
There had been a virtual package "diff" that depended on diffutils, but that's gone in wheezy/sid, too.
2012-08-15 13:34:54 +02:00
Richard W.M. Jones
42e8c093b7 python: Fix optargs so we don't use special sentinel values.
Previously with Python it was impossible to set a boolean or integer
optarg to -1 because that was used as a special sentinel value to
indicate that the optarg was not set.

Instead, use None as the sentinel value, since that cannot be a
boolean or integer type.
2012-08-15 12:16:54 +01:00
Richard W.M. Jones
e990e80c26 python: Before freeing OStringList, cast it to char ** to avoid a compiler warning.
This fixes commit c1a269513c.
2012-08-15 12:14:06 +01:00
Richard W.M. Jones
94f133f25b Remove unnecessary comment from <guestfs.h>.
Read guestfs(3) for documentation, and don't discourage people from
doing that by putting these comments into the header file.
2012-08-14 18:21:05 +01:00
Richard W.M. Jones
5ea795aa48 docs: Fix '= head' -> '=head' in back compat entries in guestfs(3). 2012-08-14 18:17:40 +01:00
Richard W.M. Jones
f5208ab865 Version 1.19.30. 2012-08-14 17:51:24 +01:00
Richard W.M. Jones
ce35eb90a2 tar-out: Add list of excluded patterns (--exclude=...) (RHBZ#847881). 2012-08-14 16:40:14 +01:00
Richard W.M. Jones
c1a269513c generator: Add new OStringList optional arg type.
This allows lists of strings to be passed as an optional argument.
2012-08-14 16:40:11 +01:00
Richard W.M. Jones
637b06ab13 daemon: New utility functions 'join_strings', 'concat_strings'.
Useful functions for concatenating strings together.
2012-08-14 16:40:07 +01:00
Richard W.M. Jones
690bdaa392 bindtests: Space before parens in call. 2012-08-14 11:14:10 +01:00
Richard W.M. Jones
d23293db7e todo: Suggestion: Add sh-in, sh-out, debug sh-in, debug sh-out. 2012-08-14 10:01:40 +01:00
Richard W.M. Jones
4dbae7cc06 tar-out: Add optional numericowner flag (RHBZ#847880).
This is equivalent to the tar option --numeric-owner.
2012-08-14 10:00:27 +01:00
Richard W.M. Jones
864ef706a8 Add optional compress flag to tar-in, tar-out APIs.
The compress flag can be used to control compression, one of: (none),
"compress", "gzip", "bzip2", "xz", "lzop".  Thus these calls can now
be used instead of tgz-in/tgz-out/txz-in/txz-out, and also support
more compression types.

Mark these APIs as once_had_no_optargs so that compatibility code is
generated.
2012-08-14 09:53:37 +01:00
Richard W.M. Jones
84c897c93a docs: Add a section describing how to use gdb + qemu wrappers to debug the appliance. 2012-08-13 13:51:29 +01:00
Richard W.M. Jones
22da2cb0ae docs: Show how to use 'annotate-output' command to collect timings. 2012-08-12 22:51:45 +01:00
Richard W.M. Jones
769a6f24c6 ocaml: Use Store_field macro instead of caml_modify.
Use the safer, higher level Store_field macro when constructing arrays
of structs to return.

I don't know if it is strictly necessary in this case, but it's safer.
2012-08-12 17:03:24 +01:00
Richard W.M. Jones
2c046c0d6f virt-make-fs: Don't display output of 'qemu-img' except on error path. 2012-08-11 20:53:00 +01:00
Richard W.M. Jones
2295b09f25 virt-make-fs: Remove note about vfat and ownership of tarball files.
This problem has been fixed in
commit 50780a84f6.
2012-08-11 20:51:28 +01:00
Richard W.M. Jones
f3b21b4da5 Include guestfs-release-notes.txt in the tarball.
This fixes commit 589db4e42a.
2012-08-11 19:08:33 +01:00
Richard W.M. Jones
32e5bab3ee tests/9p: Add test to EXTRA_DIST.
This fixes commit 499497fab0.
2012-08-11 18:35:13 +01:00
Richard W.M. Jones
42d404fa64 Version 1.19.29. 2012-08-11 14:18:42 +01:00
Wanlong Gao
159b1479cc sysprep: remove the process accounting log files
We just remove the process accounting files previously without
touch a empty file, this will cause psacct runs error.
Restart the service can't help us create this file auto.

couldn't open file '/var/account/pacct': No such file or directory

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-08-11 14:18:42 +01:00
Wanlong Gao
9fab546206 xfs: fix a possible memory leak
free out when failure.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-08-11 14:18:42 +01:00
Wanlong Gao
b93d004c7c Fix typo in release notes.
Fix typo.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-08-11 14:18:32 +01:00
Richard W.M. Jones
589db4e42a Convert release notes to a POD file / man page.
Note that we add the text version to git so that it's available for
people to read without requiring any special tools.
2012-08-11 14:18:29 +01:00
Richard W.M. Jones
198cc630f0 New APIs: rsync, rsync-in, rsync-out
Implement rsync.
2012-08-11 09:28:58 +01:00
Richard W.M. Jones
a05623cd71 fish: Add --network option.
This enables the libguestfs user network, and is the equivalent of the
'virt-rescue --network' option.
2012-08-11 09:28:58 +01:00
Richard W.M. Jones
7d6f76709e generator: 'delete' is a reserved word (in C++). 2012-08-11 09:28:58 +01:00
Richard W.M. Jones
04b475b414 tests/extra: Add workaround for memory leak in libvirt.
See: https://bugzilla.redhat.com/show_bug.cgi?id=847429
2012-08-11 09:28:58 +01:00
Richard W.M. Jones
1fe6f1f7bb Update release notes for libguestfs 1.20. 2012-08-04 17:24:42 +01:00
Richard W.M. Jones
47410e7999 appliance: Add rsync and openssh-client{,s} to the appliance.
This adds ~10M to the appliance (328M -> 338M).

However for virt-rescue these are frequently requested tools.
2012-08-04 11:48:46 +01:00
Richard W.M. Jones
87602b09ea fuse: guestmount doesn't let you pass '-- [FUSE options]'.
I don't think it ever did, so the --help text was always
wrong, and definitely didn't match the real behaviour of
the program.
2012-08-03 22:38:41 +01:00
Richard W.M. Jones
083125f709 ruby: Mark all VALUEs as volatile. 2012-08-03 19:24:44 +01:00
Richard W.M. Jones
2a87261dfc fish: Fix 'copy-out /' (RHBZ#845522). 2012-08-03 12:54:18 +01:00
Richard W.M. Jones
7fa67427c6 Document problems copying long filenames from NTFS to Linux filesystems (RHBZ#845488). 2012-08-03 11:53:44 +01:00
Richard W.M. Jones
1394d4a69b Version 1.19.28. 2012-08-02 17:35:32 +01:00
Richard W.M. Jones
863168467f examples: Use add_drive_opts function in examples.
In libguestfs 1.20, you will be able to use 'add_drive'
instead of 'add_drive_opts' (except in the C bindings).

However until libguestfs 1.20 is the minimum stable version
people will still be using old versions where you have to use
'add_drive_opts'.  This makes the examples confusing.

Therefore continue to use 'add_drive_opts' in the examples
for now.
2012-08-02 17:21:47 +01:00
Richard W.M. Jones
b3d0cc0588 grep: Add optargs to grep API and deprecate fgrep etc.
This commit makes grep into an optargs API, with flags for extended,
fixed, [case-]insensitive and compressed.

At the same time it deprecates: egrep, fgrep, grepi, egrepi, fgrepi,
zgrep, zegrep, zfgrep, zgrepi, zegrepi and zfgrepi.
2012-08-02 14:05:54 +01:00
Wanlong Gao
d40b502876 xfs: add new api xfs-growfs
New api xfs_growfs for expanding a XFS filesystem.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-08-02 10:20:57 +01:00
Richard W.M. Jones
9b9c372114 Revert "appliance: Add '-drive detect-zero=on' flag if qemu supports it."
This reverts commit fe2253088f.
2012-08-01 18:44:19 +01:00
Richard W.M. Jones
981c7b7310 Reviewed and revised TODO file. 2012-07-31 22:55:58 +01:00
Richard W.M. Jones
4efa0f8f38 m4: Sort .gitignore with LANG=C. Also add pipe2.m4 (used by RHEL 6). 2012-07-31 13:41:51 +01:00
Richard W.M. Jones
f21b866f31 build: On x86 search for qemu-system-i386 not qemu-system-i686.
host_cpu can be set to i686.  The qemu binary is called
qemu-system-i386.  Apply some sed to fix this.
2012-07-31 13:36:01 +01:00
Eric Blake
06780a92b3 build: Allow building with new glibc headers and -O0.
This is a patch taken from libvirt.  See:

http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=2af63b1c349
2012-07-31 13:15:34 +01:00
Richard W.M. Jones
499497fab0 9p: Add a regression test for 9p functionality in qemu. 2012-07-30 23:49:47 +01:00
Richard W.M. Jones
77326fa4ad appliance: Exclude kernel* packages explicitly.
febootstrap >= 3.19 will no longer exclude the kernel package
by default.
2012-07-30 23:49:47 +01:00
Richard W.M. Jones
54db02b60a Version 1.19.27. 2012-07-30 19:27:09 +01:00
Richard W.M. Jones
7b2f6bd665 libguestfs-make-fixed-appliance: Don't reference obsolete development version. 2012-07-30 17:32:10 +01:00
Richard W.M. Jones
b075b4d1fe New API: utsname
Typical output:

><fs> utsname
uts_sysname: Linux
uts_release: 3.5.0-1.fc18.x86_64
uts_version: #1 SMP Mon Jul 23 17:43:39 UTC 2012
uts_machine: x86_64
2012-07-30 15:16:45 +01:00
Richard W.M. Jones
b61a8a50bc sysprep: Describe more directly how to use qemu-img for snapshotting. 2012-07-28 21:28:23 +01:00
Richard W.M. Jones
dcc0ebc8e0 tests: Consistent use of $(top_builddir)/run --test when building test guests. 2012-07-26 22:02:07 +01:00
Richard W.M. Jones
590774ed9e build: Use $(top_builddir)/run in Makefile.am's.
Not necessary, but this makes all invocations of 'run' consistent.
There is no functional change.
2012-07-26 21:58:17 +01:00
Richard W.M. Jones
96d34d883f Version 1.19.26. 2012-07-26 19:01:28 +01:00
Richard W.M. Jones
fe2253088f appliance: Add '-drive detect-zero=on' flag if qemu supports it.
NB: The patch to implement this feature in qemu is not upstream, and
may never make it upstream.  However this is so useful for
virt-sparsify that I decided to add this to libguestfs while we see
what qemu decides to do.
2012-07-26 18:33:37 +01:00
Richard W.M. Jones
0f837ec068 ruby: Allow optional arguments hash to be really optional.
Allow optargs functions to be called as either:

  g.mkfs_opts(fs, device)

or:

  g.mkfs_opts(fs, device, { optargs hash })

This also preserves backwards compatibility with once_has_no_optargs
functions such as mkfs.
2012-07-26 11:57:02 +01:00
Richard W.M. Jones
5f30912d74 ruby: In event wrapper, ignore callback functions which have type T_ZOMBIE.
Note that in old versions of Ruby, T_ZOMBIE was not defined.
2012-07-26 11:56:49 +01:00
Richard W.M. Jones
7b84b49603 ruby: Set LD_LIBRARY_PATH for Ruby libs in run script.
This lets you use './run gdb ruby ...' and get accurate
debugging information.
2012-07-25 22:56:54 +01:00
Richard W.M. Jones
208d1c1a09 sparsify: Detect qemu-img version and use qcow2 v3 for overlay if available.
qcow2 v3 is generally more efficient, although unfortunately it
doesn't support automatically sparsifying zero writes.

Note this *only* uses qcow2 v3 for the intermediate overlay file, not
for the final output (since we want the output to be broadly
compatible with old hypervisors).
2012-07-25 16:51:42 +01:00
Richard W.M. Jones
0b3b5f984c sparsify: Change code that generates qemu-img -o argument.
This is just code motion.
2012-07-25 16:28:12 +01:00
Richard W.M. Jones
42bf3274e4 sysprep: Generate new random UUIDs for LVM2 PVs and VGs (thanks Kazuo Moriwaka). 2012-07-25 14:47:15 +01:00
Richard W.M. Jones
e64bf3fb29 New APIs: pvchange-uuid, pvchange-uuid-all, vgchange-uuid, vgchange-uuid-all.
These APIs will allow sysprep to change the UUIDs of all PVs and VGs
in the system.

LVs don't have UUIDs AFAICT, or at least there seems to be no way to
change them if they do have them.
2012-07-25 14:47:15 +01:00
Richard W.M. Jones
2b59b5f1d2 sysprep: Change perform callback to perform_on_filesystems and perform_on_devices.
Operations that need to work directly on guest block devices will fail
because the block devices are busy.  Therefore add a phase with the
filesystems unmounted, and allow operations to specify that they need
to work in this phase.
2012-07-25 14:47:15 +01:00
Matthew Booth
1fb95e6566 fish: Use minimal permissions when initially creating history file 2012-07-25 14:17:37 +01:00
Richard W.M. Jones
b7ff02354d sysprep: Tidy up the Makefile.
This is just code motion.
2012-07-25 10:15:47 +01:00
Richard W.M. Jones
4fa51f11da sysprep: operation machine-id: return `Created_files.
This operation can create the /etc/machine-id file, so it may need to
be relabelled by SELinux.

This fixes commit e68336d72a.
2012-07-25 10:09:28 +01:00
Wanlong Gao
e68336d72a sysprep: remove the local machine ID
remove the local machine ID, leave it empty, let it be generated
during next booting.

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

RWMJ:
 - Whitespace change.
 - Remove completed items from TODO.
2012-07-25 08:56:38 +01:00
Wanlong Gao
a121f1d654 sysprep: remove the auto generated abrt data
remove the automatically generated abrt data.

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

RWMJ:
 - Remove copy and pasted line.
 - Use C<> in description.
2012-07-25 08:55:20 +01:00
Masami HIRATA
d74e7fad28 Mac OS X: Use u_int64_t/uint64_t instead of unsigned hyper in .x file
Signed-off-by: Masami HIRATA <msmhrt@gmail.com>

RWMJ:
  Fixed whitespace in generator_xdr.ml
2012-07-24 19:40:40 +01:00
Masami HIRATA
61c9ea496e Mac OS X: Use libtool --mode=execute instead of LD_LIBRARY_PATH
because Mac OS X doesn't support LD_LIBRARY_PATH

Signed-off-by: Masami HIRATA <msmhrt@gmail.com>
2012-07-24 19:40:40 +01:00
Masami HIRATA
7d3f190d90 Mac OS X: Use gnulib stat-time module explicitly.
Signed-off-by: Masami HIRATA <msmhrt@gmail.com>
2012-07-24 19:40:40 +01:00
Masami HIRATA
a887dd5109 lib: Use <sys/socket.h> and <sys/un.h> for sockaddr_un
Signed-off-by: Masami HIRATA <msmhrt@gmail.com>
2012-07-24 19:40:39 +01:00
Masami HIRATA
399887defd Mac OS X: Use real files for gtk-doc (not the symlink)
Signed-off-by: Masami HIRATA <msmhrt@gmail.com>
2012-07-24 19:40:39 +01:00
Masami HIRATA
9519c60ce5 Mac OS X: don't check glibc-style extended printf formatters unless --enable-daemon
Signed-off-by: Masami HIRATA <msmhrt@gmail.com>

RWMJ:
 - Test was in the wrong place (before --enable-daemon had been
   detected) so I moved it later.
2012-07-24 19:40:14 +01:00
Masami HIRATA
7dab208765 Mac OS X: #define UNIX_PATH_MAX 104
See http://developer.apple.com/library/mac/documentation/Darwin/Reference/Manpages/man4/unix.4.html

Signed-off-by: Masami HIRATA <msmhrt@gmail.com>
2012-07-24 19:18:37 +01:00
Masami HIRATA
6e3f8d2511 Mac OS X: Added check of #include <endian.h>
Mac OS X doesn't have endian.h

Signed-off-by: Masami HIRATA <msmhrt@gmail.com>
2012-07-24 19:18:37 +01:00
Masami HIRATA
a47fa7a65e Mac OS X: Use gnulib fstatat module explicitly.
Signed-off-by: Masami HIRATA <msmhrt@gmail.com>
2012-07-24 19:18:37 +01:00
Masami HIRATA
d6ef91d7c4 Mac OS X: Use gnulib memmem module explicitly.
m4/.gitignore: Update.

Signed-off-by: Masami HIRATA <msmhrt@gmail.com>
2012-07-24 19:18:37 +01:00
Masami HIRATA
ef1a8446a6 configure: Use $(PERL) instead of perl
Signed-off-by: Masami HIRATA <msmhrt@gmail.com>
2012-07-24 19:18:36 +01:00
Masami HIRATA
8f3a839aa8 configure: Add -nographic command line option to qemu.
Without this option, configure will fail when there is no display.

Signed-off-by: Masami HIRATA <msmhrt@gmail.com>
2012-07-24 19:18:36 +01:00
Richard W.M. Jones
ebe826f23f Version 1.19.25. 2012-07-24 14:48:39 +01:00
Richard W.M. Jones
67e1c90605 launch: libvirt: Suppress printing of libvirt errors to stderr and other cleanups. 2012-07-24 14:26:55 +01:00
Richard W.M. Jones
493e80ab4e launch: libvirt: Use SELinux-mandated directory for sockets (RHBZ#842307).
Note this does not yet enable sVirt confinement of the appliance.
That requires at least that SELinux policy goes upstream, plus there
may still be bugs.
2012-07-24 14:03:36 +01:00
Richard W.M. Jones
97aeaa86d0 todo: More suggestions for virt-sysprep (thanks Kazuo Moriwaka). 2012-07-24 13:42:06 +01:00
Richard W.M. Jones
5d0ef09963 launch: libvirt: Move free to end of function.
This is just code motion.
2012-07-24 13:01:08 +01:00
Richard W.M. Jones
507aa9ac35 launch: libvirt: Add is_blk utility.
This is just code motion.
2012-07-24 13:01:08 +01:00
Wanlong Gao
d8b2c1afee umount: use Dev_or_Path for the argument type
Use Dev_or_Path instead of String.

Remove the RESOLVE_DEVICE since Dev_or_Path will generate
REQUIRE_ROOT_OR_RESOLVE_DEVICE instead.

RWMJ:
Note a change in semantics: this now requires root.  However this is
OK and still works with mkmountpoint and friends because
'is_root_mounted' works even if something is mounted below the root.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-07-24 13:01:08 +01:00
Richard W.M. Jones
c03cdcc25c launch: libvirt: Set <emulator> in libvirt XML if g->qemu is not the default. 2012-07-24 10:21:32 +01:00
Richard W.M. Jones
40e5317cfb xfs-info: Fix description to refer to 'pathordevice' param. 2012-07-24 10:16:31 +01:00
Wanlong Gao
f4094b91d2 xfs_info: resolve device when doing xfs_info on a device
Resolve device first, like do_umount.
Use Dev_or_Path.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-07-24 10:10:30 +01:00
Wanlong Gao
bda974e64c umount: add force umount and lazy umount
Add the option force and lazy for force and lazy umount.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-07-24 09:06:27 +01:00
Richard W.M. Jones
6bdc4b30ea Version 1.19.24. 2012-07-23 21:53:55 +01:00
Richard W.M. Jones
2b059535b1 tests: Skip regression test for 790721 if attach-method is not 'appliance'. 2012-07-23 21:41:47 +01:00
Richard W.M. Jones
941ec968b8 lib: Initialize libvirt and libxml2 once when the library loads. 2012-07-23 21:26:18 +01:00
Richard W.M. Jones
bf00be0e17 launch: Make get-pid and max-disks APIs into virtual methods of the current attach-method. 2012-07-23 20:17:25 +01:00
Richard W.M. Jones
3614d76b37 tests: Move debug-drives testing API to launch.c and change the output.
It should work with any attach-method.
2012-07-23 20:17:24 +01:00
Richard W.M. Jones
a6366f5dae python: Set file encoding to utf-8. 2012-07-23 20:17:24 +01:00
Richard W.M. Jones
bc917a0efc tests/protocol: Skip these tests if default attach-method is not 'appliance'. 2012-07-23 18:44:07 +01:00
Richard W.M. Jones
b6afb98a79 tests: Fix get-attach-method test.
If ./configure --with-default-attach-method is set to something other
than 'appliance', then this will legitimately return a different
string.  Simply test that it runs, rather than testing the output.

This fixes commit 20a5b4de7d.
2012-07-23 18:44:07 +01:00
Richard W.M. Jones
c65ee25a75 tests: Remove get-pid test.
If the libvirt attach-method is used, then there is no known PID
(libvirt hides it).
2012-07-23 18:44:02 +01:00
Richard W.M. Jones
0a1b2f85e6 launch: libvirt: Use <driver name="qemu" type=[format] />.
We were using format= which was bogus and libvirt was ignoring it and
forcing raw format instead.

Also in its default configuration libvirt won't do disk format
autodetection at all, so we must do it instead.
2012-07-23 18:08:16 +01:00
Richard W.M. Jones
f9e484ca45 launch: libvirt: You can't set O_CLOEXEC flag using fcntl + F_SETFL.
And in any case there is no point, since proto.c already sets the
SOCK_CLOEXEC flag (using accept4) on this socket.

The code now matches the code in launch-appliance.c.
2012-07-23 18:08:16 +01:00
Richard W.M. Jones
793a482015 launch: libvirt: Use accept4 to set socket flags correctly. 2012-07-23 18:08:16 +01:00
Richard W.M. Jones
5fb0f4e07e launch: libvirt: Add <on_reboot>destroy</on_reboot> to libvirt XML.
This causes libvirt to add the qemu -no-reboot option, which
reflects existing behaviour.
2012-07-23 16:43:14 +01:00
Richard W.M. Jones
20a5b4de7d launch: Allow default attach-method to be set in environment or configure.
You can now choose the default attach method in two ways:

(1) Set the LIBGUESTFS_ATTACH_METHOD environment variable.

(2)  ./configure --with-default-attach-method=appliance|libvirt|...

Note that (1) overrides (2).
2012-07-23 15:24:57 +01:00
Richard W.M. Jones
7a691e6665 java: Set '-encoding utf8' for javac and javadoc commands. 2012-07-23 15:24:07 +01:00
Richard W.M. Jones
7f519bdc06 java: JAVAC_FLAGS -> EXTRA_JAVAC_FLAGS.
This is just a rename.
2012-07-23 15:18:12 +01:00
Richard W.M. Jones
99f108b840 launch: libvirt: Move remaining to-do items to TODO file. 2012-07-23 14:28:03 +01:00
Richard W.M. Jones
68836022d2 launch: libvirt: Add a hack to detect if KVM is available.
We need to select the <domain type=...> attribute depending on whether
KVM is detected in the libvirt capabilities.

This is a hack because it doesn't try to parse the libvirt
capabilities XML.
2012-07-23 13:14:16 +01:00
Richard W.M. Jones
890a4fbc87 launch: libvirt: Use <cpu model="host-model"/> (thanks Dan Berrange).
This ensures maximum performance of the appliance, particularly for
things like MD where the guest needs to use optimal SSE instructions.
2012-07-23 13:05:46 +01:00
Richard W.M. Jones
67f7a30cc9 launch: libvirt: Change disk XML according to whether host path is device or file (thanks Dan Berrange). 2012-07-23 13:02:25 +01:00
Richard W.M. Jones
f2d7305091 launch: libvirt: Use "guestfs-" prefix on random names (thanks Dan Berrange). 2012-07-23 12:46:37 +01:00
Richard W.M. Jones
ef75c4c568 launch: libvirt: Enforce minimum version of libvirt 0.9.13. 2012-07-23 12:45:31 +01:00
Richard W.M. Jones
524bb29526 launch: libvirt: Use snapshot=on instead of <readonly/>.
For compatibility with the appliance backend, devices added readonly
are in fact added writable with snapshots on top.  This is necessary
because options like 'mount -o ro' usually require write access to the
disk (eg. to replay journals).
2012-07-23 12:37:22 +01:00
Richard W.M. Jones
abcd6f0c15 Version 1.19.23. 2012-07-22 14:40:43 +01:00
Richard W.M. Jones
aa0efa9eb4 launch: Add libvirt backend.
Complete the attach-method libvirt backend.

This backend uses libvirt to create a transient KVM domain to run the
appliance.

Note that this still will only work with local libvirt URIs since the
<kernel>, <initrd> and appliance links in the libvirt XML refer to
local files, and virtio serial only works locally (limitation of
libvirt).  Remote support will be added later.
2012-07-22 09:32:04 +01:00
Richard W.M. Jones
42ba262003 Add attach-method "libvirt" or "libvirt:<URI>".
With this commit, you can set the attach method to libvirt,
but calling launch will give an error.
2012-07-21 15:47:50 +01:00
Richard W.M. Jones
f32b93416a launch: Make 'drive_name' into a common function.
This is just code motion.
2012-07-21 15:47:50 +01:00
Richard W.M. Jones
fa3b204f4a appliance: Push appliance building lock into guestfs___build_appliance.
Since we will be calling guestfs___build_appliance from the libvirt
code in future, there's no point having two places where we have to
acquire the lock.  Push the lock down into this function instead.

Because "glthread/lock.h" includes <errno.h> we have to add this
header to the file too.
2012-07-21 14:26:24 +01:00
Wanlong Gao
a58368b3db fuse:remove the unused macro when fuse is not available
Just make gcc happy when fuse is not available.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-07-21 08:30:44 +01:00
Richard W.M. Jones
ec8e3b6cad launch: Abstract attach method operations.
g->attach_ops points to a structure which contains the
operations supported by each attach method backend
(ie. appliance, unix, etc.).
2012-07-20 15:10:46 +01:00
Richard W.M. Jones
08cad54349 launch: Move the command line building code entirely into launch-appliance.c.
Although we still use the handle as convenient temporary
storage.
2012-07-20 13:49:10 +01:00
Richard W.M. Jones
52fa23d74f launch: Move guestfs_config API and build list of qemu parameters in handle.
Move and rewrite guestfs_config so it accumulates a list of qemu
parameters in the handle.  These are added to the appliance at launch
time (with attach method == unix:...  you'll now get an error).
2012-07-20 13:43:55 +01:00
Richard W.M. Jones
4df6beee54 launch: Move launch timing / messages code into launch.c. 2012-07-20 13:43:13 +01:00
Richard W.M. Jones
54fd9a10a6 lib: Use bool (from <stdbool.h>) for a few fields in the handle. 2012-07-20 13:43:13 +01:00
Richard W.M. Jones
709e28e6d5 lib: Rearrange fields in guestfs handle.
Arrange the fields more logically.  This is just code motion.
2012-07-20 13:43:13 +01:00
Richard W.M. Jones
a6e0e0d6bf add-cdrom: Rewrite description emphasising that this API should not be used. 2012-07-20 13:43:13 +01:00
Richard W.M. Jones
184b9d7c11 ocaml: Skip mount-local test if /dev/fuse is not writable. 2012-07-20 08:35:13 +01:00
Richard W.M. Jones
9d314c7c3f launch: Remove some dead code from the appliance method. 2012-07-19 19:06:23 +01:00
Richard W.M. Jones
4c261da5ba lib: Split launch.c into separate files.
launch-appliance.c contains the code associated with the 'appliance'
attach-method.  Mostly.  In fact there are a few APIs which don't fit
so nicely:

 - config: deprecated API which fiddles with the qemu command
   line directly

 - max-disks: depends on the qemu implementation (virtio-scsi
   or not)

 - debug-drives: used for testing only

launch-unix.c contains the code associated with 'unix:<path>'.

launch.c is the common code for launching, along with a few other APIs
such as guestfs_add_drive_opts.

This commit also reduces the number of headers to just those
which are required.
2012-07-19 17:49:25 +01:00
Richard W.M. Jones
80d102c49d Remove debug-cmdline API.
Note that debug* calls are not part of the stable API and can be
removed or changed at any time.
2012-07-19 17:12:44 +01:00
Richard W.M. Jones
eca544d87d lib: Use safe_asprintf when constructing attach_method.
Just a small code cleanup / simplification.
2012-07-19 16:26:06 +01:00
Richard W.M. Jones
2e4089f300 build: Rename most C files that contain underscore with dash.
This is just code motion.

Some files cannot be renamed.  Notably rpcgen input and output files
must not contain dash characters, else rpcgen breaks.
2012-07-19 16:11:47 +01:00
Richard W.M. Jones
6054051a9d fish: Rename fish/virt.c to fish/domain.c
This file handles the -d option for guestfish and other C command line
utilities.  Renaming this file makes it less confusing.
2012-07-19 16:11:26 +01:00
Richard W.M. Jones
d1d29ab488 build: Rename src/virt.c to src/libvirtdomain.c
This file contains the code implementing guestfs_add_domain
(for adding a libvirt domain) so this name is less confusing.
2012-07-19 16:11:26 +01:00
Richard W.M. Jones
d88f4ca634 build: Arrange libguestfs_la_SOURCES in order. 2012-07-19 16:11:26 +01:00
Richard W.M. Jones
a8b4ea1f0c Remove references to long-obsolete Ocaml_inspector module from .gitignore. 2012-07-19 16:11:24 +01:00
Richard W.M. Jones
f514d462cd podwrapper: Fix setting of GIT_DIR in git subcommand.
This fixes commit 1e17a32060.
2012-07-19 16:10:48 +01:00
Richard W.M. Jones
805d642565 license: Use latest license files from gnu.org.
COPYING from https://www.gnu.org/licenses/gpl-2.0.txt
COPYING.LIB from https://www.gnu.org/licenses/lgpl-2.1.txt

(Note this change shouldn't alter the licensing of libguestfs)
2012-07-19 14:17:31 +01:00
Richard W.M. Jones
719297a220 Version 1.19.22.
Includes rebuilt gnulib to work around test problems with
test-getlogin_r.
2012-07-19 13:51:16 +01:00
Richard W.M. Jones
6e1b5f0fea gnulib: Don't include or run getlogin_r test (thanks Jim Meyering).
See:
https://lists.gnu.org/archive/html/bug-gnulib/2012-07/msg00194.html
2012-07-19 12:43:55 +01:00
Richard W.M. Jones
fc86db3b3b build: Return 77 from skipped tests. 2012-07-19 11:22:40 +01:00
Richard W.M. Jones
1b94ea204d Version 1.19.21. 2012-07-18 21:51:20 +01:00
Richard W.M. Jones
a0a517869c tests: Rewrite parallel mount-local test in C. 2012-07-18 20:09:40 +01:00
Richard W.M. Jones
eef11f33f9 ocaml: Test mount-local, without parallel test.
Unfortunately the parallel test keeps hitting this bug:
https://bugzilla.redhat.com/show_bug.cgi?id=838081
which could be a bug in the OCaml runtime.

Just test simple mount-local.  We will write a parallel test in C to
replace this.
2012-07-18 13:45:21 +01:00
Richard W.M. Jones
50780a84f6 tar-in: Add --no-same-owner flag to tar command when target filesystem doesn't support chown (RHBZ#840572).
When using tar-in or tools built around it such as virt-make-fs, if
the target filesystem is vfat then unpacking the tarball would fail
because tar tries to chown(2) files and fails.

You would see errors such as:

tar: <file>: Cannot change ownership to uid 500, gid 500: Operation not permitted

This change detects whether the target filesystem supports chown(2).
If not, it adds the --no-same-owner flag to tar to stop it from trying
to change the ownership of newly created files.
2012-07-18 12:33:16 +01:00
Richard W.M. Jones
781857a86b daemon: Make 'random_name' into a utility function.
This is mostly code motion, although the precise contract of this
function changes slightly to make it more generally useful
2012-07-18 12:32:21 +01:00
Richard W.M. Jones
9c2b9c2df6 virt-make-fs: Suggest guestfish for complex layouts in man page. 2012-07-18 11:14:19 +01:00
Richard W.M. Jones
b25aea33fa build: Change how make.sh, packagelist, excludelist are updated.
Add proper dependencies for these files, but also use 'cmp' to ensure
they only get overwritten if the new files have actually changed, so
we don't rebuild the appliance unnecessarily.
2012-07-18 10:03:29 +01:00
Wanlong Gao
87206e4e9e New API: add new api xfs_info
Add xfs_info to show the geometry of the xfs filesystem.

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

RWMJ:
 - Updated po/POTFILES.
 - Use xfs_ prefix for all struct fields.
 - Return uninitialized fields as -1 / empty string.
 - Copyedit the description.
2012-07-18 09:37:17 +01:00
Wanlong Gao
2f89f584c0 augeas: make functions as noreturn
Just make gcc happy.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-07-18 09:05:32 +01:00
Richard W.M. Jones
8e75e21b23 podwrapper: Use UTF8 in output, send errors to stderr.
This fixes commit 1e17a32060.
2012-07-17 20:04:24 +01:00
Richard W.M. Jones
d76ea07814 Version 1.19.20. 2012-07-17 15:38:52 +01:00
Richard W.M. Jones
973581780d case_sensitive_path: Allow trailing path element to be missing (RHBZ#840115).
case_sensitive_path is undefined when the final path element doesn't
exist.  Currently it returns an error, but this means that creating a
new file doesn't work as expected:

  $ guestfish --rw -i -d windows touch 'win:c:\blah'
  libguestfs: error: case_sensitive_path: blah no file or directory found with this name

We should allow this case (provided there is no trailing slash) so
that new files or directories can be created.
2012-07-17 14:37:03 +01:00
Richard W.M. Jones
ac0373bdec case_sensitive_path: Move variables to top of function.
This is just code motion.
2012-07-17 13:46:48 +01:00
Richard W.M. Jones
4bc110e2bc docs: Use L<...> for links.
Instead of working around bugs, podwrapper has been fixed so that
links work in all output formats.
2012-07-17 13:18:39 +01:00
Richard W.M. Jones
182b4a6660 podwrapper: Subclass Pod::Man so we can fix the way links are generated. 2012-07-17 13:18:34 +01:00
Richard W.M. Jones
9967ad3fa1 podwrapper: Define $VERSION in subclass.
The superclass sometimes uses this and will give an undefined
error if it's missing.
2012-07-17 13:18:34 +01:00
Richard W.M. Jones
60c42dd2a1 podwrapper: Tidy up the program name.
Messages now look like this:

  podwrapper.pl: wrote guestfs-examples.3
  podwrapper.pl: wrote ../html/guestfs-examples.3.html
2012-07-17 13:18:34 +01:00
Richard W.M. Jones
f6846d74c9 perl: In examples, call $g->shutdown, $g->close. 2012-07-17 12:34:51 +01:00
Richard W.M. Jones
a99ea198b2 perl: Use $g instead of $h in documentation.
$g is the "standard" name for libguestfs handles.
2012-07-17 12:33:45 +01:00
Richard W.M. Jones
8d0baf7b85 docs: febootstrap is in section 8 of the manual, not section 1. 2012-07-16 23:04:17 +01:00
Richard W.M. Jones
1e17a32060 Replace podwrapper shell script with custom Perl script.
This uses Pod::Simple so it properly parses the input POD and can
generate proper custom output as required specifically by libguestfs.

One immediate benefit is that links between and within manual pages
now work mostly correctly.
2012-07-16 22:53:01 +01:00
Richard W.M. Jones
0bf1e5b665 Fix pod.css for new HTML output from Perl 5.16.
There used to be a <div> around the table of contents, but that
is no longer present.
2012-07-16 22:13:24 +01:00
Richard W.M. Jones
3a442e6617 configure: Make generated files read-only.
Some of the generated files anyway.
2012-07-16 21:58:34 +01:00
Richard W.M. Jones
f2ea617e22 build: Change calls to podwrapper.sh to use $(PODWRAPPER).
This will allow us to easily change the location of this
script in future.
2012-07-16 18:56:57 +01:00
Richard W.M. Jones
c7d342a94a virt-make-fs: Add --floppy option to make preconfigured vfd's. 2012-07-16 16:47:44 +01:00
Richard W.M. Jones
24b7979ea2 virt-make-fs: Recognize "msdos" as a partition or filesystem type.
Set MBR partition type byte accordingly.
2012-07-16 16:26:26 +01:00
Richard W.M. Jones
d69a03e448 Revert "ocaml: Calling Gc.compact before g#mount_local works around RHBZ#838081."
This reverts commit ad7c4498f6.

Reverted because we still see core dumps.
2012-07-16 14:01:46 +01:00
Richard W.M. Jones
2bd080fd5a Version 1.19.19. 2012-07-16 13:29:40 +01:00
Richard W.M. Jones
98f2d221cf run: Update comments. 2012-07-16 13:29:39 +01:00
Richard W.M. Jones
95d26f0240 generator: Rename 'ntfsresize_opts' API to 'ntfsresize'.
By using the once_had_no_optargs flag, this change is backwards
compatible for callers.
2012-07-14 13:08:21 +01:00
Richard W.M. Jones
e055bf4cab generator: Rename 'mkfs_opts' API to 'mkfs'.
By using the once_had_no_optargs flag, this change is backwards
compatible for callers.
2012-07-14 12:43:13 +01:00
Richard W.M. Jones
7486fc6f43 generator: Rename 'add_drive_opts' API to 'add_drive'.
By using the once_had_no_optargs flag, this change is backwards
compatible for callers (except Haskell, PHP and GObject as discussed
in earlier commit).
2012-07-14 12:42:24 +01:00
Richard W.M. Jones
b48ae2eadf generator: In non-C bindings, generate '*_opts' alias.
In C, a function called 'func' which has once_had_no_optargs=true will
(because of the previous commit) generate 'func_opts' and a
backwards-compatibility function called 'func'.

This commit changes some of the non-C bindings so that they also
generate 'func_opts' which is merely a wrapper that calls 'func'.

This avoids incompatibility when we rename 'mkfs_opts' etc back to
plain 'mkfs', and it also makes it easier to translate between other
language bindings and C code.

NB: Some bindings do not include aliases:

  PHP:     There's no way to easily alias methods in PHP < 5.3, and we
           can't assume everyone has this minimum version.

  GObject: Very complex to add aliases, but we should probably do this
           at some point.

  Haskell: No support for optargs in these bindings.  Unfortunately
           this means that we can no longer bind 'Guestfs.add_drive'
           (since it will be changed to add optional arguments) making
           the Haskell bindings even less useful than they were already.
2012-07-14 11:13:49 +01:00
Richard W.M. Jones
98757e151a generator: Allow non-optargs functions to gain optargs.
This commit adds a flag (once_had_no_optargs) which can be used to add
optargs to functions that currently don't have any.

The idea is that if 'func' currently has no optargs, we can safely add
optargs provided we are backwards compatible for existing callers.

In C that means we leave 'guestfs_func' alone and provide an extra
function 'guestfs_func_opts' that takes the optargs ('guestfs_func'
becomes a wrapper that calls 'guestfs_func_opts').

In the C generator this means there are two names for each function
(although the two names are normally identical).  'c_name' is the name
that we export publicly (eg. [guestfs_] 'func_opts').  'name' is the
internal name of the function (eg. 'func') which is used for
everything apart from the public interface, and also to generate the
no-optargs compat function.

In other languages that can add optional arguments safely, we simply
add the arguments to the existing 'func', so for example in Perl:

  $g->func (required_args)
  $g->func (required_args, optional_args)

can be used.

Note that this commit does not cause any change to the output of the
generator.  I verified this by diffing the output before and after.
2012-07-14 10:20:58 +01:00
Richard W.M. Jones
9eb6060456 generator: Rearrange some C generator code into sub-functions.
This is just code motion.  I verified this by comparing the
generator output before and after this commit.
2012-07-13 14:02:43 +01:00
Richard W.M. Jones
0da2dbef26 java: Generate overloaded non-optargs method for each optargs method.
For example the existing method:

  public void mkfs_opts (String fstype, String device, Map<..> optargs);

is now accompanied by this overloaded method which is a simple wrapper:

  public void mkfs_opts (String fstype, String device)
    throws LibGuestFSException
  {
    mkfs_opts (fstype, device, null);
  }
2012-07-13 14:02:43 +01:00
Richard W.M. Jones
60805c9217 generator: Add c_optarg_prefix for each action.
This updates commit 9286f556c6.
2012-07-13 09:00:25 +01:00
Richard W.M. Jones
9286f556c6 generator: Add c_function (C function name) to each action struct.
This field, which is generated internally by the generator, is the
name of the C function corresponding to each action.

For actions that have NO optional arguments, it's just "guestfs_<name>".

For actions that have any optional arguments, it is
"guestfs_<name>_argv" (since any binding has to construct the optional
argument struct explicitly).

In a future commit, this mapping may become more complex.

This commit also "fixes" the C# bindings which didn't handle optional
arguments properly at all.  In fact, it doesn't fix this, it just
changes it enough that it probably now compiles.  We should either
compile and test the bindings routinely with Mono, or drop them, since
they are starting to bit-rot.

In the GObject bindings, I have added a space between the C function
name and the first paren.

Apart from the C# and GObject changes, this is just code motion.  It
was verified by diffing the output of the generator before and after.
2012-07-12 12:50:49 +01:00
Richard W.M. Jones
e80f368732 generator: Change the way that camel-case names are generated.
Store the camel-case name directly in the struct instead
of generating it on the fly in only the GObject bindings.

This is just code motion.  Tested by verifying that the generator
output is identical.
2012-07-12 11:11:31 +01:00
Richard W.M. Jones
e452a0b8ca tests: Rename test0* functions as internal_test*.
The internal_* prefix is reserved for internal functions
such as these tests.
2012-07-11 23:56:10 +01:00
Richard W.M. Jones
7a0478bed0 tests: Better way to ensure 'g' is used and return success or error. 2012-07-11 23:55:11 +01:00
Richard W.M. Jones
39d1a7dbc9 generator: Use a struct instead of a tuple to describe each action.
Each action changes from a tuple like this:

  ("cat", (RString "content", [Pathname "path"], []), 4,
   [ProtocolLimitWarning],
   [InitISOFS, Always, TestOutput (
      [["cat"; "/known-2"]], "abcdef\n")],
   "list the contents of a file",
   "[...]");

to a slightly longer but more readable struct:

  { defaults with
    name = "cat";
    style = RString "content", [Pathname "path"], [];
    proc_nr = Some 4;
    protocol_limit_warning = true;
    tests = [
      InitISOFS, Always, TestOutput (
      [["cat"; "/known-2"]], "abcdef\n")
    ];
    shortdesc = "list the contents of a file";
    longdesc = "[...]" };

["defaults" is a struct which contains the defaults for every field,
allowing us to use the "{ defaults with ... }" syntax to just update
the fields we want to be different from the defaults.]

This is a mechanical change and there is no change to the output of
the generator.  I checked the output before and after with diff to
verify this.  There are no changes in the output apart from UUIDs
which are expected to change with each run.
2012-07-11 19:55:16 +01:00
Richard W.M. Jones
7b619d47f6 todo: Tidy up test0 functions. 2012-07-11 15:05:57 +01:00
Richard W.M. Jones
196742cd46 generator: Add a note in generator/README about safely extending functions. 2012-07-11 10:47:18 +01:00
Richard W.M. Jones
cf0defedb8 generator: Move note in comment to generator/README file. 2012-07-11 10:46:56 +01:00
Richard W.M. Jones
ec0c7e0a1a fuse: Cleaner code and documentation for safe cleanups. 2012-07-10 19:03:19 +01:00
Richard W.M. Jones
f883e4d8d3 tests/guests: Add temp files to CLEANFILES. 2012-07-10 18:59:04 +01:00
Richard W.M. Jones
1c8403885c Update translations from Transifex. 2012-07-10 18:44:45 +01:00
Richard W.M. Jones
33bb7408f6 podwrapper: Fix shell script.
This fixes commit f9a5e3ed86.
2012-07-10 13:46:17 +01:00
Hilko Bengen
f9a5e3ed86 podwrapper.sh: Take date from ChangeLog or from the latest git commit. 2012-07-10 10:34:37 +02:00
Richard W.M. Jones
afb30b1b8a Version 1.19.18. 2012-07-09 18:36:46 +01:00
Richard W.M. Jones
8df259496a fuse: Add regression test for RHBZ#838592. 2012-07-09 17:44:50 +01:00
Richard W.M. Jones
5546ea6d68 fuse: Add guestmount --pid-file option (RHBZ#838592). 2012-07-09 16:10:24 +01:00
Richard W.M. Jones
bfbfe6dd78 fuse: Link to mount-local documentation in guestmount man page. 2012-07-09 15:24:26 +01:00
Richard W.M. Jones
1cde66165a fuse: Document race condition possible with fusermount.
See also:
https://bugzilla.redhat.com/show_bug.cgi?id=835466#c9
2012-07-09 15:23:52 +01:00
Richard W.M. Jones
b749dc7074 fuse: Document Device or resource busy errors from fusermount. 2012-07-09 15:23:09 +01:00
Richard W.M. Jones
bd3e42a8de Revert "launch: Correction in comment."
This reverts commit 6e5a85bb9b.

It turns out this is a bug in QEMU after all.
2012-07-08 12:55:44 +01:00
Richard W.M. Jones
e6dec15948 extra-tests: Add a test using upstream qemu. 2012-07-07 16:19:55 +01:00
Richard W.M. Jones
6e5a85bb9b launch: Correction in comment.
https://bugs.launchpad.net/qemu/+bug/1021649 is invalid, probably
caused by a Fedora ROM.

This updates commit 52d188e32f.
2012-07-07 15:49:22 +01:00
Richard W.M. Jones
1596b6026d Update gnulib to latest version. 2012-07-07 12:39:46 +01:00
Richard W.M. Jones
ac25512175 Version 1.19.17. 2012-07-06 14:11:38 +01:00
Richard W.M. Jones
ad7c4498f6 ocaml: Calling Gc.compact before g#mount_local works around RHBZ#838081. 2012-07-06 13:47:07 +01:00
Richard W.M. Jones
52d188e32f qemu: Use sgabios by default (thanks Dan Berrange). 2012-07-06 10:29:26 +01:00
Richard W.M. Jones
1b87f89b5c todo: Investigate qemu caching modes. 2012-07-04 16:44:35 +01:00
Richard W.M. Jones
a95fc92388 Version 1.19.16. 2012-07-04 16:17:44 +01:00
Richard W.M. Jones
7996e08824 qemu or qemu-kvm >= 1.1.0 is required.
Earlier versions of qemu contained a bug in the qcow2 code which
causes qemu to segfault when shutting down and flushing its internal
cache, and this can result in data loss.
2012-07-04 16:17:44 +01:00
Richard W.M. Jones
ffbf1475f7 New API: guestfs_shutdown: Cleanly shutdown the backend.
The new API splits orderly close into a two-step process:

  if (guestfs_shutdown (g) == -1) {
    /* handle the error, eg. qemu error */
  }
  guestfs_close (g);

Note that the explicit shutdown step is only necessary in the case
where you have made changes to the disk image and want to handle write
errors.  Read the documentation for further information.

This change also:

 - deprecates guestfs_kill_subprocess

 - turns guestfs_kill_subprocess into the same as guestfs_shutdown

 - changes guestfish and other tools to call shutdown + close
   where necessary (not for read-only tools)

 - updates documentation

 - updates examples
2012-07-03 21:27:29 +01:00
Richard W.M. Jones
bcc4ffb52b close: Warn if qemu exits unsuccessfully.
Currently guestfs_close has no method to return an error indication,
so this commit simply prints the error on stderr.
2012-07-03 18:14:06 +01:00
Richard W.M. Jones
fc3c6fff4b close: Rearrange the order in which the handle is closed and freed.
The order is now:

 - remove the handle from the list of handles
 - send close trace message
 - sync and shutdown qemu
 - run user close callback
 - free temporary directory
 - free memory

This commit ought to be no functional change.
2012-07-03 14:45:42 +01:00
Richard W.M. Jones
27ebf517fa perl, python, ruby: Fix comments on call to close method.
Make the comments consistent.

Also make the Perl example call $g->close explicitly so it is
consistent with the other examples.
2012-07-03 14:45:42 +01:00
Richard W.M. Jones
917550a117 examples: In create_disk example, don't call set_autosync.
This is now set by default in all supported versions of libguestfs.
It's just confusing if the examples refer to it.
2012-07-03 14:45:42 +01:00
Richard W.M. Jones
c0a3c9ce70 daemon: Run fsync on block devices after sync (RHBZ#836710).
On Linux, sync(2) does not actually issue a write barrier, thus it
doesn't force a flush of the underlying hardware write cache (or
qemu's disk cache in the virtual case).

This can be a problem, because libguestfs relies on running sync in
the appliance, followed by killing qemu (using SIGTERM).

In most cases, this is fine, because killing qemu with SIGTERM should
cause it to flush out the disk cache before it exits.  However we have
found various bugs in qemu which cause qemu to crash while doing the
flush, leaving the data unwritten (see RHBZ#836913).

The solution is to issue fsync(2) to the block devices.  This has a
write barrier, so it ensures that qemu writes out its cache long
before we get around to killing qemu.
2012-07-02 21:13:21 +01:00
Richard W.M. Jones
cb24ceedd8 daemon: Code tidy up in devsparts.
No functional change.
2012-07-02 16:42:17 +01:00
Richard W.M. Jones
0437a79056 Add notes about how qemu cache=none works internally.
This is just a comment and has no functional effect.
2012-07-02 14:16:35 +01:00
Richard W.M. Jones
1608ca182b Rename qemu option cache=off to cache=none.
Note that qemu treats these identically, so this change has
no functional effect.
2012-07-02 14:16:35 +01:00
Richard W.M. Jones
906f8e3ae2 appliance: Update paths to udevd.
systemd is playing a WTF game with udevd, moving it around and
renaming it unnecessarily in each release.  Chase all known locations.
2012-07-02 12:34:11 +01:00
Richard W.M. Jones
100271c7bc appliance: Update comment to note that systemd package now contains udevd. 2012-07-02 12:33:42 +01:00
Richard W.M. Jones
757b089053 Version 1.19.15. 2012-06-29 21:03:42 +01:00
Richard W.M. Jones
5489304c8d tests: Add a test of /dev/disk/by-id paths (RHBZ#627675). 2012-06-29 20:19:13 +01:00
Richard W.M. Jones
339f3647f8 tests: Use qemu-img to create an overlay for testing, instead of copying.
Replace:

  cp tests/guests/fedora.img test.img

with the longer but possibly more space-efficient equivalent:

  qemu-img create -F raw -b tests/guests/fedora.img -f qcow2 test.qcow2
2012-06-29 20:19:13 +01:00
Richard W.M. Jones
ea8421c5d2 inspect: Check partition exists when doing fstab mapping.
If the partition name we're about to return doesn't really exist,
then don't perform the mapping.
2012-06-29 20:19:13 +01:00
Richard W.M. Jones
7eaa99994e inspect: Guess device name from /dev/disk/by-id/*-partN path (RHBZ#627675).
See https://bugzilla.redhat.com/show_bug.cgi?id=836573#c3
for an explanation.

Useful function 'is_partition' shows how to tell if a device name
represents a partition.
2012-06-29 20:19:09 +01:00
Richard W.M. Jones
47b8225b05 inspect: Refactor resolve_fstab_device code into multiple functions.
This is mostly code motion, although it also fixes a memory leak in an
extremely rare failure case, and it generally tidies up the existing
code.
2012-06-29 19:04:21 +01:00
Richard W.M. Jones
152b179a19 New API: guestfs_nr_devices
This returns the number of whole block devices added.  It is usually
simpler to call this than to list the devices and count them, which
is what we do in some places in the current codebase.
2012-06-29 19:04:21 +01:00
Richard W.M. Jones
cba4916909 ruby: Fix detection of library (thanks Hilko Bengen).
On Debian, the Ruby C extensions library isn't '-lruby', it's
something like '-lruby1.8' or '-lruby-1.9.1' and these can even be
parallel-installed.

Fix detection so we use Ruby's own rbconfig.rb file to find the right
library to use.
2012-06-29 14:54:44 +01:00
Richard W.M. Jones
b07d096882 ruby: Changing spacing in configure file.
No functional change.
2012-06-29 14:54:05 +01:00
Richard W.M. Jones
b9f858e5ee ruby: Remove useless AC_SUBST in configure file. 2012-06-29 14:18:10 +01:00
Richard W.M. Jones
a176f508cb Update API support from tarballs. 2012-06-28 17:19:14 +01:00
Richard W.M. Jones
27efd99ddb tests: Reformat TESTS_ENVIRONMENT so all use a standard format.
No functional change.
2012-06-28 13:49:32 +01:00
Richard W.M. Jones
2f1a602c4b python: Set PYTHON in run script. 2012-06-28 13:47:35 +01:00
Richard W.M. Jones
04a533ca8c ocaml: Set CAML_LD_LIBRARY_PATH in run script. 2012-06-28 13:46:31 +01:00
Richard W.M. Jones
e7d2d3cb89 ruby: Use run --tests for tests. 2012-06-28 13:41:40 +01:00
Richard W.M. Jones
8439e97f76 java: Use run --tests for tests.
Java-specific environment variables are set in the run script.
2012-06-28 13:40:33 +01:00
Richard W.M. Jones
1b56aedc2b gobject: Use run --test for tests, and set GJS in run script. 2012-06-28 13:35:55 +01:00
Richard W.M. Jones
2d56e5af90 run: Rearrangement and add comments.
No functional change.
2012-06-28 13:32:53 +01:00
Richard W.M. Jones
927ef14c58 run: Set MALLOC_PERTURB_ to a random value.
MALLOC_PERTURB_ is a glibc feature which causes malloc to wipe memory
before and after it is used, allowing both use-after-free and
uninitialized reads to be detected with relatively little performance
penalty:

  http://udrepper.livejournal.com/11429.html?nojs=1

Modify the ./run script so that it always sets this.

We were already using MALLOC_PERTURB_ in most tests.  Since ./run is
now setting this, we can remove it from individual Makefiles.  Most
TESTS_ENVIRONMENT will now simply look like this:

  TESTS_ENVIRONMENT = $(top_builddir)/run --test
2012-06-28 13:19:39 +01:00
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
1442 changed files with 574010 additions and 96825 deletions

919
.gitignore vendored
View File

@@ -1,399 +1,560 @@
*~
*.a
ABOUT-NLS
aclocal.m4
align/stamp-virt-alignment-scan.pod
align/virt-alignment-scan
align/virt-alignment-scan.1
appliance/excludelist
appliance/make.sh
appliance/packagelist
appliance/stamp-supermin
appliance/supermin.d
autom4te.cache
*.bak
bindtests.tmp
/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
*.class
clone/stamp-virt-sysprep.pod
clone/virt-sysprep
clone/virt-sysprep.1
*.cma
*.cmi
*.cmo
*.cmx
*.cmxa
compile
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
cscope.out
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
.deps
df/stamp-virt-df.pod
df/virt-df
df/virt-df.1
*.diff
edit/stamp-virt-*.pod
edit/virt-edit
edit/virt-edit.1
*.eml
emptydisk
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/create_disk
examples/guestfs-examples.3
examples/guestfs-recipes.1
examples/guestfs-testing.1
examples/inspect_vm
examples/stamp-guestfs-examples.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
/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
*.hi
html/guestfish.1.html
html/guestfs.3.html
html/guestfs-erlang.3.html
html/guestfs-examples.3.html
html/guestfs-java.3.html
html/guestfs-ocaml.3.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/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
*.jar
java/api
java/Bindtests.java
java/com/redhat/et/libguestfs/Application.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/Partition.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
java/examples/guestfs-java.3
java/examples/stamp-guestfs-java.pod
*.la
libguestfs.pc
libguestfs.spec
libguestfs-*.tar.gz
.libs
libtool
*.lo
/local*
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
/maint.mk
Makefile
Makefile.in
missing
*.o
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
*.orig
*.patch
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/build/
php/extension/config.nice
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/Makefile.fragments
php/extension/Makefile.global
php/extension/Makefile.objects
php/extension/mkinstalldirs
php/extension/modules/
php/extension/php_guestfs_php.h
php/extension/run-tests.php
php/extension/tmp-php.ini
po/boldquot.sed
pod2htm?.tmp
po-docs/*/*.1
po-docs/*/*.3
po-docs/*/*.pl
po-docs/po4a.conf
po-docs/*/*.pod
podwrapper.sh
po/en@boldquot.header
po/en@quot.header
po/*.gmo
po/insert-header.sin
po/LINGUAS
po/Makevars.template
po/POTFILES
po/quot.sed
po/remove-potcdate.sed
po/remove-potcdate.sin
po/Rules-quot
po/stamp-it
po/stamp-po
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/__pycache__
*.rej
rescue/stamp-virt-rescue.pod
rescue/virt-rescue
rescue/virt-rescue.1
resize/.depend
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/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.syms
src/.libs/libguestfs.so
src/stamp-guestfs.pod
stamp-h1
*.swp
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-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/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/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
tools/test.img
tools/virt-*.1
tools/virt-*.pl
/valgrind.log.*
bindtests.tmp
cscope.out
.deps
.gdb_history
.libs
Makefile
Makefile.in
/.sc-*
/ABOUT-NLS
/aclocal.m4
/align/stamp-virt-alignment-scan.pod
/align/virt-alignment-scan
/align/virt-alignment-scan.1
/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
/bash/virt-builder
/bash/virt-cat
/bash/virt-df
/bash/virt-edit
/bash/virt-filesystems
/bash/virt-format
/bash/virt-inspector
/bash/virt-log
/bash/virt-ls
/bash/virt-sysprep
/bash/virt-sparsify
/build-aux
/builder/.depend
/builder/index-parse.c
/builder/index-parse.h
/builder/index-scan.c
/builder/libguestfs.conf
/builder/*.qcow2
/builder/stamp-virt-builder.pod
/builder/stamp-virt-index-validate.pod
/builder/test-config/virt-builder/repos.d/test-index.conf
/builder/test-website/virt-builder/repos.d/libguestfs.conf
/builder/virt-builder
/builder/virt-builder.1
/builder/virt-index-validate
/builder/virt-index-validate.1
/builder/*.xz
/cat/stamp-virt-*.pod
/cat/virt-cat
/cat/virt-cat.1
/cat/virt-filesystems
/cat/virt-filesystems.1
/cat/virt-log
/cat/virt-log.1
/cat/virt-ls
/cat/virt-ls.1
/ChangeLog
/compile
/config.cache
/config.guess
/config.h
/config.h.in
/config.log
/config.status
/config.sub
/configure
/csharp/Libguestfs.cs
/customize/.depend
/customize/customize_cmdline.ml
/customize/customize_cmdline.mli
/customize/customize-options.pod
/customize/customize-synopsis.pod
/customize/stamp-virt-customize.pod
/customize/virt-customize
/customize/virt-customize.1
/daemon/actions.h
/daemon/errnostring.c
/daemon/errnostring-gperf.c
/daemon/errnostring-gperf.gperf
/daemon/errnostring.h
/daemon/guestfsd
/daemon/guestfsd.8
/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/stamp-guestfsd.pod
/daemon/stubs.c
/depcomp
/df/stamp-virt-df.pod
/df/virt-df
/df/virt-df.1
/diff/stamp-virt-diff.pod
/diff/virt-diff
/diff/virt-diff.1
/edit/stamp-virt-*.pod
/edit/virt-edit
/edit/virt-edit.1
/erlang/bindtests.erl
/erlang/erl-guestfs
/erlang/erl-guestfs.c
/erlang/examples/guestfs-erlang.3
/erlang/examples/stamp-guestfs-erlang.pod
/erlang/guestfs.beam
/erlang/guestfs.erl
/erlang/libguestfs-1.*
/examples/copy-over
/examples/create-disk
/examples/debug-logging
/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/libvirt-auth
/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/guestfish-prepopts.pod
/fish/libguestfs-tools.conf.5
/fish/prepopts.c
/fish/prepopts.h
/fish/rc_protocol.c
/fish/rc_protocol.h
/fish/stamp-guestfish.pod
/fish/stamp-libguestfs-tools.conf.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/guestunmount
/fuse/guestunmount.1
/fuse/stamp-guestmount.pod
/fuse/stamp-guestunmount.pod
/fuse/test-fuse
/fuse/test-guestmount-fd
/fuse/test-guestunmount-fd
/generator/.depend
/generator/files-generated.txt
/generator/generator
/generator/.pod2text.data*
/generator/stamp-generator
/.gitattributes
/.git-module-status
/gnulib
/GNUmakefile
/gobject/bindtests.js
/gobject/Guestfs-1.0.gir
/gobject/Guestfs-1.0.typelib
/golang/bindtests.go
/golang/examples/guestfs-golang.3
/golang/examples/stamp-guestfs-golang.pod
/golang/pkg
/guestfs-release-notes.1
/guestfsd-in-wine.log
/haskell/Bindtests
/haskell/Bindtests.hs
/haskell/Guestfs010Load
/haskell/Guestfs030Config
/haskell/Guestfs050LVCreate
/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-golang.3.html
/html/guestfs-java.3.html
/html/guestfs-lua.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-release-notes.1.html
/html/guestfs-ruby.3.html
/html/guestfs-testing.1.html
/html/guestfsd.8.html
/html/guestmount.1.html
/html/guestunmount.1.html
/html/libguestfs-make-fixed-appliance.1.html
/html/libguestfs-test-tool.1.html
/html/libguestfs-tools.conf.5.html
/html/virt-alignment-scan.1.html
/html/virt-builder.1.html
/html/virt-cat.1.html
/html/virt-copy-in.1.html
/html/virt-copy-out.1.html
/html/virt-customize.1.html
/html/virt-df.1.html
/html/virt-diff.1.html
/html/virt-edit.1.html
/html/virt-filesystems.1.html
/html/virt-format.1.html
/html/virt-index-validate.1.html
/html/virt-inspector.1.html
/html/virt-list-filesystems.1.html
/html/virt-list-partitions.1.html
/html/virt-log.1.html
/html/virt-ls.1.html
/html/virt-make-fs.1.html
/html/virt-p2v.1.html
/html/virt-p2v-make-disk.1.html
/html/virt-p2v-make-kickstart.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-v2v.1.html
/html/virt-win-reg.1.html
/inspector/actual-*.xml
/inspector/stamp-virt-inspector.pod
/inspector/test-xmllint.sh
/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
/lua/bindtests.lua
/lua/examples/guestfs-lua.3
/lua/examples/stamp-guestfs-lua.pod
/lua/guestfs.so
/lua/lua-guestfs.c
/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
/make-fs/stamp-virt-make-fs.pod
/make-fs/virt-make-fs
/make-fs/virt-make-fs.1
/missing
/mllib/.depend
/mllib/common_gettext.ml
/mllib/common_utils_tests
/mllib/config.ml
/mllib/dummy
/mllib/libdir.ml
/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.ml
/ocaml/guestfs.mli
/ocamlinit-stamp
/ocaml/META
/ocaml/stamp-mlguestfs
/ocaml/t/*.bc
/ocaml/t/*.opt
/p2v/launch-virt-p2v
/p2v/stamp-virt-p2v.pod
/p2v/stamp-virt-p2v-make-disk.pod
/p2v/stamp-virt-p2v-make-kickstart.pod
/p2v/virt-p2v
/p2v/virt-p2v.1
/p2v/virt-p2v-make-disk
/p2v/virt-p2v-make-disk.1
/p2v/virt-p2v-make-kickstart
/p2v/virt-p2v-make-kickstart.1
/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/env
/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-for-tests.sh
/php/extension/php_guestfs_php.h
/php/extension/run-tests.php
/php/extension/tmp-php.ini
/pick-guests.pl
/po-docs/*/*.1
/po-docs/*/*.3
/po-docs/*/*.5
/po-docs/*/*.8
/po-docs/po4a.conf
/po-docs/*/*.pod
/podwrapper.1
/podwrapper.pl
/po/*.gmo
/python/bindtests.py
/python/build
/python/config.h
/python/dist
/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/guestfs-internal-all.h
/python/guestfs-internal-frontend-cleanups.h
/python/guestfs-internal-frontend.h
/python/MANIFEST
/python/__pycache__
/python/setup.py
/python/stamp-extra-files
/python/utils.c
/qemu-wrapper.sh
/rescue/stamp-virt-rescue.pod
/rescue/virt-rescue
/rescue/virt-rescue.1
/resize/.depend
/resize/stamp-virt-resize.pod
/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/extconf.rb
/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/link.sh
/sparsify/stamp-virt-sparsify.pod
/sparsify/virt-sparsify
/sparsify/virt-sparsify.1
/src/actions-?.c
/src/actions-variants.c
/src/bindtests.c
/src/errnostring.c
/src/errnostring-gperf.c
/src/errnostring-gperf.gperf
/src/errnostring.h
/src/event-string.c
/src/guestfs.3
/src/guestfs-actions.pod
/src/guestfs-availability.pod
/src/guestfs.h
/src/guestfs-internal-actions.h
/src/guestfs-internal-frontend-cleanups.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/libvirt-is-version
/src/stamp-guestfs.pod
/src/structs-cleanup.c
/src/structs-compare.c
/src/structs-copy.c
/src/structs-free.c
/src/test-utils
/stamp-guestfs-release-notes.pod
/stamp-h1
/sysprep/.depend
/sysprep/stamp-script1.sh
/sysprep/stamp-script2.sh
/sysprep/stamp-script4.sh
/sysprep/stamp-virt-sysprep.pod
/sysprep/sysprep-extra-options.pod
/sysprep/sysprep-operations.pod
/sysprep/virt-sysprep
/sysprep/virt-sysprep.1
/test.err
/test.out
/tests/c-api/test-add-drive-opts
/tests/c-api/test-add-libvirt-dom
/tests/c-api/test-backend-settings
/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-environment
/tests/c-api/test-event-string
/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/test-pwd
/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/blank-disk-*
/tests/data/blank-disk-*
/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/disks/test-qemu-drive-libvirt.xml
/tests/events/test-libvirt-auth-callbacks
/tests/guests/blank-*.img
/tests/guests/debian.img
/tests/guests/fedora.img
/tests/guests/fedora-btrfs.img
/tests/guests/fedora-md1.img
/tests/guests/fedora-md2.img
/tests/guests/guests.xml
/tests/guests/guests-all-good.xml
/tests/guests/guest-aux/fedora-name.db
/tests/guests/guest-aux/fedora-packages.db
/tests/guests/guest-aux/windows-software
/tests/guests/guest-aux/windows-system
/tests/guests/stamp-fedora-md.img
/tests/guests/ubuntu.img
/tests/guests/windows.img
/tests/mount-local/test-parallel-mount-local
/tests/mountable/test-internal-parse-mountable
/tests/parallel/test-parallel
/tests/protocol/test-error-messages
/tests/qemu/qemu-boot
/tests/qemu/qemu-speed-test
/tests/regressions/rhbz501893
/tests/regressions/rhbz790721
/tests/regressions/rhbz914931
/tests/regressions/rhbz1044014.out
/tests/regressions/rhbz1055452
/tests/rsync/rsyncd.pid
/tests/syslinux/extlinux-guest.img
/tests/syslinux/syslinux-guest.img
/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/virt-*.1
/v2v/.depend
/v2v/centos-6.img
/v2v/centos-7.0.img
/v2v/fedora-20.img
/v2v/link.sh
/v2v/rhel-5.10.img
/v2v/rhel-6.5.img
/v2v/rhel-7.0.img
/v2v/stamp-virt-v2v.pod
/v2v/test-v2v-networks-and-bridges.xml
/v2v/virt-v2v
/v2v/virt-v2v.1

Submodule .gnulib updated: b64318247b...4738e5acde

View File

@@ -5,5 +5,5 @@
set sw=2
set ts=2
set tw=80
set tw=70
set expandtab

13
.mailmap Normal file
View File

@@ -0,0 +1,13 @@
Jim Meyering <meyering@redhat.com> <jim@meyering.net>
Jim Meyering <meyering@redhat.com> <meyering@vv.meyering.net.meyering.net>
Richard W.M. Jones <rjones@redhat.com> Richard Jones <rich@hakodate.home.annexia.org>
Richard W.M. Jones <rjones@redhat.com> Richard Jones <rich@koneko.home.annexia.org>
Richard W.M. Jones <rjones@redhat.com> Richard Jones <rich@koneko.local>
Richard W.M. Jones <rjones@redhat.com> Richard Jones <rjones@centos5x32.home.annexia.org>
Richard W.M. Jones <rjones@redhat.com> Richard Jones <rjones@debian5x64.home.annexia.org>
Richard W.M. Jones <rjones@redhat.com> Richard Jones <rjones@redhat.com>
Richard W.M. Jones <rjones@redhat.com> Richard Jones <rjones@trick.home.annexia.org>
Richard W.M. Jones <rjones@redhat.com> Richard Jones <rjones@ubuntu910x64.home.annexia.org>
Richard W.M. Jones <rjones@redhat.com> <rich@annexia.org>
Richard W.M. Jones <rjones@redhat.com> rjones <rjones>
Wanlong Gao <gaowanlong@cn.fujitsu.com> <wanlong.gao@gmail.com>

View File

@@ -1,5 +1,5 @@
[main]
host = https://www.transifex.net
host = https://www.transifex.com
[libguestfs.libguestfspot]
file_filter = po/<lang>.po
@@ -10,4 +10,3 @@ source_lang = en
file_filter = po-docs/<lang>.po
source_file = po-docs/libguestfs-docs.pot
source_lang = en

View File

@@ -1,4 +1,3 @@
^appliance/debian/modules/
^tests/data/
^COPYING(.LIB)?$
^\.gitmodules$

80
AUTHORS
View File

@@ -1,25 +1,55 @@
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>
Matthew Booth <mbooth@redhat.com>
Maxim Koltsov <kolmax94@gmail.com>
Michael Scherer <misc@zarb.org>
Nikita A Menkovich <menkovich@gmail.com>
Piotr Drąg <piotrdrag@gmail.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>
Adam Huffman
Angus Salkeld
Ani Peter
Bastien ROUCARIÈS
Charles Duffy
Cole Robinson
Colin Walters
Dan Lipsitt
Daniel Berrange
Daniel Cabrera
Daniel Exner
Dave Vasilevsky
Douglas Schilling Landgraf
Eric Blake
Erik Nolte
Evaggelos Balaskas
Geert Warrink
Guido Günther
Hilko Bengen
Hu Tao
infernix
Jaswinder Singh
Jim Meyering
Jiri Popelka
John Eckersberg
Joseph Wang
Karel Klíč
Lee Yarwood
Marcin Gibula
Maros Zatko
Martin Kletzander
Masami HIRATA
Matthew Booth
Maxim Koltsov
Michael Scherer
Mike Kelly
Nicholas Strugnell
Nikita A Menkovich
Nikita Menkovich
Nikos Skalkotos
Olaf Hering
Or Goshen
Paul Mackerras
Pino Toscano
Piotr Drąg
Qin Guan
Rajesh Ranjan
Richard W.M. Jones
Sandeep Shedmake
Shahar Havivi
Shankar Prasad
Thomas S Hatch
Török Edwin
Wanlong Gao
Wulf C. Krueger

700
BUGS
View File

@@ -1,5 +1,5 @@
NOTE: This file is automatically generated from "update-bugs.sh".
Last updated: 2012-02-15
Last updated: 2014-09-22
This contains a local list of the bugs that are open against
libguestfs. Bugs are tracked in the Red Hat Bugzilla database
@@ -20,231 +20,599 @@ When reporting a new bug, please check:
--------------------------------------------------
Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
676020 NEW https://bugzilla.redhat.com/show_bug.cgi?id=676020
After using virt-resize with an ntfs partition windows is not booting
684486 NEW https://bugzilla.redhat.com/show_bug.cgi?id=684486
Guest fails to boot after virt-resize
691659 NEW https://bugzilla.redhat.com/show_bug.cgi?id=691659
libguestfs fails to run under JRuby 1.6.0
693064 NEW https://bugzilla.redhat.com/show_bug.cgi?id=693064
Symbolic links on ntfs-3g are not followed correctly by some commands
701814 NEW https://bugzilla.redhat.com/show_bug.cgi?id=701814
virt-win-reg fails on a libvirt guest that has no defined disk format: "format parameter is empty or contains disallowed characters"
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
745576 NEW https://bugzilla.redhat.com/show_bug.cgi?id=745576
libguestfs (or qemu?) hangs if sparse file runs out of disk space
745606 NEW https://bugzilla.redhat.com/show_bug.cgi?id=745606
libguestfs: error: part_list: could not parse row from output of parted print command
761565 NEW https://bugzilla.redhat.com/show_bug.cgi?id=761565
Missing deps on netpbm-progs and icoutils
767852 NEW https://bugzilla.redhat.com/show_bug.cgi?id=767852
dependency on fuse suggested
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
786187 NEW https://bugzilla.redhat.com/show_bug.cgi?id=786187
list-filesystems error mentions "list-devices"
786188 NEW https://bugzilla.redhat.com/show_bug.cgi?id=786188
libguestfs inspection does not recognize FreeDOS install CD
786215 NEW https://bugzilla.redhat.com/show_bug.cgi?id=786215
libguestfs inspection does not recognize FreeDOS operating system
786604 NEW https://bugzilla.redhat.com/show_bug.cgi?id=786604
guestfish on CentOS 5.7 x86 and augeas-libs-0.10.0-2.el5 crashes with message "guestfsd: error while loading shared libraries: libxml2.so.2: cannot open shared object file"
789504 NEW https://bugzilla.redhat.com/show_bug.cgi?id=789504
virt-df (other tools?) should not give up if a guest disk is missing
790837 NEW https://bugzilla.redhat.com/show_bug.cgi?id=790837
Use of atexit to clean up handles is wrong in multithreaded programs
790958 NEW https://bugzilla.redhat.com/show_bug.cgi?id=790958
multiprovider build error: RuntimeError: link: /tmp/.guestfs-0/kernel /tmp/.guestfs-0/kernel.10139: File exists
563450 NEW https://bugzilla.redhat.com/show_bug.cgi?id=563450
list-devices returns devices of different types out of order
696445 NEW https://bugzilla.redhat.com/show_bug.cgi?id=696445
Backport virt-inspector for virt-v2v
547488 NEW https://bugzilla.redhat.com/show_bug.cgi?id=547488
guestfish cannot tab complete filenames that contain spaces
672485 NEW https://bugzilla.redhat.com/show_bug.cgi?id=672485
[RFE] virt-edit/tar/inspector do not support encrypted system
745282 NEW https://bugzilla.redhat.com/show_bug.cgi?id=745282
[RFE] Support to use virt-filesystems with remote libvirt systems
507278 NEW https://bugzilla.redhat.com/show_bug.cgi?id=507278
libguestfs fails to build on Fedora sparc64
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
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
592910 NEW https://bugzilla.redhat.com/show_bug.cgi?id=592910
'guestfish --remote run' hangs in a shell command substitution context
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
635971 NEW https://bugzilla.redhat.com/show_bug.cgi?id=635971
glob mkfs ext2 /dev/vd[b-t]1 does not expand
637251 NEW https://bugzilla.redhat.com/show_bug.cgi?id=637251
virt-inspector fails to recognize data-only NTFS disk image
646036 NEW https://bugzilla.redhat.com/show_bug.cgi?id=646036
libguestfs fails to launch
693064 NEW https://bugzilla.redhat.com/show_bug.cgi?id=693064
Symbolic links on ntfs-3g are not followed correctly by some commands
660687 NEW https://bugzilla.redhat.com/show_bug.cgi?id=660687
guestmount: "touch" command fails: touch: setting times of `timestamp': Invalid argument
709326 NEW https://bugzilla.redhat.com/show_bug.cgi?id=709326
virt-inspector cannot detect ReactOS
696451 NEW https://bugzilla.redhat.com/show_bug.cgi?id=696451
libguestfs: unknown filesystem label SWAP-sda2
737261 NEW https://bugzilla.redhat.com/show_bug.cgi?id=737261
libguestfs grub-install API needs grub1
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
745576 NEW https://bugzilla.redhat.com/show_bug.cgi?id=745576
libguestfs (or qemu?) hangs if sparse file runs out of disk space
700342 NEW https://bugzilla.redhat.com/show_bug.cgi?id=700342
virt-inspector resports unknown filesystem UUID
770075 NEW https://bugzilla.redhat.com/show_bug.cgi?id=770075
FEBOOTSTRAP_MODULES fails if modules directory is not under /lib
713678 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=713678
Not all febootstrap messages are redirected to log callbacks
770076 NEW https://bugzilla.redhat.com/show_bug.cgi?id=770076
FEBOOTSTRAP_KERNEL causes appliance build to fail
721160 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=721160
Missing btrfs support
785603 NEW https://bugzilla.redhat.com/show_bug.cgi?id=785603
copy-out "No such file or directory"
583974 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=583974
mount hangs there when you lack proper permission to guest image
790837 NEW https://bugzilla.redhat.com/show_bug.cgi?id=790837
Use of atexit to clean up handles is wrong in multithreaded programs
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
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
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.'
822538 NEW https://bugzilla.redhat.com/show_bug.cgi?id=822538
libguestfs tools hang on qcow2 encrypted disks
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
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
835622 NEW https://bugzilla.redhat.com/show_bug.cgi?id=835622
RFE: virt-sparsify should be able to sparsify onto a thin-provisioned LV
845234 NEW https://bugzilla.redhat.com/show_bug.cgi?id=845234
RFE: virt-ls on Windows guest doesn't support drive letters
848464 NEW https://bugzilla.redhat.com/show_bug.cgi?id=848464
gobject javascript bindings cannot use 64 bit integers
848926 NEW https://bugzilla.redhat.com/show_bug.cgi?id=848926
virt-v2v should verify that the RHEV-M domain is an export storage domain
857763 NEW https://bugzilla.redhat.com/show_bug.cgi?id=857763
libguestfs 'file-architecture' returns 'ARM' for arm binaries
866994 NEW https://bugzilla.redhat.com/show_bug.cgi?id=866994
tgz-out causes memory leak in guestfsd
887826 NEW https://bugzilla.redhat.com/show_bug.cgi?id=887826
RFE: virt-sparsify cannot handle multi-disk virtual machines (eg. if they use LVM, MD, LDM, etc)
891909 NEW https://bugzilla.redhat.com/show_bug.cgi?id=891909
Can't make install with non-standard prefix as non-root
895898 NEW https://bugzilla.redhat.com/show_bug.cgi?id=895898
RFE: Allow interface to be specified with libvirt attach-method
895946 NEW https://bugzilla.redhat.com/show_bug.cgi?id=895946
Got incorrect block count number when resize ntfs file system via "ntfsresize_opts"
903987 NEW https://bugzilla.redhat.com/show_bug.cgi?id=903987
Command "acl-set-file" is inconvenient to use
906766 NEW https://bugzilla.redhat.com/show_bug.cgi?id=906766
virt-resize cannot resize RHEL 5 guest with GPT partition table type
906777 NEW https://bugzilla.redhat.com/show_bug.cgi?id=906777
In tests, set_label sometimes fails
910115 NEW https://bugzilla.redhat.com/show_bug.cgi?id=910115
RFE: support ntfsresize --bad-sectors option in virt-resize
910117 NEW https://bugzilla.redhat.com/show_bug.cgi?id=910117
virt-v2v removes serial console from securetty list
910269 NEW https://bugzilla.redhat.com/show_bug.cgi?id=910269
Tracker: Bugs in other packages that stop libguestfs working
913815 NEW https://bugzilla.redhat.com/show_bug.cgi?id=913815
febootstrap: no ext2 root device found when running libguestfs-test-tools
917706 NEW https://bugzilla.redhat.com/show_bug.cgi?id=917706
guestfs_umount_local is not thread safe
920617 NEW https://bugzilla.redhat.com/show_bug.cgi?id=920617
RFE: virt-inspector (or another tool) should produce OVF output for oVirt / RHEV
921604 NEW https://bugzilla.redhat.com/show_bug.cgi?id=921604
RFE: virt-v2v: add option to specify spice or VNC and whether to add USB connections
927447 NEW https://bugzilla.redhat.com/show_bug.cgi?id=927447
[suse] virt tools hang on disk image, but libguestfs-test-tool runs OK
963232 NEW https://bugzilla.redhat.com/show_bug.cgi?id=963232
RFE: v2v: a --no-cleanup would be useful for debugging of disk images that guestfs has issues converting
973138 NEW https://bugzilla.redhat.com/show_bug.cgi?id=973138
RFE: sh & debug sh should be able to capture all output and error return code
979392 NEW https://bugzilla.redhat.com/show_bug.cgi?id=979392
[abrt] virt-manager crash from libguestfs launch_libvirt
980790 NEW https://bugzilla.redhat.com/show_bug.cgi?id=980790
fstrim returns error "FITRIM ioctl failed: Inappropriate ioctl for device"
982516 NEW https://bugzilla.redhat.com/show_bug.cgi?id=982516
sh "rpm -Va" fails because apparently /dev/shm is not created/bind-mounted correctly
983969 NEW https://bugzilla.redhat.com/show_bug.cgi?id=983969
RFE: virt-sysprep should be SELinux-aware
986242 NEW https://bugzilla.redhat.com/show_bug.cgi?id=986242
golang bindings cannot be compiled if golang-guestfs package is installed
987829 NEW https://bugzilla.redhat.com/show_bug.cgi?id=987829
virt-resize error: "lvm_set_filter: vgchange: Couldn't find device with uuid .. Refusing activation of partial LV"
988100 NEW https://bugzilla.redhat.com/show_bug.cgi?id=988100
RFE: journal reader in guestfish
991641 NEW https://bugzilla.redhat.com/show_bug.cgi?id=991641
virt-sysprep fs-uuids plugin doesn't update UUIDs in fstab, elsewhere
991830 NEW https://bugzilla.redhat.com/show_bug.cgi?id=991830
virt-resize throws ambiguous error when /dev/mapper/VG-LV path is used
994965 NEW https://bugzilla.redhat.com/show_bug.cgi?id=994965
libguestfs doesn't work on armv7hl
1019388 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1019388
firstboot scripts (virt-builder, virt-sysprep) don't work for Debian 6 & 7 guests
1023630 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1023630
enable-valgrind-daemon option breaks UML
1025942 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1025942
Parallel virt-df and virt-alignment-scan tests sometimes deadlock
1027526 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1027526
RFE: Labels for logical partitions lost in Windows 2003 after virt-resize for primary partition
1028676 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1028676
Add virt-builder to RHEL 7.1
1029134 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1029134
Broken links in virt-builder web man page
1033573 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1033573
libguestfs inspection does not recognize NAS4Free OS installed on QCOW2 image
1040912 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1040912
[ARM] mount-local / FUSE support does not seem to work at all
1041552 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1041552
virt-sysprep should remove Pegasus certificates
1042780 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1042780
Support the virt-sysprep --delete option
1051694 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1051694
libguestfs FTBFS on Ubuntu saucy
1056045 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1056045
virt-v2v OVA import fails when no (optional) manifest file is included
1056047 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1056047
virt-df generates no output for Solaris 11 x86_64 guest.
1056126 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1056126
virt-v2v OVA/OVF import fails with 'MegaBytes' as memory allocation units
1056534 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1056534
virt-v2v OVF/OVA import fails when disks aren't attached to either IDE or SCSI controllers
1056640 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1056640
virt-v2v OVA/OVF import fails when no (optional) ovf:capacityAllocationUnits is specified
1056983 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1056983
virt-v2v OVA/OVF import fails when no (optional) ovf:populatedSize is specified
1057006 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1057006
virt-v2v OVA/OVF import fails when no (optional) Name under VirtualSystem is specified
1057873 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1057873
libguestfs df/ subdirectory tests fail occasionally
1059428 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1059428
Failed dependencies installing libguestfs with glibc ppc64p7
1060423 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1060423
Support setting xattrs via FUSE
1061040 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1061040
RFE: Enable ZFS support
1064041 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1064041
virt-sparsify fails if a btrfs filesystem contains readonly snapshots
1074005 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1074005
java bindings inspect_list_applications2 throws java.lang.ArrayIndexOutOfBoundsException:
1075164 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1075164
RFE: allow passing in a pre-opened libvirt connection from python
1075594 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1075594
RFE: python-libguestfs should be available on pypi
1076213 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1076213
OpenStack as a v2v target.
1076478 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1076478
FTBFS: libguestfs-1.22.6-15.el7
1079625 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1079625
virt-sparsify fails if a btrfs filesystem contains readonly snapshots
1079734 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1079734
Tiny Core Linux is not recognized by libguestfs inspection
1084221 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1084221
virt-builder --update causes vm not to allow logins
1089100 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1089100
NetworkManager avc unlink denied for resolv.conf after using --selinux-relabel
1091859 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1091859
scrub-file can't handle link file
1092583 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1092583
guestfish removes query string from URI
1097272 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1097272
Ruby bindings should use RB_GC_GUARD (instead of volatile) for enhanced safety
1099284 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1099284
typo errors in man pages
1099292 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1099292
sfdisk failed by "Device or resource busy" when using one command line
1099475 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1099475
sfdisk: BLKRRPART: Device or resource busy
1099976 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1099976
virt-builder gives GPG warning message
1100138 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1100138
some operation cause "lvremove" can not find the object
1100140 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1100140
some operation cause "lvremove" can not find the object
1100528 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1100528
These APIs also need to add to `guestfish -h` command list
1100530 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1100530
These APIs also need to add to `guestfish -h` command list
1100533 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1100533
Remove 'user-cancel' from guestfish(1)
1102241 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1102241
[RFE] libguestfs should detect OSTree (project-atomic) qcow2 disk image
1102619 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1102619
lvm-clear-filter failed when has two same name but different uuid's VG
1102620 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1102620
lvm-clear-filter failed when has two same name but different uuid's VG
1103444 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1103444
virt-v2v of RHEL AS release 3(Taroon) VMware VM fails because rpm binary segfaults
1107317 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1107317
Ubuntu package fails to depend on linux-image-extra (causes missing virtio-serial)
1108171 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1108171
RFE: virt-builder should be able to build PXE images for baremetal installation
1109144 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1109144
virt-builder --get-kernel doesn't fetch the dtb from images
1111794 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1111794
virt-sparsify leaves lots of data in TMPDIR
1113020 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1113020
Support virt-sparsify option to allow specifying temporary file or block device
1113153 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1113153
RFE: Inspection should support systemd mount units
1114012 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1114012
"yum install guestfish" on fresh Fedora 20 results in broken libguestfs
1118305 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1118305
RFE: Ability to set iSCSI-Initiator-IQN for iSCSI connections
1123221 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1123221
make xfs faield, "mkfs.xfs: No such file or directory"
1123797 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1123797
libguestfs 'direct' backend should close file descriptors before exec-ing qemu to avoid leaking !O_CLOEXEC fds
1128942 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1128942
libguests tools failing on images containing a colon in the path
1129110 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1129110
Libguestfs NTFS not setting ACLs
1130506 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1130506
RFE: virt-sparsify in copying mode should support qemu detect-zeroes
1132652 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1132652
virt-sysprep firstboot doesn't work with RHEL 7 guest
1134726 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1134726
[RFE] virt-builder should support args with the --run command
1135064 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1135064
virt-sparsify fails at /sys/block/sdb/dev discovery
1135585 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1135585
[RFE] virt-builder should support copying in a directory/list of files
1136371 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1136371
add apt-rpm support to supermin
1138630 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1138630
Remove user accounts from "/etc/shadow" when exeucte virt-sysprep with '--enable user-account' option
1138634 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1138634
Remove user accounts from "/etc/shadow" when exeucte virt-sysprep with '--enable user-account' option
1139785 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1139785
virt-sysprep should change UUID fields in /etc/sysconfig/network-scripts/ifcfg-* files
1141451 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1141451
Failures in tests: /dev/sda1: No such file or directory
1141626 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1141626
virt-sysprep option '--password' don't work well, it will cause login problem and if execute with other options it will take no effect
1142184 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1142184
virt-sparsify --help print description of a option which is hard to get common understanding
1144137 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1144137
virt-inspector fails on Minix 3 guest
1144138 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1144138
virt-inspector fails on FreeBSD 9.3 guest
1144266 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1144266
virt-copy-in, virt-copy-out, virt-tar-in, virt-tar-out have the same help message with 'guestfish -V'
1144267 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1144267
virt-copy-in, virt-copy-out, virt-tar-in, virt-tar-out have the same help message with 'guestfish -V'
1144927 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1144927
Syntax error in lens definition: /usr/share/guestfs/guestfs_lvm_conf.aug:28.25-.40:Could not load module Quote for Quote.do_dquotee
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
547488 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=547488
guestfish cannot tab complete filenames that contain spaces
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
SELinux labels don't work over guestmount (FUSE)
1069966 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1069966
RFE: let virt-builder etc build ARM guests on x86 host
1141145 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1141145
virt-v2v fails to convert xen pv guests.
1142008 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1142008
Conversion guest cannot been seen on rhevm server
(142 bugs)
--------------------------------------------------
Bugs in MODIFIED, POST or ON_QA state are fixed.
You can help by testing the fixes.
691389 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=691389
Extended attributes don't work over guestmount (FUSE)
1028650 POST https://bugzilla.redhat.com/show_bug.cgi?id=1028650
virt-* argument parser doesn't accept --arg=value (you have to use --arg value)
750889 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=750889
Python code incompatible with Python v3.
1073917 POST https://bugzilla.redhat.com/show_bug.cgi?id=1073917
java bindings inspect_list_applications2 throws java.lang.ArrayIndexOutOfBoundsException:
769359 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=769359
virt-resize on RHEL 6 kernel fails to re-read the partition table
1091803 POST https://bugzilla.redhat.com/show_bug.cgi?id=1091803
tar-in-opts execute failed that cause libguestfs appliance crashed
784647 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=784647
Libguestfs uses deprecated net-tools
1122557 POST https://bugzilla.redhat.com/show_bug.cgi?id=1122557
virt-sparsify overwrites block devices if used as output files
788642 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=788642
virt-edit doesn't preserve file permissions
1144766 POST https://bugzilla.redhat.com/show_bug.cgi?id=1144766
futimens() is a no-op via guestmount
657499 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=657499
checksum: wrong check sum type causes umount to fail
1144891 POST https://bugzilla.redhat.com/show_bug.cgi?id=1144891
RFE: stat calls do not return nanosecond timestamps
719879 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=719879
Rebase libguestfs in RHEL 6.3
1053847 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1053847
Recommended default clock/timer settings
729076 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=729076
libguestfs confuses Hp_recovery partition with Windows root filesystem
1143887 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1143887
Warning shows when converting guests to rhev:chown: changing ownership of ?/tmp/v2v.u48xag/*.ovf?: Invalid argument
749828 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=749828
p2v does not support raid devices
805417 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=805417
RFE: support inspection of installation ISOs of WinVista, Win7, Win2008 & Win2008r2
760221 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=760221
RFE: Support inspection of cciss devices
1020950 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1020950
CVE-2013-4419 libguestfs: insecure temporary directory handling for guestfish's network socket [epel-5]
647174 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=647174
RHEL6: virt-clone should remove old udev rules when changing MAC address
1021149 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1021149
Rebase libguestfs to 1.28 in RHEL 7.1
741183 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=741183
[RFE] Write a tool to align the partition(s) in a Windows XP image to a multiple of 8 sectors
1091856 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1091856
scrub-file can't handle link file
1140547 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1140547
virt-builder option '--format' don't work well
1140894 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1140894
No error messages output if append '--format qcow2' after '-a guest.img', guest.img is a raw format image file
1141157 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1141157
virt-sysprep option '--user-accounts' don't work well
1142158 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1142158
Illegal command 'part-get-name /dev/sda1 1' cause libguestfs appliance crashed
1142178 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1142178
virt-customize: No error messages output if append '--format qcow2' after '-a guest.img', guest.img is a raw format image file
1142186 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1142186
virt-sysprep option '--mount-options' don't work well
1142416 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1142416
part-get-name give 'libguestfs: error: part_get_name: parted does not support the machine output (-m)' error message when run 'part-get-name /dev/sda 1'
1143949 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1143949
virt-customize option '--password-crypto' do not work
1144197 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1144197
Disable libguestfs UML backend mode in RHEL7
1144201 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1144201
guestfish can not restore terminal's output colour when exit guestfish, if the terminal's background colour is black then it will make a inconvenient
(22 bugs)
--------------------------------------------------
These bugs are in the VERIFIED state.
731742 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=731742
libguestfs should escape special/non-printing characters in debug output
624335 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=624335
blockdev-setbsz succeeds, but does not affect blockdev-getbsz
785305 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=785305
ocaml (bytecode) bindings segfault in 'add_drive_opts'
965495 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=965495
New APIs required in libguestfs for virt-v2v in RHEL 6.5
789960 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=789960
guestfsd crash when try to mount non-exist disk
982979 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=982979
Disable fstrim API/command in RHEL 6
679737 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=679737
libguestfs: improve error message when zerofree is not available in the appliance
1025269 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1025269
libguestfs tests hang in libguestfs-1.20.11/tests/guests/guest-aux/make-fedora-img.pl
785668 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=785668
aug-defnode: daemon crash
1056558 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1056558
virt-sparsify overwrites block devices if used as output files
--------------------------------------------------
Bugs in MODIFIED, POST or ON_QA state are fixed.
You can help by testing the fixes.
1057510 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1057510
mount-local should give a clearer error if root is not mounted
790721 POST https://bugzilla.redhat.com/show_bug.cgi?id=790721
multiprovider build error: RuntimeError: link: /tmp/.guestfs-0/kernel /tmp/.guestfs-0/kernel.10139: File exists
1072062 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1072062
Ruby bindings for libguestfs throws an error periodically
1079182 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1079182
virt-df cannot report used disk space of windows guest when updated to 6.5
1091805 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1091805
tar-in-opts execute failed that cause libguestfs appliance crashed
1097359 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1097359
virt-sparsify hangs with 'No space left on device' while filling LV
1099105 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1099105
libguestfs Requires: /lib64/libldif-2.4.so.2 missing from openldap-2.4.39-6.el6.x86_64
1099332 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1099332
typo errors in man pages
1106548 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1106548
root gets an error accessing to a non-root dir on a snapshot guestmount VMDK img
1117540 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1117540
Support virt-sparsify option to allow specifying temporary file or block device
1136739 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1136739
virt-v2v warning info should be printed to fill the whole line
1138182 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1138182
xen guest will be kernel panic after converted by virt-v2v
1138184 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1138184
virt-v2v will fail when converting guests with initramfs-*kdump.img under /boot
1138504 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1138504
Support conversion of guests from remote kvm/xen/esx connections by virt-v2v
1138586 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1138586
No error shows when converting running guest with virt-v2v
1139543 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1139543
Improve the error info when converting guest with no space left
1139973 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1139973
Improve the error info when converting xen guest with no passwordless SSH access configured
1140050 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1140050
No error shows when multiple conflicting options used with virt-v2v
1141113 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1141113
virt-v2v fails to convert esx guests
1141631 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1141631
[RFE] virt-v2 should support convert a guest to a dir-pool with using pool's uuid
1141654 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1141654
virt-v2v: error: access: No such file or directory shows when converting xen/esx guests
1141680 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1141680
[RFE] virt-v2 should support convert a domain with using domain's UUID instead of domain name
1141723 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1141723
virt-v2v: error: disk sda has no defined format shows when converting xen hvm guest
1142004 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1142004
virt-v2v prints waring:WARNING:/files/boot/grub/device.map references unknown device "xvda"
1143866 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1143866
virt-v2v fails with error: cannot open Packages index using db5
1143883 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1143883
warning shows when converting rhel7 guest:virt-v2v:could not update grub2 console: aug_get: no matching node (ignored)
(30 bugs)
End of BUGS file.

14
COPYING
View File

@@ -1,12 +1,12 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
@@ -56,7 +56,7 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
@@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it

View File

@@ -1,112 +1,125 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the library, or if you modify it.
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LIBRARY GENERAL PUBLIC LICENSE
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License"). Each licensee is
addressed as "you".
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
@@ -255,7 +268,7 @@ distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also compile or
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
@@ -282,23 +295,31 @@ of these things:
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Accompany the work with a written offer, valid for at
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
d) Verify that the user has already received a copy of these
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
@@ -347,7 +368,7 @@ Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
@@ -390,7 +411,7 @@ excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
@@ -411,7 +432,7 @@ decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
@@ -434,9 +455,9 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Libraries
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
@@ -453,19 +474,18 @@ convey the exclusion of warranty; and each file should have at least the
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
version 2.1 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
Lesser General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.

View File

@@ -1,5 +1,5 @@
# libguestfs
# Copyright (C) 2009-2012 Red Hat Inc.
# Copyright (C) 2009-2014 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
@@ -15,12 +15,15 @@
# 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
include $(top_srcdir)/common-rules.mk
ACLOCAL_AMFLAGS = -I m4
# Gnulib - must be built and tested before the library.
SUBDIRS = gnulib/lib gnulib/tests
SUBDIRS = gnulib/lib
if ENABLE_GNULIB_TESTS
SUBDIRS += gnulib/tests
endif
# Basic source for the library.
SUBDIRS += tests/data generator src examples po
@@ -37,16 +40,39 @@ if ENABLE_APPLIANCE
SUBDIRS += tests/qemu
SUBDIRS += tests/guests
SUBDIRS += tests/c-api
SUBDIRS += tests/tmpdirs
SUBDIRS += tests/protocol
SUBDIRS += tests/events
SUBDIRS += tests/parallel
SUBDIRS += tests/create
SUBDIRS += tests/disks
SUBDIRS += tests/discard
SUBDIRS += tests/mountable
SUBDIRS += tests/network
SUBDIRS += tests/lvm
SUBDIRS += tests/luks
SUBDIRS += tests/md
SUBDIRS += tests/selinux
SUBDIRS += tests/ntfsclone
SUBDIRS += tests/btrfs
SUBDIRS += tests/xfs
SUBDIRS += tests/charsets
SUBDIRS += tests/xml
SUBDIRS += tests/mount-local
SUBDIRS += tests/9p
SUBDIRS += tests/rsync
SUBDIRS += tests/bigdirs
SUBDIRS += tests/disk-labels
SUBDIRS += tests/hotplug
SUBDIRS += tests/nbd
SUBDIRS += tests/http
SUBDIRS += tests/syslinux
SUBDIRS += tests/journal
SUBDIRS += tests/fuzz
SUBDIRS += tests/relative-paths
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
@@ -54,7 +80,13 @@ SUBDIRS += test-tool
SUBDIRS += fish
# virt-tools in C.
SUBDIRS += align cat df edit format inspector rescue
SUBDIRS += align cat diff df edit format inspector make-fs rescue
if HAVE_P2V
SUBDIRS += p2v
endif
# bash-completion
SUBDIRS += bash
# Language bindings.
if HAVE_PERL
@@ -81,16 +113,30 @@ endif
if HAVE_ERLANG
SUBDIRS += erlang erlang/examples
endif
if HAVE_LUA
SUBDIRS += lua lua/examples
endif
if HAVE_GOBJECT
SUBDIRS += gobject
endif
if HAVE_GOLANG
SUBDIRS += golang golang/examples
endif
# Unconditional because nothing is built yet.
SUBDIRS += csharp
# virt-resize (new version) and virt-sparsify are written in OCaml.
# OCaml tools. Note 'mllib' and 'customize' contain shared code used
# by other OCaml tools, so these must come first.
if HAVE_OCAML
SUBDIRS += resize sparsify
SUBDIRS += \
mllib \
customize \
builder builder/website \
resize \
sparsify \
sysprep \
v2v
endif
# Perl tools.
@@ -103,29 +149,34 @@ if HAVE_FUSE
SUBDIRS += fuse
endif
# virt-tools in shell. This uses guestmount and virt-inspector.
if HAVE_FUSE
SUBDIRS += clone
endif
# po-docs must come after tools, inspector.
if HAVE_PO4A
SUBDIRS += po-docs
endif
EXTRA_DIST = \
$(generator_built) \
BUGS HACKING RELEASE-NOTES ROADMAP TODO \
BUGS HACKING TODO \
.gitignore \
.lvimrc \
.mailmap \
.tx/config \
bootstrap \
bugs-in-changelog.sh \
autogen.sh \
bindtests \
cfg.mk \
contrib/autobuild/autobuild.sh \
contrib/guestfsd-in-wine.sh \
contrib/intro/libguestfs-intro.html \
contrib/intro/overview.png \
contrib/intro/overview.svg \
contrib/intro/talk.txt \
contrib/intro/tools.png \
contrib/intro/tools.svg \
contrib/intro/virt-manager-t.png \
contrib/intro/virt-manager.png \
contrib/intro/vmm-icons-t.png \
contrib/intro/vmm-icons.png \
contrib/intro/win7.xml \
contrib/make-check-on-installed.pl \
contrib/README \
contrib/visualize-alignment/.gitignore \
@@ -138,65 +189,60 @@ EXTRA_DIST = \
contrib/visualize-alignment/qemu-0.13-trace-block-device-access.patch \
contrib/visualize-alignment/README \
contrib/visualize-alignment/tracetops.ml \
debian/.gitignore \
debian/changelog \
debian/compat \
debian/control \
debian/copyright \
debian/docs \
debian/guestfish.dirs \
debian/guestfish.install \
debian/guestfsd.dirs \
debian/guestfsd.install \
debian/guestmount.dirs \
debian/guestmount.install \
debian/libguestfs-dev.dirs \
debian/libguestfs-dev.install \
debian/libguestfs-doc.docs \
debian/libguestfs-perl.examples \
debian/libguestfs-perl.install \
debian/libguestfs-tools.dirs \
debian/libguestfs-tools.install \
debian/libguestfs0.dirs \
debian/libguestfs0.install \
debian/patches/series \
debian/python-guestfs.install \
debian/pyversions \
debian/rules \
debian/shlibs.local \
debian/watch \
contrib/windows-icons.pl \
guestfs-release-notes.pod \
guestfs-release-notes.txt \
html/draft.png \
html/draft.svg \
html/pod.css \
libguestfs.pc libguestfs.pc.in \
html/virt-builder.svg \
libtool-kill-dependency_libs.sh \
logo/fish.svg logo/fish.png \
logo/fish-5yrs.svg logo/fish-5yrs.png \
logo/virt-builder.svg \
m4/.gitignore \
update-bugs.sh
tests/run-xml-to-junit.sh \
tests/run-xml-to-junit.xsl \
tmp/.gitignore \
tx-pull.sh \
update-bugs.sh \
valgrind-suppressions \
.x-sc_avoid_ctype_macros \
.x-sc_prohibit_have_config_h \
.x-sc_prohibit_magic_number_exit \
.x-sc_prohibit_strcmp \
.x-sc_prohibit_strcmp_and_strncmp \
.x-sc_TAB_in_indentation \
.x-sc_trailing_blank
# The website.
HTMLFILES = \
html/guestfs.3.html \
html/guestfs-examples.3.html \
html/guestfs-erlang.3.html \
html/guestfs-java.3.html \
html/guestfs-ocaml.3.html \
html/guestfs-perl.3.html \
html/guestfs-python.3.html \
html/guestfs-faq.1.html \
html/guestfs-performance.1.html \
html/guestfs-recipes.1.html \
html/guestfs-ruby.3.html \
html/guestfs-release-notes.1.html \
html/guestfs-testing.1.html \
html/guestfsd.8.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-builder.1.html \
html/virt-cat.1.html \
html/virt-copy-in.1.html \
html/virt-copy-out.1.html \
html/virt-customize.1.html \
html/virt-df.1.html \
html/virt-diff.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-log.1.html \
html/virt-ls.1.html \
html/virt-make-fs.1.html \
html/virt-rescue.1.html \
@@ -206,19 +252,67 @@ HTMLFILES = \
html/virt-tar.1.html \
html/virt-tar-in.1.html \
html/virt-tar-out.1.html \
html/virt-v2v.1.html \
html/virt-win-reg.1.html
TEXTFILES = BUGS README RELEASE-NOTES ROADMAP TODO
if HAVE_ERLANG
HTMLFILES += html/guestfs-erlang.3.html
endif
if HAVE_GOLANG
HTMLFILES += html/guestfs-golang.3.html
endif
if HAVE_JAVA
HTMLFILES += html/guestfs-java.3.html
endif
if HAVE_LUA
HTMLFILES += html/guestfs-lua.3.html
endif
if HAVE_OCAML
HTMLFILES += html/guestfs-ocaml.3.html
endif
if HAVE_PERL
HTMLFILES += html/guestfs-perl.3.html
endif
if HAVE_PYTHON
HTMLFILES += html/guestfs-python.3.html
endif
if HAVE_RUBY
HTMLFILES += html/guestfs-ruby.3.html
endif
if HAVE_FUSE
HTMLFILES += \
html/guestmount.1.html \
html/guestunmount.1.html
endif
if HAVE_P2V
HTMLFILES += \
html/virt-p2v.1.html \
html/virt-p2v-make-disk.1.html \
html/virt-p2v-make-kickstart.1.html
endif
WEBSITEDIR = $(HOME)/d/redhat/websites/libguestfs
HTMLSUPPORTFILES = \
html/draft.png \
html/pod.css \
html/virt-builder.svg
TEXTFILES = BUGS README TODO
BUILDERFILES = \
builder/website/README \
builder/website/index \
builder/website/index.asc
WEBSITEDIR = $(HOME)/d/websites/libguestfs
# For reasons not fully understood, we need to rebuild all the
# man pages and HTMLFILES from scratch here.
website: $(HTMLFILES) $(TEXTFILES)
website: $(HTMLFILES) $(HTMLSUPPORTFILES) $(TEXTFILES) $(BUILDERFILES)
find -name 'stamp-*.pod' -delete
$(MAKE)
cp $(HTMLFILES) $(WEBSITEDIR)
cp $(HTMLFILES) $(HTMLSUPPORTFILES) $(WEBSITEDIR)
for f in $(TEXTFILES); do cp $$f $(WEBSITEDIR)/$$f.txt; done
cp $(BUILDERFILES) $(WEBSITEDIR)/download/builder/
cd $(WEBSITEDIR) && \
date=`date +%F`; \
sed -e "s/SUBST_VERSION/$(VERSION)/" \
@@ -227,69 +321,273 @@ website: $(HTMLFILES) $(TEXTFILES)
# When doing 'make dist' update a few files automatically.
dist-hook:
$(top_srcdir)/build-aux/gitlog-to-changelog > ChangeLog
git log --decorate=false > 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
git shortlog -s | $(AWK) -F'\t' '{print $$2}' | sort -f > 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. These are separated into:
#
# po/POTFILES - files with ordinary extensions, but not OCaml files
# po/POTFILES-pl - Perl files that don't end in *.pl, which need a
# special xgettext option [not generated here]
# po/POTFILES-ml - OCaml files, which need a special tool to translate
#
# See po/Makefile.am.
#
# 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' | \
grep -v '^perl/blib/' | \
grep -v '^tests/' | \
grep -v '^daemon/lib/' | \
grep -v '^daemon/tests/' | \
grep -v '^examples/' | \
grep -v '^gnulib/' | \
grep -v '^perl/examples/' | \
grep -v '/guestfs_protocol.c' | \
grep -v '/rc_protocol.c' | \
grep -v 'appliance/debian/root' | \
grep -v '^po-docs/' | \
grep -v '^images/' | \
LC_ALL=C sort | \
sed 's,^\./,,' > po/POTFILES.in
find $(DIST_SUBDIRS) -name '*.c' -o -name '*.pl' -o -name '*.pm' | \
grep -v -E '^(examples|gnulib|perl/(blib|examples)|po-docs|tests)/' | \
grep -v -E '/((guestfs|rc)_protocol\.c)$$' | \
grep -v -E '^python/utils.c$$' | \
LC_ALL=C sort > po/POTFILES
cd $(srcdir); \
find builder customize mllib resize sparsify sysprep v2v -name '*.ml' | \
LC_ALL=C sort > po/POTFILES-ml
# Pkgconfig.
# Manual pages in top level directory.
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libguestfs.pc
man_MANS = \
guestfs-release-notes.1
noinst_DATA = \
$(top_builddir)/html/guestfs-release-notes.1.html
guestfs-release-notes.1 guestfs-release-notes.txt $(top_builddir)/html/guestfs-release-notes.1.html: stamp-guestfs-release-notes.pod
stamp-guestfs-release-notes.pod: guestfs-release-notes.pod
$(PODWRAPPER) \
--section 1 \
--man guestfs-release-notes.1 \
--text guestfs-release-notes.txt \
--html $(top_builddir)/html/guestfs-release-notes.1.html \
--license GPLv2+ \
$<
touch $@
# NB. podwrapper is an internal tool, so the man page mustn't be installed.
noinst_MANS = podwrapper.1
podwrapper.1: podwrapper.pl
$(PODWRAPPER) \
--section 1 \
--man $@-t \
--license GPLv2+ \
$<
mv $@-t $@
# Make clean.
CLEANFILES = \
*~ \
html/*.html \
pod2htm?.tmp \
html/*.html
podwrapper.1 \
qemu-wrapper.sh \
stamp-guestfs-release-notes.pod \
tmp/disk* \
tmp/run-* \
tmp/valgrind-*.log
clean-local:
-rm -rf tmp/libguestfs??????
-rm -rf tmp/guestfs.*
-rm -rf tmp/.guestfs-*
# 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)
$(top_builddir)/run test-tool/libguestfs-test-tool $(QUICKCHECK_TEST_TOOL_ARGS)
# Run extra-tests in tests/extra/ subdirectory.
# Non-standard tests.
extra-tests:
make -C tests/extra $@
check-all:
$(MAKE) -j1 \
check \
check-valgrind \
check-valgrind-local-guests \
check-direct \
check-valgrind-direct \
check-uml \
check-valgrind-uml \
check-with-upstream-qemu \
check-with-upstream-libvirt \
check-slow
# Make binary distribution.
check-release:
$(MAKE) -j1 \
check \
check-valgrind \
check-direct \
check-valgrind-direct
$(MAKE) -j1 LIBGUESTFS_HV=$(HOME)/d/linux-um/vmlinux \
check-uml \
check-valgrind-uml
$(MAKE) -j1 \
check-slow
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
check-valgrind: build-test-guests
@errors=0; \
for f in `grep -l '^$@:' $(SUBDIRS:%=%/Makefile.am)`; do \
echo $(MAKE) -C `dirname $$f` $@; \
$(MAKE) -C `dirname $$f` $@ || (( errors++ )); \
done; \
exit $$(( $$errors ? 1 : 0 ))
check-valgrind-local-guests:
@GUESTS=`$(top_builddir)/run ./pick-guests.pl 5`; \
errors=0; \
for f in `grep -l '^$@:' $(SUBDIRS:%=%/Makefile.am)`; do \
echo $(MAKE) GUESTS="$$GUESTS" -C `dirname $$f` $@; \
$(MAKE) GUESTS="$$GUESTS" -C `dirname $$f` $@ || (( errors++ )); \
done; \
exit $$(( $$errors ? 1 : 0 ))
check-direct:
@backend=`$(top_builddir)/run ./fish/guestfish get-backend`; \
if [ "$$backend" != "direct" ]; then \
$(MAKE) LIBGUESTFS_BACKEND=direct check || exit $$?; \
fi
check-with-appliance: check-direct
check-valgrind-direct:
@backend=`$(top_builddir)/run ./fish/guestfish get-backend`; \
if [ "$$backend" != "direct" ]; then \
$(MAKE) LIBGUESTFS_BACKEND=direct check-valgrind || exit $$?; \
fi
check-valgrind-with-appliance: check-valgrind-direct
# Tests which currently fail under UML:
# - blockdev --setro seems to have no effect on /dev/ubd* devices [*]
# - RHBZ#914931: test is sent a SIGTERM, apparently by UML [*]
# - tests/md/test-inspect-fstab-md.sh hangs at various places during the
# test, eg. running mdadm, mounting MD filesystem [*]
# [*] = likely to be a bug in UML itself
SKIP_TESTS_FAILING_IN_UML = \
SKIP_TEST_BLOCKDEV_GETRO=1 \
SKIP_TEST_BLOCKDEV_SETRO=1 \
SKIP_TEST_RHBZ914931=1 \
SKIP_TEST_INSPECT_FSTAB_MD_SH=1
check-uml:
$(MAKE) LIBGUESTFS_BACKEND=uml $(SKIP_TESTS_FAILING_IN_UML) check
check-valgrind-uml:
$(MAKE) LIBGUESTFS_BACKEND=uml $(SKIP_TESTS_FAILING_IN_UML) check-valgrind
QEMUDIR = $(HOME)/d/qemu
QEMUBINARY = $(QEMUDIR)/x86_64-softmmu/qemu-system-x86_64
check-with-upstream-qemu:
rm -f $(top_builddir)/qemu-wrapper.sh
$(MAKE) check-with-upstream-qemu-1 || exit $$?
check-with-upstream-qemu-1: $(top_builddir)/qemu-wrapper.sh
$(QEMUBINARY) --version
$(MAKE) LIBGUESTFS_HV=$(abs_top_builddir)/qemu-wrapper.sh check
$(top_builddir)/qemu-wrapper.sh: Makefile
rm -f $@ $@-t
echo -e "#!/bin/sh\nexec" "$(QEMUBINARY)" -L "$(QEMUDIR)/pc-bios" \"\$$@\" > $@-t
chmod +x,-w $@-t
mv $@-t $@
LIBVIRTDIR = $(HOME)/d/libvirt
check-with-upstream-libvirt:
@backend=`$(top_builddir)/run ./fish/guestfish get-backend`; \
if [ "$$backend" = "libvirt" ] && [ -x "$(LIBVIRTDIR)/run" ]; then \
$(LIBVIRTDIR)/run $(MAKE) check || exit $$?; \
fi
check-slow: build-test-guests
@errors=0; \
for f in `grep -l '^$@:' $(SUBDIRS:%=%/Makefile.am)`; do \
echo $(MAKE) -C `dirname $$f` $@; \
$(MAKE) -C `dirname $$f` $@ || (( errors++ )); \
done; \
exit $$(( $$errors ? 1 : 0 ))
build-test-guests:
$(MAKE) -C tests/guests check
# Print subdirs.
#
# If you want to selectively run tests, or if the test suite fails half
# way through, use:
#
# make print-subdirs
#
# to print the subdirectories, select the ones you want to run / the
# remaining ones, and do:
#
# make check SUBDIRS="..."
print-subdirs:
@echo $(SUBDIRS)
# Commit everything in current directory to HEAD, and set commit
# message to current version (only for maintainer).
maintainer-commit:
git commit -a -m "Version $(VERSION)."
# Tag HEAD with current version (only for maintainer).
maintainer-tag:
git tag -a $(VERSION) -m "Version $(VERSION) ($(BRANCH_TYPE))" -f
# Maintainer only: check EXTRA_DIST rule is complete.
# (Note you must have done 'make dist')
maintainer-check-extra-dist:
zcat $(PACKAGE_NAME)-$(VERSION).tar.gz | tar tf - | sort | \
sed 's,^$(PACKAGE_NAME)-$(VERSION)/,,' > tmp/tarfiles
git ls-files | sort > tmp/gitfiles
diff -ur tmp/tarfiles tmp/gitfiles | grep '^\+' | \
grep -v src/api-support/[0-9]
rm tmp/tarfiles tmp/gitfiles
# Provide help on common Makefile targets.
help:
@echo
@echo "make Build everything."
@echo
@echo "make check Run the standard tests"
@echo "make -k check ... and display all errors at once."
@echo
@echo "make check-valgrind Run a subset of the tests under valgrind."
@echo "make check-valgrind-local-guests Test under valgrind using local guests."
@echo "make check-direct Test using direct backend."
@echo "make check-valgrind-direct Test valgrind + direct backend."
@echo "make check-uml Test using User-Mode Linux."
@echo "make check-valgrind-uml Test valgrind + User-Mode Linux."
@echo "make check-with-upstream-qemu Test using upstream qemu."
@echo "make check-with-upstream-libvirt Test using upstream libvirt."
@echo "make check-slow Slow/long-running tests."
@echo
@echo "make check-all Runs all 'check*' rules."
@echo "make check-release Runs 'check*' rules required for release."
@echo
@echo "make syntax-check -j1 -k Check syntax and style problems in the code."
@echo "make print-subdirs Print subdirectories."
@echo
@echo "make install Install everything."
@echo
@echo "make clean Clean everything."
@echo
@echo "To run programs without installing:"
@echo " ./run ./fish/guestfish [or any other program]"
@echo
@echo "For more information, see EXTENDING LIBGUESTFS in guestfs(3); and README."
@echo

403
README
View File

@@ -26,169 +26,290 @@ Fedora/RHEL users:
Debian/Ubuntu users:
Take a look at the debian/control file and install everything listed
in "Build-Depends". If that is successful, you don't need to bother
with the rest of this section.
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
- recent QEMU >= 0.13 (0.14 or later is better) with virtio-serial support
- 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.3 (it is best to use the latest version)
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
- XDR, rpcgen (on Linux these are provided by glibc)
- cpio
- gperf
- pcre (Perl Compatible Regular Expressions C library)
- genisoimage (NOT mkisofs any more)
- hivex >= 1.2.7 (http://libguestfs.org/download) (optional)
- libmagic (the library that corresponds to the 'file' command) (optional)
- libvirt (optional)
- libxml2 (optional)
- libconfig (optional)
- augeas >= 0.5.0 (http://augeas.net/) (optional)
- Berkeley DB 'db_dump' and 'db_load' utilities
(db4-utils or db4.X-util or similar) (optional)
- systemtap/DTrace userspace probes (optional)
http://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps
- perldoc (pod2man, pod2text, pod2html) to generate the manual pages
and other documentation.
- Readline to have nicer command-line editing in guestfish (optional)
- xmllint (part of libxml2) to validate virt-inspector
RELAX NG schema (optional)
- OCaml if you want to rebuild the generated files, and
also to build the OCaml bindings (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)
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
R = Required
O = Optional
+==============+=============+===+=========================================+
| Package name | Min.version | | Notes |
+==============+=============+===+=========================================+
| Install as many packages listed in appliance/packagelist.in as possible. |
| This installs the disk management tools required by the appliance. The |
| list below is *additional* packages needed on the host. |
+--------------+-------------+---+-----------------------------------------+
| qemu | 1.2.0 | R | 1.1 may work, but has broken virtio-scsi|
+--------------+-------------+---+-----------------------------------------+
| qemu-img | | R | >= 2.2.0 is required for virt-v2v but |
| | | | optional elsewhere |
+--------------+-------------+---+-----------------------------------------+
| kernel | 2.6.34 | R | Make sure the following are enabled |
| | | | compiled in or as a module: |
| | | | - virtio-pci |
| | | | - virtio-serial |
| | | | - virtio-block |
| | | | - virtio-net |
+--------------+-------------+---+-----------------------------------------+
| supermin | 5.1.0 | R | This is required on all distros. |
| | | | 'supermin' is the new name for |
| | | | 'febootstrap'. |
| | | | For alternatives, see: |
| | | | libguestfs.org/download/binaries/appliance/
+--------------+-------------+---+-----------------------------------------+
| glibc | | R | We use various glibc-isms. |
| | | | Also glibc provides XDR, rpcgen. |
+--------------+-------------+---+-----------------------------------------+
| GCC or LLVM | | R | We use __attribute__((cleanup)). |
+--------------+-------------+---+-----------------------------------------+
| Perl | | R | Various build and test programs need |
| | | | Perl. Not needed at runtime except if |
| | | | you need to run a handful of virt-* |
| | | | tools that are still written in Perl. |
+--------------+-------------+---+-----------------------------------------+
| Pod::Man | | R | Part of Perl core. |
+--------------+-------------+---+-----------------------------------------+
| Pod::Simple | | R | Part of Perl core. |
+--------------+-------------+---+-----------------------------------------+
| OCaml | |R/O| Required if compiling from git. |
| | | | Optional if compiling from tarball. |
| | | | To build generated files and OCaml bindings.
+--------------+-------------+---+-----------------------------------------+
| autotools | |R/O| Required if compiling from git. |
| | | | Optional if compiling from tarball. |
| | | | Autotools-based build system. |
+--------------+-------------+---+-----------------------------------------+
| cpio | | R | |
+--------------+-------------+---+-----------------------------------------+
| gperf | | R | |
+--------------+-------------+---+-----------------------------------------+
| flex | | R | flex & bison are required for virt- |
+--------------+-------------+---| builder. We could make these |
| bison | | R | optional but automakes makes it hard. |
+--------------+-------------+---+-----------------------------------------+
| PCRE | | R | Perl-compatible Regular Expression lib. |
+--------------+-------------+---+-----------------------------------------+
| genisoimage | | R | mkisofs may work. |
+--------------+-------------+---+-----------------------------------------+
| libxml2 | | R | Popular XML library. |
+--------------+-------------+---+-----------------------------------------+
| augeas | 1.0.0 | R | |
+--------------+-------------+---+-----------------------------------------+
| xz | | R | Used to compress disk images. |
| | | | Used by virt-builder for compression. |
+--------------+-------------+---+-----------------------------------------+
| po4a | |R/O| Required if compiling from git. |
| | | | Optional if compiling from tarball. |
| | | | For localizing man pages. |
+--------------+-------------+---+-----------------------------------------+
| hivex | 1.2.7 |R/O| Require if compiling from git. |
| | | | Windows Registry hive parser. |
+--------------+-------------+---+-----------------------------------------+
| libmagic | | O | The library used by the 'file' command. |
+--------------+-------------+---+-----------------------------------------+
| libvirt | | O | >= 0.10.2 is needed if you want to use |
| | | | libvirt to manage transient VMs. |
+--------------+-------------+---+-----------------------------------------+
| xmllint | | O | Part of libxml2. Used for tests only. |
+--------------+-------------+---+-----------------------------------------+
| libconfig | | O | Used to parse libguestfs's own config |
| | | | files eg. /etc/libguestfs-tools.conf. |
+--------------+-------------+---+-----------------------------------------+
| libselinux | | O | Used by the libvirt backend to securely |
| | | | confine the appliance (sVirt). |
+--------------+-------------+---+-----------------------------------------+
| db utils | | O | db_dump, db_load etc. Usually found in |
| | | | a package called db-utils, db4-utils, |
| | | | db4.X-utils, Berkeley DB utils, etc. |
+--------------+-------------+---+-----------------------------------------+
| systemtap | | O | For userspace probes. |
+--------------+-------------+---+-----------------------------------------+
| readline | | O | For nicer command line in guestfish. |
+--------------+-------------+---+-----------------------------------------+
| acl | | O | Library (libacl) and programs for |
| | | | handling POSIX ACLs. |
+--------------+-------------+---+-----------------------------------------+
| libcap | | O | Library (libcap) and programs for |
| | | | handling Linux capabilities. |
+--------------+-------------+---+-----------------------------------------+
| libldm | | O | Library (libldm) and 'ldmtool' for |
| | | | handling Windows Dynamic Disks. |
+--------------+-------------+---+-----------------------------------------+
| sd-journal | | O | systemd journal library |
+--------------+-------------+---+-----------------------------------------+
| yajl | 2 | O | JSON parser for parsing output of |
| | | | ldmtool and qemu-img info commands. |
+--------------+-------------+---+-----------------------------------------+
| gdisk | | O | GPT disk support. |
+--------------+-------------+---+-----------------------------------------+
| netpbm | | O | Render icons from guests. |
+--------------+-------------+---+-----------------------------------------+
| icoutils | | O | Render icons from Windows guests. |
+--------------+-------------+---+-----------------------------------------+
| Expect | | O | Perl module used to test virt-rescue. |
+--------------+-------------+---+-----------------------------------------+
| FUSE | | O | fusermount, libfuse, and kernel module |
| | | | are all needed if you want guestmount |
| | | | and/or 'mount-local' support. |
+--------------+-------------+---+-----------------------------------------+
| static glibc | | O | Used for testing only. |
+--------------+-------------+---+-----------------------------------------+
| qemu-nbd | | O | Used for testing only. |
+--------------+-------------+---+-----------------------------------------+
| uml_mkcow | | O | For the UML backend. |
+--------------+-------------+---+-----------------------------------------+
| curl | | O | Used by virt-builder for downloads |
+--------------+-------------+---+-----------------------------------------+
| gpg | | O | Used by virt-builder for digital |
| | | | signatures |
+--------------+-------------+---+-----------------------------------------+
| liblzma | | O | Can be used by virt-builder for fast |
| | | | uncompression of templates. |
+--------------+-------------+---+-----------------------------------------+
| gtk2 | | O | Used by virt-p2v user interface. |
+--------------+-------------+---+-----------------------------------------+
| python-evtx | | O | Used by virt-log to parse Windows |
| | | | Event Log files. |
+--------------+-------------+---+-----------------------------------------+
| findlib | | O | For the OCaml bindings. |
+--------------+-------------+---+-----------------------------------------+
| ocaml-gettext| | O | For localizing OCaml virt-* tools. |
+--------------+-------------+---+-----------------------------------------+
| Python | 2.2 | O | For the Python bindings. |
+--------------+-------------+---+-----------------------------------------+
| Ruby | | O | >= 1.9 is better than 1.8. |
+--------------+-------------+---+-----------------------------------------+
| rake | | O | For the Ruby bindings. |
+--------------+-------------+---+-----------------------------------------+
| rubygem-minitest | O | For the Ruby bindings. |
+--------------+-------------+---+-----------------------------------------+
| Java | 1.6 | O | Java + JNI + jpackage-utils are needed |
| | | | for the Java bindings. |
+--------------+-------------+---+-----------------------------------------+
| GHC | | O | For the Haskell bindings. |
+--------------+-------------+---+-----------------------------------------+
| PHP | | O | For the PHP bindings. |
+--------------+-------------+---+-----------------------------------------+
| phpize | | O | For the PHP bindings. |
+--------------+-------------+---+-----------------------------------------+
| glib2 | | O | For the GObject bindings. |
+--------------+-------------+---+-----------------------------------------+
| gobject-introspection | O | For the GObject bindings. |
+--------------+-------------+---+-----------------------------------------+
| gjs | | O | For testing the GObject bindings. |
+--------------+-------------+---+-----------------------------------------+
| LUA | | O | For the LUA bindings. |
+--------------+-------------+---+-----------------------------------------+
| Erlang | | O | For the Erlang bindings. |
+--------------+-------------+---+-----------------------------------------+
| erl_interface| | O | For the Erlang bindings. |
+--------------+-------------+---+-----------------------------------------+
| golang | 1.1.1 | O | For the Go bindings. |
+--------------+-------------+---+-----------------------------------------+
| valgrind | | O | For testing for memory problems. |
+--------------+-------------+---+-----------------------------------------+
| Sys::Virt | | O | Perl bindings for libvirt. |
+--------------+-------------+---+-----------------------------------------+
| Win::Hivex | | O | Perl bindings for hivex. |
+--------------+-------------+---+-----------------------------------------+
| Pod::Usage | | O | Perl module used by tests. |
+--------------+-------------+---+-----------------------------------------+
| Test::More | | O | Perl module used by tests. |
+--------------+-------------+---+-----------------------------------------+
| XML::XPath | | O | Perl module used by some virt-* tools. |
+--------------+-------------+---+-----------------------------------------+
| XML::XPath::XMLParser | O | Perl module used by some virt-* tools. |
+--------------+-------------+---+-----------------------------------------+
| perl-libintl | | O | Perl module for localization. |
+--------------+-------------+---+-----------------------------------------+
| bash-completion | O | For tab-completion of commands in bash. |
+==============+=============+===+=========================================+
R = Required
O = Optional
Building
----------------------------------------------------------------------
Then make the daemon, library and root filesystem:
Build the daemon, library and root filesystem:
./configure
make
building from tarball building from git
--------------------- -----------------
./configure ./autogen.sh
make make
Finally run the tests:
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:
Also:
make extra-tests
make check-valgrind
If everything works, you can install the library and tools by running
this command as root:
runs a subset of the test suite under valgrind (requires valgrind to
be installed obviously).
make check-all
runs check-valgrind + even more 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.
make help
lists all 'make' targets.
You may install the library by running the following command as root.
However *most users should probably not do this*. Instead, './run'
the programs from the build directory as described below.
make install
Distro packagers should use this instead:
make INSTALLDIRS=vendor [DESTDIR=...] 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:
to install, using the "./run" script in the top directory. This
script sets up some environment variables. For example:
./run ./fish/guestfish [usual guestfish args ...]
./run guestfish [usual guestfish args ...]
./run ./inspector/virt-inspector [usual virt-inspector args ...]
./run virt-inspector [usual virt-inspector args ...]
If you are already in the fish/ subdirectory, then the following
command will also work:
../run ./guestfish [...]
../run guestfish [...]
You can also make a symlink (note: NOT a hard link) from your $PATH to
the run script, eg:
cd ~/bin
ln -s ~/libguestfs/run libguestfs-run
cd ~/libguestfs
libguestfs-run ./inspector/virt-inspector [...]
The ./run script adds every libguestfs binary to the $PATH, so the
above example runs guestfish from the build directory (not the
globally installed guestfish if there is one).
You can also run the C programs under valgrind like this:
./run valgrind [valgrind opts...] ./cat/virt-cat [virt-cat opts...]
./run valgrind [valgrind opts...] virt-cat [virt-cat opts...]
or under gdb:
./run gdb --args virt-cat [virt-cat opts...]
This also works with sudo (eg. if you need root access for libvirt or
to access a block device):
sudo ./run ./cat/virt-cat -d LinuxGuest /etc/passwd
sudo ./run virt-cat -d LinuxGuest /etc/passwd
qemu
@@ -220,7 +341,7 @@ these instructions:
On some systems, this will work too:
chmod o+rw /dev/kvm
chmod 0666 /dev/kvm
On some systems, the chmod will not survive a reboot, and you will
need to make edits to the udev configuration.
@@ -254,15 +375,31 @@ 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 port the febootstrap first
appliance. You will need to port febootstrap first
(http://people.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').
Copyright and license information
----------------------------------------------------------------------
Copyright (C) 2009-2012 Red Hat Inc.
Copyright (C) 2009-2014 Red Hat Inc.
The library is distributed under the LGPLv2+. The programs are
distributed under the GPLv2+. Please see the files COPYING and
COPYING.LIB for full license information.
The examples are under a very liberal license.

File diff suppressed because it is too large Load Diff

52
ROADMAP
View File

@@ -1,52 +0,0 @@
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.18)
------------------------------------
* 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.18 (put "1.18" 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.18&component=libguestfs&product=Virtualization%20Tools
Beyond 1.18
-----------
* 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.

427
TODO
View File

@@ -43,75 +43,36 @@ 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?
Ideas for extra commands
------------------------
General glibc / core programs:
chgrp
more mk*temp calls
ext2 properties:
chattr
lsattr
badblocks
debugfs
dumpe2fs
e2image
e2undo
filefrag
findfs
logsave
mklost+found
SELinux:
chcat
restorecon
ch???
[Wanlong Gao submitted patches for restorecon, but
there are problems with using the restorecon binary
from the host on the guest. Most of the time it
would do more harm than good.]
setfiles
Oddball:
pivot_root
fts(3) / ftw(3)
sh-in, sh-out: run shell command with large input/output
debug sh-in, debug sh-out: debug versions of the above
Other initrd-* commands
-----------------------
@@ -120,74 +81,6 @@ 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->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->add_drive_ro ($filename);
$h->launch ();
$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?
virt-rescue pty
---------------
@@ -202,20 +95,24 @@ two sides to a pty, and one has to be handled after the fork).
work. qemu is implementing its own ptys, and they are broken. Need
to fix qemu.]
Windows-based daemon/appliance
------------------------------
Port to Windows
---------------
See discussion on list:
"Port to Windows" means different things to different people.
The easiest is to port the library to Windows, but reuse the Linux
appliance/daemon. This would allow people to use libguestfs on
Windows hosts and link libguestfs to Windows programs. Doing this is
just a matter of chugging through the code fixing portability issues,
using gnulib as far as possible as the portability layer.
The hardest is probably a port of the daemon to Windows. The reason
to do this is so that you can use the native NTFS drivers (in Windows)
in order to edit Windows guests. Although back in 2009 we did some
work on this, I am now dubious about the utility of this, since
ntfs-3g works very well. See also discussion on list:
https://www.redhat.com/archives/libguestfs/2009-November/msg00165.html
qemu locking
------------
Add -drive file=...,lock=exclusive and -drive file=...,lock=shared
Change libguestfs and libvirt to do the right thing, so that multiple
instances of qemu cannot stomp on each other.
virt-disk-explore
-----------------
@@ -256,17 +153,8 @@ http://sourceforge.net/projects/aide/
http://osiris.shmoo.com/
http://sourceforge.net/projects/tripwire/
Fix 'file'
----------
https://www.redhat.com/archives/libguestfs/2010-June/msg00053.html
https://www.redhat.com/archives/libguestfs/2010-June/msg00079.html
Freeze/thaw filesystems
-----------------------
Access to these ioctls:
http://git.kernel.org/linus/fcccf502540e3d7
See also: virt-aide;
https://rwmj.wordpress.com/2013/05/16/scanning-offline-guests-using-openscap-and-guestmount/#content
Tips for new users in guestfish
-------------------------------
@@ -293,13 +181,6 @@ Could we make guestfish interactive if commands are used without params?
Image name? disk.img
Size of image? 10M
Common problems
---------------
How can we solve these common user problems?
[space for common problems here]
Better support for encrypted devices
------------------------------------
@@ -325,6 +206,9 @@ 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 the library directly.
Visualization
-------------
@@ -369,23 +253,13 @@ $EDITOR without any corresponding ability to set them.
echo $EDITOR # or %{EDITOR}
edit /etc/resolv.conf
live CD inspection for Windows 7
--------------------------------
Windows 7 install CDs are quite different and pretty impenetrable.
There are no obvious files to parse.
More ntfs tools
---------------
ntfsprogs actually has a lot more useful tools than we currently
use. Interesting ones are:
ntfslabel: display or change filesystem label (we should unify all
set*label APIs into a single set_vfs_label which can deal with any
filesystem)
ntfsclone: clone, image, restore, rescue NTFS
ntfscluster: display file(s) that occupy a cluster or sector
ntfsinfo: print various information about NTFS volume and files
@@ -496,35 +370,18 @@ Interactive disk creator
An interactive disk creator program.
Attach method for disconnected operation
----------------------------------------
Backend for disconnected operation
----------------------------------
http://libguestfs.org/guestfs.3.html#guestfs_set_attach_method
http://libguestfs.org/guestfs.3.html#guestfs_set_backend
"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).
would be some sort of modified backend (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).
GObject Introspection
---------------------
We periodically get asked to implement gobject-introspection (it's a
GNOME thing):
http://live.gnome.org/GObjectIntrospection
This would require a separate Gtk C API since the main guestfs handle
would have to be encapsulated in a GObject. However the main
difficulty is that the annotations supported to define types are not
very rich. Notably missing are support for optional arguments
(defined but not implemented), support for structs (unless mapped to
other objects).
Also note that the libguestfs API is not "object oriented".
libosinfo mappings for virt-inspector
-------------------------------------
@@ -533,52 +390,45 @@ Return libosinfo mappings from inspection API.
virt-sysprep ideas
------------------
- touch /.unconfigured ?
- other Spacewalk / RHN IDs (?)
- Kerberos keys
- Puppet registration
- user accounts
- Windows sysprep
(see: https://github.com/clalancette/oz/blob/e74ce83283d468fd987583d6837b441608e5f8f0/oz/Windows.py )
- blue skies: change the background image
- (librarian suggests ...)
. install a firstboot script virt-sysprep --script=/tmp/foo.sh
. run an external shell script
. run external guestfish script virt-sysprep --fish=/tmp/foo.fish
. rm /var/cache/apt/archives/*
- /var/run/* and pam_faillock's data files
- homedirs/.ssh directory, especially /root/.ssh (Steve Grubb)
- 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/cache/gdm/*
/var/lib/fprint/*
/var/run/*
/var/lib/AccountService/users/*
/var/lib/sss/db/*
/var/lib/samba/*
/var/lib/samba/*/*
(thanks Marko Myllynen, James Antill)
- remove or modify UUIDs in /etc/fstab (eg. on Ubuntu)
(thanks Joshua Daniel Franklin)
- fix the virt-sysprep fs-uuids plugin
Launch remote sessions over ssh
-------------------------------
- virt-sysprep should be able to zero-free space on the disks (a bit
like virt-sparsify). This is a security measure to stop people
trying to read the deleted files.
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.
Kazuo Moriwaka adds:
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".
- swap devices (both of block device and file) should be wiped. This may
good for security purpose, and size. I found virt-sparsify can clear
swap partition.
- --script is nice. Defining default sysprep script directory
like /usr/lib/guestfs/sysprep-scripts.d/ may be useful to integrate
other package maintainer(or ISV)'s effort.
- To achieve better (or crazy) coverage, a simple examination will be
help:
Install the same kickstart into VM twice, and diff the trees.
Many autogenerated IDs and configs can be found :)
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)
- Windows login script/service
Note that virt-sysprep has gradually gained some of these features,
eg. setting hostname, changing passwords. Since this precedent has
now been set, it could do more of the same.
virt-make-fs and virt-win-reg need to not be in Perl
----------------------------------------------------
@@ -599,3 +449,158 @@ 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
--------------------------
'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.
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).
virt-sparsify should use discard
--------------------------------
This requires some changes to qemu to make discard work properly
throughout the entire stack.
Reimplement some APIs to avoid protocol limits
----------------------------------------------
Mostly this item was done (eg. commits a69f44f56f and before). The
most notable API with a protocol limit remaining is:
- guestfs_readdir
hivex
-----
Reimplement virt-win-reg to use this API. (This is difficult because
the Perl libraries underneath access the hivex API directly).
ruby
----
Implement blocking calls. The API for this:
http://www.spacevatican.org/2012/7/5/whos-afraid-of-the-big-bad-lock/
is very poorly designed and essentially impossible for us to use:
https://bugs.ruby-lang.org/issues/5543
particularly if we also want to maintain backwards compatibility with
Ruby 1.8, and/or maintain volatile VALUEs on the stack.
virt-builder
------------
- set keyboard
- set default timezone and language
- set permissions on uploaded files & created directories
- how can we give users a shell for debugging purposes?
- allow non-xz-compressed templates (faster)
- let notes etc be localized, ie. notes[en]=...
- add a CLI option to print the in-built path/fingerprint(s)
- allow public keys to come from local file paths
- doing virt-builder then running (eg. via qemu, libvirt?) is common; is
it possible to make this more automatic?
- more common code between virt-sysprep & virt-builder:
* virt-sysprep should have --run, --run-command,
--firstboot-command options with common code from virt-builder
- document:
* how to integrate with ansible, puppet, chef
* how to import to OpenStack / Glance
* how to import to EC2
- /etc/resolv.conf handling works but is best described as a hack:
https://github.com/libguestfs/libguestfs/commit/9521422ce60578f7196cc8b7977d998159238c19
- let's make UML work
+ SLIRP is insecure, but we could allow just a bare web proxy which
gets proxied over virtio-serial to the outside world (except
virtio-serial can't be multiplexed)
- sometimes (not always) aug_init takes ages, why?
Midnight Commander (mc) extension
---------------------------------
Write an extension for mc that would let people browse into
filesystems. See
http://repo.or.cz/w/midnight-commander.git/tree/HEAD:/misc/ext.d
Python
------
It seems as if we should call PyErr_Clear() somewhere in every
Python binding.
Improvements in virt-log
------------------------
- Make it faster, especially if the user wants to grep the output.
- Support Windows guests, see
http://rwmj.wordpress.com/2011/04/17/decoding-the-windows-event-log-using-guestfish/
Subsecond handling in virt-diff, virt-ls
----------------------------------------
Handle nanoseconds properly. You should be able to specify them on
the command line and display them.

View File

@@ -18,6 +18,8 @@
include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = \
test-virt-alignment-scan.sh \
test-virt-alignment-scan-guests.sh \
virt-alignment-scan.pod
CLEANFILES = stamp-virt-alignment-scan.pod
@@ -25,32 +27,48 @@ CLEANFILES = stamp-virt-alignment-scan.pod
bin_PROGRAMS = virt-alignment-scan
SHARED_SOURCE_FILES = \
../df/domains.c \
../df/domains.h \
../df/estimate-max-threads.c \
../df/estimate-max-threads.h \
../df/parallel.c \
../df/parallel.h \
../fish/config.c \
../fish/domain.c \
../fish/inspect.c \
../fish/keys.c \
../fish/options.h \
../fish/options.c \
../fish/virt.c
../fish/uri.h \
../fish/uri.c
virt_alignment_scan_SOURCES = \
$(SHARED_SOURCE_FILES) \
scan.c
virt_alignment_scan_CFLAGS = \
virt_alignment_scan_CPPFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \
-DGUESTFS_PRIVATE=1 \
-I$(top_srcdir)/src -I$(top_builddir)/src \
-I$(top_srcdir)/df \
-I$(top_srcdir)/fish \
-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-DLOCALEBASEDIR=\""$(datadir)/locale"\"
virt_alignment_scan_CFLAGS = \
-pthread \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(LIBCONFIG_CFLAGS) \
$(LIBXML2_CFLAGS) \
$(LIBVIRT_CFLAGS)
virt_alignment_scan_LDADD = \
$(LIBCONFIG_LIBS) \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
../gnulib/lib/libgnu.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
../gnulib/lib/libgnu.la \
-lm
# Manual pages and HTML files for the website.
@@ -60,18 +78,24 @@ 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 \
$(PODWRAPPER) \
--man virt-alignment-scan.1 \
--html $(top_builddir)/html/virt-alignment-scan.1.html \
--license GPLv2+ \
$<
touch $@
# Tests.
# random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
TESTS_ENVIRONMENT = $(top_builddir)/run --test
# TESTS_ENVIRONMENT = \
# MALLOC_PERTURB_=$(random_val) \
# $(top_builddir)/run
TESTS =
# TESTS = test-virt-alignment-scan.sh
if ENABLE_APPLIANCE
TESTS += \
test-virt-alignment-scan.sh \
test-virt-alignment-scan-guests.sh
endif
check-valgrind:
$(MAKE) VG="$(top_builddir)/run @VG@" check

View File

@@ -25,20 +25,32 @@
#include <inttypes.h>
#include <unistd.h>
#include <getopt.h>
#include <errno.h>
#include <locale.h>
#include <assert.h>
#include <libintl.h>
#include <pthread.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 "parallel.h"
#include "domains.h"
/* This just needs to be larger than any alignment we care about. */
static size_t worst_alignment = UINT_MAX;
static pthread_mutex_t worst_alignment_mutex = PTHREAD_MUTEX_INITIALIZER;
static int scan (guestfs_h *g, const char *prefix, FILE *fp);
#ifdef HAVE_LIBVIRT
static int scan_work (guestfs_h *g, size_t i, FILE *fp);
#endif
/* These globals are shared with options.c. */
guestfs_h *g;
@@ -52,14 +64,7 @@ const char *libvirt_uri = NULL;
int inspector = 0;
static int quiet = 0; /* --quiet */
static int scan (void);
static inline char *
bad_cast (char const *s)
{
return (char *) s;
}
static int uuid = 0; /* --uuid */
static void __attribute__((noreturn))
usage (int status)
@@ -80,6 +85,7 @@ usage (int status)
" -d|--domain guest Add disks from libvirt guest\n"
" --format[=raw|..] Force disk format for -a option\n"
" --help Display brief help\n"
" -P nr_threads Use at most nr_threads\n"
" -q|--quiet No output, just exit code\n"
" -v|--verbose Verbose messages\n"
" -V|--version Display version and exit\n"
@@ -94,33 +100,34 @@ usage (int 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 char *options = "a:c:d:P: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 },
{ "long-options", 0, 0, 0 },
{ "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;
bool format_consumed = true;
int c;
int option_index;
int exit_code;
size_t max_threads = 0;
int r;
g = guestfs_create ();
if (g == NULL) {
@@ -128,19 +135,18 @@ main (int argc, char *argv[])
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;
if (STREQ (long_options[option_index].name, "long-options"))
display_long_options (long_options);
else if (STREQ (long_options[option_index].name, "format")) {
OPTION_format;
} 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);
@@ -160,6 +166,13 @@ main (int argc, char *argv[])
OPTION_d;
break;
case 'P':
if (sscanf (optarg, "%zu", &max_threads) != 1) {
fprintf (stderr, _("%s: -P option is not numeric\n"), program_name);
exit (EXIT_FAILURE);
}
break;
case 'q':
quiet = 1;
break;
@@ -196,60 +209,98 @@ main (int argc, char *argv[])
if (optind != argc)
usage (EXIT_FAILURE);
/* The user didn't specify any drives to scan. */
if (drvs == NULL)
usage (EXIT_FAILURE);
CHECK_OPTION_format_consumed;
/* Add domains/drives from the command line (for a single guest). */
add_drives (drvs, 'a');
if (guestfs_launch (g) == -1)
/* virt-alignment-scan has two modes. If the user didn't specify
* any drives, then we do the scan on every libvirt guest. That's
* the if-clause below. If the user specified domains/drives, then
* we assume they belong to a single guest. That's the else-clause
* below.
*/
if (drvs == NULL) {
#if defined(HAVE_LIBVIRT)
get_all_libvirt_domains (libvirt_uri);
r = start_threads (max_threads, g, scan_work);
free_domains ();
if (r == -1)
exit (EXIT_FAILURE);
#else
fprintf (stderr, _("%s: compiled without support for libvirt.\n"),
program_name);
exit (EXIT_FAILURE);
#endif
} else { /* Single guest. */
if (uuid) {
fprintf (stderr, _("%s: --uuid option cannot be used with -a or -d\n"),
program_name);
exit (EXIT_FAILURE);
}
/* Free up data structures, no longer needed after this point. */
free_drives (drvs);
/* Add domains/drives from the command line (for a single guest). */
add_drives (drvs, 'a');
/* Perform the scan. */
exit_code = scan ();
if (guestfs_launch (g) == -1)
exit (EXIT_FAILURE);
guestfs_close (g);
/* Free up data structures, no longer needed after this point. */
free_drives (drvs);
/* Perform the scan. */
r = scan (g, NULL, stdout);
guestfs_close (g);
if (r == -1)
exit (EXIT_FAILURE);
}
/* 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);
}
static int
scan (void)
scan (guestfs_h *g, const char *prefix, FILE *fp)
{
int exit_code = 0;
char **devices;
size_t i, j;
size_t alignment;
uint64_t start;
struct guestfs_partition_list *parts;
int err;
devices = guestfs_list_devices (g);
CLEANUP_FREE_STRING_LIST char **devices = guestfs_list_devices (g);
if (devices == NULL)
exit (EXIT_FAILURE);
return -1;
for (i = 0; devices[i] != NULL; ++i) {
parts = guestfs_part_list (g, devices[i]);
CLEANUP_FREE char *name = NULL;
CLEANUP_FREE_PARTITION_LIST struct guestfs_partition_list *parts =
guestfs_part_list (g, devices[i]);
if (parts == NULL)
exit (EXIT_FAILURE);
return -1;
/* Canonicalize the name of the device for printing. */
if (STRPREFIX (devices[i], "/dev/") &&
(devices[i][5] == 'h' || devices[i][5] == 'v') &&
devices[i][6] == 'd' &&
c_isalpha (devices[i][7]))
devices[i][5] = 's';
name = guestfs_canonical_device_name (g, devices[i]);
if (name == NULL)
return -1;
for (j = 0; j < parts->len; ++j) {
/* Start offset of the partition in bytes. */
start = parts->val[j].part_start;
if (!quiet)
printf ("%s%d %12" PRIu64 " ",
devices[i], (int) parts->val[j].part_num, start);
if (!quiet) {
if (prefix)
fprintf (fp, "%s:", prefix);
fprintf (fp, "%s%d %12" PRIu64 " ",
name, (int) parts->val[j].part_num, start);
}
/* What's the alignment? */
if (start == 0) /* Probably not possible, but anyway. */
@@ -260,32 +311,60 @@ scan (void)
if (!quiet) {
if (alignment < 10)
printf ("%12" PRIu64 " ", UINT64_C(1) << alignment);
fprintf (fp, "%12" PRIu64 " ", UINT64_C(1) << alignment);
else if (alignment < 64)
printf ("%12" PRIu64 "K ", UINT64_C(1) << (alignment - 10));
fprintf (fp, "%12" PRIu64 "K ", UINT64_C(1) << (alignment - 10));
else
printf ("- ");
fprintf (fp, "- ");
}
err = pthread_mutex_lock (&worst_alignment_mutex);
assert (err == 0);
if (alignment < worst_alignment)
worst_alignment = alignment;
err = pthread_mutex_unlock (&worst_alignment_mutex);
assert (err == 0);
if (alignment < 12) { /* Bad in general: < 4K alignment */
exit_code = 3;
if (!quiet)
printf ("bad (%s)\n", _("alignment < 4K"));
fprintf (fp, "bad (%s)\n", _("alignment < 4K"));
} else if (alignment < 16) { /* Bad on NetApps: < 64K alignment */
if (exit_code < 2)
exit_code = 2;
if (!quiet)
printf ("bad (%s)\n", _("alignment < 64K"));
fprintf (fp, "bad (%s)\n", _("alignment < 64K"));
} else {
if (!quiet)
printf ("ok\n");
fprintf (fp, "ok\n");
}
}
guestfs_free_partition_list (parts);
free (devices[i]);
}
free (devices);
return exit_code;
return 0;
}
#if defined(HAVE_LIBVIRT)
/* The multi-threaded version. This callback is called from the code
* in "parallel.c".
*/
static int
scan_work (guestfs_h *g, size_t i, FILE *fp)
{
struct guestfs___add_libvirt_dom_argv optargs;
optargs.bitmask =
GUESTFS___ADD_LIBVIRT_DOM_READONLY_BITMASK |
GUESTFS___ADD_LIBVIRT_DOM_READONLYDISK_BITMASK;
optargs.readonly = 1;
optargs.readonlydisk = "read";
if (guestfs___add_libvirt_dom (g, domains[i].dom, &optargs) == -1)
return -1;
if (guestfs_launch (g) == -1)
return -1;
return scan (g, !uuid ? domains[i].name : domains[i].uuid, fp);
}
#endif /* HAVE_LIBVIRT */

View File

@@ -0,0 +1,35 @@
#!/bin/bash -
# libguestfs
# Copyright (C) 2013 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.
export LANG=C
if [ -n "$SKIP_TEST_VIRT_ALIGNMENT_SCAN_GUESTS_SH" ]; then
echo "$0: skipping test because SKIP_TEST_VIRT_ALIGNMENT_SCAN_GUESTS_SH is set."
exit 77
fi
guestsdir="$(cd ../tests/guests && pwd)"
libvirt_uri="test://$guestsdir/guests-all-good.xml"
$VG virt-alignment-scan -c "$libvirt_uri"
r=$?
# 0, 2 and 3 are reasonable non-error exit codes. Others are errors.
if [ $r -ne 0 -a $r -ne 2 -a $r -ne 3 ]; then
exit $r
fi

View File

@@ -0,0 +1,27 @@
#!/bin/bash -
# libguestfs
# 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.
export LANG=C
$VG virt-alignment-scan -a ../tests/guests/fedora.img
r=$?
# 0, 2 and 3 are reasonable non-error exit codes. Others are errors.
if [ $r -ne 0 -a $r -ne 2 -a $r -ne 3 ]; then
exit $r
fi

82
align/virt-alignment-scan.pod Executable file → Normal file
View File

@@ -1,5 +1,3 @@
=encoding utf8
=head1 NAME
virt-alignment-scan - Check alignment of virtual machine partitions
@@ -10,6 +8,8 @@ virt-alignment-scan - Check alignment of virtual machine partitions
virt-alignment-scan [--options] -a disk.img [-a disk.img ...]
virt-alignment-scan [--options]
=head1 DESCRIPTION
When older operating systems install themselves, the partitioning
@@ -51,6 +51,14 @@ possibly the I<-c> option:
/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:
@@ -59,8 +67,12 @@ program. The columns are:
=item col 1
the device and partition name (eg. C</dev/sda1> meaning the
first partition on the first block device)
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
@@ -103,6 +115,12 @@ 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<-a URI>
=item B<--add URI>
Add a remote disk. See L<guestfish(1)/ADDING REMOTE STORAGE>.
=item B<-c> URI
=item B<--connect> URI
@@ -144,6 +162,18 @@ 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<-P> nr_threads
Since libguestfs 1.22, virt-alignment-scan is multithreaded and
examines guests in parallel. By default the number of threads to use
is chosen based on the amount of free memory available at the time
that virt-alignment-scan is started. You can force
virt-alignment-scan to use at most C<nr_threads> by using the I<-P>
option.
Note that I<-P 0> means to autodetect, and I<-P 1> means to use a
single thread.
=item B<-q>
=item B<--quiet>
@@ -151,6 +181,15 @@ security problem with malicious guests (CVE-2010-3851).
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>
@@ -211,13 +250,13 @@ 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 |
| | |
---+-------------------------+-------------------------+---
┌──────────────────────────┬ ─ ─ ─ ─
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
@@ -308,13 +347,6 @@ 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:
@@ -365,17 +397,3 @@ 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

@@ -0,0 +1,17 @@
# For libguestfs, create /dev/disk/guestfs/<serial>
# and /dev/disk/guestfs/<serial><partnum>
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", ENV{ID_SCSI_SERIAL}=="?*", \
SYMLINK+="disk/guestfs/$env{ID_SCSI_SERIAL}"
KERNEL=="sd*", ENV{DEVTYPE}=="partition", ENV{ID_SCSI_SERIAL}=="?*", \
SYMLINK+="disk/guestfs/$env{ID_SCSI_SERIAL}%n"
# As written, it's likely the above only works with virtio-scsi
# because ID_SCSI_SERIAL is specific to the output of the 'scsi_id'
# program. The following will not work because ID_SERIAL contains
# some unwanted text.
#KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", \
# SYMLINK+="disk/guestfs/$env{ID_SERIAL}"
#KERNEL=="vd*[0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", \
# SYMLINK+="disk/guestfs/$env{ID_SERIAL}%n"

View File

@@ -1,5 +1,5 @@
# libguestfs
# Copyright (C) 2009 Red Hat Inc.
# Copyright (C) 2009-2014 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
@@ -18,72 +18,137 @@
include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = \
packagelist.in \
excludelist.in \
99-guestfs-serial.rules \
excludefiles.in \
guestfsd.suppressions \
guestfs_lvm_conf.aug \
guestfs_shadow.aug \
hostfiles.in \
init \
make.sh.in
libguestfs-make-fixed-appliance.in \
libguestfs-make-fixed-appliance.pod \
make.sh.in \
packagelist.in
fsdir = $(libdir)/guestfs
superminfsdir = $(libdir)/guestfs/supermin.d
fs_DATA =
superminfs_DATA = \
supermin.d/base.img \
supermin.d/daemon.img \
supermin.d/init.img \
supermin.d/hostfiles
supermin.d/base.tar.gz \
supermin.d/daemon.tar.gz \
supermin.d/excludefiles \
supermin.d/hostfiles \
supermin.d/init.tar.gz \
supermin.d/packages \
supermin.d/udev-rules.tar.gz
# 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
supermin.d/base.tar.gz supermin.d/packages: stamp-supermin
stamp-supermin: make.sh packagelist
rm -f $@ supermin.d/base.tar.gz supermin.d/packages
./make.sh
$(MAKE) \
supermin.d/daemon.tar.gz \
supermin.d/excludefiles \
supermin.d/hostfiles \
supermin.d/init.tar.gz \
supermin.d/udev-rules.tar.gz
touch $@
# This used to be a configure-generated file. However config.status
# always touches the destination file, which means the appliance got
# rebuilt too often.
make.sh: make.sh.in $(top_builddir)/config.log $(top_builddir)/config.status
cd $(top_builddir) && \
./config.status --file=appliance/$@-t:appliance/$<
chmod +x $@-t
mv $@-t $@
cmp -s $@ $@-t || mv $@-t $@
rm -f $@-t
PACKAGELIST_CPP_FLAGS = -D$(DISTRO)=1
PACKAGELIST_CPP_FLAGS = -D$(DISTRO)=1 -DEXTRA_PACKAGES="$(EXTRA_PACKAGES)"
if VALGRIND_DAEMON
PACKAGELIST_CPP_FLAGS += -DVALGRIND_DAEMON=1
endif
packagelist: packagelist.in
cpp -undef $(PACKAGELIST_CPP_FLAGS) < $< | \
packagelist: packagelist.in Makefile
m4 $(PACKAGELIST_CPP_FLAGS) $< | \
grep -v '^[[:space:]]*$$' | grep -v '^#' > $@-t
cmp -s $@ $@-t || mv $@-t $@
rm -f $@-t
supermin.d/daemon.tar.gz: ../daemon/guestfsd guestfsd.suppressions guestfs_lvm_conf.aug guestfs_shadow.aug
rm -f $@ $@-t
rm -rf tmp-d
mkdir -p tmp-d$(DAEMON_SUPERMIN_DIR) tmp-d/etc tmp-d/usr/share/guestfs
ln ../daemon/guestfsd tmp-d$(DAEMON_SUPERMIN_DIR)/guestfsd
ln $(srcdir)/guestfsd.suppressions tmp-d/etc/guestfsd.suppressions
ln $(srcdir)/guestfs_lvm_conf.aug tmp-d/usr/share/guestfs/guestfs_lvm_conf.aug
ln $(srcdir)/guestfs_shadow.aug tmp-d/usr/share/guestfs/guestfs_shadow.aug
( cd tmp-d && tar zcf - * ) > $@-t
rm -r tmp-d
mv $@-t $@
excludelist: excludelist.in
cpp -undef $(PACKAGELIST_CPP_FLAGS) < $< | \
grep -v '^[[:space:]]*$$' | grep -v '^#' > $@-t
# Note we must avoid touching supermin.d if possible, so don't create
# the temporary files inside the supermin.d directory.
$@supermin.d/excludefiles: excludefiles.in Makefile
m4 $(PACKAGELIST_CPP_FLAGS) $< | \
grep -v '^[[:space:]]*$$' | grep -v '^#' > excludefiles-t
cmp -s $@ excludefiles-t || mv excludefiles-t $@
rm -f excludefiles-t
supermin.d/hostfiles: hostfiles.in Makefile
m4 $(PACKAGELIST_CPP_FLAGS) $< | \
grep -v '^[[:space:]]*$$' | grep -v '^#' > hostfiles-t
cmp -s $@ hostfiles-t || mv hostfiles-t $@
rm -f hostfiles-t
supermin.d/init.tar.gz: init
rm -f $@ $@-t
( cd $(srcdir) && tar zcf - init ) > $@-t
mv $@-t $@
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
# We should put this file in /lib/udev/rules.d, but put it in /etc so
# we don't have to deal with all the UsrMove crap in Fedora.
supermin.d/udev-rules.tar.gz: 99-guestfs-serial.rules
rm -f $@ $@-t
rm -rf tmp-u
mkdir -p tmp-u/etc/udev/rules.d
for f in $^; do ln $$f tmp-u/etc/udev/rules.d/$$(basename $$f); done
( cd tmp-u && tar zcf - etc ) > $@-t
rm -r tmp-u
mv $@-t $@
# If installing the daemon, install the udev rules too.
if INSTALL_DAEMON
udevrulesdir = /lib/udev/rules.d
udevrules_DATA = 99-guestfs-serial.rules
endif
# libguestfs-make-fixed-appliance script and man page.
sbin_SCRIPTS = libguestfs-make-fixed-appliance
man_MANS = libguestfs-make-fixed-appliance.1
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
$(PODWRAPPER) \
--man libguestfs-make-fixed-appliance.1 \
--html $(top_builddir)/html/libguestfs-make-fixed-appliance.1.html \
--license GPLv2+ \
$<
touch $@
supermin.d/daemon.img: ../daemon/guestfsd
mkdir -p supermin.d
rm -f $@ $@-t
rm -rf tmp
mkdir -p tmp$(DAEMON_SUPERMIN_DIR)
ln ../daemon/guestfsd tmp$(DAEMON_SUPERMIN_DIR)/guestfsd
( cd tmp && find | cpio --quiet -o -H newc ) > $@-t
rm -rf tmp
mv $@-t $@
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 $@
# Make clean.
CLEANFILES = packagelist excludelist
CLEANFILES = \
*~ \
libguestfs-make-fixed-appliance.1 \
stamp-libguestfs-make-fixed-appliance.pod
clean-local:
rm -rf supermin.d
DISTCLEANFILES = \
stamp-supermin \
supermin.d/*

54
appliance/excludefiles.in Normal file
View File

@@ -0,0 +1,54 @@
dnl This is the list of files excluded from the appliance, even if
dnl they appear in packagelist.in (or more likely, as dependencies of
dnl packages in packagelist.in).
dnl
dnl List is a list of wildcards, one per line, prefixed by a '-' character.
dnl
dnl This file is processed by m4 with one of the
dnl following symbols defined (depending on the distro):
dnl
dnl REDHAT=1 For Fedora, RHEL, EPEL and workalikes.
dnl DEBIAN=1 For Debian.
dnl UBUNTU=1 For Ubuntu.
dnl ARCHLINUX=1 For Archlinux.
dnl SUSE=1 For OpenSUSE.
dnl FRUGALWARE=1 For Frugalware.
dnl MAGEIA=1 For Mageia.
dnl
dnl Note that any matching file will be dropped from the appliance.
dnl Of course, this may break the appliance, so be careful.
dnl The right kernel modules are added back by supermin.
-/boot/*
-/lib/modules/*
-/usr/lib/locale/*
-/usr/share/locale/*
-/usr/share/man/*
-/usr/share/doc/*
-/usr/share/info/*
-/usr/share/gnome/help/*
-/usr/share/cracklib/*
-/usr/share/i18n/*
-/usr/share/pkgconfig/*
-/var/log/*.log*
-/var/log/cron*
-/var/log/lastlog*
-/var/log/messages*
-/var/log/secure*
-/var/log/syslog*
dnl For Debian:
-/usr/share/lintian/*
-/usr/share/initramfs-tools/*
-/usr/share/doc-base/*
-/usr/share/bug/*
-/etc/initramfs-tools/*
dnl For Ubuntu:
ifelse(UBUNTU,1,
dnl This lvm2 rule automatically re-enables vgs when they are added
dnl or changed
-/lib/udev/rules.d/85-lvm2.rules
)

View File

@@ -1,52 +0,0 @@
/* 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,74 @@
(*
Module: LVM
Parses LVM metadata.
Author: Gabriel de Perthuis <g2p.code+augeas@gmail.com>
About: License
This file is licensed under the LGPL v2+.
About: Configuration files
This lens applies to files in /etc/lvm/backup and /etc/lvm/archive.
About: Examples
The <Test_LVM> file contains various examples and tests.
*)
module Guestfs_LVM_conf =
autoload xfm
(* See lvm2/libdm/libdm-config.c for tokenisation;
* libdm uses a blacklist but I prefer the safer whitelist approach. *)
(* View: identifier
* The left hand side of a definition *)
let identifier = /[a-zA-Z0-9_-]+/
(* strings can contain backslash-escaped dquotes, but I don't know
* how to get the message across to augeas *)
let str = [label "str". Quote.do_dquote (store /([^\"]|\\\\.)*/)]
let int = [label "int". store Rx.relinteger]
(* View: flat_literal
* A literal without structure *)
let flat_literal = int|str
(* allow multiline and mixed int/str, used for raids and stripes *)
(* View: list
* A list containing flat literals *)
let list = [
label "list" . counter "list"
. del /\[[ \t\n]*/ "["
.([seq "list". flat_literal . del /,[ \t\n]*/ ", "]*
. [seq "list". flat_literal . del /[ \t\n]*/ ""])?
. Util.del_str "]"]
(* View: val
* Any value that appears on the right hand side of an assignment *)
let val = flat_literal | list
(* View: nondef
* A line that doesn't contain a statement *)
let nondef =
Util.empty
| Util.comment
(* Build.block couldn't be reused, because of recursion and
* a different philosophy of whitespace handling. *)
(* View: def
* An assignment, or a block containing definitions *)
let rec def = [
Util.indent . key identifier . (
del /[ \t]*\{\n/ " {\n"
.[label "dict".(nondef | def)*]
. Util.indent . Util.del_str "}\n"
|Sep.space_equal . val . Util.comment_or_eol)]
(* View: lns
* The main lens *)
let lns = (nondef | def)*
let filter =
incl "/etc/lvm/archive/*.vg"
. incl "/etc/lvm/backup/*"
. Util.stdexcl
let xfm = transform lns filter

View File

@@ -0,0 +1,72 @@
(*
Module: Shadow
Parses /etc/shadow
Author: Lorenzo M. Catucci <catucci@ccd.uniroma2.it>
Original Author: Free Ekanayaka <free@64studio.com>
About: Reference
- man 5 shadow
- man 3 getspnam
About: License
This file is licensed under the LGPL v2+, like the rest of Augeas.
About:
Each line in the shadow files represents the additional shadow-defined attributes
for the corresponding user, as defined in the passwd file.
*)
module Guestfs_Shadow =
autoload xfm
(************************************************************************
* USEFUL PRIMITIVES
*************************************************************************)
let eol = Util.eol
let comment = Util.comment
let empty = Util.empty
let dels = Util.del_str
let colon = Sep.colon
let word = Rx.word
let integer = Rx.integer
let sto_to_col = Passwd.sto_to_col
let sto_to_eol = Passwd.sto_to_eol
(************************************************************************
* Group: ENTRIES
*************************************************************************)
(* View: entry *)
let entry = [ key word
. colon
. [ label "password" . sto_to_col? . colon ]
. [ label "lastchange_date" . store integer? . colon ]
. [ label "minage_days" . store integer? . colon ]
. [ label "maxage_days" . store integer? . colon ]
. [ label "warn_days" . store integer? . colon ]
. [ label "inactive_days" . store integer? . colon ]
. [ label "expire_date" . store integer? . colon ]
. [ label "flag" . store integer? ]
. eol ]
(************************************************************************
* LENS
*************************************************************************)
let lns = (comment|empty|entry) *
let filter
= incl "/shadow"
. Util.stdexcl
let xfm = transform lns filter

View File

@@ -0,0 +1,27 @@
# 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
}
# aug_setm memory leak
{
aug_setm_leak
Memcheck:Leak
...
fun:aug_setm
}

17
appliance/hostfiles.in Normal file
View File

@@ -0,0 +1,17 @@
dnl This is the list of extra files added to appliance.
dnl
dnl List is a list of wildcards, one per line.
dnl
dnl This file is processed by m4 with one of the
dnl following symbols defined (depending on the distro):
dnl
dnl REDHAT=1 For Fedora, RHEL, EPEL and workalikes.
dnl DEBIAN=1 For Debian.
dnl UBUNTU=1 For Ubuntu.
dnl ARCHLINUX=1 For Archlinux.
dnl SUSE=1 For OpenSUSE.
dnl FRUGALWARE=1 For Frugalware.
dnl MAGEIA=1 For Mageia.
/lib/lsb/*
/usr/share/augeas/lenses/*.aug

View File

@@ -10,61 +10,68 @@ RUNLEVEL=S
PREVLEVEL=N
export RUNLEVEL PREVLEVEL
# Make sure to find all the libraries, also those in non-standard place
# but with a proper ld.so configuration pointing at them
ldconfig
# Try to print a stack trace for segfaults inside the appliance.
for d in /lib64 /lib; do
f=$d/libSegFault.so
if [ -f "$f" ]; then
LD_PRELOAD=$f
export LD_PRELOAD
break
fi
done
mkdir -p /sysroot
rm -f /proc; mkdir /proc
if [ ! -d /proc ]; then rm -f /proc; fi
mkdir -p /proc
mount -t proc /proc /proc
rm -f /sys; mkdir /sys
if [ ! -d /sys ]; then rm -f /sys; fi
mkdir -p /sys
mount -t sysfs /sys /sys
# taken from initramfs-tools/init --Hilko Bengen
mkdir -p /run
mount -t tmpfs -o "nosuid,size=20%,mode=0755" tmpfs /run
mkdir -p /run/lock
ln -s ../run/lock /var/lock
# 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
:
elif [ -x /sbin/udevd ]; then
echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
/sbin/udevd --daemon
/sbin/udevadm trigger
/sbin/udevadm settle
elif [ -x /lib/udev/udevd ]; then
echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
/lib/udev/udevd --daemon
/sbin/udevadm trigger
/sbin/udevadm settle
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 ||:
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
# Find udevd and run it directly.
for f in /sbin/udevd /lib/udev/udevd \
/lib/systemd/systemd-udevd /usr/lib/systemd/systemd-udevd \
/usr/lib/udev/udevd; do
if [ -x "$f" ]; then UDEVD="$f"; fi
done
if [ -z "$UDEVD" ]; then
echo "udev not found! Things will probably not work ..."
fi
$UDEVD --daemon #--debug
udevadm trigger
udevadm settle --timeout=600
if grep -sq selinux=1 /proc/cmdline; then
mount -t selinuxfs none /selinux
mount -t selinuxfs none /sys/fs/selinux
fi
# Set up kmod static-nodes (RHBZ#1011907).
mkdir -p /run/tmpfiles.d
kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf
# Set up tmpfiles (must run after kmod.conf is created above).
systemd-tmpfiles --prefix=/dev --create
# Disk optimizations.
# Increase the SCSI timeout so we can read remote images.
for f in /sys/block/sd*/device/timeout; do echo 300 > $f; done
# https://access.redhat.com/site/solutions/5427
for f in /sys/block/{h,s,ub,v}d*/queue/scheduler; do echo noop > $f; done
# Update the system clock.
hwclock -u -s
@@ -77,25 +84,23 @@ ip link set dev eth0 up
ip route add default via 169.254.2.2
echo nameserver 169.254.2.3 > /etc/resolv.conf
# Scan for MDs.
mdadm -As --auto=yes --run
# Scan for LVM.
modprobe dm_mod ||:
lvmetad ||:
lvm vgscan --ignorelockingfailure
lvm vgchange -ay --ignorelockingfailure
lvm vgchange -aay --sysinit
# Improve virtio-blk performance (RHBZ#509383).
for f in /sys/block/vd*/queue/rotational; do echo 1 > $f; done
# 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
# Scan for Windows dynamic disks.
ldmtool create all
# These are useful when debugging.
if grep -sq guestfs_verbose=1 /proc/cmdline; then
uname -a
ls -lR /dev
cat /proc/mounts
lvm pvs
@@ -106,6 +111,8 @@ if grep -sq guestfs_verbose=1 /proc/cmdline; then
lsmod
#hwclock -r
date
echo -n "clocksource: "
cat /sys/devices/system/clocksource/clocksource0/current_clocksource
#ping -n -v -c 5 10.0.2.2
#ping -n -v -c 5 10.0.2.4
@@ -113,24 +120,37 @@ if grep -sq guestfs_verbose=1 /proc/cmdline; then
fi
if ! grep -sq guestfs_rescue=1 /proc/cmdline; then
# Run the daemon.
# Run the daemon under valgrind if ./configure --enable-valgrind-daemon
vg_channel=/dev/virtio-ports/org.libguestfs.valgrind
if [ -w $vg_channel ]; then
exec 3>$vg_channel
vg="valgrind --leak-check=full --log-fd=3 --error-exitcode=119 --max-stackframe=8388608 --child-silent-after-fork=yes"
if grep -sq guestfs_valgrind_daemon=1 /proc/cmdline; then
if [ -r /etc/guestfsd.suppressions ]; then
suppressions="--suppressions=/etc/guestfsd.suppressions"
fi
vg="valgrind --leak-check=full --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
# Run guestfsd, under valgrind if asked.
$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.
if [ $? -eq 119 ]; then
echo "DAEMON VALGRIND FAILED"
# Sleep so valgrind messages are seen by the host. Note this
# only happens in non-production builds
# (--enable-valgrind-daemon) + on an error path.
sleep 10
fi
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
# Run virt-rescue shell.
# Remove LD_PRELOAD=libSegFault set above.
unset LD_PRELOAD
:> $HOME/.bashrc
grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline >> $HOME/.bashrc
echo "PS1='><rescue> '" >> $HOME/.bashrc
echo "export TERM PS1" >> $HOME/.bashrc
echo
echo "------------------------------------------------------------"
echo
@@ -147,4 +167,9 @@ else
fi
sync
/sbin/reboot -f
if ! grep -sq guestfs_noreboot=1 /proc/cmdline; then
# qemu has the -no-reboot flag, so issuing a reboot here actually
# causes qemu to exit gracefully.
reboot -f
fi

View File

@@ -0,0 +1,161 @@
#!/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.
cachedir="$(guestfish get-cachedir)"
euid="$(id -u)"
appliancedir="$cachedir/.guestfs-$euid/appliance.d"
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 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,178 @@
=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>.
Some reasons why you I<might> want to use this include:
=over 4
=item *
You want to make a self-contained libguestfs appliance that can be
copied to another machine or platform that doesn't support
L<supermin(1)>.
=item *
You have multiple users on the same machine and want to avoid the
storage duplication and start-up overhead of having multiple cached
copies of the appliance.
=item *
You want to have very predictable performance from libguestfs (see
L<guestfs-performance(1)>).
=back
For deeper understanding of why you might need 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<supermin(1)/SUPERMIN APPLIANCE>). libguestfs reconstructs this
into a full appliance by running C<supermin --build>.
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 supermin 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 supermin. You build the fixed appliance on a
platform that does support supermin, 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<supermin(1)>,
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-2014 Red Hat Inc.

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# @configure_input@
# Copyright (C) 2009-2012 Red Hat Inc.
# Copyright (C) 2009-2014 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
@@ -20,47 +20,14 @@ unset CDPATH
set -e
# Turn excludelist file into command line arguments.
exec 5<excludelist
while read regexp <&5; do
excludes="$excludes --exclude $regexp"
done
exec 5<&-
# Run supermin.
# Run febootstrap on the package list.
if [ "x@FEBOOTSTRAP_YUM_CONFIG@" != "xno" ]; then
extra="--yum-config @FEBOOTSTRAP_YUM_CONFIG@"
if [ "x@SUPERMIN_PACKAGER_CONFIG@" != "xno" ]; then
extra="--packager-config @SUPERMIN_PACKAGER_CONFIG@"
fi
if [ "x@SUPERMIN_EXTRA_OPTIONS@" != "xno" ]; then
extra="$extra @SUPERMIN_EXTRA_OPTIONS@"
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
echo @SUPERMIN@ --prepare -v -o supermin.d $(< packagelist ) $extra
@SUPERMIN@ --prepare -v -o supermin.d $(< packagelist ) $extra

View File

@@ -1,136 +1,254 @@
/* This is the list of distro packages which are
* installed on the appliance.
*
* 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.
*
* There is also a list of packages which are excluded if they appear
* as dependencies of the packages below. See: excludelist.in
*/
dnl This is the list of distro packages which are
dnl installed on the appliance.
dnl
dnl This file is processed by m4 with one of the
dnl following symbols defined (depending on the distro):
dnl
dnl REDHAT=1 For Fedora, RHEL, EPEL and workalikes.
dnl DEBIAN=1 For Debian.
dnl UBUNTU=1 For Ubuntu.
dnl ARCHLINUX=1 For Archlinux.
dnl SUSE=1 For OpenSUSE.
dnl FRUGALWARE=1 For Frugalware.
dnl MAGEIA=1 For Mageia.
dnl
dnl There is also a list of packages which are excluded if they appear
dnl as dependencies of the packages below. See: excludelist.in
dnl
dnl To add arbitrary extra packages, use:
dnl
dnl ./configure --with-extra-packages="gdb valgrind [etc]"
/* Basically the same with a few minor tweaks. */
#ifdef UBUNTU
#define DEBIAN 1
#endif
dnl Basically the same with a few minor tweaks.
ifelse(UBUNTU,1,`define(`DEBIAN',1)')
#ifdef REDHAT
ifelse(REDHAT,1,
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. */
cryptsetup-luks dnl old name used before Fedora 17
dnl e4fsprogs only exists on RHEL 5, will be ignored everywhere else.
e4fsprogs
genisoimage
gfs-utils
gfs2-utils
grub
hfsplus-tools
hivex
iproute
iputils
kernel
MAKEDEV
libcap
libldm dnl only Fedora for now, others later
nilfs-utils
ntfsprogs
ntfs-3g
openssh-clients
pcre
reiserfs-utils
libselinux
systemd /* for /sbin/reboot */
udev
util-linux-ng
syslinux-extlinux
systemd dnl for /sbin/reboot and udevd
vim-minimal
xz
yajl
zfs-fuse
#endif /* REDHAT */
)
#ifdef DEBIAN
ifelse(DEBIAN,1,
bsdmainutils
btrfs-tools
cryptsetup
diff
e2fsprogs
extlinux
genisoimage
dnl gfs-tools, gfs2-tools have been renamed to gfs2-utils
gfs-tools
gfs2-tools
grub-pc
gfs2-utils
grub2-common
hfsplus
dnl iproute has been renamed to iproute2
iproute
iproute2
iputils-ping
iputils-arping
iputils-tracepath
libaugeas0
libc-bin
libcap2
libhivex0
libpcre3
libsystemd0
libsystemd-id128-0
libsystemd-journal0
libyajl2
linux-image
dnl syslinux 'suggests' mtools, but in reality it's a hard dependency:
mtools
nilfs-tools
ntfs-3g
ntfsprogs
openssh-client
reiserfsprogs
udev
sysvinit dnl for /sbin/reboot
systemd dnl alternative for /sbin/reboot
ufsutils
util-linux
vim-tiny
xz-utils
zfs-fuse
#endif /* DEBIAN */
)
#ifdef ARCHLINUX
linux
vim
btrfs-progs-unstable
cryptsetup
diffutils
ifelse(ARCHLINUX,1,
augeas
zfs-fuse
e2fsprogs
btrfs-progs
cdrkit
cryptsetup
grub
hivex
iproute2
iputils
libcap
linux
lrzip
dnl syslinux has mtools as optional dependency, but in reality it's
dnl a hard one:
mtools
nilfs-utils
ntfsprogs
ntfs-3g
pcre
reiserfsprogs
udev
util-linux-ng
systemd
vim
xz
#endif /* ARCHLINUX */
yajl
zfs-fuse
)
ifelse(SUSE,1,
augeas
dnl It seems no other augeas package depends on it.
augeas-lenses
btrfsprogs
cryptsetup
genisoimage
glibc-locale
gptfdisk
hivex
iproute2
iputils
libcap2
libselinux1
mkisofs
reiserfs
systemd
vim
xz
)
ifelse(FRUGALWARE,1,
augeas
btrfs-progs
cryptsetup-luks
cdrkit
grub2
hfsplus
iproute2
iputils
kernel
libcap
ntfsprogs
ntfs-3g
openssh
pcre
reiserfsprogs
systemd
vim
xz
yajl
xfsprogs-acl
xfsprogs-attr
gptfdisk
)
ifelse(MAGEIA,1,
augeas
btrfs-progs
cryptsetup
chkconfig /* for /etc/init.d */
cdrkit-genisoimage
cdrkit-isotools
extlinux
gfs2-utils
grub
hfsplus-tools
hivex
iproute2
iputils
libcap
dnl syslinux uses mtools without depending on it
mtools
nilfs-utils
ntfsprogs
ntfs-3g
openssh-clients
pcre
reiserfs-utils
libselinux
systemd /* for /sbin/reboot and udevd */
vim-minimal
xz
yajl
module-init-tools
procps-ng
udev
)
acl
attr
bash
binutils
bzip2
coreutils
cpio
diffutils
dosfstools
e2fsprogs
file
findutils
gawk
gdisk
grep
gzip
iproute
jfsutils
kmod
less
libxml2
lsof
lsscsi
lvm2
lzop
mdadm
module-init-tools
/*
Enabling this pulls out 140 extra packages
into the appliance:
ocfs2-tools
*/
dnl Enabling this pulls out 140 extra packages
dnl into the appliance:
dnl ocfs2-tools
parted
procps
procps-ng
psmisc
rsync
scrub
sed
strace
syslinux
tar
#ifndef UBUNTU
/* on Ubuntu contains a file in /lib64 which conflicts with libc6 that has
* /lib64 as a symbolic link
*/
udev
util-linux
util-linux-ng
xfsprogs
#endif
zerofree
#ifdef VALGRIND_DAEMON
valgrind
#endif
ifelse(VALGRIND_DAEMON,1,valgrind)
dnl Define this by doing: ./configure --with-extra-packages="..."
EXTRA_PACKAGES

View File

@@ -44,7 +44,7 @@ fi
# If no arguments were specified and configure has run before, use the previous
# arguments
if test $# == 0 && test -x ./config.status; then
if test $# -eq 0 && test -x ./config.status; then
./config.status --recheck
else
$CONFIGUREDIR/configure "$@"

74
bash/Makefile.am Normal file
View File

@@ -0,0 +1,74 @@
# libguestfs
# Copyright (C) 2013 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
scripts = \
guestfish \
guestmount \
virt-alignment-scan \
virt-builder \
virt-cat \
virt-df \
virt-edit \
virt-filesystems \
virt-format \
virt-inspector \
virt-log \
virt-ls \
virt-rescue \
virt-resize \
virt-sparsify \
virt-sysprep
EXTRA_DIST = \
README \
$(scripts)
# Some of the scripts are simply symbolic links.
virt-cat:
ln -sf virt-alignment-scan $@
virt-df:
ln -sf virt-alignment-scan $@
virt-edit:
ln -sf virt-alignment-scan $@
virt-filesystems:
ln -sf virt-alignment-scan $@
virt-format:
ln -sf virt-alignment-scan $@
virt-inspector:
ln -sf virt-alignment-scan $@
virt-log:
ln -sf virt-alignment-scan $@
virt-ls:
ln -sf virt-alignment-scan $@
virt-sysprep:
ln -sf virt-alignment-scan $@
virt-builder:
ln -sf virt-resize $@
virt-sparsify:
ln -sf virt-resize $@
if HAVE_BASH_COMPLETION
# Bash completion script.
bashcompletiondir = $(BASH_COMPLETIONS_DIR)
bashcompletion_DATA = $(scripts)
endif

3
bash/README Normal file
View File

@@ -0,0 +1,3 @@
This directory contains the scripts for tab-completing commands in
bash. Note these new-style demand-loaded scripts require
'bash-completion' >= 1.99.

72
bash/guestfish Normal file
View File

@@ -0,0 +1,72 @@
# guestfish bash completion script -*- shell-script -*-
# Copyright (C) 2010-2014 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.
# List all local libvirt domains.
_guestfs_virsh_list ()
{
local flag_ro=$1 flags
if [ "$flag_ro" -eq 1 ]; then
flags="--all"
else
flags="--inactive"
fi
virsh list $flags | head -n -1 | tail -n +3 | awk '{print $2}'
}
_guestfish ()
{
local cur prev words cword split
local longopts flag_ro=0 c=1 word cmds doms
_init_completion -s || return
longopts="$(guestfish --long-options)"
# See if user has specified certain options anywhere on the
# command line before the current word.
while [ $c -lt $COMP_CWORD ]; do
word="${COMP_WORDS[c]}"
case "$word" in
-r|--ro) flag_ro=1 ;;
esac
c=$((++c))
done
case "$prev" in
-a|--add)
COMPREPLY=( $(compgen "$cur") )
return ;;
-d|--domain)
doms=$(_guestfs_virsh_list "$flag_ro")
COMPREPLY=( $(compgen -W "$doms" -- "$cur") )
return ;;
esac
case "$cur" in
--*)
# --options
COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
return ;;
*)
# Might be a guestfish command.
cmds=$(guestfish -h| head -n -1 | tail -n +2 | awk '{print $1}')
COMPREPLY=( $(compgen -W "$cmds" -- "$cur") )
return ;;
esac
} &&
complete -o default -F _guestfish guestfish

67
bash/guestmount Normal file
View File

@@ -0,0 +1,67 @@
# guestmount bash completion script -*- shell-script -*-
# Copyright (C) 2010-2014 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.
# List all local libvirt domains.
_guestfs_virsh_list ()
{
local flag_ro=$1 flags
if [ "$flag_ro" -eq 1 ]; then
flags="--all"
else
flags="--inactive"
fi
virsh list $flags | head -n -1 | tail -n +3 | awk '{print $2}'
}
_guestmount ()
{
local cur prev words cword split
local longopts flag_ro=0 c=1 word doms
_init_completion -s || return
longopts="$(guestmount --long-options)"
# See if user has specified certain options anywhere on the
# command line before the current word.
while [ $c -lt $COMP_CWORD ]; do
word="${COMP_WORDS[c]}"
case "$word" in
-r|--ro) flag_ro=1 ;;
esac
c=$((++c))
done
case "$prev" in
-d|--domain)
doms=$(_guestfs_virsh_list "$flag_ro")
COMPREPLY=( $(compgen -W "$doms" -- "$cur") )
return ;;
esac
case "$cur" in
--*)
# --options
COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
return ;;
*)
COMPREPLY=( $(compgen "$cur") )
return ;;
esac
} &&
complete -o default -F _guestmount guestmount

108
bash/virt-alignment-scan Normal file
View File

@@ -0,0 +1,108 @@
# virt-tools bash completion script -*- shell-script -*-
# Copyright (C) 2010-2014 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.
# List all local libvirt domains.
_guestfs_virsh_list ()
{
local flag_ro=$1 flags
if [ "$flag_ro" -eq 1 ]; then
flags="--all"
else
flags="--inactive"
fi
virsh list $flags | head -n -1 | tail -n +3 | awk '{print $2}'
}
_guestfs_virttools ()
{
local cur prev words cword split
local longopts="$1" flag_ro="$2" doms
_init_completion -s || return
case "$prev" in
-d|--domain)
doms=$(_guestfs_virsh_list "$flag_ro")
COMPREPLY=( $(compgen -W "$doms" -- "$cur") )
return ;;
esac
case "$cur" in
--*)
# --options
COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
return ;;
*)
COMPREPLY=( $(compgen "$cur") )
return ;;
esac
}
_virt_alignment_scan ()
{
_guestfs_virttools "$(virt-alignment-scan --long-options)" 1
} &&
complete -o default -F _virt_alignment_scan virt-alignment-scan
_virt_cat ()
{
_guestfs_virttools "$(virt-cat --long-options)" 1
} &&
complete -o default -F _virt_cat virt-cat
_virt_df ()
{
_guestfs_virttools "$(virt-df --long-options)" 1
} &&
complete -o default -F _virt_df virt-df
_virt_edit ()
{
_guestfs_virttools "$(virt-edit --long-options)" 0
} &&
complete -o default -F _virt_edit virt-edit
_virt_filesystems ()
{
_guestfs_virttools "$(virt-filesystems --long-options)" 1
} &&
complete -o default -F _virt_filesystems virt-filesystems
_virt_format ()
{
_guestfs_virttools "$(virt-format --long-options)" 0
} &&
complete -o default -F _virt_format virt-format
_virt_inspector ()
{
_guestfs_virttools "$(virt-inspector --long-options)" 1
} &&
complete -o default -F _virt_inspector virt-inspector
_virt_ls ()
{
_guestfs_virttools "$(virt-ls --long-options)" 1
} &&
complete -o default -F _virt_ls virt-ls
_virt_sysprep ()
{
_guestfs_virttools "$(virt-sysprep --long-options)" 0
} &&
complete -o default -F _virt_sysprep virt-sysprep

67
bash/virt-rescue Normal file
View File

@@ -0,0 +1,67 @@
# virt-rescue bash completion script -*- shell-script -*-
# Copyright (C) 2010-2014 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.
# List all local libvirt domains.
_guestfs_virsh_list ()
{
local flag_ro=$1 flags
if [ "$flag_ro" -eq 1 ]; then
flags="--all"
else
flags="--inactive"
fi
virsh list $flags | head -n -1 | tail -n +3 | awk '{print $2}'
}
_virt_rescue ()
{
local cur prev words cword split
local longopts flag_ro=0 c=1 word doms
_init_completion -s || return
longopts="$(virt-rescue --long-options)"
# See if user has specified certain options anywhere on the
# command line before the current word.
while [ $c -lt $COMP_CWORD ]; do
word="${COMP_WORDS[c]}"
case "$word" in
-r|--ro) flag_ro=1 ;;
esac
c=$((++c))
done
case "$prev" in
-d|--domain)
doms=$(_guestfs_virsh_list "$flag_ro")
COMPREPLY=( $(compgen -W "$doms" -- "$cur") )
return ;;
esac
case "$cur" in
--*)
# --options
COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
return ;;
*)
COMPREPLY=( $(compgen "$cur") )
return ;;
esac
} &&
complete -o default -F _virt_rescue virt-rescue

53
bash/virt-resize Normal file
View File

@@ -0,0 +1,53 @@
# virt-resize, virt-builder, virt-sparsify bash completion script
# -*- shell-script -*-
# Copyright (C) 2010-2014 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.
_guestfs_options_only ()
{
local cur prev words cword split
local longopts="$1"
_init_completion -s || return
case "$cur" in
--*)
# --options
COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
return ;;
*)
COMPREPLY=( $(compgen "$cur") )
return ;;
esac
}
_virt_builder ()
{
_guestfs_options_only "$(virt-builder --long-options)"
} &&
complete -o default -F _virt_builder virt-builder
_virt_resize ()
{
_guestfs_options_only "$(virt-resize --long-options)"
} &&
complete -o default -F _virt_resize virt-resize
_virt_sparsify ()
{
_guestfs_options_only "$(virt-sparsify --long-options)"
} &&
complete -o default -F _virt_sparsify virt-sparsify

View File

@@ -9,8 +9,9 @@ false
<61><62><63><00><61><62><63>
obool: true
oint: 1
oint64: unset
oint64: 9223372036854775807
ostring: unset
ostringlist: unset
abc
null
[]
@@ -24,6 +25,7 @@ obool: unset
oint: unset
oint64: 1
ostring: string
ostringlist: unset
def
[]
@@ -35,8 +37,9 @@ false
<61><62><63><00><61><62><63>
obool: false
oint: unset
oint64: unset
oint64: -9223372036854775808
ostring: unset
ostringlist: unset
[]
@@ -50,6 +53,7 @@ obool: unset
oint: unset
oint64: unset
ostring: unset
ostringlist: unset
abc
def
["1"]
@@ -63,6 +67,7 @@ obool: unset
oint: unset
oint64: unset
ostring: unset
ostringlist: unset
abc
def
["1", "2"]
@@ -76,6 +81,7 @@ obool: unset
oint: unset
oint64: unset
ostring: unset
ostringlist: unset
abc
def
["1"]
@@ -89,6 +95,7 @@ obool: unset
oint: unset
oint64: unset
ostring: unset
ostringlist: unset
abc
def
["1"]
@@ -102,6 +109,7 @@ obool: unset
oint: unset
oint64: unset
ostring: unset
ostringlist: unset
abc
def
["1"]
@@ -115,6 +123,7 @@ obool: unset
oint: unset
oint64: unset
ostring: unset
ostringlist: unset
abc
def
["1"]
@@ -128,6 +137,7 @@ obool: unset
oint: unset
oint64: unset
ostring: unset
ostringlist: unset
abc
def
["1"]
@@ -141,12 +151,13 @@ obool: unset
oint: unset
oint64: unset
ostring: unset
ostringlist: unset
abc
def
["1"]
false
4095
4095
9223372036854775807
123
456
<61><62><63><00><61><62><63>
@@ -154,12 +165,13 @@ obool: unset
oint: unset
oint64: unset
ostring: unset
ostringlist: unset
abc
def
["1"]
false
0
0
-9223372036854775808
<61><62><63><00><61><62><63>
@@ -167,4 +179,61 @@ obool: unset
oint: unset
oint64: unset
ostring: unset
ostringlist: unset
abc
def
[]
false
0
0
123
456
<61><62><63><00><61><62><63>
obool: unset
oint: unset
oint64: unset
ostring: unset
ostringlist: []
abc
def
[]
false
0
0
123
456
<61><62><63><00><61><62><63>
obool: unset
oint: unset
oint64: unset
ostring: unset
ostringlist: ["optelem1"]
abc
def
[]
false
0
0
123
456
<61><62><63><00><61><62><63>
obool: unset
oint: unset
oint64: unset
ostring: unset
ostringlist: ["optelem1", "optelem2"]
abc
def
[]
false
0
0
123
456
<61><62><63><00><61><62><63>
obool: unset
oint: unset
oint64: unset
ostring: unset
ostringlist: ["optelem1", "optelem2", "optelem3"]
EOF

View File

@@ -26,13 +26,6 @@ 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.
@@ -41,16 +34,22 @@ libtoolize --copy --install
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
<$gnulib_tool || exit
(cd daemon && mkdir -p tests lib && ../$gnulib_tool --update)
(cd daemon && mkdir -p tests lib && ../$gnulib_tool --dir=.. --update)
modules='
accept4
areadlink
areadlinkat
arpa_inet
byteswap
c-ctype
cloexec
closeout
connect
dup3
error
filevercmp
fstatat
fsusage
fts
full-read
@@ -69,19 +68,22 @@ ignore-value
lock
maintainer-makefile
manywarnings
memmem
mkdtemp
mkstemps
netdb
netinet_in
openat
perror
pipe2
pread
progname
read-file
readlink
select
setenv
sleep
socket
stat-time
strchrnul
strerror
strndup
@@ -98,8 +100,12 @@ xstrtoll
xvasprintf
'
# If any tests fail, avoid including them by adding them to
# this list.
avoid="--avoid=dummy --avoid=getlogin_r-tests"
$gnulib_tool \
--avoid=dummy \
$avoid \
--with-tests \
--m4-base=m4 \
--source-base=gnulib/lib \

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# bugs-in-changelog.sh
# Copyright (C) 2009-2012 Red Hat Inc.
# Copyright (C) 2009-2014 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
@@ -16,10 +16,10 @@
# 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:
# Used when preparing the guestfs-release-notes(1) man page. 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.."
@@ -42,5 +42,10 @@ 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
--outputformat='%{bug_id} %{short_desc}' |
sort -n -r |
perl -pe '
s{([0-9]+)\s+(.*)}{
sprintf ("=item L<https://bugzilla.redhat.com/%s>\n\n%s\n",
$1, $2)
}xe'

328
builder/Makefile.am Normal file
View File

@@ -0,0 +1,328 @@
# libguestfs virt-builder tool
# Copyright (C) 2013 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
AM_YFLAGS = -d
AM_CFLAGS = \
-I$(shell $(OCAMLC) -where) \
-I$(top_srcdir)/gnulib/lib \
-I$(top_srcdir)/src \
-I$(top_srcdir)/fish \
-pthread \
$(LIBLZMA_CFLAGS)
EXTRA_DIST = \
$(SOURCES) \
libguestfs.gpg \
test-index \
test-virt-builder.sh \
test-virt-builder-list.sh \
test-virt-builder-planner.sh \
test-virt-index-validate.sh \
test-virt-index-validate-bad-1 \
test-virt-index-validate-good-1 \
test-virt-index-validate-good-2 \
virt-builder.pod \
virt-index-validate.pod
CLEANFILES = *~ *.cmi *.cmo *.cmx *.cmxa *.o virt-builder
# Alphabetical order.
SOURCES = \
architecture.ml \
builder.ml \
cache.mli \
cache.ml \
cmdline.ml \
downloader.mli \
downloader.ml \
get_kernel.mli \
get_kernel.ml \
index_parser.mli \
index_parser.ml \
index-parser-c.c \
ini_reader.mli \
ini_reader.ml \
languages.mli \
languages.ml \
list_entries.mli \
list_entries.ml \
paths.ml \
pxzcat.ml \
pxzcat.mli \
pxzcat-c.c \
setlocale.ml \
setlocale.mli \
setlocale-c.c \
sigchecker.mli \
sigchecker.ml \
sources.mli \
sources.ml \
uname.ml \
uname.mli \
uname-c.c
man_MANS =
noinst_DATA =
if HAVE_OCAML
# Note this list must be in dependency order.
deps = \
$(top_builddir)/mllib/libdir.cmx \
$(top_builddir)/mllib/config.cmx \
$(top_builddir)/mllib/common_gettext.cmx \
$(top_builddir)/mllib/common_utils.cmx \
$(top_builddir)/mllib/fsync-c.o \
$(top_builddir)/mllib/fsync.cmx \
$(top_builddir)/mllib/planner.cmx \
$(top_builddir)/mllib/regedit.cmx \
$(top_builddir)/mllib/uri-c.o \
$(top_builddir)/mllib/uRI.cmx \
$(top_builddir)/mllib/mkdtemp-c.o \
$(top_builddir)/mllib/mkdtemp.cmx \
$(top_builddir)/customize/urandom.cmx \
$(top_builddir)/customize/random_seed.cmx \
$(top_builddir)/customize/hostname.cmx \
$(top_builddir)/customize/timezone.cmx \
$(top_builddir)/customize/firstboot.cmx \
$(top_builddir)/customize/perl_edit-c.o \
$(top_builddir)/customize/perl_edit.cmx \
$(top_builddir)/customize/crypt-c.o \
$(top_builddir)/customize/crypt.cmx \
$(top_builddir)/customize/password.cmx \
$(top_builddir)/customize/customize_cmdline.cmx \
$(top_builddir)/customize/customize_run.cmx \
$(top_builddir)/fish/guestfish-uri.o \
$(top_builddir)/fish/guestfish-file-edit.o \
index-scan.o \
index-struct.o \
index-parse.o \
index-parser-c.o \
pxzcat-c.o \
pxzcat.cmx \
setlocale-c.o \
setlocale.cmx \
uname-c.o \
uname.cmx \
architecture.cmx \
ini_reader.cmx \
paths.cmx \
languages.cmx \
get_kernel.cmx \
cache.cmx \
downloader.cmx \
sigchecker.cmx \
index_parser.cmx \
list_entries.cmx \
sources.cmx \
cmdline.cmx \
builder.cmx
if HAVE_OCAMLOPT
OBJECTS = $(deps)
else
OBJECTS = $(patsubst %.cmx,%.cmo,$(deps))
endif
bin_SCRIPTS = virt-builder
# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
# option to be passed to gcc, so we don't try linking against an
# installed copy of libguestfs.
OCAMLPACKAGES = \
-package str,unix \
-I $(top_builddir)/src/.libs \
-I $(top_builddir)/ocaml \
-I $(top_builddir)/mllib \
-I $(top_builddir)/customize
if HAVE_OCAML_PKG_GETTEXT
OCAMLPACKAGES += -package gettext-stub
endif
OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX-3 $(OCAMLPACKAGES)
OCAMLOPTFLAGS = $(OCAMLCFLAGS)
OCAMLCLIBS = \
$(LIBLZMA_LIBS) \
$(LIBXML2_LIBS) \
-L../src/.libs -lutils \
-L../gnulib/lib/.libs -lgnu \
-pthread -lpthread \
-lncurses -lcrypt
if HAVE_OCAMLOPT
virt-builder: $(OBJECTS)
$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
mlguestfs.cmxa -linkpkg $^ \
-cclib '$(OCAMLCLIBS)' \
-o $@
else
virt-builder: $(OBJECTS)
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) \
mlguestfs.cma -linkpkg $^ \
-cclib '$(OCAMLCLIBS)' \
-custom \
-o $@
endif
.mli.cmi:
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
.ml.cmo:
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
if HAVE_OCAMLOPT
.ml.cmx:
$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@
endif
# Manual pages and HTML files for the website.
man_MANS += virt-builder.1
noinst_DATA += $(top_builddir)/html/virt-builder.1.html
virt-builder.1 $(top_builddir)/html/virt-builder.1.html: stamp-virt-builder.pod
stamp-virt-builder.pod: virt-builder.pod $(top_srcdir)/customize/customize-synopsis.pod $(top_srcdir)/customize/customize-options.pod
$(PODWRAPPER) \
--man virt-builder.1 \
--html $(top_builddir)/html/virt-builder.1.html \
--insert $(top_srcdir)/customize/customize-synopsis.pod:__CUSTOMIZE_SYNOPSIS__ \
--insert $(top_srcdir)/customize/customize-options.pod:__CUSTOMIZE_OPTIONS__ \
--license GPLv2+ \
$<
touch $@
CLEANFILES += stamp-virt-builder.pod
# Tests.
TESTS_ENVIRONMENT = $(top_builddir)/run --test
disk_images := \
$(shell for f in debian fedora ubuntu windows; do if [ -s "../tests/guests/$$f.img" ]; then echo $$f.xz; fi; done) \
$(shell if [ -s "../tests/guests/fedora.img" ]; then echo fedora.qcow2 fedora.qcow2.xz; fi)
CLEANFILES += *.qcow2 *.xz
check_DATA = $(disk_images)
fedora.qcow2: ../tests/guests/fedora.img
rm -f $@ $@-t
qemu-img convert -f raw -O qcow2 $< $@-t
mv $@-t $@
fedora.qcow2.xz: fedora.qcow2
rm -f $@ $@-t
xz --best -c $< > $@-t
mv $@-t $@
%.xz: ../tests/guests/%.img
rm -f $@ $@-t
xz --best -c $< > $@-t
mv $@-t $@
TESTS = \
test-virt-builder-list.sh \
test-virt-index-validate.sh
if ENABLE_APPLIANCE
TESTS += test-virt-builder.sh
endif ENABLE_APPLIANCE
check-valgrind:
$(MAKE) VG="$(top_builddir)/run @VG@" check
check-slow:
$(MAKE) TESTS="test-virt-builder-planner.sh" check
# Dependencies.
depend: .depend
.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
rm -f $@ $@-t
$(OCAMLFIND) ocamldep -I ../ocaml -I $(abs_srcdir) -I $(abs_top_builddir)/mllib -I $(abs_top_builddir)/customize $^ | \
$(SED) 's/ *$$//' | \
$(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
$(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
sort > $@-t
mv $@-t $@
-include .depend
endif
DISTCLEANFILES = .depend
.PHONY: depend docs
# virt-builder's default repository
repoconfdir = $(sysconfdir)/xdg/virt-builder/repos.d
repoconf_DATA = libguestfs.conf libguestfs.gpg
install-exec-hook:
$(LN_S) xdg/virt-builder $(DESTDIR)$(sysconfdir)/virt-builder
# Build a small C index validator program.
bin_PROGRAMS = virt-index-validate
virt_index_validate_SOURCES = \
index-parse.y \
index-scan.l \
index-struct.h \
index-struct.c \
index-validate.c
virt_index_validate_CPPFLAGS = \
-DLOCALEBASEDIR=\""$(datadir)/locale"\"
virt_index_validate_LDADD = \
../gnulib/lib/libgnu.la
man_MANS += virt-index-validate.1
noinst_DATA += $(top_builddir)/html/virt-index-validate.1.html
virt-index-validate.1 $(top_builddir)/html/virt-index-validate.1.html: stamp-virt-index-validate.pod
stamp-virt-index-validate.pod: virt-index-validate.pod
$(PODWRAPPER) \
--man virt-index-validate.1 \
--html $(top_builddir)/html/virt-index-validate.1.html \
--license GPLv2+ \
$<
touch $@
CLEANFILES += \
index-parse.c \
index-parse.h \
index-scan.c \
stamp-virt-index-validate.pod
if HAVE_OCAML
# Automake-generated makefile has a rule ".l.c:" but lacks a rule ".l.h:".
# Also it doesn't generate dependencies for the C files that include
# index-parse.h.
index-parser-c.c index-scan.c index-validate.c: index-parse.h
index-parse.h: index-parse.y
$(MAKE) index-parse.h
endif
# Apparently there's no clean way with Automake to not have them
# in the distribution, so just remove them from the distdir.
dist-hook:
rm -f $(distdir)/index-parse.c $(distdir)/index-parse.h $(distdir)/index-scan.c

41
builder/architecture.ml Normal file
View File

@@ -0,0 +1,41 @@
(* virt-builder
* Copyright (C) 2014 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.
*)
open Common_gettext.Gettext
open Common_utils
open Unix
let filter_arch = function
| "amd64" | "x86_64" | "x64" -> "x86_64"
| "powerpc" | "ppc" -> "ppc"
| arch -> arch
let arch_is_compatible nativearch otherarch =
let nativearch = filter_arch nativearch in
let otherarch = filter_arch otherarch in
match nativearch, otherarch with
| a, b when a = b -> true
| "x86_64", "i386" -> true
| "ppc64", "ppc" -> true
| "sparc64", "sparc" -> true
| a, b -> false
let current_arch =
try filter_arch ((Uname.uname ()).Uname.machine)
with Unix_error _ -> "unknown"

739
builder/builder.ml Normal file
View File

@@ -0,0 +1,739 @@
(* virt-builder
* Copyright (C) 2013 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.
*)
open Common_gettext.Gettext
module G = Guestfs
open Common_utils
open Password
open Planner
open Cmdline
open Customize_cmdline
open Unix
open Printf
let quote = Filename.quote
let prog = Filename.basename Sys.executable_name
let () = Random.self_init ()
let remove_duplicates index =
(* Fill an hash with the higher revision of the available
* (name, arch) tuples, so it possible to ignore duplicates,
* and versions with a lower revision.
*)
let nseen = Hashtbl.create 13 in
List.iter (
fun (name, { Index_parser.arch = arch; revision = revision }) ->
let id = name, arch in
try
let rev = Hashtbl.find nseen id in
if revision > rev then
Hashtbl.replace nseen id revision
with Not_found ->
Hashtbl.add nseen id revision
) index;
List.filter (
fun (name, { Index_parser.arch = arch; revision = revision }) ->
let id = name, arch in
try
let rev = Hashtbl.find nseen (name, arch) in
(* Take the first occurrency with the higher revision,
* removing it from the hash so the other occurrencies
* are ignored.
*)
if revision = rev then (
Hashtbl.remove nseen id;
true
) else
false
with Not_found ->
(* Already taken, so ignore. *)
false
) index
let main () =
(* Command line argument parsing - see cmdline.ml. *)
let mode, arg,
arch, attach, cache, check_signature, curl,
delete_on_failure, format, gpg, list_format, memsize,
network, ops, output, quiet, size, smp, sources, sync,
trace, verbose =
parse_cmdline () in
(* Timestamped messages in ordinary, non-debug non-quiet mode. *)
let msg fs = make_message_function ~quiet fs in
(* If debugging, echo the command line arguments and the sources. *)
if verbose then (
eprintf "command line:";
List.iter (eprintf " %s") (Array.to_list Sys.argv);
prerr_newline ();
iteri (
fun i (source, fingerprint) ->
eprintf "source[%d] = (%S, %S)\n" i source fingerprint
) sources
);
(* Handle some modes here, some later on. *)
let mode =
match mode with
| `Get_kernel -> (* --get-kernel is really a different program ... *)
Get_kernel.get_kernel ~trace ~verbose ?format ?output arg;
exit 0
| `Delete_cache -> (* --delete-cache *)
(match cache with
| Some cachedir ->
msg "Deleting: %s" cachedir;
Cache.clean_cachedir cachedir;
exit 0
| None ->
eprintf (f_"%s: error: could not find cache directory. Is $HOME set?\n")
prog;
exit 1
)
| (`Install|`List|`Notes|`Print_cache|`Cache_all) as mode -> mode in
(* Check various programs/dependencies are installed. *)
(* Check that gpg is installed. Optional as long as the user
* disables all signature checks.
*)
let cmd = sprintf "%s --help >/dev/null 2>&1" gpg in
if Sys.command cmd <> 0 then (
if check_signature then (
eprintf (f_"%s: gpg is not installed (or does not work)\nYou should install gpg, or use --gpg option, or use --no-check-signature.\n") prog;
exit 1
)
else if verbose then
warning ~prog (f_"gpg program is not available")
);
(* Check that curl works. *)
let cmd = sprintf "%s --help >/dev/null 2>&1" curl in
if Sys.command cmd <> 0 then (
eprintf (f_"%s: curl is not installed (or does not work)\n") prog;
exit 1
);
(* Check that virt-resize works. *)
let cmd = "virt-resize --help >/dev/null 2>&1" in
if Sys.command cmd <> 0 then (
eprintf (f_"%s: virt-resize is not installed (or does not work)\n") prog;
exit 1
);
(* Create the cache. *)
let cache =
match cache with
| None -> None
| Some dir ->
try Some (Cache.create ~verbose ~directory:dir)
with exn ->
warning ~prog (f_"cache %s: %s") dir (Printexc.to_string exn);
warning ~prog (f_"disabling the cache");
None
in
(* Download the sources. *)
let downloader = Downloader.create ~verbose ~curl ~cache in
let repos = Sources.read_sources ~prog ~verbose in
let repos = List.map (
fun { Sources.uri = uri; Sources.gpgkey = gpgkey; Sources.proxy = proxy } ->
let gpgkey =
match gpgkey with
| None -> Sigchecker.No_Key
| Some key -> Sigchecker.KeyFile key in
uri, gpgkey, proxy
) repos in
let sources = List.map (
fun (source, fingerprint) ->
source, Sigchecker.Fingerprint fingerprint, Downloader.SystemProxy
) sources in
let sources = List.append repos sources in
let index : Index_parser.index =
List.concat (
List.map (
fun (source, key, proxy) ->
let sigchecker =
Sigchecker.create ~verbose ~gpg ~check_signature ~gpgkey:key in
Index_parser.get_index ~prog ~verbose ~downloader ~sigchecker ~proxy source
) sources
) in
let index = remove_duplicates index in
(* Now handle the remaining modes. *)
let mode =
match mode with
| `List -> (* --list *)
List_entries.list_entries ~list_format ~sources index;
exit 0
| `Print_cache -> (* --print-cache *)
(match cache with
| Some cache ->
let l = List.filter (
fun (_, { Index_parser.hidden = hidden }) ->
hidden <> true
) index in
let l = List.map (
fun (name, { Index_parser.revision = revision; arch = arch }) ->
(name, arch, revision)
) l in
Cache.print_item_status cache ~header:true l
| None -> printf (f_"no cache directory\n")
);
exit 0
| `Cache_all -> (* --cache-all-templates *)
(match cache with
| None ->
eprintf (f_"%s: error: no cache directory\n") prog;
exit 1
| Some _ ->
List.iter (
fun (name,
{ Index_parser.revision = revision; file_uri = file_uri;
proxy = proxy }) ->
let template = name, arch, revision in
msg (f_"Downloading: %s") file_uri;
let progress_bar = not quiet in
ignore (Downloader.download ~prog downloader ~template ~progress_bar
~proxy file_uri)
) index;
exit 0
);
| (`Install|`Notes) as mode -> mode in
(* Which os-version (ie. index entry)? *)
let arg =
(* Try to resolve the alias. *)
try
let item =
List.find (
fun (name, { Index_parser.aliases = aliases }) ->
match aliases with
| None -> false
| Some l -> List.mem arg l
) index in
fst item
with Not_found -> arg in
let item =
try List.find (
fun (name, { Index_parser.arch = a }) ->
name = arg && arch = Architecture.filter_arch a
) index
with Not_found ->
eprintf (f_"%s: cannot find os-version '%s' with architecture '%s'.\nUse --list to list available guest types.\n")
prog arg arch;
exit 1 in
let entry = snd item in
let sigchecker = entry.Index_parser.sigchecker in
(match mode with
| `Notes -> (* --notes *)
let notes =
Languages.find_notes (Languages.languages ()) entry.Index_parser.notes in
(match notes with
| notes :: _ ->
print_endline notes
| [] ->
printf (f_"There are no notes for %s\n") arg
);
exit 0
| `Install ->
() (* fall through to create the guest *)
);
(* --- If we get here, we want to create a guest. --- *)
(* Download the template, or it may be in the cache. *)
let template =
let template, delete_on_exit =
let { Index_parser.revision = revision; file_uri = file_uri;
proxy = proxy } = entry in
let template = arg, arch, revision in
msg (f_"Downloading: %s") file_uri;
let progress_bar = not quiet in
Downloader.download ~prog downloader ~template ~progress_bar ~proxy
file_uri in
if delete_on_exit then unlink_on_exit template;
template in
(* Check the signature of the file. *)
let () =
match entry with
(* New-style: Using a checksum. *)
| { Index_parser.checksum_sha512 = Some csum } ->
Sigchecker.verify_checksum sigchecker (Sigchecker.SHA512 csum) template
| { Index_parser.checksum_sha512 = None } ->
(* Old-style: detached signature. *)
let sigfile =
match entry with
| { Index_parser.signature_uri = None } -> None
| { Index_parser.signature_uri = Some signature_uri } ->
let sigfile, delete_on_exit =
Downloader.download ~prog downloader signature_uri in
if delete_on_exit then unlink_on_exit sigfile;
Some sigfile in
Sigchecker.verify_detached sigchecker template sigfile in
(* For an explanation of the Planner, see:
* http://rwmj.wordpress.com/2013/12/14/writing-a-planner-to-solve-a-tricky-programming-optimization-problem/
*)
(* Planner: Input tags. *)
let itags =
let { Index_parser.size = size; format = format } = entry in
let format_tag =
match format with
| None -> []
| Some format -> [`Format, format] in
let compression_tag =
match detect_compression template with
| `XZ -> [ `XZ, "" ]
| `Unknown -> [] in
[ `Template, ""; `Filename, template; `Size, Int64.to_string size ] @
format_tag @ compression_tag in
(* Planner: Goal. *)
let output_filename, output_format =
match output, format with
| None, None -> sprintf "%s.img" arg, "raw"
| None, Some "raw" -> sprintf "%s.img" arg, "raw"
| None, Some format -> sprintf "%s.%s" arg format, format
| Some output, None -> output, "raw"
| Some output, Some format -> output, format in
if is_char_device output_filename then (
eprintf (f_"%s: cannot output to a character device or /dev/null\n") prog;
exit 1
);
let blockdev_getsize64 dev =
let cmd = sprintf "blockdev --getsize64 %s" (quote dev) in
let lines = external_command ~prog cmd in
assert (List.length lines >= 1);
Int64.of_string (List.hd lines)
in
let output_is_block_dev, blockdev_size =
let b = is_block_device output_filename in
let sz = if b then blockdev_getsize64 output_filename else 0L in
b, sz in
let output_size =
let { Index_parser.size = original_image_size } = entry in
let size =
match size with
| Some size -> size
(* --size parameter missing, output to file: use original image size *)
| None when not output_is_block_dev -> original_image_size
(* --size parameter missing, block device: use block device size *)
| None -> blockdev_size in
if size < original_image_size then (
eprintf (f_"%s: images cannot be shrunk, the output size is too small for this image. Requested size = %s, minimum size = %s\n")
prog (human_size size) (human_size original_image_size);
exit 1
)
else if output_is_block_dev && output_format = "raw" && size > blockdev_size then (
eprintf (f_"%s: output size is too large for this block device. Requested size = %s, output block device = %s, output block device size = %s\n")
prog (human_size size) output_filename (human_size blockdev_size);
exit 1
);
size in
let goal =
(* MUST *)
let goal_must = [
`Filename, output_filename;
`Size, Int64.to_string output_size;
`Format, output_format
] in
(* MUST NOT *)
let goal_must_not = [ `Template, ""; `XZ, "" ] in
goal_must, goal_must_not in
(* Planner: Transitions. *)
let transitions itags =
let is t = List.mem_assoc t itags in
let is_not t = not (is t) in
let remove = List.remove_assoc in
let ret = ref [] in
let tr task weight otags = ret := (task, weight, otags) :: !ret in
(* XXX Weights are not very smartly chosen. At the moment I'm
* using a range [0..100] where 0 = free and 100 = expensive. We
* could estimate weights better by looking at file sizes.
*)
(* Since the final plan won't run in parallel, we don't only need
* to choose unique tempfiles per transition, so this is OK:
*)
let tempfile = Filename.temp_file "vb" ".img" in
unlink_on_exit tempfile;
(* Always possible to copy from one place to another. The only
* thing a copy does is to remove the template tag (since it's always
* copied out of the cache directory).
*)
tr `Copy 50 ((`Filename, output_filename) :: remove `Template itags);
tr `Copy 50 ((`Filename, tempfile) :: remove `Template itags);
(* We can rename a file instead of copying, but don't rename the
* cache copy! (XXX Also this is not free if copying across
* filesystems)
*)
if is_not `Template then (
if not output_is_block_dev then
tr `Rename 0 ((`Filename, output_filename) :: itags);
tr `Rename 0 ((`Filename, tempfile) :: itags);
);
if is `XZ then (
(* If the input is XZ-compressed, then we can run xzcat, either
* to the output file or to a temp file.
*)
if not output_is_block_dev then
tr `Pxzcat 80
((`Filename, output_filename) :: remove `XZ (remove `Template itags));
tr `Pxzcat 80
((`Filename, tempfile) :: remove `XZ (remove `Template itags));
)
else (
(* If the input is NOT compressed then we could run virt-resize
* if it makes sense to resize the image. Note that virt-resize
* can do both size and format conversions.
*)
let old_size = Int64.of_string (List.assoc `Size itags) in
let headroom = 256L *^ 1024L *^ 1024L in
if output_size >= old_size +^ headroom then (
tr `Virt_resize 100
((`Size, Int64.to_string output_size) ::
(`Filename, output_filename) ::
(`Format, output_format) :: (remove `Template itags));
tr `Virt_resize 100
((`Size, Int64.to_string output_size) ::
(`Filename, tempfile) ::
(`Format, output_format) :: (remove `Template itags))
)
(* If the size increase is smaller than the amount of headroom
* inside the disk image, then virt-resize won't work. However
* we can do a disk resize (using 'qemu-img resize') instead,
* although it won't resize the filesystems for the user.
*
* 'qemu-img resize' works on the file in-place and won't change
* the format. It must not be run on a template directly.
*
* Don't run 'qemu-img resize' on an auto format. This is to
* force an explicit conversion step to a real format.
*)
else if output_size > old_size && is_not `Template && List.mem_assoc `Format itags then (
tr `Disk_resize 60 ((`Size, Int64.to_string output_size) :: itags);
tr `Disk_resize 60 ((`Size, Int64.to_string output_size) :: itags);
);
(* qemu-img convert is always possible, and quicker. It doesn't
* resize, but it does change the format.
*)
tr `Convert 60
((`Filename, output_filename) :: (`Format, output_format) ::
(remove `Template itags));
tr `Convert 60
((`Filename, tempfile) :: (`Format, output_format) ::
(remove `Template itags));
);
(* Return the list of possible transitions. *)
!ret
in
(* Plan how to create the disk image. *)
msg (f_"Planning how to build this image");
let plan =
try plan ~max_depth:5 transitions itags goal
with
Failure "plan" ->
eprintf (f_"%s: no plan could be found for making a disk image with\nthe required size, format etc. This is a bug in libguestfs!\nPlease file a bug, giving the command line arguments you used.\n") prog;
exit 1
in
(* Print out the plan. *)
if verbose then (
let print_tags tags =
(try
let v = List.assoc `Filename tags in eprintf " +filename=%s" v
with Not_found -> ());
(try
let v = List.assoc `Size tags in eprintf " +size=%s" v
with Not_found -> ());
(try
let v = List.assoc `Format tags in eprintf " +format=%s" v
with Not_found -> ());
if List.mem_assoc `Template tags then eprintf " +template";
if List.mem_assoc `XZ tags then eprintf " +xz"
in
let print_task = function
| `Copy -> eprintf "cp"
| `Rename -> eprintf "mv"
| `Pxzcat -> eprintf "pxzcat"
| `Virt_resize -> eprintf "virt-resize"
| `Disk_resize -> eprintf "qemu-img resize"
| `Convert -> eprintf "qemu-img convert"
in
iteri (
fun i (itags, task, otags) ->
eprintf "%d: itags:" i;
print_tags itags;
eprintf "\n";
eprintf "%d: task : " i;
print_task task;
eprintf "\n";
eprintf "%d: otags:" i;
print_tags otags;
eprintf "\n\n%!"
) plan
);
(* Delete the output file before we finish. However don't delete it
* if it's block device, or if --no-delete-on-failure is set.
*)
let delete_output_file =
ref (delete_on_failure && not output_is_block_dev) in
let delete_file () =
if !delete_output_file then
try unlink output_filename with _ -> ()
in
at_exit delete_file;
(* Carry out the plan. *)
List.iter (
function
| itags, `Copy, otags ->
let ifile = List.assoc `Filename itags in
let ofile = List.assoc `Filename otags in
msg (f_"Copying");
let cmd = sprintf "cp %s %s" (quote ifile) (quote ofile) in
if verbose then eprintf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
| itags, `Rename, otags ->
let ifile = List.assoc `Filename itags in
let ofile = List.assoc `Filename otags in
let cmd = sprintf "mv %s %s" (quote ifile) (quote ofile) in
if verbose then eprintf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
| itags, `Pxzcat, otags ->
let ifile = List.assoc `Filename itags in
let ofile = List.assoc `Filename otags in
msg (f_"Uncompressing");
Pxzcat.pxzcat ifile ofile
| itags, `Virt_resize, otags ->
let ifile = List.assoc `Filename itags in
let iformat =
try Some (List.assoc `Format itags) with Not_found -> None in
let ofile = List.assoc `Filename otags in
let osize = Int64.of_string (List.assoc `Size otags) in
let osize = roundup64 osize 512L in
let oformat = List.assoc `Format otags in
let { Index_parser.expand = expand; lvexpand = lvexpand } = entry in
msg (f_"Resizing (using virt-resize) to expand the disk to %s")
(human_size osize);
let preallocation = if oformat = "qcow2" then Some "metadata" else None in
let () =
let g = new G.guestfs () in
if verbose then ( g#set_trace true; g#set_verbose true );
g#disk_create ?preallocation ofile oformat osize in
let cmd =
sprintf "virt-resize%s%s%s --output-format %s%s%s %s %s"
(if verbose then " --verbose" else " --quiet")
(if is_block_device ofile then " --no-sparse" else "")
(match iformat with
| None -> ""
| Some iformat -> sprintf " --format %s" (quote iformat))
(quote oformat)
(match expand with
| None -> ""
| Some expand -> sprintf " --expand %s" (quote expand))
(match lvexpand with
| None -> ""
| Some lvexpand -> sprintf " --lv-expand %s" (quote lvexpand))
(quote ifile) (quote ofile) in
if verbose then eprintf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
| itags, `Disk_resize, otags ->
let ofile = List.assoc `Filename otags in
let osize = Int64.of_string (List.assoc `Size otags) in
let osize = roundup64 osize 512L in
msg (f_"Resizing container (but not filesystems) to expand the disk to %s")
(human_size osize);
let cmd = sprintf "qemu-img resize %s %Ld%s"
(quote ofile) osize (if verbose then "" else " >/dev/null") in
if verbose then eprintf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
| itags, `Convert, otags ->
let ifile = List.assoc `Filename itags in
let iformat =
try Some (List.assoc `Format itags) with Not_found -> None in
let ofile = List.assoc `Filename otags in
let oformat = List.assoc `Format otags in
msg (f_"Converting %s to %s")
(match iformat with None -> "auto" | Some f -> f) oformat;
let cmd = sprintf "qemu-img convert%s %s -O %s %s%s"
(match iformat with
| None -> ""
| Some iformat -> sprintf " -f %s" (quote iformat))
(quote ifile) (quote oformat) (quote ofile)
(if verbose then "" else " >/dev/null 2>&1") in
if verbose then eprintf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
) plan;
(* Now mount the output disk so we can make changes. *)
msg (f_"Opening the new disk");
let g =
let g = new G.guestfs () in
if verbose then g#set_trace true;
(match memsize with None -> () | Some memsize -> g#set_memsize memsize);
(match smp with None -> () | Some smp -> g#set_smp smp);
g#set_network network;
g#set_selinux ops.flags.selinux_relabel;
(* The output disk is being created, so use cache=unsafe here. *)
g#add_drive_opts ~format:output_format ~cachemode:"unsafe" output_filename;
(* Attach ISOs, if we have any. *)
List.iter (
fun (format, file) ->
g#add_drive_opts ?format ~readonly:true file;
) attach;
g#launch ();
g in
(* Inspect the disk and mount it up. *)
let root =
match Array.to_list (g#inspect_os ()) with
| [root] ->
let mps = g#inspect_get_mountpoints root in
let cmp (a,_) (b,_) =
compare (String.length a) (String.length b) in
let mps = List.sort cmp mps in
List.iter (
fun (mp, dev) ->
try g#mount dev mp
with G.Error msg -> eprintf (f_"%s: %s (ignored)\n") prog msg
) mps;
root
| _ ->
eprintf (f_"%s: no guest operating systems or multiboot OS found in this disk image\nThis is a failure of the source repository. Use -v for more information.\n") prog;
exit 1 in
Customize_run.run ~prog ~verbose ~quiet g root ops;
(* Collect some stats about the final output file.
* Notes:
* - These are virtual disk stats.
* - Never fail here.
*)
let stats =
if not quiet then (
try
(* Calculate the free space (in bytes) across all mounted
* filesystems in the guest.
*)
let free_bytes, total_bytes =
let filesystems = List.map snd (g#mountpoints ()) in
let stats = List.map g#statvfs filesystems in
let stats = List.map (
fun { G.bfree = bfree; bsize = bsize; blocks = blocks } ->
bfree *^ bsize, blocks *^ bsize
) stats in
List.fold_left (
fun (f,t) (f',t') -> f +^ f', t +^ t'
) (0L, 0L) stats in
let free_percent = 100L *^ free_bytes /^ total_bytes in
Some (
String.concat "\n" [
sprintf "%30s: %s" (s_"Output file") output_filename;
sprintf "%30s: %s" (s_"Output size") (human_size output_size);
sprintf "%30s: %s" (s_"Output format") output_format;
sprintf "%30s: %s" (s_"Total usable space")
(human_size total_bytes);
sprintf "%30s: %s (%Ld%%)" (s_"Free space")
(human_size free_bytes) free_percent;
] ^ "\n"
)
with
_ -> None
)
else None in
(* Unmount everything and we're done! *)
msg (f_"Finishing off");
g#umount_all ();
g#shutdown ();
g#close ();
(* Because we used cache=unsafe when writing the output file, the
* file might not be committed to disk. This is a problem if qemu is
* immediately used afterwards with cache=none (which uses O_DIRECT
* and therefore bypasses the host cache). In general you should not
* use cache=none.
*)
if sync then
Fsync.file output_filename;
(* Now that we've finished the build, don't delete the output file on
* exit.
*)
delete_output_file := false;
(* Print the stats calculated above. *)
Pervasives.flush Pervasives.stdout;
Pervasives.flush Pervasives.stderr;
match stats with
| None -> ()
| Some stats -> print_string stats
let () = run_main_and_handle_errors ~prog main

60
builder/cache.ml Normal file
View File

@@ -0,0 +1,60 @@
(* virt-builder
* Copyright (C) 2013-2014 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.
*)
open Common_gettext.Gettext
open Common_utils
open Unix
open Printf
let quote = Filename.quote
let clean_cachedir dir =
let cmd = sprintf "rm -rf %s" (quote dir) in
ignore (Sys.command cmd);
type t = {
verbose : bool;
directory : string;
}
let create ~verbose ~directory =
if not (is_directory directory) then
mkdir directory 0o755;
{
verbose = verbose;
directory = directory;
}
let cache_of_name t name arch revision =
t.directory // sprintf "%s.%s.%d" name arch revision
let is_cached t name arch revision =
let filename = cache_of_name t name arch revision in
Sys.file_exists filename
let print_item_status t ~header l =
if header then (
printf (f_"cache directory: %s\n") t.directory
);
List.iter (
fun (name, arch, revision) ->
let cached = is_cached t name arch revision in
printf "%-24s %-10s %s\n" name arch
(if cached then s_"cached" else (*s_*)"no")
) l

45
builder/cache.mli Normal file
View File

@@ -0,0 +1,45 @@
(* virt-builder
* Copyright (C) 2013-2014 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 module represents a local cache. *)
val clean_cachedir : string -> unit
(** [clean_cachedir dir] clean the specified cache directory. *)
type t
(** The abstract data type. *)
val create : verbose:bool -> directory:string -> t
(** Create the abstract type. *)
val cache_of_name : t -> string -> string -> int -> string
(** [cache_of_name t name arch revision] return the filename
of the cached file. (Note: It doesn't check if the filename
exists, this is just a simple string transformation). *)
val is_cached : t -> string -> string -> int -> bool
(** [is_cached t name arch revision] return whether the file with
specified name, architecture and revision is cached. *)
val print_item_status : t -> header:bool -> (string * string * int) list -> unit
(** [print_item_status t header items] print the status in the cache
of the specified items (which are tuples of name, architecture,
and revision).
If [~header:true] then display a header with the path of the
cache. *)

352
builder/cmdline.ml Normal file
View File

@@ -0,0 +1,352 @@
(* virt-builder
* Copyright (C) 2013 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.
*)
(* Command line argument parsing. *)
open Common_gettext.Gettext
open Common_utils
open Customize_cmdline
module G = Guestfs
open Unix
open Printf
let prog = Filename.basename Sys.executable_name
let parse_cmdline () =
let display_version () =
printf "virt-builder %s\n" Config.package_version;
exit 0
in
let mode = ref `Install in
let list_mode () = mode := `List in
let notes_mode () = mode := `Notes in
let get_kernel_mode () = mode := `Get_kernel in
let cache_all_mode () = mode := `Cache_all in
let print_cache_mode () = mode := `Print_cache in
let delete_cache_mode () = mode := `Delete_cache in
let arch = ref "" in
let attach = ref [] in
let attach_format = ref None in
let set_attach_format = function
| "auto" -> attach_format := None
| s -> attach_format := Some s
in
let attach_disk s = attach := (!attach_format, s) :: !attach in
let cache = ref Paths.xdg_cache_home in
let set_cache arg = cache := Some arg in
let no_cache () = cache := None in
let check_signature = ref true in
let curl = ref "curl" in
let delete_on_failure = ref true in
let fingerprints = ref [] in
let add_fingerprint arg = fingerprints := arg :: !fingerprints in
let format = ref "" in
let gpg = ref "gpg" in
let list_format = ref `Short in
let list_set_long () = list_format := `Long in
let list_set_format arg =
list_format := match arg with
| "short" -> `Short
| "long" -> `Long
| "json" -> `Json
| fmt ->
eprintf (f_"%s: invalid --list-format type '%s', see the man page.\n") prog fmt;
exit 1 in
let machine_readable = ref false in
let memsize = ref None in
let set_memsize arg = memsize := Some arg in
let network = ref true in
let output = ref "" in
let quiet = ref false in
let size = ref None in
let set_size arg = size := Some (parse_size ~prog arg) in
let smp = ref None in
let set_smp arg = smp := Some arg in
let sources = ref [] in
let add_source arg = sources := arg :: !sources in
let sync = ref true in
let trace = ref false in
let verbose = ref false in
let argspec = [
"--arch", Arg.Set_string arch, "arch" ^ " " ^ s_"Set the output architecture";
"--attach", Arg.String attach_disk, "iso" ^ " " ^ s_"Attach data disk/ISO during install";
"--attach-format", Arg.String set_attach_format,
"format" ^ " " ^ s_"Set attach disk format";
"--cache", Arg.String set_cache, "dir" ^ " " ^ s_"Set template cache dir";
"--no-cache", Arg.Unit no_cache, " " ^ s_"Disable template cache";
"--cache-all-templates", Arg.Unit cache_all_mode,
" " ^ s_"Download all templates to the cache";
"--check-signature", Arg.Set check_signature,
" " ^ s_"Check digital signatures";
"--check-signatures", Arg.Set check_signature,
" " ^ s_"Check digital signatures";
"--no-check-signature", Arg.Clear check_signature,
" " ^ s_"Disable digital signatures";
"--no-check-signatures", Arg.Clear check_signature,
" " ^ s_"Disable digital signatures";
"--curl", Arg.Set_string curl, "curl" ^ " " ^ s_"Set curl binary/command";
"--delete-cache", Arg.Unit delete_cache_mode,
" " ^ s_"Delete the template cache";
"--no-delete-on-failure", Arg.Clear delete_on_failure,
" " ^ s_"Don't delete output file on failure";
"--fingerprint", Arg.String add_fingerprint,
"AAAA.." ^ " " ^ s_"Fingerprint of valid signing key";
"--format", Arg.Set_string format, "raw|qcow2" ^ " " ^ s_"Output format (default: raw)";
"--get-kernel", Arg.Unit get_kernel_mode,
"image" ^ " " ^ s_"Get kernel from image";
"--gpg", Arg.Set_string gpg, "gpg" ^ " " ^ s_"Set GPG binary/command";
"-l", Arg.Unit list_mode, " " ^ s_"List available templates";
"--list", Arg.Unit list_mode, " " ^ s_"List available templates";
"--long", Arg.Unit list_set_long, " " ^ s_"Shortcut for --list-format short";
"--list-format", Arg.String list_set_format,
"short|long|json" ^ " " ^ s_"Set the format for --list (default: short)";
"--long-options", Arg.Unit display_long_options, " " ^ s_"List long options";
"--machine-readable", Arg.Set machine_readable, " " ^ s_"Make output machine readable";
"-m", Arg.Int set_memsize, "mb" ^ " " ^ s_"Set memory size";
"--memsize", Arg.Int set_memsize, "mb" ^ " " ^ s_"Set memory size";
"--network", Arg.Set network, " " ^ s_"Enable appliance network (default)";
"--no-network", Arg.Clear network, " " ^ s_"Disable appliance network";
"--notes", Arg.Unit notes_mode, " " ^ s_"Display installation notes";
"-o", Arg.Set_string output, "file" ^ " " ^ s_"Set output filename";
"--output", Arg.Set_string output, "file" ^ " " ^ s_"Set output filename";
"--print-cache", Arg.Unit print_cache_mode,
" " ^ s_"Print info about template cache";
"--quiet", Arg.Set quiet, " " ^ s_"No progress messages";
"--size", Arg.String set_size, "size" ^ " " ^ s_"Set output disk size";
"--smp", Arg.Int set_smp, "vcpus" ^ " " ^ s_"Set number of vCPUs";
"--source", Arg.String add_source, "URL" ^ " " ^ s_"Set source URL";
"--no-sync", Arg.Clear sync, " " ^ s_"Do not fsync output file on exit";
"-v", Arg.Set verbose, " " ^ s_"Enable debugging messages";
"--verbose", Arg.Set verbose, " " ^ s_"Enable debugging messages";
"-V", Arg.Unit display_version, " " ^ s_"Display version and exit";
"--version", Arg.Unit display_version, " " ^ s_"Display version and exit";
"-x", Arg.Set trace, " " ^ s_"Enable tracing of libguestfs calls";
] in
let customize_argspec, get_customize_ops =
Customize_cmdline.argspec ~prog () in
let customize_argspec =
List.map (fun (spec, _, _) -> spec) customize_argspec in
let argspec = argspec @ customize_argspec in
let argspec =
let cmp (arg1, _, _) (arg2, _, _) =
let arg1 = skip_dashes arg1 and arg2 = skip_dashes arg2 in
compare (String.lowercase arg1) (String.lowercase arg2)
in
List.sort cmp argspec in
let argspec = Arg.align argspec in
long_options := argspec;
let args = ref [] in
let anon_fun s = args := s :: !args in
let usage_msg =
sprintf (f_"\
%s: build virtual machine images quickly
virt-builder OS-VERSION
virt-builder -l
virt-builder --notes OS-VERSION
virt-builder --print-cache
virt-builder --cache-all-templates
virt-builder --delete-cache
virt-builder --get-kernel IMAGE
A short summary of the options is given below. For detailed help please
read the man page virt-builder(1).
")
prog in
Arg.parse argspec anon_fun usage_msg;
(* Dereference options. *)
let args = List.rev !args in
let mode = !mode in
let arch = !arch in
let attach = List.rev !attach in
let cache = !cache in
let check_signature = !check_signature in
let curl = !curl in
let delete_on_failure = !delete_on_failure in
let fingerprints = List.rev !fingerprints in
let format = match !format with "" -> None | s -> Some s in
let gpg = !gpg in
let list_format = !list_format in
let machine_readable = !machine_readable in
let memsize = !memsize in
let network = !network in
let ops = get_customize_ops () in
let output = match !output with "" -> None | s -> Some s in
let quiet = !quiet in
let size = !size in
let smp = !smp in
let sources = List.rev !sources in
let sync = !sync in
let trace = !trace in
let verbose = !verbose in
(* No arguments and machine-readable mode? Print some facts. *)
if args = [] && machine_readable then (
printf "virt-builder\n";
printf "arch\n";
printf "config-file\n";
printf "customize\n";
printf "json-list\n";
if Pxzcat.using_parallel_xzcat () then printf "pxzcat\n";
exit 0
);
(* Check options. *)
let arg =
match mode with
| `Install ->
(match args with
| [arg] -> arg
| [] ->
eprintf (f_"%s: virt-builder os-version\nMissing 'os-version'. Use '--list' to list available template names.\n") prog;
exit 1
| _ ->
eprintf (f_"%s: virt-builder: too many parameters, expecting 'os-version'\n") prog;
exit 1
)
| `List ->
if format <> None then (
eprintf (f_"%s: virt-builder --list: use '--list-format', not '--format'.\n") prog;
exit 1
);
(match args with
| [] -> ""
| _ ->
eprintf (f_"%s: virt-builder --list does not need any extra arguments.\n") prog;
exit 1
)
| `Notes ->
(match args with
| [arg] -> arg
| [] ->
eprintf (f_"%s: virt-builder --notes os-version\nMissing 'os-version'. Use '--list' to list available template names.\n") prog;
exit 1
| _ ->
eprintf (f_"%s: virt-builder: too many parameters, expecting 'os-version'\n") prog;
exit 1
)
| `Cache_all
| `Print_cache
| `Delete_cache ->
(match args with
| [] -> ""
| _ ->
eprintf (f_"%s: virt-builder --cache-all-templates/--print-cache/--delete-cache does not need any extra arguments.\n") prog;
exit 1
)
| `Get_kernel ->
(match args with
| [arg] -> arg
| [] ->
eprintf (f_"%s: virt-builder --get-kernel image\nMissing 'image' (disk image file) argument.\n") prog;
exit 1
| _ ->
eprintf (f_"%s: virt-builder --get-kernel: too many parameters\n") prog;
exit 1
) in
(* Check source(s) and fingerprint(s). *)
let sources =
let rec repeat x = function
| 0 -> [] | 1 -> [x]
| n -> x :: repeat x (n-1)
in
let nr_sources = List.length sources in
let fingerprints =
match fingerprints with
| [fingerprint] ->
(* You're allowed to have multiple sources and one fingerprint: it
* means that the same fingerprint is used for all sources.
*)
repeat fingerprint nr_sources
| xs -> xs in
if List.length fingerprints <> nr_sources then (
eprintf (f_"%s: source and fingerprint lists are not the same length\n")
prog;
exit 1
);
(* Combine the sources and fingerprints into a single list of pairs. *)
List.combine sources fingerprints in
(* Check the architecture. *)
let arch =
match arch with
| "" -> Architecture.current_arch
| arch ->
let target_arch = Architecture.filter_arch arch in
if Architecture.arch_is_compatible Architecture.current_arch target_arch <> true then (
let requires_execute_on_guest = List.exists (
function
| `Command _ | `InstallPackages _ | `Script _ | `Update -> true
| `Delete _ | `Edit _ | `FirstbootCommand _ | `FirstbootPackages _
| `FirstbootScript _ | `Hostname _ | `Link _ | `Mkdir _
| `Password _ | `RootPassword _ | `Scrub _ | `Timezone _ | `Upload _
| `Write _ | `Chmod _ -> false
) ops.ops in
if requires_execute_on_guest then (
eprintf (f_"%s: sorry, cannot run commands on a guest with a different architecture\n")
prog;
exit 1
);
);
target_arch in
(* If user didn't elect any root password, that means we set a random
* root password.
*)
let ops =
let has_set_root_password = List.exists (
function `RootPassword _ -> true | _ -> false
) ops.ops in
if has_set_root_password then ops
else (
let pw = Password.parse_selector ~prog "random" in
{ ops with ops = ops.ops @ [ `RootPassword pw ] }
) in
mode, arg,
arch, attach, cache, check_signature, curl,
delete_on_failure, format, gpg, list_format, memsize,
network, ops, output, quiet, size, smp, sources, sync,
trace, verbose

163
builder/downloader.ml Normal file
View File

@@ -0,0 +1,163 @@
(* virt-builder
* Copyright (C) 2013 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.
*)
open Common_gettext.Gettext
open Common_utils
open Unix
open Printf
let quote = Filename.quote
type uri = string
type filename = string
type t = {
verbose : bool;
curl : string;
cache : Cache.t option; (* cache for templates *)
}
type proxy_mode =
| UnsetProxy
| SystemProxy
| ForcedProxy of string
let create ~verbose ~curl ~cache = {
verbose = verbose;
curl = curl;
cache = cache;
}
let rec download ~prog t ?template ?progress_bar ?(proxy = SystemProxy) uri =
match template with
| None -> (* no cache, simple download *)
(* Create a temporary name. *)
let tmpfile = Filename.temp_file "vbcache" ".txt" in
download_to ~prog t ?progress_bar ~proxy uri tmpfile;
(tmpfile, true)
| Some (name, arch, revision) ->
match t.cache with
| None ->
(* Not using the cache at all? *)
download t ~prog ?progress_bar ~proxy uri
| Some cache ->
let filename = Cache.cache_of_name cache name arch revision in
(* Is the requested template name + revision in the cache already?
* If not, download it.
*)
if not (Sys.file_exists filename) then
download_to ~prog t ?progress_bar ~proxy uri filename;
(filename, false)
and download_to ~prog t ?(progress_bar = false) ~proxy uri filename =
let parseduri =
try URI.parse_uri uri
with Invalid_argument "URI.parse_uri" ->
eprintf (f_"Error parsing URI '%s'. Look for error messages printed above.\n") uri;
exit 1 in
(* Note because there may be parallel virt-builder instances running
* and also to avoid partial downloads in the cache if the network
* fails, we download to a random name in the cache and then
* atomically rename it to the final filename.
*)
let filename_new = filename ^ "." ^ string_random8 () in
unlink_on_exit filename_new;
(match parseduri.URI.protocol with
| "file" ->
let path = parseduri.URI.path in
let cmd = sprintf "cp%s %s %s"
(if t.verbose then " -v" else "")
(quote path) (quote filename_new) in
let r = Sys.command cmd in
if r <> 0 then (
eprintf (f_"%s: cp (download) command failed copying '%s'\n")
prog path;
exit 1
)
| _ as protocol -> (* Any other protocol. *)
let outenv = proxy_envvar protocol proxy in
(* Get the status code first to ensure the file exists. *)
let cmd = sprintf "%s%s%s -g -o /dev/null -I -w '%%{http_code}' %s"
outenv
t.curl
(if t.verbose then "" else " -s -S")
(quote uri) in
if t.verbose then eprintf "%s\n%!" cmd;
let lines = external_command ~prog cmd in
if List.length lines < 1 then (
eprintf (f_"%s: unexpected output from curl command, enable debug and look at previous messages\n")
prog;
exit 1
);
let status_code = List.hd lines in
let bad_status_code = function
| "" -> true
| s when s.[0] = '4' -> true (* 4xx *)
| s when s.[0] = '5' -> true (* 5xx *)
| _ -> false
in
if bad_status_code status_code then (
eprintf (f_"%s: failed to download %s: HTTP status code %s\n")
prog uri status_code;
exit 1
);
(* Now download the file. *)
let cmd = sprintf "%s%s%s -g -o %s %s"
outenv
t.curl
(if t.verbose then "" else if progress_bar then " -#" else " -s -S")
(quote filename_new) (quote uri) in
if t.verbose then eprintf "%s\n%!" cmd;
let r = Sys.command cmd in
if r <> 0 then (
eprintf (f_"%s: curl (download) command failed downloading '%s'\n")
prog uri;
exit 1
)
);
(* Rename the file if the download was successful. *)
rename filename_new filename
and proxy_envvar protocol = function
| UnsetProxy ->
(match protocol with
| "http" -> "env http_proxy= no_proxy=* "
| "https" -> "env https_proxy= no_proxy=* "
| "ftp" -> "env ftp_proxy= no_proxy=* "
| _ -> "env no_proxy=* "
)
| SystemProxy ->
(* No changes required. *)
""
| ForcedProxy proxy ->
let proxy = Filename.quote proxy in
(match protocol with
| "http" -> sprintf "env http_proxy=%s no_proxy= " proxy
| "https" -> sprintf "env https_proxy=%s no_proxy= " proxy
| "ftp" -> sprintf "env ftp_proxy=%s no_proxy= " proxy
| _ -> ""
)

53
builder/downloader.mli Normal file
View File

@@ -0,0 +1,53 @@
(* virt-builder
* Copyright (C) 2013 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 module is a wrapper around curl, plus local caching. *)
type uri = string
type filename = string
type t
(** The abstract data type. *)
(** Type of proxy. *)
type proxy_mode =
| UnsetProxy (* The proxy is forced off. *)
| SystemProxy (* The proxy is not changed (follows the
* system configuration).
*)
| ForcedProxy of string (* The proxy is forced to the specified URL. *)
val create : verbose:bool -> curl:string -> cache:Cache.t option -> t
(** Create the abstract type. *)
val download : prog:string -> t -> ?template:(string*string*int) -> ?progress_bar:bool -> ?proxy:proxy_mode -> uri -> (filename * bool)
(** Download the URI, returning the downloaded filename and a
temporary file flag. The temporary file flag is [true] iff
the downloaded file is temporary and should be deleted by the
caller (otherwise it's in the cache and you shouldn't delete it).
For templates, you must supply [~template:(name, arch, revision)].
This causes the cache to be used (if possible). Name, arch(itecture)
and revision are used for cache control (see the man page for details).
If [~progress_bar:true] then display a progress bar if the file
doesn't come from the cache. In verbose mode, progress messages
are always displayed.
[proxy] specifies the type of proxy to be used in the transfer,
if possible. *)

96
builder/get_kernel.ml Normal file
View File

@@ -0,0 +1,96 @@
(* virt-builder
* Copyright (C) 2013 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.
*)
open Common_gettext.Gettext
open Common_utils
module G = Guestfs
open Printf
(* Originally:
* http://rwmj.wordpress.com/2013/09/13/get-kernel-and-initramfs-from-a-disk-image/
*)
let rec get_kernel ~trace ~verbose ?format ?output disk =
let g = new G.guestfs () in
if trace then g#set_trace true;
if verbose then g#set_verbose true;
g#add_drive_opts ?format ~readonly:true disk;
g#launch ();
let roots = g#inspect_os () in
if Array.length roots = 0 then (
eprintf (f_"virt-builder: get-kernel: no operating system found\n");
exit 1
);
if Array.length roots > 1 then (
eprintf (f_"virt-builder: get-kernel: dual/multi-boot images are not supported by this tool\n");
exit 1
);
let root = roots.(0) in
(* Mount up the disks. *)
let mps = g#inspect_get_mountpoints root in
let cmp (a,_) (b,_) = compare (String.length a) (String.length b) in
let mps = List.sort cmp mps in
List.iter (
fun (mp, dev) ->
try g#mount_ro dev mp
with Guestfs.Error msg -> eprintf "%s (ignored)\n" msg
) mps;
(* Get all kernels and initramfses. *)
let glob w = Array.to_list (g#glob_expand w) in
let kernels = glob "/boot/vmlinuz-*" in
let initrds = glob "/boot/initramfs-*" in
(* Old RHEL: *)
let initrds = if initrds <> [] then initrds else glob "/boot/initrd-*" in
(* Debian/Ubuntu: *)
let initrds = if initrds <> [] then initrds else glob "/boot/initrd.img-*" in
(* Sort by version to get the latest version as first element. *)
let kernels = List.rev (List.sort compare_version kernels) in
let initrds = List.rev (List.sort compare_version initrds) in
if kernels = [] then (
eprintf (f_"virt-builder: no kernel found\n");
exit 1
);
(* Download the latest. *)
let outputdir =
match output with
| None -> Filename.current_dir_name
| Some dir -> dir in
let kernel_in = List.hd kernels in
let kernel_out = outputdir // Filename.basename kernel_in in
printf "download: %s -> %s\n%!" kernel_in kernel_out;
g#download kernel_in kernel_out;
if initrds <> [] then (
let initrd_in = List.hd initrds in
let initrd_out = outputdir // Filename.basename initrd_in in
printf "download: %s -> %s\n%!" initrd_in initrd_out;
g#download initrd_in initrd_out
);
(* Shutdown. *)
g#shutdown ();
g#close ()

19
builder/get_kernel.mli Normal file
View File

@@ -0,0 +1,19 @@
(* virt-builder
* Copyright (C) 2013 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.
*)
val get_kernel : trace:bool -> verbose:bool -> ?format:string -> ?output:string -> string -> unit

176
builder/index-parse.y Normal file
View File

@@ -0,0 +1,176 @@
/* libguestfs virt-builder tool -*- fundamental -*-
* Copyright (C) 2013 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 "index-struct.h"
#include "index-parse.h"
#define YY_EXTRA_TYPE struct parse_context *
extern void yyerror (YYLTYPE * yylloc, yyscan_t scanner, struct parse_context *context, const char *msg);
extern int yylex (YYSTYPE * yylval, YYLTYPE * yylloc, yyscan_t scanner);
extern void scanner_init (yyscan_t *scanner, struct parse_context *context, FILE *in);
extern void scanner_destroy (yyscan_t scanner);
/* Join two strings with \n */
static char *
concat_newline (const char *str1, const char *str2)
{
size_t len1, len2, len;
char *ret;
if (str2 == NULL)
return strdup (str1);
len1 = strlen (str1);
len2 = strlen (str2);
len = len1 + 1 /* \n */ + len2 + 1 /* \0 */;
ret = malloc (len);
memcpy (ret, str1, len1);
ret[len1] = '\n';
memcpy (ret + len1 + 1, str2, len2);
ret[len-1] = '\0';
return ret;
}
%}
%code requires {
#ifndef YY_TYPEDEF_YY_SCANNER_T
#define YY_TYPEDEF_YY_SCANNER_T
typedef void *yyscan_t;
#endif
}
%locations
%union {
struct section *section;
struct field *field;
char *str;
}
%token <str> SECTION_HEADER
%token <field> FIELD
%token <str> VALUE_CONT
%token EMPTY_LINE
%token PGP_PROLOGUE
%token PGP_EPILOGUE
%token UNKNOWN_LINE
%type <section> sections section
%type <field> fields field
%type <str> continuations
%pure-parser
%lex-param { yyscan_t scanner }
%parse-param { yyscan_t scanner }
%parse-param { struct parse_context *context }
%destructor { section_free ($$); } <sections>
%destructor { section_free ($$); } <section>
%destructor { field_free ($$); } <fields>
%destructor { field_free ($$); } <field>
%%
index:
sections
{ context->parsed_index = $1; }
| PGP_PROLOGUE sections PGP_EPILOGUE
{ context->parsed_index = $2; }
sections:
section emptylines
{ $$ = $1; }
| section EMPTY_LINE emptylines sections
{ $$ = $1; $$->next = $4; }
| emptylines
{ $$ = NULL; }
section:
SECTION_HEADER fields
{ $$ = malloc (sizeof (struct section));
$$->next = NULL;
$$->name = $1;
$$->fields = $2; }
fields:
/* empty */
{ $$ = NULL; }
| field fields
{ $$ = $1; $$->next = $2; }
field: FIELD continuations
{ $$ = $1;
char *old_value = $$->value;
$$->value = concat_newline (old_value, $2);
free (old_value);
free ($2); }
continuations:
/* empty */
{ $$ = NULL; }
| VALUE_CONT continuations
{ $$ = concat_newline ($1, $2);
free ($1);
free ($2); }
emptylines:
/* empty */
{}
| EMPTY_LINE emptylines
{}
%%
void
yyerror (YYLTYPE * yylloc, yyscan_t scanner, struct parse_context *context, const char *msg)
{
int has_suffix = context->error_suffix != NULL && context->error_suffix[0] != 0;
fprintf (stderr, "%s%s%s%ssyntax error at line %d: %s%s%s\n",
context->program_name ? context->program_name : "",
context->program_name ? ": " : "",
context->input_file ? context->input_file : "",
context->input_file ? ": " : "",
yylloc->first_line, msg,
has_suffix ? " " : "",
has_suffix ? context->error_suffix : "");
}
int
do_parse (struct parse_context *context, FILE *in)
{
yyscan_t scanner;
int res;
scanner_init (&scanner, context, in);
res = yyparse (scanner, context);
scanner_destroy (scanner);
return res;
}

119
builder/index-parser-c.c Normal file
View File

@@ -0,0 +1,119 @@
/* virt-builder
* Copyright (C) 2013 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 file handles the interface between the C/lex/yacc index file
* parser, and the OCaml world. See index_parser.ml for the OCaml
* type definition.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <caml/alloc.h>
#include <caml/fail.h>
#include <caml/memory.h>
#include <caml/mlvalues.h>
#ifdef HAVE_CAML_UNIXSUPPORT_H
#include <caml/unixsupport.h>
#else
#define Nothing ((value) 0)
extern void unix_error (int errcode, char * cmdname, value arg) Noreturn;
#endif
#include "index-struct.h"
#include "index-parse.h"
extern int do_parse (struct parse_context *context, FILE *in);
value
virt_builder_parse_index (value progv, value error_suffixv, value filenamev)
{
CAMLparam2 (progv, filenamev);
CAMLlocal5 (rv, v, sv, sv2, fv);
struct section *sections;
size_t i, nr_sections;
struct parse_context context;
FILE *in;
parse_context_init (&context);
context.program_name = String_val (progv);
context.input_file = String_val (filenamev);
context.error_suffix = String_val (error_suffixv);
in = fopen (String_val (filenamev), "r");
if (in == NULL)
unix_error (errno, (char *) "fopen", filenamev);
if (do_parse (&context, in) != 0) {
fclose (in);
caml_invalid_argument ("parse error");
}
if (fclose (in) == EOF)
unix_error (errno, (char *) "fclose", filenamev);
/* Convert the parsed data to OCaml structures. */
nr_sections = 0;
for (sections = context.parsed_index; sections != NULL; sections = sections->next)
nr_sections++;
rv = caml_alloc (nr_sections, 0);
for (i = 0, sections = context.parsed_index; sections != NULL;
i++, sections = sections->next) {
struct field *fields;
size_t j, nr_fields;
nr_fields = 0;
for (fields = sections->fields; fields != NULL; fields = fields->next)
nr_fields++;
fv = caml_alloc (nr_fields, 0);
for (j = 0, fields = sections->fields; fields != NULL;
j++, fields = fields->next) {
v = caml_alloc_tuple (3);
sv = caml_copy_string (fields->key);
Store_field (v, 0, sv); /* (key, Some subkey, value) */
if (fields->subkey) {
sv2 = caml_copy_string (fields->subkey);
sv = caml_alloc (1, 0);
Store_field (sv, 0, sv2);
} else
sv = Val_int (0);
Store_field (v, 1, sv);
sv = caml_copy_string (fields->value);
Store_field (v, 2, sv);
Store_field (fv, j, v); /* assign to return array of fields */
}
v = caml_alloc_tuple (2);
sv = caml_copy_string (sections->name);
Store_field (v, 0, sv); /* (name, fields) */
Store_field (v, 1, fv);
Store_field (rv, i, v); /* assign to return array of sections */
}
/* Free parsed data. */
parse_context_free (&context);
CAMLreturn (rv);
}

128
builder/index-scan.l Normal file
View File

@@ -0,0 +1,128 @@
/* libguestfs virt-builder tool -*- fundamental -*-
* Copyright (C) 2013 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 "index-struct.h"
#include "index-parse.h"
#define YY_EXTRA_TYPE struct parse_context *
#define YY_USER_ACTION yylloc->first_line = yylloc->last_line = yylineno;
%}
%option nounput
%option noyywrap
%option yylineno
%option reentrant
%option bison-bridge
%option bison-locations
%%
/* Apart from the PGP prologue/epilogue which is a hack, the
* scanning strategy is to deal with the file strictly line by
* line, and pass those lines up to the parser which deals with
* whether they appear in the right order to be meaningful.
* Note that flex does longest-match.
*/
/* Ignore comments - '#' MUST appear at the start of a line. */
^"#".*\n { yyextra->seen_comments++; }
/* An empty line is significant. */
^\n { return EMPTY_LINE; }
/* [...] marks beginning of a section. */
^"["[-A-Za-z0-9._]+"]"\n {
yylval->str = strndup (yytext+1, yyleng-3);
return SECTION_HEADER;
}
/* field=value or field[subfield]=value */
^[A-Za-z0-9_.]+("["[A-Za-z0-9_,.]+"]")?"=".*\n {
size_t i = strcspn (yytext, "=[");
yylval->field = malloc (sizeof (struct field));
yylval->field->next = NULL;
yylval->field->key = strndup (yytext, i);
if (yytext[i] == '[') {
size_t j = strcspn (yytext+i+1, "]");
yylval->field->subkey = strndup (yytext+i+1, j);
i += 1+j+1;
} else {
yylval->field->subkey = NULL;
}
/* Note we chop the final \n off here. */
yylval->field->value = strndup (yytext+i+1, yyleng-(i+2));
return FIELD;
}
/* Continuation line for multi-line values. */
^[[:blank:]].*\n {
yylval->str = strndup (yytext+1, yyleng-2);
return VALUE_CONT;
}
/* Hack to eat the PGP prologue. */
^"-----BEGIN PGP SIGNED MESSAGE-----\n" {
int c, prevnl = 0;
/* Eat everything to the first blank line. */
while ((c = input (yyscanner)) != EOF) {
if (c == '\n' && prevnl)
break;
prevnl = c == '\n';
}
return PGP_PROLOGUE;
}
/* Hack to eat the PGP epilogue. */
^"-----BEGIN PGP SIGNATURE-----\n" {
/* Eat everything to the end of the file. */
while (input (yyscanner) != EOF)
;
return PGP_EPILOGUE;
}
/* anything else is an error */
. {
return UNKNOWN_LINE;
}
%%
void
scanner_init (yyscan_t *scanner, struct parse_context *context, FILE *in)
{
yylex_init (scanner);
yyset_extra (context, *scanner);
yyset_in (in, *scanner);
}
void
scanner_destroy (yyscan_t scanner)
{
yylex_destroy (scanner);
}

60
builder/index-struct.c Normal file
View File

@@ -0,0 +1,60 @@
/* libguestfs virt-builder tool
* Copyright (C) 2013 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 "index-struct.h"
void
parse_context_init (struct parse_context *context)
{
memset (context, 0, sizeof *context);
}
void
parse_context_free (struct parse_context *context)
{
section_free (context->parsed_index);
}
void
section_free (struct section *section)
{
if (section) {
section_free (section->next);
free (section->name);
field_free (section->fields);
free (section);
}
}
void
field_free (struct field *field)
{
if (field) {
field_free (field->next);
free (field->key);
free (field->subkey);
free (field->value);
free (field);
}
}

67
builder/index-struct.h Normal file
View File

@@ -0,0 +1,67 @@
/* libguestfs virt-builder tool
* Copyright (C) 2013 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.
*/
/* The data structures produced when parsing the index file. */
#ifndef INDEX_STRUCT_H
#define INDEX_STRUCT_H
/* A section or list of sections. */
struct section {
struct section *next;
char *name;
struct field *fields;
};
/* A field or list of fields. */
struct field {
struct field *next;
char *key;
char *subkey;
char *value;
};
/* A struct holding the data needed during the parsing. */
struct parse_context {
struct section *parsed_index; /* The result of the parsing. */
/* yyparse sets this if any comments were seen. Required for checking
* compatibility with virt-builder 1.24.
*/
int seen_comments;
const char *input_file;
const char *program_name;
const char *error_suffix;
};
/* Initialize the content of a parse_context. */
extern void parse_context_init (struct parse_context *state);
/* Free the content of a parse_context. The actual pointer is not freed. */
extern void parse_context_free (struct parse_context *state);
/* Free the content of a section, recursively freeing also its fields.
* The actual pointer is not freed.
*/
extern void section_free (struct section *section);
/* Free the content of a field, recursively freeing also its next field.
* The actual pointer is not freed.
*/
extern void field_free (struct field *field);
#endif /* INDEX_STRUCT_H */

186
builder/index-validate.c Normal file
View File

@@ -0,0 +1,186 @@
/* libguestfs virt-builder tool
* Copyright (C) 2013 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 <limits.h>
#include <getopt.h>
#include <errno.h>
#include <locale.h>
#include <libintl.h>
#include <guestfs.h>
#include "guestfs-internal-frontend.h"
#include "index-struct.h"
#include "index-parse.h"
extern int do_parse (struct parse_context *context, FILE *in);
static void
usage (int exit_status)
{
printf ("%s index\n", program_name);
exit (exit_status);
}
int
main (int argc, char *argv[])
{
enum { HELP_OPTION = CHAR_MAX + 1 };
static const char *options = "V";
static const struct option long_options[] = {
{ "help", 0, 0, HELP_OPTION },
{ "compat-1.24.0", 0, 0, 0 },
{ "compat-1.24.1", 0, 0, 0 },
{ "version", 0, 0, 'V' },
{ 0, 0, 0, 0 }
};
int c;
int option_index;
int compat_1_24_0 = 0;
int compat_1_24_1 = 0;
const char *input;
struct section *sections;
struct parse_context context;
FILE *in;
int ret;
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEBASEDIR);
textdomain (PACKAGE);
parse_context_init (&context);
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, "compat-1.24.0"))
compat_1_24_0 = compat_1_24_1 = 1;
else if (STREQ (long_options[option_index].name, "compat-1.24.1"))
compat_1_24_1 = 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 'V':
printf ("%s %s\n", PACKAGE_NAME, PACKAGE_VERSION);
exit (EXIT_SUCCESS);
case HELP_OPTION:
usage (EXIT_SUCCESS);
default:
usage (EXIT_FAILURE);
}
}
if (optind != argc-1)
usage (EXIT_FAILURE);
input = argv[optind++];
in = fopen (input, "r");
if (in == NULL) {
perror (input);
exit (EXIT_FAILURE);
}
ret = do_parse (&context, in);
if (fclose (in) == EOF) {
fprintf (stderr, _("%s: %s: error closing input file: %m (ignored)\n"),
program_name, input);
}
if (ret != 0) {
parse_context_free (&context);
fprintf (stderr, _("%s: '%s' could not be validated, see errors above\n"),
program_name, input);
exit (EXIT_FAILURE);
}
if (compat_1_24_1 && context.seen_comments) {
parse_context_free (&context);
fprintf (stderr, _("%s: %s contains comments which will not work with virt-builder 1.24.1\n"),
program_name, input);
exit (EXIT_FAILURE);
}
/* Iterate over the parsed sections, semantically validating it. */
for (sections = context.parsed_index; sections != NULL; sections = sections->next) {
int seen_sig = 0;
struct field *fields;
if (compat_1_24_0) {
if (strchr (sections->name, '_')) {
parse_context_free (&context);
fprintf (stderr, _("%s: %s: section [%s] has invalid characters which will not work with virt-builder 1.24.0\n"),
program_name, input, sections->name);
exit (EXIT_FAILURE);
}
}
for (fields = sections->fields; fields != NULL; fields = fields->next) {
if (compat_1_24_0) {
if (strchr (fields->key, '[') ||
strchr (fields->key, ']')) {
parse_context_free (&context);
fprintf (stderr, _("%s: %s: section [%s], field '%s' has invalid characters which will not work with virt-builder 1.24.0\n"),
program_name, input, sections->name, fields->key);
exit (EXIT_FAILURE);
}
}
if (compat_1_24_1) {
if (strchr (fields->key, '.') ||
strchr (fields->key, ',')) {
parse_context_free (&context);
fprintf (stderr, _("%s: %s: section [%s], field '%s' has invalid characters which will not work with virt-builder 1.24.1\n"),
program_name, input, sections->name, fields->key);
exit (EXIT_FAILURE);
}
}
if (STREQ (fields->key, "sig"))
seen_sig = 1;
}
if (compat_1_24_0 && !seen_sig) {
parse_context_free (&context);
fprintf (stderr, _("%s: %s: section [%s] is missing a 'sig' field which will not work with virt-builder 1.24.0\n"),
program_name, input, sections->name);
exit (EXIT_FAILURE);
}
}
/* Free the parsed data. */
parse_context_free (&context);
printf ("%s validated OK\n", input);
exit (EXIT_SUCCESS);
}

314
builder/index_parser.ml Normal file
View File

@@ -0,0 +1,314 @@
(* virt-builder
* Copyright (C) 2013 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.
*)
open Common_gettext.Gettext
open Common_utils
open Printf
open Unix
type index = (string * entry) list (* string = "os-version" *)
and entry = {
printable_name : string option; (* the name= field *)
osinfo : string option;
file_uri : string;
arch : string;
signature_uri : string option; (* deprecated, will be removed in 1.26 *)
checksum_sha512 : string option;
revision : int;
format : string option;
size : int64;
compressed_size : int64 option;
expand : string option;
lvexpand : string option;
notes : (string * string) list;
hidden : bool;
aliases : string list option;
sigchecker : Sigchecker.t;
proxy : Downloader.proxy_mode;
}
let print_entry chan (name, { printable_name = printable_name;
file_uri = file_uri;
arch = arch;
osinfo = osinfo;
signature_uri = signature_uri;
checksum_sha512 = checksum_sha512;
revision = revision;
format = format;
size = size;
compressed_size = compressed_size;
expand = expand;
lvexpand = lvexpand;
notes = notes;
aliases = aliases;
hidden = hidden }) =
let fp fs = fprintf chan fs in
fp "[%s]\n" name;
(match printable_name with
| None -> ()
| Some name -> fp "name=%s\n" name
);
(match osinfo with
| None -> ()
| Some id -> fp "osinfo=%s\n" id
);
fp "file=%s\n" file_uri;
fp "arch=%s\n" arch;
(match signature_uri with
| None -> ()
| Some uri -> fp "sig=%s\n" uri
);
(match checksum_sha512 with
| None -> ()
| Some uri -> fp "checksum[sha512]=%s\n" uri
);
fp "revision=%d\n" revision;
(match format with
| None -> ()
| Some format -> fp "format=%s\n" format
);
fp "size=%Ld\n" size;
(match compressed_size with
| None -> ()
| Some size -> fp "compressed_size=%Ld\n" size
);
(match expand with
| None -> ()
| Some expand -> fp "expand=%s\n" expand
);
(match lvexpand with
| None -> ()
| Some lvexpand -> fp "lvexpand=%s\n" lvexpand
);
List.iter (
fun (lang, notes) ->
match lang with
| "" -> fp "notes=%s\n" notes
| lang -> fp "notes[%s]=%s\n" lang notes
) notes;
(match aliases with
| None -> ()
| Some l -> fp "aliases=%s\n" (String.concat " " l)
);
if hidden then fp "hidden=true\n"
let get_index ~prog ~verbose ~downloader ~sigchecker ~proxy source =
let corrupt_file () =
eprintf (f_"\nThe index file downloaded from '%s' is corrupt.\nYou need to ask the supplier of this file to fix it and upload a fixed version.\n")
source;
exit 1
in
let rec get_index () =
(* Get the index page. *)
let tmpfile, delete_tmpfile = Downloader.download ~prog downloader ~proxy source in
(* Check index file signature (also verifies it was fully
* downloaded and not corrupted in transit).
*)
Sigchecker.verify sigchecker tmpfile;
(* Try parsing the file. *)
let sections = Ini_reader.read_ini ~prog tmpfile in
if delete_tmpfile then
(try Unix.unlink tmpfile with _ -> ());
(* Check for repeated os-version+arch combination. *)
let name_arch_map = List.map (
fun (n, fields) ->
let rec find_arch = function
| ("arch", None, value) :: y -> value
| _ :: y -> find_arch y
| [] -> ""
in
n, (find_arch fields)
) sections in
let nseen = Hashtbl.create 13 in
List.iter (
fun (n, arch) ->
let id = n, arch in
if Hashtbl.mem nseen id then (
eprintf (f_"virt-builder: index is corrupt: os-version '%s' with architecture '%s' appears two or more times\n") n arch;
corrupt_file ()
);
Hashtbl.add nseen id true
) name_arch_map;
(* Check for repeated fields. *)
List.iter (
fun (n, fields) ->
let fseen = Hashtbl.create 13 in
List.iter (
fun (field, subkey, _) ->
let hashkey = (field, subkey) in
if Hashtbl.mem fseen hashkey then (
(match subkey with
| Some value ->
eprintf (f_"virt-builder: index is corrupt: %s: field '%s[%s]' appears two or more times\n") n field value
| None ->
eprintf (f_"virt-builder: index is corrupt: %s: field '%s' appears two or more times\n") n field);
corrupt_file ()
);
Hashtbl.add fseen hashkey true
) fields
) sections;
(* Turn the sections into the final index. *)
let entries =
List.map (
fun (n, fields) ->
let fields = List.map (fun (k, sk, v) -> (k, sk), v) fields in
let printable_name =
try Some (List.assoc ("name", None) fields) with Not_found -> None in
let osinfo =
try Some (List.assoc ("osinfo", None) fields) with Not_found -> None in
let file_uri =
try make_absolute_uri (List.assoc ("file", None) fields)
with Not_found ->
eprintf (f_"virt-builder: no 'file' (URI) entry for '%s'\n") n;
corrupt_file () in
let arch =
try List.assoc ("arch", None) fields
with Not_found ->
eprintf (f_"virt-builder: no 'arch' entry for '%s'\n") n;
corrupt_file () in
let signature_uri =
try Some (make_absolute_uri (List.assoc ("sig", None) fields))
with Not_found -> None in
let checksum_sha512 =
try Some (List.assoc ("checksum", Some "sha512") fields)
with Not_found ->
try Some (List.assoc ("checksum", None) fields)
with Not_found -> None in
let revision =
try int_of_string (List.assoc ("revision", None) fields)
with
| Not_found -> 1
| Failure "int_of_string" ->
eprintf (f_"virt-builder: cannot parse 'revision' field for '%s'\n")
n;
corrupt_file () in
let format =
try Some (List.assoc ("format", None) fields) with Not_found -> None in
let size =
try Int64.of_string (List.assoc ("size", None) fields)
with
| Not_found ->
eprintf (f_"virt-builder: no 'size' field for '%s'\n") n;
corrupt_file ()
| Failure "int_of_string" ->
eprintf (f_"virt-builder: cannot parse 'size' field for '%s'\n")
n;
corrupt_file () in
let compressed_size =
try Some (Int64.of_string (List.assoc ("compressed_size", None) fields))
with
| Not_found ->
None
| Failure "int_of_string" ->
eprintf (f_"virt-builder: cannot parse 'compressed_size' field for '%s'\n")
n;
corrupt_file () in
let expand =
try Some (List.assoc ("expand", None) fields) with Not_found -> None in
let lvexpand =
try Some (List.assoc ("lvexpand", None) fields) with Not_found -> None in
let notes =
let rec loop = function
| [] -> []
| (("notes", subkey), value) :: xs ->
let subkey = match subkey with
| None -> ""
| Some v -> v in
(subkey, value) :: loop xs
| _ :: xs -> loop xs in
List.sort (
fun (k1, _) (k2, _) ->
String.compare k1 k2
) (loop fields) in
let hidden =
try bool_of_string (List.assoc ("hidden", None) fields)
with
| Not_found -> false
| Failure "bool_of_string" ->
eprintf (f_"virt-builder: cannot parse 'hidden' field for '%s'\n")
n;
corrupt_file () in
let aliases =
let l =
try string_nsplit " " (List.assoc ("aliases", None) fields)
with Not_found -> [] in
match l with
| [] -> None
| l -> Some l in
let entry = { printable_name = printable_name;
osinfo = osinfo;
file_uri = file_uri;
arch = arch;
signature_uri = signature_uri;
checksum_sha512 = checksum_sha512;
revision = revision;
format = format;
size = size;
compressed_size = compressed_size;
expand = expand;
lvexpand = lvexpand;
notes = notes;
hidden = hidden;
aliases = aliases;
proxy = proxy;
sigchecker = sigchecker } in
n, entry
) sections in
if verbose then (
eprintf "index file (%s) after parsing (C parser):\n" source;
List.iter (print_entry Pervasives.stderr) entries
);
entries
(* Verify same-origin policy for the file= and sig= fields. *)
and make_absolute_uri path =
if String.length path = 0 then (
eprintf (f_"virt-builder: zero length path in the index file\n");
corrupt_file ()
)
else if string_find path "://" >= 0 then (
eprintf (f_"virt-builder: cannot use a URI ('%s') in the index file\n")
path;
corrupt_file ()
)
else if path.[0] = '/' then (
eprintf (f_"virt-builder: you must use relative paths (not '%s') in the index file\n") path;
corrupt_file ()
)
else (
(* Construct the URI. *)
try
let i = String.rindex source '/' in
String.sub source 0 (i+1) ^ path
with
Not_found -> source // path
)
in
get_index ()

41
builder/index_parser.mli Normal file
View File

@@ -0,0 +1,41 @@
(* virt-builder
* Copyright (C) 2013 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.
*)
type index = (string * entry) list (* string = "os-version" *)
and entry = {
printable_name : string option; (* the name= field *)
osinfo : string option;
file_uri : string;
arch : string;
signature_uri : string option; (* deprecated, will be removed in 1.26 *)
checksum_sha512 : string option;
revision : int;
format : string option;
size : int64;
compressed_size : int64 option;
expand : string option;
lvexpand : string option;
notes : (string * string) list;
hidden : bool;
aliases : string list option;
sigchecker : Sigchecker.t;
proxy : Downloader.proxy_mode;
}
val get_index : prog:string -> verbose:bool -> downloader:Downloader.t -> sigchecker:Sigchecker.t -> proxy:Downloader.proxy_mode -> string -> index

38
builder/ini_reader.ml Normal file
View File

@@ -0,0 +1,38 @@
(* virt-builder
* Copyright (C) 2013-2014 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.
*)
type sections = section list
and section = string * fields (* [name] + fields *)
and fields = field list
and field = string * string option * string (* key + subkey + value *)
(* Types returned by the C index parser. *)
type c_sections = c_section array
and c_section = string * c_fields (* [name] + fields *)
and c_fields = field array
(* Calls yyparse in the C code. *)
external parse_index : prog:string -> error_suffix:string -> string -> c_sections = "virt_builder_parse_index"
let read_ini ~prog ?(error_suffix = "") file =
let sections = parse_index ~prog ~error_suffix file in
let sections = Array.to_list sections in
List.map (
fun (n, fields) ->
n, Array.to_list fields
) sections

24
builder/ini_reader.mli Normal file
View File

@@ -0,0 +1,24 @@
(* virt-builder
* Copyright (C) 2013-2014 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.
*)
type sections = section list
and section = string * fields (* [name] + fields *)
and fields = field list
and field = string * string option * string (* key + subkey + value *)
val read_ini : prog:string -> ?error_suffix:string -> string -> sections

57
builder/languages.ml Normal file
View File

@@ -0,0 +1,57 @@
(* virt-builder
* Copyright (C) 2013-2014 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.
*)
open Common_utils
let split_locale loc =
let regex = Str.regexp "^\\([A-Za-z]+\\)\\(_\\([A-Za-z]+\\)\\)?\\(\\.\\([A-Za-z0-9-]+\\)\\)?\\(@\\([A-Za-z]+\\)\\)?$" in
let l = ref [] in
if Str.string_match regex loc 0 then (
let match_or_empty n =
try Str.matched_group n loc with
| Not_found -> ""
in
let lang = Str.matched_group 1 loc in
let territory = match_or_empty 3 in
(match territory with
| "" -> ()
| territory -> l := (lang ^ "_" ^ territory) :: !l);
l := lang :: !l;
);
l := "" :: !l;
List.rev !l
let languages () =
match Setlocale.setlocale Setlocale.LC_MESSAGES None with
| None -> [""]
| Some locale -> split_locale locale
let find_notes languages notes =
let notes = List.fold_left (
fun acc lang ->
let res = List.filter (
fun (langkey, _) ->
match langkey with
| "C" -> lang = ""
| langkey -> langkey = lang
) notes in
match res with
| (_, noteskey) :: _ -> noteskey :: acc
| [] -> acc
) [] languages in
List.rev notes

21
builder/languages.mli Normal file
View File

@@ -0,0 +1,21 @@
(* virt-builder
* Copyright (C) 2014 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.
*)
val languages : unit -> string list
val find_notes : string list -> (string * string) list -> string list

View File

@@ -0,0 +1,3 @@
[libguestfs.org]
uri=http://libguestfs.org/download/builder/index.asc
gpgkey=file://@SYSCONFDIR@/xdg/virt-builder/repos.d/libguestfs.gpg

64
builder/libguestfs.gpg Normal file
View File

@@ -0,0 +1,64 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.14 (GNU/Linux)
mQINBE6UMMEBEADM811hfTulaF4JpkVpAI10FImyb4ArvOiu8NdcUwTFo+cyWno3
U85B86H1Bsk/LgLTYtthSrTgsCtdxy+i5OaMjxZDIwKQ2+IYI3FCn9T3Mn28Idyh
kLHzrO9ph0Dv0BNfrlDZhQEC53aAFe/QxN7+A49BNBV7D1VAOOCsHjxMEDzcZkCa
oCrtXw1aNm2vkkj5ukbfukHAyLcQL7kow0qKPSVa1G4lfQP0WiG259Ydy+sUmbVb
TGdb6MEC84PQRDuw6/ZeoV04tn7ZNtQEMOS0uiciHOGfr2hBxQf9VIPNrHg42yaL
dOv51D99GuaxZ9E0HSoH/RwB1oXgd6rFdqVNYaBIQnnkwJANUEeGBArtIOZNCADT
Bt8vkSDm+lLEAFS+V8CACyW/LMIrGCvLdHeqtoAv0GDVyR2GPxldYfdtEmCUMWcb
Jlf71V9iAse2gUdoiHp5FfpGMkA5j7idKuxIws11XxRZJXXbBqiBqmVEAQ/v0m6p
kdo0MYTHydmecLuUK2bAGhpysfX97EfTSrxfrYphYWjTfKRD9GrADeZNfuz1DbKs
7LSqVaQJSjQrfgAwcnZLRaU0V4P5zxiz50gz1Aj3AZRL+Y3meZenzZTXcLFdnusg
wUfhhCuL3tluMtEh6tznumyxb43WO1yLwj6J6LtveiuJN1Z+KSQ6OieZcwARAQAB
tCVSaWNoYXJkIFcuTS4gSm9uZXMgPHJpY2hAYW5uZXhpYS5vcmc+iQI4BBMBAgAi
BQJOlDDBAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRCRc49z4bdooHQY
D/wJLklSZNyXIW+rG5sUbg7j9cTIF5p/lB9kI2yx6KodJp/2knKyvnmzz0gBw/OE
HL4E4UW26oWKo+36I8wkBnuGa6UtANeITcJqFE19VpHEXHsxre64jNQnO8/w748W
1ROW+Ry43xmrlRWKuCm4oPYUzlp0fq9ATAne8eblfG+NOs8DYuA8xZNQzFaI2kDC
QLD4YoXLoNsP27Koga36b0KwxPFD9tyVZiu9XDH/3hMN7Nb15B66PFr+HcMmQ67G
nUIN5ulcIwj38i40cyaTs1VRheOzTHXE/a6Q2AhMKiKqOoEjQ73/mV7cAVoPtM3o
83Q/8aVKBH0bVRwAeV1tju6b14fqKoG0zNBEcXdlSkht6ScxJYIc/LPUxAMDwgSE
OWshjmeRzKXypBbHn/DP8QVyM2gk5wY+mMSH7MpR0p/hgj+rFO8H9L7pC4dCog3E
qzrYhRN+TaP6MPH3WkOwPH4d4IfQRFnHp+VPYPijKEiLrUl/o8k3DyAanAPBpJ/x
na4wXAjlFBctOq6g+SrCUiHpwk7b2YNwGgr5Vl3GmZELzK/G8gg3uJYKQ9Bpv16t
WWOz+IFiOFa0UULeo0QPmFAIMZiDojNsY1SwBKB3ZL1YWZezgMdQAbpze/IXoSt7
zxWJoKH2jK7q9mvFiaY12l2YnKuCcegWVAViLxRpBnrbz7QmUmljaGFyZCBXLk0u
IEpvbmVzIDxyam9uZXNAcmVkaGF0LmNvbT6JAjgEEwECACIFAk6UOQsCGwMGCwkI
BwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEJFzj3Pht2igIUYQAKomI0edLakahsUQ
MxOZuhBbXJ4/VWF8bXYChDNPKvJp5nB7fBXujJ+39cIUM5fe2ViO6qSDpFC29imx
F5pPbAqspZBPBkLLiZLji8R42hGarntdtTW0UWSBpq+nC5+G1psrnATI3uXGNxKQ
R99c5HoMY7dBC2Y8TCGE64NINZ/XVh472s6IGLPn8MTn26YdRKC9BrVkCFMP2OBr
6D4IprnyTAWAzb68ew20QmyWO+NBi9MplaDNQVl8PIOgfpyWlkgX1z9m67pcSDkw
46hksp0yuOD1VwR4iVZ2/CmIsGRUlx41vWD6BIp9KxKyDIU1CYTRhq72dahHsl/8
BjCndV5PO0GphqfCzmCv4DXjUwmrMTbH/GFnt5rfwcMcXUgcK0vV9vQ2SOU56Zd1
fb27ZCFJKZc0Fu8krwFldCp/NYILf6ogUL/C1hfuCGSSuyDVY16Gg3dla1x+6zpF
asnWQlaw8xT5LlMWvTZs5WsoSVHu7dVZWlgxINP++hlZrTz/S8l38yyQ15YFFl3W
9M7dzkegOeDTPfx6B89WgfvfJjA/D0/FYxxWPXEtrn9DlJ4daEJqNsrvfLErz9R8
4IQmfmhR93j+rdotner+6keC/wVByEfbW1wmXtmFKXQ6srdpj8VKRFrvkyXVgepM
DypLgRH2v7lL2kdWhUu2y4EAgrwzuQINBE6UMMEBEADxQxMgUuDrw5GT4tqARTPI
SSdNcUsRxRhVA8srYOyECliE+B3TwcRDFBs+MyPFJVEuX8fi4eGj/AK5t1GHerfk
orUGlz72q4c7LLhkfZrsuJbk2dgkjvldKJnIazQJa6epGLqdsE5RlmSgwedIbtMd
naGJBQH8aKP/Wi1+wUxsm5N3p7+R2WRx48VfpEhYB+Zf/FkFm1Ycjwh57KQ0+OHw
ykf8VfMisxuH30tDxOCV+VptWKfOF2rDNdaNPWhij2YIjhJXRpkuRR+1PpI4jLaD
JxcVZmG/0zucacupUN2g5OUH59ySU/totD6YMnmp3FONoyF1uIEJo6Vs30npHGkO
XgBo3Pxt7oLJeykLPtdSLgm3cwXIYMWarVsAkKNXitQIVGpVRLeaK373VwmXFqoi
M2SMHeawTUdOORFjpQzkknlJWM1TmUVtHHKt8Pl9+/5+wXKyt2IDdcUkMrB6K5qF
fb7EwVhoI8ehJQK+eeDCjFwCAiwB3iV8JlyW+tEU7JuyXOQlwY1VWm/WqMD8gaRi
rT+RFDFliZ3tQbW2pqUoZBROV5HN4tieDfwxGKCvk6Tsdb30zA9DPQp93+238bYf
312sg9R+CD0AqxoxFG5FJu4HShcPRrPnYtRZqKRe40GDWvBEArXZprwL1qrP+Kl/
mRrEQpxAGIoFG8HbVvD3EQARAQABiQIfBBgBAgAJBQJOlDDBAhsMAAoJEJFzj3Ph
t2igSLQP/2uIrAY2CDr0kWBJiD3TztiHy8IdxwUpyTBTebwmAbi44/EvtJfIisrG
YjKIEv/w0E61gO7O1JBG4+IG93W+v9fTT/e39JMyxsYqoZZHUhP11Okx5grDS5b0
O8VXOmXVRMdVNfstRBr10HD9uNDq7ruKD18TxYTwN0GPD4gj1dbHQDR77Tr5cyBs
6Ou5PBOH4r3qcqf/cJUSMeUUu75xLwixux6E7tD2S+t6F07wlWxntUcPtzyAHj20
J89orUC+dT6r6MypBoI0jdJCp9JPGtR7i+fE5Gm4E5+AUSubLPtZGRY9Um2eMoS2
DnQpGOKx1VvsixR/Kw44j2tRAvmYMS4iDKcuZU+nZ+xokAgObILj/b9n/Qe2/fXy
CFdcgSvbm+dV1fZxsdMF/P9OU8aqdT9A9Fv5y+cDMEg4DVnhwMJTxGh/TCkw/H+A
frHEtRc98lSQN5odpITNG17mG6JOdHM+wA57qHH0uy4+5RsbyAJahcdBcmObK/RF
i4WZlThpbHftX5O/LH98aYQ2fJayIxv1EAjzOBOQ0MfBHI0KCJR1pysEisX28sJA
Ic73gnJJ3BLZbqfBRgxjNMNroxC+5Tw6uPGFHa3YnuIAxxw0HcDVZ9vnTWBWFPGw
ZvXkQ3FVJwZoLmHw47vvlVpLD/4gi1SuHWieRvZ+UdDq00E348pm
=neBW
-----END PGP PUBLIC KEY BLOCK-----

188
builder/list_entries.ml Normal file
View File

@@ -0,0 +1,188 @@
(* virt-builder
* Copyright (C) 2013 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.
*)
open Common_gettext.Gettext
open Common_utils
open Printf
let rec list_entries ~list_format ~sources index =
match list_format with
| `Short -> list_entries_short index
| `Long -> list_entries_long ~sources index
| `Json -> list_entries_json ~sources index
and list_entries_short index =
List.iter (
fun (name, { Index_parser.printable_name = printable_name;
arch = arch;
hidden = hidden }) ->
if not hidden then (
printf "%-24s" name;
printf " %-10s" arch;
(match printable_name with
| None -> ()
| Some s -> printf " %s" s
);
printf "\n"
)
) index
and list_entries_long ~sources index =
let langs = Languages.languages () in
List.iter (
fun (source, key, proxy) ->
printf (f_"Source URI: %s\n") source;
(match key with
| Sigchecker.No_Key -> ()
| Sigchecker.Fingerprint fp ->
printf (f_"Fingerprint: %s\n") fp;
| Sigchecker.KeyFile kf ->
printf (f_"Key: %s\n") kf;
);
printf "\n"
) sources;
List.iter (
fun (name, { Index_parser.printable_name = printable_name;
arch = arch;
size = size;
compressed_size = compressed_size;
notes = notes;
aliases = aliases;
hidden = hidden }) ->
if not hidden then (
printf "%-24s %s\n" "os-version:" name;
(match printable_name with
| None -> ()
| Some name -> printf "%-24s %s\n" (s_"Full name:") name;
);
printf "%-24s %s\n" (s_"Architecture:") arch;
printf "%-24s %s\n" (s_"Minimum/default size:") (human_size size);
(match compressed_size with
| None -> ()
| Some size ->
printf "%-24s %s\n" (s_"Download size:") (human_size size);
);
(match aliases with
| None -> ()
| Some l -> printf "%-24s %s\n" (s_"Aliases:")
(String.concat " " l);
);
let notes = Languages.find_notes langs notes in
(match notes with
| notes :: _ ->
printf "\n";
printf (f_"Notes:\n\n%s\n") notes
| [] -> ()
);
printf "\n"
)
) index
and list_entries_json ~sources index =
let trailing_comma index size =
if index = size - 1 then "" else "," in
let json_string_of_bool b =
if b then "true" else "false" in
let json_string_escape str =
let res = ref "" in
for i = 0 to String.length str - 1 do
res := !res ^ (match str.[i] with
| '"' -> "\\\""
| '\\' -> "\\\\"
| '\b' -> "\\b"
| '\n' -> "\\n"
| '\r' -> "\\r"
| '\t' -> "\\t"
| c -> String.make 1 c)
done;
!res in
let json_optional_printf_string key = function
| None -> ()
| Some str ->
printf " \"%s\": \"%s\",\n" key (json_string_escape str) in
let json_optional_printf_int64 key = function
| None -> ()
| Some n ->
printf " \"%s\": \"%Ld\",\n" key n in
let json_optional_printf_stringlist key = function
| None -> ()
| Some l ->
printf " \"%s\": [" key;
iteri (
fun i alias ->
printf " \"%s\"%s" alias (trailing_comma i (List.length l))
) l;
printf " ],\n" in
let print_notes = function
| [] -> ()
| notes ->
printf " \"notes\": {\n";
iteri (
fun i (lang, langnotes) ->
let lang =
match lang with
| "" -> "C"
| x -> x in
printf " \"%s\": \"%s\"%s\n"
(json_string_escape lang) (json_string_escape langnotes)
(trailing_comma i (List.length notes))
) notes;
printf " },\n" in
printf "{\n";
printf " \"version\": %d,\n" 1;
printf " \"sources\": [\n";
iteri (
fun i (source, key, proxy) ->
printf " {\n";
(match key with
| Sigchecker.No_Key -> ()
| Sigchecker.Fingerprint fp ->
printf " \"fingerprint\": \"%s\",\n" fp;
| Sigchecker.KeyFile kf ->
printf " \"key\": \"%s\",\n" kf;
);
printf " \"uri\": \"%s\"\n" source;
printf " }%s\n" (trailing_comma i (List.length sources))
) sources;
printf " ],\n";
printf " \"templates\": [\n";
iteri (
fun i (name, { Index_parser.printable_name = printable_name;
arch = arch;
size = size;
compressed_size = compressed_size;
notes = notes;
aliases = aliases;
hidden = hidden }) ->
printf " {\n";
printf " \"os-version\": \"%s\",\n" name;
json_optional_printf_string "full-name" printable_name;
printf " \"arch\": \"%s\",\n" arch;
printf " \"size\": %Ld,\n" size;
json_optional_printf_int64 "compressed-size" compressed_size;
print_notes notes;
json_optional_printf_stringlist "aliases" aliases;
printf " \"hidden\": %s\n" (json_string_of_bool hidden);
printf " }%s\n" (trailing_comma i (List.length index))
) index;
printf " ]\n";
printf "}\n"

19
builder/list_entries.mli Normal file
View File

@@ -0,0 +1,19 @@
(* virt-builder
* Copyright (C) 2013 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.
*)
val list_entries : list_format:([ `Short | `Long | `Json ]) -> sources:(string * Sigchecker.gpgkey_type * Downloader.proxy_mode) list -> Index_parser.index -> unit

41
builder/paths.ml Normal file
View File

@@ -0,0 +1,41 @@
(* virt-builder
* Copyright (C) 2014 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.
*)
open Common_utils
let xdg_cache_home =
try Some (Sys.getenv "XDG_CACHE_HOME" // "virt-builder")
with Not_found ->
try Some (Sys.getenv "HOME" // ".cache" // "virt-builder")
with Not_found ->
None (* no cache directory *)
let xdg_config_home ~prog =
try Some (Sys.getenv "XDG_CONFIG_HOME" // prog)
with Not_found ->
try Some (Sys.getenv "HOME" // ".config" // prog)
with Not_found ->
None (* no config directory *)
let xdg_config_dirs ~prog =
let dirs =
try Sys.getenv "XDG_CONFIG_DIRS"
with Not_found -> "/etc/xdg" in
let dirs = string_nsplit ":" dirs in
let dirs = List.filter (fun x -> x <> "") dirs in
List.map (fun x -> x // prog) dirs

668
builder/pxzcat-c.c Normal file
View File

@@ -0,0 +1,668 @@
/* virt-builder
* Copyright (C) 2013 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 <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <pthread.h>
#include <caml/alloc.h>
#include <caml/fail.h>
#include <caml/memory.h>
#include <caml/mlvalues.h>
#include "ignore-value.h"
#if HAVE_LIBLZMA
#include <lzma.h>
#endif
#ifdef HAVE_CAML_UNIXSUPPORT_H
#include <caml/unixsupport.h>
#else
#define Nothing ((value) 0)
extern void unix_error (int errcode, char * cmdname, value arg) Noreturn;
#endif
#if defined (HAVE_LIBLZMA) && \
defined (HAVE_LZMA_INDEX_STREAM_FLAGS) && \
defined (HAVE_LZMA_INDEX_STREAM_PADDING)
#define PARALLEL_XZCAT 1
#else
#define PARALLEL_XZCAT 0
#endif
value
virt_builder_using_parallel_xzcat (value unitv)
{
return PARALLEL_XZCAT ? Val_true : Val_false;
}
#if PARALLEL_XZCAT
static void pxzcat (value filenamev, value outputfilev, unsigned nr_threads);
#endif /* PARALLEL_XZCAT */
value
virt_builder_pxzcat (value inputfilev, value outputfilev)
{
CAMLparam2 (inputfilev, outputfilev);
#if PARALLEL_XZCAT
/* Parallel implementation of xzcat (pxzcat). */
/* XXX Make number of threads configurable? */
long i;
unsigned nr_threads;
i = sysconf (_SC_NPROCESSORS_ONLN);
if (i <= 0) {
perror ("could not get number of cores");
i = 1;
}
nr_threads = (unsigned) i;
/* NB: This might throw an exception if something fails. If it
* does, this function won't return as a regular C function.
*/
pxzcat (inputfilev, outputfilev, nr_threads);
#else /* !PARALLEL_XZCAT */
/* Fallback: use regular xzcat. */
int fd;
pid_t pid;
int status;
fd = open (String_val (outputfilev), O_WRONLY|O_CREAT|O_TRUNC|O_NOCTTY, 0666);
if (fd == -1)
unix_error (errno, "open", outputfilev);
pid = fork ();
if (pid == -1) {
int err = errno;
close (fd);
unix_error (err, "fork", Nothing);
}
if (pid == 0) { /* child - run xzcat */
dup2 (fd, 1);
execlp (XZCAT, XZCAT, String_val (inputfilev), NULL);
perror (XZCAT);
_exit (EXIT_FAILURE);
}
close (fd);
if (waitpid (pid, &status, 0) == -1)
unix_error (errno, "waitpid", Nothing);
if (!WIFEXITED (status) || WEXITSTATUS (status) != 0)
caml_failwith (XZCAT " program failed, see earlier error messages");
#endif /* !PARALLEL_XZCAT */
CAMLreturn (Val_unit);
}
#if PARALLEL_XZCAT
#define DEBUG 0
#if DEBUG
#define debug(fs,...) fprintf (stderr, "pxzcat: debug: " fs "\n", ## __VA_ARGS__)
#else
#define debug(fs,...) /* nothing */
#endif
/* Size of buffers used in decompression loop. */
#define BUFFER_SIZE (64*1024)
#define XZ_HEADER_MAGIC "\xfd" "7zXZ\0"
#define XZ_HEADER_MAGIC_LEN 6
#define XZ_FOOTER_MAGIC "YZ"
#define XZ_FOOTER_MAGIC_LEN 2
static int check_header_magic (int fd);
static lzma_index *parse_indexes (value filenamev, int fd);
static void iter_blocks (lzma_index *idx, unsigned nr_threads, value filenamev, int fd, value outputfilev, int ofd);
static void
pxzcat (value filenamev, value outputfilev, unsigned nr_threads)
{
int fd, ofd;
uint64_t size;
lzma_index *idx;
/* Open the file. */
fd = open (String_val (filenamev), O_RDONLY);
if (fd == -1)
unix_error (errno, "open", filenamev);
/* Check file magic. */
if (!check_header_magic (fd)) {
close (fd);
caml_invalid_argument ("input file is not an xz file");
}
/* Read and parse the indexes. */
idx = parse_indexes (filenamev, fd);
/* Get the file uncompressed size, create the output file. */
size = lzma_index_uncompressed_size (idx);
debug ("uncompressed size = %" PRIu64 " bytes", size);
/* Avoid annoying ext4 auto_da_alloc which causes a flush on close
* unless we are very careful about not truncating a regular file
* from non-zero size to zero size. (Thanks Eric Sandeen)
*/
ofd = open (String_val (outputfilev), O_WRONLY|O_CREAT|O_NOCTTY, 0644);
if (ofd == -1) {
int err = errno;
close (fd);
unix_error (err, "open", outputfilev);
}
if (ftruncate (ofd, 1) == -1) {
int err = errno;
close (fd);
unix_error (err, "ftruncate", outputfilev);
}
if (lseek (ofd, 0, SEEK_SET) == -1) {
int err = errno;
close (fd);
unix_error (err, "lseek", outputfilev);
}
if (write (ofd, "\0", 1) == -1) {
int err = errno;
close (fd);
unix_error (err, "write", outputfilev);
}
if (ftruncate (ofd, size) == -1) {
int err = errno;
close (fd);
unix_error (err, "ftruncate", outputfilev);
}
/* Tell the kernel we won't read the output file. */
ignore_value (posix_fadvise (fd, 0, 0, POSIX_FADV_RANDOM|POSIX_FADV_DONTNEED));
/* Iterate over blocks. */
iter_blocks (idx, nr_threads, filenamev, fd, outputfilev, ofd);
lzma_index_end (idx, NULL);
if (close (fd) == -1)
unix_error (errno, "close", filenamev);
}
static int
check_header_magic (int fd)
{
char buf[XZ_HEADER_MAGIC_LEN];
if (lseek (fd, 0, SEEK_SET) == -1)
return 0;
if (read (fd, buf, XZ_HEADER_MAGIC_LEN) != XZ_HEADER_MAGIC_LEN)
return 0;
if (memcmp (buf, XZ_HEADER_MAGIC, XZ_HEADER_MAGIC_LEN) != 0)
return 0;
return 1;
}
/* For explanation of this function, see src/xz/list.c:parse_indexes
* in the xz sources.
*/
static lzma_index *
parse_indexes (value filenamev, int fd)
{
lzma_ret r;
off_t pos, index_size;
uint8_t footer[LZMA_STREAM_HEADER_SIZE];
uint8_t header[LZMA_STREAM_HEADER_SIZE];
lzma_stream_flags footer_flags;
lzma_stream_flags header_flags;
lzma_stream strm = LZMA_STREAM_INIT;
ssize_t n;
lzma_index *combined_index = NULL;
lzma_index *this_index = NULL;
lzma_vli stream_padding = 0;
size_t nr_streams = 0;
/* Check file size is a multiple of 4 bytes. */
pos = lseek (fd, 0, SEEK_END);
if (pos == (off_t) -1)
unix_error (errno, "lseek", filenamev);
if ((pos & 3) != 0)
caml_invalid_argument ("input not an xz file: size is not a multiple of 4 bytes");
/* Jump backwards through the file identifying each stream. */
while (pos > 0) {
debug ("looping through streams: pos = %" PRIu64, (uint64_t) pos);
if (pos < LZMA_STREAM_HEADER_SIZE)
caml_invalid_argument ("corrupted xz file");
if (lseek (fd, -LZMA_STREAM_HEADER_SIZE, SEEK_CUR) == -1)
unix_error (errno, "lseek", filenamev);
if (read (fd, footer, LZMA_STREAM_HEADER_SIZE) != LZMA_STREAM_HEADER_SIZE)
unix_error (errno, "read", filenamev);
/* Skip stream padding. */
if (footer[8] == 0 && footer[9] == 0 &&
footer[10] == 0 && footer[11] == 0) {
stream_padding += 4;
pos -= 4;
continue;
}
pos -= LZMA_STREAM_HEADER_SIZE;
nr_streams++;
debug ("decode stream footer at pos = %" PRIu64, (uint64_t) pos);
/* Does the stream footer look reasonable? */
r = lzma_stream_footer_decode (&footer_flags, footer);
if (r != LZMA_OK) {
fprintf (stderr, "invalid stream footer - error %d\n", r);
caml_invalid_argument ("invalid stream footer");
}
debug ("backward_size = %" PRIu64, (uint64_t) footer_flags.backward_size);
index_size = footer_flags.backward_size;
if (pos < index_size + LZMA_STREAM_HEADER_SIZE)
caml_invalid_argument ("invalid stream footer");
pos -= index_size;
debug ("decode index at pos = %" PRIu64, (uint64_t) pos);
/* Seek backwards to the index of this stream. */
if (lseek (fd, pos, SEEK_SET) == -1)
unix_error (errno, "lseek", filenamev);
/* Decode the index. */
r = lzma_index_decoder (&strm, &this_index, UINT64_MAX);
if (r != LZMA_OK) {
fprintf (stderr, "invalid stream index - error %d\n", r);
caml_invalid_argument ("invalid stream index");
}
do {
uint8_t buf[BUFSIZ];
strm.avail_in = index_size;
if (strm.avail_in > BUFSIZ)
strm.avail_in = BUFSIZ;
n = read (fd, &buf, strm.avail_in);
if (n == -1)
unix_error (errno, "read", filenamev);
index_size -= strm.avail_in;
strm.next_in = buf;
r = lzma_code (&strm, LZMA_RUN);
} while (r == LZMA_OK);
if (r != LZMA_STREAM_END) {
fprintf (stderr, "could not parse index - error %d\n", r);
caml_invalid_argument ("could not parse index");
}
pos -= lzma_index_total_size (this_index) + LZMA_STREAM_HEADER_SIZE;
debug ("decode stream header at pos = %" PRIu64, (uint64_t) pos);
/* Read and decode the stream header. */
if (lseek (fd, pos, SEEK_SET) == -1)
unix_error (errno, "lseek", filenamev);
if (read (fd, header, LZMA_STREAM_HEADER_SIZE) != LZMA_STREAM_HEADER_SIZE)
unix_error (errno, "read stream header", filenamev);
r = lzma_stream_header_decode (&header_flags, header);
if (r != LZMA_OK) {
fprintf (stderr, "invalid stream header - error %d\n", r);
caml_invalid_argument ("invalid stream header");
}
/* Header and footer of the stream should be equal. */
r = lzma_stream_flags_compare (&header_flags, &footer_flags);
if (r != LZMA_OK) {
fprintf (stderr, "header and footer of stream are not equal - error %d\n",
r);
caml_invalid_argument ("header and footer of stream are not equal");
}
/* Store the decoded stream flags in this_index. */
r = lzma_index_stream_flags (this_index, &footer_flags);
if (r != LZMA_OK) {
fprintf (stderr, "cannot read stream_flags from index - error %d\n", r);
caml_invalid_argument ("cannot read stream_flags from index");
}
/* Store the amount of stream padding so far. Needed to calculate
* compressed offsets correctly in multi-stream files.
*/
r = lzma_index_stream_padding (this_index, stream_padding);
if (r != LZMA_OK) {
fprintf (stderr, "cannot set stream_padding in index - error %d\n", r);
caml_invalid_argument ("cannot set stream_padding in index");
}
if (combined_index != NULL) {
r = lzma_index_cat (this_index, combined_index, NULL);
if (r != LZMA_OK) {
fprintf (stderr, "cannot combine indexes - error %d\n", r);
caml_invalid_argument ("cannot combine indexes");
}
}
combined_index = this_index;
this_index = NULL;
}
lzma_end (&strm);
return combined_index;
}
/* Return true iff the buffer is all zero bytes.
*
* Note that gcc is smart enough to optimize this properly:
* http://stackoverflow.com/questions/1493936/faster-means-of-checking-for-an-empty-buffer-in-c/1493989#1493989
*/
static inline int
is_zero (const unsigned char *buffer, size_t size)
{
size_t i;
for (i = 0; i < size; ++i) {
if (buffer[i] != 0)
return 0;
}
return 1;
}
struct global_state {
/* Current iterator. Threads update this, but it is protected by a
* mutex, and each thread takes a copy of it when working on it.
*/
lzma_index_iter iter;
lzma_bool iter_finished;
pthread_mutex_t iter_mutex;
/* Note that all threads are accessing these fds, so you have
* to use pread/pwrite instead of lseek!
*/
/* Input file. */
const char *filename;
int fd;
/* Output file. */
const char *outputfile;
int ofd;
};
struct per_thread_state {
unsigned thread_num;
struct global_state *global;
int status;
};
/* Create threads to iterate over the blocks and uncompress. */
static void *worker_thread (void *vp);
static void
iter_blocks (lzma_index *idx, unsigned nr_threads,
value filenamev, int fd, value outputfilev, int ofd)
{
struct global_state global;
struct per_thread_state per_thread[nr_threads];
pthread_t thread[nr_threads];
unsigned u, nr_errors;
int err;
void *status;
lzma_index_iter_init (&global.iter, idx);
global.iter_finished = 0;
err = pthread_mutex_init (&global.iter_mutex, NULL);
if (err != 0)
unix_error (err, "pthread_mutex_init", Nothing);
global.filename = String_val (filenamev);
global.fd = fd;
global.outputfile = String_val (outputfilev);
global.ofd = ofd;
for (u = 0; u < nr_threads; ++u) {
per_thread[u].thread_num = u;
per_thread[u].global = &global;
}
/* Start the threads. */
for (u = 0; u < nr_threads; ++u) {
err = pthread_create (&thread[u], NULL, worker_thread, &per_thread[u]);
if (err != 0)
unix_error (err, "pthread_create", Nothing);
}
/* Wait for the threads to exit. */
nr_errors = 0;
for (u = 0; u < nr_threads; ++u) {
err = pthread_join (thread[u], &status);
if (err != 0) {
fprintf (stderr, "pthread_join (%u): %s\n", u, strerror (err));
nr_errors++;
}
if (*(int *)status == -1)
nr_errors++;
}
if (nr_errors > 0)
caml_invalid_argument ("some threads failed, see earlier errors");
}
/* Iterate over the blocks and uncompress. */
static void *
worker_thread (void *vp)
{
struct per_thread_state *state = vp;
struct global_state *global = state->global;
lzma_index_iter iter;
int err;
off_t position, oposition;
uint8_t header[LZMA_BLOCK_HEADER_SIZE_MAX];
ssize_t n;
lzma_block block;
lzma_filter filters[LZMA_FILTERS_MAX + 1];
lzma_ret r;
lzma_stream strm = LZMA_STREAM_INIT;
uint8_t buf[BUFFER_SIZE];
unsigned char outbuf[BUFFER_SIZE];
size_t i;
lzma_bool iter_finished;
state->status = -1;
for (;;) {
/* Get the next block. */
err = pthread_mutex_lock (&global->iter_mutex);
if (err != 0) abort ();
iter_finished = global->iter_finished;
if (!iter_finished) {
iter_finished = global->iter_finished =
lzma_index_iter_next (&global->iter, LZMA_INDEX_ITER_NONEMPTY_BLOCK);
if (!iter_finished)
/* Take a local copy of this iterator since another thread will
* update the global version.
*/
iter = global->iter;
}
err = pthread_mutex_unlock (&global->iter_mutex);
if (err != 0) abort ();
if (iter_finished)
break;
/* Read the block header. Start by reading a single byte which
* tell us how big the block header is.
*/
position = iter.block.compressed_file_offset;
n = pread (global->fd, header, 1, position);
if (n == 0) {
fprintf (stderr,
"%s: read: unexpected end of file reading block header byte\n",
global->filename);
return &state->status;
}
if (n == -1) {
perror (String_val (global->filename));
return &state->status;
}
position++;
if (header[0] == '\0') {
fprintf (stderr,
"%s: read: unexpected invalid block in file, header[0] = 0\n",
global->filename);
return &state->status;
}
block.version = 0;
block.check = iter.stream.flags->check;
block.filters = filters;
block.header_size = lzma_block_header_size_decode (header[0]);
/* Now read and decode the block header. */
n = pread (global->fd, &header[1], block.header_size-1, position);
if (n >= 0 && n != block.header_size-1) {
fprintf (stderr,
"%s: read: unexpected end of file reading block header\n",
global->filename);
return &state->status;
}
if (n == -1) {
perror (global->filename);
return &state->status;
}
position += n;
r = lzma_block_header_decode (&block, NULL, header);
if (r != LZMA_OK) {
fprintf (stderr, "%s: invalid block header (error %d)\n",
global->filename, r);
return &state->status;
}
/* What this actually does is it checks that the block header
* matches the index.
*/
r = lzma_block_compressed_size (&block, iter.block.unpadded_size);
if (r != LZMA_OK) {
fprintf (stderr,
"%s: cannot calculate compressed size (error %d)\n",
global->filename, r);
return &state->status;
}
/* Where we will start writing to. */
oposition = iter.block.uncompressed_file_offset;
/* Read the block data and uncompress it. */
r = lzma_block_decoder (&strm, &block);
if (r != LZMA_OK) {
fprintf (stderr, "%s: invalid block (error %d)\n", global->filename, r);
return &state->status;
}
strm.next_in = NULL;
strm.avail_in = 0;
strm.next_out = outbuf;
strm.avail_out = sizeof outbuf;
for (;;) {
lzma_action action = LZMA_RUN;
if (strm.avail_in == 0) {
strm.next_in = buf;
n = pread (global->fd, buf, sizeof buf, position);
if (n == -1) {
perror (global->filename);
return &state->status;
}
position += n;
strm.avail_in = n;
if (n == 0)
action = LZMA_FINISH;
}
r = lzma_code (&strm, action);
if (strm.avail_out == 0 || r == LZMA_STREAM_END) {
size_t wsz = sizeof outbuf - strm.avail_out;
/* Don't write if the block is all zero, to preserve output file
* sparseness. However we have to update oposition.
*/
if (!is_zero (outbuf, wsz)) {
if (pwrite (global->ofd, outbuf, wsz, oposition) != wsz) {
/* XXX Handle short writes. */
perror (global->filename);
return &state->status;
}
}
oposition += wsz;
strm.next_out = outbuf;
strm.avail_out = sizeof outbuf;
}
if (r == LZMA_STREAM_END)
break;
if (r != LZMA_OK) {
fprintf (stderr,
"%s: could not parse block data (error %d)\n",
global->filename, r);
return &state->status;
}
}
lzma_end (&strm);
for (i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i)
free (filters[i].options);
}
state->status = 0;
return &state->status;
}
#endif /* PARALLEL_XZCAT */

20
builder/pxzcat.ml Normal file
View File

@@ -0,0 +1,20 @@
(* virt-builder
* Copyright (C) 2013 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.
*)
external pxzcat : string -> string -> unit = "virt_builder_pxzcat"
external using_parallel_xzcat : unit -> bool = "virt_builder_using_parallel_xzcat" "noalloc"

34
builder/pxzcat.mli Normal file
View File

@@ -0,0 +1,34 @@
(* virt-builder
* Copyright (C) 2013 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.
*)
(** {1 Parallel xzcat (or fall back to regular xzcat).}
Eventually regular xzcat will be able to work in parallel and this
code can go away.
*)
val pxzcat : string -> string -> unit
(** [pxzcat input output] uncompresses the file [input] to the file
[output]. The input and output must both be seekable.
If liblzma was found at compile time, this uses an internal
implementation of parallel xzcat. Otherwise regular xzcat is
used. *)
val using_parallel_xzcat : unit -> bool
(** Returns [true] iff the implementation uses parallel xzcat. *)

59
builder/setlocale-c.c Normal file
View File

@@ -0,0 +1,59 @@
/* virt-builder
* Copyright (C) 2014 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 <locale.h>
#include <caml/alloc.h>
#include <caml/fail.h>
#include <caml/memory.h>
#include <caml/mlvalues.h>
static const int lc_string_table[7] = {
LC_ALL,
LC_CTYPE,
LC_NUMERIC,
LC_TIME,
LC_COLLATE,
LC_MONETARY,
LC_MESSAGES
};
#define Val_none (Val_int (0))
value
virt_builder_setlocale (value val_category, value val_name)
{
CAMLparam2 (val_category, val_name);
CAMLlocal2 (rv, rv2);
char *ret, *locstring;
int category;
category = lc_string_table[Int_val (val_category)];
locstring = val_name == Val_none ? NULL : String_val (Field (val_name, 0));
ret = setlocale (category, locstring);
if (ret) {
rv2 = caml_copy_string (ret);
rv = caml_alloc (1, 0);
Store_field (rv, 0, rv2);
} else
rv = Val_none;
CAMLreturn (rv);
}

29
builder/setlocale.ml Normal file
View File

@@ -0,0 +1,29 @@
(* virt-builder
* Copyright (C) 2014 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.
*)
type localecategory =
| LC_ALL
| LC_CTYPE
| LC_NUMERIC
| LC_TIME
| LC_COLLATE
| LC_MONETARY
| LC_MESSAGES
;;
external setlocale : localecategory -> string option -> string option = "virt_builder_setlocale"

30
builder/setlocale.mli Normal file
View File

@@ -0,0 +1,30 @@
(* virt-builder
* Copyright (C) 2014 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.
*)
type localecategory =
| LC_ALL
| LC_CTYPE
| LC_NUMERIC
| LC_TIME
| LC_COLLATE
| LC_MONETARY
| LC_MESSAGES
;;
val setlocale : localecategory -> string option -> string option
(** [setlocale category newlocale] Tiny wrapper to the C [setlocale]. *)

219
builder/sigchecker.ml Normal file
View File

@@ -0,0 +1,219 @@
(* virt-builder
* Copyright (C) 2013 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.
*)
open Common_gettext.Gettext
open Common_utils
open Printf
open Unix
let quote = Filename.quote
type gpgkey_type =
| No_Key
| Fingerprint of string
| KeyFile of string
type t = {
verbose : bool;
gpg : string;
fingerprint : string;
check_signature : bool;
gpghome : string;
}
(* Import the specified key file. *)
let import_keyfile ~gpg ~gpghome ~verbose keyfile =
let status_file = Filename.temp_file "vbstat" ".txt" in
unlink_on_exit status_file;
let cmd = sprintf "%s --homedir %s --status-file %s --import %s%s"
gpg gpghome (quote status_file) (quote keyfile)
(if verbose then "" else " >/dev/null 2>&1") in
if verbose then eprintf "%s\n%!" cmd;
let r = Sys.command cmd in
if r <> 0 then (
eprintf (f_"virt-builder: error: could not import public key\nUse the '-v' option and look for earlier error messages.\n");
exit 1
);
status_file
let rec create ~verbose ~gpg ~gpgkey ~check_signature =
(* Create a temporary directory for gnupg. *)
let tmpdir = Mkdtemp.temp_dir "vb.gpghome." "" in
rmdir_on_exit tmpdir;
(* Make sure we have no check_signature=true with no actual key. *)
let check_signature, gpgkey =
match check_signature, gpgkey with
| true, No_Key -> false, No_Key
| x, y -> x, y in
let fingerprint =
if check_signature then (
(* Run gpg so it can setup its own home directory, failing if it
* cannot.
*)
let cmd = sprintf "%s --homedir %s --list-keys%s"
gpg tmpdir (if verbose then "" else " >/dev/null 2>&1") in
if verbose then eprintf "%s\n%!" cmd;
let r = Sys.command cmd in
if r <> 0 then (
eprintf (f_"virt-builder: error: GPG failure: could not run GPG the first time\nUse the '-v' option and look for earlier error messages.\n");
exit 1
);
match gpgkey with
| No_Key ->
assert false
| KeyFile kf ->
let status_file = import_keyfile gpg tmpdir verbose kf in
let status = read_whole_file status_file in
let status = string_nsplit "\n" status in
let fingerprint = ref "" in
List.iter (
fun line ->
let line = string_nsplit " " line in
match line with
| "[GNUPG:]" :: "IMPORT_OK" :: _ :: fp :: _ -> fingerprint := fp
| _ -> ()
) status;
!fingerprint
| Fingerprint fp ->
let filename = Filename.temp_file "vbpubkey" ".asc" in
unlink_on_exit filename;
let cmd = sprintf "%s --yes --armor --output %s --export %s%s"
gpg (quote filename) (quote fp)
(if verbose then "" else " >/dev/null 2>&1") in
if verbose then eprintf "%s\n%!" cmd;
let r = Sys.command cmd in
if r <> 0 then (
eprintf (f_"virt-builder: error: could not export public key\nUse the '-v' option and look for earlier error messages.\n");
exit 1
);
ignore (import_keyfile gpg tmpdir verbose filename);
fp
) else
"" in
{
verbose = verbose;
gpg = gpg;
fingerprint = fingerprint;
check_signature = check_signature;
gpghome = tmpdir;
}
(* Compare two strings of hex digits ignoring whitespace and case. *)
and equal_fingerprints fp1 fp2 =
let len1 = String.length fp1 and len2 = String.length fp2 in
let rec loop i j =
if i = len1 && j = len2 then true (* match! *)
else if i = len1 || j = len2 then false (* no match - different lengths *)
else (
let x1 = getxdigit fp1.[i] and x2 = getxdigit fp2.[j] in
match x1, x2 with
| Some x1, Some x2 when x1 = x2 -> loop (i+1) (j+1)
| Some x1, Some x2 -> false (* no match - different content *)
| Some _, None -> loop i (j+1)
| None, Some _ -> loop (i+1) j
| None, None -> loop (i+1) (j+1)
)
in
loop 0 0
and getxdigit = function
| '0'..'9' as c -> Some (Char.code c - Char.code '0')
| 'a'..'f' as c -> Some (Char.code c - Char.code 'a')
| 'A'..'F' as c -> Some (Char.code c - Char.code 'A')
| _ -> None
let rec verify t filename =
if t.check_signature then (
let args = quote filename in
do_verify t args
)
and verify_detached t filename sigfile =
if t.check_signature then (
match sigfile with
| None ->
eprintf (f_"virt-builder: error: there is no detached signature file\nThis probably means the index file is missing a sig=... line.\nYou can use --no-check-signature to ignore this error, but that means\nyou are susceptible to man-in-the-middle attacks.\n");
exit 1
| Some sigfile ->
let args = sprintf "%s %s" (quote sigfile) (quote filename) in
do_verify t args
)
and do_verify t args =
let status_file = Filename.temp_file "vbstat" ".txt" in
unlink_on_exit status_file;
let cmd =
sprintf "%s --homedir %s --verify%s --status-file %s %s"
t.gpg t.gpghome
(if t.verbose then "" else " -q --logger-file /dev/null")
(quote status_file) args in
if t.verbose then eprintf "%s\n%!" cmd;
let r = Sys.command cmd in
if r <> 0 then (
eprintf (f_"virt-builder: error: GPG failure: could not verify digital signature of file\nTry:\n - Use the '-v' option and look for earlier error messages.\n - Delete the cache: virt-builder --delete-cache\n - Check no one has tampered with the website or your network!\n");
exit 1
);
(* Check the fingerprint is who it should be. *)
let status = read_whole_file status_file in
let status = string_nsplit "\n" status in
let fingerprint = ref "" in
List.iter (
fun line ->
let line = string_nsplit " " line in
match line with
| "[GNUPG:]" :: "VALIDSIG" :: fp :: _ -> fingerprint := fp
| _ -> ()
) status;
if not (equal_fingerprints !fingerprint t.fingerprint) then (
eprintf (f_"virt-builder: error: fingerprint of signature does not match the expected fingerprint!\n found fingerprint: %s\n expected fingerprint: %s\n")
!fingerprint t.fingerprint;
exit 1
)
type csum_t = SHA512 of string
let verify_checksum t (SHA512 csum) filename =
let csum_file = Filename.temp_file "vbcsum" ".txt" in
unlink_on_exit csum_file;
let cmd = sprintf "sha512sum %s | awk '{print $1}' > %s"
(quote filename) (quote csum_file) in
if t.verbose then eprintf "%s\n%!" cmd;
let r = Sys.command cmd in
if r <> 0 then (
eprintf (f_"virt-builder: error: could not run sha512sum command to verify checksum\n");
exit 1
);
let csum_actual = read_whole_file csum_file in
let csum_actual =
let len = String.length csum_actual in
if len > 0 && csum_actual.[len-1] = '\n' then
String.sub csum_actual 0 (len-1)
else
csum_actual in
if csum <> csum_actual then (
eprintf (f_"virt-builder: error: checksum of template did not match the expected checksum!\n found checksum: %s\n expected checksum: %s\nTry:\n - Use the '-v' option and look for earlier error messages.\n - Delete the cache: virt-builder --delete-cache\n - Check no one has tampered with the website or your network!\n")
csum_actual csum;
exit 1
)

39
builder/sigchecker.mli Normal file
View File

@@ -0,0 +1,39 @@
(* virt-builder
* Copyright (C) 2013 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.
*)
type t
type gpgkey_type =
| No_Key
| Fingerprint of string
| KeyFile of string
val create : verbose:bool -> gpg:string -> gpgkey:gpgkey_type -> check_signature:bool -> t
val verify : t -> string -> unit
(** Verify the file is signed (if check_signature is true). *)
val verify_detached : t -> string -> string option -> unit
(** Verify the file is signed against the detached signature
(if check_signature is true). *)
type csum_t = SHA512 of string
val verify_checksum : t -> csum_t -> string -> unit
(** Verify the checksum of the file. This is always verified even if
check_signature if false. *)

139
builder/sources.ml Normal file
View File

@@ -0,0 +1,139 @@
(* virt-builder
* Copyright (C) 2014 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.
*)
open Common_gettext.Gettext
open Common_utils
open Printf
open Unix
type source = {
name : string;
uri : string;
gpgkey : string option;
proxy : Downloader.proxy_mode;
}
module StringSet = Set.Make (String)
let parse_conf ~prog ~verbose file =
if verbose then (
eprintf (f_"%s: trying to read %s\n") prog file;
);
let sections = Ini_reader.read_ini ~prog ~error_suffix:"[ignored]" file in
let sources = List.fold_right (
fun (n, fields) acc ->
let give_source n fields =
let fields = List.map (fun (k, sk, v) -> (k, sk), v) fields in
let uri =
try List.assoc ("uri", None) fields
with Not_found as ex ->
eprintf (f_"%s: no 'uri' entry for '%s' in %s, skipping it\n") prog n file;
raise ex in
let gpgkey =
let k =
try Some (URI.parse_uri (List.assoc ("gpgkey", None) fields)) with
| Not_found -> None
| Invalid_argument "URI.parse_uri" as ex ->
if verbose then (
eprintf (f_"%s: '%s' has invalid gpgkey URI\n") prog n;
);
raise ex in
match k with
| None -> None
| Some uri ->
(match uri.URI.protocol with
| "file" -> Some uri.URI.path
| _ ->
if verbose then (
eprintf (f_"%s: '%s' has non-local gpgkey URI\n") prog n;
);
None
) in
let proxy =
try
(match (List.assoc ("proxy", None) fields) with
| "no" | "off" -> Downloader.UnsetProxy
| "system" -> Downloader.SystemProxy
| _ as proxy -> Downloader.ForcedProxy proxy
)
with
Not_found -> Downloader.SystemProxy in
{
name = n; uri = uri; gpgkey = gpgkey; proxy = proxy;
}
in
try (give_source n fields) :: acc
with Not_found | Invalid_argument _ -> acc
) sections [] in
if verbose then (
eprintf (f_"%s: ... read %d sources\n") prog (List.length sources);
);
sources
let merge_sources current_sources new_sources =
List.fold_right (
fun source acc ->
if List.exists (fun { name = n } -> n = source.name) acc then
acc
else
source :: acc
) new_sources current_sources
let filter_filenames filename =
Filename.check_suffix filename ".conf"
let read_sources ~prog ~verbose =
let dirs = Paths.xdg_config_dirs ~prog in
let dirs =
match Paths.xdg_config_home ~prog with
| None -> dirs
| Some dir -> dir :: dirs in
let dirs = List.map (fun x -> x // "repos.d") dirs in
let fnseen = ref StringSet.empty in
List.fold_left (
fun acc dir ->
let files =
try List.filter filter_filenames (Array.to_list (Sys.readdir dir))
with Sys_error _ -> [] in
let files = List.filter (fun x -> StringSet.mem x !fnseen <> true) files in
List.fold_left (
fun acc file ->
try (
let s = merge_sources acc (parse_conf ~prog ~verbose (dir // file)) in
(* Add the current file name to the set only if its parsing
* was successful.
*)
fnseen := StringSet.add file !fnseen;
s
) with
| Unix_error (code, fname, _) ->
if verbose then (
eprintf (f_"%s: file error: %s: %s\n") prog fname (error_message code)
);
acc
| Invalid_argument msg ->
if verbose then (
eprintf (f_"%s: internal error: invalid argument: %s\n") prog msg
);
acc
) acc files
) [] dirs

26
builder/sources.mli Normal file
View File

@@ -0,0 +1,26 @@
(* virt-builder
* Copyright (C) 2014 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.
*)
type source = {
name : string;
uri : string;
gpgkey : string option;
proxy : Downloader.proxy_mode;
}
val read_sources : prog:string -> verbose:bool -> source list

View File

@@ -0,0 +1,2 @@
[test-index]
uri=file://@abs_top_builddir@/builder/test-index

66
builder/test-index Normal file
View File

@@ -0,0 +1,66 @@
[phony-debian]
name=Phony Debian
arch=x86_64
file=debian.xz
format=raw
size=536870912
expand=/dev/sda2
lvexpand=/dev/debian/root
notes=Phony Debian look-alike used for testing.
[phony-fedora]
name=Phony Fedora
arch=x86_64
file=fedora.xz
format=raw
size=1073741824
expand=/dev/sda2
lvexpand=/dev/VG/Root
notes=Phony Fedora look-alike used for testing.
[phony-fedora-qcow2]
name=Phony Fedora qcow2
arch=x86_64
file=fedora.qcow2.xz
format=qcow2
size=1073741824
expand=/dev/sda2
lvexpand=/dev/VG/Root
notes=Phony Fedora look-alike used for testing.
[phony-fedora-qcow2-uncompressed]
name=Phony Fedora qcow2 uncompressed
arch=x86_64
file=fedora.qcow2
format=qcow2
size=1073741824
expand=/dev/sda2
lvexpand=/dev/VG/Root
notes=Phony Fedora look-alike used for testing.
[phony-fedora-no-format]
name=Phony Fedora
arch=x86_64
file=fedora.qcow2.xz
size=1073741824
expand=/dev/sda2
lvexpand=/dev/VG/Root
notes=Phony Fedora look-alike used for testing.
[phony-ubuntu]
name=Phony Ubuntu
arch=x86_64
file=ubuntu.xz
format=raw
size=536870912
expand=/dev/sda2
notes=Phony Ubuntu look-alike used for testing.
[phony-windows]
name=Phony Windows
arch=x86_64
file=windows.xz
format=raw
size=536870912
expand=/dev/sda2
notes=Phony Windows look-alike used for testing.

199
builder/test-virt-builder-list.sh Executable file
View File

@@ -0,0 +1,199 @@
#!/bin/bash -
# libguestfs virt-builder test script
# Copyright (C) 2013 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.
# Test the virt-builder --list [--long] options.
export LANG=C
set -e
abs_builddir=$(pwd)
export XDG_CONFIG_HOME=
export XDG_CONFIG_DIRS="$abs_builddir/test-config"
short_list=$($VG virt-builder --no-check-signature --no-cache --list)
if [ "$short_list" != "phony-debian x86_64 Phony Debian
phony-fedora x86_64 Phony Fedora
phony-fedora-qcow2 x86_64 Phony Fedora qcow2
phony-fedora-qcow2-uncompressed x86_64 Phony Fedora qcow2 uncompressed
phony-fedora-no-format x86_64 Phony Fedora
phony-ubuntu x86_64 Phony Ubuntu
phony-windows x86_64 Phony Windows" ]; then
echo "$0: unexpected --list output:"
echo "$short_list"
exit 1
fi
long_list=$(virt-builder --no-check-signature --no-cache --list --long)
if [ "$long_list" != "Source URI: file://$abs_builddir/test-index
os-version: phony-debian
Full name: Phony Debian
Architecture: x86_64
Minimum/default size: 512.0M
Notes:
Phony Debian look-alike used for testing.
os-version: phony-fedora
Full name: Phony Fedora
Architecture: x86_64
Minimum/default size: 1.0G
Notes:
Phony Fedora look-alike used for testing.
os-version: phony-fedora-qcow2
Full name: Phony Fedora qcow2
Architecture: x86_64
Minimum/default size: 1.0G
Notes:
Phony Fedora look-alike used for testing.
os-version: phony-fedora-qcow2-uncompressed
Full name: Phony Fedora qcow2 uncompressed
Architecture: x86_64
Minimum/default size: 1.0G
Notes:
Phony Fedora look-alike used for testing.
os-version: phony-fedora-no-format
Full name: Phony Fedora
Architecture: x86_64
Minimum/default size: 1.0G
Notes:
Phony Fedora look-alike used for testing.
os-version: phony-ubuntu
Full name: Phony Ubuntu
Architecture: x86_64
Minimum/default size: 512.0M
Notes:
Phony Ubuntu look-alike used for testing.
os-version: phony-windows
Full name: Phony Windows
Architecture: x86_64
Minimum/default size: 512.0M
Notes:
Phony Windows look-alike used for testing." ]; then
echo "$0: unexpected --list --long output:"
echo "$long_list"
exit 1
fi
json_list=$(virt-builder --no-check-signature --no-cache --list --list-format json)
if [ "$json_list" != "{
\"version\": 1,
\"sources\": [
{
\"uri\": \"file://$abs_builddir/test-index\"
}
],
\"templates\": [
{
\"os-version\": \"phony-debian\",
\"full-name\": \"Phony Debian\",
\"arch\": \"x86_64\",
\"size\": 536870912,
\"notes\": {
\"C\": \"Phony Debian look-alike used for testing.\"
},
\"hidden\": false
},
{
\"os-version\": \"phony-fedora\",
\"full-name\": \"Phony Fedora\",
\"arch\": \"x86_64\",
\"size\": 1073741824,
\"notes\": {
\"C\": \"Phony Fedora look-alike used for testing.\"
},
\"hidden\": false
},
{
\"os-version\": \"phony-fedora-qcow2\",
\"full-name\": \"Phony Fedora qcow2\",
\"arch\": \"x86_64\",
\"size\": 1073741824,
\"notes\": {
\"C\": \"Phony Fedora look-alike used for testing.\"
},
\"hidden\": false
},
{
\"os-version\": \"phony-fedora-qcow2-uncompressed\",
\"full-name\": \"Phony Fedora qcow2 uncompressed\",
\"arch\": \"x86_64\",
\"size\": 1073741824,
\"notes\": {
\"C\": \"Phony Fedora look-alike used for testing.\"
},
\"hidden\": false
},
{
\"os-version\": \"phony-fedora-no-format\",
\"full-name\": \"Phony Fedora\",
\"arch\": \"x86_64\",
\"size\": 1073741824,
\"notes\": {
\"C\": \"Phony Fedora look-alike used for testing.\"
},
\"hidden\": false
},
{
\"os-version\": \"phony-ubuntu\",
\"full-name\": \"Phony Ubuntu\",
\"arch\": \"x86_64\",
\"size\": 536870912,
\"notes\": {
\"C\": \"Phony Ubuntu look-alike used for testing.\"
},
\"hidden\": false
},
{
\"os-version\": \"phony-windows\",
\"full-name\": \"Phony Windows\",
\"arch\": \"x86_64\",
\"size\": 536870912,
\"notes\": {
\"C\": \"Phony Windows look-alike used for testing.\"
},
\"hidden\": false
}
]
}" ]; then
echo "$0: unexpected --list --format json output:"
echo "$json_list"
exit 1
fi

View File

@@ -0,0 +1,52 @@
#!/bin/bash -
# libguestfs virt-builder test script
# Copyright (C) 2013 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.
export LANG=C
set -e
abs_builddir=$(pwd)
export XDG_CONFIG_HOME=
export XDG_CONFIG_DIRS="$abs_builddir/test-config"
if [ ! -f fedora.xz -o ! -f fedora.qcow2 -o ! -f fedora.qcow2.xz ]; then
echo "$0: test skipped because there is no fedora.xz, fedora.qcow2 or fedora.qcow2.xz in the build directory"
exit 77
fi
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because backend is UML"
exit 77
fi
rm -f planner-output
for input in phony-fedora phony-fedora-qcow2 phony-fedora-qcow2-uncompressed phony-fedora-no-format; do
for size in none 1G 1.1G 2G; do
for format in none raw qcow2; do
args="--output planner-output --no-cache --no-check-signature"
if [ "$size" != "none" ]; then args="$args --size $size"; fi
if [ "$format" != "none" ]; then args="$args --format $format"; fi
echo $VG virt-builder $input $args
$VG virt-builder $input $args
done
done
done
rm planner-output

123
builder/test-virt-builder.sh Executable file
View File

@@ -0,0 +1,123 @@
#!/bin/bash -
# libguestfs virt-builder test script
# Copyright (C) 2013 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.
export LANG=C
set -e
abs_builddir=$(pwd)
export XDG_CONFIG_HOME=
export XDG_CONFIG_DIRS="$abs_builddir/test-config"
if [ -n "$SKIP_TEST_VIRT_BUILDER_SH" ]; then
echo "$0: skipping test because environment variable is set."
exit 77
fi
if [ ! -f fedora.xz ]; then
echo "$0: test skipped because there is no fedora.xz in the build directory"
exit 77
fi
output=phony-fedora.img
format=qcow2
if [ "$(guestfish get-backend)" = "uml" ]; then
format=raw
# XXX We specifically want virt-builder to work with the UML
# backend. However currently it fails with:
# error: uml backend does not support networking
# We should be able to make uml have a network backend, but in
# the meantime add this:
no_network=--no-network
fi
rm -f $output
# Test as many options as we can!
#
# Note we cannot test --install, --run since the phony Fedora doesn't
# have a real OS inside just some configuration files. Just about
# every other option is fair game.
$VG virt-builder phony-fedora \
-v --no-cache --no-check-signature $no_network \
-o $output --size 2G --format $format \
--arch x86_64 \
--hostname test.example.com \
--timezone Europe/London \
--root-password password:123456 \
--mkdir /etc/foo/bar/baz \
--write '/etc/foo/bar/baz/foo:Hello World' \
--upload Makefile:/Makefile \
--edit '/Makefile: s{^#.*}{}' \
--upload Makefile:/etc/foo/bar/baz \
--delete /Makefile \
--link /etc/foo/bar/baz/foo:/foo \
--link /etc/foo/bar/baz/foo:/foo1:/foo2:/foo3 \
--firstboot Makefile --firstboot-command 'echo "hello"' \
--firstboot-install "minicom,inkscape"
# Check that some modifications were made.
$VG guestfish --ro -i -a $output > test.out <<EOF
# Uploaded files
is-file /etc/foo/bar/baz/Makefile
cat /etc/foo/bar/baz/foo
is-symlink /foo
is-symlink /foo1
is-symlink /foo2
is-symlink /foo3
echo -----
# Hostname
cat /etc/sysconfig/network | grep HOSTNAME=
echo -----
# Timezone
is-file /usr/share/zoneinfo/Europe/London
is-symlink /etc/localtime
readlink /etc/localtime
echo -----
# Password
is-file /etc/shadow
cat /etc/shadow | sed -r '/^root:/!d;s,^(root:\\\$6\\\$).*,\\1,g'
EOF
if [ "$(cat test.out)" != "true
Hello World
true
true
true
true
-----
HOSTNAME=test.example.com
-----
true
true
/usr/share/zoneinfo/Europe/London
-----
true
root:\$6\$" ]; then
echo "$0: unexpected output:"
cat test.out
exit 1
fi
rm $output
rm test.out

View File

@@ -0,0 +1,8 @@
name=Phony Fedora
arch=x86_64
file=fedora.xz
format=raw
size=1073741824
expand=/dev/sda2
lvexpand=/dev/VG/Root
notes=Phony Fedora look-alike used for testing.

View File

@@ -0,0 +1,2 @@
# All lines commented out.
# [foo]

View File

@@ -0,0 +1,24 @@
#!/bin/bash -
# test virt-index-validate
# Copyright (C) 2014 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.
export LANG=C
set -e
! $VG virt-index-validate test-virt-index-validate-bad-1
$VG virt-index-validate test-virt-index-validate-good-1
$VG virt-index-validate test-virt-index-validate-good-2

View File

@@ -0,0 +1,3 @@
[libguestfs.org]
uri=file://@abs_top_srcdir@/builder/website/index.asc
gpgkey=file://@abs_top_srcdir@/builder/libguestfs.gpg

55
builder/uname-c.c Normal file
View File

@@ -0,0 +1,55 @@
/* virt-builder
* Copyright (C) 2014 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 <errno.h>
#include <sys/utsname.h>
#include <caml/alloc.h>
#include <caml/fail.h>
#include <caml/memory.h>
#include <caml/mlvalues.h>
#ifdef HAVE_CAML_UNIXSUPPORT_H
#include <caml/unixsupport.h>
#else
#define Nothing ((value) 0)
extern void unix_error (int errcode, char * cmdname, value arg) Noreturn;
#endif
value
virt_builder_uname (value unit)
{
CAMLparam0 ();
CAMLlocal1 (rv);
struct utsname u;
if (uname (&u) < 0)
unix_error (errno, (char *) "uname", Val_int (0));
rv = caml_alloc (5, 0);
Store_field (rv, 0, caml_copy_string (u.sysname));
Store_field (rv, 1, caml_copy_string (u.nodename));
Store_field (rv, 2, caml_copy_string (u.release));
Store_field (rv, 3, caml_copy_string (u.version));
Store_field (rv, 4, caml_copy_string (u.machine));
CAMLreturn (rv);
}

27
builder/uname.ml Normal file
View File

@@ -0,0 +1,27 @@
(* virt-builder
* Copyright (C) 2014 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.
*)
type uname_struct = {
sysname : string;
nodename : string;
release : string;
version : string;
machine : string;
}
external uname : unit -> uname_struct = "virt_builder_uname"

28
builder/uname.mli Normal file
View File

@@ -0,0 +1,28 @@
(* virt-builder
* Copyright (C) 2014 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.
*)
type uname_struct = {
sysname : string;
nodename : string;
release : string;
version : string;
machine : string;
}
val uname : unit -> uname_struct
(** [uname] Tiny wrapper to the C [uname]. *)

1713
builder/virt-builder.pod Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,90 @@
=head1 NAME
virt-index-validate - Validate virt-builder index file
=head1 SYNOPSIS
virt-index-validate index
=head1 DESCRIPTION
L<virt-builder(1)> uses an index file to store metadata about templates
that it knows how to use. This index file has a specific format which
virt-index-validate knows how to validate.
Note that virt-index-validate can validate either the signed or
unsigned index file (ie. either C<index> or C<index.asc>). It can
only validate a local file, not a URL.
=head1 OPTIONS
=over 4
=item B<--compat-1.24.0>
Check for compatibility with virt-builder 1.24.0. (Using this option
implies I<--compat-1.24.1>, so you don't need to use both.)
In particular:
=over 4
=item *
This version of virt-builder could not handle C<[...]>
(square brackets) in field names (eg. C<checksum[sha512]=...>).
=item *
It required detached signatures (C<sig=...>).
=back
=item B<--compat-1.24.1>
Check for compatibility with virt-builder E<ge> 1.24.1.
In particular:
=over 4
=item *
This version of virt-builder could not handle C<.> (period) in field
names or C<,> (comma) in subfield names.
=item *
It could not handle comments appearing in the file.
=back
=item B<--help>
Display help.
=item B<-V>
=item B<--version>
Display version number and exit.
=back
=head1 EXIT STATUS
This program returns 0 if the index file validates, or non-zero if
there was an error.
=head1 SEE ALSO
L<virt-builder(1)>,
L<http://libguestfs.org/>.
=head1 AUTHOR
Richard W.M. Jones L<http://people.redhat.com/~rjones/>
=head1 COPYRIGHT
Copyright (C) 2013 Red Hat Inc.

1
builder/website/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.xz

View File

@@ -0,0 +1,44 @@
# libguestfs virt-builder tool
# Copyright (C) 2013 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 = \
.gitignore \
compress.sh \
test-guest.sh \
validate.sh \
README \
index \
index.asc \
centos.sh \
debian.preseed \
debian.sh \
fedora.sh \
rhel.sh \
scientificlinux.sh \
ubuntu.preseed \
ubuntu.sh
CLEANFILES = *~
# Validates the index file.
TESTS_ENVIRONMENT = $(top_builddir)/run --test
TESTS = validate.sh
check-valgrind:
$(MAKE) VG="$(top_builddir)/run @VG@" check

42
builder/website/README Normal file
View File

@@ -0,0 +1,42 @@
If you are looking at this file at http://libguestfs.org/download/builder
-------------------------------------------------------------------------
This directory is used by the libguestfs 'virt-builder' to store the
clean, signed OS templates used for building new virtual machines.
The index file is the default source URL and links to the other OS
templates. It has the canonical URL:
http://libguestfs.org/download/builder/index.asc
If you are looking at this file in the git repository
-----------------------------------------------------
libguestfs.git/builder/website/ contains a copy of the website, minus
the huge OS template files (because of their size, they are stored
elsewhere and merged into the website when it is uploaded).
When you use the ./run script to run virt-builder without installing,
the ./run script sets $VIRT_BUILDER_SOURCE to point to this directory.
If you actually want to use this configuration for anything except
simple testing, you will have to download one or more OS templates
from the libguestfs website and put them into the builder/website/
directory.
ie:
./run virt-builder fedora-20
will fail unless you have downloaded fedora-20.xz here.
Fedora guests
-------------
The general plan for using kickstart and virt-install is outlined
by Kashyap here:
http://kashyapc.wordpress.com/2011/08/18/unattended-guest-install-with-a-local-kickstart/
If you want to reproduce the builds then the kickstart files are
located in fedora-<N>.ks and the virt-install + other commands are in
fedora-<N>.sh.

98
builder/website/centos.sh Executable file
View File

@@ -0,0 +1,98 @@
#!/bin/bash -
# virt-builder
# Copyright (C) 2013-2014 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
export LANG=C
set -e
set -x
if [ $# -ne 1 ]; then
echo "$0 VERSION"
exit 1
fi
version=$1
output=centos-$version
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
case $version in
6)
# We rebuild this every time there is a new 6.x release, and bump
# the revision in the index.
tree=http://mirror.bytemark.co.uk/centos/$version/os/x86_64/
major=6
;;
7.*)
major=7
# XXX Need to fix the URL when 7.1 comes out.
tree=http://mirror.centos.org/centos-7/$major/os/x86_64/
;;
esac
rm -f $output $output.old $output.xz
# Generate the kickstart to a temporary file.
ks=$(mktemp)
cat > $ks <<'EOF'
install
text
reboot
lang en_US.UTF-8
keyboard us
network --bootproto dhcp
rootpw builder
firewall --enabled --ssh
selinux --enforcing
timezone --utc America/New_York
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH"
zerombr
clearpart --all --initlabel
part /boot --fstype=ext4 --size=512 --asprimary
part swap --size=1024 --asprimary
part / --fstype=ext4 --size=1024 --grow --asprimary
# Halt the system once configuration has finished.
poweroff
%packages
@core
%end
EOF
# Clean up function.
cleanup ()
{
rm -f $ks
virsh undefine $tmpname ||:
}
trap cleanup INT QUIT TERM EXIT ERR
virt-install \
--name=$tmpname \
--ram=2048 \
--cpu=host --vcpus=2 \
--os-type=linux --os-variant=rhel$major \
--initrd-inject=$ks \
--extra-args="ks=file:/`basename $ks` console=tty0 console=ttyS0,115200 proxy=$http_proxy" \
--disk $(pwd)/$output,size=6 \
--serial pty \
--location=$tree \
--nographics \
--noreboot
source $(dirname "$0")/compress.sh $output

Some files were not shown because too many files have changed in this diff Show More