| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
The guestfs_ll command currently lists files in the appliance if you
prefix filenames with "/..". However this is a bug, not a feature,
and we should not be testing it.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is another case where downloads of small files could fail if the
library side (writer) fails. In this case the library would send back
a cancellation, but it would be received after the daemon had finished
sending the whole file (because the file is small enough). The daemon
would reenter the main loop and immediately get an unexpected cancel
message, causing the daemon to die.
This commit also makes test-cancellation-download-librarycancels.sh
more robust. We use Monte-Carlo testing with a range of file sizes.
Small file sizes should trigger the error case.
|
|
|
|
|
|
| |
This avoids conflicts with the globally installed libguestfs
appliance, or lets us build in multiple local directories at the same
time without conflicts.
|
|
|
|
| |
This updates commit 319e946b92e175c05cdd1fdcb85c9b86f5631011.
|
|
|
|
| |
Related to RHBZ#727178.
|
|
|
|
|
|
|
|
| |
If debugging or tracing is enabled, extra messages are sent to stderr
which mess with this test. Remove the extra messages before checking
stderr.
This updates commit 617e7f6bafa7de2303c08e1715004aae3141c389.
|
| |
|
| |
|
|
|
|
| |
List device mapper devices.
|
|
|
|
| |
Notes:
Labels: bugfix, RHBZ#690819
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the case where both ends cancel at the same time (eg. both ends
realize there are errors before or during the transfer), previously we
skipped sending back an error from the daemon, on the spurious basis
that the library would not need it (the library is cancelling because
of its own error).
However this is wrong: we should always send back an error message
from the daemon in order to preserve synchronization of the protocol.
A simple test case is:
$ guestfish -N fs -m /dev/sda1 upload nosuchfile /
libguestfs: error: open: nosuchfile: No such file or directory
libguestfs: error: unexpected procedure number (66/282)
(Notice two things: there are errors at both ends, and the
loss of synchronization).
After applying this commit, the loss of synchronization does not occur
and we just see the library error:
$ guestfish -N fs -m /dev/sda1 upload nosuchfile /
libguestfs: error: open: nosuchfile: No such file or directory
The choice of displaying the library or the daemon error is fairly
arbitrary in this case -- it would be valid to display either or even
to combine them into one error. Displaying the library error only
makes the code considerably simpler.
This commit also (re-)enables a test for this case.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As a previous, incorrect attempt to fix RHBZ#576879 we tried to
prevent the daemon from sending an error reply if the daemon had
cancelled the transfer. This is wrong: the daemon should send an
error reply in these cases.
A simple test case is this:
guestfish -N fs -m /dev/sda1 upload big-file /
(This fails because the target "/" is a directory, not a file.)
Prior to this commit, libguestfs would hang instead of printing an
error. With this commit, libguestfs prints an error.
What is happening is:
(1) Library is uploading
a file (2) In the middle of the long
upload, daemon detects an error.
Daemon cancels.
(3) Library detects cancel,
sends cancel chunk, then waits
for the error reply from the
daemon. (4) Daemon is supposed to send
an error reply message.
Because step (4) wasn't happening, uploads that failed like this would
hang in the library (waiting for the error message, while the daemon
was waiting for the next request).
This also adds a regression test.
This temporarily breaks the "both ends cancel" case (RHBZ#576879c5).
Therefore the test for that is disabled, and this is fixed in the next
patch in the series.
This partially reverts commit dc706a639eec16084c0618baf7bfde00c6565f63.
|
| |
|
|
|
|
| |
This updates commit cbd8da6d4dd2e4cbc3b87fbc7cb7d6129eb69172.
|
|
|
|
|
|
|
| |
We suspect that there are in fact two separate bugs. In any
case it makes sense for the two tests to be done separately.
Note that these tests still fail.
|
| |
|
|
|
|
| |
This fixes commit 1d999540bddd7aea7c2d0fef8b15223d4acc645f.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix guestfish (and other C tools) so that they ignore errors
when /etc/fstab contains bogus entries.
Update the documentation for inspect-get-mountpoints to emphasize
that callers must be aware of this when mounting the returned
values.
Add a regression test.
Update the example code ("inspect_vm") to reflect the way this
API ought to be called.
For more detail see:
https://bugzilla.redhat.com/show_bug.cgi?id=668574
|
|
|
|
| |
This also adds a regression test.
|
|
|
|
| |
This is necessary because of too old cryptsetup on Ubuntu.
|
|
|
|
|
| |
This test has worked only intermittently for a while. Disable
it. The upstream bug has been reopened.
|
| |
|
|
|
|
|
|
|
|
| |
We were generating this dummy 'Fedora' image already in the
tools directory. It contains just enough Fedora-like files
to fool our inspection code and thus to test the tools.
This is general enough that we can use it everywhere.
|
|
|
|
|
|
| |
This also makes libxml2 and libvirt into optional dependencies.
If they are missing then the core API will print an error, as
will the '-d' option to guestfish.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This new API allows you to add the disks from a libvirt
domain.
In guestfish you can use the 'domain' command to access the
API, eg:
><fs> domain Fedora14 libvirturi:qemu:///system
1
The returned number is the number of disks that were added.
Also here is a proposed (but commented out) low-level API
which would allow you to add a domain from a virDomainPtr.
However there are several problems with this API -- see discussion
on the list:
https://www.redhat.com/archives/libguestfs/2010-November/thread.html#00028
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Cached appliances are discovered by their predictable path. Previously we were
creating a cached appliance directly in this predictable path. This had at least
2 undesirable effects:
* Interrupting appliance creation would leave a corrupt appliance
* 2 processes could simultaneously attempt to create the same appliance, causing
corruption.
This patch causes the cached appliance to be created in a temporary directory,
and then renamed to the predictable path. As rename is an atomic operation, this
makes the whole creation atomic.
This patch also changes the predictable path to have a prefix of 'guestfs.'.
This will make it simpler for system administrators to clean up old cached
appliances.
This patch resolves RHBZ#639405
|
|
|
|
| |
This test has started to hang, for reasons we don't understand.
|
|
|
|
|
|
|
|
| |
For libvirt guests, the disk format is copied from libvirt (if
libvirt knows it).
For command line disk images, you can use --format to override
format auto-detection.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This large commit changes the generator so that optional arguments
can be supported for functions.
The model for arguments (known as the "style") is changed from
(ret, args) to (ret, args, optargs) where optargs is a more limited
list of arguments.
One function has been added which takes optional arguments, it is
"add-drive-opts", modelled as:
(RErr, [String "filename"], #required
[Bool "readonly"; String "format"; String "iface"]) #optional
Note that this function is processed in the library (does not go over
the RPC protocol to the daemon). This has allowed us to simplify
the current implementation by omitting changes related to RPC or the
daemon, although we plan to add these at some point in the future.
From C this function can be called in 3 different ways as in these
examples:
guestfs_add_drive_opts (g, filename,
GUESTFS_ADD_DRIVE_OPTS_READONLY, 1,
GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
-1);
(the argument(s) between 'filename' and '-1' are the optional ones).
guestfs_add_drive_opts_va (g, filename, args);
where 'args' is a va_list. This works like the first version.
struct guestfs_add_drive_opts_argv optargs = {
.bitmask = GUESTFS_ADD_DRIVE_OPTS_READONLY_BITMASK,
.readonly = 1,
}
guestfs_add_drive_opts_argv (g, filename, &optargs);
This last form lets you construct lists of optional arguments, and
is used by guestfish and the language bindings.
In guestfish optional arguments are used like this:
add-drive-opts filename readonly:true
In OCaml these are mapped naturally to OCaml optional arguments, eg:
g#add_drive_opts ~readonly:true filename;
In Perl these are mapped to extra arguments, eg:
$g->add_drive_opts ($filename, readonly => 1);
In Python these are mapped to optional arguments, eg:
g.add_drive_opts ("file", readonly = 1, format = "qcow2")
In Ruby these are mapped to a final hash argument, eg:
g.add_drive_opts("file", {})
g.add_drive_opts("file", :readonly => 1)
g.add_drive_opts("file", :readonly => 1, :iface => "virtio")
In PHP these are mapped to extra parameters. This is not quite
accurate since you cannot omit arbitrary optional parameters, but
there's not much than can be done within the limitations of PHP
as a language.
Unimplemented in: Haskell, C#, Java.
|
| |
|
|
|
|
|
|
| |
Instead of testing the installed /usr/bin/guestfish.
This fixes commit ddda0f7bd00a37274dae38f4ce93955b8cfdf7d7.
|
|
|
|
|
| |
Since these options were both broken in released version 1.5.17,
best to have a regression test to catch this in future.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some tests in the regressions directory deliberately print
error messages. As long as they still PASS, this is OK.
However these tests also printed some misleading messages
about what error to expect. Since error messages were slightly
different across distros, these messages were not accurate.
Therefore remove these messages, and replace with a general
message before all tests telling users not to worry about
errors from the tests as long as the tests don't fail.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit adds four APIs for creating new LUKS devices
and key management. These are:
luks_format Format a LUKS device with the default cipher.
luks_format_cipher Format with a chosen cipher.
luks_add_key Add another key to an existing device.
luks_kill_slot Delete a key from an existing device.
This enables all the significant functionality of the
cryptsetup luks* commands.
Note that you can obtain the UUID of a LUKS device already
by using vfs-uuid.
This also includes a regression test covering all the LUKS
functions.
|
|
|
|
|
|
|
| |
These APIs allow you to change the device filter, the list of
block devices that LVM "sees". Either you can set it to a fixed
list of devices / partitions, or you can clear it so that LVM sees
everything.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This small change uses the gnulib xstrtoll functionality to
enable suffixes on integer parameters in guestfish. For example:
truncate-size /file 1G
(previously you would have had to given the full number).
This also applies to the 'alloc' and 'sparse' commands (and
indirectly to the -N option). The specification for these commands
has changed slightly, in that 'alloc foo 1MB' would now use SI
units, allocating 1000000 bytes instead of a true megabyte. All
existing uses would use 'alloc foo 1M' which still allocates true
megabytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds additional tests to check that several types of parameter
including String are not NULL when passed to the C functions.
Previously this would cause a segfault inside libguestfs. With
this change, you get an error message / exception.
Of the possible pointer parameters, only OptString is now permitted
to be NULL.
This change does not affect the Perl bindings. This is because Perl
XS code was already adding similar checks if you passed undef into
a parameter expecting a string.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
During a FileIn command (eg. upload, tar-in) if both sides
experience errors, then both sides could send cancel messages,
the result being lost synchronization.
The reason for the lost synch was because the daemon was ignoring
this case and sending an error message back which the library side
(which had cancelled) was not expecting.
Fix this by checking in the daemon for the case where the library
also cancels during daemon cancellation, and not sending an error
messages.
This also includes an enhanced regression test which checks for this
case.
This extends the original fix in
commit 5922d7084d6b43f0a1a15b664c7082dfeaf584d0.
More details can be found here:
https://bugzilla.redhat.com/show_bug.cgi?id=576879#c5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously you might have typed:
$ guestfish
><fs> alloc test1.img 100M
><fs> run
><fs> part-disk /dev/sda mbr
><fs> mkfs ext4 /dev/sda1
now you can do the same with:
$ guestfish -N fs:ext4
Some tests have also been updated to use this new
functionality.
|
|
|
|
|
|
|
| |
'dd' is a very inefficient way to create files. 'truncate' is
better, but unfortunately that command is not available in RHEL 5.
So use the guestfish 'sparse' command instead (which also avoids
allocating disk space).
|
|
|
|
|
|
|
|
|
|
|
|
| |
Modify the generator so that it can correctly handle early
cancellation for Pathname|Device|.. parameters. This fixes
the upload command, but consequently we need to fix the
parameters for tar_in and t?z_in commands. This should also
mean that 'win:' can now be used as the second argument of
tar_in and t?z_in commands in guestfish, whereas previously
this wouldn't have worked.
Adds a regression test for the original problem.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow -cmd on the command line to mean that normal exit on error
behaviour is overridden, ie. we will not exit.
This allows you to do:
guestfish -- command : -command : command
with the second command allowing errors. (Note that '--' is required
to stop getopt parsing -command as an option).
Also this fixes the remote case which is what the original
bug report was about.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This includes various code cleanups:
(a) A regression test for RHBZ#580246.
(b) Use write instead of fwrite to write out the tar file. This is
just because the error handling of write seems to be better
specified and easier to use.
(c) Use size_t instead of int for length.
(d) Clearer debug messages when in verbose mode.
|
|
|
|
|
|
|
|
|
| |
These calls allow you to query the relationship between
LVM objects, for example, which PVs contain a VG, or which
LVs are contained in a VG.
See the example / test program 'regressions/test-lvm-mapping.pl'
for an example of how to do this from Perl.
|
|
|
|
|
|
| |
Change guestfish so it uses xstrtoll to parse Int (31 bit)
parameters. This fixes two bugs on 32 bit platforms which
failed when long = 32 bits. long long = 64 bits on both.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
guestfs_mount adds -o sync implicitly. This causes a very large
performance problem for write-intensive programs (eg. virt-v2v).
Document this as a "gotcha".
Change the tests, guestfish, Sys::Guestfs::Lib, guestmount to use
mount-options instead.
(Note that this gotcha does not affect mount-ro).
The source of the performance problem was first identified by
Matthew Booth.
|
| |
|