Commit Graph

73 Commits

Author SHA1 Message Date
Richard W.M. Jones
ffffe71c16 build: Remove code coverage and code profiling options.
This reverts commit 5a2e320ec9.
2014-04-09 14:51:59 +01:00
Richard W.M. Jones
ae6f726ecc sysprep: Use customize module for customizing the guest after sysprepping.
Note this removes the following modules (all replaced by 'customize'):

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

Although this is mostly refactoring, it does change the order in which
virt-builder command line arguments are processed, so they are now
processed in the order they appear, not the inflexible fixed order
used before.
2014-03-25 12:41:04 +00:00
Hilko Bengen
b30e2cf122 Fix out-of-tree build: Do not accidentally build mllib components in srcdir 2014-03-04 00:06:09 +01:00
Hilko Bengen
f75142c577 Fix building on architectures where ocamlopt is not available 2014-02-28 14:01:25 +00:00
Pino Toscano
0f3898b2f5 sysprep: use Mkdtemp to create the temporary directory
Use the safer mkdtemp instead of manually creating a path.
2014-02-24 15:40:29 +01:00
Pino Toscano
4ca4eef0cc sysprep: remove RH subscription manager files
Add a new operation for it, which should do what
`subscription-manager clean` does.

Part of RHBZ#1063374.
2014-02-13 10:57:31 +01:00
Richard W.M. Jones
233d5410e5 sysprep: Add script4.sh (test script) to EXTRA_DIST.
This fixes commit ce9d4d335b.
2014-01-28 21:56:18 +00:00
Richard W.M. Jones
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
6c971faecf Update copyright dates for 2014. 2014-01-02 16:53:34 +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
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
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
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
08b7c90228 sysprep: Refactor hostname code into a common library. 2013-10-03 22:02:47 +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
147b4ee87e sysprep: Refactor firstboot code into a common library. 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
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
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
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
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
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
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
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
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
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
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
6185aa4e38 ocaml tools: Enable parallel builds.
In particular, building virt-sysprep is slow because there are so many
modules.  Enable parallel builds.  If it breaks, we should fix it, not
work around it.
2013-03-28 20:15:51 +00:00
Richard W.M. Jones
05ba393724 OCaml tools: Use Common_gettext and Common_utils modules.
Share these modules across all three tools virt-resize, virt-sparsify
and virt-sysprep.

