The new module ‘Std_utils’ contains only functions which are pure
OCaml and depend only on the OCaml stdlib. Therefore these functions
may be used by the generator.
The new module is moved to ‘common/mlstdutils’.
This also removes the "<stdlib>" hack, and the code which copied the
library around.
Also ‘Guestfs_config’, ‘Libdir’ and ‘StringMap’ modules are moved
since these are essentially the same.
The bulk of this change is just updating files which use
‘open Common_utils’ to add ‘open Std_utils’ where necessary.
The ‘Xml’ module is a self-contained library of bindings for libxml2,
with no other dependencies.
Move it to a separate ‘common/mlxml’ directory.
This is not pure refactoring. For unclear reasons, the previous
version of ‘Xml.parse_file’ read the whole file into memory and then
called ‘xmlReadMemory’. This was quite inefficient, and unnecessary
because we could use ‘xmlReadFile’ to read and parse the file
efficiently. Changing the code to use ‘xmlReadFile’ also removes the
unnecessary dependency on ‘Common_utils.read_whole_file’.
The ‘Progress’ module is a self-contained library with the only
dependencies being:
- the C ‘progress’ implementation
Move it to a separate ‘common/mlprogress’ directory.
This change is pure code refactoring.
The ‘Visit’ module is a self-contained library with the only
dependencies being:
- the C ‘visit’ implementation
- the guestfs OCaml bindings
Move it to a separate ‘common/mlvisit’ directory.
This change is not entirely refactoring. Two other fixes are made:
- remove unsafe use of CLEANUP_FREE from a function which could
raise an OCaml exception (cleanup handlers would not be called
correctly if the exception is thrown)
- don't link directly to common/visit/visit.c, but instead use
the library (common/visit/libvisit.la)
When installing guests that need NVRAM variables, the cleanup of the
guest with `virsh undefine` will remove that file too, which is not what
we want. Instead, compress the NVRAM file right before the cleanup,
to ensure we have it.
Also, fix the filename for it, removing the double "-nvram" suffixes.
- set the mirror to deb.debian.org, which is the official redirector, so
generated images will use the closest mirror depending on their
location
- automake the task selection, using the choice we want
- do a full upgrade of the distro, so the template is already up-to-date
- install grub on the default device, which should also be the only one
in the automated installation
We were dropping the add_drive copyonread flag when using the libvirt
backend. This resulted in significant performance degradation (2x-3x
slower) when running virt-v2v against VMware servers.
Thanks: Kun Wei.
Currently -i libvirtxml mode only works for local files or NBD disks.
The purpose of NBD is to support virt-p2v.
This change adds support for network disks over http or https, ie:
<disk type='network' device='disk'>
<driver name='qemu' type='raw'/>
<source protocol="http" name="/scratch/disk.img">
<host name="server.example.com" port="80"/>
</source>
<target dev='hda' bus='ide'/>
</disk>
This is just for testing. It's especially useful for exercising curl
support in qemu without requiring VMware to be available.
This feature allows you to use different image formats for the fixed
appliance. The raw format is used by default.
Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
Caused the following error when running make-template:
syntax error at line 22: syntax error
virt-index-validate: ‘debian-9.index-fragment’ could not be validated, see errors above
Add a RELEASES file which contains the release date for each version
of libguestfs. When a new version is released, the configure script
checks that the date has not been omitted from the file.
This also fixes the release date for version 1.37.16 which I omitted
from commit 9455f21237.
New gnulib uses ‘-Wimplicit-fallthrough=5’ which warns (and hence
errors) on every switch statement with an implicit fallthrough.
We could use the new GCC attribute here:
#ifndef FALLTHROUGH
# if __GNUC__ < 7
# define FALLTHROUGH ((void) 0)
# else
# define FALLTHROUGH __attribute__ ((__fallthrough__))
# endif
#endif
but instead this changes the level to 4 which allows us to use
/*FALLTHROUGH*/ comments (which we are already using) to mark cases
where we expect fallthrough.
Gnulib installs two files: ‘GNUmakefile’ and ‘maint.mk’. The first
one runs the second one, and the second one sets LC_ALL=C universally.
However this breaks the ‘bugzilla’ script (or Python) because some
bugs contain non-ASCII characters in their Summary. The script prints
this error:
Traceback (most recent call last):
File "/usr/bin/bugzilla", line 1117, in <module>
main()
File "/usr/bin/bugzilla", line 1112, in main
_format_output(bz, opt, buglist)
File "/usr/bin/bugzilla", line 702, in _format_output
print(format_field_re.sub(bug_field, opt.outputformat))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 108-109: ordinal not in range(128)
The simplest fix for this is to unset LC_ALL before running the
external script, so that the normal locale settings are used.
The OCaml function ‘input_line’ throws an End_of_file exception if the
end of the file is read before any other input, ie. if the file here
is zero length. Return an empty string instead.
This can produce peculiar errors such as:
$ virt-customize ... --root-password file:/dev/null
libguestfs: uncaught OCaml exception in getopt callback: End_of_file
Remove (before opening round bracket) whitespaces in the documentation
of the Python binding, according to the PEP 8 specification.
This is just code reformatting, with no behaviour changes; no content
changed beside whitespaces, so "git diff -w" gives an empty diff.
Mostly modelled after a snippet implemented in dib, it is an helper
function to run multiple commands in parallel, waiting for all of them
at once, and returning all their exit codes. It is possible to pass
custom descriptors for collecting stdout and stderr of each command.
Common_utils.run_command is adapted to use few helper methods used by
run_commands, so all the existing code using it keeps working; in
addition, it gets labelled parameters for stdout and stderr FDs.
Add a simple unit tests for them.
LVM2 >= 2.02.171 requires the ‘--yes’ option to force pvresize to work
in various circumstances, eg. reducing the size of an existing PV.
Pass this flag unconditionally.
Note this does NOT break earlier versions which just ignore this flag.
If SIGTERM is blocked in the main program, then it ends up still being
blocked in the subprocess after we fork. This means that we cannot
kill qemu by sending SIGTERM to it. This commit fixes the problem by
unblocking SIGTERM unconditionally after fork.
Thanks: wtfuzz on IRC for reporting and analysis.
If you use the libguestfs tools which open disk images read-only
(eg. virt-df), with formats such as 'vdi', then you will see an error:
error: invalid value for backingformat parameter 'vdi'
This is because opening a disk image read-only will try to create a
qcow2 file with the original image as a backing file. However the
list of permitted backing formats was very restrictive and did not
include 'vdi' (nor many other uncommon formats).
Instead of using a whitelist for backing formats, just validate that
the string is alphanumeric and short.
Thanks: Mike Goodwin for reporting the bug.
Complementary fix of commit 2d25872df3.
On SLES 11 SP4 with kdump enabled mkinitrd calls mkdumprd which calls
mkinitrd, but mkdumprd doesn't have any clue of the root device.
Call mkinitrd with rootdev environment variable to tell them all
what device to use as root.
Tested-By: Cédric Bosdonnat <cbosdonnat@suse.com>
These were already included in the .ml implementation file, but just
weren't being exported in the interface, so there's no real change
here. It just allows these functions to be used.
Make use of the additional command line arguments, and API needed to
decrypt LUKS partitions. This extends to v2v the work done in other
OCaml tools with commit 6b26a0cce4,
since it seems to be working fine after a basic testing.
Related to: RHBZ#1362649