Compare commits

...

1044 Commits

Author SHA1 Message Date
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
812 changed files with 227038 additions and 92529 deletions

85
.gitignore vendored
View File

@@ -31,6 +31,7 @@ gmon.out
Makefile
Makefile.in
/.sc-*
/ABOUT-NLS
/aclocal.m4
/align/stamp-virt-alignment-scan.pod
@@ -45,6 +46,7 @@ Makefile.in
/appliance/stamp-supermin
/appliance/supermin.d
/autom4te.cache
/bash/virt-builder
/bash/virt-cat
/bash/virt-df
/bash/virt-edit
@@ -55,6 +57,19 @@ Makefile.in
/bash/virt-sysprep
/bash/virt-sparsify
/build-aux
/builder/.depend
/builder/index-parse.c
/builder/index-parse.h
/builder/index-scan.c
/builder/*.qcow2
/builder/stamp-virt-builder.pod
/builder/stamp-virt-index-validate.pod
/builder/test-index
/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
@@ -94,6 +109,9 @@ Makefile.in
/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
@@ -104,9 +122,10 @@ Makefile.in
/erlang/examples/stamp-guestfs-erlang.pod
/erlang/guestfs.beam
/erlang/guestfs.erl
/erlang/test.img
/erlang/libguestfs-1.*
/examples/copy-over
/examples/create-disk
/examples/debug-logging
/examples/display-icon
/examples/guestfs-examples.3
/examples/guestfs-faq.1
@@ -132,11 +151,14 @@ Makefile.in
/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
@@ -169,6 +191,10 @@ Makefile.in
/gobject/Guestfs-1.0.typelib
/gobject/guestfs-gobject*.c
/gobject/guestfs-gobject*.h
/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
@@ -182,6 +208,7 @@ Makefile.in
/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
@@ -197,14 +224,18 @@ Makefile.in
/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-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
@@ -218,6 +249,7 @@ Makefile.in
/html/virt-tar-in.1.html
/html/virt-tar-out.1.html
/html/virt-win-reg.1.html
/inspector/actual-*.xml
/inspector/stamp-virt-inspector.pod
/inspector/test-xmllint.sh
/inspector/virt-inspector
@@ -241,7 +273,6 @@ Makefile.in
/lua/examples/stamp-guestfs-lua.pod
/lua/guestfs.so
/lua/lua-guestfs.c
/lua/test.img
/m4/ChangeLog
/m4/gnulib-cache.m4
/m4/intmax.m4
@@ -252,6 +283,12 @@ Makefile.in
/m4/ltversion.m4
/maint.mk
/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
@@ -267,20 +304,8 @@ Makefile.in
/ocamlinit-stamp
/ocaml/META
/ocaml/stamp-mlguestfs
/ocaml/t/guestfs_005_load.bc
/ocaml/t/guestfs_005_load.opt
/ocaml/t/guestfs_010_basic.bc
/ocaml/t/guestfs_010_basic.opt
/ocaml/t/guestfs_070_threads.bc
/ocaml/t/guestfs_070_threads.opt
/ocaml/t/guestfs_080_optargs.bc
/ocaml/t/guestfs_080_optargs.opt
/ocaml/t/guestfs_400_events.bc
/ocaml/t/guestfs_400_events.opt
/ocaml/t/guestfs_400_progress.bc
/ocaml/t/guestfs_400_progress.opt
/ocaml/t/guestfs_500_mount_local.bc
/ocaml/t/guestfs_500_mount_local.opt
/ocaml/t/*.bc
/ocaml/t/*.opt
/perl/bindtests.pl
/perl/blib
/perl/examples/guestfs-perl.3
@@ -331,11 +356,10 @@ Makefile.in
/pick-guests.pl
/po-docs/*/*.1
/po-docs/*/*.3
/po-docs/*/*.5
/po-docs/*/*.8
/po-docs/*/*.pl
/po-docs/po4a.conf
/po-docs/*/*.pod
/po-docs/*/stamp-update-po
/podwrapper.1
/podwrapper.pl
/po/*.gmo
@@ -352,8 +376,6 @@ Makefile.in
/rescue/virt-rescue
/rescue/virt-rescue.1
/resize/.depend
/resize/common_gettext.ml
/resize/common_utils_tests
/resize/stamp-virt-resize.pod
/resize/virt-resize
/resize/virt-resize.1
@@ -376,13 +398,11 @@ Makefile.in
/src/actions-?.c
/src/actions-variants.c
/src/bindtests.c
/src/cleanup-structs.c
/src/errnostring.c
/src/errnostring-gperf.c
/src/errnostring-gperf.gperf
/src/errnostring.h
/src/event-string.c
/src/free-structs.c
/src/guestfs.3
/src/guestfs-actions.pod
/src/guestfs-availability.pod
@@ -397,6 +417,11 @@ Makefile.in
/src/libguestfs.syms
/src/.libs/libguestfs.so
/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
@@ -407,8 +432,6 @@ Makefile.in
/sysprep/sysprep-operations.pod
/sysprep/virt-sysprep
/sysprep/virt-sysprep.1
/test1.img
/test2.img
/test.err
/test.out
/tests/c-api/test-add-drive-opts
@@ -437,12 +460,16 @@ Makefile.in
/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
@@ -453,6 +480,8 @@ Makefile.in
/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
@@ -462,12 +491,14 @@ Makefile.in
/tests/regressions/rhbz501893
/tests/regressions/rhbz790721
/tests/regressions/rhbz914931
/tests/regressions/rhbz1044014
/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/test.img
/tools/virt-*.1
/tools/virt-*.pl
/valgrind.log*

Submodule .gnulib updated: 4a8c422f31...0ac90c5a98

View File

@@ -1,5 +1,5 @@
[main]
host = https://www.transifex.net
host = https://www.transifex.com
[libguestfs.libguestfspot]
file_filter = po/<lang>.po

86
AUTHORS
View File

@@ -1,37 +1,49 @@
Angus Salkeld <asalkeld@redhat.com>
Ani Peter <apeter@redhat.com>
Charles Duffy <cduffy@messageone.com>
Cole Robinson <crobinso@redhat.com>
Daniel Berrange <berrange@redhat.com>
Daniel Cabrera <logan@fedoraproject.org>
Douglas Schilling Landgraf <dougsland@redhat.com>
Eric Blake <eblake@redhat.com>
Erik Nolte <erik_nolte@acm.org>
Evaggelos Balaskas <ebalaskas@ebalaskas.gr>
Geert Warrink <geert.warrink@onsnet.nu>
Guido Günther <agx@sigxcpu.org>
Hilko Bengen <bengen@debian.org>
Hilko Bengen <bengen@hilluzination.de>
infernix <infernix@infernix.net>
Jaswinder Singh <jsingh@redhat.com>
Jim Meyering <meyering@redhat.com>
Jiri Popelka <jpopelka@redhat.com>
John Eckersberg <jeckersb@redhat.com>
Karel Klíč <kklic@redhat.com>
Marcin Gibula <m.gibula@e24cloud.com>
Masami HIRATA <msmhrt@gmail.com>
Matthew Booth <mbooth@redhat.com>
Maxim Koltsov <kolmax94@gmail.com>
Michael Scherer <misc@zarb.org>
Nikita A Menkovich <menkovich@gmail.com>
Nikos Skalkotos <skalkoto@gmail.com>
Olaf Hering <olaf@aepfle.de>
Piotr Drąg <piotrdrag@gmail.com>
Qin Guan <qguan@redhat.com>
Rajesh Ranjan <rranjan@redhat.com>
Richard W.M. Jones <rjones@redhat.com>
Sandeep Shedmake <sshedmak@redhat.com>
Shankar Prasad <svenkate@redhat.com>
Thomas S Hatch <thatch45@gmail.com>
Wanlong Gao <gaowanlong@cn.fujitsu.com>
Wulf C. Krueger <philantrop@exherbo.org>
Adam Huffman
Angus Salkeld
Ani Peter
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
infernix
Jaswinder Singh
Jim Meyering
Jiri Popelka
John Eckersberg
Karel Klíč
Marcin Gibula
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
Shankar Prasad
Thomas S Hatch
Török Edwin
Wanlong Gao
Wulf C. Krueger

396
BUGS
View File

@@ -1,5 +1,5 @@
NOTE: This file is automatically generated from "update-bugs.sh".
Last updated: 2013-03-29
Last updated: 2014-01-25
This contains a local list of the bugs that are open against
libguestfs. Bugs are tracked in the Red Hat Bugzilla database
@@ -29,9 +29,6 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
554829 NEW https://bugzilla.redhat.com/show_bug.cgi?id=554829
SELinux handling could be done better.
563450 NEW https://bugzilla.redhat.com/show_bug.cgi?id=563450
list-devices returns devices of different types out of order
572337 NEW https://bugzilla.redhat.com/show_bug.cgi?id=572337
libguestfs should support gptsync
@@ -44,42 +41,18 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
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
637251 NEW https://bugzilla.redhat.com/show_bug.cgi?id=637251
virt-inspector fails to recognize data-only NTFS disk image
660687 NEW https://bugzilla.redhat.com/show_bug.cgi?id=660687
guestmount: "touch" command fails: touch: setting times of `timestamp': Invalid argument
672485 NEW https://bugzilla.redhat.com/show_bug.cgi?id=672485
[RFE] virt-edit/tar/inspector do not support encrypted system
693064 NEW https://bugzilla.redhat.com/show_bug.cgi?id=693064
Symbolic links on ntfs-3g are not followed correctly by some commands
696445 NEW https://bugzilla.redhat.com/show_bug.cgi?id=696445
Backport virt-inspector for virt-v2v
696451 NEW https://bugzilla.redhat.com/show_bug.cgi?id=696451
libguestfs: unknown filesystem label SWAP-sda2
700342 NEW https://bugzilla.redhat.com/show_bug.cgi?id=700342
virt-inspector resports unknown filesystem UUID
709326 NEW https://bugzilla.redhat.com/show_bug.cgi?id=709326
virt-inspector cannot detect ReactOS
737261 NEW https://bugzilla.redhat.com/show_bug.cgi?id=737261
libguestfs grub-install API needs grub1
745282 NEW https://bugzilla.redhat.com/show_bug.cgi?id=745282
[RFE] Support to use virt-filesystems with remote libvirt systems
745576 NEW https://bugzilla.redhat.com/show_bug.cgi?id=745576
libguestfs (or qemu?) hangs if sparse file runs out of disk space
@@ -95,30 +68,21 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
790837 NEW https://bugzilla.redhat.com/show_bug.cgi?id=790837
Use of atexit to clean up handles is wrong in multithreaded programs
803643 NEW https://bugzilla.redhat.com/show_bug.cgi?id=803643
inspect-is-multipart return false when inspection results should be true
803650 NEW https://bugzilla.redhat.com/show_bug.cgi?id=803650
inspect-is-live return false when inspection results should be true
803657 NEW https://bugzilla.redhat.com/show_bug.cgi?id=803657
[RFE] inspect-is-netinst : support more distributions
805417 NEW https://bugzilla.redhat.com/show_bug.cgi?id=805417
RFE: support inspection of installation ISOs of WinVista, Win7, Win2008 & Win2008r2
806179 NEW https://bugzilla.redhat.com/show_bug.cgi?id=806179
RFE: support inspection of icon for more Windows guests
812970 NEW https://bugzilla.redhat.com/show_bug.cgi?id=812970
virt-rescue cannot set ><rescue> prompt, on Ubuntu 12.04
813290 NEW https://bugzilla.redhat.com/show_bug.cgi?id=813290
mdadm (md-detail) test occasionally fails with 'md device /dev/md125 does not appear to be active.'
815149 NEW https://bugzilla.redhat.com/show_bug.cgi?id=815149
virt-alignment-scan gives error "part_list: could not parse row from output of parted print command: /dev/vda:4194304B:virtblk:512:512:msdos:Virtio Block Device"
819086 NEW https://bugzilla.redhat.com/show_bug.cgi?id=819086
look for qemu-kvm on /usr/libexec
822538 NEW https://bugzilla.redhat.com/show_bug.cgi?id=822538
libguestfs tools hang on qcow2 encrypted disks
@@ -137,9 +101,6 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
835622 NEW https://bugzilla.redhat.com/show_bug.cgi?id=835622
RFE: virt-sparsify should be able to sparsify onto a thin-provisioned LV
837941 NEW https://bugzilla.redhat.com/show_bug.cgi?id=837941
Data loss when writing to qcow2-format disk files
845234 NEW https://bugzilla.redhat.com/show_bug.cgi?id=845234
RFE: virt-ls on Windows guest doesn't support drive letters
@@ -152,120 +113,156 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
866994 NEW https://bugzilla.redhat.com/show_bug.cgi?id=866994
tgz-out causes memory leak in guestfsd
869179 NEW https://bugzilla.redhat.com/show_bug.cgi?id=869179
libguestfs fail to startup on latest rhel7 tree
880806 NEW https://bugzilla.redhat.com/show_bug.cgi?id=880806
virt-df with two -a options displays incorrect disk image name
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)
889089 NEW https://bugzilla.redhat.com/show_bug.cgi?id=889089
Block device /dev/sd* didn't translate to /dev/vd*
890027 NEW https://bugzilla.redhat.com/show_bug.cgi?id=890027
virt-sysprep: Setting the hostname on Fedora 18 is stupidly over-complicated
891909 NEW https://bugzilla.redhat.com/show_bug.cgi?id=891909
Can't make install with non-standard prefix as non-root
892271 NEW https://bugzilla.redhat.com/show_bug.cgi?id=892271
virt-format fail to format the same disk more than twice with lvm enable
892272 NEW https://bugzilla.redhat.com/show_bug.cgi?id=892272
Specify QEMU interface emulation will break libguestfs
892275 NEW https://bugzilla.redhat.com/show_bug.cgi?id=892275
checksums-out fail to compute the checksums of all regular files in directory
892291 NEW https://bugzilla.redhat.com/show_bug.cgi?id=892291
guestmount: link() incorrectly returns ENOENT, when it should be EXDEV
892834 NEW https://bugzilla.redhat.com/show_bug.cgi?id=892834
guestmount: rename() incorrectly follows symbolic links
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"
903890 NEW https://bugzilla.redhat.com/show_bug.cgi?id=903890
scrub-freespace didn't remove the scrub file, cause the file system 100% full
903972 NEW https://bugzilla.redhat.com/show_bug.cgi?id=903972
Command "acl-set-file" is inconvenient to use
903987 NEW https://bugzilla.redhat.com/show_bug.cgi?id=903987
Command "acl-set-file" is inconvenient to use
905322 NEW https://bugzilla.redhat.com/show_bug.cgi?id=905322
"No such file or directory" when execute "hivex-commit"
906190 NEW https://bugzilla.redhat.com/show_bug.cgi?id=906190
Need add a line break behind the output of command "hivex-value-value"
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
908255 NEW https://bugzilla.redhat.com/show_bug.cgi?id=908255
error message didn't translate to user language
909666 NEW https://bugzilla.redhat.com/show_bug.cgi?id=909666
Unexpected non-tail recursion in recv_from_daemon results in stack overflow in very long-running API calls that send progress messages
909667 NEW https://bugzilla.redhat.com/show_bug.cgi?id=909667
Unexpected non-tail recursion in recv_from_daemon results in stack overflow in very long-running API calls that send progress messages
910115 NEW https://bugzilla.redhat.com/show_bug.cgi?id=910115
RFE: support ntfsresize --bad-sectors option in virt-resize
910269 NEW https://bugzilla.redhat.com/show_bug.cgi?id=910269
Tracker: Bugs in other packages that stop libguestfs working on current Rawhide
910270 NEW https://bugzilla.redhat.com/show_bug.cgi?id=910270
Tracker: Bugs in other packages that stop libguestfs working on Fedora 18
911674 NEW https://bugzilla.redhat.com/show_bug.cgi?id=911674
swapon label test fails (RHEL 7 only)
911678 NEW https://bugzilla.redhat.com/show_bug.cgi?id=911678
libguestfs: error: cpio command failed: Resource temporarily unavailable (RHEL 7 only)
913774 NEW https://bugzilla.redhat.com/show_bug.cgi?id=913774
libguestfs: could not create appliance through libvirt when URI is qemu:///system or running as root (which causes system to be used implicitly)
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
916130 NEW https://bugzilla.redhat.com/show_bug.cgi?id=916130
libguestfs can't rebuild in mock
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
921299 NEW https://bugzilla.redhat.com/show_bug.cgi?id=921299
virt-p2v fails with permissions problem on kernel module.
921710 NEW https://bugzilla.redhat.com/show_bug.cgi?id=921710
9p support should be disabled in libguestfs in RHEL 7
922891 NEW https://bugzilla.redhat.com/show_bug.cgi?id=922891
Tracker: Bugs in other packages that stop libguestfs working on Fedora 19
923355 NEW https://bugzilla.redhat.com/show_bug.cgi?id=923355
guestfish prints literal "n" in error messages
927447 NEW https://bugzilla.redhat.com/show_bug.cgi?id=927447
[suse] virt tools hang on disk image, but libguestfs-test-tool runs OK
953907 NEW https://bugzilla.redhat.com/show_bug.cgi?id=953907
virt-sysprep does not correctly set the hostname on Debian/Ubuntu
972292 NEW https://bugzilla.redhat.com/show_bug.cgi?id=972292
lgetxattrs can't show the file attribute list with ntfs FS in rhel7
972294 NEW https://bugzilla.redhat.com/show_bug.cgi?id=972294
lsetxattr/lgetxattr doesn't work to softlink file with ntfs FS in rhel7
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
982979 NEW https://bugzilla.redhat.com/show_bug.cgi?id=982979
Disable fstrim API/command in RHEL 6
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
997160 NEW https://bugzilla.redhat.com/show_bug.cgi?id=997160
virt-sysprep prints: filesize: /etc/mdadm.conf: No such file or directory
998065 NEW https://bugzilla.redhat.com/show_bug.cgi?id=998065
libguestfs kernel hang in RHEL 6.5
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
1020806 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1020806
All libguestfs LVM operations fail on Debian/Ubuntu
1021149 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1021149
Rebase libguestfs to 1.24 in RHEL 7.1
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
1035320 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1035320
test faild during build
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
1049656 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1049656
hostnamectl set-hostname fails
1051694 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1051694
libguestfs FTBFS on Ubuntu saucy
1056047 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1056047
virt-df generates no output for Solaris 11 x86_64 guest.
1056556 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1056556
virt-sparsify overwrites block devices if used as output files
1056558 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1056558
virt-sparsify overwrites block devices if used as output files
1057492 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1057492
mount-local should give a clearer error if root is not mounted
1057510 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1057510
mount-local should give a clearer error if root is not mounted
503134 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=503134
guestfish's list splitting does not recognize internal quoting
@@ -278,11 +275,14 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
619334 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=619334
RFE: Enable coredump capture in the appliance
691389 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=691389
Extended attributes don't work over guestmount (FUSE)
624335 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=624335
blockdev-setbsz succeeds, but does not affect blockdev-getbsz
803643 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=803643
inspect-is-multipart return false when inspection results should be true
691389 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=691389
SELinux labels don't work over guestmount (FUSE)
965495 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=965495
New APIs required in libguestfs for virt-v2v in RHEL 6.5
(88 bugs)
@@ -290,18 +290,158 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
Bugs in MODIFIED, POST or ON_QA state are fixed.
You can help by testing the fixes.
889536 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=889536
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)
1057504 POST https://bugzilla.redhat.com/show_bug.cgi?id=1057504
mount-local should give a clearer error if root is not mounted
1053847 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1053847
Recommended default clock/timer settings
998109 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=998109
Let's enable kvmclock in RHEL 7
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]
1045033 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1045033
LIBVIRT_DEFAULT_URI=qemu:///system breaks libguestfs
(6 bugs)
--------------------------------------------------
These bugs are in the VERIFIED state.
672485 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=672485
[RFE] virt-edit/tar-in/tar-out/inspector do not support encrypted system
869179 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=869179
libguestfs fail to startup on latest rhel7 tree
880806 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=880806
virt-df with two -a options displays incorrect disk image name
889536 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=889536
[RFE]It's better to emphasize "libguestfs-winsupport" in V2V manpage or error output
889537 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=889537
889537 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=889537
Libguestfs live support should be disabled in RHEL 7 packages
889538 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=889538
889538 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=889538
libguestfs can not be installed with recent iptables
909573 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=909573
892271 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=892271
virt-format fail to format the same disk more than twice with lvm enable
892275 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=892275
checksums-out fail to compute the checksums of all regular files in directory
894241 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=894241
aug-init fail with the newest augeas package
905322 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=905322
"hivex-commit" should fail with a relative path
909573 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=909573
patch libguestfs to use 'supermin' instead of 'febootstrap' in RHEL 7
(4 bugs)
909667 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=909667
Unexpected non-tail recursion in recv_from_daemon results in stack overflow in very long-running API calls that send progress messages
921710 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=921710
9p support should be disabled in libguestfs in RHEL 7
947438 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=947438
Some obsolete tools should be removed from libguestfs RHEL 7 package
949486 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=949486
libguestfs-1.20.5-3.el7.x86_64 dependency problem
957616 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=957616
libguestfs-1.21.31-1.1.el7.1.1.x86_64 won't install due to missing dependency
957796 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=957796
tar-out and base64-out quoting error
962113 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=962113
Disable libguestfs block drivers which are not supported by RHEL 7 qemu + libvirt
974490 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=974490
Regression: Fedora inspection broken by change from guestfs_exists to guestfs_is_file
975573 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=975573
virt-sysprep is in the wrong subpackage
975771 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=975771
Specifying virtio interface ('iface' parameter) breaks the direct backend - libguestfs hangs
976250 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=976250
Make xfs filesystem failed with specified blocksize, gives "unknown option -b" error
976299 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=976299
mke2fs-J should give a meaningful error when specified type is anything except 'ext{2,3,4}'
980338 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=980338
disk-format "qemu-img info: JSON parse error" when target file does not exist
983691 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=983691
libguestfs double free when kernel link fails during launch
985856 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=985856
Can't set acl value for a specified user with 'acl-set-file'
988862 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=988862
virt-sysprep --firstboot option writes incorrect "99" (instead of "S99") sysv-init-style start up script
989356 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=989356
cap-get-file will return error if the file has not be set capabilities
995176 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=995176
RFE: Implement set-uuid command
995712 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=995712
list-filesystems command fails if there are no block devices
998485 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=998485
guestfish remote prints "libguestfs: error: waitpid (qemu): No child processes"
998750 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=998750
guestfish does not work due to conflict of remote and interactive mode
1000123 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1000123
'sh' command before mount causes daemon to segfault
1000428 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1000428
virt-format uses wrong partition type for vfat filesystems
1001875 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1001875
Argument 'excludes' of tar-out does not work
1001876 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1001876
Update "rsync-out" helpout for using wildcard
1002032 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1002032
mke2fs can't return the correct filesystem type when blockscount is less than 2048 for ext3
1003291 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1003291
Backport cachemode patch to RHEL 7
1011922 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1011922
Use host-passthrough instead of host-model
1016465 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1016465
blockdev-setbsz succeeds, but does not affect blockdev-getbsz
1019891 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1019891
libguestfs-tools.conf should have a man page
1020021 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1020021
Drop php-libguestfs subpackage
1037795 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1037795
libguestfs rebuild needed due to broken ABI compatibility (caused by procps-ng update to 3.3.9)
(43 bugs)
End of BUGS file.

View File

@@ -1,5 +1,5 @@
# libguestfs
# Copyright (C) 2009-2013 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,9 +15,7 @@
# 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_builddir)/localenv
include $(top_srcdir)/subdir-rules.mk
include $(top_srcdir)/common-rules.mk
ACLOCAL_AMFLAGS = -I m4
@@ -39,15 +37,18 @@ SUBDIRS += tests/guests
SUBDIRS += tests/c-api
SUBDIRS += tests/tmpdirs
SUBDIRS += tests/protocol
SUBDIRS += tests/events
SUBDIRS += tests/parallel
SUBDIRS += tests/disks
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
@@ -57,6 +58,11 @@ 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
@@ -67,7 +73,7 @@ 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 rescue
# bash-completion
SUBDIRS += bash
@@ -103,13 +109,17 @@ endif
if HAVE_GOBJECT
SUBDIRS += gobject
endif
if HAVE_GOLANG
SUBDIRS += golang golang/examples
endif
# Unconditional because nothing is built yet.
SUBDIRS += csharp
# OCaml tools.
# OCaml tools. Note 'mllib' contains random shared code used by
# all of the OCaml tools.
if HAVE_OCAML
SUBDIRS += resize sparsify sysprep
SUBDIRS += mllib builder builder/website resize sparsify sysprep
endif
# Perl tools.
@@ -128,17 +138,17 @@ SUBDIRS += po-docs
endif
EXTRA_DIST = \
$(generator_built) \
BUGS HACKING ROADMAP 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 \
@@ -162,18 +172,28 @@ EXTRA_DIST = \
contrib/visualize-alignment/qemu-0.13-trace-block-device-access.patch \
contrib/visualize-alignment/README \
contrib/visualize-alignment/tracetops.ml \
contrib/windows-icons.pl \
guestfs-release-notes.pod \
guestfs-release-notes.txt \
html/draft.png \
html/draft.svg \
html/pod.css \
html/virt-builder.svg \
libtool-kill-dependency_libs.sh \
logo/fish.svg logo/fish.png \
logo/virt-builder.svg \
m4/.gitignore \
tmp/.gitignore \
tx-pull.sh \
update-bugs.sh \
valgrind-suppressions
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 = \
@@ -181,6 +201,7 @@ HTMLFILES = \
html/guestfs-examples.3.html \
html/guestfs-erlang.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 \
@@ -198,10 +219,12 @@ HTMLFILES = \
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-df.1.html \
html/virt-diff.1.html \
html/virt-edit.1.html \
html/virt-filesystems.1.html \
html/virt-format.1.html \
@@ -219,19 +242,30 @@ HTMLFILES = \
html/virt-tar-out.1.html \
html/virt-win-reg.1.html
HTMLSUPPORTFILES = html/draft.png html/pod.css
HTMLSUPPORTFILES = \
html/draft.png \
html/pod.css \
html/virt-builder.svg
TEXTFILES = BUGS README ROADMAP TODO
WEBSITEDIR = $(HOME)/d/redhat/websites/libguestfs
BUILDERFILES = \
builder/website/README \
builder/website/index \
builder/website/index.asc \
builder/website/*.xz \
builder/website/*.xz.sig
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) $(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)/" \
@@ -240,37 +274,34 @@ 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 shortlog -se | awk -F'\t' '{print $$2}' | sort -f > 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 (po/POTFILES po/POTFILES-ml).
# 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 '^po-docs/' | \
grep -v '^images/' | \
LC_ALL=C sort | \
sed 's,^\./,,' > po/POTFILES
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)$$' | \
LC_ALL=C sort > po/POTFILES
cd $(srcdir); \
find resize sparsify sysprep -name '*.ml' | \
find builder mllib resize sparsify sysprep -name '*.ml' | \
LC_ALL=C sort > po/POTFILES-ml
# Manual pages in top level directory.
@@ -305,11 +336,20 @@ podwrapper.1: podwrapper.pl
# Make clean.
CLEANFILES = \
*~ \
html/*.html \
pod2htm?.tmp \
podwrapper.1 \
qemu-wrapper.sh \
stamp-guestfs-release-notes.pod
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
@@ -320,41 +360,82 @@ quickcheck:
# Non-standard tests.
extra-tests:
check-all:
$(MAKE) -j1 \
check \
check-valgrind \
check-valgrind-local-guests \
check-with-appliance \
check-valgrind-with-appliance \
check-direct \
check-valgrind-direct \
check-uml \
check-valgrind-uml \
check-with-upstream-qemu \
check-with-upstream-libvirt \
check-slow
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
check-valgrind: build-test-guests
@for f in `grep -l '^$@:' $(SUBDIRS:%=%/Makefile.am)`; do \
@errors=0; \
for f in `grep -l '^$@:' $(SUBDIRS:%=%/Makefile.am)`; do \
echo $(MAKE) -C `dirname $$f` $@; \
$(MAKE) -C `dirname $$f` $@ || exit $$?; \
done
$(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` $@ || exit $$?; \
done
$(MAKE) GUESTS="$$GUESTS" -C `dirname $$f` $@ || (( errors++ )); \
done; \
exit $$(( $$errors ? 1 : 0 ))
check-with-appliance:
@method=`$(top_builddir)/run ./fish/guestfish get-attach-method`; \
if [ "$$method" != "appliance" ]; then \
$(MAKE) LIBGUESTFS_ATTACH_METHOD=appliance check || exit $$?; \
check-direct:
@backend=`$(top_builddir)/run ./fish/guestfish get-backend`; \
if [ "$$backend" != "direct" ]; then \
$(MAKE) LIBGUESTFS_BACKEND=direct check || exit $$?; \
fi
check-valgrind-with-appliance:
@method=`$(top_builddir)/run ./fish/guestfish get-attach-method`; \
if [ "$$method" != "appliance" ]; then \
$(MAKE) LIBGUESTFS_ATTACH_METHOD=appliance check-valgrind || exit $$?; \
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
@@ -364,7 +445,7 @@ check-with-upstream-qemu:
check-with-upstream-qemu-1: $(top_builddir)/qemu-wrapper.sh
$(QEMUBINARY) --version
$(MAKE) LIBGUESTFS_QEMU=$(abs_top_builddir)/qemu-wrapper.sh check
$(MAKE) LIBGUESTFS_HV=$(abs_top_builddir)/qemu-wrapper.sh check
$(top_builddir)/qemu-wrapper.sh: Makefile
rm -f $@ $@-t
@@ -375,16 +456,18 @@ $(top_builddir)/qemu-wrapper.sh: Makefile
LIBVIRTDIR = $(HOME)/d/libvirt
check-with-upstream-libvirt:
@method=`$(top_builddir)/run ./fish/guestfish get-attach-method`; \
if [ "$$method" = "libvirt" ] && [ -x "$(LIBVIRTDIR)/run" ]; then \
@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` $@ || exit $$?; \
done
$(MAKE) -C `dirname $$f` $@ || (( errors++ )); \
done; \
exit $$(( $$errors ? 1 : 0 ))
build-test-guests:
$(MAKE) -C tests/guests check
@@ -404,6 +487,22 @@ build-test-guests:
print-subdirs:
@echo $(SUBDIRS)
# 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:
@@ -413,16 +512,20 @@ help:
@echo "make check Run the standard tests"
@echo "make -k check ... and display all errors at once."
@echo
@echo "make extra-tests ... runs all of the following tests:"
@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-with-appliance Test using appliance attach-method."
@echo " make check-valgrind-with-appliance Test valgrind + appliance attach-method."
@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 "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 syntax-check Check syntax and style problems in the code."
@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."

100
README
View File

@@ -94,32 +94,40 @@ The full requirements are described below.
+--------------+-------------+---+-----------------------------------------+
| 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 | O | Windows Registry hive parser. |
| 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. |
+--------------+-------------+---+-----------------------------------------+
| libxml2 | | O | Popular XML library. |
+--------------+-------------+---+-----------------------------------------+
| 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 attach-method to |
| | | | securely confine the appliance (sVirt). |
+--------------+-------------+---+-----------------------------------------+
| augeas | 0.5.0 | O | To inspect configuration of Linux guests.
| 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, |
@@ -138,6 +146,8 @@ The full requirements are described below.
| 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. |
+--------------+-------------+---+-----------------------------------------+
@@ -157,6 +167,16 @@ The full requirements are described below.
+--------------+-------------+---+-----------------------------------------+
| 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. |
+--------------+-------------+---+-----------------------------------------+
| findlib | | O | For the OCaml bindings. |
+--------------+-------------+---+-----------------------------------------+
| ocaml-gettext| | O | For localizing OCaml virt-* tools. |
@@ -190,6 +210,8 @@ The full requirements are described below.
+--------------+-------------+---+-----------------------------------------+
| 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. |
@@ -219,8 +241,10 @@ Building
Build the daemon, library and root filesystem:
./configure
make
building from tarball building from git
--------------------- -----------------
./configure ./autogen.sh
make make
Run the tests:
@@ -233,7 +257,7 @@ Also:
runs a subset of the test suite under valgrind (requires valgrind to
be installed obviously).
make extra-tests
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
@@ -258,34 +282,31 @@ 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:
./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 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 ./cat/virt-cat [virt-cat opts...]
./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
@@ -369,43 +390,10 @@ Don't enable GCC warnings (ie. *don't* use
'./configure --enable-gcc-warnings').
Note on using non-x86 architectures
----------------------------------------------------------------------
In theory libguestfs should work on non-x86 architectures. Usually if
it doesn't it's because qemu isn't available or cannot boot the
kernel.
For ARM you will need to specify the exact machine type and CPU
variant that is required to boot the Linux kernel (there's no way to
know this except by looking at how the Linux kernel was configured).
For example:
./configure \
--with-qemu="qemu-system-arm" \
--with-qemu-options="-M versatilepb -cpu arm926"
./configure \
--with-qemu="qemu-system-arm" \
--with-qemu-options="-M vexpress-a15 -cpu cortex-a15"
Note that since virtio is required by libguestfs, and virtio is a
PCI-based architecture, whatever architecture qemu emulates MUST
support PCI.
For PPC64 you will need to specify the IBM pSeries machine type:
./configure \
--with-qemu="qemu-system-ppc64" \
--with-qemu-options="-M pseries"
After building libguestfs, run 'make quickcheck' and pay close
attention to the qemu command line and kernel output.
Copyright and license information
----------------------------------------------------------------------
Copyright (C) 2009-2013 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

12
ROADMAP
View File

@@ -12,19 +12,15 @@ Before you read this:
(4) For general "might be good to have" items, see 'TODO'.
For next major stable release (1.22)
For next major stable release (1.26)
------------------------------------
* 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.22 (put "1.22" in the Devel Whiteboard field in
Bugs assigned to 1.26 (put "1.26" 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.22&component=libguestfs&product=Virtualization%20Tools
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.26&component=libguestfs&product=Virtualization%20Tools
Beyond 1.22
Beyond 1.26
-----------
* Make 'guestfish --ro' be the default, and get users to use

167
TODO
View File

@@ -95,10 +95,22 @@ 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
virt-disk-explore
@@ -141,11 +153,8 @@ http://sourceforge.net/projects/aide/
http://osiris.shmoo.com/
http://sourceforge.net/projects/tripwire/
Freeze/thaw filesystems
-----------------------
Access to these ioctls:
http://git.kernel.org/linus/fcccf502540e3d7
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
-------------------------------
@@ -198,7 +207,7 @@ There are some places where we call out to the 'blkid' program. This
might be replaced by direct use of the library (if this is easier).
But it is very hard to be compatible between RHEL6 and RHEL5 when
using direct library.
using the library directly.
Visualization
-------------
@@ -361,14 +370,14 @@ 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).
@@ -388,18 +397,12 @@ virt-sysprep ideas
. run external guestfish script virt-sysprep --fish=/tmp/foo.fish
- if drives are encrypted, then dm-crypt key should be changed
and drives all re-encrypted
- /etc/pki
(Steve says ...)
Rpm uses nss. Nss sets up its crypto database in
/etc/pki. Depending on how long the machine ran before cloning, you
may have picked up some certificates or things. This is an area
that you would want to look into.
- secure erase of inodes etc using scrub (Steve Grubb)
- other directories that could require cleaning include:
/var/run/*
(thanks Marko Myllynen, James Antill)
- remove or modify UUIDs in /etc/fstab (eg. on Ubuntu)
(thanks Joshua Daniel Franklin)
- fix the virt-sysprep fs-uuids plugin
- 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.
Kazuo Moriwaka adds:
@@ -423,16 +426,9 @@ customized with the organization logo etc. Some ideas:
- change the sign-on messages (/etc/issue.net etc)
- Windows login script/service
Launch remote sessions over ssh
-------------------------------
We had an idea you could add a launch method that uses ssh, ie. all
supermin and qemu commands happen the same as now, but prefixed by
ssh so it happens on a remote machine.
Note that proper remote support and integration with libvirt is
different from this, and people are working on that. ssh would just
be "remote-lite".
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
----------------------------------------------------
@@ -473,11 +469,6 @@ opened with O_CLOEXEC. Therefore we need to examine every call to:
virt-sparsify enhancements
--------------------------
TMPDIR should be checked to ensure that we won't run out of space
during the conversion, since current behaviour is very bad when this
happens (it usually causes virt-sparsify to hang). This requires
writing a small C binding to statvfs for OCaml.
'virt-sparsify --whitelist' option to generate skeletons (for
debugging, bug forensics, diagnosis). The whilelist option would
specify a list of files to be *preserved*. All other files in the
@@ -485,14 +476,6 @@ image would be replaced by equivalent files of zeroes, thus minimizing
the size of the debug image that needs to be shipped to us by the
customer.
Optimize the appliance
----------------------
Pass -cpu host. Anything else?
[The libvirt attach-method uses 'host-model' which is basically
the same as this]
Sort out partitioning
---------------------
@@ -518,37 +501,6 @@ 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).
qemu caching
------------
(Suggested by Paolo Bonzini and Kevin Wolf)
Measure the effect of cache=none, cache=directsync,
cache=writethrough, cache=writeback.
It's doubtful that using cache=none is useful, since it disables the
host cache making read-heavy workloads slower (they rely entirely on
the smaller appliance kernel's cache). And in libguestfs we don't
necessarily care about ongoing data integrity while writing, as long
as data is reliably written out when g.sync, g.shutdown or g.close
return. Also in libguestfs we effectively control the whole stack, so
we can ensure write barriers happen when we want.
libvirt attach-method
---------------------
Since libguestfs 1.19.24 this mostly works. Here are some suggested
items to work on:
- SELinux labelling of guestfsd.sock, console.sock
https://bugzilla.redhat.com/show_bug.cgi?id=842307
Once this is fixed, remove <seclabel type=none> from libvirt XML
- Check feature parity between src/launch-appliance.c and
src/launch-libvirt.c.
- Remote support. (This requires work on libvirt)
virt-sparsify should use discard
--------------------------------
@@ -558,19 +510,14 @@ throughout the entire stack.
Reimplement some APIs to avoid protocol limits
----------------------------------------------
We should reimplement the following APIs to avoid protocol limits.
These would be changed from daemon_functions to non_daemon_functions,
with the non-daemon versions implemented using guestfs_upload and
guestfs_download (and others). This change should be transparent from
the p.o.v of the API and ABI.
Mostly this item was done (eg. commits a69f44f56f and before). The
most notable API with a protocol limit remaining is:
- guestfs_readdir
hivex
-----
Add more of hivex to the API, especially for writing.
Reimplement virt-win-reg to use this API. (This is difficult because
the Perl libraries underneath access the hivex API directly).
@@ -587,3 +534,53 @@ is very poorly designed and essentially impossible for us to use:
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

View File

@@ -38,7 +38,9 @@ SHARED_SOURCE_FILES = \
../fish/inspect.c \
../fish/keys.c \
../fish/options.h \
../fish/options.c
../fish/options.c \
../fish/uri.h \
../fish/uri.c
virt_alignment_scan_SOURCES = \
$(SHARED_SOURCE_FILES) \
@@ -58,6 +60,7 @@ virt_alignment_scan_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(GPROF_CFLAGS) $(GCOV_CFLAGS) \
$(LIBCONFIG_CFLAGS) \
$(LIBXML2_CFLAGS) \
$(LIBVIRT_CFLAGS)
virt_alignment_scan_LDADD = \

View File

@@ -25,6 +25,7 @@
#include <inttypes.h>
#include <unistd.h>
#include <getopt.h>
#include <errno.h>
#include <locale.h>
#include <assert.h>
#include <libintl.h>
@@ -36,8 +37,6 @@
#include <libvirt/virterror.h>
#endif
#include "progname.h"
#include "guestfs.h"
#include "options.h"
#include "parallel.h"
@@ -101,9 +100,6 @@ 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);
@@ -125,7 +121,6 @@ main (int argc, char *argv[])
{ 0, 0, 0, 0 }
};
struct drv *drvs = NULL;
struct drv *drv;
const char *format = NULL;
int c;
int option_index;
@@ -139,8 +134,6 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
argv[0] = (char *) program_name;
for (;;) {
c = getopt_long (argc, argv, options, long_options, &option_index);
if (c == -1) break;
@@ -225,14 +218,14 @@ main (int argc, char *argv[])
* below.
*/
if (drvs == NULL) {
#if defined(HAVE_LIBVIRT) && defined(HAVE_LIBXML2)
#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 and/or libxml2.\n"),
fprintf (stderr, _("%s: compiled without support for libvirt.\n"),
program_name);
exit (EXIT_FAILURE);
#endif

View File

@@ -117,6 +117,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

View File

@@ -15,9 +15,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Old RHEL 5 autoconf doesn't have builddir.
builddir ?= .
include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = \
@@ -38,14 +35,18 @@ superminfs_DATA = \
supermin.d/init.img \
supermin.d/udev-rules.img
if SUPERMIN_HELPER_COMPRESSED_CPIO
GZ = .gz
endif
if ENABLE_DAEMON
superminfs_DATA += \
supermin.d/daemon.img
supermin.d/daemon.img$(GZ)
endif
if ENABLE_APPLIANCE
superminfs_DATA += \
supermin.d/base.img \
supermin.d/base.img$(GZ) \
supermin.d/hostfiles
endif
@@ -76,41 +77,46 @@ excludelist: excludelist.in Makefile
cmp -s $@ $@-t || mv $@-t $@
rm -f $@-t
supermin.d/base.img supermin.d/hostfiles: stamp-supermin
supermin.d/base.img$(GZ) supermin.d/hostfiles: stamp-supermin
stamp-supermin: make.sh packagelist excludelist
mkdir -p supermin.d
rm -f $@ supermin.d/base.img supermin.d/hostfiles
rm -f $@ supermin.d/base.img$(GZ) supermin.d/hostfiles
./make.sh
if SUPERMIN_HELPER_COMPRESSED_CPIO
gzip -9 supermin.d/base.img
endif
touch $@
supermin.d/daemon.img: ../daemon/guestfsd guestfsd.suppressions
mkdir -p supermin.d
rm -f $@ $@-t
supermin.d/daemon.img$(GZ): ../daemon/guestfsd guestfsd.suppressions
rm -f $@ $@-t $@-tt
rm -rf tmp-d
mkdir -p tmp-d$(DAEMON_SUPERMIN_DIR) tmp-d/etc
ln ../daemon/guestfsd tmp-d$(DAEMON_SUPERMIN_DIR)/guestfsd
ln $(srcdir)/guestfsd.suppressions tmp-d/etc/guestfsd.suppressions
( cd tmp-d && find | cpio --quiet -o -H newc ) > $@-t
rm -rf tmp-d
rm -r tmp-d
if SUPERMIN_HELPER_COMPRESSED_CPIO
gzip -9 -c $@-t > $@-tt
mv $@-tt $@-t
endif
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
rm -rf init.tmp $@ $@-t
mkdir init.tmp
cp $< init.tmp
(cd init.tmp; echo "init" | cpio --quiet -o -H newc) > $@-t
rm -r init.tmp
mv $@-t $@
# 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.img: 99-guestfs-serial.rules
mkdir -p supermin.d
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 && find | cpio --quiet -o -H newc ) > $@-t
rm -rf tmp-u
rm -r tmp-u
mv $@-t $@
# If installing the daemon, install the udev rules too.
@@ -140,7 +146,5 @@ stamp-libguestfs-make-fixed-appliance.pod: libguestfs-make-fixed-appliance.pod
CLEANFILES = packagelist excludelist \
libguestfs-make-fixed-appliance.1 \
stamp-libguestfs-make-fixed-appliance.pod
clean-local:
rm -rf supermin.d
stamp-libguestfs-make-fixed-appliance.pod \
supermin.d/*

View File

@@ -17,3 +17,11 @@
fun:expand_dynamic_string_token
fun:_dl_map_object
}
# aug_setm memory leak
{
aug_setm_leak
Memcheck:Leak
...
fun:aug_setm
}

View File

@@ -36,53 +36,38 @@ mkdir -p /run/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
:
else
# 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 [ -n "$UDEVD" ]; then
echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
$UDEVD --daemon
udevadm trigger
udevadm settle --timeout=600
else
echo No udevd, creating /dev manually.
mount -t tmpfs none /dev
mkdir /dev/pts /dev/shm /dev/mapper
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
# Must do each MAKEDEV individually, because if one device fails,
# MAKEDEV will quit without creating the rest (RHBZ#507374).
for dev in mem null port zero core full ram tty console fd \
hda hdb hdc hdd sda sdb sdc sdd loop sd; do
MAKEDEV $dev ||:
done
mknod /dev/ptmx c 5 2; chmod 0666 /dev/ptmx
mknod /dev/random c 1 8; chmod 0666 /dev/random
mknod /dev/urandom c 1 9; chmod 0444 /dev/urandom
ln -sf /proc/self/fd/0 /dev/stdin
ln -sf /proc/self/fd/1 /dev/stdout
ln -sf /proc/self/fd/2 /dev/stderr
modprobe virtio_pci
modprobe virtio_net
fi
# 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
echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
$UDEVD --daemon
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
@@ -95,11 +80,14 @@ 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
@@ -107,16 +95,9 @@ lvm vgchange -ay --ignorelockingfailure
# Scan for Windows dynamic disks.
ldmtool create all
# 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
# These are useful when debugging.
if grep -sq guestfs_verbose=1 /proc/cmdline; then
uname -a
ls -lR /dev
cat /proc/mounts
lvm pvs
@@ -127,6 +108,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
@@ -134,23 +117,31 @@ 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
if grep -sq guestfs_valgrind_daemon=1 /proc/cmdline; then
if [ -r /etc/guestfsd.suppressions ]; then
suppressions="--suppressions=/etc/guestfsd.suppressions"
fi
exec 3>$vg_channel
vg="valgrind --leak-check=full --log-fd=3 --error-exitcode=119 --max-stackframe=8388608 --child-silent-after-fork=yes $suppressions"
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
# Run virt-rescue shell.
# Remove LD_PRELOAD=libSegFault set above.
unset LD_PRELOAD
# Use appliance in rescue mode, also used by the virt-rescue command.
eval $(grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline)
PS1='><rescue> '
@@ -171,4 +162,9 @@ else
fi
sync
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

@@ -25,7 +25,7 @@ Some reasons why you I<might> want to use this include:
You want to make a self-contained libguestfs appliance that can be
copied to another machine or platform that doesn't support
L<supermin(8)>.
L<supermin(1)>.
=item *
@@ -129,8 +129,8 @@ 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(8)/SUPERMIN APPLIANCE>). libguestfs reconstructs this
into a full appliance by running L<supermin-helper(8)>.
L<supermin(1)/SUPERMIN APPLIANCE>). libguestfs reconstructs this
into a full appliance by running L<supermin-helper(1)>.
However, a simpler "fixed appliance" can also be used. libguestfs
detects this by looking for a directory on the path containing four
@@ -166,8 +166,8 @@ libguestfs, please see the L<guestfs(3)> manual page.
=head1 SEE ALSO
L<guestfs(3)>,
L<supermin(8)>,
L<supermin-helper(8)>,
L<supermin(1)>,
L<supermin-helper(1)>,
L<xz(1)>,
L<http://libguestfs.org/>,
L<http://qemu.org/>.
@@ -178,4 +178,4 @@ Richard W.M. Jones (C<rjones at redhat dot com>)
=head1 COPYRIGHT
Copyright (C) 2009-2013 Red Hat Inc.
Copyright (C) 2009-2014 Red Hat Inc.

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# @configure_input@
# Copyright (C) 2009-2013 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
@@ -33,6 +33,9 @@ exec 5<&-
if [ "x@SUPERMIN_PACKAGER_CONFIG@" != "xno" ]; then
extra="--yum-config @SUPERMIN_PACKAGER_CONFIG@"
fi
if [ "x@SUPERMIN_EXTRA_OPTIONS@" != "xno" ]; then
extra="$extra @SUPERMIN_EXTRA_OPTIONS@"
fi
echo @SUPERMIN@ -v -o supermin.d --names $(< packagelist ) $excludes $extra
@SUPERMIN@ -v -o supermin.d --names $(< packagelist ) $excludes $extra
@@ -43,10 +46,6 @@ echo @SUPERMIN@ -v -o supermin.d --names $(< packagelist ) $excludes $extra
< 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/' |
@@ -54,12 +53,6 @@ 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

View File

@@ -41,7 +41,6 @@
kernel
libcap
libldm /* only Fedora has this for now, but we should add it to others later*/
MAKEDEV
nilfs-utils
ntfsprogs
ntfs-3g
@@ -49,6 +48,7 @@
pcre
reiserfs-utils
libselinux
syslinux-extlinux
systemd /* for /sbin/reboot and udevd */
vim-minimal
xz
@@ -61,6 +61,7 @@
btrfs-tools
cryptsetup
e2fsprogs
extlinux
genisoimage
gfs-tools
gfs2-tools
@@ -73,6 +74,8 @@
libpcre3
libyajl2
linux-image
/* syslinux 'suggests' mtools, but in reality it's a hard dependency: */
mtools
nilfs-tools
ntfs-3g
ntfsprogs
@@ -110,6 +113,64 @@
zfs-fuse
#endif /* ARCHLINUX */
#ifdef FRUGALWARE
augeas
btrfs-progs
cryptsetup-luks
e2fsprogs
cdrkit
grub2
hfsplus
iproute2
iputils
kernel
libcap
ntfsprogs
ntfs-3g
openssh
pcre
reiserfsprogs
syslinux
systemd
vim
xz
yajl
xfsprogs-acl
xfsprogs-attr
bash
binutils
bzip2
coreutils
cpio
diffutils
dosfstools
file
findutils
gawk
gptfdisk
grep
gzip
jfsutils
kmod
less
libxml2
lsof
lsscsi
lvm2
mdadm
module-init-tools
parted
procps
psmisc
rsync
sed
strace
syslinux
tar
util-linux
xfsprogs
#endif /* FRUGALWARE */
acl
attr
bash
@@ -148,6 +209,7 @@ rsync
scrub
sed
strace
syslinux
tar
udev
util-linux

