Commit Graph

9707 Commits

Author SHA1 Message Date
Richard W.M. Jones
2cc348448a generator: Share Common_utils code.
For a very long time we have maintained two sets of utility functions,
in mllib/common_utils.ml and generator/utils.ml.  This changes things
so that the same set of utility functions can be shared with both
directories.

It's not possible to use common_utils.ml directly in the generator
because it provides several functions that use modules outside the
OCaml stdlib.  Therefore we add some lightweight post-processing which
extracts the functions using only the stdlib:

  (*<stdlib>*)
  ...
  (*</stdlib>*)

and creates generator/common_utils.ml and generator/common_utils.mli
from that.  The effect is we only need to write utility functions
once.

As with other tools, we still have generator-specific utility
functions in generator/utils.ml.

Also in this change:

 - Use String.uppercase_ascii and String.lowercase_ascii in place
   of deprecated String.uppercase/String.lowercase.

 - Implement String.capitalize_ascii to replace deprecated
   String.capitalize.

 - Move isspace, isdigit, isxdigit functions to Char module.
2016-12-09 09:31:25 +00:00
Richard W.M. Jones
865d070ddc inspect: fstab: Canonicalize paths appearing in fstab.
For example, converts "///usr//local//" -> "/usr/local".
2016-12-07 14:54:24 +00:00
Richard W.M. Jones
222535fa12 v2v: Rename RHEV to RHV throughout.
You can now use -o rhv (-o rhev is supported for compatibility).
2016-12-07 14:12:28 +00:00
Richard W.M. Jones
bdaeeb4e60 v2v: -o vdsm: Add --vdsm-compat flag. -o rhev: Drop support for RHV < 4.1 (RHBZ#1400205).
Support for RHEV with RHEL 6 nodes required us to output the old style
qcow2 compat=0.10 images.  Since RHEV 3.6 GA, RHEL 6 has not been
supported as a RHEV node type.  Since RHV 4.1, compat=1.1 is
supported.  (Support for compat=1.1 is uncertain in RHV 4.0 even on
RHEL 7 nodes.)

There are significant downsides to using qcow2 compat=0.10 instead of
the modern default (compat=1.1).

Therefore this patch does two things:

For -o rhev, it drops support for compat=0.10 completely.  You must
use RHV 4.1.

For -o vdsm, it adds an interim flag (--vdsm-compat=0.10 or
--vdsm-compat=1.1) which controls the compat level of the qcow2 output
file.  VDSM should use --vdsm-compat=1.1 when it is known that modern
qemu is available.  We can make this the default later when all RHV
instances have moved to 4.1.

It also adds:

  vdsm-compat-option

to the `virt-v2v --machine-readable' output to indicate that this flag
can be used.

Thanks: Yaniv Kaul, Michal Skrivanek.
2016-12-07 14:12:28 +00:00
Pino Toscano
1d86b37689 inspect: gather info from /usr filesystems as well (RHBZ#1401474)
Flag the filesystems for Linux /usr properly as USR role, and detect
some data out of it, like the distro information from an os-release
(if present), and the architecture (since the binaries used for our
architecture check will be available there only).

Later on, collect the results in a way similar to what is done for
CoreOS: for each non-CoreOS root, try to find its /usr filesystem, and
if found then merge what is missing from root; in the last case, also
override the distro inspection data (version, product name) if available
in /usr.
2016-12-07 14:23:11 +01:00
Pino Toscano
dad35e55fa inspect: fix existance check of /dev/mapper devices
When checking for the existance of /dev/mapper devices found in the
fstab of a filesystem, using guestfs_exists means they are checked as
files in the guest, while they really appear as devices on the
appliance. Instead, try the lvm name resolution anyway, and ignore them
when they are reported as missing.

Thanks to: Richard W.M. Jones.

Fixes commit 96b6504b09.
2016-12-07 14:23:11 +01:00
Pino Toscano
e21b055f3e resize: shrink/expand swap partitions
Handle the swap partition on their own, rebuilding them using the
existing UUID and label.
2016-12-07 14:20:35 +01:00
Pino Toscano
aad24f4d56 daemon: allow to change the labels of swap partitions 2016-12-07 14:20:31 +01:00
Pino Toscano
a94d551345 libvirt: read secrets of disks (RHBZ#1392798)
Read also the secrets associated to disks (<secret> tag within <auth>),
so qemu can properly open them later on.
2016-12-07 13:48:47 +01:00
Pino Toscano
bef838202b libvirt: un-duplicate XPath code
Move the checks for empty xmlXPathObjectPtr, and for extracting the
result string out of it, to a new helper functions.

This is just code motion, there should be no behaviour changes.
2016-12-07 13:38:29 +01:00
Pino Toscano
e77e1ef95e inspect: mark CoreOS /usr partitions with own USR role
Add a new inspect role for "/usr" partitions, and use that to mark the
/usr partition in CoreOS: this additional role allows to ease its lookup
later on, when merging its results into those of the root.
2016-12-06 18:11:44 +01:00
Pino Toscano
0c4edcecba inspect: change is_root flag into enum
Introduce a new enum to classify the role of a filesystem, if available.
This will help later on when doing operations on non-root filesystems,
like detecting particular mountpoints such as /usr.

The new enum has only "root" as known role, which replaces the is_root
flag.
2016-12-06 18:11:44 +01:00
Pino Toscano
b01416121f appliance: mount also /dev/pts
Tools could require the use of pseudo-terminals, so make sure we have
/dev/pts available in the appliance.  The "command" API already
bind-mounts it when running commands, so this is the only bit needed.
2016-12-06 18:11:44 +01:00
Richard W.M. Jones
601e05508b builder: Refactor command line parsing in make-template script.
This refactors command line parsing into a parse_cmdline function.
The function uses the Arg module to parse the command line instead of
ad hoc parsing.

This also enforces use of the ./run script to run the program, since
otherwise you can end up with mixed versions of the OCaml bindings and
the C library.

This updates commit 65a0570385.
2016-12-02 17:04:05 +00:00
Pino Toscano
8462b1ea32 environment: fix error message for LIBGUESTFS_DEBUG failure
Properly mention LIBGUESTFS_DEBUG as environment variable when it
cannot be parsed as boolean.
2016-12-01 16:01:57 +01:00
Richard W.M. Jones
c2f5330447 v2v: Remove bogus backslash in test. 2016-12-01 12:48:57 +00:00
Cédric Bosdonnat
cd78fa4c88 packagelist: add initviocons package on SUSE
initviocons package provides tools to resize the terminal. Having it
in the appliance will allow SUSE users to have proper line wrapping
in their terminal when using virt-rescue.
2016-11-30 17:06:06 +00:00
Richard W.M. Jones
e4b73d67f2 builder: Update Fedora 25 and RHEL 7.3 ppc64 and ppc64le images.
Rebuild these images with the new make-template.ml script.  This fixes
the lack of virtio-scsi driver and broken initramfs.

These images all use LVM because without that both Fedora and RHEL put
the root filesystem on an extended partition (/dev/sda5) which
virt-resize cannot handle.

(Note the RHEL images are not public.)
2016-11-30 14:21:13 +00:00
Richard W.M. Jones
7a9f9b7cdc builder: ppc64: Enable virtio-scsi in templates.
Workaround for dracut bug RHBZ#1396217.
2016-11-30 14:21:13 +00:00
Richard W.M. Jones
65a0570385 builder: Rearrange how template-building scripts work.
Create a new directory (builder/template).  Integrate all of the
scripts into a single program, so that templates are generated more
consistently.

This also changes how the index file is generated.  The script now
generates the index file fragment and saves it under version control,
and then generates the final index file by concatenating these.
(Previously the index was written by hand which was tedious and
error-prone.)

The new script also saves the generated kickstart under version
control so it can be referenced later.
2016-11-30 14:20:20 +00:00
Richard W.M. Jones
06dc0e52eb Revert "builder: ppc64, ppc64le: Force add virtio-scsi driver."
It turns out that adding the virtio-scsi driver does not help
to fix the dracut problem.

This partially reverts commit f766c84c39,
keeping the change to index.
2016-11-24 18:46:26 +00:00
Richard W.M. Jones
f766c84c39 builder: ppc64, ppc64le: Force add virtio-scsi driver.
Works around dracut bug RHBZ#1396217.

Also update new Fedora ppc64 & ppc64le images.
2016-11-24 17:25:33 +00:00
Richard W.M. Jones
0cd54ff45b builder: Add Fedora 25 templates. 2016-11-24 10:35:45 +00:00
Richard W.M. Jones
bad1059bc4 fish: Fix small typos in virt-copy-in and virt-copy-out man pages (RHBZ#1398070).
Thanks: Xianghua Chen
2016-11-24 09:53:10 +00:00
Richard W.M. Jones
0ae56ad711 builder: fedora-armv7l: Increase RAM for installation.
In Fedora 25 the guest runs out of RAM when loading the
Anaconda initramfs.
2016-11-24 09:52:17 +00:00
Richard W.M. Jones
f45d9d3cd2 builder: fedora-ppc64le: Require POWER8 CPU.
This is the same as commit 4919f4f740
for Fedora.
2016-11-23 22:01:57 +00:00
Richard W.M. Jones
6c50cfd464 builder: fedora-aarch64: Add --arch flag.
This is the same thing as
commit 4a5605e7be, but for Fedora.
2016-11-23 21:57:02 +00:00
Richard W.M. Jones
4919f4f740 builder: ppc64le: Require POWER8 CPU.
RHEL 7.3 requires POWER8 instructions.
2016-11-17 14:51:10 +00:00
Richard W.M. Jones
4a5605e7be builder: aarch64: Add --arch flag.
This allows us to cross-build the image from x86_64 which is
more convenient than doing it on aarch64 host.
2016-11-17 14:51:10 +00:00
Richard W.M. Jones
c08788ef1b filearch: Add s390 and s390x detection and tests.
Unfortunately I was unable to build s390 binaries since multilib was
dropped in Fedora 24 on s390x.  Going from the source of the 'file'
command it seems as if it prints "32-bit" (the architecture is really
31 bit).
2016-11-13 18:32:21 +00:00
Richard W.M. Jones
6d805f3b33 docs: Fix man pages references to incorrect section numbers. 2016-11-13 18:32:21 +00:00
Richard W.M. Jones
fc73cdc014 Fix HACKING file in top level directory. 2016-11-13 18:28:38 +00:00
Richard W.M. Jones
cf0967542f installcheck: p2v: Make virt-p2v binary executable after uncompressing it.
Fixes commit 4152388530
and commit face52f62e.
2016-11-10 11:39:43 +00:00
Matteo Cafasso
5d36f5ae82 upload: improve file write callback
As noted by Pino in another patch, the logic passes the first member of
the struct which happens to be the right address to the callback
function.

This will break the callback if order of the members of the struct will
change.

As the callback is using the entire struct, better to pass the pointer
to the struct itself.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-11-09 21:09:24 +00:00
Richard W.M. Jones
4152388530 installcheck: p2v: Fix tests of virt-p2v.
Fixes commit face52f62e.
2016-11-09 17:54:52 +00:00
Pino Toscano
086be00aca v2v: add "colours-option" to machine readable sample output (RHBZ#1390876) 2016-11-02 11:00:39 +01:00
Pino Toscano
49dd176974 builder: distribute fedora-s390x.sh
Followup of commit c25a898710.
2016-11-02 11:00:39 +01:00
Richard W.M. Jones
0acdc83736 v2v: glance: Set hw_video_model property to qxl|cirrus (RHBZ#1374651).
Thanks: Vladik Romanovsky, Ming Xie.
2016-11-01 17:24:19 +00:00
Pino Toscano
1c51773b09 v2v: update again URL with glance metadata
Finally got the (hopefully stable) right URL for them.
2016-11-01 18:15:25 +01:00
Richard W.M. Jones
c25a898710 builder: Add script for starting Fedora/s390x.
However it does not currently work because of a bug in libvirt:

https://bugzilla.redhat.com/show_bug.cgi?id=1376547
2016-11-01 11:50:22 +00:00
Richard W.M. Jones
c7ce5e47fa handle: Improve error messaging if XDG_RUNTIME_DIR path does not exist.
If an environment variable such as XDG_RUNTIME_DIR or one of the
tmpdirs or cachedir is set to a non-existent directory, improve the
error message that the user will see so that (where possible) it
includes the environment variable or API call.

This is still not bullet-proof because it's hard to display the
environment variable if it is LIBGUESTFS_TMPDIR or
LIBGUESTFS_CACHEDIR, but the main problem is with XDG_RUNTIME_DIR
(because of systemd bugs).

Thanks: Hilko Bengen for identifying the bug.
2016-11-01 10:20:28 +00:00
Pino Toscano
a8b206234c docs: fix link to guestfs-golang(3) 2016-10-31 13:08:40 +01:00
Hilko Bengen
eecb1d8177 run.in: Quote contents of @VAR@ substitutions 2016-10-27 21:35:57 +02:00
Richard W.M. Jones
d411cd6127 Version 1.35.14. v1.35.14 2016-10-25 22:53:15 +01:00
Richard W.M. Jones
e73763de1f docs: Ignore ruby/ext/guestfs/extconf.h
Updates commit bd21993d77.
2016-10-25 22:30:30 +01:00
Richard W.M. Jones
67cc867da8 docs: Ignore php/extension/config.h.
Updates commit bd21993d77.
2016-10-25 21:59:19 +01:00
Richard W.M. Jones
7d85796466 Version 1.35.13. v1.35.13 2016-10-25 21:43:32 +01:00
Richard W.M. Jones
4f3269ac23 docs: Ignore java/com_redhat_et_libguestfs_GuestFS.h
Updates commit bd21993d77.
2016-10-25 21:37:37 +01:00
Richard W.M. Jones
d76d916501 Version 1.35.12. v1.35.12 2016-10-25 21:19:18 +01:00
Richard W.M. Jones
0875989384 docs: Ignore more generated headers.
Updates commit bd21993d77.
2016-10-25 21:12:56 +01:00