This is mostly code motion.
2013-03-28 14:00:42 +00:00
Richard W.M. Jones
3e9e40aee3 fuse: Add guestunmount program to handle unmounting (RHBZ#916780). 2013-03-05 13:12:25 +00:00
Richard W.M. Jones
5a2e320ec9 configure: Add --enable-code-profiling and --enable-code-coverage flags.
These configure flags enable code profiling (with gprof) and code
coverage (with gcov) respectively.

Although this is a nice idea, it's not currently very useful.

Libtool mangles filenames in such a way that gcov cannot locate its
datafiles.

Profiling is of dubious utility with libguestfs which is not CPU-bound
and relies extensively on running external programs (oprofile-like
system profiling that took into account libguestfs + qemu or
libguestfs + qemu + the appliance + filesystem tools *would* be
useful).

Also neither flag will help in capturing data from the appliance.
2012-12-04 14:11:14 +00:00
Wanlong Gao
9fb5a3ceaf sysprep: remove crash data generated by kexec-tools
Remove the kdump generated kernel crash data.

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

RWMJ:
 - Added /var/log/dump/* path for SLES (thanks Olaf Hering).
 - Update po/POTFILES-ml.
2012-11-22 08:30:21 +00:00
Richard W.M. Jones
3636c5fcff tests: Replace 'make extra-tests' with individual tests.
'make extra-tests' was a monolithic set of tests that did all sorts of
things: valgrind, tests over local guests, tests with upstream qemu,
tests with upstream libvirt, tests with the appliance attach method.

This made it hard to perform individual tests, eg. just valgrind
testing.  It was also hard to maintain because the tests were not
located in the same directories as the programs and sometimes
duplicated tests that were run elsewhere.

This commit splits up 'make extra-tests' into 5 separate targets:

 make check-valgrind              # run a subset of tests under valgrind
 make check-valgrind-local-guests # test under valgrind with local guests
 make check-with-appliance        # test with attach-method == appliance
 make check-with-upstream-qemu    # test with an alternate/upstream qemu
 make check-with-upstream-libvirt # test with an alternate/upstream libvirt

(You can also still run 'make extra-tests' which is now simply
a rule that runs the above 5 targets in order).

This replaces everything that was in the tests/extra directory,
so that has now gone.
2012-11-13 15:26:29 +00:00
Richard W.M. Jones
4a4ca0c01d syntax: Use __PATTERNS__ instead of @PATTERNS@ in podwrapper man pages.
It is slightly dangerous to use @PATTERNS@, since these might
be substituted by autoconf when they appear in Makefile.am files.
2012-10-03 09:22:45 +01:00
Wanlong Gao
98bf41d80d sysprep: remove hostname from ifcfg-*
Remove hostname from network interface configuration.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-09-03 09:39:48 +01:00
Richard W.M. Jones
2f97bf873b podwrapper: Add --license parameter, which is required.
This adds standard LICENSE and BUGS sections to all of the man pages
that are processed by podwrapper.

Modify all the calls to $(PODWRAPPER) to add the right --license
parameter according to the content.  Note that this relaxes the
license on some code example pages, making them effectively BSD-style
licensed.
2012-08-21 20:33:21 +01:00
Richard W.M. Jones
99cfc1f36e sysprep: Add --firstboot functionality.
This allows you to add scripts that run in the context of
the guest the first time it boots.
2012-08-18 11:47:19 +01:00
Wanlong Gao
159b1479cc sysprep: remove the process accounting log files
We just remove the process accounting files previously without
touch a empty file, this will cause psacct runs error.
Restart the service can't help us create this file auto.

couldn't open file '/var/account/pacct': No such file or directory

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-08-11 14:18:42 +01:00
Richard W.M. Jones
590774ed9e build: Use $(top_builddir)/run in Makefile.am's.
Not necessary, but this makes all invocations of 'run' consistent.
There is no functional change.
2012-07-26 21:58:17 +01:00
Richard W.M. Jones
42bf3274e4 sysprep: Generate new random UUIDs for LVM2 PVs and VGs (thanks Kazuo Moriwaka). 2012-07-25 14:47:15 +01:00
Richard W.M. Jones
b7ff02354d sysprep: Tidy up the Makefile.
This is just code motion.
2012-07-25 10:15:47 +01:00
Wanlong Gao
e68336d72a sysprep: remove the local machine ID
remove the local machine ID, leave it empty, let it be generated
during next booting.

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

RWMJ:
 - Whitespace change.
 - Remove completed items from TODO.
2012-07-25 08:56:38 +01:00
Wanlong Gao
a121f1d654 sysprep: remove the auto generated abrt data
remove the automatically generated abrt data.

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

RWMJ:
 - Remove copy and pasted line.
 - Use C<> in description.
2012-07-25 08:55:20 +01:00
Richard W.M. Jones
f2ea617e22 build: Change calls to podwrapper.sh to use $(PODWRAPPER).
This will allow us to easily change the location of this
script in future.
2012-07-16 18:56:57 +01:00
Richard W.M. Jones
927ef14c58 run: Set MALLOC_PERTURB_ to a random value.
MALLOC_PERTURB_ is a glibc feature which causes malloc to wipe memory
before and after it is used, allowing both use-after-free and
uninitialized reads to be detected with relatively little performance
penalty:

  http://udrepper.livejournal.com/11429.html?nojs=1

Modify the ./run script so that it always sets this.

We were already using MALLOC_PERTURB_ in most tests.  Since ./run is
now setting this, we can remove it from individual Makefiles.  Most
TESTS_ENVIRONMENT will now simply look like this:

  TESTS_ENVIRONMENT = $(top_builddir)/run --test
2012-06-28 13:19:39 +01:00
Richard W.M. Jones
05d4e07918 tests: Add ./run --test option.
This option, when added via
  TESTS_ENVIRONMENT = [...] $(top_builddir)/run --test
allows us to run the tests and only print the full output (including
debugging etc) when the test fails.
2012-06-26 23:34:30 +01:00
Richard W.M. Jones
bc7f1a5ef1 build: Define abs_builddir if not defined already.
This is missing on RHEL 5.

This updates commit 50aa9533e4.
2012-06-18 21:45:13 +01:00
Richard W.M. Jones
50aa9533e4 build: Define builddir and abs_srcdir when they are missing.
RHEL 5-era autoconf did not define these, so define them manually
when they are missing.

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

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

Useful script:

  for f in $(find -name Makefile.am | xargs fgrep '$(abs_srcdir)' -l) ; do
    if ! grep -q '^abs_srcdir' $f; then
      echo missing in $f
    fi
  done
2012-06-18 15:32:47 +01:00