View File

@@ -21,6 +21,7 @@ scripts = \
guestfish \
guestmount \
virt-alignment-scan \
virt-builder \
virt-cat \
virt-df \
virt-edit \
@@ -55,6 +56,8 @@ virt-ls:
virt-sysprep:
ln -sf virt-alignment-scan $@
virt-builder:
ln -sf virt-resize $@
virt-sparsify:
ln -sf virt-resize $@

View File

@@ -1,5 +1,5 @@
# guestfish bash completion script -*- shell-script -*-
# Copyright (C) 2010-2013 Red Hat Inc.
# 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

View File

@@ -1,5 +1,5 @@
# guestmount bash completion script -*- shell-script -*-
# Copyright (C) 2010-2013 Red Hat Inc.
# 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

View File

@@ -1,5 +1,5 @@
# virt-tools bash completion script -*- shell-script -*-
# Copyright (C) 2010-2013 Red Hat Inc.
# 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

View File

@@ -1,5 +1,5 @@
# virt-rescue bash completion script -*- shell-script -*-
# Copyright (C) 2010-2013 Red Hat Inc.
# 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

View File

@@ -1,5 +1,6 @@
# virt-resize, virt-sparsify bash completion script -*- shell-script -*-
# Copyright (C) 2010-2013 Red Hat Inc.
# 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
@@ -33,6 +34,12 @@ _guestfs_options_only ()
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)"

View File

@@ -34,7 +34,7 @@ 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
@@ -77,7 +77,6 @@ openat
perror
pipe2
pread
progname
read-file
readlink
select

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# bugs-in-changelog.sh
# Copyright (C) 2009-2013 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

237
builder/Makefile.am Normal file
View File

