Commit Graph

16 Commits

Author SHA1 Message Date
Richard W.M. Jones
cd304ad838 common/mltools: Rename Common_utils to Tools_utils.
Reflecting the purpose of this module now, which is to act as a place
for utility functions shared only by the OCaml virt tools.
2017-09-28 14:39:23 +01:00
Richard W.M. Jones
a1e47c4b47 tools: Reduce use of _ (wildcard) in match statements.
No functional change, just various improvements to the safety of match
statements.
2016-04-21 12:50:58 +01:00
Pino Toscano
14b8e67f0b sysprep, get-kernel: explicit the Guestfs parameter
Help the OCaml compiler by expliciting Guestfs.guestfs as type for 'g'
in some functions.
2016-02-04 10:22:18 +01:00
Richard W.M. Jones
59228c39b1 ocaml tools: Use global variable to store quiet (--quiet) flag.
Don't pass this flag to dozens of functions.

This change is analogous to the change made in
commit 79fc6074a7 for the -v & -x flags.
2015-05-15 19:08:36 +01:00
Richard W.M. Jones
79fc6074a7 ocaml tools: Use global variables to store trace (-x) and verbose (-v) flags.
Don't pass these flags to dozens of functions.
2015-05-15 15:18:19 +01:00
Richard W.M. Jones
d3e93e1011 inspection: Recognise 'dnf' as the package manager in Fedora 22.
Also fix virt-sysprep and virt-customize so they can work with dnf.

I also sorted some of the lists alphabetically.
2014-12-15 14:41:29 +00:00
Richard W.M. Jones
b6b9b90dd7 Use -v and -x flags consistently across OCaml virt-* tools.
virt-customize:
virt-sparsify:
virt-sysprep:
virt-v2v:
  - These tools consistently used -v to mean verbose/debugging
    and -x to mean enable libguestfs tracing.

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

Unfortunately this has a cascade of effects through the code.
2014-06-24 16:54:32 +01:00
Richard W.M. Jones
8e386fc1be sysprep: Pass debug and quiet flags to all modules.
Also use the Common_utils.make_message_function function to print
messages (same as virt-builder).
2014-03-25 12:41:04 +00:00
Richard W.M. Jones
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
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
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
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
Olaf Hering
d6c11b0a3d sysprep: add zypper to package-manager-cache operation
libzypp and zypper store their cache files in
/var/cache/zypp/{packages,raw,solv}/ and /var/cache/zypper/RPMS/
Add a single pattern to match both cases.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2012-09-19 21:05:29 +01:00
Richard W.M. Jones
2b59b5f1d2 sysprep: Change perform callback to perform_on_filesystems and perform_on_devices.
Operations that need to work directly on guest block devices will fail
because the block devices are busy.  Therefore add a phase with the
filesystems unmounted, and allow operations to specify that they need
to work in this phase.
2012-07-25 14:47:15 +01:00
Richard W.M. Jones
027fefd517 Add gettext support for OCaml tools (virt-resize, virt-sparsify, virt-sysprep).
Note that this support is optional: To enable it, install the
ocaml-gettext library from
http://forge.ocamlcore.org/projects/ocaml-gettext .  If this library
is not installed, then configure detects this and inserts dummy
gettext functions that do nothing.
2012-05-01 09:39:35 +01:00
Wanlong Gao
7fc7c3aa5b sysprep: remove the cache of package manager
Remove the cache of package manager like yum and apt.

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

RWMJ:
- Small code cleanup.
2012-04-24 08:32:08 +01:00