Add common error/warning/info functions.
Examine every existing call to printf/eprintf and change where
necessary so that:
- error is used instead of eprintf + exit 1
- warning no longer needs ~prog argument (it is added by Utils module)
- any verbose output should go to stdout, not stderr
- info is used to print general informational messages
Also, don't indent summary of changes.
Add a Customize_utils module. This contains common error/warning/info
functions, and also quote = Filename.quote.
Examine every existing call to printf/eprintf and change where
necessary so that:
- error is used instead of eprintf + exit 1
- warning no longer needs ~prog argument (it is added by Utils module)
- any verbose output should go to stdout, not stderr
- info is used to print general informational messages
Also, don't pass ~prog parameter around. Instead we just get it from
the executable name.
Add a Utils module. This contains common error/warning/info functions,
and also quote = Filename.quote.
Examine every existing call to printf/eprintf and change where
necessary so that:
- error is used instead of eprintf + exit 1
- warning no longer needs ~prog argument (it is added by Utils module)
- any verbose output should go to stdout, not stderr
- info is used to print general informational messages
get_current_dir_name exists on GNU libc only, so not portable.
On the other hand, while POSIX leaves a null buffer argument for getcwd
as unspecified behaviour, basically the most used/important Unix
implementations (GNU libc, FreeBSD's libc, etc) allow such value,
returning a new allocated buffer with the current directory.
In any case, the change just affects two tests, so even if it hits a
libc not implementing this behaviour for getcwd, only tests are
affected.
uri-c.c and perl_edit-c.c end up (directly or indirectly) including
guestfs-internal-frontend.h, which in turns includes libvirt/libvirt.h;
hence, make sure to use the libvirt CFLAGS.
Add a IfNotCrossAppliance prereq for tests, so a test using it can only
be run when the appliance is a copy of the running host system; this can
help marking tests which run stuff (usually built in the host) inside
the appliance.
Since the signature of iconv() changes between implementations (the
constness of the second parameter, in particular), make use of the iconv
module of gnulib to handle these potential differences, including an
external (out of libc) iconv implementation.
Previously I modified the parse_libvirt_xml function to get rid of the
awkward 'map_source*' functions, and have the callers map over and
modify the source disks afterwards. However this broke the case where
an "nbd:..." URL was returned by parse_libvirt_xml, since the callers
might try to map this URL (eg. turning it into an absolute path).
This broke virt-p2v specifically.
This commit changes parse_libvirt_xml to return a list of tuples
containing disk information, giving the callers more information with
which to do the mapping.
This fixes commit 3596165282.
Take the opportunity presented by the refactoring in the previous
commit to inline and simplify functions in these input subclasses.
This finally removes the map_source* functions.
This refactors the code into more logical units, based on the previous
commits. So Xen + the input_libvirt Xen code is grouped and moved
into a new module called Input_libvirt_xen_ssh. Similarly VCenter +
input_libvirt vCenter code is moved to Input_libvirt_vcenter_https.
There is no change here, purely code motion.
Previously we fixed RHBZ#1151033 by increasing the cURL readahead
parameter to a large value. Unfortunately this is too large -- and
hence slow -- for the conversion phase, which broke on slow vCenter
servers (RHBZ#1153589).
What we do now is to perform the conversion phase with the default
readahead (2MB) to ensure stability, since performance of the
conversion phase is not critical. Then before copying we change the
readahead to the larger value (64MB) to ensure efficient copying.
This is called before the copying phase to allow the input method to
adjust overlay/backing parameters.
The default implementation does nothing, so this commit has no effect.
Note that it doesn't matter what the number is, as long as it's
different for each disk.
The unique number lets us store extra data in input objects which is
associated with each disk.
Get rid of the awkward map_source* functions, and replace it with
equivalent code which modifies the source disks objects coming back
from Input_libvirtxml.parse_libvirt_xml.
This is just code refactoring. Apart from the order in which certain
tests are done, this should be equivalent to the previous code.
Previously we had one class ('input_libvirt') which handled all three
cases. Now we have one superclass ('input_libvirt') and three
subclasses of that ('input_libvirt_vcenter_https',
'input_libvirt_xen_ssh', 'input_libvirt_other') which handle the three
cases separately.
This is just code motion, and should be functionally equivalent to
what was here before.
Unfortunately udev removed the udevtimeout setting on the kernel
command line. This means the default timeout was being set back to 30
seconds, which is way too low for remote disks.
However it was re-added (2014-07-29) as udev.event-timeout. Set both
to be sure.
Note this requires systemd >= 216.
In full_path, skip the trailing slash in the base directory when
different than "/", as the slash will eventually be added when building
the resulting path.
Make sure to output the field for checksum even for non-regular files,
as empty, in CSV output mode. This ensures each line has the same number
of fields, regardless of the file type.