@@ -0,0 +1,237 @@
# 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)/src \
-I$(top_srcdir)/fish \
-pthread \
$(LIBLZMA_CFLAGS)
EXTRA_DIST = \
$(SOURCES) \
virt-builder.pod \
virt-index-validate.pod \
test-virt-builder.sh \
test-virt-builder-list.sh \
test-virt-builder-planner.sh
CLEANFILES = *~ *.cmi *.cmo *.cmx *.cmxa *.o virt-builder
# Alphabetical order.
SOURCES = \
builder.ml \
cmdline.ml \
downloader.mli \
downloader.ml \
get_kernel.mli \
get_kernel.ml \
index_parser.mli \
index_parser.ml \
index-parser-c.c \
list_entries.mli \
list_entries.ml \
perl_edit.ml \
perl_edit.mli \
pxzcat.ml \
pxzcat.mli \
pxzcat-c.c \
sigchecker.mli \
sigchecker.ml
man_MANS =
noinst_DATA =
if HAVE_OCAML
# Note this list must be in dependency order.
OBJECTS = \
$(top_builddir)/mllib/libdir.cmx \
$(top_builddir)/mllib/common_gettext.cmx \
$(top_builddir)/mllib/common_utils.cmx \
$(top_builddir)/mllib/urandom.cmx \
$(top_builddir)/mllib/random_seed.cmx \
$(top_builddir)/mllib/hostname.cmx \
$(top_builddir)/mllib/timezone.cmx \
$(top_builddir)/mllib/firstboot.cmx \
$(top_builddir)/mllib/crypt-c.o \
$(top_builddir)/mllib/crypt.cmx \
$(top_builddir)/mllib/fsync-c.o \
$(top_builddir)/mllib/fsync.cmx \
$(top_builddir)/mllib/password.cmx \
$(top_builddir)/mllib/planner.cmx \
$(top_builddir)/mllib/config.cmx \
index-scan.o \
index-struct.o \
index-parse.o \
index-parser-c.o \
pxzcat-c.o \
pxzcat.cmx \
get_kernel.cmx \
downloader.cmx \
sigchecker.cmx \
index_parser.cmx \
list_entries.cmx \
perl_edit.cmx \
cmdline.cmx \
builder.cmx
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
if HAVE_OCAML_PKG_GETTEXT
OCAMLPACKAGES += -package gettext-stub
endif
OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX $(OCAMLPACKAGES)
OCAMLOPTFLAGS = $(OCAMLCFLAGS)
virt-builder: $(OBJECTS)
$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
mlguestfs.cmxa -linkpkg $^ \
-cclib '-pthread $(LIBLZMA_LIBS) -lncurses -lcrypt -lpthread' \
$(OCAML_GCOV_LDFLAGS) \
-o $@
.mli.cmi:
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
.ml.cmo:
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
.ml.cmx:
$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@
# 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
$(PODWRAPPER) \
--man virt-builder.1 \
--html $(top_builddir)/html/virt-builder.1.html \
--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 --block-size=16777216 -c $< > $@-t
mv $@-t $@
%.xz: ../tests/guests/%.img
rm -f $@ $@-t
xz --best --block-size=16777216 -c $< > $@-t
mv $@-t $@
TESTS = test-virt-builder-list.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 $(top_srcdir)/mllib $^ | \
$(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
# 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
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
# Fix dependencies which automake doesn't generate correctly.
if HAVE_OCAML
index-parser-c.o: index-parse.h index-struct.h
index-scan.o: index-parse.h
endif
index-validate.o: index-parse.h

1029
builder/builder.ml Normal file

File diff suppressed because it is too large Load Diff

465
builder/cmdline.ml Normal file
View File

@@ -0,0 +1,465 @@
(* 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
module G = Guestfs
open Password
open Unix
open Printf
let prog = Filename.basename Sys.executable_name
let default_cachedir =
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 default_source = "http://libguestfs.org/download/builder/index.asc"
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 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 default_cachedir 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 debug = ref false in
let delete = ref [] in
let add_delete s = delete := s :: !delete in
let delete_on_failure = ref true in
let edit = ref [] in
let add_edit arg =
let i =
try String.index arg ':'
with Not_found ->
eprintf (f_"%s: invalid --edit format, see the man page.\n") prog;
exit 1 in
let len = String.length arg in
let file = String.sub arg 0 i in
let expr = String.sub arg (i+1) (len-(i+1)) in
edit := (file, expr) :: !edit
in
let fingerprints = ref [] in
let add_fingerprint arg = fingerprints := arg :: !fingerprints in
let firstboot = ref [] in
let add_firstboot s =
if not (Sys.file_exists s) then (
if not (String.contains s ' ') then
eprintf (f_"%s: %s: %s: file not found\n") prog "--firstboot" s
else
eprintf (f_"%s: %s: %s: file not found [did you mean %s?]\n") prog "--firstboot" s "--firstboot-command";
exit 1
);
firstboot := `Script s :: !firstboot
in
let add_firstboot_cmd s = firstboot := `Command s :: !firstboot in
let add_firstboot_install pkgs =
let pkgs = string_nsplit "," pkgs in
firstboot := `Packages pkgs :: !firstboot
in
let format = ref "" in
let gpg = ref "gpg" in
let hostname = ref None in
let set_hostname s = hostname := Some s in
let install = ref [] in
let add_install pkgs =
let pkgs = string_nsplit "," pkgs in
install := pkgs @ !install
in
let links = ref [] in
let add_link arg =
let target, lns =
match string_nsplit ":" arg with
| [] | [_] ->
eprintf (f_"%s: invalid --link format, see the man page.\n") prog;
exit 1
| target :: lns -> target, lns in
links := (target, lns) :: !links
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 memsize = ref None in
let set_memsize arg = memsize := Some arg in
let mkdirs = ref [] in
let add_mkdir arg = mkdirs := arg :: !mkdirs in
let network = ref true in
let output = ref "" in
let password_crypto : password_crypto option ref = ref None in
let set_password_crypto arg =
password_crypto := Some (password_crypto_of_string ~prog arg)
in
let quiet = ref false in
let root_password = ref None in
let set_root_password arg =
let pw = parse_selector ~prog arg in
root_password := Some pw
in
let run = ref [] in
let add_run s =
if not (Sys.file_exists s) then (
if not (String.contains s ' ') then
eprintf (f_"%s: %s: %s: file not found\n") prog "--run" s
else
eprintf (f_"%s: %s: %s: file not found [did you mean %s?]\n") prog "--run" s "--run-command";
exit 1
);
run := `Script s :: !run
in
let add_run_cmd s = run := `Command s :: !run in
let scrub = ref [] in
let add_scrub s = scrub := s :: !scrub in
let scrub_logfile = ref false in
let selinux_relabel = 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 timezone = ref None in
let set_timezone s = timezone := Some s in
let update = ref false in
let upload = ref [] in
let add_upload arg =
let i =
try String.index arg ':'
with Not_found ->
eprintf (f_"%s: invalid --upload format, see the man page.\n") prog;
exit 1 in
let len = String.length arg in
let file = String.sub arg 0 i in
if not (Sys.file_exists file) then (
eprintf (f_"%s: --upload: %s: file not found\n") prog file;
exit 1
);
let dest = String.sub arg (i+1) (len-(i+1)) in
upload := (file, dest) :: !upload
in
let writes = ref [] in
let add_write arg =
let i =
try String.index arg ':'
with Not_found ->
eprintf (f_"%s: invalid --write format, see the man page.\n") prog;
exit 1 in
let len = String.length arg in
let file = String.sub arg 0 i in
let content = String.sub arg (i+1) (len-(i+1)) in
writes := (file, content) :: !writes
in
let ditto = " -\"-" in
let argspec = Arg.align [
"--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, ditto;
"--no-check-signature", Arg.Clear check_signature,
" " ^ s_"Disable digital signatures";
"--no-check-signatures", Arg.Clear check_signature, ditto;
"--curl", Arg.Set_string curl, "curl" ^ " " ^ s_"Set curl binary/command";
"--delete", Arg.String add_delete, "name" ^ " " ^ s_"Delete a file or dir";
"--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";
"--edit", Arg.String add_edit, "file:expr" ^ " " ^ s_"Edit file with Perl expr";
"--fingerprint", Arg.String add_fingerprint,
"AAAA.." ^ " " ^ s_"Fingerprint of valid signing key";
"--firstboot", Arg.String add_firstboot, "script" ^ " " ^ s_"Run script at first guest boot";
"--firstboot-command", Arg.String add_firstboot_cmd, "cmd+args" ^ " " ^ s_"Run command at first guest boot";
"--firstboot-install", Arg.String add_firstboot_install,
"pkg,pkg" ^ " " ^ s_"Add package(s) to install at firstboot";
"--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";
"--hostname", Arg.String set_hostname, "hostname" ^ " " ^ s_"Set the hostname";
"--install", Arg.String add_install, "pkg,pkg" ^ " " ^ s_"Add package(s) to install";
"--link", Arg.String add_link, "target:link.." ^ " " ^ s_"Create symbolic links";
"-l", Arg.Unit list_mode, " " ^ s_"List available templates";
"--list", Arg.Unit list_mode, ditto;
"--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)";
"--no-logfile", Arg.Set scrub_logfile, " " ^ s_"Scrub build log file";
"--long-options", Arg.Unit display_long_options, " " ^ s_"List long options";
"-m", Arg.Int set_memsize, "mb" ^ " " ^ s_"Set memory size";
"--memsize", Arg.Int set_memsize, "mb" ^ ditto;
"--mkdir", Arg.String add_mkdir, "dir" ^ " " ^ s_"Create directory";
"--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" ^ ditto;
"--password-crypto", Arg.String set_password_crypto,
"md5|sha256|sha512" ^ " " ^ s_"Set password crypto";
"--print-cache", Arg.Unit print_cache_mode,
" " ^ s_"Print info about template cache";
"--quiet", Arg.Set quiet, " " ^ s_"No progress messages";
"--root-password", Arg.String set_root_password,
"..." ^ " " ^ s_"Set root password";
"--run", Arg.String add_run, "script" ^ " " ^ s_"Run script in disk image";
"--run-command", Arg.String add_run_cmd, "cmd+args" ^ " " ^ s_"Run command in disk image";
"--scrub", Arg.String add_scrub, "name" ^ " " ^ s_"Scrub a file";
"--selinux-relabel", Arg.Set selinux_relabel,
" " ^ s_"Relabel files with correct SELinux labels";
"--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";
"--timezone",Arg.String set_timezone, "timezone" ^ " " ^ s_"Set the default timezone";
"--update", Arg.Set update, " " ^ s_"Update core packages";
"--upload", Arg.String add_upload, "file:dest" ^ " " ^ s_"Upload file to dest";
"-v", Arg.Set debug, " " ^ s_"Enable debugging messages";
"--verbose", Arg.Set debug, ditto;
"-V", Arg.Unit display_version, " " ^ s_"Display version and exit";
"--version", Arg.Unit display_version, ditto;
"--write", Arg.String add_write, "file:content" ^ " " ^ s_"Write file";
] 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 attach = List.rev !attach in
let cache = !cache in
let check_signature = !check_signature in
let curl = !curl in
let debug = !debug in
let delete = List.rev !delete in
let delete_on_failure = !delete_on_failure in
let edit = List.rev !edit in
let fingerprints = List.rev !fingerprints in
let firstboot = List.rev !firstboot in
let run = List.rev !run in
let format = match !format with "" -> None | s -> Some s in
let gpg = !gpg in
let hostname = !hostname in
let install = List.rev !install in
let list_format = !list_format in
let links = List.rev !links in
let memsize = !memsize in
let mkdirs = List.rev !mkdirs in
let network = !network in
let output = match !output with "" -> None | s -> Some s in
let password_crypto = !password_crypto in
let quiet = !quiet in
let root_password = !root_password in
let scrub = List.rev !scrub in
let scrub_logfile = !scrub_logfile in
let selinux_relabel = !selinux_relabel in
let size = !size in
let smp = !smp in
let sources = List.rev !sources in
let sync = !sync in
let timezone = !timezone in
let update = !update in
let upload = List.rev !upload in
let writes = List.rev !writes in
(* 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 ->
(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), or use environment or default. *)
let sources =
let list_split = function "" -> [] | str -> string_nsplit "," str in
let rec repeat x = function
| 0 -> [] | 1 -> [x]
| n -> x :: repeat x (n-1)
in
let sources =
if sources <> [] then sources
else (
try list_split (Sys.getenv "VIRT_BUILDER_SOURCE")
with Not_found -> [ default_source ]
) in
let fingerprints =
if fingerprints <> [] then fingerprints
else (
try list_split (Sys.getenv "VIRT_BUILDER_FINGERPRINT")
with Not_found -> [ Sigchecker.default_fingerprint ]
) 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
);
assert (nr_sources > 0);
(* Combine the sources and fingerprints into a single list of pairs. *)
List.combine sources fingerprints in
mode, arg,
attach, cache, check_signature, curl, debug, delete, delete_on_failure,
edit, firstboot, run, format, gpg, hostname, install, list_format, links,
memsize, mkdirs,
network, output, password_crypto, quiet, root_password, scrub,
scrub_logfile, selinux_relabel, size, smp, sources, sync, timezone,
update, upload, writes

118
builder/downloader.ml Normal file
View File

@@ -0,0 +1,118 @@
(* 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
let (//) = Filename.concat
let cache_of_name cachedir name revision =
cachedir // sprintf "%s.%d" name revision
type uri = string
type filename = string
type t = {
debug : bool;
curl : string;
cache : string option; (* cache directory for templates *)
}
let create ~debug ~curl ~cache = {
debug = debug;
curl = curl;
cache = cache;
}
let rec download ~prog t ?template ?progress_bar 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 uri tmpfile;
(tmpfile, true)
| Some (name, revision) ->
match t.cache with
| None ->
(* Not using the cache at all? *)
download t ~prog ?progress_bar uri
| Some cachedir ->
let filename = cache_of_name cachedir name 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 uri filename;
(filename, false)
and download_to ~prog t ?(progress_bar = false) uri filename =
(* Get the status code first to ensure the file exists. *)
let cmd = sprintf "%s%s -g -o /dev/null -I -w '%%{http_code}' %s"
t.curl
(if t.debug then "" else " -s -S")
(quote uri) in
if t.debug 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.
*
* Note because there may be parallel virt-builder instances running
* and also to avoid partial downloads in the cachedir 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;
let cmd = sprintf "%s%s -g -o %s %s"
t.curl
(if t.debug then "" else if progress_bar then " -#" else " -s -S")
(quote filename_new) (quote uri) in
if t.debug 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 curl was successful. *)
rename filename_new filename

47
builder/downloader.mli Normal file
View File

@@ -0,0 +1,47 @@
(* 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. *)
val cache_of_name : string -> string -> int -> string
(** [cache_of_name cachedir name revision] returns the filename
of the cached file. (Note: It doesn't check if the filename
exists, this is just a simple string transformation). *)
type uri = string
type filename = string
type t
(** The abstract data type. *)
val create : debug:bool -> curl:string -> cache:string option -> t
(** Create the abstract type. *)
val download : prog:string -> t -> ?template:(string*int) -> ?progress_bar:bool -> 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, revision)]. This
causes the cache to be used (if possible). Name 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 debug mode, progress messages
are always displayed. *)

121
builder/get_kernel.ml Normal file
View File

@@ -0,0 +1,121 @@
(* 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
let rex_numbers = Str.regexp "^\\([0-9]+\\)\\(.*\\)$"
let rex_letters = Str.regexp_case_fold "^\\([a-z]+\\)\\(.*\\)$"
(* Originally:
* http://rwmj.wordpress.com/2013/09/13/get-kernel-and-initramfs-from-a-disk-image/
*)
let rec get_kernel ~debug ?format ?output disk =
let g = new G.guestfs () in
if debug then g#set_trace 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: daual/mult-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 ()
and compare_version v1 v2 =
compare (split_version v1) (split_version v2)
and split_version = function
| "" -> []
| str ->
let first, rest =
if Str.string_match rex_numbers str 0 then (
let n = Str.matched_group 1 str in
let rest = Str.matched_group 2 str in
let n =
try `Number (int_of_string n)
with Failure "int_of_string" -> `String n in
n, rest
)
else if Str.string_match rex_letters str 0 then
`String (Str.matched_group 1 str), Str.matched_group 2 str
else (
let len = String.length str in
`Char str.[0], String.sub str 1 (len-1)
) in
first :: split_version rest

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 : debug:bool -> ?format:string -> ?output:string -> string -> unit

129
builder/index-parse.y Normal file
View File

@@ -0,0 +1,129 @@
/* 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"
extern void yyerror (const char *);
extern int yylex (void);
/* 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;
}
%}
%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
%type <section> sections section
%type <field> fields field
%type <str> continuations
%%
index:
sections
{ parsed_index = $1; }
| PGP_PROLOGUE sections PGP_EPILOGUE
{ parsed_index = $2; }
sections:
section emptylines
{ $$ = $1; }
| section EMPTY_LINE emptylines sections
{ $$ = $1; $$->next = $4; }
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 (const char *msg)
{
fprintf (stderr, "syntax error at line %d: %s\n",
yylloc.first_line, msg);
}

112
builder/index-parser-c.c Normal file
View File

@@ -0,0 +1,112 @@
/* 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 FILE *yyin;
value
virt_builder_parse_index (value filenamev)
{
CAMLparam1 (filenamev);
CAMLlocal5 (rv, v, sv, sv2, fv);
struct section *sections;
size_t i, nr_sections;
yyin = fopen (String_val (filenamev), "r");
if (yyin == NULL)
unix_error (errno, (char *) "fopen", filenamev);
if (yyparse () != 0) {
fclose (yyin);
caml_invalid_argument ("parse error");
}
if (fclose (yyin) == EOF)
unix_error (errno, (char *) "fclose", filenamev);
/* Convert the parsed data to OCaml structures. */
nr_sections = 0;
for (sections = parsed_index; sections != NULL; sections = sections->next)
nr_sections++;
rv = caml_alloc (nr_sections, 0);
for (i = 0, sections = 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 global data. */
free_index ();
CAMLreturn (rv);
}

110
builder/index-scan.l Normal file
View File

@@ -0,0 +1,110 @@
/* 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-parse.h"
#include "index-struct.h"
#define YY_USER_ACTION yylloc.first_line = yylloc.last_line = yylineno;
extern void yyerror (const char *);
%}
%option noyywrap
%option yylineno
%%
/* 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 { 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 ()) != 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 () != EOF)
;
return PGP_EPILOGUE;
}
/* anything else is an error */
. {
yyerror ("unexpected character in input");
exit (EXIT_FAILURE);
}

59
builder/index-struct.c Normal file
View File

@@ -0,0 +1,59 @@
/* 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 "index-struct.h"
struct section *parsed_index = NULL;
int seen_comments = 0;
static void free_section (struct section *section);
static void free_field (struct field *field);
void
free_index (void)
{
free_section (parsed_index);
}
static void
free_section (struct section *section)
{
if (section) {
free_section (section->next);
free (section->name);
free_field (section->fields);
free (section);
}
}
static void
free_field (struct field *field)
{
if (field) {
free_field (field->next);
free (field->key);
free (field->subkey);
free (field->value);
free (field);
}
}

49
builder/index-struct.h Normal file
View File

@@ -0,0 +1,49 @@
/* 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;
};
/* The parser (yyparse) stores the result here. */
extern struct section *parsed_index;
/* yyparse sets this if any comments were seen. Required for checking
* compatibility with virt-builder 1.24.
*/
extern int seen_comments;
extern void free_index (void);
#endif /* INDEX_STRUCT_H */

161
builder/index-validate.c Normal file
View File

@@ -0,0 +1,161 @@
/* 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 <libintl.h>
#include <guestfs.h>
#include "guestfs-internal-frontend.h"
#include "index-struct.h"
#include "index-parse.h"
extern FILE *yyin;
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;
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++];
yyin = fopen (input, "r");
if (yyin == NULL) {
perror (input);
exit (EXIT_FAILURE);
}
if (yyparse () != 0) {
fprintf (stderr, _("%s: '%s' could not be validated, see errors above\n"),
program_name, input);
exit (EXIT_FAILURE);
}
if (fclose (yyin) == EOF) {
fprintf (stderr, _("%s: %s: error reading input file: %m\n"),
program_name, input);
exit (EXIT_FAILURE);
}
if (compat_1_24_1 && seen_comments) {
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 = parsed_index; sections != NULL; sections = sections->next) {
int seen_sig = 0;
struct field *fields;
for (fields = sections->fields; fields != NULL; fields = fields->next) {
if (compat_1_24_0) {
if (strchr (fields->key, '[') ||
strchr (fields->key, ']')) {
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, ',')) {
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) {
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. */
free_index ();
printf ("%s validated OK\n", input);
exit (EXIT_SUCCESS);
}

293
builder/index_parser.ml Normal file
View File

@@ -0,0 +1,293 @@
(* 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;
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;
sigchecker : Sigchecker.t;
}
let print_entry chan (name, { printable_name = printable_name;
file_uri = file_uri;
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;
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;
(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
);
(match notes with
| ("", notes) :: _ -> fp "notes=%s\n" notes
| _ :: _
| [] -> ()
);
if hidden then fp "hidden=true\n"
(* Types returned by the C index parser. *)
type sections = section array
and section = string * fields (* [name] + fields *)
and fields = field array
and field = string * string option * string (* key + subkey + value *)
(* Calls yyparse in the C code. *)
external parse_index : string -> sections = "virt_builder_parse_index"
let get_index ~prog ~debug ~downloader ~sigchecker 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 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 = parse_index tmpfile in
if delete_tmpfile then
(try Unix.unlink tmpfile with _ -> ());
let sections = Array.to_list sections in
let sections = List.map (
fun (n, fields) ->
n, Array.to_list fields
) sections in
(* Check for repeated os-version names. *)
let nseen = Hashtbl.create 13 in
List.iter (
fun (n, _) ->
if Hashtbl.mem nseen n then (
eprintf (f_"virt-builder: index is corrupt: os-version '%s' appears two or more times\n") n;
corrupt_file ()
);
Hashtbl.add nseen n true
) sections;
(* 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 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 entry = { printable_name = printable_name;
osinfo = osinfo;
file_uri = file_uri;
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;
sigchecker = sigchecker } in
n, entry
) sections in
if debug 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 ()

38
builder/index_parser.mli Normal file
View File

@@ -0,0 +1,38 @@
(* 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;
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;
sigchecker : Sigchecker.t;
}
val get_index : prog:string -> debug:bool -> downloader:Downloader.t -> sigchecker:Sigchecker.t -> string -> index

144
builder/list_entries.ml Normal file
View File

@@ -0,0 +1,144 @@
(* 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;
size = size;
compressed_size = compressed_size;
notes = notes;
hidden = hidden }) ->
if not hidden then (
printf "%-24s" name;
(match printable_name with
| None -> ()
| Some s -> printf " %s" s
);
printf "\n"
)
) index
and list_entries_long ~sources index =
List.iter (
fun (source, fingerprint) ->
printf (f_"Source URI: %s\n") source;
printf (f_"Fingerprint: %s\n") fingerprint;
printf "\n"
) sources;
List.iter (
fun (name, { Index_parser.printable_name = printable_name;
size = size;
compressed_size = compressed_size;
notes = notes;
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_"Minimum/default size:") (human_size size);
(match compressed_size with
| None -> ()
| Some size ->
printf "%-24s %s\n" (s_"Download size:") (human_size size);
);
(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 print_notes = function
| ("", notes) :: _ ->
printf " \"notes\": \"%s\",\n" (json_string_escape notes)
| _ :: _
| _ -> () in
printf "{\n";
printf " \"version\": %d,\n" 1;
printf " \"sources\": [\n";
iteri (
fun i (source, fingerprint) ->
printf " {\n";
printf " \"uri\": \"%s\",\n" source;
printf " \"fingerprint\": \"%s\"\n" fingerprint;
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;
size = size;
compressed_size = compressed_size;
notes = notes;
hidden = hidden }) ->
printf " {\n";
printf " \"os-version\": \"%s\",\n" name;
json_optional_printf_string "full-name" printable_name;
printf " \"size\": %Ld,\n" size;
json_optional_printf_int64 "compressed-size" compressed_size;
print_notes notes;
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 * string) list -> Index_parser.index -> unit

78
builder/perl_edit.ml Normal file
View File

@@ -0,0 +1,78 @@
(* 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
(* Implement the --edit option.
*
* Code copied from virt-edit.
*)
let rec edit_file ~debug (g : Guestfs.guestfs) file expr =
let file_old = file ^ "~" in
g#rename file file_old;
(* Download the file to a temporary. *)
let tmpfile = Filename.temp_file "vbedit" "" in
unlink_on_exit tmpfile;
g#download file_old tmpfile;
do_perl_edit ~debug g tmpfile expr;
(* Upload the file. Unlike virt-edit we can afford to fail here
* so we don't need the temporary upload file.
*)
g#upload tmpfile file;
(* However like virt-edit we do need to copy attributes. *)
g#copy_attributes ~all:true file_old file;
g#rm file_old
and do_perl_edit ~debug g file expr =
(* Pass the expression to Perl via the environment. This sidesteps
* any quoting problems with the already complex Perl command line.
*)
Unix.putenv "virt_edit_expr" expr;
(* Call out to a canned Perl script. *)
let cmd = sprintf "\
perl -e '
$lineno = 0;
$expr = $ENV{virt_edit_expr};
while (<STDIN>) {
$lineno++;
eval $expr;
die if $@;
print STDOUT $_ or die \"print: $!\";
}
close STDOUT or die \"close: $!\";
' < %s > %s.out" file file in
if debug then
eprintf "%s\n%!" cmd;
let r = Sys.command cmd in
if r <> 0 then (
eprintf (f_"virt-builder: error: could not evaluate Perl expression '%s'\n")
expr;
exit 1
);
Unix.rename (file ^ ".out") file

19
builder/perl_edit.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 edit_file : debug:bool -> Guestfs.guestfs -> string -> string -> unit

650
builder/pxzcat-c.c Normal file
View File

@@ -0,0 +1,650 @@
/* 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>
#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
#ifdef HAVE_LIBLZMA
#include <lzma.h>
static void pxzcat (value filenamev, value outputfilev, unsigned nr_threads);
#endif
value
virt_builder_pxzcat (value inputfilev, value outputfilev)
{
CAMLparam2 (inputfilev, outputfilev);
#ifdef HAVE_LIBLZMA
/* 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
/* 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
CAMLreturn (Val_unit);
}
#ifdef HAVE_LIBLZMA
#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. */
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 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];
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 /* HAVE_LIBLZMA */

19
builder/pxzcat.ml 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.
*)
external pxzcat : string -> string -> unit = "virt_builder_pxzcat"

31
builder/pxzcat.mli Normal file
View File

@@ -0,0 +1,31 @@
(* 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. *)

237
builder/sigchecker.ml Normal file
View File

@@ -0,0 +1,237 @@
(* 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
(* These are the public key and fingerprint belonging to
* Richard W.M. Jones who signs the templates on
* http://libguestfs.org/download/builder.
*)
let default_fingerprint = "F777 4FB1 AD07 4A7E 8C87 67EA 9173 8F73 E1B7 68A0"
let default_pubkey = "\
-----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-----
"
let key_imported = ref false
type t = {
debug : bool;
gpg : string;
fingerprint : string;
check_signature : bool;
}
let create ~debug ~gpg ~fingerprint ~check_signature =
{
debug = debug;
gpg = gpg;
fingerprint = fingerprint;
check_signature = check_signature;
}
(* Compare two strings of hex digits ignoring whitespace and case. *)
let rec 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 =
import_key t;
let status_file = Filename.temp_file "vbstat" ".txt" in
unlink_on_exit status_file;
let cmd =
sprintf "%s --verify%s --status-file %s %s"
t.gpg (if t.debug then "" else " -q --logger-file /dev/null")
(quote status_file) args in
if t.debug 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
)
(* Import the default public key. *)
and import_key t =
if not !key_imported then (
let filename, chan = Filename.open_temp_file "vbpubkey" ".asc" in
unlink_on_exit filename;
output_string chan default_pubkey;
close_out chan;
let cmd = sprintf "%s --import %s%s"
t.gpg (quote filename)
(if t.debug then "" else " >/dev/null 2>&1") in
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
);
key_imported := true
)
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.debug 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
)

36
builder/sigchecker.mli Normal file
View File

@@ -0,0 +1,36 @@
(* 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 default_fingerprint : string
type t
val create : debug:bool -> gpg:string -> fingerprint:string -> 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. *)

59
builder/test-index.in Normal file
View File

@@ -0,0 +1,59 @@
[phony-debian]
name=Phony Debian
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
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
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
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
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
file=ubuntu.xz
format=raw
size=536870912
expand=/dev/sda2
notes=Phony Ubuntu look-alike used for testing.
[phony-windows]
name=Phony Windows
file=windows.xz
format=raw
size=536870912
expand=/dev/sda2
notes=Phony Windows look-alike used for testing.

172
builder/test-virt-builder-list.sh Executable file
View File

@@ -0,0 +1,172 @@
#!/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 VIRT_BUILDER_SOURCE=file://$abs_builddir/test-index
short_list=$($VG ./virt-builder --no-check-signature --no-cache --list)
if [ "$short_list" != "phony-debian Phony Debian
phony-fedora Phony Fedora
phony-fedora-qcow2 Phony Fedora qcow2
phony-fedora-qcow2-uncompressed Phony Fedora qcow2 uncompressed
phony-fedora-no-format Phony Fedora
phony-ubuntu Phony Ubuntu
phony-windows 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: $VIRT_BUILDER_SOURCE
Fingerprint: F777 4FB1 AD07 4A7E 8C87 67EA 9173 8F73 E1B7 68A0
os-version: phony-debian
Full name: Phony Debian
Minimum/default size: 512.0M
Notes:
Phony Debian look-alike used for testing.
os-version: phony-fedora
Full name: Phony Fedora
Minimum/default size: 1.0G
Notes:
Phony Fedora look-alike used for testing.
os-version: phony-fedora-qcow2
Full name: Phony Fedora qcow2
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
Minimum/default size: 1.0G
Notes:
Phony Fedora look-alike used for testing.
os-version: phony-fedora-no-format
Full name: Phony Fedora
Minimum/default size: 1.0G
Notes:
Phony Fedora look-alike used for testing.
os-version: phony-ubuntu
Full name: Phony Ubuntu
Minimum/default size: 512.0M
Notes:
Phony Ubuntu look-alike used for testing.
os-version: phony-windows
Full name: Phony Windows
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\": \"$VIRT_BUILDER_SOURCE\",
\"fingerprint\": \"F777 4FB1 AD07 4A7E 8C87 67EA 9173 8F73 E1B7 68A0\"
}
],
\"templates\": [
{
\"os-version\": \"phony-debian\",
\"full-name\": \"Phony Debian\",
\"size\": 536870912,
\"notes\": \"Phony Debian look-alike used for testing.\",
\"hidden\": false
},
{
\"os-version\": \"phony-fedora\",
\"full-name\": \"Phony Fedora\",
\"size\": 1073741824,
\"notes\": \"Phony Fedora look-alike used for testing.\",
\"hidden\": false
},
{
\"os-version\": \"phony-fedora-qcow2\",
\"full-name\": \"Phony Fedora qcow2\",
\"size\": 1073741824,
\"notes\": \"Phony Fedora look-alike used for testing.\",
\"hidden\": false
},
{
\"os-version\": \"phony-fedora-qcow2-uncompressed\",
\"full-name\": \"Phony Fedora qcow2 uncompressed\",
\"size\": 1073741824,
\"notes\": \"Phony Fedora look-alike used for testing.\",
\"hidden\": false
},
{
\"os-version\": \"phony-fedora-no-format\",
\"full-name\": \"Phony Fedora\",
\"size\": 1073741824,
\"notes\": \"Phony Fedora look-alike used for testing.\",
\"hidden\": false
},
{
\"os-version\": \"phony-ubuntu\",
\"full-name\": \"Phony Ubuntu\",
\"size\": 536870912,
\"notes\": \"Phony Ubuntu look-alike used for testing.\",
\"hidden\": false
},
{
\"os-version\": \"phony-windows\",
\"full-name\": \"Phony Windows\",
\"size\": 536870912,
\"notes\": \"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,51 @@
#!/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 VIRT_BUILDER_SOURCE=file://$abs_builddir/test-index
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 [ "$(../fish/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

115
builder/test-virt-builder.sh Executable file
View File

@@ -0,0 +1,115 @@
#!/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 VIRT_BUILDER_SOURCE=file://$abs_builddir/test-index
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 [ "$(../fish/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 \
--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 \
--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 ../fish/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

1850
builder/virt-builder.pod Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,92 @@
=encoding utf8
=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,47 @@
# 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 \
centos-*.xz.sig \
cirros-*.xz.sig \
debian.preseed \
debian.sh \
debian-*.xz.sig \
fedora.sh \
fedora-*.xz.sig \
rhel.sh \
scientificlinux.sh \
scientificlinux-*.xz.sig \
ubuntu.preseed \
ubuntu.sh \
ubuntu-*.*.xz.sig
CLEANFILES = *~
# Validates the index file.
TESTS_ENVIRONMENT = $(top_builddir)/run --test
TESTS = validate.sh

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.

View File

@@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)
iQIcBAABAgAGBQJSovhrAAoJEJFzj3Pht2igwDMP/3kxGo8Uhro4c08/AmARucOn
K8xVFMNth6e70ULit0iBnzsqsRcLXMtcdaIzA3wPNJoa3Uw0ZKzHO1FIP1DZC0Yp
wQgnT/HV70k4YKMbJk2ayk9RPop/tRY/Pet9b0MoBwf/H7QzfQX+rU5WYCkcvr60
t18hgugLfFh4wS5UP8jz1S5f6ftrb4TKQUB95lge+Fs7hCf2eqSy4jOciX92yQA6
ACsh1e8hkWlAuDBesg+vcPFrh0oR05HZykUPOH5jUC9zM7kP2w4Y/mPFMIB6J/Zg
SWOTfQWyKYWpW8MZ3huuB8/4EziOOwmIE9pDMcXIS4Cei08DOvq+/F6nbtpErfDU
GdeypPIAsQPjjYDlPUEgYv6L8egzDGuOYWxgNO+2EaYCRjmtvDIxgnf4Q2fQLAhS
Eir9hgvGH6BnNjaLigG1nA/wT6G0U6Ng1vqVrdGUpW1c6m7QoyjhRt4CyaaK0Rj/
3H4FPPdamw/PXLM9IGVauthx/40umcBEZpSq5FSNGbzfzYPxMExJnu2W2bFF4QBD
I/wnPxk5RCYq/AUmRwNrx4klmXnhZZKHYHTDkMuwoV8eIe9Bb6/+f9BY2ujkeMZR
EbeG4i/E8YQ3fwSDfUpQS6kWZ74gMRfuC8vW2LGKMwKPrCaXJu4mVNYmdJGd3d8v
fQ9MlcBUSfaMkyAQ2gc4
=Phm4
-----END PGP SIGNATURE-----

87
builder/website/centos.sh Executable file
View File

@@ -0,0 +1,87 @@
#!/bin/bash -
# 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.
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)
# 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/
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$version \
--initrd-inject=$ks \
--extra-args="ks=file:/`basename $ks` console=tty0 console=ttyS0,115200 proxy=$http_proxy" \
--disk $(pwd)/$output,size=6 \
--location=$tree \
--nographics \
--noreboot
source $(dirname "$0")/compress.sh $output

View File

@@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAABAgAGBQJSx//LAAoJEJFzj3Pht2igtekP/11RH1POvryBWsmtjgwviPJV
P8eIGuUBy38BYbEO0jBWTsT6CAfwOCtyUUMWCBPJ3meoRd4C5AGWHUS5F6z6fZWq
Qo+LU1BfPWDa3TMXP9TybexUCI6cIBMlbzbwkSE/fR2JDwl3K58ZWUrI1rxfKKNJ
CM8rcpLVVP19sAiurndqiIU43bEOS7UwKhBYr1LtNQndpaDH2l+9XnC/HlOrAKgR
H/X9GgscJ43MtA3VPY140RKgZ716c/zznd2yLXrXIJ9JJ9DsoPsooZ6cZSoxDl2E
Y16lnQyAcDySPY+NZluQ6xvtk4JiDWxLFqdXMksRtUb14D91bJ2okhjtztg5yuLh
tC1aNiwcZaDynjXec4SnB+06oPZGstO6uPotasb9sBH/Prm1mv1A4jLwwMTOjSLT
svZ2/xy83lZqBBwU2oFTiSL+hSS3zTm8X0JaInZJPXlgDOTrdKb7UlzVEJ6SqOZo
4omjaYnHWIe9H2SPxCH/7/DC9WW1K9fuxkIEjvqbxTC3n/6WziK2Aq2k5s1Aq0Yy
Z0am0Xhi169V8s8BaLFWiHGi/VlCd81/q2bg+3qCZcWE4zonEZDZSNrL1FtDtHRj
Cgzo0su2LYHhdt0+2QYnAfUJN7Q5kGA1apWrmVI2cvvDpx0eHsFKLcdJnzOntabv
fI+rI2o+Lhp1DW7ywVzl
=KKLo
-----END PGP SIGNATURE-----

View File

@@ -0,0 +1,38 @@
#!/bin/bash -
# 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.
# Common code which syspreps, sparsifies and compresses the templates.
output=$1
# Sysprep (removes logfiles and so on).
# Note this also touches /.autorelabel so the further installation
# changes that we make will be labelled properly at first boot.
virt-sysprep -a $output
# Sparsify.
mv $output $output.old
virt-sparsify $output.old $output
rm $output.old
# Compress.
xz --best --block-size=16777216 $output
# Result. These can be copied into the index file directly.
echo -n compressed_size= ; stat -c %s $output.xz
echo -n checksum= ; sha512sum $output.xz | awk '{print $1}'

View File

@@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
iQIcBAABAgAGBQJSgNPNAAoJEJFzj3Pht2igb1MP/2sQeJEznpBguE5bbs+ulGyW
Aa6jHgM+sG90OF0J9YlDZcYWYKiuVt+kdPOCw9WPg/e5AglKOu6FiMdFA/R9uP9i
ga49So8xYQwaGS6GitHT6dI/kDNLSvTny0nNvAtut62mEJ5D5m9xxtXgYrttUByk
DGQNUJizj8KehUbu9G+sVDM4ojyEbQlSWqi+SRK8uSFwINXXMwwimjZsq/BddcC6
5DplyxS4o9EkbJP/QJKjkfyuhyBzMdIbVstPNFefqPn/xRX7h8VZOyVxr5dw0gYd
PUU5aXeNJFiYR+LvJ2dLxjbcMEmFT+zhUOcxFWwZnjSYaRDdz47AeGfMLzEoFN4K
/fYmtlusjLn9TDNsQ85ffXTETQU8CrhAfUvFmSPU1XuyY/G0UfK6LQehhg5tmHVL
sfOBTKm/lOj+DG4CS0uAjY7JhLEn9K88kKgXhRGIcKt8UjgsPLvTq9sI87OlbcEe
e4++ALWkXpfXF3Nf7mFXNwhQQSiiG9NIATsbfxSS9C7b0Y3HGWOy6pp4TyN8SIEi
RNyWq93iOOtg91kuoRdScEn0crNninok7BmNt2MJry3Cujet+wBpBXYxuVdvRTPO
6kBdl48bxvRb6hcwLqVjeWw8FM6sBGaA8mnTzshHu8nk6hl+tNwfk0loFwyO2M18
bx0DKFFg024W/hfFqKkt
=9ZnB
-----END PGP SIGNATURE-----

View File

@@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
iQIcBAABAgAGBQJSgN0FAAoJEJFzj3Pht2igfCAP/RUpnWQd1XjLKyyZjJSLMyPb
oFF5JmQbFLF906L3wj/kuqyVf+VEdPXBSYTCw/5qvcAoNW/4DxtooSztK0P6j8TX
Ez1g/Hamp0brIdBaFaerTMFSMtrHsIfBjSRCZJy2WCmlJH/piefPdRS06GXqLcDO
WwLN5RZ2R5bWsSkS7DU4V/QODX35jFKV5xMwmX622jitDDWyStLESmyzF8E9MwKh
QbRSguMilpszac9+GcaN05UTv4htarcsy5EkHBxZzjrS5srxlBQl5ygt0ZIj9GBh
UUvfrIXnCZz7WhsBrbB72VhyXFnZj6gsPJsxRdvDg0nH9ORbmsnUo+Q3AJm6h8Vg
UlOPMn05eToeDHF7U5Ki1w5G39TovUTLDJ43jTLHEy/im4zIIRSJgKaD8a4xLhib
6wLWV9LHYQXHesoIqpfb5ife4KEFi5OVlioZ4REK0auKVVOA0y0eQnjDGJ0szBpp
2xx+c+v2q5rn5X3S79lugAC0TpNxbM3X7rtli+kwa5l9Y7f5Z0XZJ7iuywoPs/VN
5WxfG6vc0yfCMs8gpLL1TDVWZW6baoALTUkWj3ePn5od4KL/V9RXTnWhjaDQ+XbX
/DEHwg7E+ICMPiZSqkeqfSAmbc+8Njdf77sEFCZF+ZV046BlHy+aFvxAY6rmrQTZ
+d6Z2oiZ3UZ5R8iOqiDB
=HZIe
-----END PGP SIGNATURE-----

View File

@@ -0,0 +1,385 @@
#### Contents of the preconfiguration file (for wheezy)
### Localization
# Preseeding only locale sets language, country and locale.
d-i debian-installer/locale string en_US
# The values can also be preseeded individually for greater flexibility.
#d-i debian-installer/language string en
#d-i debian-installer/country string NL
#d-i debian-installer/locale string en_GB.UTF-8
# Optionally specify additional locales to be generated.
#d-i localechooser/supported-locales multiselect en_US.UTF-8, nl_NL.UTF-8
# Keyboard selection.
# keymap is an alias for keyboard-configuration/xkb-keymap
d-i keymap select us
# d-i keyboard-configuration/toggle select No toggling
### Network configuration
# Disable network configuration entirely. This is useful for cdrom
# installations on non-networked devices where the network questions,
# warning and long timeouts are a nuisance.
d-i netcfg/enable boolean true
# netcfg will choose an interface that has link if possible. This makes it
# skip displaying a list if there is more than one interface.
d-i netcfg/choose_interface select auto
# To pick a particular interface instead:
#d-i netcfg/choose_interface select eth1
# To set a different link detection timeout (default is 3 seconds).
# Values are interpreted as seconds.
#d-i netcfg/link_detection_timeout string 10
# If you have a slow dhcp server and the installer times out waiting for
# it, this might be useful.
#d-i netcfg/dhcp_timeout string 60
#d-i netcfg/dhcpv6_timeout string 60
# If you prefer to configure the network manually, uncomment this line and
# the static network configuration below.
#d-i netcfg/disable_autoconfig boolean true
# If you want the preconfiguration file to work on systems both with and
# without a dhcp server, uncomment these lines and the static network
# configuration below.
#d-i netcfg/dhcp_failed note
#d-i netcfg/dhcp_options select Configure network manually
# Static network configuration.
#
# IPv4 example
#d-i netcfg/get_ipaddress string 192.168.1.42
#d-i netcfg/get_netmask string 255.255.255.0
#d-i netcfg/get_gateway string 192.168.1.1
#d-i netcfg/get_nameservers string 192.168.1.1
#d-i netcfg/confirm_static boolean true
#
# IPv6 example
#d-i netcfg/get_ipaddress string fc00::2
#d-i netcfg/get_netmask string ffff:ffff:ffff:ffff::
#d-i netcfg/get_gateway string fc00::1
#d-i netcfg/get_nameservers string fc00::1
#d-i netcfg/confirm_static boolean true
# Any hostname and domain names assigned from dhcp take precedence over
# values set here. However, setting the values still prevents the questions
# from being shown, even if values come from dhcp.
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
# If you want to force a hostname, regardless of what either the DHCP
# server returns or what the reverse DNS entry for the IP is, uncomment
# and adjust the following line.
#d-i netcfg/hostname string somehost
# Disable that annoying WEP key dialog.
d-i netcfg/wireless_wep string
# The wacky dhcp hostname that some ISPs use as a password of sorts.
#d-i netcfg/dhcp_hostname string radish
# If non-free firmware is needed for the network or other hardware, you can
# configure the installer to always try to load it, without prompting. Or
# change to false to disable asking.
#d-i hw-detect/load_firmware boolean true
### Network console
# Use the following settings if you wish to make use of the network-console
# component for remote installation over SSH. This only makes sense if you
# intend to perform the remainder of the installation manually.
#d-i anna/choose_modules string network-console
#d-i network-console/authorized_keys_url string http://10.0.0.1/openssh-key
#d-i network-console/password password r00tme
#d-i network-console/password-again password r00tme
### Mirror settings
# If you select ftp, the mirror/country string does not need to be set.
#d-i mirror/protocol string ftp
d-i mirror/country string manual
d-i mirror/http/hostname string ftp.uk.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string @CACHE@
# Suite to install.
#d-i mirror/suite string testing
# Suite to use for loading installer components (optional).
#d-i mirror/udeb/suite string testing
### Account setup
# Skip creation of a root account (normal user account will be able to
# use sudo).
#d-i passwd/root-login boolean false
# Alternatively, to skip creation of a normal user account.
d-i passwd/make-user boolean false
# Root password, either in clear text
d-i passwd/root-password password builder
d-i passwd/root-password-again password builder
# or encrypted using an MD5 hash.
#d-i passwd/root-password-crypted password [MD5 hash]
# To create a normal user account.
#d-i passwd/user-fullname string Debian User
#d-i passwd/username string debian
# Normal user's password, either in clear text
#d-i passwd/user-password password insecure
#d-i passwd/user-password-again password insecure
# or encrypted using an MD5 hash.
#d-i passwd/user-password-crypted password [MD5 hash]
# Create the first user with the specified UID instead of the default.
#d-i passwd/user-uid string 1010
# The user account will be added to some standard initial groups. To
# override that, use this.
#d-i passwd/user-default-groups string audio cdrom video
### Clock and time zone setup
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true
# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string US/Eastern
# Controls whether to use NTP to set the clock during the install
d-i clock-setup/ntp boolean true
# NTP server to use. The default is almost always fine here.
#d-i clock-setup/ntp-server string ntp.example.com
### Partitioning
## Partitioning example
# If the system has free space you can choose to only partition that space.
# This is only honoured if partman-auto/method (below) is not set.
#d-i partman-auto/init_automatically_partition select biggest_free
# Alternatively, you may specify a disk to partition. If the system has only
# one disk the installer will default to using that, but otherwise the device
# name must be given in traditional, non-devfs format (so e.g. /dev/hda or
# /dev/sda, and not e.g. /dev/discs/disc0/disc).
# For example, to use the first SCSI/SATA hard disk:
#d-i partman-auto/disk string /dev/sda
# In addition, you'll need to specify the method to use.
# The presently available methods are:
# - regular: use the usual partition types for your architecture
# - lvm: use LVM to partition the disk
# - crypto: use LVM within an encrypted partition
d-i partman-auto/method string regular
# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. This can be preseeded away...
d-i partman-lvm/device_remove_lvm boolean true
# The same applies to pre-existing software RAID array:
d-i partman-md/device_remove_md boolean true
# And the same goes for the confirmation to write the lvm partitions.
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
# You can choose one of the three predefined partitioning recipes:
# - atomic: all files in one partition
# - home: separate /home partition
# - multi: separate /home, /usr, /var, and /tmp partitions
d-i partman-auto/choose_recipe select atomic
# Or provide a recipe of your own...
# If you have a way to get a recipe file into the d-i environment, you can
# just point at it.
#d-i partman-auto/expert_recipe_file string /hd-media/recipe
# If not, you can put an entire recipe into the preconfiguration file in one
# (logical) line. This example creates a small /boot partition, suitable
# swap, and uses the rest of the space for the root partition:
#d-i partman-auto/expert_recipe string \
# boot-root :: \
# 40 50 100 ext3 \
# $primary{ } $bootable{ } \
# method{ format } format{ } \
# use_filesystem{ } filesystem{ ext3 } \
# mountpoint{ /boot } \
# . \
# 500 10000 1000000000 ext3 \
# method{ format } format{ } \
# use_filesystem{ } filesystem{ ext3 } \
# mountpoint{ / } \
# . \
# 64 512 300% linux-swap \
# method{ swap } format{ } \
# .
# The full recipe format is documented in the file partman-auto-recipe.txt
# included in the 'debian-installer' package or available from D-I source
# repository. This also documents how to specify settings such as file
# system labels, volume group names and which physical devices to include
# in a volume group.
# This makes partman automatically partition without confirmation, provided
# that you told it what to do using one of the methods above.
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
## Partitioning using RAID
# The method should be set to "raid".
#d-i partman-auto/method string raid
# Specify the disks to be partitioned. They will all get the same layout,
# so this will only work if the disks are the same size.
#d-i partman-auto/disk string /dev/sda /dev/sdb
# Next you need to specify the physical partitions that will be used.
#d-i partman-auto/expert_recipe string \
# multiraid :: \
# 1000 5000 4000 raid \
# $primary{ } method{ raid } \
# . \
# 64 512 300% raid \
# method{ raid } \
# . \
# 500 10000 1000000000 raid \
# method{ raid } \
# .
# Last you need to specify how the previously defined partitions will be
# used in the RAID setup. Remember to use the correct partition numbers
# for logical partitions. RAID levels 0, 1, 5, 6 and 10 are supported;
# devices are separated using "#".
# Parameters are:
# <raidtype> <devcount> <sparecount> <fstype> <mountpoint> \
# <devices> <sparedevices>
#d-i partman-auto-raid/recipe string \
# 1 2 0 ext3 / \
# /dev/sda1#/dev/sdb1 \
# . \
# 1 2 0 swap - \
# /dev/sda5#/dev/sdb5 \
# . \
# 0 2 0 ext3 /home \
# /dev/sda6#/dev/sdb6 \
# .
# For additional information see the file partman-auto-raid-recipe.txt
# included in the 'debian-installer' package or available from D-I source
# repository.
# This makes partman automatically partition without confirmation.
d-i partman-md/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
## Controlling how partitions are mounted
# The default is to mount by UUID, but you can also choose "traditional" to
# use traditional device names, or "label" to try filesystem labels before
# falling back to UUIDs.
#d-i partman/mount_style select uuid
### Base system installation
# Configure APT to not install recommended packages by default. Use of this
# option can result in an incomplete system and should only be used by very
# experienced users.
#d-i base-installer/install-recommends boolean false
# The kernel image (meta) package to be installed; "none" can be used if no
# kernel is to be installed.
#d-i base-installer/kernel/image string linux-image-486
### Apt setup
# You can choose to install non-free and contrib software.
#d-i apt-setup/non-free boolean true
#d-i apt-setup/contrib boolean true
# Uncomment this if you don't want to use a network mirror.
#d-i apt-setup/use_mirror boolean false
# Select which update services to use; define the mirrors to be used.
# Values shown below are the normal defaults.
#d-i apt-setup/services-select multiselect security, volatile
#d-i apt-setup/security_host string security.debian.org
#d-i apt-setup/volatile_host string volatile.debian.org
# Additional repositories, local[0-9] available
#d-i apt-setup/local0/repository string \
# http://local.server/debian stable main
#d-i apt-setup/local0/comment string local server
# Enable deb-src lines
#d-i apt-setup/local0/source boolean true
# URL to the public key of the local repository; you must provide a key or
# apt will complain about the unauthenticated repository and so the
# sources.list line will be left commented out
#d-i apt-setup/local0/key string http://local.server/key
# By default the installer requires that repositories be authenticated
# using a known gpg key. This setting can be used to disable that
# authentication. Warning: Insecure, not recommended.
#d-i debian-installer/allow_unauthenticated boolean true
### Package selection
#tasksel tasksel/first multiselect standard, web-server
# If the desktop task is selected, install the kde and xfce desktops
# instead of the default gnome desktop.
#tasksel tasksel/desktop multiselect kde, xfce
# Individual additional packages to install
#d-i pkgsel/include string openssh-server build-essential
# Whether to upgrade packages after debootstrap.
# Allowed values: none, safe-upgrade, full-upgrade
#d-i pkgsel/upgrade select none
# Some versions of the installer can report back on what software you have
# installed, and what software you use. The default is not to report back,
# but sending reports helps the project determine what software is most
# popular and include it on CDs.
popularity-contest popularity-contest/participate boolean false
### Finishing up the installation
# During installations from serial console, the regular virtual consoles
# (VT1-VT6) are normally disabled in /etc/inittab. Uncomment the next
# line to prevent this.
#d-i finish-install/keep-consoles boolean true
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note
# This will prevent the installer from ejecting the CD during the reboot,
# which is useful in some situations.
#d-i cdrom-detect/eject boolean false
# This is how to make the installer shutdown when finished, but not
# reboot into the installed system.
#d-i debian-installer/exit/halt boolean true
# This will power off the machine instead of just halting it.
#d-i debian-installer/exit/poweroff boolean true
### Preseeding other packages
# Depending on what software you choose to install, or if things go wrong
# during the installation process, it's possible that other questions may
# be asked. You can preseed those too, of course. To get a list of every
# possible question that could be asked during an install, do an
# installation, and then run these commands:
# debconf-get-selections --installer > file
# debconf-get-selections >> file
#### Advanced options
### Running custom commands during the installation
# d-i preseeding is inherently not secure. Nothing in the installer checks
# for attempts at buffer overflows or other exploits of the values of a
# preconfiguration file like this one. Only use preconfiguration files from
# trusted locations! To drive that home, and because it's generally useful,
# here's a way to run any shell command you'd like inside the installer,
# automatically.
# This first command is run as early as possible, just after
# preseeding is read.
#d-i preseed/early_command string anna-install some-udeb
# This command is run immediately before the partitioner starts. It may be
# useful to apply dynamic partitioner preseeding that depends on the state
# of the disks (which may not be visible when preseed/early_command runs).
#d-i partman/early_command \
# string debconf-set partman-auto/disk "$(list-devices disk | head -n1)"
# This command is run just before the install finishes, but when there is
# still a usable /target directory. You can chroot to /target and use it
# directly, or use the apt-install and in-target commands to easily install
# packages and run commands in the target system.
#d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh

77
builder/website/debian.sh Executable file
View File

@@ -0,0 +1,77 @@
#!/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.
# The basic plan comes from:
# http://honk.sigxcpu.org/con/Preseeding_Debian_virtual_machines_with_virt_install.html
# https://wiki.debian.org/DebianInstaller/Preseed
unset CDPATH
export LANG=C
set -e
set -x
if [ $# -ne 2 ]; then
echo "$0 VERSION DIST"
exit 1
fi
# Some configuration.
version=$1
dist=$2
location=http://ftp.uk.debian.org/debian/dists/$dist/main/installer-amd64
output=debian-$version
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
rm -f $output $output.old $output.xz
# Make sure it's being run from the correct directory.
if [ ! -f debian.preseed ]; then
echo "You are running this script from the wrong directory."
exit 1
fi
# Note that the injected file must be called "/preseed.cfg" in order
# for d-i to pick it up.
sed -e "s,@CACHE@,$http_proxy,g" < debian.preseed > preseed.cfg
# Clean up function.
cleanup ()
{
rm -f preseed.cfg
virsh undefine $tmpname ||:
}
trap cleanup INT QUIT TERM EXIT ERR
virt-install \
--name=$tmpname \
--ram=1024 \
--os-type=linux --os-variant=debian$dist \
--initrd-inject=$(pwd)/preseed.cfg \
--extra-args="auto console=tty0 console=ttyS0,115200" \
--disk=$(pwd)/$output,size=4 \
--location=$location \
--nographics \
--noreboot
# Remove apt proxy configuration (thanks: Daniel Miranda).
guestfish -a $output -i <<EOF
rm /etc/apt/apt.conf
touch /etc/apt/apt.conf
EOF
source $(dirname "$0")/compress.sh $output

View File

@@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
iQIcBAABAgAGBQJSSt3OAAoJEJFzj3Pht2ig8x4QAKoQVfMWxXiFvV3lrHUVsjpG
n+fDcoFJqMKeE/kMLhmlmzF+QDz1qRs3Xlypy7C8B5ii5jbFVCv6q5edeEWrVYE3
HZOeNgUgmVJEiCSgScEXPpVMAOL/zppJ2PjAbg7CNLHQ64HweNkv6F1ePg4NCIoA
Op5yIvzm0gUHN9ONfsJRBLlZGQRu8bdsNhdYOAr3rmdxhuuunIi/17qNrT6eaWFO
2pnGFIyYMn9q2ReXBG8mFIkHlac9ZpT2sR7EKY3LBt0FvGz0qQrNM+9M9bQBwbIQ
dD/IRfSUUQqjCLYLqiFvFVC/pqAAcR1G2rQ20jRLPkpSUFceFL/K5ueI2flEPEJk
mF6WR4MsN4lX4w0iiJvpWwE0jqlLVQ1GnhoE2GDZEHgkth/4l+0pN0Jos8OKINDJ
wB4W1Xc2aXNXaD1JAaebu+CthZNnFEXpa5TrXMFAOnBY4oQ4DgOt/ad1s9Ju4zLX
EI+Zn0Q++l+iMyU2InXnTHoaTagqKqtngvHWGmSuK55dM8jW9HoYsjZZl0oC0lVz
GbXQ/1t1loTBqh+crr4kcP0oKvRFT9YPASadUVThmeYlxOyhvQ0e30IBdz0Te1OR
rqfymVGR8NsGdLW+jCKOfbLEaYShTksTnUmr+yF5w5D2uzZHqZasE7cpwPXAEhuZ
TF7ZoSqz1utSQF9/xBnz
=L4x6
-----END PGP SIGNATURE-----

View File

@@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
iQIcBAABAgAGBQJSSt3WAAoJEJFzj3Pht2igSeMQAI42FK1YU6Fr/LreD9/BdjNH
TUJ3L/B3ZMJwlMT+F4cX9r1uVD5udzpXdClUEcKgdwPdqzPsQvuwLSBS4fn38nZM
mryzNeUjbcNPSPSY6bj/MNuYNlYNaWShhL6UjHBD6XYIhAs6hYp0RGcogcpgRU9Z
0peHFyJBp+uUqCpnBDz00zJht49mgT6ovUA3cGd/vPhHrsrJUusgzzi46X3F90+H
9eRoe6/xzCbmbiD7HUlARnMK8ec0b7H/CWsNNCd0v9KBNyW9QROkbwBMtRcWtQZW
p9h9JGT2N3AmIqRbUbKwfWxGN6AfK+Xtl9YjJb/ugwSlw0Pif055EKNeUZjGUUzk
V4YA9b1Z6mncyL4wxV8VD9w8en+dr5Iu6ga02r7Xr0rIHuTQyQQaKfHvNoWZFmhq
WI2xsSBLr1EYfLEetdqUkEo2f2gpy7f6UKL1bsHi/6oqA3NaOOXiPdVlbVDNOQFe
kXPfjz/8hnzQ/8O/zIiSiDefQObdM4DQDTk5ha/vOu4pt5XevHkusaciPNGUAhx1
JmxEmPF6sqg2Y0xmeFZB2ab5s6VL/CfVGBF5ZFq7QmDj9eNFjrElfv+uN9NqD+ll
YlR/g3f7vFLHSG64ez4yV/Hgmfv1+4DMGi9MNmhFF3u0W5AIxznTsQzj1KFhbvmV
8QUyTDG7lGNqsgsSgb7W
=l9GJ
-----END PGP SIGNATURE-----

View File

@@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)
iQIcBAABAgAGBQJSsHIuAAoJEJFzj3Pht2igimkP/2YaCFAfSDJWMyumZart/ycr
asgCoNFCr/10jlN2jPTRgOg/hPvrqxIxPvoGRhM/S6hrO8BXHl3dxiOEDi3AMmT+
t//IHduIfpQCEbLCwse3sCwKXKN7PI9lcZ83gdg9eMKnGHSNkDWKI+33c66EvpfX
T/j3UWvSgl3bDftOWIDWPAqnZI4N9+jtat16QwihxRFxALUxoW6v9JgUHc3HfICg
cF5iHDvKmVAlwM+LTCCA+loxM8gyIf1rpC7dpGraskJylldZsx+6lcZqEoqlPxhW
w/OR2hi/5Avoasxd1NTJE3MpQ4tJevlOwXLxhsWKiR4mk8ZmZl4RONnwq25xGiGZ
hqP7FyDhv7q7lYtMmClLOKEvysY2F7++s7nQAjIjkMlJY5LNn/LukZg10rU54UpD
HmSfGPRqKnnnRzVzwxNXjoUGsR1hJ81de+ytHE3sG7tSUZJk0WcC7K0ZUhN7Obnw
X8V1Y0PFsSxds+BVIJ8afJzKzwFnx8yGsY8spwkAttoCVbJZnU3sMwcypKY68QOe
EdnQq8HaGgx1e439mykXOD/dxMhIoPe4zG6XOa9DKV0eo7BY8V4mFCmyOd99IZKh
4V2TSTVfXIqxLZf12r4+7r+JzmufdZIuJLgw6k/t+05Wltm2hAo6SVBqr6IwRXbm
/ZKnJe+5HIwb07EVgHNJ
=asUm
-----END PGP SIGNATURE-----

85
builder/website/fedora.sh Executable file
View File

@@ -0,0 +1,85 @@
#!/bin/bash -
# 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 script was used to create the Fedora templates used by
# virt-builder.
unset CDPATH
export LANG=C
set -e
set -x
if [ $# -ne 1 ]; then
echo "$0 VERSION"
exit 1
fi
version=$1
tree=http://mirror.bytemark.co.uk/fedora/linux/releases/$version/Fedora/x86_64/os/
output=fedora-$version
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
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
autopart --type=plain
# 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=fedora18 \
--initrd-inject=$ks \
--extra-args="ks=file:/`basename $ks` console=tty0 console=ttyS0,115200 proxy=$http_proxy" \
--disk $(pwd)/$output,size=6 \
--location=$tree \
--nographics \
--noreboot
source $(dirname "$0")/compress.sh $output

269
builder/website/index Normal file
View File

@@ -0,0 +1,269 @@
[centos-6]
name=CentOS 6.5
revision=5
osinfo=centos6.5
file=centos-6.xz
sig=centos-6.xz.sig
checksum=8f08505ec708b04a25bbd21816cdda8a5eff8bbf85fec3caff6d7a9a7bfba07dafa707e60772f5676c437a6d3381cd26b4e48bc82a232bc940ca9dcddcff7a85
format=raw
size=6442450944
compressed_size=197139324
expand=/dev/sda3
notes=CentOS 6.5
This CentOS image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/centos.sh
Note that `virt-builder centos-6' will always install the latest
6.x release.
[cirros-0.3.1]
name=CirrOS 0.3.1
file=cirros-0.3.1.xz
sig=cirros-0.3.1.xz.sig
checksum=096209f00eb62d5722accf3d22ca3a4ee5baaac6d7d4ce0be93b56bbd1c8ab2e3eb4f5db1deffcb570e2c3d41f4d721798a1c499675346cee9546554a4b10388
format=raw
size=41126400
compressed_size=11419004
expand=/dev/sda1
notes=CirrOS 0.3.1
CirrOS is a commonly used test image, ideal because it is very
small and boots into a minimally usable Linux system.
Note this is not a real Linux distribution, and several virt-builder
features such as installing packages will not (and cannot) work.
This CirrOS image comes from https://launchpad.net/cirros
[debian-6]
name=Debian 6 (Squeeze)
osinfo=debian6
file=debian-6.xz
revision=2
sig=debian-6.xz.sig
checksum=bff9c28da0375fde65fa238d7a2ea644cbfad0ea3246783a2f44a98f2374850987679c3f1032a632d3c6238de8d9e43291d07a82efc1e824945000e206b9f6cc
format=raw
size=4294967296
compressed_size=139615908
expand=/dev/sda1
notes=Debian 6 (Squeeze).
This is a default Debian install.
The preseed and virt-install scripts that produced this image
can be found in the libguestfs source tree:
builder/website/debian.preseed
builder/website/debian.sh
This image is so very minimal that it only includes an ssh
server and no virtual consoles. To enable virtual consoles
use this virt-builder option:
virt-builder debian-6 \
--edit '/etc/inittab: s,^#([1-9].*respawn.*/sbin/getty.*),$1,'
This image does not contain SSH host keys. To regenerate them use:
--firstboot-command "dpkg-reconfigure openssh-server"
[debian-7]
name=Debian 7 (Wheezy)
osinfo=debian7
file=debian-7.xz
revision=2
sig=debian-7.xz.sig
checksum=c980a7d878c086b14619b3b9f644ab131c1f88b87729062f2832de12a938ba9e5a511c49402a9d02b740a30876f51889d20e7d0ed4997755f542650b8485f013
format=raw
size=4294967296
compressed_size=150734028
expand=/dev/sda1
notes=Debian 7 (Wheezy).
This is a default Debian install.
The preseed and virt-install scripts that produced this image
can be found in the libguestfs source tree:
builder/website/debian.preseed
builder/website/debian.sh
This image is so very minimal that it only includes an ssh
server and no virtual consoles. To enable virtual consoles
use this virt-builder option:
virt-builder debian-7 \
--edit '/etc/inittab: s,^#([1-9].*respawn.*/sbin/getty.*),$1,'
This image does not contain SSH host keys. To regenerate them use:
--firstboot-command "dpkg-reconfigure openssh-server"
[fedora-18]
name=Fedora® 18
osinfo=fedora18
file=fedora-18.xz
sig=fedora-18.xz.sig
checksum=12435775193b69f6e22658aaa001d4ca9b15fd68a04b4b7e9be20b3b517e857e417dc3268a302979d4a702b20f25754025f7ae0e9fb7088419a4ca1669585e6f
format=raw
size=6442450944
compressed_size=148947524
expand=/dev/sda3
notes=Fedora 18.
This Fedora image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/fedora.sh
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[fedora-19]
name=Fedora® 19
osinfo=fedora19
file=fedora-19.xz
sig=fedora-19.xz.sig
checksum=6228792b15df695260eea5530770e22b1bce40a1986410252928adbe4131ab85c031bcf8892736b63240fd585e39a5f44ed7770ba0dc1e6d8de6834cccee3767
format=raw
size=4294967296
compressed_size=172190964
expand=/dev/sda3
notes=Fedora 19.
This Fedora image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/fedora.sh
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[fedora-20]
name=Fedora® 20
osinfo=fedora20
file=fedora-20.xz
sig=fedora-20.xz.sig
checksum=fadde95d55323d1d24ad8a968ac0b5b1f94148e8caa8c96e596b3c71a57569f7b6e18767dbe9b32822bf6caecde6e45f89277f85970569079b1f65ceaf6ed7ba
format=raw
size=4294967296
compressed_size=182477140
expand=/dev/sda3
notes=Fedora 20.
This Fedora image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/fedora.sh
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[scientificlinux-6]
name=Scientific Linux 6.4
revision=4
osinfo=centos6.4
file=scientificlinux-6.xz
sig=scientificlinux-6.xz.sig
checksum=806dd95dd73820b6183c183a9040c547f44b7e9fc109a8ce3cedf7646a9e02d3b65e9dd31f99b656e76c5842b0471f35fa93c4b4d49bf372c842617987b6bd7b
format=raw
size=6442450944
compressed_size=183917692
expand=/dev/sda3
notes=Scientific Linux 6.4
This Scientific Linux image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/scientificlinux.sh
Note that `virt-builder scientificlinux-6' will always install the
latest 6.x release.
[ubuntu-10.04]
name=Ubuntu 10.04 (Lucid)
osinfo=ubuntulucid
file=ubuntu-10.04.xz
sig=ubuntu-10.04.xz.sig
checksum=9e322782bc77c740ce956d57d0d89ec9ac9f2b890c474ac937f400db848df3e164683eaf4631b989f8b4771f64e0c0972452d1555a15c65714b5ceefb295fb7e
format=raw
size=4294967296
compressed_size=149728112
expand=/dev/sda1
notes=Ubuntu 10.04 (Lucid).
This is a minimal Ubuntu 10.04 (Lucid) install.
Only the openssh-server package is selected in tasksel.
The preseed and virt-install scripts that produced this image
can be found in the libguestfs source tree:
builder/website/ubuntu.preseed
builder/website/ubuntu.sh
This image does not contain SSH host keys. To regenerate them use:
--firstboot-command "dpkg-reconfigure openssh-server"
[ubuntu-12.04]
name=Ubuntu 12.04 (Precise)
osinfo=ubuntuprecise
file=ubuntu-12.04.xz
sig=ubuntu-12.04.xz.sig
checksum=15eab4610a44bf28423c08982cec47f6c3d43f29834791440249916ed76cc2dfeaf0405fddc8627086257bbbdaa4016c8982ad9b269f57f8f625b0e70d09e4e0
format=raw
size=4294967296
compressed_size=168593316
expand=/dev/sda1
notes=Ubuntu 12.04 (Precise).
This is a minimal Ubuntu 12.04 (Precise) install.
Only the openssh-server package is selected in tasksel.
The preseed and virt-install scripts that produced this image
can be found in the libguestfs source tree:
builder/website/ubuntu.preseed
builder/website/ubuntu.sh
This image does not contain SSH host keys. To regenerate them use:
--firstboot-command "dpkg-reconfigure openssh-server"
[ubuntu-13.10]
name=Ubuntu 13.10 (Saucy)
osinfo=ubuntusaucy
file=ubuntu-13.10.xz
sig=ubuntu-13.10.xz.sig
checksum=841876f027c63229a0aaac4540ba80d23e56d211138987e3d8187cacb04bc801d144a9831d842fc04aea557fc0c690c812c045ed440123b1d616e61ab2d56049
format=raw
size=4294967296
compressed_size=196481392
expand=/dev/sda1
notes=Ubuntu 13.10 (Saucy).
This is a minimal Ubuntu 13.10 (Saucy) install.
Only the openssh-server package is selected in tasksel.
The preseed and virt-install scripts that produced this image
can be found in the libguestfs source tree:
builder/website/ubuntu.preseed
builder/website/ubuntu.sh
This image does not contain SSH host keys. To regenerate them use:
--firstboot-command "dpkg-reconfigure openssh-server"

289
builder/website/index.asc Normal file
View File

@@ -0,0 +1,289 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[centos-6]
name=CentOS 6.5
revision=5
osinfo=centos6.5
file=centos-6.xz
sig=centos-6.xz.sig
checksum=8f08505ec708b04a25bbd21816cdda8a5eff8bbf85fec3caff6d7a9a7bfba07dafa707e60772f5676c437a6d3381cd26b4e48bc82a232bc940ca9dcddcff7a85
format=raw
size=6442450944
compressed_size=197139324
expand=/dev/sda3
notes=CentOS 6.5
This CentOS image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/centos.sh
Note that `virt-builder centos-6' will always install the latest
6.x release.
[cirros-0.3.1]
name=CirrOS 0.3.1
file=cirros-0.3.1.xz
sig=cirros-0.3.1.xz.sig
checksum=096209f00eb62d5722accf3d22ca3a4ee5baaac6d7d4ce0be93b56bbd1c8ab2e3eb4f5db1deffcb570e2c3d41f4d721798a1c499675346cee9546554a4b10388
format=raw
size=41126400
compressed_size=11419004
expand=/dev/sda1
notes=CirrOS 0.3.1
CirrOS is a commonly used test image, ideal because it is very
small and boots into a minimally usable Linux system.
Note this is not a real Linux distribution, and several virt-builder
features such as installing packages will not (and cannot) work.
This CirrOS image comes from https://launchpad.net/cirros
[debian-6]
name=Debian 6 (Squeeze)
osinfo=debian6
file=debian-6.xz
revision=2
sig=debian-6.xz.sig
checksum=bff9c28da0375fde65fa238d7a2ea644cbfad0ea3246783a2f44a98f2374850987679c3f1032a632d3c6238de8d9e43291d07a82efc1e824945000e206b9f6cc
format=raw
size=4294967296
compressed_size=139615908
expand=/dev/sda1
notes=Debian 6 (Squeeze).
This is a default Debian install.
The preseed and virt-install scripts that produced this image
can be found in the libguestfs source tree:
builder/website/debian.preseed
builder/website/debian.sh
This image is so very minimal that it only includes an ssh
server and no virtual consoles. To enable virtual consoles
use this virt-builder option:
virt-builder debian-6 \
--edit '/etc/inittab: s,^#([1-9].*respawn.*/sbin/getty.*),$1,'
This image does not contain SSH host keys. To regenerate them use:
--firstboot-command "dpkg-reconfigure openssh-server"
[debian-7]
name=Debian 7 (Wheezy)
osinfo=debian7
file=debian-7.xz
revision=2
sig=debian-7.xz.sig
checksum=c980a7d878c086b14619b3b9f644ab131c1f88b87729062f2832de12a938ba9e5a511c49402a9d02b740a30876f51889d20e7d0ed4997755f542650b8485f013
format=raw
size=4294967296
compressed_size=150734028
expand=/dev/sda1
notes=Debian 7 (Wheezy).
This is a default Debian install.
The preseed and virt-install scripts that produced this image
can be found in the libguestfs source tree:
builder/website/debian.preseed
builder/website/debian.sh
This image is so very minimal that it only includes an ssh
server and no virtual consoles. To enable virtual consoles
use this virt-builder option:
virt-builder debian-7 \
--edit '/etc/inittab: s,^#([1-9].*respawn.*/sbin/getty.*),$1,'
This image does not contain SSH host keys. To regenerate them use:
--firstboot-command "dpkg-reconfigure openssh-server"
[fedora-18]
name=Fedora® 18
osinfo=fedora18
file=fedora-18.xz
sig=fedora-18.xz.sig
checksum=12435775193b69f6e22658aaa001d4ca9b15fd68a04b4b7e9be20b3b517e857e417dc3268a302979d4a702b20f25754025f7ae0e9fb7088419a4ca1669585e6f
format=raw
size=6442450944
compressed_size=148947524
expand=/dev/sda3
notes=Fedora 18.
This Fedora image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/fedora.sh
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[fedora-19]
name=Fedora® 19
osinfo=fedora19
file=fedora-19.xz
sig=fedora-19.xz.sig
checksum=6228792b15df695260eea5530770e22b1bce40a1986410252928adbe4131ab85c031bcf8892736b63240fd585e39a5f44ed7770ba0dc1e6d8de6834cccee3767
format=raw
size=4294967296
compressed_size=172190964
expand=/dev/sda3
notes=Fedora 19.
This Fedora image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/fedora.sh
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[fedora-20]
name=Fedora® 20
osinfo=fedora20
file=fedora-20.xz
sig=fedora-20.xz.sig
checksum=fadde95d55323d1d24ad8a968ac0b5b1f94148e8caa8c96e596b3c71a57569f7b6e18767dbe9b32822bf6caecde6e45f89277f85970569079b1f65ceaf6ed7ba
format=raw
size=4294967296
compressed_size=182477140
expand=/dev/sda3
notes=Fedora 20.
This Fedora image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/fedora.sh
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[scientificlinux-6]
name=Scientific Linux 6.4
revision=4
osinfo=centos6.4
file=scientificlinux-6.xz
sig=scientificlinux-6.xz.sig
checksum=806dd95dd73820b6183c183a9040c547f44b7e9fc109a8ce3cedf7646a9e02d3b65e9dd31f99b656e76c5842b0471f35fa93c4b4d49bf372c842617987b6bd7b
format=raw
size=6442450944
compressed_size=183917692
expand=/dev/sda3
notes=Scientific Linux 6.4
This Scientific Linux image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/scientificlinux.sh
Note that `virt-builder scientificlinux-6' will always install the
latest 6.x release.
[ubuntu-10.04]
name=Ubuntu 10.04 (Lucid)
osinfo=ubuntulucid
file=ubuntu-10.04.xz
sig=ubuntu-10.04.xz.sig
checksum=9e322782bc77c740ce956d57d0d89ec9ac9f2b890c474ac937f400db848df3e164683eaf4631b989f8b4771f64e0c0972452d1555a15c65714b5ceefb295fb7e
format=raw
size=4294967296
compressed_size=149728112
expand=/dev/sda1
notes=Ubuntu 10.04 (Lucid).
This is a minimal Ubuntu 10.04 (Lucid) install.
Only the openssh-server package is selected in tasksel.
The preseed and virt-install scripts that produced this image
can be found in the libguestfs source tree:
builder/website/ubuntu.preseed
builder/website/ubuntu.sh
This image does not contain SSH host keys. To regenerate them use:
--firstboot-command "dpkg-reconfigure openssh-server"
[ubuntu-12.04]
name=Ubuntu 12.04 (Precise)
osinfo=ubuntuprecise
file=ubuntu-12.04.xz
sig=ubuntu-12.04.xz.sig
checksum=15eab4610a44bf28423c08982cec47f6c3d43f29834791440249916ed76cc2dfeaf0405fddc8627086257bbbdaa4016c8982ad9b269f57f8f625b0e70d09e4e0
format=raw
size=4294967296
compressed_size=168593316
expand=/dev/sda1
notes=Ubuntu 12.04 (Precise).
This is a minimal Ubuntu 12.04 (Precise) install.
Only the openssh-server package is selected in tasksel.
The preseed and virt-install scripts that produced this image
can be found in the libguestfs source tree:
builder/website/ubuntu.preseed
builder/website/ubuntu.sh
This image does not contain SSH host keys. To regenerate them use:
--firstboot-command "dpkg-reconfigure openssh-server"
[ubuntu-13.10]
name=Ubuntu 13.10 (Saucy)
osinfo=ubuntusaucy
file=ubuntu-13.10.xz
sig=ubuntu-13.10.xz.sig
checksum=841876f027c63229a0aaac4540ba80d23e56d211138987e3d8187cacb04bc801d144a9831d842fc04aea557fc0c690c812c045ed440123b1d616e61ab2d56049
format=raw
size=4294967296
compressed_size=196481392
expand=/dev/sda1
notes=Ubuntu 13.10 (Saucy).
This is a minimal Ubuntu 13.10 (Saucy) install.
Only the openssh-server package is selected in tasksel.
The preseed and virt-install scripts that produced this image
can be found in the libguestfs source tree:
builder/website/ubuntu.preseed
builder/website/ubuntu.sh
This image does not contain SSH host keys. To regenerate them use:
--firstboot-command "dpkg-reconfigure openssh-server"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBAgAGBQJSx/+uAAoJEJFzj3Pht2igUzQP/2ssVh9l6TL7vd9z13rbernd
fsxcTwV/2Vpv2qUVbxuCOZj1uFxkRb+CVk6kRaLKrGYH/bNROJitn6FieHM7lf09
0vd/vEj7Ie9pATxMzFoEy+M8sSJAXTVH2k8OjGhpOuevSswb/JQx23L/KdGa/ERu
X9ZRpsNTaJ/xDOx9tZt/YbWP/SesF8G/LWFG30ULRH8S5jqPUb/DS2k1sgZjCeUk
kawf7/kLzPTuH51YpjZGHDgCIOoyRQORtZDmcaMWFcEVyvoyvMMnK0vsq7mvzvhO
FYqq+32TadS9cLC1O0R6rQxQALmFMuZCd/O2XO6E8mMMeLHS7ooCjdoxl4ospecf
9NefsIXAcHk69hT3EBZflxCkZT5H7rXIAsrDfoK0p3259vgBh8qiYaC7v3RLbJBy
ZICixl9s5KcizI/GU5qZ2/eYXDnsrYRXOFNtKltwe+PeGDDVokmoILMupvAuci1i
e52rxe0jHPsdoJGdAtS61/8jnpL5MbCSbImjZroaWic4NSv9L1klElTNc2cRRQN8
rS/7P7zmBdno8/Ft/UWVePaS4x0BN/JWbe3SgmWjAuw7gYCVh6FPq/paUyKa6p93
ZA+UziEXDxUvE6YNPjjwR1n1X9qqkNTyMu3fL3KyaPc3VfCfPKYmfOfzxhcXA/Ou
9LVnGbZKRdOke5wJ572Z
=fOtX
-----END PGP SIGNATURE-----

175
builder/website/rhel.sh Executable file
View File

@@ -0,0 +1,175 @@
#!/bin/bash -
# 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.
unset CDPATH
export LANG=C
set -e
set -x
# Hack for RWMJ
unset http_proxy
if [ $# -ne 1 ]; then
echo "$0 VERSION"
exit 1
fi
version=$1
output=rhel-$version
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
case $version in
5.*)
major=5
minor=`echo $version | awk -F. '{print $2}'`
topurl=http://download.devel.redhat.com/released/RHEL-$major-Server/U$minor
tree=$topurl/x86_64/os
srpms=$topurl/source/SRPMS
bootfs=ext2
;;
6.*)
major=6
topurl=http://download.devel.redhat.com/released/RHEL-$major/$version
tree=$topurl/Server/x86_64/os
srpms=$topurl/source/SRPMS
optional=$topurl/Server/optional/x86_64/os
optionalsrpms=$topurl/Server/optional/source/SRPMS
bootfs=ext4
;;
7beta1)
major=7
topurl=http://download.devel.redhat.com/released/RHEL-7/7.0-Beta-1
tree=$topurl/Server/x86_64/os
srpms=$topurl/source/SRPMS
optional=$topurl/Server/optional/x86_64/os
optionalsrpms=$topurl/Server/optional/source/SRPMS
bootfs=ext4
;;
*)
echo "$0: version $version not supported by this script yet"
exit 1
esac
rm -f $output $output.old $output.xz
# Generate the kickstart to a temporary file.
ks=$(mktemp)
cat > $ks <<'EOF'
install
text
lang en_US.UTF-8
keyboard us
network --bootproto dhcp
rootpw builder
firewall --enabled --ssh
selinux --enforcing
timezone --utc America/New_York
EOF
if [ $major -eq 5 ]; then
cat >> $ks <<EOF
key --skip
EOF
fi
cat >> $ks <<EOF
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH"
zerombr
clearpart --all --initlabel
part /boot --fstype=$bootfs --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
EOF
# RHEL 5 didn't understand the %end directive, but RHEL >= 6
# requires it.
if [ $major -ge 6 ]; then
cat >> $ks <<EOF
%end
EOF
fi
# Yum configuration.
yum=$(mktemp)
cat > $yum <<EOF
[rhel$major]
name=RHEL $major Server
baseurl=$tree
enabled=1
gpgcheck=0
keepcache=0
[rhel$major-source]
name=RHEL $major Server Source
baseurl=$srpms
enabled=0
gpgcheck=0
keepcache=0
EOF
if [ -n "$optional" ]; then
cat >> $yum <<EOF
[rhel$major-optional]
name=RHEL $major Server Optional
baseurl=$optional
enabled=1
gpgcheck=0
keepcache=0
[rhel$major-optional-source]
name=RHEL $major Server Optional
baseurl=$optionalsrpms
enabled=0
gpgcheck=0
keepcache=0
EOF
fi
# Clean up function.
cleanup ()
{
rm -f $ks
rm -f $yum
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" \
--disk $(pwd)/$output,size=6 \
--location=$tree \
--nographics \
--noreboot
# We have to replace yum config so it doesn't try to use RHN (it
# won't be registered).
guestfish --rw -a $output -m /dev/sda3 \
upload $yum /etc/yum.repos.d/download.devel.redhat.com.repo
source $(dirname "$0")/compress.sh $output

View File

@@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
iQIcBAABAgAGBQJSerbJAAoJEJFzj3Pht2igy+IP/3lkQnpPWz39TUahttdrbwlG
4E+EhqZPXc/53/DVxgOI/AtHZLfpyQ5KghWTfS2Sk/M0j+SYo5BaZgiZE2RlSl33
maynqvrsuCqHtYBsegLxgSPexI+CvysEEUGqZSbLKDbTFeVWsCvfNz0mk4N0+TwH
JIcKu9ziY5219pMkFhAeqhQobGm/rc9RFsSalaPRgZg04dhpUU6zk3lwchvkQ4q8
Wg9BuWKsqBcyi7p9swTq6+gP7SI96pwaUwAum2Cqo3v/dqAJ6KXFK1fo5NDCTpBX
YHIhusm8R/U+2opmdkHAyd3bWT+SHufv3mNtr233K8774FCxgiF7IhcNMtbcx5f8
/p9Uh0NkNWVZt+H2dU+k8xGH5zUmm92h/+GbX8R/qs//tu3DiOrdBT2Cjq98Yrho
lsjII069rvqOVzjR31vuGmpCx7bKCB5Am2VBLmR+Viv16/ZnXlbIwXKJBBLiqdht
Jih3b8U4MVDYt+ZpaCnKpbihNj+WRQ7IwAkNG9EvxVYnzrBbY5NMVtbvL7p6LRNs
GJRwgC0VmZuBVq/yVokT5LVJ/ZWN3mS6MIulsUi0rgEdZyTb11GSLNtKQOlQ6j85
I7VzG0ojI5drBkL2ps/8cgd7yAaXa/k8J4RLvpqoeXL3VPjG3e3tJberBbpn4ZYM
qEy/MJrUC92zo8Chffss
=dSpW
-----END PGP SIGNATURE-----

View File

@@ -0,0 +1,87 @@
#!/bin/bash -
# 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.
unset CDPATH
export LANG=C
set -e
set -x
if [ $# -ne 1 ]; then
echo "$0 VERSION"
exit 1
fi
version=$1
output=scientificlinux-$version
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
# We rebuild this every time there is a new 6.x release, and bump
# the revision in the index.
tree=http://www.mirrorservice.org/sites/ftp.scientificlinux.org/linux/scientific/$version/x86_64/os
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$version \
--initrd-inject=$ks \
--extra-args="ks=file:/`basename $ks` console=tty0 console=ttyS0,115200 proxy=$http_proxy" \
--disk $(pwd)/$output,size=6 \
--location=$tree \
--nographics \
--noreboot
source $(dirname "$0")/compress.sh $output

90
builder/website/test-guest.sh Executable file
View File

@@ -0,0 +1,90 @@
#!/bin/bash -
# 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 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.
#
# Usage:
# ./run builder/website/test-guest.sh os-version [extra virt-builder args]
# Then read the instructions ...
export LANG=C
set -e
if [ ! -x builder/virt-builder ]; then
echo "$0: running the test from the wrong directory, or libguestfs has not been built"
exit 1
fi
if [ $# -lt 1 ]; then
echo "$0: missing os-version"
echo "try: ./run builder/virt-builder -l"
exit 1
fi
osversion="$1"
shift
output="$osversion.img"
builder/virt-builder "$osversion" \
--no-cache -v \
--size 10G \
--root-password password:123456 \
--hostname test.example.com \
--install scrub \
--edit '/etc/issue: s/(.*)/$lineno: $1/' \
--upload builder/virt-builder.pod:/virt-builder.pod \
--run-command 'echo RUN COMMAND 1 >> /run-command.log' \
--run-command 'echo RUN COMMAND 2 >> /run-command.log' \
--run-command 'echo RUN COMMAND 3 >> /run-command.log' \
--firstboot-command 'useradd -m -p "" rjones ; chage -d 0 rjones' \
--firstboot-command 'echo FIRSTBOOT COMMAND 1' \
--firstboot-command 'echo FIRSTBOOT COMMAND 2' \
--firstboot-command 'echo FIRSTBOOT COMMAND 3' \
"$@" |& tee "$osversion.log"
# Boot the guest.
qemu-system-x86_64 \
-m 1024 \
-drive "file=$output,format=raw,snapshot=on,if=ide" &
cat <<EOF
========================================
The "$osversion" guest is being booted.
The trace file is here: "$osversion.log"
Checklist:
1: Root password is 123456
2: Hostname is test.example.com
3: scrub package is installed
4: /etc/issue has line numbers
5: /virt-builder.pod exists and looks reasonable
6: /run-command.log exists and has 3 lines in correct order
7: /root/virt-sysprep-firstboot.log exists and has 3 entries in correct order
8: rjones account exists, with no password
9: rjones password must be changed at first login
10: /home/rjones exists and is populated
11: random-seed file was created or modified
========================================
EOF
#rm $output

View File

@@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
iQIcBAABAgAGBQJSUslLAAoJEJFzj3Pht2igo7MQAJoaHvLfYFBsgx242/U3sY3e
V8WNF77t9NDoTkIS5q/XK9c6w/JeNDsq8SdiLP6+LaFNbFh9O+mo4bhu3Vme3Op8
/ubZ9s1RrysG+dSdUsqEIipUEiII0Xr/ZTONzJpLA5p9k2zDMoJLVgCmywlgnNQp
wdthLDmvQuZQl7YZLbV8TeMjkNm0vOcEZXv+eeOb2guYMZKnfYo6NFBivlCiZxL2
tjZZkCVy/tGRTVrsi8YUumY0TJ4jhZn4Rkzu/KtvbUkfG+jQPoesTCHk3u0tBF5m
h+vrGbj7xf0OHvHtjQhAghlaLMEs1M8QDNV17g+zleu3hVw/WkcgClKa+g4AVbb0
rGlDT3570viQ+Y8fj0upBUQypIwzPMZP88XVKiGCpl6xLinTZBha1SPoTK75Wxue
3Mu2IKqBUi/Y5zMTcPD6EHvssK/pDu7XMtebGzI2AEVTdvTrNyw73d4GkaLtM+eR
AyZt7RxrsRF89EQfBN6adH2WMztNPQvghrk0KphG91E3Dxo4+tp40QWXKKSwHs7S
DnSFVQTrmKI9CxWueUp8b2Lkjlo+tgmolFXrK7HwNHziymdcZtPx+yuSSR5Wa9/5
H3JP133/RWCgJ1MfiIcdVV1yUpP87ApXQo0X/ibU8jXMqIpy+20b6J9dOim+ggjd
Gf/ClDA++NoU5qDijjvR
=iWQP
-----END PGP SIGNATURE-----

View File

@@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
iQIcBAABAgAGBQJSUslUAAoJEJFzj3Pht2igf2wP/iRAY6RO6R3kavBolQufnJ5I
Zx1jy1wL7JkTuUeNi2q69iv/JNvf+1bU6egSGcKV1uGUoJMa7mUMe3vF+WlW/XvM
/RpU2sWnOnoe8JrWpaV+PFHV4oQNqR4Xu/wiq+fqsrC3AFkGz9O3ht+7X9pWO5V2
6XUfAeYNnl/r9ISYFATxn5mysvRtlO7pTra9UhBeLUMEShU0Se2pcppAmqOWhCKv
GYmB8kW28ioOilmcoBJO4Q9MwXYHTP5ZpR1hV6HXG+dv6VkC8WVG5OQIxp6pCqnh
jN0tVc8ahdTX9eE6stzXmfrJzlKnbVnBcmFBTpFoFj5Vdwir2oXrzVMpZqF+V6R9
DmCSFWo7wtv2qjU+Zajk9Jht8NDf3il8Oz3ROSH8dbHz2AkE8nLh0FXQo3Hbj3gB
iYZNqWz1TCh1j9R9/JMhz+C55nSQO6GM2kc4JUo3B6BZVbhoRVV7w5zv56xCneg1
cZm8tU1xydIiBePn71o/mmKhxUdq6gCrmGw6Cx55pRegkydoYXDXr8Xjt+dqw9En
EM2fEvpMzsJZ5uyA2e1GsDaf/+8HuZ0PXYGgBqrC7zOOZv4S13dLDtB6cs2K9vI2
6FjtyBdDscxuFGla9yA8aD8yx2rZ41VWIReaM+RIlbS5hElxiK6YUbLQmnI6DZex
Z1yGEDgOGRa52YrCEsgP
=UfhD
-----END PGP SIGNATURE-----

View File

@@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
iQIcBAABAgAGBQJSUslaAAoJEJFzj3Pht2ig/VcQAIwP3uzFYusmDRLTJsgb8x+6
Pb4QrtR3jltu6MmXtJAdMhvSwReETCy+h18amKtPQObRrrMB0lq+NGXtaWIkmY+j
BhMJpsmjqOot1pvBp1ag9Q/Jsq2oh4vZw+2YTPlZ9E6orJPXm1AvN366zHgrf4jt
8747ASmzFRbExoQmwIBOYPe5Mo/jMmzk5et87r8Hlcs0g41OADMVP5JAs+T17CbI
e+EM64BhHGMjaxe7NsnGhyb2+VwakJxUSCMYJ2WblLirKaXwIU9nNZgi/iIpk4/D
ntZSnHvp/3tyPmcK8pWZar46xLM1J5TJ18Ko1O9I9mGYMPyvbSgw7WviRKhMMzcr
U8Y5fnb4zZ6ciGH8jC6VhalWW46ArMpHUuadLEzTK2ofMeyKVa6zw6YB4rTHhAd9
HXm2rlsBK3m4uSuhnS775N2SRMFwsfhZFLS9qTy2BdK1Yh20kQJ4Yop5WviEUjgz
UNICOs0FUmOa6DRJFibMp7duqjlyE2DVtZxWOMIqjgN4TmxgLZ7L7lNXxF0ZGx6v
laRfsHj/IC/nuysptZf1knrT7NEKJrvebI/nGSP96RqCX/Mv9t0Rtj7rki9fwL0H
EofsCl4BS1L5Owm8/iM5cH+Pv/2TuN4Wg78E1Z4uDli9jYpH/QZatoKanFj5QjNc
VqofvPjofGRrQDHk+7Hv
=SauI
-----END PGP SIGNATURE-----

View File

@@ -0,0 +1,376 @@
#### Contents of the preconfiguration file (for &releasename;)
### Localization
# Locale sets language and country.
d-i debian-installer/locale string en_US
# Keyboard selection.
# Disable automatic (interactive) keymap detection.
d-i console-setup/ask_detect boolean false
#d-i console-setup/modelcode string pc105
d-i console-setup/layoutcode string us
# To select a variant of the selected layout (if you leave this out, the
# basic form of the layout will be used):
#d-i console-setup/variantcode string dvorak
### Network configuration
# netcfg will choose an interface that has link if possible. This makes it
# skip displaying a list if there is more than one interface.
d-i netcfg/choose_interface select auto
# To pick a particular interface instead:
#d-i netcfg/choose_interface select eth1
# If you have a slow dhcp server and the installer times out waiting for
# it, this might be useful.
#d-i netcfg/dhcp_timeout string 60
# If you prefer to configure the network manually, uncomment this line and
# the static network configuration below.
#d-i netcfg/disable_dhcp boolean true
# If you want the preconfiguration file to work on systems both with and
# without a dhcp server, uncomment these lines and the static network
# configuration below.
#d-i netcfg/dhcp_failed note
#d-i netcfg/dhcp_options select Configure network manually
# Static network configuration.
#d-i netcfg/get_nameservers string 192.168.1.1
#d-i netcfg/get_ipaddress string 192.168.1.42
#d-i netcfg/get_netmask string 255.255.255.0
#d-i netcfg/get_gateway string 192.168.1.1
#d-i netcfg/confirm_static boolean true
# Any hostname and domain names assigned from dhcp take precedence over
# values set here. However, setting the values still prevents the questions
# from being shown, even if values come from dhcp.
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
# Disable that annoying WEP key dialog.
d-i netcfg/wireless_wep string
# The wacky dhcp hostname that some ISPs use as a password of sorts.
#d-i netcfg/dhcp_hostname string radish
# If non-free firmware is needed for the network or other hardware, you can
# configure the installer to always try to load it, without prompting. Or
# change to false to disable asking.
#d-i hw-detect/load_firmware boolean true
### Mirror settings
# If you select ftp, the mirror/country string does not need to be set.
#d-i mirror/protocol string ftp
#d-i mirror/country string manual
#d-i mirror/http/hostname string http.us.debian.org
#d-i mirror/http/directory string /ubuntu
#d-i mirror/http/proxy string
# Alternatively: by default, the installer uses CC.archive.ubuntu.com where
# CC is the ISO-3166-2 code for the selected country. You can preseed this
# so that it does so without asking.
d-i mirror/http/mirror select uk.archive.ubuntu.com
# Suite to install.
#d-i mirror/suite string &releasename;
# Suite to use for loading installer components (optional).
#d-i mirror/udeb/suite string &releasename;
# Components to use for loading installer components (optional).
#d-i mirror/udeb/components multiselect main, restricted
### Clock and time zone setup
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true
# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string US/Eastern
# Controls whether to use NTP to set the clock during the install
d-i clock-setup/ntp boolean true
# NTP server to use. The default is almost always fine here.
#d-i clock-setup/ntp-server string ntp.example.com
### Partitioning
# If the system has free space you can choose to only partition that space.
# Alternatives: custom, some_device, some_device_crypto, some_device_lvm.
#d-i partman-auto/init_automatically_partition select biggest_free
# Alternatively, you can specify a disk to partition. The device name must
# be given in traditional non-devfs format.
# Note: A disk must be specified, unless the system has only one disk.
# For example, to use the first SCSI/SATA hard disk:
#d-i partman-auto/disk string /dev/sda
# In addition, you'll need to specify the method to use.
# The presently available methods are: "regular", "lvm" and "crypto"
d-i partman-auto/method string regular
# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. This can be preseeded away...
d-i partman-lvm/device_remove_lvm boolean true
# The same applies to pre-existing software RAID array:
d-i partman-md/device_remove_md boolean true
# And the same goes for the confirmation to write the lvm partitions.
d-i partman-lvm/confirm boolean true
# For LVM partitioning, you can select how much of the volume group to use
# for logical volumes.
#d-i partman-auto-lvm/guided_size string max
#d-i partman-auto-lvm/guided_size string 10GB
#d-i partman-auto-lvm/guided_size string 50%
# You can choose one of the three predefined partitioning recipes:
# - atomic: all files in one partition
# - home: separate /home partition
# - multi: separate /home, /usr, /var, and /tmp partitions
d-i partman-auto/choose_recipe select atomic
# Or provide a recipe of your own...
# The recipe format is documented in the file devel/partman-auto-recipe.txt.
# If you have a way to get a recipe file into the d-i environment, you can
# just point at it.
#d-i partman-auto/expert_recipe_file string /hd-media/recipe
# If not, you can put an entire recipe into the preconfiguration file in one
# (logical) line. This example creates a small /boot partition, suitable
# swap, and uses the rest of the space for the root partition:
#d-i partman-auto/expert_recipe string \
# boot-root :: \
# 40 50 100 ext3 \
# $primary{ } $bootable{ } \
# method{ format } format{ } \
# use_filesystem{ } filesystem{ ext3 } \
# mountpoint{ /boot } \
# . \
# 500 10000 1000000000 ext3 \
# method{ format } format{ } \
# use_filesystem{ } filesystem{ ext3 } \
# mountpoint{ / } \
# . \
# 64 512 300% linux-swap \
# method{ swap } format{ } \
# .
# If you just want to change the default filesystem from ext3 to something
# else, you can do that without providing a full recipe.
#d-i partman/default_filesystem string ext4
# This makes partman automatically partition without confirmation, provided
# that you told it what to do using one of the methods above.
d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
### Controlling how partitions are mounted
# The default is to mount by UUID, but you can also choose "traditional" to
# use traditional device names, or "label" to try filesystem labels before
# falling back to UUIDs.
#d-i partman/mount_style select uuid
### Base system installation
# The kernel image (meta) package to be installed; "none" can be used if no
# kernel is to be installed.
#d-i base-installer/kernel/image string linux-generic
### Account setup
# Skip creation of a root account (normal user account will be able to
# use sudo). The default is false; preseed this to true if you want to set
# a root password.
#d-i passwd/root-login boolean false
# Alternatively, to skip creation of a normal user account.
d-i passwd/make-user boolean false
# Root password, either in clear text
d-i passwd/root-password password builder
d-i passwd/root-password-again password builder
# or encrypted using an MD5 hash.
#d-i passwd/root-password-crypted password [MD5 hash]
# To create a normal user account.
#d-i passwd/user-fullname string Ubuntu User
#d-i passwd/username string ubuntu
# Normal user's password, either in clear text
#d-i passwd/user-password password insecure
#d-i passwd/user-password-again password insecure
# or encrypted using an MD5 hash.
#d-i passwd/user-password-crypted password [MD5 hash]
# Create the first user with the specified UID instead of the default.
#d-i passwd/user-uid string 1010
# The installer will warn about weak passwords. If you are sure you know
# what you're doing and want to override it, uncomment this.
#d-i user-setup/allow-password-weak boolean true
# The user account will be added to some standard initial groups. To
# override that, use this.
#d-i passwd/user-default-groups string audio cdrom video
# Set to true if you want to encrypt the first user's home directory.
d-i user-setup/encrypt-home boolean false
### Apt setup
# You can choose to install restricted and universe software, or to install
# software from the backports repository.
#d-i apt-setup/restricted boolean true
#d-i apt-setup/universe boolean true
#d-i apt-setup/backports boolean true
# Uncomment this if you don't want to use a network mirror.
#d-i apt-setup/use_mirror boolean false
# Select which update services to use; define the mirrors to be used.
# Values shown below are the normal defaults.
#d-i apt-setup/services-select multiselect security
#d-i apt-setup/security_host string security.ubuntu.com
#d-i apt-setup/security_path string /ubuntu
# Additional repositories, local[0-9] available
#d-i apt-setup/local0/repository string \
# http://local.server/ubuntu &releasename; main
#d-i apt-setup/local0/comment string local server
# Enable deb-src lines
#d-i apt-setup/local0/source boolean true
# URL to the public key of the local repository; you must provide a key or
# apt will complain about the unauthenticated repository and so the
# sources.list line will be left commented out
#d-i apt-setup/local0/key string http://local.server/key
# By default the installer requires that repositories be authenticated
# using a known gpg key. This setting can be used to disable that
# authentication. Warning: Insecure, not recommended.
#d-i debian-installer/allow_unauthenticated string true
### Package selection
#tasksel tasksel/first multiselect ubuntu-desktop
#tasksel tasksel/first multiselect lamp-server, print-server
#tasksel tasksel/first multiselect kubuntu-desktop
tasksel tasksel/first multiselect openssh-server
# Individual additional packages to install
#d-i pkgsel/include string openssh-server build-essential
# Whether to upgrade packages after debootstrap.
# Allowed values: none, safe-upgrade, full-upgrade
#d-i pkgsel/upgrade select none
# Language pack selection
#d-i pkgsel/language-packs multiselect de, en, zh
# Policy for applying updates. May be "none" (no automatic updates),
# "unattended-upgrades" (install security updates automatically), or
# "landscape" (manage system with Landscape).
#d-i pkgsel/update-policy select none
# Some versions of the installer can report back on what software you have
# installed, and what software you use. The default is not to report back,
# but sending reports helps the project determine what software is most
# popular and include it on CDs.
#popularity-contest popularity-contest/participate boolean false
# By default, the system's locate database will be updated after the
# installer has finished installing most packages. This may take a while, so
# if you don't want it, you can set this to "false" to turn it off.
#d-i pkgsel/updatedb boolean true
### Boot loader installation
# Grub is the default boot loader (for x86). If you want lilo installed
# instead, uncomment this:
#d-i grub-installer/skip boolean true
# To also skip installing lilo, and install no bootloader, uncomment this
# too:
#d-i lilo-installer/skip boolean true
# This is fairly safe to set, it makes grub install automatically to the MBR
# if no other operating system is detected on the machine.
d-i grub-installer/only_debian boolean true
# This one makes grub-installer install to the MBR if it also finds some other
# OS, which is less safe as it might not be able to boot that other OS.
d-i grub-installer/with_other_os boolean true
# Alternatively, if you want to install to a location other than the mbr,
# uncomment and edit these lines:
#d-i grub-installer/only_debian boolean false
#d-i grub-installer/with_other_os boolean false
#d-i grub-installer/bootdev string (hd0,0)
# To install grub to multiple disks:
#d-i grub-installer/bootdev string (hd0,0) (hd1,0) (hd2,0)
# Optional password for grub, either in clear text
#d-i grub-installer/password password r00tme
#d-i grub-installer/password-again password r00tme
# or encrypted using an MD5 hash, see grub-md5-crypt(8).
#d-i grub-installer/password-crypted password [MD5 hash]
### Finishing up the installation
# During installations from serial console, the regular virtual consoles
# (VT1-VT6) are normally disabled in /etc/inittab. Uncomment the next
# line to prevent this.
#d-i finish-install/keep-consoles boolean true
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note
# This will prevent the installer from ejecting the CD during the reboot,
# which is useful in some situations.
#d-i cdrom-detect/eject boolean false
# This is how to make the installer shutdown when finished, but not
# reboot into the installed system.
#d-i debian-installer/exit/halt boolean true
# This will power off the machine instead of just halting it.
#d-i debian-installer/exit/poweroff boolean true
### X configuration
# X can detect the right driver for some cards, but if you're preseeding,
# you override whatever it chooses. Still, vesa will work most places.
#xserver-xorg xserver-xorg/config/device/driver select vesa
# A caveat with mouse autodetection is that if it fails, X will retry it
# over and over. So if it's preseeded to be done, there is a possibility of
# an infinite loop if the mouse is not autodetected.
#xserver-xorg xserver-xorg/autodetect_mouse boolean true
# Monitor autodetection is recommended.
xserver-xorg xserver-xorg/autodetect_monitor boolean true
# Uncomment if you have an LCD display.
#xserver-xorg xserver-xorg/config/monitor/lcd boolean true
# X has three configuration paths for the monitor. Here's how to preseed
# the "medium" path, which is always available. The "simple" path may not
# be available, and the "advanced" path asks too many questions.
xserver-xorg xserver-xorg/config/monitor/selection-method \
select medium
xserver-xorg xserver-xorg/config/monitor/mode-list \
select 1024x768 @ 60 Hz
### Preseeding other packages
# Depending on what software you choose to install, or if things go wrong
# during the installation process, it's possible that other questions may
# be asked. You can preseed those too, of course. To get a list of every
# possible question that could be asked during an install, do an
# installation, and then run these commands:
# debconf-get-selections --installer > file
# debconf-get-selections >> file
#### Advanced options
### Running custom commands during the installation
# d-i preseeding is inherently not secure. Nothing in the installer checks
# for attempts at buffer overflows or other exploits of the values of a
# preconfiguration file like this one. Only use preconfiguration files from
# trusted locations! To drive that home, and because it's generally useful,
# here's a way to run any shell command you'd like inside the installer,
# automatically.
# This first command is run as early as possible, just after
# preseeding is read.
#d-i preseed/early_command string anna-install some-udeb
# This command is run immediately before the partitioner starts. It may be
# useful to apply dynamic partitioner preseeding that depends on the state
# of the disks (which may not be visible when preseed/early_command runs).
#d-i partman/early_command string debconf-set partman-auto/disk "$(list-devices disk | head -n1)"
# This command is run just before the install finishes, but when there is
# still a usable /target directory. You can chroot to /target and use it
# directly, or use the apt-install and in-target commands to easily install
# packages and run commands in the target system.
#d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh

72
builder/website/ubuntu.sh Executable file
View File

@@ -0,0 +1,72 @@
#!/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.
# The basic plan comes from:
# http://honk.sigxcpu.org/con/Preseeding_Debian_virtual_machines_with_virt_install.html
# https://wiki.debian.org/DebianInstaller/Preseed
# https://help.ubuntu.com/10.04/installation-guide/i386/preseed-using.html
unset CDPATH
export LANG=C
set -e
set -x
if [ $# -ne 2 ]; then
echo "$0 VERSION DIST"
exit 1
fi
# Some configuration.
version=$1
dist=$2
location=http://archive.ubuntu.net/ubuntu/dists/$dist/main/installer-amd64
output=ubuntu-$version
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
rm -f $output $output.old $output.xz
# Make sure it's being run from the correct directory.
if [ ! -f ubuntu.preseed ]; then
echo "You are running this script from the wrong directory."
exit 1
fi
# Note that the injected file must be called "/preseed.cfg" in order
# for d-i to pick it up.
sed -e "s,@CACHE@,$http_proxy,g" < ubuntu.preseed > preseed.cfg
# Clean up function.
cleanup ()
{
rm -f preseed.cfg
virsh undefine $tmpname ||:
}
trap cleanup INT QUIT TERM EXIT ERR
virt-install \
--name=$tmpname \
--ram=1024 \
--os-type=linux --os-variant=ubuntu$dist \
--initrd-inject=$(pwd)/preseed.cfg \
--extra-args="auto console=tty0 console=ttyS0,115200" \
--disk=$(pwd)/$output,size=4 \
--location=$location \
--nographics \
--noreboot
source $(dirname "$0")/compress.sh $output

24
builder/website/validate.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash -
# libguestfs virt-builder validate index
# 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
../virt-index-validate $srcdir/index
../virt-index-validate $srcdir/index.asc

View File

@@ -30,16 +30,17 @@ CLEANFILES = stamp-virt-cat.pod stamp-virt-ls.pod stamp-virt-filesystems.pod
bin_PROGRAMS = virt-cat virt-filesystems virt-ls
SHARED_SOURCE_FILES = \
../fish/config.c \
../fish/domain.c \
../fish/inspect.c \
../fish/keys.c \
../fish/options.h \
../fish/options.c
../fish/options.c \
../fish/uri.h \
../fish/uri.c
virt_cat_SOURCES = \
$(SHARED_SOURCE_FILES) \
virt-cat.c
cat.c
virt_cat_CPPFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \
@@ -51,10 +52,9 @@ virt_cat_CPPFLAGS = \
virt_cat_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(GPROF_CFLAGS) $(GCOV_CFLAGS) \
$(LIBCONFIG_CFLAGS)
$(LIBXML2_CFLAGS)
virt_cat_LDADD = \
$(LIBCONFIG_LIBS) \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
$(LIBXML2_LIBS) \
@@ -63,7 +63,7 @@ virt_cat_LDADD = \
virt_filesystems_SOURCES = \
$(SHARED_SOURCE_FILES) \
virt-filesystems.c
filesystems.c
virt_filesystems_CPPFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \
@@ -75,10 +75,9 @@ virt_filesystems_CPPFLAGS = \
virt_filesystems_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(GPROF_CFLAGS) $(GCOV_CFLAGS) \
$(LIBCONFIG_CFLAGS)
$(LIBXML2_CFLAGS)
virt_filesystems_LDADD = \
$(LIBCONFIG_LIBS) \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
$(LIBXML2_LIBS) \
@@ -87,7 +86,9 @@ virt_filesystems_LDADD = \
virt_ls_SOURCES = \
$(SHARED_SOURCE_FILES) \
virt-ls.c
ls.c \
visit.c \
visit.h
virt_ls_CPPFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \
@@ -99,10 +100,9 @@ virt_ls_CPPFLAGS = \
virt_ls_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(GPROF_CFLAGS) $(GCOV_CFLAGS) \
$(LIBCONFIG_CFLAGS)
$(LIBXML2_CFLAGS)
virt_ls_LDADD = \
$(LIBCONFIG_LIBS) \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
$(LIBXML2_LIBS) \

View File

@@ -24,11 +24,11 @@
#include <inttypes.h>
#include <unistd.h>
#include <getopt.h>
#include <errno.h>
#include <locale.h>
#include <assert.h>
#include <libintl.h>
#include "progname.h"
#include "c-ctype.h"
#include "guestfs.h"
@@ -83,9 +83,6 @@ 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);
@@ -119,8 +116,6 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
argv[0] = (char *) program_name;
for (;;) {
c = getopt_long (argc, argv, options, long_options, &option_index);
if (c == -1) break;
@@ -191,7 +186,11 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
drv->type = drv_a;
drv->a.filename = argv[optind];
drv->a.filename = strdup (argv[optind]);
if (!drv->a.filename) {
perror ("strdup");
exit (EXIT_FAILURE);
}
drv->next = drvs;
drvs = drv;
} else { /* simulate -d option */

View File

@@ -24,6 +24,7 @@
#include <inttypes.h>
#include <unistd.h>
#include <getopt.h>
#include <errno.h>
#include <locale.h>
#include <assert.h>
#include <string.h>
@@ -31,7 +32,6 @@
#include "c-ctype.h"
#include "human.h"
#include "progname.h"
#include "guestfs.h"
#include "options.h"
@@ -131,9 +131,6 @@ 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);
@@ -177,7 +174,6 @@ main (int argc, char *argv[])
{ 0, 0, 0, 0 }
};
struct drv *drvs = NULL;
struct drv *drv;
const char *format = NULL;
int c;
int option_index;
@@ -192,8 +188,6 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
argv[0] = (char *) program_name;
for (;;) {
c = getopt_long (argc, argv, options, long_options, &option_index);
if (c == -1) break;
@@ -693,7 +687,7 @@ do_output_blockdevs (void)
for (i = 0; devices[i] != NULL; ++i) {
int64_t size = -1;
CLEANUP_FREE_STRING_LIST char **parents = NULL;
CLEANUP_FREE char *dev;
CLEANUP_FREE char *dev = NULL;
dev = guestfs_canonical_device_name (g, devices[i]);
if (!dev)
@@ -849,35 +843,6 @@ parents_of_vg (char *vg)
return ret;
}
static char *
join_comma (char **strings)
{
size_t i, count;
char *ret;
for (count = i = 0; strings[i] != NULL; ++i) {
if (i > 0)
count++;
count += strlen (strings[i]);
}
ret = malloc (count + 1);
if (ret == NULL) {
perror ("malloc");
exit (EXIT_FAILURE);
}
for (count = i = 0; strings[i] != NULL; ++i) {
if (i > 0)
ret[count++] = ',';
strcpy (&ret[count], strings[i]);
count += strlen (strings[i]);
}
ret[count] = 0;
return ret;
}
static void
write_row (const char *name, const char *type,
const char *vfs_type, const char *vfs_label, int mbr_id,
@@ -924,7 +889,7 @@ write_row (const char *name, const char *type,
}
if ((columns & COLUMN_PARENTS)) {
/* Internally comma-separated field. */
parents_str = join_comma (parents);
parents_str = guestfs___join_strings (",", parents);
strings[len++] = parents_str;
}
if ((columns & COLUMN_UUID))

View File

@@ -25,16 +25,18 @@
#include <unistd.h>
#include <getopt.h>
#include <fcntl.h>
#include <errno.h>
#include <locale.h>
#include <assert.h>
#include <time.h>
#include <libintl.h>
#include "human.h"
#include "progname.h"
#include "guestfs.h"
#include "options.h"
#include "visit.h"
/* Currently open libguestfs handle. */
guestfs_h *g;
@@ -74,14 +76,6 @@ static void output_int64_uid (int64_t);
static void output_string (const char *);
static void output_string_link (const char *);
static int is_reg (int64_t mode);
static int is_dir (int64_t mode);
static int is_chr (int64_t mode);
static int is_blk (int64_t mode);
static int is_fifo (int64_t mode);
static int is_lnk (int64_t mode);
static int is_sock (int64_t mode);
static void __attribute__((noreturn))
usage (int status)
{
@@ -130,9 +124,6 @@ main (int argc, char *argv[])
/* Current time for --time-days, --time-relative output. */
time (&now);
/* Set global program name that is not polluted with libtool artifacts. */
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEBASEDIR);
textdomain (PACKAGE);
@@ -184,8 +175,6 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
argv[0] = (char *) program_name;
for (;;) {
c = getopt_long (argc, argv, options, long_options, &option_index);
if (c == -1) break;
@@ -296,7 +285,11 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
drv->type = drv_a;
drv->a.filename = argv[optind];
drv->a.filename = strdup (argv[optind]);
if (!drv->a.filename) {
perror ("strdup");
exit (EXIT_FAILURE);
}
drv->next = drvs;
drvs = drv;
} else { /* simulate -d option */
@@ -443,129 +436,12 @@ do_ls_R (const char *dir)
return 0;
}
/* Adapted from
https://rwmj.wordpress.com/2010/12/15/tip-audit-virtual-machine-for-setuid-files/
*/
static char *full_path (const char *dir, const char *name);
static int show_file (const char *dir, const char *name, const struct guestfs_stat *stat, const struct guestfs_xattr_list *xattrs);
typedef int (*visitor_function) (const char *dir, const char *name, const struct guestfs_stat *stat, const struct guestfs_xattr_list *xattrs);
static int
visit (int depth, const char *dir, visitor_function f)
{
/* Call 'f' with the top directory. Note that ordinary recursive
* visits will not otherwise do this, so we have to have a special
* case.
*/
if (depth == 0) {
CLEANUP_FREE_STAT struct guestfs_stat *stat = NULL;
CLEANUP_FREE_XATTR_LIST struct guestfs_xattr_list *xattrs = NULL;
int r;
stat = guestfs_lstat (g, dir);
if (stat == NULL)
return -1;
xattrs = guestfs_lgetxattrs (g, dir);
if (xattrs == NULL)
return -1;
r = f (dir, NULL, stat, xattrs);
if (r == -1)
return -1;
}
size_t i, xattrp;
CLEANUP_FREE_STRING_LIST char **names = NULL;
CLEANUP_FREE_STAT_LIST struct guestfs_stat_list *stats = NULL;
CLEANUP_FREE_XATTR_LIST struct guestfs_xattr_list *xattrs = NULL;
names = guestfs_ls (g, dir);
if (names == NULL)
return -1;
stats = guestfs_lstatlist (g, dir, names);
if (stats == NULL)
return -1;
xattrs = guestfs_lxattrlist (g, dir, names);
if (xattrs == NULL)
return -1;
/* Call function on everything in this directory. */
for (i = 0, xattrp = 0; names[i] != NULL; ++i, ++xattrp) {
CLEANUP_FREE char *path = NULL;
struct guestfs_xattr_list file_xattrs;
size_t nr_xattrs;
assert (stats->len >= i);
assert (xattrs->len >= xattrp);
/* Find the list of extended attributes for this file. */
assert (strlen (xattrs->val[xattrp].attrname) == 0);
if (xattrs->val[xattrp].attrval_len == 0) {
fprintf (stderr, _("%s: error getting extended attrs for %s %s\n"),
program_name, dir, names[i]);
return -1;
}
/* attrval is not \0-terminated. */
char attrval[xattrs->val[xattrp].attrval_len+1];
memcpy (attrval, xattrs->val[xattrp].attrval,
xattrs->val[xattrp].attrval_len);
attrval[xattrs->val[xattrp].attrval_len] = '\0';
if (sscanf (attrval, "%zu", &nr_xattrs) != 1) {
fprintf (stderr, _("%s: error: cannot parse xattr count for %s %s\n"),
program_name, dir, names[i]);
return -1;
}
file_xattrs.len = nr_xattrs;
file_xattrs.val = &xattrs->val[xattrp];
xattrp += nr_xattrs;
/* Call the function. */
if (f (dir, names[i], &stats->val[i], &file_xattrs) == -1)
return -1;
/* Recursively call visit, but only on directories. */
if (is_dir (stats->val[i].mode)) {
path = full_path (dir, names[i]);
if (visit (depth + 1, path, f) == -1)
return -1;
}
}
return 0;
}
static char *
full_path (const char *dir, const char *name)
{
int r;
char *path;
if (STREQ (dir, "/"))
r = asprintf (&path, "/%s", name ? name : "");
else if (name)
r = asprintf (&path, "%s/%s", dir, name);
else
r = asprintf (&path, "%s", dir);
if (r == -1) {
perror ("asprintf");
exit (EXIT_FAILURE);
}
return path;
}
static int show_file (const char *dir, const char *name, const struct guestfs_stat *stat, const struct guestfs_xattr_list *xattrs, void *unused);
static int
do_ls_lR (const char *dir)
{
return visit (0, dir, show_file);
return visit (g, dir, show_file, NULL);
}
/* This is the function which is called to display all files and
@@ -578,31 +454,31 @@ do_ls_lR (const char *dir)
static int
show_file (const char *dir, const char *name,
const struct guestfs_stat *stat,
const struct guestfs_xattr_list *xattrs)
const struct guestfs_xattr_list *xattrs,
void *unused)
{
char filetype[2];
const char *filetype;
CLEANUP_FREE char *path = NULL, *csum = NULL, *link = NULL;
/* Display the basic fields. */
output_start_line ();
if (is_reg (stat->mode))
filetype[0] = '-';
filetype = "-";
else if (is_dir (stat->mode))
filetype[0] = 'd';
filetype = "d";
else if (is_chr (stat->mode))
filetype[0] = 'c';
filetype = "c";
else if (is_blk (stat->mode))
filetype[0] = 'b';
filetype = "b";
else if (is_fifo (stat->mode))
filetype[0] = 'p';
filetype = "p";
else if (is_lnk (stat->mode))
filetype[0] = 'l';
filetype = "l";
else if (is_sock (stat->mode))
filetype[0] = 's';
filetype = "s";
else
filetype[0] = 'u';
filetype[1] = '\0';
filetype = "u";
output_string (filetype);
output_int64_perms (stat->mode & 07777);
@@ -884,51 +760,3 @@ output_int64_dev (int64_t i)
exit (EXIT_FAILURE);
}
}
/* In the libguestfs API, modes returned by lstat and friends are
* defined to contain Linux ABI values. However since the "current
* operating system" might not be Linux, we have to hard-code those
* numbers here.
*/
static int
is_reg (int64_t mode)
{
return (mode & 0170000) == 0100000;
}
static int
is_dir (int64_t mode)
{
return (mode & 0170000) == 0040000;
}
static int
is_chr (int64_t mode)
{
return (mode & 0170000) == 0020000;
}
static int
is_blk (int64_t mode)
{
return (mode & 0170000) == 0060000;
}
static int
is_fifo (int64_t mode)
{
return (mode & 0170000) == 0010000;
}
/* symbolic link */
static int
is_lnk (int64_t mode)
{
return (mode & 0170000) == 0120000;
}
static int
is_sock (int64_t mode)
{
return (mode & 0170000) == 0140000;
}

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# libguestfs
# Copyright (C) 2009-2013 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

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# libguestfs
# Copyright (C) 2009-2013 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

View File

@@ -78,6 +78,12 @@ them with separate I<-a> options.
The format of the disk image is auto-detected. To override this and
force a particular format use the I<--format=..> option.
=item B<-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

View File

@@ -107,6 +107,12 @@ them with separate I<-a> options.
The format of the disk image is auto-detected. To override this and
force a particular format use the I<--format=..> option.
=item B<-a URI>
=item B<--add URI>
Add a remote disk. See L<guestfish(1)/ADDING REMOTE STORAGE>.
=item B<--all>
Display everything. This is currently the same as specifying these

View File

@@ -68,18 +68,8 @@ Find regular files modified in the last 24 hours:
=head2 DIFFERENCES IN SNAPSHOTS AND BACKING FILES
Find the differences between files in a guest and an earlier snapshot
of the same guest.
virt-ls -lR -a snapshot.img / --uids --time-t > old
virt-ls -lR -a current.img / --uids --time-t > new
diff -u old new | less
The commands above won't find files where the content has changed but
the metadata (eg. file size and modification date) is the same. To do
that, you need to add the I<--checksum> parameter to both C<virt-ls>
commands. I<--checksum> can be quite slow since it has to read and
compute a checksum of every regular file in the virtual machine.
Although it is possible to use virt-ls to look for differences, since
libguestfs E<ge> 1.26 a new tool is available called L<virt-diff(1)>.
=head1 OUTPUT MODES
@@ -277,6 +267,12 @@ them with separate I<-a> options.
The format of the disk image is auto-detected. To override this and
force a particular format use the I<--format=..> option.
=item B<-a URI>
=item B<--add URI>
Add a remote disk. See L<guestfish(1)/ADDING REMOTE STORAGE>.
=item B<--checksum>
=item B<--checksum=crc|md5|sha1|sha224|sha256|sha384|sha512>
@@ -498,10 +494,8 @@ L<guestfs(3)>,
L<guestfish(1)>,
L<virt-cat(1)>,
L<virt-copy-out(1)>,
L<virt-diff(1)>,
L<virt-tar-out(1)>,
L<Sys::Guestfs(3)>,
L<Sys::Guestfs::Lib(3)>,
L<Sys::Virt(3)>,
L<http://libguestfs.org/>.
=head1 AUTHOR
@@ -510,4 +504,4 @@ Richard W.M. Jones L<http://people.redhat.com/~rjones/>
=head1 COPYRIGHT
Copyright (C) 2009-2013 Red Hat Inc.
Copyright (C) 2009-2014 Red Hat Inc.

203
cat/visit.c Normal file
View File

@@ -0,0 +1,203 @@
/* virt-ls visitor function
* 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.
*/
/* Adapted from
https://rwmj.wordpress.com/2010/12/15/tip-audit-virtual-machine-for-setuid-files/
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <libintl.h>
#include "guestfs.h"
#include "guestfs-internal-frontend.h"
#include "visit.h"
static int _visit (guestfs_h *g, int depth, const char *dir, visitor_function f, void *opaque);
int
visit (guestfs_h *g, const char *dir, visitor_function f, void *opaque)
{
return _visit (g, 0, dir, f, opaque);
}
static int
_visit (guestfs_h *g, int depth, const char *dir,
visitor_function f, void *opaque)
{
/* Call 'f' with the top directory. Note that ordinary recursive
* visits will not otherwise do this, so we have to have a special
* case.
*/
if (depth == 0) {
CLEANUP_FREE_STAT struct guestfs_stat *stat = NULL;
CLEANUP_FREE_XATTR_LIST struct guestfs_xattr_list *xattrs = NULL;
int r;
stat = guestfs_lstat (g, dir);
if (stat == NULL)
return -1;
xattrs = guestfs_lgetxattrs (g, dir);
if (xattrs == NULL)
return -1;
r = f (dir, NULL, stat, xattrs, opaque);
if (r == -1)
return -1;
}
size_t i, xattrp;
CLEANUP_FREE_STRING_LIST char **names = NULL;
CLEANUP_FREE_STAT_LIST struct guestfs_stat_list *stats = NULL;
CLEANUP_FREE_XATTR_LIST struct guestfs_xattr_list *xattrs = NULL;
names = guestfs_ls (g, dir);
if (names == NULL)
return -1;
stats = guestfs_lstatlist (g, dir, names);
if (stats == NULL)
return -1;
xattrs = guestfs_lxattrlist (g, dir, names);
if (xattrs == NULL)
return -1;
/* Call function on everything in this directory. */
for (i = 0, xattrp = 0; names[i] != NULL; ++i, ++xattrp) {
CLEANUP_FREE char *path = NULL;
struct guestfs_xattr_list file_xattrs;
size_t nr_xattrs;
assert (stats->len >= i);
assert (xattrs->len >= xattrp);
/* Find the list of extended attributes for this file. */
assert (strlen (xattrs->val[xattrp].attrname) == 0);
if (xattrs->val[xattrp].attrval_len == 0) {
fprintf (stderr, _("%s: error getting extended attrs for %s %s\n"),
program_name, dir, names[i]);
return -1;
}
/* attrval is not \0-terminated. */
char attrval[xattrs->val[xattrp].attrval_len+1];
memcpy (attrval, xattrs->val[xattrp].attrval,
xattrs->val[xattrp].attrval_len);
attrval[xattrs->val[xattrp].attrval_len] = '\0';
if (sscanf (attrval, "%zu", &nr_xattrs) != 1) {
fprintf (stderr, _("%s: error: cannot parse xattr count for %s %s\n"),
program_name, dir, names[i]);
return -1;
}
file_xattrs.len = nr_xattrs;
file_xattrs.val = &xattrs->val[xattrp+1];
xattrp += nr_xattrs;
/* Call the function. */
if (f (dir, names[i], &stats->val[i], &file_xattrs, opaque) == -1)
return -1;
/* Recursively call visit, but only on directories. */
if (is_dir (stats->val[i].mode)) {
path = full_path (dir, names[i]);
if (_visit (g, depth + 1, path, f, opaque) == -1)
return -1;
}
}
return 0;
}
char *
full_path (const char *dir, const char *name)
{
int r;
char *path;
if (STREQ (dir, "/"))
r = asprintf (&path, "/%s", name ? name : "");
else if (name)
r = asprintf (&path, "%s/%s", dir, name);
else
r = asprintf (&path, "%s", dir);
if (r == -1) {
perror ("asprintf");
abort ();
}
return path;
}
/* In the libguestfs API, modes returned by lstat and friends are
* defined to contain Linux ABI values. However since the "current
* operating system" might not be Linux, we have to hard-code those
* numbers here.
*/
int
is_reg (int64_t mode)
{
return (mode & 0170000) == 0100000;
}
int
is_dir (int64_t mode)
{
return (mode & 0170000) == 0040000;
}
int
is_chr (int64_t mode)
{
return (mode & 0170000) == 0020000;
}
int
is_blk (int64_t mode)
{
return (mode & 0170000) == 0060000;
}
int
is_fifo (int64_t mode)
{
return (mode & 0170000) == 0010000;
}
/* symbolic link */
int
is_lnk (int64_t mode)
{
return (mode & 0170000) == 0120000;
}
int
is_sock (int64_t mode)
{
return (mode & 0170000) == 0140000;
}

36
cat/visit.h Normal file
View File

@@ -0,0 +1,36 @@
/* virt-ls visitor function
* 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.
*/
#ifndef VISIT_H
#define VISIT_H
typedef int (*visitor_function) (const char *dir, const char *name, const struct guestfs_stat *stat, const struct guestfs_xattr_list *xattrs, void *opaque);
extern int visit (guestfs_h *g, const char *dir, visitor_function f, void *opaque);
extern char *full_path (const char *dir, const char *name);
extern int is_reg (int64_t mode);
extern int is_dir (int64_t mode);
extern int is_chr (int64_t mode);
extern int is_blk (int64_t mode);
extern int is_fifo (int64_t mode);
extern int is_lnk (int64_t mode);
extern int is_sock (int64_t mode);
#endif /* VISIT_H */

14
cfg.mk
View File

@@ -25,15 +25,17 @@ url_dir_list = \
ftp://$(gnu_rel_host)/gnu/coreutils
# Exclude some filenames.
exclude_file_name_regexp--sc_bindtextdomain = ^(daemon|erlang|examples|tests)/
exclude_file_name_regexp--sc_error_message_period = ^php/
exclude_file_name_regexp--sc_prohibit_always-defined_macros = ^examples/
exclude_file_name_regexp--sc_bindtextdomain = ^(daemon|erlang|examples|tests)/|/test-
exclude_file_name_regexp--sc_error_message_period = ^(generator|php|po-docs)/
exclude_file_name_regexp--sc_prohibit_always-defined_macros = ^examples/|^tests/xml/fake-libvirt-xml\.c|^daemon/guestfsd\.c
exclude_file_name_regexp--sc_prohibit_doubled_word = ^po/
exclude_file_name_regexp--sc_prohibit_magic_number_exit = ^(po|po-docs)/|\.pod$
exclude_file_name_regexp--sc_prohibit_strcmp = ^examples/
exclude_file_name_regexp--sc_prohibit_strcmp_and_strncmp = ^examples/
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = ^tests/data/|\.patch$|\.png$|^tests/guests/guest-aux/debian-packages|^tests/guests/guest-aux/minimal-hive
exclude_file_name_regexp--sc_prohibit_magic_number_exit = ^(po|po-docs)/|\.pod$|^fuse/guestunmount\.c
exclude_file_name_regexp--sc_prohibit_strcmp = ^(examples|po-docs)/|\.pod$
exclude_file_name_regexp--sc_prohibit_strcmp_and_strncmp = ^(examples|po-docs)/|\.pod$
exclude_file_name_regexp--sc_prohibit_strncpy = ^src/launch-.*\.c$
exclude_file_name_regexp--sc_require_config_h = ^examples/|^tests/c-api/test-just-header\.c$
exclude_file_name_regexp--sc_require_config_h_first = ^examples/|^tests/c-api/test-just-header\.c$|^python/guestfs-py-byhand\.c$
# Tests not to run as part of "make distcheck".
local-checks-to-skip = \

29
common-rules.mk Normal file
View File

@@ -0,0 +1,29 @@
# 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.
# 'common-rules.mk' should be included in every Makefile.am.
# cf. 'subdir-rules.mk'
-include $(top_builddir)/localenv
# Old RHEL 5 autoconf defines these, but RHEL 5 automake doesn't
# create variables for them. So define them here if they're not
# defined already.
builddir ?= @builddir@
abs_builddir ?= @abs_builddir@
srcdir ?= @srcdir@
abs_srcdir ?= @abs_srcdir@

View File

@@ -1,5 +1,5 @@
# libguestfs
# Copyright (C) 2009-2013 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,18 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# 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.
# The major, minor, and release fields MUST be numbers. Packagers can
# add extra information using --with-extra="..." which may be any
# freeform string.
m4_define([libguestfs_major], [1])
m4_define([libguestfs_minor], [21])
m4_define([libguestfs_release], [25])
m4_define([libguestfs_minor], [25])
m4_define([libguestfs_release], [28])
AC_INIT([libguestfs],libguestfs_major.libguestfs_minor.libguestfs_release)
AC_CONFIG_AUX_DIR([build-aux])
@@ -48,12 +54,16 @@ AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
AC_CONFIG_MACRO_DIR([m4])
dnl Stable or unstable version?
AC_MSG_CHECKING([if this is a stable or unstable branch of libguestfs])
dnl Stable or development version?
BRANCH_NUMBER=libguestfs_major.libguestfs_minor
AC_SUBST([BRANCH_NUMBER])
AC_MSG_CHECKING([if $BRANCH_NUMBER is a stable or development branch of libguestfs])
AS_IF([test "$((libguestfs_minor % 2))" -eq 0 ],[
AC_MSG_RESULT([stable])
BRANCH_TYPE=stable
AC_MSG_RESULT([$BRANCH_TYPE])
],[
AC_MSG_RESULT([unstable])
BRANCH_TYPE=development
AC_MSG_RESULT([$BRANCH_TYPE])
AC_MSG_NOTICE([
***
This is a development version of libguestfs. Some APIs may be unstable
@@ -63,6 +73,7 @@ more information about stable and development branches of libguestfs
please see the section "LIBGUESTFS VERSION NUMBERS" in guestfs(3).
***])
])
AC_SUBST([BRANCH_TYPE])
dnl Extra string, a freeform string defined by packagers.
AC_ARG_WITH([extra],
@@ -80,16 +91,25 @@ AC_DEFINE([PACKAGE_VERSION_MINOR],[libguestfs_minor],[Minor version number.])
AC_DEFINE([PACKAGE_VERSION_RELEASE],[libguestfs_release],[Release number.])
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_EXTRA],["$libguestfs_extra"],[Extra version string.])
dnl Default attach method.
AC_MSG_CHECKING([if the user specified a default attach method])
dnl Default backend.
AC_MSG_CHECKING([if the user specified a default backend])
AC_ARG_WITH([default-backend],
[AS_HELP_STRING([--with-default-backend="direct|libvirt|..."],
[set default backend @<:@default=direct@:>@])],
[DEFAULT_BACKEND="$withval"],
[DEFAULT_BACKEND=direct])
AC_MSG_RESULT([$DEFAULT_BACKEND])
AC_DEFINE_UNQUOTED([DEFAULT_BACKEND],["$DEFAULT_BACKEND"],
[Default backend.])
dnl Fail with error if user does --with-default-attach-method.
AC_ARG_WITH([default-attach-method],
[AS_HELP_STRING([--with-default-attach-method="appliance|libvirt|..."],
[set default attach method @<:@default=appliance@:>@])],
[DEFAULT_ATTACH_METHOD="$withval"],
[DEFAULT_ATTACH_METHOD=appliance])
AC_MSG_RESULT([$DEFAULT_ATTACH_METHOD])
AC_DEFINE_UNQUOTED([DEFAULT_ATTACH_METHOD],["$DEFAULT_ATTACH_METHOD"],
[Default attach method.])
[AS_HELP_STRING([--with-default-attach-method="..."],
[use --with-default-backend instead])],
[AC_MSG_FAILURE([--with-default-attach-method no longer works in
this version of libguestfs, use
./configure --with-default-backend=$withval
instead.])])
dnl Early gnulib initialization.
gl_EARLY
@@ -182,7 +202,8 @@ if test "$gl_gcc_warnings" = yes; then
AC_DEFINE([GNULIB_PORTCHECK], [1], [Enable some gnulib portability checks.])
AH_VERBATIM([FORTIFY_SOURCE],[
/* Enable compile-time and run-time bounds-checking, and some warnings. */
#if __OPTIMIZE__
#if __OPTIMIZE__ && (! defined (_FORTIFY_SOURCE) || _FORTIFY_SOURCE < 2)
# undef _FORTIFY_SOURCE
# define _FORTIFY_SOURCE 2
#endif])
fi
@@ -222,7 +243,7 @@ AC_LANG_SOURCE([[
void
freep (void *ptr)
{
exit (0);
exit (EXIT_SUCCESS);
}
void
@@ -235,7 +256,7 @@ int
main (int argc, char *argv[])
{
test ();
exit (1);
exit (EXIT_FAILURE);
}
]])
],[
@@ -263,12 +284,16 @@ AC_CHECK_MEMBER([struct stat.st_blksize],[
dnl Define a C symbol for the host CPU architecture.
AC_DEFINE_UNQUOTED([host_cpu],["$host_cpu"],[Host architecture.])
dnl Check if libc has program_invocation_short_name.
AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include <errno.h>])
dnl Headers.
AC_CHECK_HEADERS([\
attr/xattr.h \
byteswap.h \
endian.h \
errno.h \
linux/raid/md_u.h \
printf.h \
sys/inotify.h \
sys/socket.h \
@@ -368,7 +393,6 @@ if test "x$enable_daemon" = "xyes"; then
if test "x$enable_valgrind_daemon" = "xyes"; then
AC_DEFINE([VALGRIND_DAEMON],[1],[Define to 1 to run the daemon under valgrind.])
AC_DEFINE_UNQUOTED([VALGRIND_LOG_PATH],["$(pwd)"],[Path to save valgrind log files.])
fi
dnl Which directory should we put the daemon in? NOTE: This
@@ -417,16 +441,45 @@ AC_MSG_CHECKING([if we should build the appliance])
AC_ARG_ENABLE([appliance],
[AS_HELP_STRING([--enable-appliance],
[enable building the appliance @<:@default=yes@:>@])],
[],
[enable_appliance=yes])
AM_CONDITIONAL([ENABLE_APPLIANCE],[test "x$enable_appliance" = "xyes"])
AC_MSG_RESULT([$enable_appliance])
[ENABLE_APPLIANCE="$enableval"],
[ENABLE_APPLIANCE=yes])
AM_CONDITIONAL([ENABLE_APPLIANCE],[test "x$ENABLE_APPLIANCE" = "xyes"])
AC_MSG_RESULT([$ENABLE_APPLIANCE])
AC_SUBST([ENABLE_APPLIANCE])
dnl Check for supermin >= 4.1.0 or febootstrap >= 3.20.
AC_CHECK_PROGS([SUPERMIN],
[supermin febootstrap],[no])
AC_CHECK_PROGS([SUPERMIN_HELPER],
[supermin-helper febootstrap-supermin-helper],[no])
AC_PATH_PROGS([SUPERMIN_HELPER],
[supermin-helper febootstrap-supermin-helper],[no])
dnl supermin >= 4.1.4 supports compressed cpio images.
AC_MSG_CHECKING([for supermin-helper version])
supermin_helper_version=`$SUPERMIN_HELPER --version | awk '{print $2}'`
AC_MSG_RESULT([$supermin_helper_version])
AC_MSG_CHECKING([if supermin-helper supports compressed cpio images])
supermin_helper_version_int=`echo "$supermin_helper_version" | awk -F. '{print $1 * 1000000 + $2 * 1000 + $3}'`
echo supermin_helper_version_int=$supermin_helper_version_int >&AS_MESSAGE_LOG_FD
if test $supermin_helper_version_int -ge 4001004; then
supermin_helper_compressed_cpio=yes
else
supermin_helper_compressed_cpio=no
fi
AC_MSG_RESULT([$supermin_helper_compressed_cpio])
AM_CONDITIONAL([SUPERMIN_HELPER_COMPRESSED_CPIO],
[test "x$supermin_helper_compressed_cpio" = "xyes"])
dnl supermin >= 4.1.5 supports device trees and uses a new style command
dnl syntax.
AC_MSG_CHECKING([if supermin-helper supports device trees and new style command syntax])
if test $supermin_helper_version_int -ge 4001005; then
supermin_helper_new_style_syntax=yes
AC_DEFINE([SUPERMIN_HELPER_NEW_STYLE_SYNTAX],[1],
[Define to 1 if you have supermin-helper >= 4.1.5.])
else
supermin_helper_new_style_syntax=no
fi
AC_MSG_RESULT([$supermin_helper_new_style_syntax])
dnl Pass supermin --packager-config option.
dnl
@@ -461,7 +514,20 @@ AC_ARG_WITH([febootstrap-packager-config],
AC_SUBST([SUPERMIN_PACKAGER_CONFIG])
if test "x$enable_appliance" = "xyes"; then
dnl Pass additional supermin options.
dnl
SUPERMIN_EXTRA_OPTIONS=no
AC_MSG_CHECKING([for --with-supermin-extra-options option])
AC_ARG_WITH([supermin-extra-options],
[AS_HELP_STRING([--with-supermin-extra-options="--opt1 --opt2 ..."],
[Pass additional supermin options. @<:@default=no@:>@])],
[SUPERMIN_EXTRA_OPTIONS="$withval"
AC_MSG_RESULT([$SUPERMIN_EXTRA_OPTIONS"])],
[AC_MSG_RESULT([not set])])
AC_SUBST([SUPERMIN_EXTRA_OPTIONS])
if test "x$ENABLE_APPLIANCE" = "xyes"; then
test "x$SUPERMIN" = "xno" &&
AC_MSG_ERROR([supermin (formerly called febootstrap) must be installed])
dnl febootstrap 2.x did not support the --version parameter
@@ -488,12 +554,18 @@ fi
if test -f /etc/arch-release; then
DISTRO=ARCHLINUX
fi
if test -f /etc/SuSE-release; then
DISTRO=SUSE
fi
if test -f /etc/frugalware-release; then
DISTRO=FRUGALWARE
fi
AC_MSG_RESULT([$DISTRO])
AC_SUBST([DISTRO])
dnl Add extra packages to the appliance.
AC_ARG_WITH([extra-packages],
[AS_HELP_STRING([--with-extra-packages],
[AS_HELP_STRING([--with-extra-packages="pkg1 pkg2 ..."],
[add extra packages to the appliance])],
[EXTRA_PACKAGES="$withval"],
[EXTRA_PACKAGES=])
@@ -516,34 +588,21 @@ AM_CONDITIONAL([HAVE_XDR_U_INT64_T],
AM_CONDITIONAL([HAVE_XDR_UINT64_T],
[test "x$ac_cv_search_xdr_uint64_t" != "xno"])
dnl Check for Augeas (optional).
PKG_CHECK_MODULES([AUGEAS],[augeas],[
AC_SUBST([AUGEAS_CFLAGS])
AC_SUBST([AUGEAS_LIBS])
AC_DEFINE([HAVE_AUGEAS],[1],[Define to 1 if you have Augeas.])
old_LIBS="$LIBS"
LIBS="$LIBS $AUGEAS_LIBS"
dnl Check for functions not available in earlier versions of Augeas.
AC_CHECK_FUNCS([aug_load aug_defvar aug_defnode])
LIBS="$old_LIBS"
],[AC_MSG_WARN([augeas not found, some core features will be disabled])])
dnl Check for libselinux (optional).
AC_CHECK_HEADERS([selinux/selinux.h])
AC_CHECK_LIB([selinux],[setexeccon],[
have_libselinux="$ac_cv_header_selinux_selinux_h"
SELINUX_LIB="-lselinux"
SELINUX_LIBS="-lselinux"
old_LIBS="$LIBS"
LIBS="$LIBS $SELINUX_LIB"
LIBS="$LIBS $SELINUX_LIBS"
AC_CHECK_FUNCS([setcon getcon])
LIBS="$old_LIBS"
],[have_libselinux=no])
if test "x$have_libselinux" = "xyes"; then
AC_DEFINE([HAVE_LIBSELINUX],[1],[Define to 1 if you have libselinux.])
fi
AC_SUBST([SELINUX_LIB])
AC_SUBST([SELINUX_LIBS])
dnl Check for systemtap/DTrace userspace probes (optional).
dnl Since the probe points break under clang, allow this to be disabled.
@@ -607,10 +666,10 @@ AC_CHECK_PROG([PO4A],[po4a],[po4a],[no])
AM_CONDITIONAL([HAVE_PO4A], [test "x$PO4A" != "xno"])
dnl Check for db_dump, db_load (optional).
AC_CHECK_PROGS([DB_DUMP],
[db_dump db5.1_dump db4_dump db4.8_dump db4.7_dump db4.6_dump],[no])
AC_CHECK_PROGS([DB_LOAD],
[db_load db5.1_load db4_load db4.8_load db4.7_load db4.6_load],[no])
AC_PATH_PROGS([DB_DUMP],
[db_dump db5.1_dump db4_dump db4.8_dump db4.7_dump db4.6_dump],[no])
AC_PATH_PROGS([DB_LOAD],
[db_load db5.1_load db4_load db4.8_load db4.7_load db4.6_load],[no])
if test "x$DB_DUMP" != "xno"; then
AC_DEFINE_UNQUOTED([DB_DUMP],["$DB_DUMP"],[Name of db_dump program.])
fi
@@ -619,10 +678,10 @@ if test "x$DB_LOAD" != "xno"; then
fi
dnl Check for netpbm programs (optional).
AC_CHECK_PROGS([PBMTEXT],[pbmtext],[no])
AC_CHECK_PROGS([PNMTOPNG],[pnmtopng],[no])
AC_CHECK_PROGS([BMPTOPNM],[bmptopnm],[no])
AC_CHECK_PROGS([PAMCUT],[pamcut],[no])
AC_PATH_PROGS([PBMTEXT],[pbmtext],[no])
AC_PATH_PROGS([PNMTOPNG],[pnmtopng],[no])
AC_PATH_PROGS([BMPTOPNM],[bmptopnm],[no])
AC_PATH_PROGS([PAMCUT],[pamcut],[no])
if test "x$PBMTEXT" != "xno"; then
AC_DEFINE_UNQUOTED([PBMTEXT],["$PBMTEXT"],[Name of pbmtext program.])
fi
@@ -637,92 +696,131 @@ if test "x$PAMCUT" != "xno"; then
fi
dnl Check for icoutils (optional).
AC_CHECK_PROGS([WRESTOOL],[wrestool],[no])
AC_PATH_PROGS([WRESTOOL],[wrestool],[no])
if test "x$WRESTOOL" != "xno"; then
AC_DEFINE_UNQUOTED([WRESTOOL],["$WRESTOOL"],[Name of wrestool program.])
fi
dnl Check for xzcat (required).
AC_PATH_PROGS([XZCAT],[xzcat],[no])
test "x$XZCAT" = "xno" && AC_MSG_ERROR([xzcat must be installed])
AC_DEFINE_UNQUOTED([XZCAT],["$XZCAT"],[Name of xzcat program.])
dnl liblzma can be used by virt-builder (optional).
PKG_CHECK_MODULES([LIBLZMA], [liblzma],[
AC_SUBST([LIBLZMA_CFLAGS])
AC_SUBST([LIBLZMA_LIBS])
AC_DEFINE([HAVE_LIBLZMA],[1],[liblzma found at compile time.])
],
[AC_MSG_WARN([liblzma not found, virt-builder will be slower])])
dnl (f)lex and bison for virt-builder (required).
dnl XXX Could be optional with some work.
AC_PROG_LEX
AC_PROG_YACC
dnl These macros don't fail, instead they set some useless defaults.
if test "x$LEX" = "x:"; then
AC_MSG_FAILURE([GNU 'flex' is required.])
fi
if test "x$YACC" = "xyacc"; then
AC_MSG_FAILURE([GNU 'bison' is required (yacc won't work).])
fi
dnl Check for QEMU for running binaries on this $host_cpu, fall
dnl back to basic 'qemu'. Allow the user to override it.
qemu_system="`echo qemu-system-$host_cpu | $SED 's/i@<:@456@:>@86/i386/g'`"
qemu_system="$(
echo qemu-system-$host_cpu |
$SED -e 's/-i@<:@456@:>@86/-i386/g' \
-e 's/-arm.*/-arm/g'
)"
default_qemu="qemu-kvm kvm $qemu_system qemu"
AC_ARG_WITH([qemu],
[AS_HELP_STRING([--with-qemu],
[set default QEMU binary @<:@default=[qemu-kvm] qemu-system-<host> qemu@:>@])],
[],
[with_qemu="$default_qemu"])
AC_PATH_PROGS([QEMU],[$with_qemu],[no],
[$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/libexec])
test "x$QEMU" = "xno" && AC_MSG_ERROR([qemu must be installed])
AC_DEFINE_UNQUOTED([QEMU],["$QEMU"],[Location of qemu binary.])
[AS_HELP_STRING([--with-qemu="bin1 bin2 ..."],
[set default QEMU binary @<:@default="[qemu-kvm] qemu-system-<host> qemu"@:>@])],
dnl --with-qemu or --without-qemu:
[],
dnl neither option was given:
[with_qemu="$default_qemu"]
)
dnl Does the user wish to specify -M, -cpu or other qemu options?
AC_MSG_CHECKING([if the user specified extra options for qemu command line])
AC_ARG_WITH([qemu-options],
[AS_HELP_STRING([--with-qemu-options="-M ... -cpu ... etc"],
[pass extra options for qemu command line @<:@default=no@:>@])],
[QEMU_OPTIONS="$withval"],
[QEMU_OPTIONS=no])
AS_IF([test "x$QEMU_OPTIONS" = "xno"],[
AC_MSG_RESULT([no])
QEMU_OPTIONS=
AS_IF([test "x$with_qemu" = "xno"],[
AC_MSG_WARN([qemu was disabled, libguestfs may not work at all])
QEMU=no
],[
AC_MSG_RESULT([$QEMU_OPTIONS])
])
AC_DEFINE_UNQUOTED([QEMU_OPTIONS],["$QEMU_OPTIONS"],
[Extra options for qemu command line.])
AC_PATH_PROGS([QEMU],[$with_qemu],[no],
[$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/libexec])
test "x$QEMU" = "xno" && AC_MSG_ERROR([qemu must be installed])
dnl Check that the chosen qemu has virtio-serial support.
dnl For historical reasons this can be disabled by setting vmchannel_test=no.
if test "x$vmchannel_test" != "xno"; then
AC_MSG_CHECKING([that $QEMU -help works])
if $QEMU -help >&AS_MESSAGE_LOG_FD 2>&1; then
AC_MSG_RESULT([yes])
else
AC_DEFINE_UNQUOTED([QEMU],["$QEMU"],[Location of qemu binary.])
dnl Does the user wish to specify -M, -cpu or other qemu options?
AC_MSG_CHECKING([if the user specified extra options for qemu command line])
AC_ARG_WITH([qemu-options],
[AS_HELP_STRING([--with-qemu-options="-M ... -cpu ... etc"],
[pass extra options for qemu command line @<:@default=no@:>@])],
[QEMU_OPTIONS="$withval"],
[QEMU_OPTIONS=no])
AS_IF([test "x$QEMU_OPTIONS" = "xno"],[
AC_MSG_RESULT([no])
AC_MSG_FAILURE(
QEMU_OPTIONS=
],[
AC_MSG_RESULT([$QEMU_OPTIONS])
])
AC_DEFINE_UNQUOTED([QEMU_OPTIONS],["$QEMU_OPTIONS"],
[Extra options for qemu command line.])
dnl Check that the chosen qemu has virtio-serial support.
dnl For historical reasons this can be disabled by setting
dnl vmchannel_test=no.
if test "x$vmchannel_test" != "xno"; then
AC_MSG_CHECKING([that $QEMU -help works])
if $QEMU -help >&AS_MESSAGE_LOG_FD 2>&1; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_FAILURE(
[$QEMU -help: command failed.
This could be a very old version of qemu, or qemu might not be
working.
])
fi
fi
AC_MSG_CHECKING([that $QEMU -version works])
if $QEMU -version >&AS_MESSAGE_LOG_FD 2>&1; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_FAILURE(
AC_MSG_CHECKING([that $QEMU -version works])
if $QEMU -version >&AS_MESSAGE_LOG_FD 2>&1; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_FAILURE(
[$QEMU -version: command failed.
This could be a very old version of qemu, or qemu might not be
working.
])
fi
fi
AC_MSG_CHECKING([for $QEMU version >= 1])
if $QEMU -version | grep -sq 'version @<:@1-@:>@'; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_FAILURE([$QEMU version must be >= 1.0.])
fi
AC_MSG_CHECKING([for $QEMU version >= 1])
if $QEMU -version | grep -sq 'version @<:@1-@:>@'; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_FAILURE([$QEMU version must be >= 1.0.])
fi
AC_MSG_CHECKING([that $QEMU -nographic -machine accel=kvm:tcg -device ? works])
if $QEMU -nographic -machine accel=kvm:tcg -device \? >&AS_MESSAGE_LOG_FD 2>&1; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_FAILURE([$QEMU -nographic -machine accel=kvm:tcg -device ? doesn't work.])
fi
AC_MSG_CHECKING([that $QEMU -display none -machine accel=kvm:tcg -device ? works])
if $QEMU -display none -machine accel=kvm:tcg -device \? >&AS_MESSAGE_LOG_FD 2>&1; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_FAILURE([$QEMU -display none -machine accel=kvm:tcg -device ? doesn't work.])
fi
AC_MSG_CHECKING([for virtio-serial support in $QEMU])
if $QEMU $QEMU_OPTIONS -nographic -machine accel=kvm:tcg -device \? 2>&1 | grep -sq virtio-serial; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_FAILURE(
AC_MSG_CHECKING([for virtio-serial support in $QEMU])
if $QEMU $QEMU_OPTIONS -display none -machine accel=kvm:tcg -device \? 2>&1 | grep -sq virtio-serial; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_FAILURE(
[I did not find virtio-serial support in
$QEMU.
@@ -743,8 +841,9 @@ If I am using the wrong qemu or you want to compile qemu from source
and install it in another location, then you should configure with
the --with-qemu option.
])
fi
fi
fi
])
dnl Enable packet dumps when in verbose mode. This generates lots
dnl of debug info, only useful for people debugging the RPC mechanism.
@@ -782,6 +881,9 @@ AS_IF([test "x$with_readline" != xno],[
dnl Check for PCRE (required)
PKG_CHECK_MODULES([PCRE], [libpcre])
dnl Check for Augeas >= 1.0.0 (required).
PKG_CHECK_MODULES([AUGEAS],[augeas >= 1.0.0])
dnl libmagic (highly recommended)
AC_CHECK_LIB([magic],[magic_file],[
AC_CHECK_HEADER([magic.h],[
@@ -825,18 +927,12 @@ AM_CONDITIONAL([HAVE_LIBVIRT],[test "x$LIBVIRT_LIBS" != "x"])
libvirt_ro_uri='qemu+unix:///system?socket=/var/run/libvirt/libvirt-sock-ro'
AC_SUBST([libvirt_ro_uri])
dnl libxml2 (highly recommended)
PKG_CHECK_MODULES([LIBXML2], [libxml-2.0],[
AC_SUBST([LIBXML2_CFLAGS])
AC_SUBST([LIBXML2_LIBS])
AC_DEFINE([HAVE_LIBXML2],[1],[libxml2 found at compile time.])
old_LIBS="$LIBS"
LIBS="$LIBS $LIBXML2_LIBS"
AC_CHECK_FUNCS([xmlBufferDetach])
LIBS="$old_LIBS"
],
[AC_MSG_WARN([libxml2 not found, some core features will be disabled])])
AM_CONDITIONAL([HAVE_LIBXML2],[test "x$LIBXML2_LIBS" != "x"])
dnl libxml2 (required)
PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
old_LIBS="$LIBS"
LIBS="$LIBS $LIBXML2_LIBS"
AC_CHECK_FUNCS([xmlBufferDetach])
LIBS="$old_LIBS"
dnl libconfig (highly recommended)
PKG_CHECK_MODULES([LIBCONFIG], [libconfig],[
@@ -858,6 +954,14 @@ PKG_CHECK_MODULES([HIVEX], [hivex],[
[AC_MSG_WARN([hivex not found, some core features will be disabled])])
AM_CONDITIONAL([HAVE_HIVEX],[test "x$HIVEX_LIBS" != "x"])
dnl systemd journal library (optional)
PKG_CHECK_MODULES([SD_JOURNAL], [libsystemd-journal],[
AC_SUBST([SD_JOURNAL_CFLAGS])
AC_SUBST([SD_JOURNAL_LIBS])
AC_DEFINE([HAVE_SD_JOURNAL],[1],[systemd journal library found at compile time.])
],
[AC_MSG_WARN([systemd journal library not found, some features will be disabled])])
dnl FUSE is optional to build the FUSE module.
AC_ARG_ENABLE([fuse],
AS_HELP_STRING([--disable-fuse], [disable FUSE (guestmount) support]),
@@ -910,7 +1014,7 @@ AS_IF([test "x$VALGRIND" != "xno"],[
fi
# Substitute the whole valgrind command.
VG='$(VALGRIND) $(VALGRIND_NO_VGDB) --log-file=$(abs_top_builddir)/valgrind.log --leak-check=full --error-exitcode=119 --suppressions=$(abs_top_srcdir)/valgrind-suppressions'
VG='$(VALGRIND) $(VALGRIND_NO_VGDB) --log-file=$(abs_top_builddir)/tmp/valgrind-%q{T}-%p.log --leak-check=full --error-exitcode=119 --suppressions=$(abs_top_srcdir)/valgrind-suppressions'
],[
# No valgrind, so substitute VG with something that will break.
VG=VALGRIND_IS_NOT_INSTALLED
@@ -977,10 +1081,13 @@ AS_IF([test "x$OCAMLC" != "xno"],[
dnl Write a common gettext module used by each OCaml tool.
dnl If OCaml gettext is not available then we write dummy functions.
AC_MSG_NOTICE([creating resize/common_gettext.ml])
rm -f resize/common_gettext.ml
AC_MSG_NOTICE([creating mllib/common_gettext.ml])
rm -f mllib/common_gettext.ml
# If we're building in a different directory, then 'mllib/' might
# not exist yet, so create it:
mkdir -p mllib
cat <<EOF > resize/common_gettext.ml
cat <<EOF > mllib/common_gettext.ml
(* This file is generated automatically by ./configure. *)
(** Gettext functions for OCaml virt tools.
@@ -1018,7 +1125,7 @@ EOF
if test "x$OCAML_PKG_gettext" != "xno"; then
# ocaml-gettext available: real module.
cat <<EOF >>resize/common_gettext.ml
cat <<EOF >>mllib/common_gettext.ml
module Gettext = Gettext.Program (
struct
let textdomain = "$PACKAGE_NAME"
@@ -1030,7 +1137,7 @@ module Gettext = Gettext.Program (
EOF
else
# No gettext: module containing dummy gettext functions.
cat <<EOF >>resize/common_gettext.ml
cat <<EOF >>mllib/common_gettext.ml
module Gettext = struct
external s_ : string -> string = "%identity"
external f_ : ('a, 'b, 'c, 'd, 'e, 'f) format6
@@ -1046,7 +1153,7 @@ end
EOF
fi
chmod -w resize/common_gettext.ml
chmod -w mllib/common_gettext.ml
])
AM_CONDITIONAL([HAVE_OCAML_PKG_GETTEXT],
[test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno" && test "x$OCAML_PKG_gettext" != "xno"])
@@ -1083,7 +1190,6 @@ AM_CONDITIONAL([HAVE_PERL],
dnl Check for Python (optional, for Python bindings).
PYTHON_PREFIX=
PYTHON_VERSION=
PYTHON_INCLUDEDIR=
PYTHON_INSTALLDIR=
AC_ARG_ENABLE([python],
@@ -1094,23 +1200,30 @@ AS_IF([test "x$enable_python" != "xno"],[
AC_CHECK_PROG([PYTHON],[python],[python],[no])
if test "x$PYTHON" != "xno"; then
AC_MSG_CHECKING([Python prefix])
PYTHON_PREFIX=`$PYTHON -c "import sys; print (sys.prefix)"`
AC_MSG_RESULT([$PYTHON_PREFIX])
AC_MSG_CHECKING([Python version])
PYTHON_VERSION_MAJOR=`$PYTHON -c "import sys; print (sys.version_info@<:@0@:>@)"`
PYTHON_VERSION_MINOR=`$PYTHON -c "import sys; print (sys.version_info@<:@1@:>@)"`
PYTHON_VERSION="$PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR"
AC_MSG_RESULT([$PYTHON_VERSION])
AC_MSG_CHECKING([for Python include path])
if test -z "$PYTHON_INCLUDEDIR"; then
python_path=`$PYTHON -c "import distutils.sysconfig; \
print (distutils.sysconfig.get_python_inc ());"`
PYTHON_INCLUDEDIR=$python_path
fi
AC_MSG_RESULT([$PYTHON_INCLUDEDIR])
# Debian: python-2.7.pc, python-3.2.pc
PKG_CHECK_MODULES([PYTHON], [python-"$PYTHON_VERSION"],[
AC_SUBST([PYTHON_CFLAGS])
AC_SUBST([PYTHON_LIBS])
AC_SUBST([PYTHON_VERSION])
AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
],[
PKG_CHECK_MODULES([PYTHON], [python],[
AC_SUBST([PYTHON_CFLAGS])
AC_SUBST([PYTHON_LIBS])
AC_SUBST([PYTHON_VERSION])
AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
],[
AC_MSG_WARN([python $PYTHON_VERSION not found])
])
])
AC_MSG_CHECKING([Python prefix])
PYTHON_PREFIX=`$PYTHON -c "import sys; print (sys.prefix)"`
AC_MSG_RESULT([$PYTHON_PREFIX])
AC_ARG_WITH([python-installdir],
[AS_HELP_STRING([--with-python-installdir],
@@ -1129,6 +1242,14 @@ AS_IF([test "x$enable_python" != "xno"],[
AC_MSG_RESULT([$PYTHON_INSTALLDIR])
fi
AC_MSG_CHECKING([for Python extension suffix (PEP-3149)])
if test -z "$PYTHON_EXT_SUFFIX"; then
python_ext_suffix=`$PYTHON -c "import distutils.sysconfig; \
print (distutils.sysconfig.get_config_var('EXT_SUFFIX') or distutils.sysconfig.get_config_var('SO'))"`
PYTHON_EXT_SUFFIX=$python_ext_suffix
fi
AC_MSG_RESULT([$PYTHON_EXT_SUFFIX])
dnl Look for some optional symbols in libpython.
old_LIBS="$LIBS"
@@ -1148,11 +1269,11 @@ AS_IF([test "x$enable_python" != "xno"],[
AC_SUBST(PYTHON_PREFIX)
AC_SUBST(PYTHON_VERSION)
AC_SUBST(PYTHON_INCLUDEDIR)
AC_SUBST(PYTHON_INSTALLDIR)
AC_SUBST(PYTHON_EXT_SUFFIX)
])
AM_CONDITIONAL([HAVE_PYTHON],
[test "x$PYTHON" != "xno" && test "x$PYTHON_INCLUDEDIR" != "x" && test "x$PYTHON_INSTALLDIR" != "x"])
[test "x$PYTHON" != "xno" && test "x$PYTHON_LIBS" != "x" ])
dnl Check for Ruby and rake (optional, for Ruby bindings).
AC_ARG_ENABLE([ruby],
@@ -1411,6 +1532,34 @@ AS_IF([test "x$enable_lua" != "xno"],[
])
AM_CONDITIONAL([HAVE_LUA],[test "x$LUA_LIBS" != "x"])
dnl Golang
AC_ARG_ENABLE([golang],
AS_HELP_STRING([--disable-golang], [disable Go language bindings]),
[],
[enable_golang=yes])
AS_IF([test "x$enable_golang" != "xno"],[
AC_CHECK_PROG([GOLANG],[go],[go],[no])
AS_IF([test "x$GOLANG" != "xno"],[
AC_MSG_CHECKING([if $GOLANG is usable])
AS_IF([$GOLANG run golang/config-test.go 2>&AS_MESSAGE_LOG_FD],[
AC_MSG_RESULT([yes])
# Substitute some golang environment.
GOOS=`$GOLANG env GOOS`
GOARCH=`$GOLANG env GOARCH`
GOROOT=`$GOLANG env GOROOT`
AC_SUBST([GOOS])
AC_SUBST([GOARCH])
AC_SUBST([GOROOT])
],[
AC_MSG_RESULT([no])
AC_MSG_WARN([golang ($GOLANG) is installed but not usable])
GOLANG=no
])
])
],[GOLANG=no])
AM_CONDITIONAL([HAVE_GOLANG],[test "x$GOLANG" != "xno"])
dnl Check for Perl modules needed by Perl virt tools (virt-df, etc.)
AS_IF([test "x$PERL" != "xno"],[
missing_perl_modules=no
@@ -1506,7 +1655,19 @@ LIBTOOL='bash $(top_srcdir)/libtool-kill-dependency_libs.sh $(top_builddir)/libt
AC_SUBST([LIBTOOL])
dnl Produce output files.
AC_CONFIG_HEADERS([config.h])
dnl For separated builds, make sure that certain build directories exist.
dnl This avoids having to sprinkle 'mkdir -p' statements throughout
dnl many Makefile.am rules.
mkdir -p \
appliance/supermin.d \
java/t \
ocaml/html \
ocaml/t \
tests/guests/guest-aux
dnl http://www.mail-archive.com/automake@gnu.org/msg10204.html
AC_CONFIG_FILES([appliance/libguestfs-make-fixed-appliance],
[chmod +x,-w appliance/libguestfs-make-fixed-appliance])
@@ -1518,14 +1679,19 @@ AC_CONFIG_FILES([podwrapper.pl],
[chmod +x,-w podwrapper.pl])
AC_CONFIG_FILES([run],
[chmod +x,-w run])
AC_CONFIG_FILES([Makefile
align/Makefile
appliance/Makefile
bash/Makefile
builder/Makefile
builder/test-index
builder/website/Makefile
cat/Makefile
csharp/Makefile
daemon/Makefile
df/Makefile
diff/Makefile
edit/Makefile
erlang/Makefile
erlang/examples/Makefile
@@ -1540,12 +1706,16 @@ AC_CONFIG_FILES([Makefile
gobject/Makefile
gobject/docs/Makefile
gobject/docs/guestfs-docs.sgml
golang/Makefile
golang/examples/Makefile
haskell/Makefile
inspector/Makefile
java/Makefile
java/examples/Makefile
lua/Makefile
lua/examples/Makefile
mllib/Makefile
mllib/config.ml
ocaml/META
ocaml/Makefile
ocaml/examples/Makefile
@@ -1577,25 +1747,33 @@ AC_CONFIG_FILES([Makefile
tests/charsets/Makefile
tests/data/Makefile
tests/disks/Makefile
tests/disks/test-qemu-drive-libvirt.xml
tests/disk-labels/Makefile
tests/events/Makefile
tests/fuzz/Makefile
tests/guests/Makefile
tests/guests/guests.xml
tests/guests/guests-all-good.xml
tests/hotplug/Makefile
tests/http/Makefile
tests/journal/Makefile
tests/luks/Makefile
tests/lvm/Makefile
tests/md/Makefile
tests/mount-local/Makefile
tests/mountable/Makefile
tests/nbd/Makefile
tests/network/Makefile
tests/ntfsclone/Makefile
tests/parallel/Makefile
tests/protocol/Makefile
tests/qemu/Makefile
tests/regressions/Makefile
tests/relative-paths/Makefile
tests/rsync/Makefile
tests/selinux/Makefile
tests/syslinux/Makefile
tests/tmpdirs/Makefile
tests/xfs/Makefile
tests/xml/Makefile
tools/Makefile])
AC_OUTPUT
@@ -1609,7 +1787,7 @@ echo
echo "This is how we have configured the optional components for you today:"
echo
echo "Daemon .............................. $enable_daemon"
echo "Appliance ........................... $enable_appliance"
echo "Appliance ........................... $ENABLE_APPLIANCE"
echo "QEMU ................................ $QEMU $QEMU_OPTIONS"
echo "guestfish and C-based virt tools .... yes"
echo "FUSE filesystem ..................... $enable_fuse"
@@ -1637,6 +1815,8 @@ AS_ECHO_N(["Erlang bindings ..................... "])
if test "x$HAVE_ERLANG_TRUE" = "x"; then echo "yes"; else echo "no"; fi
AS_ECHO_N(["Lua bindings ........................ "])
if test "x$HAVE_LUA_TRUE" = "x"; then echo "yes"; else echo "no"; fi
AS_ECHO_N(["Go bindings ......................... "])
if test "x$HAVE_GOLANG_TRUE" = "x"; then echo "yes"; else echo "no"; fi
AS_ECHO_N(["gobject bindings .................... "])
if test "x$HAVE_GOBJECT_TRUE" = "x"; then echo "yes"; else echo "no"; fi
AS_ECHO_N(["gobject introspection ............... "])

View File

@@ -5,10 +5,6 @@ autobuild/
The autobuild script that we use to build and test the
tarballs on Debian and elsewhere.
guestfsd-in-wine.sh
Run a Windows-compiled guestfsd under Wine. Read the
instructions at the top of this file carefully.
intro/ "Slides" for an intro to libguestfs. This is a short (10-15
min) talk that I give to introduce the main features of
libguestfs. The slides are in the form of a complete
@@ -17,7 +13,7 @@ intro/ "Slides" for an intro to libguestfs. This is a short (10-15
make-check-on-installed.pl
This Perl script allows you to run the test suite (ie. 'make
check', 'make extra-tests' etc) on an installed RPM. This is
check', 'make check-all' etc) on an installed RPM. This is
useful for adding another layer of testing to packages before
we release them. Note that a checked out copy of the source
from git is required. Read the top of the file before using.

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# libguestfs autobuild script
# Copyright (C) 2009-2013 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

View File

@@ -1,117 +0,0 @@
#!/bin/bash -
# Copyright (C) 2009 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# INSTRUCTIONS
#----------------------------------------------------------------------
#
# This is a QEMU wrapper script that allows you to run a
# Windows-compiled guestfsd.exe (daemon) under Wine from a Linux main
# program. You need to read and understand all the instructions below
# before use.
#
# To understand how to compile the daemon for Windows, please read:
# http://www.redhat.com/archives/libguestfs/2009-November/msg00255.html
#
# Adjust the Wine configuration so it can find the libraries, as
# described here:
# http://fedoraproject.org/wiki/MinGW/Configure_wine
#
# On Fedora 13 there is a serious bug in Wine. See:
# https://bugzilla.redhat.com/show_bug.cgi?id=533806#c11
#
# If necessary, adjust the line 'guestfsd=...' below so it points to
# the correct location of the guestfsd.exe program. You can use an
# absolute path here if you want.
guestfsd=daemon/guestfsd.exe
#
# This script is a QEMU wrapper. It pretends to be qemu as far as
# libguestfs programs are concerned. Read this to understand the
# purpose of QEMU wrappers:
# http://libguestfs.org/guestfs.3.html#qemu_wrappers
#
# With this script, the qemu program is not actually run. Instead we
# pretend to be qemu, parse out the necessary parts of the long
# command line that libguestfs passes to qemu, and run the Windows
# daemon, under Wine, with the right command line. The Windows daemon
# then hopefully connects back to the libguestfs socket, and as far as
# the libguestfs program is concerned, it looks like a full appliance
# is running.
#
# To use this script, you must set the environment variable
# LIBGUESTFS_QEMU=/path/to/contrib/guestfsd-in-wine.sh (ie. the path
# to this script).
#
# You can then run libguestfs test programs, and (hopefully!) they'll
# use the Windows guestfsd.exe, simulating calls using Wine.
#
# For example from the top build directory:
#
# LIBGUESTFS_QEMU=contrib/guestfsd-in-wine.sh ./run ./fish/guestfish
#
# Another suggested environment variable is LIBGUESTFS_DEBUG=1 which
# will give you must more detail about what is going on. Also look at
# the contents of the log file 'guestfsd-in-wine.log' after each run.
#
#----------------------------------------------------------------------
# Note that stdout & stderr messages will get eaten by libguestfs
# early on in the process. Therefore write log messages to
# a log file.
exec 5>>guestfsd-in-wine.log
echo "Environment:" >&5
printenv | grep LIBGUESTFS >&5
echo "Command line:" >&5
echo " $@" >&5
# We're called several times, first with -help and -version, and we
# have to pretend to be qemu! (At least enough to trick libguestfs).
if [ "$1" = "-help" ]; then
echo -- " -net user "
echo -- " -no-hpet "
echo -- " -rtc-td-hack "
exit 0
elif [ "$1" = "-version" ]; then
echo -- "0.0.0"
exit 0
fi
# The interesting parameter is -append.
append=
while [ $# -gt 0 ]; do
if [ $1 = "-append" ]; then
append="$2"
shift
fi
shift
done
echo "Append parameter:" >&5
echo " $append" >&5
# guestfs_vmchannel parameter.
vmchannel_param=$(echo "$append" | grep -Eo 'guestfs_vmchannel=[^[:space:]]+')
echo "Vmchannel parameter:" >&5
echo " $vmchannel_param" >&5
# Port number.
port=$(echo "$vmchannel_param" | grep -Eo '[[:digit:]]+$')
echo "Port number:" >&5
echo " $vmchannel_param" >&5
# Run guestfsd.exe.
echo "Command:" >&5
echo " $guestfsd -f -v -c tcp:localhost:$port" >&5
$guestfsd -f -v -c tcp:127.0.0.1:$port

Some files were not shown because too many files have changed in this diff Show More