Compare commits

...

2242 Commits

Author SHA1 Message Date
Richard W.M. Jones
d5c0f85c6e Version 1.33.10. 2016-02-08 17:52:29 +00:00
Pino Toscano
fcf1884932 tests: reduce sizes of scratch disks to 2 GB
1 GB should be enough to create a btrfs filesystem, even with 64K page
size; hence, make the /dev/sda and /dev/sdb test devices smaller so
there is less space taken during the test run.

Followup of commit 8ffad75e5b and
commit 9e9b648770.
2016-02-08 17:22:48 +00:00
Richard W.M. Jones
7453952d24 launch: Set sockdir mode to 0755.
https://bugzilla.redhat.com/show_bug.cgi?id=610880

Fixes commit 55202a4d49.
2016-02-08 17:20:30 +00:00
Richard W.M. Jones
7fd17fa99d launch: libvirt: Debug sockdir not tmpdir.
Fixes commit 55202a4d49.
2016-02-08 17:09:48 +00:00
Dawid Zamirski
7cb28488a6 inspect: get windows drive letters for GPT disks.
This patch updates the guestfs_inspect_get_drive_mappings API call to
also return drive letters for GPT paritions. Previously this worked
only for MBR partitions. This is achieved by matching the GPT partition
GUID with the info stored in the blob from
HKLM\SYSTEM\MountedDevices\DosDevices keys. For GPT partions this blob
contains a "DMIO:ID:" prefix followed by a 16 byte binary GUID.
2016-02-06 17:09:18 +00:00
Richard W.M. Jones
985a693251 Version 1.33.9. 2016-02-05 19:11:47 +00:00
Richard W.M. Jones
8cba70c038 lib: Stop exporting the safe_malloc, etc. functions.
As was forewarned in the comment, stop exporting these functions
outside the library.
2016-02-05 14:17:48 +00:00
Richard W.M. Jones
32cd056ff8 ruby: Stop using the safe_malloc, etc. functions. 2016-02-05 14:17:48 +00:00
Richard W.M. Jones
4b96331ad5 perl: Stop using the safe_malloc, etc. functions. 2016-02-05 14:17:48 +00:00
Richard W.M. Jones
2a48a6591f java: Stop using the safe_malloc, etc. functions. 2016-02-05 13:16:22 +00:00
Richard W.M. Jones
ae750fcfe0 python: Stop using the safe_malloc, etc. functions. 2016-02-05 13:15:59 +00:00
Richard W.M. Jones
0445284dfb ocaml: Stop using the safe_malloc, etc. functions. 2016-02-05 13:15:48 +00:00
Richard W.M. Jones
0b10465772 java: Fix documentation of @throws.
The javadoc @throws directive requires a string documenting
when the exception is thrown.
2016-02-05 13:05:30 +00:00
Richard W.M. Jones
7ac9127bf4 v2v: Move the other OVMF paths into the core library.
Refactoring change, continuing the theme from the previous commit.
2016-02-05 09:22:28 +00:00
Richard W.M. Jones
4ac6ff6b47 aarch64: Use a common table of AAVMF paths.
Previously the code had two places where an identical set of AAVMF
paths were stored.  Put this information into one place.

This is just refactoring.
2016-02-04 18:36:19 +00:00
Pino Toscano
13c3698358 customize: add globbing for --delete
Support globbing in paths passed to --delete, telling glob to not
return directories with leading slash.

This re-adds back globbing for --delete in virt-sysprep, which was
available before the integration with common code from virt-customize.
2016-02-04 11:26:20 +01:00
Pino Toscano
01f46e4e31 daemon: glob: add optarg to control trailing slash for dirs
Add a new optional bool "directoryslash" to indicate whether the caller
wants trailing slashes in names of directories, defaulting to true (the
current behaviour); this helps with interoperability with other tools
(such as rm).

Related to RHBZ#1293271.
2016-02-04 11:25:56 +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
fe7fceba6e v2v: Replace "=" by "_" in OVF .meta DESCRIPTION field.
The current VDSM .meta file parser is incorrect:

  https://code.engineering.redhat.com/gerrit/gitweb?p=vdsm.git;a=blob;f=vdsm/storage/fileVolume.py;h=20573bd2a3fe6909a8474bd7c53c8d0fea79091c;hb=c1289fd70edcde0a0b3bc8e37ecad1e2a5babe1a#l285

When parsing the key=value fields in the .meta file, it uses the
Python expression:

  key, value = l.split("=")

which throws an exception "ValueError: too many values to unpack" if
the value part also contains an "=" character (because split returns
an n-tuple with n > 2).  The correct way to split the string in this
situation is to use l.split("=", 1).

In commit 399e031c25 I changed the
DESCRIPTION field in .meta so that in RHEL it would look like this:

  DESCRIPTION=generated by libguestfs 1.32.2rhel=7,release=1.el7,libvirt

thus containing an "=" character in the value and throwing an
exception in VDSM.

Although this is a bug in VDSM which needs to be fixed separately,
change any occurrence of "=" in the value to "_" to avoid this
problem.

Thanks: Derrick Ornelas for helping to diagnose this bug and finding
the offending code in VDSM.
2016-02-03 21:35:48 +00:00
Richard W.M. Jones
9e9b648770 tests: btrfs: Use a 2000 MB partition for btrfs test (instead of 200 MB).
One of the mkfs-btrfs tests used two 200 MB partitions.  That isn't
enough to create a btrfs filesystem on aarch64 (with 64K page size).
Since we now have a 10 GB disk, we can make the test partition 10
times larger.
2016-02-03 17:26:34 +00:00
Richard W.M. Jones
5238c4ee0a tests: btrfs: Don't test --leafsize, and use --nodesize 64K.
In btrfs-progs 4.4, the --leafsize parameter is deprecated.  It's now
just an alias for --nodesize.

On aarch64, --nodesize 4096 does not work because it's smaller than
the page size (64K).  Luckily we can test a 64K nodesize on any
platform, so use that instead.
2016-02-03 17:26:34 +00:00
Richard W.M. Jones
8ffad75e5b tests: Increase the size of the /dev/sda and /dev/sdb test devices.
Previously these were rather small - just 500 MB.  This is too small
to create a btrfs device on aarch64 (where page size may be 64K), and
barely enough even on x86-64.  This change makes both these devices
10 GB, and adjusts a few tests so they continue to pass.
2016-02-03 17:26:34 +00:00
Richard W.M. Jones
c055f842d7 Version 1.33.8. 2016-02-03 14:02:26 +00:00
Richard W.M. Jones
f88e931866 resize: Use sparse copy for extended partitions unless --no-sparse.
Thanks: Maxim Perevedentsev
2016-02-03 13:32:35 +00:00
Pino Toscano
d3502bdc32 generator: simplify generated code for always-available features
Just refer to the dummy function directly, instead of using #define's.
2016-02-03 13:24:37 +01:00
Pino Toscano
55202a4d49 New API: get-sockdir
Introduce a new read-only API to get a path where to store temporary
sockets: this is different from tmpdir, as we need short paths for
sockets (due to sockaddr_un::sun_path), and it is either
XDG_RUNTIME_DIR if set, or /tmp; adapt guestfs_int_create_socketname
to create sockets in that location.

Furthermore, print sockdir and XDG_RUNTIME_DIR in test-tool for
debugging.
2016-02-03 13:15:29 +01:00
Pino Toscano
4f7251f896 launch: add internal helper for socket paths creation
Introduce an internal helper to create paths for sockets -- will be
useful for changing later the logic for placing sockets.
Futhermore, check that the length of sockets won't overflow the buffer
for their filenames.
2016-02-03 12:51:26 +01:00
Pino Toscano
673a7a959c lib: extract lazy tmpdir creation helper
Extract the bit of code for lazy creation of a temporary directory, so
it can be used for more directories as well.

This is just code motion, with no behaviour changes.
2016-02-03 11:07:34 +01:00
Pino Toscano
dbad317120 launch: libvirt: cleanup sockets on shutdown
Unlink the sockets in the shutdown callback, instead of right before
creating a new ones.  This makes sure we are unlinking the right
sockets.
2016-02-01 10:52:15 +01:00
Pino Toscano
e31e3ccd8f launch: libvirt: move socket path variables
Move the paths of the sockets used, from the libvirt_xml_params struct
to backend_libvirt_data; this way, they will be usable also outside the
launch callback.

Simply code motion.
2016-02-01 10:52:14 +01:00
Pino Toscano
cfedf73b3d launch: direct: cleanup daemon socket on shutdown
Unlink the daemon socket in the shutdown callback, instead of right
before creating a new one.  This makes sure we are unlinking the right
socket.
2016-02-01 10:52:14 +01:00
Pino Toscano
0f6a3b13a5 launch: direct: save the path of the daemon socket
Save the path of the socket passed to qemu for communication with
guestfsd; we will need it to clean it correctly.
2016-02-01 10:52:13 +01:00
Pino Toscano
79b2f19fe7 launch: unix: check for length of sockets
Error out early if the path to the socket will not fit into
sockaddr_un::sun_path, as we will not be able to connect to it.
2016-02-01 10:52:12 +01:00
Richard W.M. Jones
e8ce35b007 FAQ: Add answer about unsupported use of NTFS in RHEL 7.2. 2016-01-31 16:00:00 +00:00
Richard W.M. Jones
19f3689e5d v2v: Split with_hive into with_hive_readonly, with_hive_write.
I find the code slightly easier to read if we get rid of the ~write
flag, and instead split the with_hive function into two functions, one
for readonly access, and one for write access.

This is just code refactoring.
2016-01-31 14:25:30 +00:00
Richard W.M. Jones
53cc0370b2 mllib: Add 'protect' function (like try/finally).
Use the function in the virt-v2v [Windows] module.

This is just refactoring.  There is no visible change in
functionality.
2016-01-31 14:14:37 +00:00
Richard W.M. Jones
db3e2023eb mllib: Move the maybe type (like Haskell Either) to common library.
Just code motion.
2016-01-31 14:01:59 +00:00
Richard W.M. Jones
14d80452dc arm: Disable -Wcast-align warning.
Any modern system can handle unaligned memory access.  On armv7 it's
slightly slower, that's all.
2016-01-29 20:58:46 +00:00
Richard W.M. Jones
8a910136e4 v2v: windows: Remove unused code left over by previous commit.
As this code wasn't exported in the module interface, it cannot have
been used anywhere.

Fixes commit b76f271425.
2016-01-29 12:50:12 +00:00
Richard W.M. Jones
b6a7aaf0d0 v2v: Remove items from TODO which have been implemented already. 2016-01-29 12:41:02 +00:00
Richard W.M. Jones
825ff5d04d Version 1.33.7. 2016-01-29 10:26:27 +00:00
Richard W.M. Jones
b76f271425 v2v: windows: Move all virtio driver installation code to common module.
Add a common module `Windows_virtio' and move all the code related to
finding and installing Windows virtio drivers to this module.

This is just code motion and code refactoring, there is no change in
functionality.
2016-01-29 10:10:18 +00:00
Pino Toscano
0ac8894f62 inotify_add_watch: pass IN_ALL_EVENTS as mask for test
Instead of pass 0x3fffffff as mask value, pass a simplier 0xfff, which
is the value of the IN_ALL_EVENTS define.  This will still catch all
the inotify events, and avoid a EINVAL error with Linux 4.4.
2016-01-29 10:06:33 +01:00
Richard W.M. Jones
6db3c4099f v2v: windows: Update comment about device number key.
Thanks: Vadim Rozenfeld for finding the TechNet documentation
related to this key.
2016-01-29 08:56:10 +00:00
Richard W.M. Jones
b2a10de6db v2v: Add location of SUSE UEFI binaries.
Thanks: Jim Fehlig
2016-01-29 08:52:09 +00:00
Richard W.M. Jones
52e7085d18 ruby: Rename internal C functions with more consistent naming. 2016-01-28 22:06:01 +00:00
Richard W.M. Jones
f9259c7ba4 lua: Rename 'guestfs_lua_' functions to 'guestfs_int_lua_'.
Actually these are all static functions, so they don't really need the
'guestfs_' prefix at all, but using a prefix avoids any possibility of
a collision with a standard C function.

This is a mechanical refactoring.
2016-01-28 21:53:38 +00:00
Richard W.M. Jones
1a9312c743 python: Rename 'py_guestfs_' functions to 'guestfs_int_py_'.
Purely mechanical change, done by a Perl script (hah!)
2016-01-28 21:49:47 +00:00
Richard W.M. Jones
14cd9a031a java: Rename internal C function without guestfs_ prefix. 2016-01-28 21:38:18 +00:00
Richard W.M. Jones
53403fbdef ocaml, virt tools: More consistent naming for C functions.
For functions linked to virt tools, make sure the name of the function
actually matches the virt tool.  Because of the history of moving
functions across tools, some names no longer matched.

For mllib, use `guestfs_int_mllib_' prefix.

For OCaml bindings, use `guestfs_int_ocaml_' prefix.

This commit is by no means complete.  There are many other C functions
in other language bindings which could do with being more consistently
named.

There is no functional change, this is just refactoring.
2016-01-28 21:30:20 +00:00
Richard W.M. Jones
e32a14ceec docs: Remove reference to double underscore, which is no longer used in internal identifiers. 2016-01-28 21:08:01 +00:00
Richard W.M. Jones
4125181681 docs: Rework headings in guestfs-hacking(1) manual page. 2016-01-28 21:08:01 +00:00
Richard W.M. Jones
98332e8c85 docs: Move section about local* files to guestfs-building(1).
Since it is part of the instructions for building libguestfs, it goes
better in the guestfs-building(1) man page.
2016-01-28 21:08:01 +00:00
Pino Toscano
f9e8f3b2d2 lvm: support lvm2 older than 2.02.107
lvm2 2.02.107 adds the -S/--select option used in lvs to filter out only
public LVs (see RHBZ#1278878).  To make this work again with versions
of lvm2 older than that, only on old versions filter out thin layouts
and compose the resulting device strings ourselves.

The filtering done is much simplier than what "-S lv_role=public" will
do, but should be good enough for our need.
2016-01-28 15:38:25 +01:00
Richard W.M. Jones
569ad259b4 v2v: linux: Find dracut if it is located in /usr/bin.
In Fedora 23, dracut moved to /usr/bin.  However we only looked for
/sbin/dracut, so we didn't find it.  You would have seen a failure
like this:

  virt-v2v: error: unable to rebuild initrd
  (/boot/initramfs-4.2.3-300.fc23.x86_64.img) because mkinitrd or dracut was
  not found in the guest

Look for dracut in /usr/bin as well.

Thanks: Arnaud Bougeard.
2016-01-28 13:57:04 +00:00
Pino Toscano
2bccaa3047 python: stop using parens-less print in tests
print "" is no more available in Python 3, and print(...) is available
since Python 2.7; as one of the tests was using print(), use this form
everywhere so the tests can run fine with Python 3.
2016-01-28 14:45:23 +01:00
Richard W.M. Jones
a6c7b39530 v2v: windows: Don't hard code "oem1.inf" string.
Find the next free "oem%d.inf" string.

Thanks: Vadim Rozenfeld for clarifying what we should be doing
in this case.
2016-01-28 13:11:48 +00:00
Richard W.M. Jones
58ce08f36f v2v: Abbreviate a couple of comments.
No functional change.
2016-01-28 13:11:48 +00:00
Richard W.M. Jones
b12f0a809f GCC 6: Avoid warning about logical OR of "equal" expressions.
The warning (see below) is fairly useless.  This modification to the
code avoids it.

inotify.c: In function 'do_inotify_read':
inotify.c:219:32: error: logical 'or' of equal expressions [-Werror=logical-op]
       if (errno == EWOULDBLOCK || errno == EAGAIN) /* End of list. */
                                ^~
2016-01-28 12:37:33 +00:00
Richard W.M. Jones
b1b15dc77d Version 1.33.6. 2016-01-27 17:36:03 +00:00
Richard W.M. Jones
c323bb7db7 p2v: tests: Don't supply os-version in test. 2016-01-27 15:27:06 +00:00
Pino Toscano
c355b748ce actions: mark btrfs test case of vfs_minimum_size as TestRunOrUnsupported
The btrfs implementation of vfs_minimum_size requires
btrfs-progs >= 4.2, erroring with ENOTSUP otherwise; thus mark the btrfs
test case of the vfs_minimum_size tests as TestRunOrUnsupported, so it
will not cause failures if the available btrfs-progs is not enough.
2016-01-27 14:23:48 +01:00
Pino Toscano
ceefa701c6 generator: add TestRunOrUnsupported test type
Create a new TestRunOrUnsupported test type, which represents a test
sequence where a failure with ENOTSUP in the last command only marks the
test as skipped.  To be used mainly when testing features available only
with some versions of helper tools used in the appliance, for example.
2016-01-27 14:17:22 +01:00
Pino Toscano
474e3051c7 btrfs: also check return value of sysroot_path in btrfs_minimum_size
Followup of commit 79ac68030f.
2016-01-27 14:09:16 +01:00
Pino Toscano
79ac68030f btrfs: fix leak in btrfs_minimum_size
Make sure the result of sysroot_path is properly free'd.
2016-01-27 13:45:24 +01:00
Pino Toscano
fa262e2540 btrfs: fix wrapping in message in btrfs_minimum_size 2016-01-27 13:29:16 +01:00
Richard W.M. Jones
3aaa4c9419 p2v: virt-p2v-make-disk: Make os-version parameter optional.
Having to choose the os-version of the virt-p2v disk was confusing.
Users thought it had something to do with the physical machine being
converted.

In some cases, virt-p2v-make-disk can now choose a suitable os-version
for the user.  Usually it's the latest numeric version of Fedora or
Debian, depending on the host distro.  If we don't recognize the host
distro, we bail and ask the user to choose, but this is still an
improvement.
2016-01-27 11:54:09 +00:00
Richard W.M. Jones
42f8c6e3bd p2v: Use $program consistently in virt-p2v-make-disk script. 2016-01-27 11:48:17 +00:00
Richard W.M. Jones
c3ad944555 p2v: Fix typo in virt-p2v-make-disk manual page. 2016-01-27 11:38:09 +00:00
Richard W.M. Jones
683dd5cbab docs: Refresh the guestfs-testing(1) man page.
Require libguestfs >= 1.22.  Testing ancient versions isn't useful.

Add a virt-builder test section.
2016-01-26 22:18:42 +00:00
Richard W.M. Jones
09e29a70e7 docs: Fix headings in guestfs-security(1). 2016-01-26 21:49:04 +00:00
Richard W.M. Jones
e96df6e776 docs: Add security contact information. 2016-01-26 21:45:17 +00:00
Richard W.M. Jones
1b4de75cb0 docs: Refactor list of manual pages in guestfs(3). 2016-01-26 21:38:12 +00:00
Richard W.M. Jones
1b3d3a3589 customize: Remove "useless" sprintf.
Actually the OCaml compiler rewrites all printf functions at compile
time to a series of primitive string operations, so the use of sprintf
here doesn't really matter.  Still, it's a bit tidier not to use
sprintf where it's not needed.

Also this commit contains some code reformatting.

This is just refactoring.
2016-01-26 21:26:23 +00:00
Richard W.M. Jones
81ff8c5d23 p2v: User can click on an interface name to identify the physical interface.
When the user clicks on the second column of the list of network
interfaces, run 'ethtool --identify <if_name> 10', which (on supported
cards) flashes a light on the physical interface for 10 seconds,
allowing it to be identified by the operator.
2016-01-26 17:54:20 +00:00
Richard W.M. Jones
4470f0483b customize: Add support for the APK (Alpine Linux) package manager. 2016-01-26 17:54:20 +00:00
Pino Toscano
7adb8ffa61 inspect: resolve symlinks when detecting architecture
Resolve the paths of the binaries we are looking in the guest to
identify the architecture. This way we can identify also busybox-based
guests such as Alpine Linux, where all the "base" binaries in /bin are
symlinks to busybox.
2016-01-26 17:54:20 +00:00
Richard W.M. Jones
302bba4f3f Version 1.33.5. 2016-01-26 14:04:38 +00:00
Pino Toscano
5aa26e76ea daemon: fold xfs_admin stdout to stderr
Apparent newer versions of that report everything on stdout, including
error messages; since we only print something on failure, fold stdout to
stderr so we can see everything on failure.
2016-01-26 11:25:54 +01:00
Pino Toscano
1d0bd79c08 xfs_admin: do not set lazycounter in tests not checking that
This flag cannot be disabled (yet) in V5 xfs filesystems; since 2 out
of the current 3 tests of xfs_admin check other results than that flag,
avoid setting it when not needed.
2016-01-26 11:23:25 +01:00
Pino Toscano
d2a36f8cbe daemon: improve debugging for "stdout on stderr" flag
When the COMMAND_FLAG_FOLD_STDOUT_ON_STDERR flag is passed to
command*(), indicate that as stdout=e in debugging message.
2016-01-26 11:21:46 +01:00
Pino Toscano
c22dea9871 btrfs_subvolume_show: fix root/toplevel check w/ btrfs-progs >= 4.4
In trfs-progs 4.4 the error message has been changed, and our check did
not work anymore.  Yes, parsing user messages really sucks...
2016-01-25 19:53:42 +01:00
Pino Toscano
08bf961d68 actions: expand partitions for btrfs_image test
Apparently with newer btrfs-progs (seen with 4.4) 100M are not enough
for a btrfs filesystem; hence double the size of the partitions
created in the test of btrfs_image, so now 200M are enough for btrfs.
2016-01-25 19:08:14 +01:00
Richard W.M. Jones
f2e201033a p2v: Use new miniexpect methods to access the handle fields. 2016-01-24 17:01:17 +00:00
Richard W.M. Jones
38edddb8e8 p2v: Resynch miniexpect with upstream.
Upstream miniexpect commit 3df4c0d3e4192cb6bb8e9ed7126346ab6aa98043.
2016-01-24 17:01:17 +00:00
Richard W.M. Jones
86ec266f22 p2v: Handle mexp_close returning -1 correctly.
If a system call fails, this function returns -1 and sets errno.  This
case was not handled correctly.
2016-01-24 17:01:16 +00:00
Richard W.M. Jones
b564e3682b arm: Remove all DTB (device tree) code.
In commit af762e4342 (2015-03-05)
I stopped libguestfs from using the supermin -dtb parameter when
building appliances.

It has not been necessary for quite a long time to specify a DTB,
since qemu itself creates a device tree structure in the guest
(appliance) memory from the devices presented to the guest.  Qemu does
this on the fly each time the guest starts.

As I promised in the commit mentioned above I would remove this code,
and this commit does that (for libguestfs only).
2016-01-22 22:23:25 +00:00
Richard W.M. Jones
1477c95da4 launch: libvirt: Reword an SELinux debug message. 2016-01-22 21:51:18 +00:00
Richard W.M. Jones
bf469bca13 launch: libvirt: Refactor destroy_domain function.
Small rewrite of commit 7e2f2b0b24.  No
functional change.
2016-01-22 21:48:16 +00:00
Richard W.M. Jones
2b9fda2f92 docs: Tested clang, and userspace probes now work. 2016-01-22 15:44:21 +00:00
Richard W.M. Jones
e3ff6507e9 Version 1.33.4. 2016-01-22 13:16:03 +00:00
Richard W.M. Jones
e23b44e2de daemon: Link with cleanups.c.
And remove the cleanup_* functions from guestfsd.c.

This fixes commit d94860d7e8.
2016-01-22 13:08:24 +00:00
Richard W.M. Jones
2cb8e5ddb8 Minor fixes to "daemon: Split out command* functions and CLEANUP_* macros."
This updates commit d94860d7e8.

Thanks: Pino Toscano.
2016-01-22 12:52:33 +00:00
Richard W.M. Jones
ac5fe225a9 Version 1.33.3. 2016-01-22 12:42:57 +00:00
Richard W.M. Jones
d94860d7e8 daemon: Split out command* functions and CLEANUP_* macros.
This allows the command* functions and CLEANUP_* macros to be used
independently from the daemon.
2016-01-22 09:12:17 +00:00
Richard W.M. Jones
b5066c67e0 daemon: Rename daemon/command.c -> daemon/sh.c.
Simply a file rename, no other change.
2016-01-21 14:25:44 +00:00
Richard W.M. Jones
550fdefc3c p2v: Display architecture in the About dialog. 2016-01-21 13:56:13 +00:00
Richard W.M. Jones
6d25ad48e5 p2v: virt-p2v-make-disk: Allow --arch parameter to be supplied.
This allows you to build a 32 bit virt-p2v USB key, even on a 64 bit
host.

Because of problems with the Fedora build system it's unfortunately
not easy to build a 32 bit virt-p2v binary, so this patch punts on
this issue and assumes that the user can supply the binary themselves.
2016-01-21 13:55:16 +00:00
Richard W.M. Jones
d5222a3ab9 p2v: Fix paths to data files in documentation. 2016-01-21 12:39:47 +00:00
Maxim Perevedentsev
e834b7413a New API: part_expand_gpt.
This action moves second(backup) GPT header to the end of the disk.
It is usable in in-place image expanding, since free space after
second GPT header is unusable. To use additional space, we have
to move second header. This is what sgdisk -e does.

However, sgdisk -e may perform additional actions if the partition
table has unexpected params (e.g. if we call sgdisk -e /dev/sda1,
it may fix partition table thus destroying the filesystem).
To prevent such cases, we do a dry-run at first and fail if
additional actions are scheduled.
2016-01-20 17:41:13 +00:00
Roman Kagan
390c68441a convert_windows: uninstall Parallels Tools on first boot
If present, Parallels Tools may stand in the way of proper running the
windows guests in non-Parallels hypervisors, so we're better off
uninstalling them on the first boot into the new environment.

With this patch, the uninstall records for Parallels Tools are looked up
in the registry and, if found, corresponding firstboot actions are
registered, taking special care that those actions are run fully
unattended.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2016-01-20 17:33:24 +00:00
Richard W.M. Jones
e40acef864 Version 1.33.2. 2016-01-20 17:25:09 +00:00
Richard W.M. Jones
4a0905ac36 tests: regressions: Allow test-big-heap to work on machines with less memory.
This test would fail on machines with around 4 GB of free memory.
Adjust the test so it would now work on such machines (it will however
still fail on a machine with around 2 GB of free memory).
2016-01-20 17:05:53 +00:00
Richard W.M. Jones
ce5607895f docs: Add requirement on ncurses.
Previously missing from the requirements list.
2016-01-20 16:34:34 +00:00
Richard W.M. Jones
9310fabd26 docs: Add guestfs-building(1) man page.
This contains instructions for building libguestfs from source.
2016-01-20 13:42:38 +00:00
Richard W.M. Jones
50f838de31 p2v, v2v: Move HACKING documentation to guestfs-hacking(1) manual page. 2016-01-20 12:05:22 +00:00
Maxim Perevedentsev
dce3b4649d resize: preserve GPT disk GUID.
Changed disk GUID makes some OSes fail to boot.
To enable virt-resize to support such OSes we
have to preserve disk GUID.
2016-01-19 17:59:58 +00:00
Maxim Perevedentsev
1af51b9b02 New API: part_set_disk_guid_random.
Provides a way to set a new randomly-generated GUID to disk.
2016-01-19 17:59:58 +00:00
Maxim Perevedentsev
035936a038 New API: part_get_disk_guid and part_set_disk_guid.
Some OSes (e.g. Windows Server 2012 R2) fail to boot if the disk
GPT GUID has changed. To preserve disk guid e.g. during virt-resize,
we need a way to get/set disk GUIDs.
2016-01-19 17:59:58 +00:00
Richard W.M. Jones
7e2f2b0b24 lib: Handle slow USB devices more gracefully.
Libvirt has a fixed 15 second timeout for qemu to exit.  If qemu is
writing to a slow USB key, it can hang (in D state) for much longer
than this - many minutes usually.

The solution is to check specifically for the libvirt EBUSY error when
this happens, and retry the virDomainDestroyFlags operation
(indefinitely).

See also the description here:
https://www.redhat.com/archives/libvir-list/2016-January/msg00767.html

Similar to the following OpenStack Nova commit:
http://git.openstack.org/cgit/openstack/nova/commit/?id=3907867

Thanks: Kashyap Chamarthy and Daniel Berrange.
2016-01-19 17:59:58 +00:00
Richard W.M. Jones
c3ebc0a837 launch: libvirt: In error messages, display err->int1, don't display domain.
The err->domain field is essentially random from the point of view
of libguestfs.

The err->int1 field has some useful information in some circumstances:
it has the errno value from the failed system call.
2016-01-19 16:04:02 +00:00
Richard W.M. Jones
d029fa0507 Revert "p2v: virt-p2v-make-disk: Allow --arch parameter to be supplied."
This won't work unless we also build a 32 bit virt-p2v binary.

This reverts commit d723b352f8.
2016-01-19 16:04:02 +00:00
Pino Toscano
40b5698388 daemon: resolve paths for ll and llz
Resolve in the guest the given path, so absolute symlinks can be listed
using appliance tools without resolution errors.
Also remove the note about the possibility to escape the sysroot using
ll and llz, since realpath won't return paths outside sysroot.

Fixes part of RHBZ#1293276.
2016-01-19 09:46:20 +01:00
Richard W.M. Jones
3f376fa513 p2v: virt-p2v-make-disk: Use a more robust way to get the latest kernel version.
Fedora/i686 does not have a package called 'kernel', so the command
'rpm -q kernel' fails.  In any case the method used wasn't exactly
very robust.

The new method is based on how febootstrap used to do this.

This updates commit d723b352f8.
2016-01-18 17:44:12 +00:00
Maxim Perevedentsev
4a7b32a7e2 Add -f option to resize2fs -P in vfs_minimum_size.
Sometimes the user wants to know minimum size
for dirty (e.g. mounted) filesystems. In this case,
resize2fs -P will require calling e2fsck -f, while
"in general, it is not safe to run e2fsck on mounted filesystems".

Since resize2fs -P does not modify filesystem, we force it
to display (probably approximate) minimum size.
2016-01-18 16:49:18 +00:00
Richard W.M. Jones
d723b352f8 p2v: virt-p2v-make-disk: Allow --arch parameter to be supplied.
This allows you to easily build a 32 bit virt-p2v USB key, even on a
64 bit host.
2016-01-18 12:12:58 +00:00
Richard W.M. Jones
727ac63dea Update gnulib.
The version we picked just before 1.32 was released suffers from:

  test-mbrtowc.c:49: assertion 'ret == (size_t)(-2)' failed

on RHEL 7.  See this thread for details:

  http://comments.gmane.org/gmane.comp.lib.gnulib.bugs/35567
2016-01-14 17:05:57 +00:00
Pino Toscano
0687bb8e07 builder: allow a specific template for --list
Allow the user to specify a template in --list mode, which will be the
only result in the resulting output (instead of all the available
templates).

This makes it easier to find out the details of a specific template.
2016-01-14 12:40:31 +01:00
Pino Toscano
0a84c67bd6 builder: move os-version search in own function
Simple code motion, no behaviour changes.
2016-01-14 11:51:13 +01:00
Richard W.M. Jones
7bccd0593f tests/mountable: Allow test to be skipped. 2016-01-12 18:26:33 +00:00
Richard W.M. Jones
c1799541d3 Version 1.33.1. 2016-01-11 14:06:42 +00:00
Richard W.M. Jones
446f7794e0 podwrapper: Add --warning flag for manual pages of CLI tools (RHBZ#1293527).
This doesn't add --warning flags to the translated pages,
which is a bug to be fixed at some point.
2016-01-11 13:42:49 +00:00
Richard W.M. Jones
bb27fc1c0a podwrapper: Generate consistent WARNING sections (RHBZ#1293527). 2016-01-11 13:42:49 +00:00
Richard W.M. Jones
6fa4d983a3 podwrapper: Enforce that every manual page must have a DESCRIPTION section.
For every user command line tool (eg. guestfish or virt-cat) require
that the manual page has a DESCRIPTION section.  This doesn't apply to
non-CLI man pages (eg. guestfs-perl, guestfs-faq).
2016-01-11 13:42:49 +00:00
Richard W.M. Jones
3b8322e18c customize: Document missing command line parameters in the synopsis.
I noticed that the --attach option was not covered in the synopsis.
This commit documents all of the missing command line parameters in
the synopsis.
2016-01-11 13:42:49 +00:00
Richard W.M. Jones
b527ff0dfc build: Require qemu >= 1.3.0 and yajl.
Require qemu >= 1.3.0, the first version that supported
`qemu-img --output=json'.

This means we require yajl (for parsing the JSON output of qemu-img),
and that in turn has consequences elsewhere.
2016-01-11 13:42:49 +00:00
Richard W.M. Jones
64af88a1b7 v2v: Unquote path when removing VirtualBox Guest Additions (RHBZ#1296606). 2016-01-11 13:38:36 +00:00
Richard W.M. Jones
2e728ed0dc p2v: Break long lines when displaying virt-v2v output in GUI. 2016-01-08 13:12:01 +00:00
Richard W.M. Jones
abd41320e1 tests: Allow test-disk-create.sh to be skipped. 2016-01-06 17:05:28 +00:00
Richard W.M. Jones
980dc9deaf regressions: test-big-heap: Allow this test to be skipped. 2016-01-06 16:04:46 +00:00
Richard W.M. Jones
de94d01692 regressions: test-big-heap: Add comment about a failure of this test. 2016-01-06 16:04:23 +00:00
Richard W.M. Jones
6afde4fd34 Version 1.33.0. 2016-01-06 11:45:27 +00:00
Richard W.M. Jones
f674520651 hacking: Fix git push command for pushing stable branch.
This fixes commit 5218f54a54.
2016-01-06 11:35:34 +00:00
Richard W.M. Jones
88ba55c553 Version 1.32.0. 2016-01-06 11:34:01 +00:00
Richard W.M. Jones
bc9faf843b website: Prepare website for 1.32 release. 2016-01-06 11:30:02 +00:00
Richard W.M. Jones
5218f54a54 hacking: Document simpler way to create stable branch in git.
I will try this method for the 1.32 release.
2016-01-06 11:30:02 +00:00
Richard W.M. Jones
acde5a6f95 Finalize release notes for libguestfs 1.32. 2016-01-06 11:18:35 +00:00
Richard W.M. Jones
07d1baebae Update PO files from Zanata. 2016-01-06 11:13:27 +00:00
Richard W.M. Jones
1007b2555c daemon: Fix ext2 labels error message (RHBZ#1294956). 2016-01-04 15:33:45 +00:00
Richard W.M. Jones
307c83177c Update copyright dates for 2016.
Run the following command over the source:

  perl -pi.bak -e 's/(20[01][0-9])-2015/$1-2016/g' `git ls-files`
2016-01-02 21:19:51 +00:00
Richard W.M. Jones
9958dffc08 builder: Update Fedora 23 ppc64le image which was broken.
This updates commit d92758d8bb.
2015-12-19 21:30:50 +00:00
Richard W.M. Jones
d92758d8bb builder: Add Fedora 23 ppc64/ppc64le images. 2015-12-19 13:32:25 +00:00
Richard W.M. Jones
eed0e7a2e0 builder: Fix Fedora ppc64/ppc64le build scripts to use correct version. 2015-12-19 09:57:36 +00:00
Pino Toscano
d7753a8eb9 tests: add a couple of iSCSI-related test cases 2015-12-18 17:10:25 +01:00
Pino Toscano
079984a8b8 drives: allow authentication for iSCSI
Now that both the direct and libvirt backends handle authentication with
iSCSI correctly, we can allow this in the library.
2015-12-18 11:17:23 +01:00
Pino Toscano
b2598ce890 launch: direct: manually compose iscsi:// URIs
Move the creation of iscsi URIs away from make_uri, composing them
manually: this is needed because libxml assumes colons (':') to separate
user and password for the authority part, while with iscsi URIs the
separator is percentage ('%'), which would be percent-encoded by libxml.
2015-12-18 11:17:23 +01:00
Richard W.M. Jones
7ecad8d4f7 daemon: Improve debug information from command*.
Do some fake quoting so people don't get worried that we aren't
quoting the commands we run.  See:
https://www.redhat.com/archives/libguestfs/2015-December/msg00080.html
2015-12-17 11:27:04 +00:00
Richard W.M. Jones
6d90cf5eb2 daemon: Make command*f flags parameter unsigned.
It's a bitmask, so unsigned is the right choice.  eg. We can more
easily print it using %x.

This patch changes the size of the fd mask and the values of the
COMMAND_FLAG_* constants, but since these are internal definitions
that doesn't matter.
2015-12-17 11:15:14 +00:00
Richard W.M. Jones
346a8aa303 Version 1.31.30. 2015-12-16 13:27:16 +00:00
Richard W.M. Jones
8e5a431a59 po: Add pt_BR to list of linguas.
Commit e6f7d23782 added new po files for
pt_BR to po/ and po-docs/ (they are only very minimal).  However they
were not added to the list of linguas, so amongst other things the
files were not included in EXTRA_DIST automatically.
2015-12-16 13:27:16 +00:00
Richard W.M. Jones
cbe698b9c9 po: Fix two faults in the uk.po file.
./uk.po:1049: 'msgid' and 'msgstr' entries do not both end with '\n'
./uk.po:9638: format specifications in 'msgid' and 'msgstr' for argument 2 are not the same

This updates commit e6f7d23782.
2015-12-16 13:27:08 +00:00
Richard W.M. Jones
adfe577ee9 hacking: index.html.in is now stored in git under website/ directory. 2015-12-16 12:44:51 +00:00
Richard W.M. Jones
e44de65ec9 builder: Add CentOS 7.2 image. 2015-12-15 18:40:36 +00:00
Richard W.M. Jones
e69e9c1ece builder: website: Update comment in centos.sh script. 2015-12-15 18:20:17 +00:00
Richard W.M. Jones
43e0d25f8d fish: tests: Don't open phony fedora.img for write in parallel.
Two tests opened the phony Fedora image in parallel without the
readonly flag.  This occasionally resulted in strange errors
(especially observed in test-inspect.sh).  Add the --readonly flag to
avoid this.
2015-12-15 17:01:44 +00:00
Richard W.M. Jones
8ec4ebb952 Update release notes. 2015-12-15 16:49:30 +00:00
Richard W.M. Jones
7e8ff29710 Update gnulib to latest. 2015-12-15 16:31:50 +00:00
Richard W.M. Jones
e6f7d23782 Add latest translations pulled from Zanata. 2015-12-15 16:31:50 +00:00
Richard W.M. Jones
ddd9d479cc Update translations and send to Zanata. 2015-12-15 16:31:41 +00:00
Richard W.M. Jones
5c02ad3375 Update BUGS. 2015-12-15 16:31:34 +00:00
Pino Toscano
9c3b4f6ad8 daemon: improve internal commandrvf
- add a flag to request chroot for the process, which is done only as
  very last (before chdir) operation before exec'ing the process in the
  child: this avoids using CHROOT_IN & CHROOT_OUT around command*
  invocations, and reduces the code spent in chroot mode
- add failure checks for dup2, open, and chdir done in child, not
  proceeding to executing the process if they fail
- open /dev/null without O_CLOEXEC, so it stays available for the
  exec'ed process, and thus we don't need to provide an own fd for stdin

Followup of commit fd2f175ee7, thanks also
to the notes and hints provided by Mateusz Guzik.
2015-12-15 15:00:11 +01:00
Richard W.M. Jones
6c6c3ea675 build: Disable -Wstack-protector warning.
Fires with gcc 5.3.1 (on Fedora 23).  It's a completely useless
warning since it just tells you that a function couldn't use the stack
protector.
2015-12-14 22:38:52 +00:00
Kashyap Chamarthy
b314f6700a guestfs.pod: Update reference to libguestfs internals 2015-12-14 21:23:20 +00:00
Richard W.M. Jones
cc717138a9 customize: Capitalize the first character in --sm-credentials help text.
Prior to this commit:

$ virt-builder --help
[...]
  --sm-attach SELECTOR         Attach to a subscription-manager pool
  --sm-credentials SELECTOR    credentials for subscription-manager
  --sm-register                Register using subscription-manager

Really the generator ought to check this.
2015-12-11 15:51:21 +00:00
Pino Toscano
4be1587b33 inspect: recognize the PLD Linux distribution
Just basic identification, with name and version read from
/etc/os-release.
2015-12-10 14:06:14 +01:00
Richard W.M. Jones
545fc84775 perl: Add missing backslash in CLEANFILES rule.
This fixes commit a2edda266e.

Thanks: Jean-Christophe Manciot.
2015-12-06 16:24:32 +00:00
Richard W.M. Jones
f48361ed04 Version 1.31.29. 2015-12-05 23:45:07 +00:00
Richard W.M. Jones
0339b3d7a5 builder: Add Fedora 23 i686 image (RHBZ#1288733).
This includes the DNF fix, see
commit 59ea51d358.
2015-12-05 23:41:25 +00:00
Pino Toscano
a090a48f44 builder: create temporary images in the cachedir (RHBZ#1288201)
Temporary images can be quite big, more than the space available in
$TMPDIR when it's on a tmpfs; hence, place them in our cachedir
instead.
2015-12-04 11:06:35 +01:00
Richard W.M. Jones
5c7c4666e4 resize: Add a regression test for RHBZ#1285847. 2015-12-02 16:18:14 +00:00
Richard W.M. Jones
b3bc670c71 resize: Work around regression in sfdisk (RHBZ#1285847).
'sfdisk --part-type' used to merely set the MBR ID byte in the
partition.  However since sfdisk was rewritten, it now "helpfully"
corrupts the first sector of the partition if you change the type byte
from an ordinary partition to an extended partition.

So we need to change the order in which we sets the partition type
byte, to do it before copying the partition content.

This fixes a major regression in the way that virt-resize handles any
guest with logical partitions (specifically Ubuntu guests).
2015-12-02 16:18:14 +00:00
Richard W.M. Jones
8eb9ad0fb2 POTFILES: Escape dot in regular expression. 2015-12-02 16:18:14 +00:00
Richard W.M. Jones
59ea51d358 builder: Rebuild Fedora 23 image with new DNF (RHBZ#1280029, RHBZ#1278382).
We also need to add a small hack to the build script to ensure the
latest dnf is really included.
2015-12-01 13:03:31 +00:00
Richard W.M. Jones
4085acc67f builder: pxzcat: If write fails, display correct error message.
If uncompressing a template to a filesystem which is nearly full,
virt-builder displays an error which points to the wrong (source) file:

$ virt-builder fedora-22
[   1.2] Downloading: http://libguestfs.org/download/builder/fedora-22.xz
[   1.7] Planning how to build this image
[   1.7] Uncompressing
/home/rjones/.cache/virt-builder/fedora-22.x86_64.1: No space left on device
/home/rjones/.cache/virt-builder/fedora-22.x86_64.1: No space left on device
/home/rjones/.cache/virt-builder/fedora-22.x86_64.1: No space left on device
/home/rjones/.cache/virt-builder/fedora-22.x86_64.1: No space left on device

(The error message is usually printed once by each thread, so it is
printed several times.)

Change the error message to point to the output file, which might be a
temporary or the final file depending on the build plan:

$ virt-builder fedora-22
[   1.1] Downloading: http://libguestfs.org/download/builder/fedora-22.xz
[   1.6] Planning how to build this image
[   1.6] Uncompressing
fedora-22.img: No space left on device
fedora-22.img: No space left on device
fedora-22.img: No space left on device
fedora-22.img: No space left on device
2015-11-27 09:08:07 +00:00
Richard W.M. Jones
8120c6c903 Version 1.31.28. 2015-11-24 22:59:36 +00:00
Richard W.M. Jones
2ee2003d56 daemon: Allow --channel fd:N
In this case, the daemon has been passed an open file descriptor which
it uses directly for the channel.
2015-11-24 19:13:39 +00:00
Richard W.M. Jones
49ad09bae3 launch: direct: aarch64: Add gic-version=host to -M option.
On ARM machines with vGICv3, we need to use the extra -M
parameter gic-version=3 (or gic-version=2 for the old vGIC).

qemu can detect this feature for us if we pass gic-version=host,
so add that to the -M option.  Unfortunately we cannot detect if
qemu itself supports this parameter, but this change only affects
aarch64.

Thanks: Wei Huang
2015-11-24 18:39:52 +00:00
Richard W.M. Jones
6e15468337 builder: rhel: Fix path in rhel-aarch64.sh. 2015-11-24 15:41:56 +00:00
Pino Toscano
51362c9638 fuse: fix return value of guestunmount for unmounted paths
Exit with 3 as return value when fusermount fails, because the specified
mount point is not considered mounted for the user.  This is in line
with what the guestunmount documentation says.

Adapt the test-guestunmount-fd test to the updated return value.

Thanks to: Maxim Perevedentsev.
2015-11-24 16:28:06 +01:00
Richard W.M. Jones
e49680bdd6 fish: ps_restore is only used when HAVE_LIBREADLINE is defined.
Thanks: Keresztes Péter-Zoltán
2015-11-24 11:14:37 +00:00
Pino Toscano
fd2f175ee7 daemon: always provide stdin when running chroot commands (RHBZ#1280029)
When running commands in the mounted guest (using the "command" API, and
APIs based on it), provide the /dev/null from the appliance as open fd
for stdin.  Commands usually assume stdin is open if they didn't close
it explicitly, so this should avoid crashes or misbehavings due to that.
2015-11-20 14:55:46 +01:00
Pino Toscano
0799ac4bf4 build: disable -Winline
Older GCC versions (e.g. < 4.9) may complain about inline functions that
cannot be inlined (growing the generated code). It is not really a
problem for us, so just suppress again the warning.

Followup of commit c37c554fc5.
2015-11-20 14:54:20 +01:00
Richard W.M. Jones
37e145140b v2v: Add full stop after multi-line error message. 2015-11-20 10:27:53 +00:00
Richard W.M. Jones
6faa0bb331 v2v: Clean up the documentation for virt-v2v-copy-to-local.
Don't duplicate the instructions in two different man pages.
Put the conversion steps into virt-v2v(1) only.

This updates commit 87adc30163.
2015-11-20 09:53:35 +00:00
Richard W.M. Jones
0721b8d7f3 v2v: Fix valgrind of virt-v2v-copy-to-local.
This fixes commit 87adc30163.
2015-11-20 08:22:01 +00:00
Richard W.M. Jones
b193908514 build: Add virt-v2v-copy-to-local to installcheck.
This updates commit 87adc30163.
2015-11-19 22:53:18 +00:00
Richard W.M. Jones
9fbb956b14 Version 1.31.27. 2015-11-19 22:51:17 +00:00
Richard W.M. Jones
87adc30163 v2v: Add a new tool virt-v2v-copy-to-local.
This allows certain guests which virt-v2v cannot access to be copied
off the remote hypervisor and converted.  Essentially this just
automates the process of copying the guest's disks and adjusting the
libvirt XML.

This also adds a test of the new tool.
2015-11-19 21:51:42 +00:00
Richard W.M. Jones
05a80e6088 v2v: xml: Add a binding for XmlUnsetProp. 2015-11-19 19:17:41 +00:00
Richard W.M. Jones
7a9edee22c v2v: vcenter: Split out map_source_to_https from map_source_to_uri.
Split the map_source_to_uri function up so that we can get at just the
https://... URI.

This is almost refactoring.  It doesn't quite handle the case where we
are passed a source path from the libvirt VMware driver that doesn't
match the expected "[datastore] path" format, but probably if we hit
that case it's a bug anyway.
2015-11-19 17:20:55 +00:00
Richard W.M. Jones
2ea771e4f8 v2v: Detect conversions where the source disk has zero size (RHBZ#1283588).
If you try to convert a guest that has a zero-sized disk, it
will currently fail in a rather strange way.  Usually you will
see errors in the debug output:

  [    0.562714] sd 2:0:0:0: [sda] Read Capacity(16) failed: Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
  [    0.563884] sd 2:0:0:0: [sda] Sense Key : Not Ready [current]
  [    0.564587] sd 2:0:0:0: [sda] Add. Sense: Logical unit not ready, manual intervention required

followed by virt-v2v failing with:

  libguestfs: trace: v2v: inspect_os = []
  virt-v2v: error: inspection could not detect the source guest (or physical
  machine).

Additionally, because of a problem with the ssh driver in qemu (or
perhaps, with sftp-server on the remote side) it is not possible to
use the ssh driver to open a block device path on the remote server.
The drive will appear as zero-sized, triggering the above error.

Therefore detect this situation, and emit an error (see below).  Also
add a section to the manual describing the workaround required for
converting RHEL 5 Xen guests which are located on block devices.

  virt-v2v: error: guest disk sda appears to be zero bytes in size.

  There could be several reasons for this:

  Check that the guest doesn't really have a zero-sized disk.  virt-v2v
  cannot convert such a guest.

  If you are converting a guest from an ssh source and the guest has a disk
  on a block device (eg. on a host partition or host LVM LV), then
  conversions of this type are not supported.  See "XEN OR SSH CONVERSIONS
  FROM BLOCK DEVICES" in the virt-v2v(1) manual for a workaround.
2015-11-19 13:56:37 +00:00
Richard W.M. Jones
9c85bbbc42 p2v: Cancel conversion if user closes the running dialog.
If the user tries to close the running dialog during a running
conversion, act as if the cancel button was pressed (cancelling the
conversion).

If the conversion has finished/been cancelled, then this closes the
dialog and exits virt-p2v, as now.

Cancelling the conversion in this way ensures that qemu-nbd and ssh
subprocesses are cleaned up.
2015-11-16 22:38:01 +00:00
Richard W.M. Jones
046a625846 p2v: Add a conversion_is_running() function.
This thread-safe function can be used to determine if the conversion
is running (maybe in another thread).
2015-11-16 22:33:59 +00:00
Richard W.M. Jones
62b8a09b36 p2v: Make cancel_conversion() properly thread safe.
Rename 'stop' variable as cancel_requested, and defend it with a
mutex.
2015-11-16 22:33:59 +00:00
Richard W.M. Jones
05d08b8d19 p2v: Tidy up in man page. 2015-11-16 21:47:36 +00:00
Richard W.M. Jones
7406c76bcf p2v: Send physical server 'dmesg' output to debug dir on conversion server.
If the virt-p2v ISO doesn't contain the correct drivers for the
hardware on the physical server, that can cause peculiar conversion
problems.  This was hard to diagnose because we could not see the
'dmesg' output from the physical server.

Upload 'dmesg' output from the physical server (more precisely: from
the virt-p2v ISO's kernel running on the physical server) to the
virt-v2v conversion server debugging directory, so that this
information is available for debugging later.

Unfortunately this involves yet another copy of the 'read_whole_file'
function.
2015-11-16 21:47:36 +00:00
Richard W.M. Jones
399e031c25 v2v: OVF: Use common generated_by string.
Instead of creating a special 'Exported by ...' string just for this
module, use the Common_utils.generated_by string.  Since the string is
just descriptive, this should make no difference.
2015-11-15 22:43:06 +00:00
Richard W.M. Jones
ab37d92ab9 v2v: Move mpstat struct into Types module.
Strangely the Types module already defined mpstat, but it was not used
and redefined in v2v.ml.  Apart from that, this change is just
refactoring.
2015-11-15 22:18:36 +00:00
Richard W.M. Jones
fa1f770498 v2v: windows: Fix a few comments. 2015-11-15 21:54:06 +00:00
Richard W.M. Jones
d2ea61bd1c v2v: Add comment. 2015-11-15 21:54:06 +00:00
Richard W.M. Jones
f3e6b3565c v2v: Move the get_node function to the Windows module.
Just refactoring - however this does make the function safer by having
it return an option type instead of throwing a [Not_found] exception.
2015-11-15 21:54:06 +00:00
Richard W.M. Jones
9ad4ce77b6 v2v: Refactor some uses of Windows.with_hive.
This changes:

  let f root = .. in
  Windows.with_hive ... f

to:

  Windows.with_hive ... ( fun root -> .. )

No functional change, just refactoring.
2015-11-15 21:54:06 +00:00
Richard W.M. Jones
40701b715c v2v: Move the with_hive function to the Windows module.
Just refactoring.
2015-11-15 21:33:32 +00:00
Richard W.M. Jones
8cb6600eee Version 1.31.26. 2015-11-13 19:14:43 +00:00
Richard W.M. Jones
9dc4717bb9 build: Remove ChangeLog from make distclean.
Adding this causes 'make dist' to fail with:

  make[1]: *** No rule to make target 'ChangeLog', needed by 'distdir'.  Stop.

This updates commit a2edda266e.
2015-11-13 19:10:35 +00:00
Richard W.M. Jones
c2d216d166 inspection: Fix detection of the kernel version of Windows ≥ 10 (RHBZ#1281578).
See the description in the bug report:

https://bugzilla.redhat.com/show_bug.cgi?id=1281578

Thanks: Richard Tollerton for alerting me to this change in the way
that Windows version numbers are stored in the Registry starting with
Windows ≥ 10.
2015-11-13 14:24:27 +00:00
Richard W.M. Jones
b91b39e06a daemon: lvm: Change the separator character to ':'.
The separator character (currently comma) was picked arbitrarily to
allow us to parse the output of commands like 'lvs' for APIs such as
'lvs-full'.  Unfortunately the choice of comma conflicts with the 'lvs
-o modules' column, since the list of modules is separated by commas,
breaking our parser.

Change the separator to another arbitrary character (colon) which
hopefully is not used by any column.

See also:
https://bugzilla.redhat.com/show_bug.cgi?id=1278878#c11
2015-11-13 11:53:12 +00:00
Richard W.M. Jones
fccd4ee5e8 daemon: lvm: Only return public LVs from guestfs_lvs API (RHBZ#1278878).
When a disk image uses LVM thinp (thin provisioning), the guestfs_lvs
API would return the thinp pools.  This confused other APIs because
thinp pools don't have corresponding /dev/VG/LV device nodes.

Filter the LVs that are returned using "lv_role=public".

Thanks: Fabian Deutsch
2015-11-13 11:53:12 +00:00
Richard W.M. Jones
c37c554fc5 build: Enable some more warnings.
After fixing some warnings (see prior commits), we can now enable
them in configure.ac.
2015-11-13 11:53:12 +00:00
Richard W.M. Jones
52e517c570 Avoid "function 'asprintf_nowarn' can never be inlined because it uses variable argument lists".
Move this to a separate translation unit and don't inline it.
2015-11-13 11:53:12 +00:00
Richard W.M. Jones
120b658ccc Avoid various "declaration of <var> shadows a previous local"
I enabled the -Wshadow warning temporarily in order to do these fixes,
but had to disable it again afterwards.  The reason is that this warns
about shadowing globals, which is sort of a good thing, but because we
have a global called "verbose" just about everywhere, and at the same
time we baked a function argument called "verbose" into several
unchangable APIs, well, we're stuck without being able to use this
warning.
2015-11-13 11:53:12 +00:00
Richard W.M. Jones
4dc53f0fba Avoid gcc warnings about infinite loop.
This seemingly redundant change avoids a gcc warning/error:

  error: cannot optimize possibly infinite loops

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34114#c3 and
following for an explanation.

Of course gcc is completely wrong and stupid here, because there's no
possibility on current or future hardware that an array of size
SSIZE_MAX could be allocated since it would by definition occupy at
least all addressible memory (if it was an array of bytes, which this
isn't), leaving no room for the code that is being compiled.
2015-11-13 11:53:12 +00:00
Richard W.M. Jones
573c0a26fb gobject: Ignore gobject/docs/guestfs-scan.c.
I'm not sure what/why this file has suddenly appeared.  It may
be something to do with updating gtk-doc.

Whatever - ignore it.
2015-11-13 11:53:12 +00:00
Richard W.M. Jones
4e32737c40 sparsify: Make the interface between cmdline.ml and sparsify.ml explicit.
We could go a bit further here and push the cmdline struct
into Copying.run and In_place.run.
2015-11-13 11:53:12 +00:00
Richard W.M. Jones
995ce5f648 dib: Turn a few progress messages into info messages. 2015-11-13 11:53:12 +00:00
Richard W.M. Jones
f8287387c2 dib: Make the interface between cmdline.ml and dib.ml explicit. 2015-11-13 11:53:12 +00:00
Richard W.M. Jones
a4c981e7bb builder: Make the interface between cmdline.ml and builder.ml explicit. 2015-11-13 11:53:12 +00:00
Richard W.M. Jones
6f38aff262 inspector: --xpath: Copy node to new document (RHBZ#1281577).
'virt-inspector --xpath' can segfault.

When run under valgrind, it shows this error:

==2254== Invalid free() / delete / delete[] / realloc()
==2254==    at 0x4C29D6A: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==2254==    by 0x53BA198: xmlFreeNodeList (tree.c:3690)
==2254==    by 0x53B9F65: xmlFreeDoc (tree.c:1247)
==2254==    by 0x405BFA: do_xpath (inspector.c:808)
==2254==    by 0x405BFA: main (inspector.c:250)
==2254==  Address 0x1030a037 is 311 bytes inside a block of size 1,048 alloc'd
==2254==    at 0x4C28C50: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==2254==    by 0x545DE86: xmlDictAddString.isra.0 (dict.c:270)
==2254==    by 0x545E961: xmlDictLookup (dict.c:923)
==2254==    by 0x539C6DC: xmlDetectSAX2 (parser.c:1067)
==2254==    by 0x53B0B92: xmlParseDocument (parser.c:10725)
==2254==    by 0x53B1276: xmlDoRead (parser.c:15295)
==2254==    by 0x40587D: do_xpath (inspector.c:772)
==2254==    by 0x40587D: main (inspector.c:250)

The cause appears to be that when copying the matching node(s) found
by the xpath expression, we have to copy them into the new document
(using xmlDocCopyNode instead of xmlCopyNode).

This bug has existed since this functionality was originally added in
commit d1ee71782a.
2015-11-13 11:53:12 +00:00
Richard W.M. Jones
ab48601afd inspector: Whitespace changes.
Just break up a few long source lines.
2015-11-12 22:42:45 +00:00
Richard W.M. Jones
7747723aa0 builder: Add Fedora 23 aarch64 image. 2015-11-12 18:12:04 +00:00
Richard W.M. Jones
c15b877310 builder: fedora-aarch64.sh: Switch to using Gerd's edk2. 2015-11-12 16:41:36 +00:00
Richard W.M. Jones
be1b9315ac customize, dib, resize, sysprep: Use 'may' pattern in various places. 2015-11-11 16:12:36 +00:00
Richard W.M. Jones
905d98c127 mllib, v2v: Allow open_guestfs to set the handle identifier.
Extend open_guestfs to take an optional ?identifier parameter.

Use this parameter in virt-v2v which is currently the only place where
we use the handle identifier.
2015-11-11 16:12:35 +00:00
Richard W.M. Jones
b91286c372 v2v: Use the 'may' pattern in the Changeuid module. 2015-11-11 16:12:35 +00:00
Richard W.M. Jones
9307087bb5 builder: Use the 'may' pattern in a few places. 2015-11-11 16:12:35 +00:00
Richard W.M. Jones
9a2c5b7c4d mllib: Add Common_utils 'may' function.
This higher order function encapsulates the following pattern:

  match x with
  | None -> ()
  | Some x -> f x

(replaced with: `may f x`)

This is taken from OCaml lablgtk (Gtk bindings) where this pattern is
used frequently.

See also: https://ocaml.org/learn/tutorials/labels.html
2015-11-11 16:12:35 +00:00
Richard W.M. Jones
c09be9334b v2v: Make the interface between cmdline.ml and v2v.ml explicit. 2015-11-11 14:53:18 +00:00
Richard W.M. Jones
6d46eb33bf v2v: Add --compressed option to produce compressed qcow2 files (RHBZ#1279273). 2015-11-10 13:40:34 +00:00
Pino Toscano
4cc98d8f6e OCaml tools: use open_guestfs everywhere
Instead of creating Guestfs handles and manually apply common options
(e.g. debug and trace), use the open_guestfs in Common_utils.
This also applies the common options to handles which didn't set them
before, so we can inspect also their messages if needed.
2015-11-10 11:38:40 +01:00
Pino Toscano
a7f3f48dd1 customize: allow editing symlinked files
Resolve also symlinks when checking whether a path passed to --edit is a
file: the file editing code supports symlinks anyway (properly changes
the target file, instead of overwrite the symlink with a real file), so
it is safe to allow this operation in customize/builder.
2015-11-09 18:33:52 +01:00
Pino Toscano
6e41fc5a7f customize: check for file existence with --edit (RHBZ#1275806)
Check that a path provided to --edit exists already; while the is_file
call later will fail for non-existing files, with an explicit check a
better error message can be provided.
2015-11-09 18:26:05 +01:00
Pino Toscano
78db05a05c v2v: test-v2v-i-ova-two-disks.sh: fix sha1 filename
Run sha1sum on the compressed filename (with .gz extension, after the
gzip run), and reference that file in the .mf file.
2015-11-09 16:42:32 +01:00
Pino Toscano
39a8e12d90 lib: do not manually include libvirt.h in .c files
guestfs-internal.h includes it already, so rely on that.
2015-11-09 11:38:49 +01:00
Pino Toscano
3b54869dad lib: enable the libvirt code consistently everywhere
With commit bc2b417784
HAVE_LIBVIRT_BACKEND is defined based on the libvirt version (using its
version macro), although libvirt.h is included only after that check:
because of this, variables in the guestfs_h struct after the
HAVE_LIBVIRT_BACKEND block would be used wrongly if libvirt.h was not
included before guestfs-internal.h, like in the recently added
available.c (all the other places using libvirt features in the handle
already happened to do so).

Considering guestfs-internal.h already includes libvirt.h, move its
inclusion up, right before the libvirt version check.
2015-11-09 11:29:49 +01:00
Richard W.M. Jones
cbeb127a5d todo: Remove virt-p2v --inject-ssh-identity as it has been implemented. 2015-11-08 20:36:47 +00:00
Richard W.M. Jones
3bf676be92 lib: find_or_cache_feature function can return a const pointer.
This updates commit 38598e2ba5.
2015-11-06 22:24:39 +00:00
Richard W.M. Jones
2497b4921e lib: Fix whitespace in src/available.c
This updates commit 38598e2ba5.
2015-11-06 21:38:28 +00:00
Richard W.M. Jones
dc9d14ebd3 Version 1.31.25. 2015-11-06 17:30:53 +00:00
Pino Toscano
7b74d05758 tests: rhbz1232192.sh: fix VIRT_TOOLS_DATA_DIR
Followup of commit f933a3c9c7.
2015-11-06 17:13:34 +01:00
Pino Toscano
af3511c7a9 tests: replace run-xml-to-junit.* with automake2junit.ml
Replace the custom XSLT + script to turn output from $RUN_OUTPUT_FILE
(from previous run.in versions) with a OCaml script to analyze .trs and
.log files of the automake test framework.

The final result should be the same, just with classname= for each test
set to the "path" (subdirectories) to that test.
2015-11-06 16:14:22 +01:00
Pino Toscano
18c730e7f6 build: use a custom test driver
Use a custom test driver for running the tests: based on the test-driver
provided by automake, it adds the running time of the test in each .trs
file.
2015-11-06 16:11:55 +01:00
Richard W.M. Jones
c0a781ed9a build: Drop serial_tests.
Use (implicitly) parallel tests on new enough automake.  The tests run
a bit quicker with this change.  On my laptop, I measured 27 mins down
to 18 mins.

Change the ./run function so that ./run --test no longer spools the
test output to a file.  That is not necessary when using parallel
tests, since the test harness does the same thing.

Note: This commit removes the $RUN_OUTPUT_FILE functionality.  We will
change the CI integration in a future commit so it uses the .trs and
.log files.
2015-11-06 16:11:44 +01:00
Richard W.M. Jones
7964e48b5e inspect: windows: Fail hard if we cannot detect Windows architecture (RHBZ#1278371).
The user did not have the 'file' command installed, and when they
attempted to do a v2v conversion of a Windows guest, inspection
succeeded, but the Types.i_arch field was found to contain "unknown".
virt-v2v conversion failed to locate the correct virtio drivers as a
result.

The 'file' command is required, and there's no other reason we should
not be able to detect the architecture of any Windows guest, so fail
hard in this situation.
2015-11-06 12:16:30 +00:00
Richard W.M. Jones
32368f25f1 generator: Another minor indentation fix in src/actions-*.c files. 2015-11-06 12:09:53 +00:00
Richard W.M. Jones
22c97bcb3f v2v: tests: No QXL drivers on the ISO.
There are no QXL drivers on the ISO, so don't expect the QXL driver to
be installed.

This fixes commit 8c735a84c7.
2015-11-06 09:41:47 +00:00
Richard W.M. Jones
c5237e28c5 test-data: Copy DriverVer from real *.inf files to fake *.inf files.
We want to test if virt-v2v can find drivers using the *.inf files.
For this to work, one field is important:

  [Version]
  DriverVer = 07/17/2013,6.1.0.10018

Copy the [Version] section header and DriverVer field from the real
*.inf files to our fake *.inf files, which is enough for testing.

See also:
https://www.redhat.com/archives/libguestfs/2015-October/msg00352.html

Note that the fields are case insensitive and may or may not contain
spaces.
2015-11-05 16:23:10 +00:00
Richard W.M. Jones
8c735a84c7 test-data: Make fake virtio-win ISO.
The virtio-win ISO has a different layout and superset of drivers
compared to the virtio-win RPM directory.  Previously we simply put
all the RPM files into the fake ISO.  Instead create a fake ISO which
has the same layout and (fake) drivers as the real ISO.
2015-11-05 16:23:10 +00:00
Richard W.M. Jones
b99a57a631 test-data: Add further (all fake) virtio-win driver files. 2015-11-05 16:23:10 +00:00
Richard W.M. Jones
f933a3c9c7 v2v: Move fake-virtio-win and fake-virt-tools under test-data.
There is no change, this just moves the test files.
2015-11-05 16:23:10 +00:00
Pino Toscano
38598e2ba5 actions: refactor available & feature_available
Refactor the internal_feature_available to return the result for just
one group, so it is easier to know on the library side what was the
actual error, and which group refers to; drop internal_available, as no
more needed after this.

On the library side, implement in available and feature_available the
real logic to iterate through the requested group, and error out or
return whether the groups are available. This also introduces caching
for the features, so each needs to be queried just once in each
appliance run.

The result of this is that there should be much less communication with
the daemon to know about available features; the downside is that
queries for more than one group at once, not already cached, will be
cause more queries to the daemon.
2015-11-05 16:48:58 +01:00
Pino Toscano
2e79edb4a3 actions: turn available & feature_available as non-daemon
Rename the current available and feature_available into internal daemon
functions, and provide non-daemon functions wrapping them at library
side.  This will make it possible to e.g. add caching for them.

Should be only refactoring, no actual behaviour change.
2015-11-05 16:48:58 +01:00
Richard W.M. Jones
18fbdaaf14 v2v: Improve the error when virt-v2v is run on a blank disk.
The error messages changes from:

  $ virt-v2v -i disk /tmp/blank.img -o null
  [...]
  [  14.6] Inspecting the overlay
  virt-v2v: error: no root device found in this operating system image.

to:

  $ virt-v2v -i disk /tmp/blank.img -o null
  [...]
  [  15.2] Inspecting the overlay
  virt-v2v: error: inspection could not detect the source guest (or physical
  machine).

  Assuming that you are running virt-v2v/virt-p2v on a source which is
  supported (and not, for example, a blank disk), then this should not
  happen.  You should run 'virt-v2v -v -x ... >& log' and attach the complete
  log to a new bug report (see http://libguestfs.org).

  No root device found in this operating system image.
2015-11-05 14:01:10 +00:00
Richard W.M. Jones
b20d36aa1b tests: Change more conflicting temporary output file names.
Various tests cannot be run in parallel just because they happen to
use conflicting names for temporary output files (eg. "test.out").

Change these tests to use unique temporary names, so the tests could
be run in parallel.
2015-11-05 13:48:38 +00:00
Richard W.M. Jones
8a72616bf7 test-data: phony-guests: Don't use *.tmp.* temporary files. 2015-11-05 13:46:05 +00:00
Richard W.M. Jones
458d7c09b7 v2v: Check if i_type, i_distro or i_arch contains "unknown".
That indicates that inspection failed, so we should error out early.
2015-11-05 13:46:05 +00:00
Richard W.M. Jones
fff2797578 v2v: vCenter: Document additional permission needed for conversions (RHBZ#1277274).
This updates commit 4e24338625.

Thanks: Alessandro on https://bugzilla.redhat.com/show_bug.cgi?id=1277274#c6
2015-11-05 09:03:56 +00:00
Pino Toscano
b933b17a2a actions: set features for vfs_minimum_size tests
Limit the scope of two tests of vfs_minimum_size to the features they
require (btrfs and xfs).
2015-11-05 09:46:36 +01:00
Richard W.M. Jones
c12c7d0df0 Version 1.31.24. 2015-11-04 17:45:28 +00:00
Richard W.M. Jones
8e3920a334 sparsify: Let --in-place capture ^C and shut down gracefully (RHBZ#1277122).
When virt-sparsify receives a user quit signal (eg from ^C) it
currently kills virt-sparsify and qemu instantly, meaning any mount +
fstrim in progress is uncleanly stopped.  The (minor) side effect of
this is that the guest filesystem may require a journal replay or fsck
on boot.

Let virt-sparsify capture the user quit signal and shut down
gracefully.

It is not thought that the previous behaviour could cause guest
corruption; see
https://lists.nongnu.org/archive/html/qemu-devel/2015-11/threads.html#00402
for discussion.
2015-11-04 16:24:04 +00:00
Richard W.M. Jones
4e24338625 v2v: vCenter: Document the minimum set of permissions needed for conversions (RHBZ#1277274).
Thanks: Alessandro on https://bugzilla.redhat.com/show_bug.cgi?id=1277274#c2
2015-11-04 16:24:04 +00:00
Pino Toscano
9d8ffd966a lib: include few more headers
- include <sys/un.h> for sockaddr_un, on any OS (removing the Mac OS X
  blocks)
- include <fcntl.h> for O_* flags

This commits reverts a couple of changes in these files done in
commit 3b17152ec3.
2015-11-04 14:52:29 +01:00
Pino Toscano
a13e95783d Revert "launch: add missing headers on Darwin"
This reverts commit 3ce4e95c5a.
2015-11-04 14:50:58 +01:00
Richard W.M. Jones
226848762b builder: Add fedora-23 image. 2015-11-04 13:06:11 +00:00
Margaret Lewicka
3ce4e95c5a launch: add missing headers on Darwin
Including sys/un.h for sockaddr_un and sys/fcntl.h for
O_CLOEXEC/O_NONBLOCK.
2015-11-04 12:22:28 +00:00
Richard W.M. Jones
0c879fcd15 sparsify: Don't mark virt-sparsify --in-place as "experimental".
Thanks: Gil Klein.
2015-11-04 09:47:52 +00:00
Richard W.M. Jones
9f70d71d4a builder: Document using 'qemu-img amend' for RHEL 6 compat (RHBZ#1204131). 2015-11-03 21:14:40 +00:00
Richard W.M. Jones
a2edda266e build: Make 'make clean' remove more files.
Remove man pages and other pages which 'make clean' did not remove
before.

To evaluate which pages could be removed, I did a full build and
check, and then ran 'make clean' followed by 'git clean -xdf'.  By
examining the output of the git clean command I could see which files
were being missed.

Files that are _not_ removed by make clean or make distclean:

 - generator-built files

 - Makefile, Makefile.in, .deps, .depend

 - any ./configure output files (maybe they should be?)
2015-11-03 13:53:37 +00:00
Richard W.M. Jones
6221d54445 build: Remove unused intltool-* files.
None of these files have been touched since the initial intltoolize
command (commit 29204fe10d, May 2009).
2015-11-03 12:14:10 +00:00
Richard W.M. Jones
c192d99c09 p2v: Don't present the vdsm output driver to the user (RHBZ#1277074).
Thanks: Ming Xie.
2015-11-02 23:31:32 +00:00
Richard W.M. Jones
f45c4619f5 tests: Remove fuzz testing of inspection.
It's a nice idea, but has never actually found a problem.  After using
afl to find bugs in qemu-img, it's pretty clear to me that no
successful approach could be run in the short time demanded by the
libguestfs test suite.  Afl tests run for days, weeks or even months.

A better approach may be to use a proven fuzz tester (such as afl) on
the inspection code; or to run this code for days on end on a separate
testing machine.

This reverts commit c2dcd10964.
2015-10-31 23:09:51 +00:00
Richard W.M. Jones
2c62de52b7 df: Close parenthesis in comment. 2015-10-31 22:53:14 +00:00
Richard W.M. Jones
88c506767a build: Make 'make clean' remove a few backup files. 2015-10-31 22:08:06 +00:00
Richard W.M. Jones
6190226671 website: Add guestfs-hacking, guestfs-internals, guestfs-security to website.
Also move guestfs-performance to the right place on the website.

This updates commit 2eb01004bf
and commit d07515b947
and commit 74fba6e692
and commit 15b8b6453d.
2015-10-31 17:09:29 +00:00
Richard W.M. Jones
47b095b928 website: Put website into a separate directory.
Move the random set of HTML files we build from html/ into
the website/ directory.

Also in the website/ directory, put the index.html file from
http://libguestfs.org, which was previously not under version control.
It is generated from index.html.in so we can automatically add the
current version and release date.

Also in the website/ directory, put various CSS file, images, etc.
which are required by the website and were also previously not under
version control.

Change the 'make website' rule to 'make maintainer-upload-website'.
As the name suggests, it is only useful for the maintainer, and will
fail with an error for anyone else.
2015-10-31 17:09:29 +00:00
Richard W.M. Jones
de819d17e4 Version 1.31.23. 2015-10-31 11:08:14 +00:00
Richard W.M. Jones
7dcfc9eb03 docs: Minor fix to description of 'test-data' subdirectory.
Fixes commit dc1d0880b0.
2015-10-30 23:02:54 +00:00
Richard W.M. Jones
2eb01004bf website: Copy guestfs-hacking, guestfs-internals, guestfs-security to website.
Make sure the three new man pages are copied over to the website.

This updates commit d07515b947
and commit 74fba6e692
and commit 15b8b6453d.
2015-10-30 22:49:50 +00:00
Richard W.M. Jones
877c69bef7 build: Reorder build sequence.
When I conceived commit dc1d0880b0, I
thought it would be a good idea to build test-data files, including
the phony guest images, during the 'make' phase.  Previously these
were built early in the 'make check' phase.

However this has two disadvantages: (a) We run the appliance
unnecessarily during builds.  For example, it is not necessary to
build the phony guests if we are going to do an 'installcheck'.
(b) Even if we are testing, the critical first time we run the
appliance is not in 'quickcheck' or 'tests/qemu', but some random
guest build.

Reorder the build sequence to fix this, and also a few other things.

This updates commit dc1d0880b0.
2015-10-30 22:06:18 +00:00
Richard W.M. Jones
dd5f5ffb48 test-data: Remove bogus comment.
The way we now build the blank guest images is safe to be run in
parallel.
2015-10-30 21:39:54 +00:00
Richard W.M. Jones
cd6f7f6ee0 tests/regressions: Fix rhbz1174551.sh so it works when debugging is enabled.
This test failed during release testing.  It turned out to be because
the tests are run with LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1 which
causes other messages to be printed.

Updates commit b5a6f899cd.
2015-10-30 18:51:30 +00:00
Richard W.M. Jones
c078486041 Version 1.31.22. 2015-10-30 16:28:28 +00:00
Richard W.M. Jones
dc1d0880b0 tests: Move the tests/data and tests/guests directories to test-data.
Create a new top-level directory called test-data, which will carry
all the test data which is large and/or shared between multiple tests.

There are actually several new subdirectories created:

test-data/binaries: The pre-built binary and library files for random
architectures that we use to test various architecture detection
features (was part of tests/data).

test-data/blank-disks: The blank disks which are used for disk format
detection (was part of tests/data).

test-data/files: Other miscellaneous test files from tests/data that
are not included in the above.

test-data/phony-guests: The phony guests (was tests/guests).

test-data: The top-level directory builds the 'test.iso' image file
that is used for testing the C API and in miscellaneous other tests.
2015-10-30 16:07:32 +00:00
Richard W.M. Jones
7efde6589c tests/regressions: Display errors in rhbz1174551.sh.
Updates commit b5a6f899cd.
2015-10-30 15:09:37 +00:00
Richard W.M. Jones
93214205cc Version 1.31.21. 2015-10-30 10:52:30 +00:00
Richard W.M. Jones
6b2ff3377c v2v: windows: Create Windows module, and move functions around.
Create a Windows module, analogous to the Linux module we already
have.  Move utility functions related to Windows into this module.

In particular:

 - detect_antivirus function moves here, and the Detect_antivirus
   module goes away entirely

 - copy_virtio_drivers / virtio_iso_path_matches_guest_os moves here,
   and the virtio_iso_path_matches_guest_os can now be hidden

This is just refactoring, but allows us to make deeper changes to
copy_virtio_drivers.
2015-10-30 10:32:43 +00:00
Richard W.M. Jones
b00a2151ab v2v: utils: Refactor xpath_* functions.
No change, just refactoring.
2015-10-30 09:45:02 +00:00
Richard W.M. Jones
bd65e346d8 v2v: utils: Add a utils.mli file defining the interface. 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
6a688c5119 v2v: utils: Remove unused function compare_app2_version_min. 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
e9bd10897d v2v: utils: Comment fix. 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
7f19420cfe v2v: utils: Move three utility functions to where they are used.
The three utility functions xml_quote_attr, xml_quote_pcdata and
uri_escape were only used in a single module.  Move them close to
where they are used.

This is just code refactoring.
2015-10-30 09:45:02 +00:00
Richard W.M. Jones
e7f8c064cf v2v: utils: Don't open Types module. 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
0dffbb7d94 v2v: Move the open_guestfs function into Common_utils.
Removes the somewhat ugly inclusion of this function in Types.  Also
means we can use this function elsewhere.
2015-10-30 09:45:02 +00:00
Richard W.M. Jones
63952d9666 ocaml: Rename Config module as Guestfs_config.
Unfortunately Coccinelle places a Config module in the ocaml libdir,
and this confuses ocamlfind (only when Coccinelle is installed).
Since this is a private module that only libguestfs tools use
internally, just rename it from Config -> Guestfs_config.
2015-10-30 09:45:02 +00:00
Richard W.M. Jones
f4783fcc0d docs: Group guestfs(3) 'SEE ALSO' into sections. 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
15b8b6453d docs: Move security documentation to guestfs-security(1). 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
74fba6e692 docs: Move architecture and internals documentation to guestfs-internals(1). 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
d07515b947 docs: Move 'extending libguestfs' documentation to guestfs-hacking(1).
Start to split the huge, monolithic guestfs(3) manual page.
2015-10-30 09:45:02 +00:00
Richard W.M. Jones
a87218c271 configure: Move FUSE checks to separate file.
This is moved earlier because it's now part of the C library.
2015-10-30 09:45:02 +00:00
Richard W.M. Jones
cdcd1e7c98 configure: Move misc. library checks to separate file. 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
34304f5e3d configure: Move appliance checks to separate file. 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
dfa9dee775 configure: Move daemon checks to separate file. 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
56884b6543 configure: Move C library checks to separate file. 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
4a67b4be93 configure: Move basic C compiler environment checks to separate file.
Also gnulib stuff.
2015-10-30 09:45:02 +00:00
Richard W.M. Jones
1d73d93130 configure: Move detection of external programs to a separate file.
Do this early since these tests generally don't depend on anything
else (the external program is either there or its not), and because
other things depend on some of these tests.
2015-10-30 09:45:02 +00:00
Richard W.M. Jones
671525bfdd configure: Move qemu detection to separate file. 2015-10-30 09:45:01 +00:00
Richard W.M. Jones
7adf7e26de configure: Move bash completion detection to separate file. 2015-10-30 09:45:01 +00:00
Richard W.M. Jones
3683b5f57f configure: Move Perl program / man page detection into m4/guestfs_perl.m4. 2015-10-30 09:45:01 +00:00
Richard W.M. Jones
51811c80a1 configure: Move (old, Perl) tools detection into m4/guestfs_perl.m4. 2015-10-30 09:45:01 +00:00
Richard W.M. Jones
21d41daec0 configure: Move language binding detection to separate files.
The extra files don't have to be added to EXTRA_DIST, as it appears
that autotools already knows that it has to add them.
2015-10-30 09:45:01 +00:00
Richard W.M. Jones
db5ebecd8a Revert "resize: add function find_partitions"
This reverts commit 5aa7e99cb9.
2015-10-30 09:45:01 +00:00
Richard W.M. Jones
3258695162 Revert "resize: add function calculate_target_partitions"
This reverts commit 21677c5b46.
2015-10-30 09:45:01 +00:00
Richard W.M. Jones
8ad069c402 Revert "resize: add function mbr_part_type"
This reverts commit fc34e2d16c.
2015-10-30 09:45:01 +00:00
Richard W.M. Jones
b1a7903fd1 Revert "resize: add p_mbr_p_type as member of type partition"
This reverts commit 6e989fd709.
2015-10-30 09:45:01 +00:00
Richard W.M. Jones
20ae8bd9ec v2v: windows: Don't do NTFS heads fix if i_root is not a partition (RHBZ#1276540).
The error was:

libguestfs: trace: pread_device = "NTFS    "
libguestfs: trace: part_to_dev "/dev/sda"
guestfsd: main_loop: new request, len 0x34
guestfsd: error: device name is not a partition
guestfsd: main_loop: proc 272 (part_to_dev) took 0.00 seconds
libguestfs: trace: part_to_dev = NULL (error)
virt-v2v: error: libguestfs error: part_to_dev: device name is not a
partition
2015-10-30 08:51:52 +00:00
Richard W.M. Jones
25fee09a44 builder: Add Debian 7 sparc64 image. 2015-10-27 18:18:50 +00:00
Maxim Perevedentsev
f5caa421d1 Added xfs support to vfs_minimum_size. 2015-10-27 17:25:49 +00:00
Pino Toscano
a4da3f74c9 builder: run virt-resize with --unknown-filesystems=error
This way, we can make sure that if a template needs to be expanded, the
result will have all the filesystems correctly expanded, fitting into
the new sizes of their partitions.
2015-10-27 17:49:57 +01:00
Pino Toscano
4f97f6866c resize: add --unknown-filesystems
Introduce a new option to control how virt-resize behaves when asking to
expand a filesystem, either unknown to libguestfs or that virt-resize
cannot expand. The default keeps the current behaviour, i.e. just warn.
2015-10-27 17:49:57 +01:00
Maxim Perevedentsev
858a9de297 Added btrfs support to vfs_minimum_size. 2015-10-27 14:58:42 +00:00
Pino Toscano
3734d76f1a build: look for Module::Build instead of ExtUtils::MakeMaker
Module::Build is now used for building the Perl bindings, so look for it
instead of the old module.

Followup of commit f98e0f115b.
2015-10-26 13:08:58 +01:00
Richard W.M. Jones
638761e6df Version 1.31.20. 2015-10-25 17:07:01 +00:00
Richard W.M. Jones
31c42e9c11 perl: Fix location of generator_build Guestfs.xs.
Also add MANIFEST to EXTRA_DIST.

This fixes commit f98e0f115b.
2015-10-25 17:06:06 +00:00
Richard W.M. Jones
f98e0f115b perl: Switch to using Module::Build.
Replace ExtUtils::MakeMaker with Module::Build.

'perllocal.pod' and 'bindtests.pl' are no longer incorrectly
installed.

This change also removes the following phony deps: appliance src_deps
test_images.  No other language binding needs explicit dependencies
for their tests, they just rely on the top level build order being
correct (ie. SUBDIRS in /Makefile.am).
2015-10-24 12:36:28 +01:00
Richard W.M. Jones
1c506aa960 ocaml: Allow 'make install' to be run twice.
'ocamlfind install' doesn't like to install the same package if it is
already installed.  It will give errors like:

  ocamlfind: Package guestfs is already installed

or:

  ocamlfind: Conflict with file: /usr/lib64/ocaml/guestfs/mlguestfs.cmxa

Fix this by removing the old installed files before running
'ocamlfind install'.  An alternative would be to use
'ocamlfind uninstall', but this seems more direct.
2015-10-24 12:36:28 +01:00
Richard W.M. Jones
905a9c54e6 builder: Allow 'make install' to be run twice.
The error is:

ln -s xdg/virt-builder /tmp/p/etc/virt-builder
ln: failed to create symbolic link '/etc/virt-builder/virt-builder': File exists

There is no 'LN_SF' macro, but according to the documentation at
least, it should be safe to add a '-f' flag since it will work for
both the 'ln' and 'cp' variants of the macro.
2015-10-24 12:36:18 +01:00
Maxim Perevedentsev
474f6525c8 Bugfix in number parsing in vfs_min_size. 2015-10-23 10:05:09 +01:00
Pino Toscano
a1b7540b78 v2v: -o libvirt: dump XML for libvirt if verbose
When running in verbose mode, dump the XML we created for libvirt:
this way it is easier to debug mismatches between what we want to setup
in libvirt, and what actually gets defined.
2015-10-22 14:39:03 +02:00
Pino Toscano
f56031d549 v2v: -o libvirt: fix <video> element (RHBZ#1225789)
Create the correct tags for <video> in the libvirtxml, so all the
attributes are in a <model> child of <video> instead of <video> itself.

Adapt the XML of test-v2v-i-ova to the different expected XML.
2015-10-22 14:10:16 +02:00
Pino Toscano
d8f248ffb4 po-docs: generate virt-dib and virt-get-kernel docs 2015-10-22 11:20:35 +02:00
Pino Toscano
0f04263000 build: isolate common po-docs logic
Move most of the content of either po-docs/ja/Makefile.am or
po-docs/uk/Makefile.am to po-docs/language.mk, and use it exclusively
instead of the former contents of the languange-specific Makefile.am.
This way, either adding a new documentation or enabling a new language
will not require copying over the same make code.
2015-10-22 11:13:48 +02:00
Pino Toscano
8d8fa9cf4a v2v: fix identifier
Set the "virtio_win" identifier to the right Guestfs handle.

Fixes commit f7249a0bcc.
2015-10-21 18:03:46 +02:00
Pino Toscano
6aea0e21ad v2v: use open_guestfs everywhere
Use the common open_guestfs to open Guestfs handles, so we get
debugging, tracing, and other common options set.
2015-10-21 18:03:46 +02:00
Pino Toscano
8a9d056163 v2v: move open_guestfs to Types
Move most of open_guestfs to Types, so a common function to open a
Guestfs handle is available.  Since it does not do all the things the
old open_guestfs did, the two operations have been moved to the only
place requiring them.

This function has been placed in Types and not Utils, as will be needed
by other functions in Types; Utils uses Types, so this avoids a circular
dependency.
2015-10-21 18:03:46 +02:00
Richard W.M. Jones
9ecfd8a94f p2v: Set the virt-p2v ISO timeout to 60 seconds (not 6 seconds).
Thanks: Dennis Gilmore.
2015-10-21 15:46:08 +01:00
Richard W.M. Jones
34d1b2678b p2v: Add dracut-live to the kickstart (RHBZ#1168223).
Thanks: Dennis Gilmore for working out what was missing.
2015-10-21 15:21:11 +01:00
Pino Toscano
b5a6f899cd actions: turn some params into FilenameList (RHBZ#1174551).
Use FilenameList as type for lists of file names, as used in some
listing-alike APIs.  This way we can ensure anything different than just
file names in those lists is rejected outright.

As a consequence, test-big-dirs.pl does not need to prepend the
directory name anymore before calling listing-alike APIs: previously
they didn't fail, but the returned lists contained only invalid
elements (and only their size was checked).

Furthermore, add a new regression test for it.
2015-10-21 13:00:18 +02:00
Pino Toscano
7c10cda266 generator: add a FilenameList parameter type
Mostly like StringList (so it can used in current StringList
parameters), but checking client- and daemon-side that the elements are
file names.
2015-10-21 13:00:18 +02:00
Pino Toscano
64cb0f5dad tests: use fake-virt-tools also in tests outside v2v
We have phony tools for v2v tests, introduced with
commit c1af1ba32f126b7be275bcc8cd4ea4e5af27a88e; make use of it also in
tests related to v2v outside the v2v directory.
2015-10-21 13:00:18 +02:00
Richard W.M. Jones
2b50bad568 docs: Move guestfs-release-notes(1) to docs/ subdirectory.
I have also removed the text equivalent of this file.  Originally I
added this because it was thought good to have the release notes
available in a format that doesn't require any special tools to read.
But:

 - POD files are basically text.

 - Debian tooling generates the text file in a slightly different way
   from Fedora tooling, resulting in git marking the file as being
   updated when it isn't really.

 - github can format and display POD files.
2015-10-21 11:26:16 +01:00
Richard W.M. Jones
6219e61cba Move miscellaneous documentation from examples/ to docs/.
Wasn't very logical putting these doc files in the examples directory.
2015-10-21 11:17:14 +01:00
Richard W.M. Jones
eb36df827b guestfs-performance: Add a note about Xen dom0. 2015-10-21 10:36:07 +01:00
Richard W.M. Jones
0294b1f9b2 guestfs-performance: Use lowercase in =head2 sections.
Makes it easier to read.
2015-10-21 10:35:03 +01:00
Richard W.M. Jones
a86a7d0f07 Version 1.31.19. 2015-10-20 23:53:21 +01:00
Maxim Perevedentsev
8296933ade Include resize2fs_P into vfs_minimum_size. 2015-10-20 18:26:22 +01:00
Maxim Perevedentsev
b8d4ca686b New API: vfs_minimum_size
This call provides the way to get minimum size of filesystem.
This is needed for shrinking. The return units are bytes.
2015-10-20 18:26:22 +01:00
Roman Kagan
e9b32e1bad v2v: add test for --in-place
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 18:26:22 +01:00
Roman Kagan
3c3873bc9a v2v: document --in-place
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 18:26:22 +01:00
Roman Kagan
d0069559a9 v2v: add --in-place mode
In this mode, converting of the VM configuration, setting up the
rollback path for error cases, transforming the VM storage and so on is
taken care of by a third-party toolset, and virt-v2v is only supposed to
tune up the guest OS directly inside the source VM, to enable it to boot
and run under the input hypervisor.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 18:26:22 +01:00
Pino Toscano
fe62f4727f Add a regression test for RHBZ#1011907 / RHBZ#1165785
Test case adapted from Hu Zhang's RHBZ#1242853, thanks.
2015-10-20 18:02:23 +02:00
Richard W.M. Jones
44889b7d53 Version 1.31.18. 2015-10-20 16:56:00 +01:00
Roman Kagan
fa40934aad v2v: factor out opening and populating guestfs handle
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 15:17:27 +01:00
Roman Kagan
7ad0c1eee9 v2v: factor out preserving overlays for debugging
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 15:17:27 +01:00
Roman Kagan
5c1e068e60 v2v: factor out copying of output data
Factor out copying the overlays to final disk images into a separate
function.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 15:17:27 +01:00
Roman Kagan
48345d0d83 v2v: factor out determining the guest firmware
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 15:17:27 +01:00
Roman Kagan
030c6fb63e v2v: factor out actual guest transformation
Factor out perfoming the actual convertion of the guest, which includes
determinig the appropriate guest os specific conversion module and
running its conversion routine.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 15:17:27 +01:00
Roman Kagan
5dae9ca23d v2v: factor out size checks
Factor the size checks out to separate functions.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 15:17:27 +01:00
Roman Kagan
a61f148186 v2v: factor out populating targets list
Besides, it doesn't need guestfs handle open so move this step earlier
in the process.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 14:45:41 +01:00
Roman Kagan
d59a43aa65 v2v: factor out overlay creation
Iterating over source disks and creating temporary overlays for easy
rollback fits nicely into a separate function.  In addition, determining
their size doesn't need to wait until the guestfs is launched: the size
can be obtained via disk_virtual_size() method.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 14:45:41 +01:00
Roman Kagan
3ca8c04273 v2v: factor out opening input VM
Opening the source VM and amending the properties in its internal
representation in accordance with command-line options fit nicely into
two isolated functions.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 14:45:41 +01:00
Richard W.M. Jones
754a43142c inspect: Include more information for augeas parse errors (RHBZ#1229119)
If Augeas fails to parse a file, more information is available in at
least these fields:

><fs> aug-ls /augeas/files/etc/fstab/error
/augeas/files/etc/fstab/error/char
/augeas/files/etc/fstab/error/lens
/augeas/files/etc/fstab/error/line
/augeas/files/etc/fstab/error/message
/augeas/files/etc/fstab/error/pos

Pull out some of these fields and add them to the error message.
The new error message looks like this:

  virt-v2v: error: libguestfs error: /etc/fstab:17:4: augeas parse failure:
  Iterated lens matched less than it should

This updates commit 279addeb7d.
2015-10-16 10:22:00 +01:00
Richard W.M. Jones
bc2b417784 lib: Define HAVE_LIBVIRT_BACKEND where you have too old libvirt to run the backend.
In the case where libvirt was installed, but is too old to run the
backend, the libvirt backend would be compiled out but still
referenced by the library.

Fix this by splitting the definition of HAVE_LIBVIRT (libvirt is
installed at all) and HAVE_LIBVIRT_BACKEND (libvirt is new enough to
run the libvirt backend).

Reported by: Efstratios Skleparis.
2015-10-16 10:01:36 +01:00
Pino Toscano
279addeb7d inspect: check for errors in files parsed with augeas (RHBZ#1229119)
During the inspection phase, check for errors after aug_load: if any of
the errors happened in any of the requested files, then report the error
straight away; ignoring the error means that information would be
silently lost.  For example, a malformed /etc/fstab would have caused
the inspection to not handle any of the additional mount points, giving
cryptic errors later on when trying to access files in any of the mount
points.

Now guests with invalid files such as /etc/fstab, /etc/mdadm.conf, and
/etc/sysconfig/network will cause the inspection to fail, instead of
being reported with a single mount point ('/').
2015-10-15 18:14:49 +02:00
Pino Toscano
45bb7c8bcb mllib: move is_regular_file there
Move the is_regular_file function, implemented in virt-dib and virt-v2v,
to Common_utils.
2015-10-15 16:24:25 +02:00
Richard W.M. Jones
42c60abfbd v2v: Curry Changeuid.func. 2015-10-15 14:38:29 +01:00
Richard W.M. Jones
01ede002db v2v: Rename Kvmuid module to Changeuid.
It has nothing to do with KVM.
2015-10-15 14:32:30 +01:00
Richard W.M. Jones
2587db8f18 Version 1.31.17. 2015-10-15 14:24:10 +01:00
Richard W.M. Jones
b50f341576 v2v: Add unit test for virtio_iso_path_matches_guest_os. 2015-10-15 13:23:29 +01:00
Richard W.M. Jones
6b02513bb2 v2v: Rename match_vio_path_with_os -> virtio_iso_path_matches_guest_os.
Just refactoring.  Having the function name begin with 'match' was a
bit confusing because it can look similar to a match statement.
2015-10-15 12:25:04 +01:00
Richard W.M. Jones
2cb86bc4dc lib: Add comment and regression test for case where main process has large heap.
Thanks: Dan Berrangé for identifying the problem.
2015-10-15 11:04:48 +01:00
Richard W.M. Jones
25bde98cb1 lib: info: Move common code for setting child rlimits.
This is almost just refactoring, but I also set the memory
limit to really 1 GB, and not 1×10⁹.
2015-10-15 11:04:48 +01:00
Roman Kagan
169bc884a5 v2v: drop useless forced gc
Now that virtio driver copying is localized in a single function and the
auxiliary guestfs handle doesn't leak outside of it (and thus an extra
qemu instance doesn't survive beyond that function's runtime) there's no
need in the forced GC which used to trigger closing of that handle and
termination of that qemu instance.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-15 11:04:48 +01:00
Roman Kagan
f7249a0bcc v2v: copy virtio drivers without guestfs handle leak
Refactor copying of virtio windows drivers into the guest so that the
matching of the drivers to the guest os flavor and copying the files
happens one next to the other in a single function, and no guestfs
handle (nor any other irrelevant info) is leaked outside.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-15 11:04:48 +01:00
Roman Kagan
4ff0bfc336 v2v: consolidate virtio-win file copying
Copy the appropriate driver files from the virtio-win storage into
%SYSTEMROOT%\Drivers\VirtIO once they are discovered, and stick to using
those copies later on.

This way the knowledge of where the drivers come from originally is
consolidated in one place, so the lifetime of the associated entities
becomes easier to control (to be implemented in followup patches).

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-15 11:04:48 +01:00
Maxim Perevedentsev
a5e7823c92 New API: resize2fs_P
Added support for getting ext2/3/4 filesystem minimum size.
This is needed primarily for shrinking images.
2015-10-14 17:11:54 +01:00
Richard W.M. Jones
3bf70226f6 v2v: test harness: Suggest using make check -k. 2015-10-14 14:45:48 +01:00
Richard W.M. Jones
b486ae1631 v2v: test harness: Use I<> quoting around command line parameter. 2015-10-14 14:45:29 +01:00
Pino Toscano
753bf99f5c builder: fix conversion of double to OCaml (RHBZ#1270011).
Create the OCaml value for double using caml_copy_double, which is
the correct way, simplier, and works.
2015-10-12 16:38:50 +02:00
Richard W.M. Jones
1f23a2c3a9 Version 1.31.16. 2015-10-09 17:55:19 +01:00
Richard W.M. Jones
9090408ea1 v2v: -i libvirt: Fix comment. 2015-10-09 17:46:36 +01:00
Richard W.M. Jones
5cdff50d8a v2v: Refactor the map_source_to_uri function.
Move this function to the VCenter module.  This is easier since it
doesn't have to do dcPath calculation (see previous commit).

The readhead parameter is no longer labelled.
2015-10-09 13:21:07 +01:00
Richard W.M. Jones
ffea9f9792 v2v: Use libvirt-supplied <vmware:datacenterpath> if available.
In libvirt >= 1.2.20, the VMware libvirt driver supplies the correct
dcPath to use via <vmware:datacenterpath> in the libvirt XML.  If
libvirt passes us this element, use it.

This code still allows the user to override dcPath using the --dcPath
option on the command line, but that's mainly for safety so we can fix
any problems in virt-v2v or libvirt in the field.  As we get more
confident in libvirt and as libvirt 1.2.20 is more widely adopted, we
will be able to deprecate this parameter entirely.

Thanks: Matthias Bolte for adding the <vmware:datacenterpath> element
to libvirt in
https://libvirt.org/git/?p=libvirt.git;a=commit;h=636a99058758a0447482f3baad94de8de3ab1151
2015-10-09 13:21:07 +01:00
Richard W.M. Jones
a8c725071d v2v: Move VCenter functions to library module.
This refactors useful VCenter functions out of the large
'input_libvirt_vcenter_https.ml' file.
2015-10-09 13:21:07 +01:00
Richard W.M. Jones
d4431886c7 v2v: Move curl functions to library module.
This refactors the curl functions used to talk to vCenter into a
library module.
2015-10-09 13:21:07 +01:00
Richard W.M. Jones
6fb4428358 v2v: Fix bogus comment. 2015-10-09 13:21:07 +01:00
Richard W.M. Jones
6334261497 inspect: Don't free uninitialized string.
libguestfs: trace: v2v: read_lines "/etc/os-release"
[...]
libguestfs: trace: v2v: read_lines = ["NAME=Fedora", "VERSION="20 (Heisenbug)"", "ID=fedora", "VERSION_ID=20", "PRETTY_NAME="Fedora 20 (Heisenbug)"", "ANSI_COLOR="0;34"", "CPE_NAME="cpe:/o:fedoraproject:fedora:20"", "HOME_URL="https://fedoraproject.org/"", "BUG_REPORT_URL="https://bugzilla.redhat.com/"", "REDHAT_BUGZILLA_PRODUCT="Fedora"", "REDHAT_BUGZILLA_PRODUCT_VERSION=20", "REDHAT_SUPPORT_PRODUCT="Fedora"", "REDHAT_SUPPORT_PRODUCT_VERSION=20"]

At this point libguestfs segfaulted.

It seems as if 'major' is not used here, so don't try to free it.

This fixes commit 32d19e3289.
2015-10-09 12:35:06 +01:00
Richard W.M. Jones
4f9899dd01 Version 1.31.15. 2015-10-08 22:05:19 +01:00
Richard W.M. Jones
48ae2d1dd1 handle: Free g->identifier on close.
This fixes commit f6e13aeb65.
2015-10-08 21:49:37 +01:00
Richard W.M. Jones
108c8173fa v2v: Add xpath_int64 functions, and use them to read memory values.
On 32 bit platforms, reading the memory values can cause some numbers
to be read as negative numbers.  Fix this by treating memory values as
64 bit integers throughout the parsing and calculation.
2015-10-08 20:14:04 +01:00
Richard W.M. Jones
37360159bf Version 1.31.14. 2015-10-08 19:51:43 +01:00
Richard W.M. Jones
e5fd9b54dd test/qemu: Fix free/close of log file.
The log file was not being closed at the right time, resulting in the
process running out of open files.  Also the log filename buffer was
not freed.

This fixes commit 7bbf5cab28.
2015-10-08 17:04:05 +01:00
Richard W.M. Jones
bd0b52d08e v2v: Use handle identifier in a few places.
Set the handle identifier of the main handle to "v2v".

Whenever we open a second handle for any substantial operation, set
the handle identifier for that handle too.

This should make traces clearer.
2015-10-08 16:52:43 +01:00
Roman Kagan
a94019f52f v2v: add test for v2v with virtio-win drivers on iso
For that, add autofoo machinery to generate the iso out of the fake
virtio-win drivers introduced in the previous patches, and pass the
resulting image in $VIRTIO_WIN to v2v in a new test otherwise similar to
test-v2v-windows-conversion.sh.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-08 16:37:19 +01:00
Roman Kagan
3c26dbf309 v2v:tests: use fake virtio-win drivers
In order to test the copying of virtio-win drivers into the guest during
v2v, create a set of fake virtio-win drivers and make use of them in the
corresponding v2v tests.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-08 16:37:18 +01:00
Richard W.M. Jones
7bbf5cab28 tests/qemu: Add qemu-boot --log option.
This option can be used to direct output from each individual
boot test to a different file.  Usual usage is:

  qemu-boot --log /tmp/output.% -v -x -n 1000
2015-10-08 16:35:25 +01:00
Richard W.M. Jones
f291411f76 Add the thread identifier to various multi-threaded programs and tests. 2015-10-08 16:35:24 +01:00
Richard W.M. Jones
f6e13aeb65 New APIs: set-identifier, get-identifier
Add a per-handle identifier.  The main effect of this is to change
trace output from:

  libguestfs: trace: foo

to:

  libguestfs: trace: ID: foo

which makes it simpler to follow traces from multi-threaded programs.
2015-10-08 16:35:24 +01:00
Roman Kagan
5f352f6eea v2v:test:win: actually check the eventual layout
v2v/test-v2v-windows-conversion.sh used to query if the expected
directories and files were present in the VM upon conversion; however it
would ignore the results of that query.

That lead to the test passing even though the checks failed.

To fix it, parse the output of guestfish and verify that all is-file and
is-dir commands report the expected "true".

The approach taken is slightly more elaborate than what is being used in
other components, but it allows to generate comprehensible reports in
case of test failure, and facilitates future expansion of the set of
checks including negative ones.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-08 16:34:48 +01:00
Roman Kagan
2fabb89fee v2v: add fake rhev-apt.exe
Without rhev-apt.exe the code path where firstboot scripts are created
isn't taken, so it isn't tested and v2v/test-v2v-windows-conversion.sh
is supposed to fail (it actually doesn't but for another reason,
addressed in a followup patch).

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-08 16:34:48 +01:00
Roman Kagan
c1af1ba32f v2v:tests: use fake rhsrvany.exe
The tests that depend on rhsrvany.exe being available, actually don't
need it to be the real one: all they want is the file being present.

So, instead of skipping the tests if the real rhsrvany.exe is not found,
store a fake one in the repository, and point $VIRT_TOOLS_DATA_DIR at
its location.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-08 16:34:48 +01:00
Pino Toscano
0f414edd11 build: use libintl where needed
Followup of commit a5426cce5f.
2015-10-08 16:31:54 +02:00
Pino Toscano
4d3466af68 fuse: test-fuse: close files even on errors
Make sure to close the open files even when test_fuse() returns earlier
because of failures, otherwise the mountpoint is still in use by open
files when later guestunmount is called on it.
2015-10-08 13:34:03 +02:00
Richard W.M. Jones
411e8e30e7 v2v: Skip test-v2v-o-libvirt.sh on !x86_64. 2015-10-07 17:26:22 +01:00
Richard W.M. Jones
95fe361215 Version 1.31.13. 2015-10-07 14:24:37 +01:00
Richard W.M. Jones
b1f11ef75b ocaml/examples: Fix use of event_callback in debug_logging.ml.
This fixes commit 8bbc5e73cb.
2015-10-07 14:16:00 +01:00
Richard W.M. Jones
a332e23dde ocaml/examples: Remove all programs in 'make clean'.
Previously the debug_logging program was not being deleted.
2015-10-07 14:15:05 +01:00
Richard W.M. Jones
9c97cc720b Version 1.31.12. 2015-10-07 14:02:56 +01:00
Richard W.M. Jones
63d1a8050a configure: Check that OCaml version >= 3.11. 2015-10-07 13:25:32 +01:00
Richard W.M. Jones
585a7e1f3e ocaml: Add regression test for failure of implicit close. 2015-10-06 22:28:54 +01:00
Richard W.M. Jones
8bbc5e73cb ocaml: Allow Guestfs.t handle to be garbage collected.
** NB: This is an API break for OCaml programs using Guestfs.event_callback. **

Because of the way I implemented Guestfs.event_callback which had the
Guestfs.t handle as the first parameter, we had to store the (OCaml)
Guestfs.t handle in the C handle's private data area.  To do that, we
had to create a global root pointing to the handle.

This of course meant that the handle could not be garbage collected
(thanks Roman Kagan for spotting this).

This changes the API of Guestfs.event_callback so that a handle is no
longer passed.  The OCaml handle can now be garbage collected again.

For programs that need the Guestfs.t handle in the callback function
(which turns out to be *none* of the OCaml programs we have written),
you can do:

  g#set_event_callback (callback_fn g) [Guestfs.EVENT_FOO];

In this case, since the closure passed to Guestfs.set_event_callback
is still registered as a global root, that will capture a reference to
the handle, so the handle won't be able to be garbage collected until
you delete the callback.
2015-10-06 22:28:27 +01:00
Richard W.M. Jones
3858db9d58 ocaml: Use generational global roots.
These are considerably more efficient than ordinary global roots, but
with the caveat that the program is not allowed to modify them without
calling a special function.  We don't modify them, so this change is
safe.

This requires OCaml >= 3.11, but we have that on RHEL 6
(since we dropped support for RHEL 5).

See also:
http://caml.inria.fr/pub/ml-archives/caml-list/2008/03/c3bf86990088236ceeb9a0f0f4c35390.en.html
2015-10-06 15:53:31 +01:00
Richard W.M. Jones
0944acf90c mllib: Replace various ad hoc string_* functions with String.*
This is just a straight refactoring.  Various ad hoc string_*
functions that appeared in Common_utils have been renamed and placed
in the String.* namespace.  The old vs "new" functions are:

string_prefix  -> String.is_prefix
string_suffix  -> String.is_suffix
string_find    -> String.find
replace_str    -> String.replace
string_nsplit  -> String.nsplit
string_split   -> String.split
string_lines_split -> String.lines_split
string_random8 -> String.random8
2015-10-06 13:40:34 +01:00
Richard W.M. Jones
47892b580b mllib: Hide unsafe lower/uppercase functions.
The ones in the OCaml stdlib assume ISO-8859-1 bytes and strings, and
so can end up corrupting UTF-8 strings.
2015-10-06 12:50:36 +01:00
Richard W.M. Jones
932e5ad089 mllib: Add (Char|String).(lower|upper)case_ascii functions.
These functions come from upstream OCaml (4.03) where they were
written by Gabriel Scherer under a compatible license.

See also:
http://caml.inria.fr/mantis/view.php?id=6694
http://caml.inria.fr/mantis/view.php?id=6695
2015-10-06 12:49:47 +01:00
Richard W.M. Jones
672920f3e9 mllib: Override Char and String modules from stdlib.
In Common_utils, override the Char and String modules from stdlib.
This hides the original (stdlib) modules, and means that whenever you
use Char.foo or String.foo you are in fact calling the
Common_utils.Char.foo or Common_utils.String.foo function.

As it stands, this change does nothing, but it will allow us to drop
unsafe functions (like String.lowercase) and add extra functions.
2015-10-06 12:34:30 +01:00
Richard W.M. Jones
7d7a1aeeac mllib: Don't alias G = Guestfs in Common_utils module. 2015-10-06 12:23:21 +01:00
Richard W.M. Jones
bdedb47cf0 tests: Don't leave a libguestfs tmpdir lying around after running test-launch-race.pl.
Calling _exit(2) in the child process has the side effect that
tmp/libguestfsXXXXXX is not cleaned up.  Clean it up by ensuring the
handle is properly closed before _exit.
2015-10-06 11:47:08 +01:00
Richard W.M. Jones
3b56001583 tests: Fix test-launch-race.
This test has been broken for a while.  It is meant to test that when
the appliance cachedir is empty, two simultaneous runs of libguestfs
(both rebuilding the full appliance) will not cause conflicts, because
(eg) the locking in either supermin or libguestfs is not working.

However the test only set $TMPDIR, but the ./run script sets
$LIBGUESTFS_CACHEDIR which overrides $TMPDIR, so it was simply reusing
the existing appliance, and hence not testing anything.

Fix this by clearing $LIBGUESTFS_CACHEDIR.

Note the test now takes a lot longer to run since it does a full
appliance rebuild.
2015-10-06 11:44:48 +01:00
Richard W.M. Jones
cab3d5d2f6 builder: Remove duplicate planner transition.
Seems to be a copy and paste bug in
commit 62cc7d3361.
2015-10-06 11:22:21 +01:00
Richard W.M. Jones
540ce6a4e5 clean: Remove null.* and sockets from builddir tmp/ subdirectory. 2015-10-05 22:00:13 +01:00
Richard W.M. Jones
fe4630e033 Update translations from Zanata.
However I reverted the Catalan file since it did not appear to be
newer than the version provided in
commit 6404114515.
2015-10-05 20:39:31 +01:00
Richard W.M. Jones
dd1dbc5191 Version 1.31.11. 2015-10-05 17:13:18 +01:00
Pino Toscano
7c1bb1b40c p2v: fix mode for gtk_label_set_line_wrap_mode
Accoding to its documentation [1], it takes as second parameter a
PangoWrapMode and not a GtkWrapMode.  While the change should reflect
the actual value intended, it should slightly change the label wrap
mode: GTK_WRAP_WORD is 2, which corresponds (as int value) to
PANGO_WRAP_WORD_CHAR.

[1] https://developer.gnome.org/gtk2/stable/GtkLabel.html#gtk-label-set-line-wrap-mode
2015-10-05 15:43:35 +02:00
Pino Toscano
29e6368f4c daemon: use str_udevadm in udev_settle
There is GUESTFSD_EXT_CMD defining a string for udevadm (so it is marked
as "used tool" in the appliance), but it is not actually used when
starting udevadm.

There should be no behaviour change.
2015-10-05 15:43:35 +02:00
Pino Toscano
d98c9c0e0b Fix shebang in perl scripts
Instead of hardcoding the location of perl (assuming it is installed in
/usr), use /usr/bin/env to run it, and thus picking it from $PATH.
This makes it possible to run these scripts also on installations with
perl in a different prefix than /usr.

Also, given that we want enable warnings on scripts, turn the -w
previously in shebang to explicit "use warnings;" in scripts which
didn't have it before.
2015-10-05 15:43:35 +02:00
Pino Toscano
1e0cbe6681 lib: include <sys/socket.h> for accept4
Apparently implicitly pulled by something else on Linux, it is not when
building on e.g. FreeBSD.

This reverts the change to this file of
commit 3b17152ec3.
2015-10-05 15:43:35 +02:00
Pino Toscano
b530bc764e Revert "lib: Don't need to include <rpc/types.h>."
The include is not needed with GNU libc, where rpc/xdr.h includes it
[1].  But this does not happen on other libc's, for example the
FreeBSD [2] and Mac OS X [3] ones.

Hence put it back, with an extra comment about this.

[1] http://linux.die.net/man/3/xdr
[2] http://www.freebsd.org/cgi/man.cgi?query=xdr&sektion=3&apropos=0&manpath=freebsd
[3] https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/xdr.3.html

This reverts commit ada85d1566.
2015-10-05 15:43:35 +02:00
Richard W.M. Jones
8554dbbc03 Remove multiple hacks that only apply to RHEL 5.
We don't support RHEL 5 upstream (see the 'oldlinux' branch for a
version that works with RHEL 5).  Therefore remove a bunch of hacks
that were only needed on RHEL 5.
2015-10-05 14:32:28 +01:00
Richard W.M. Jones
677c721e85 Fix whitespace.
Because of previous automated commits, such as changing 'guestfs___'
-> 'guestfs_int_', several function calls no longer lined up with
their parameters, and some lines were too long.

The bulk of this commit was done using emacs batch mode and the
technique described here:

  http://www.cslab.pepperdine.edu/warford/BatchIndentationEmacs.html

The changes suggested by emacs were then reviewed by hand.
2015-10-05 14:28:33 +01:00
Richard W.M. Jones
d07b32e14f Change 'fprintf (stdout,...)' -> printf.
Result of earlier copy and paste.
2015-10-05 14:28:33 +01:00
Roman Kagan
82763c0444 v2v:utils: ignore files w/o extension
When searching for virtio drivers, it makes no sense to fail if we
encounter a file without extension.

Ignore such files instead, just like we do for the files whose extension
doesn't match that of a driver-related file.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-05 14:28:33 +01:00
Pino Toscano
1f47ba92f2 actions: fix documented limit for btrfs labels
Our documentation of set-label says that labels for btrfs are limited
to 256 characters, while btrfs-filesystem(1) says:

  Note
  the maximum allowable length shall be less than 256 chars

which is indeed true, as trying to set a label with 256 characters
fails. Hence, fix our documentation to say that the limit is actually
255 characters.

Related to RHBZ#1164708.
2015-10-05 11:41:03 +02:00
Richard W.M. Jones
67bd4f37a1 Version 1.31.10. 2015-10-04 20:03:46 +01:00
Richard W.M. Jones
5d2ebb7076 launch: direct: Use a single -machine [type, ]accel=... option.
Previously we used (on arm): -M virt -machine accel=...

After this change, we use: -machine virt,accel=...
On x86 there is no change.

The -M option is an abbreviation for -machine, and we can combine the
two options together.  (Qemu combines the two options internally, but
it's more predictable if we do it ourselves).

Upstream qemu has supported the -machine option for over 5 years, and
in fact we implicitly relied on it (despite what the comment in the
code said).
2015-10-04 19:20:35 +01:00
Richard W.M. Jones
45cc5489b2 launch: Change comment.
Making -machine configurable would be a really bad idea.
2015-10-04 19:20:35 +01:00
Cédric Bosdonnat
bc8e1ff9ae customize: remove zypper's gpg keys auto-import
This option was considered unsecure, found a fix on the generated
opensuse images instead.
2015-10-02 17:21:47 +01:00
Pino Toscano
9c836e8669 ruby: improve rdoc markup
- fix the syntax of hyperlinks
- replace the deprecation text with a simplier named list item, so it's
  more visible
- use a named list item for the pointer to the C documentation of each
  API
- add a named list item for the version of each API
2015-10-02 15:30:38 +02:00
Robert Antoni Buj Gelonch
6404114515 add Catalan in po/Makefile.am 2015-10-02 12:25:20 +01:00
Richard W.M. Jones
7bc6fb2451 build: Remove ./configure --enable-valgrind-daemon.
If you've ever tried to use this option, you'll know that it didn't
work well.  It broke random things (probably RHBZ#1020216, definitely
RHBZ#1023630), and caused random failures generally, while often not
actually failing when valgrind itself found problems.
2015-10-01 15:32:49 +01:00
Richard W.M. Jones
4414de775a ocaml: Conditionally remove bindtests.* when doing 'make install'.
Commit f6a790b67d changed the Makefile
so it only builds the tests when you run 'make check'.

If you didn't run 'make check' then (in particular) bindtests won't be
built, and so when you install it cannot be removed.

The simple fix for this is to make the removal of bindtests.*
conditional.

This fixes commit f6a790b67d.
2015-10-01 14:17:52 +01:00
Richard W.M. Jones
2c519cf055 Add missing generated files to generator_built and EXTRA_DIST.
Use the generator_built variable to list any files which are built by
the generator.  This ensures they get automatically rebuilt.

Three files were missing from EXTRA_DIST, so they were not included in
the tarball, meaning you would have needed OCaml to build from the
tarball.  You would have seen this when building:

  cd .. && /builddir/build/BUILD/libguestfs-1.31.9/generator/generator
  written gobject/docs/guestfs-title.sgml
  written customize/customize-synopsis.pod
  written customize/customize-options.pod
  generated 476921 lines of code
2015-10-01 14:13:30 +01:00
Cédric Bosdonnat
3b4f83e0b2 customize: sles password defaults. 2015-10-01 13:01:59 +01:00
Richard W.M. Jones
24d2230831 Version 1.31.9. 2015-09-30 17:30:47 +01:00
Cédric Bosdonnat
d0aa7a032c Add opensuse.gpg to the dist tarball
Adding missing opensuse.gpg to EXTRA_DIST.
2015-09-30 16:04:12 +01:00
Richard W.M. Jones
3f3d9353a3 ocaml: Improve ocamldoc.
Miscellaneous improvements to the ocamldoc:

 - Generate more sub-headings.

 - Document the object-oriented API.

 - Use a common function to generate the doc for module and OO APIs.
2015-09-30 14:19:12 +01:00
Richard W.M. Jones
b482593a07 ocaml: Use ocamlfind to run ocamldoc.
Using 'ocamlfind ocamldoc' is much faster than running 'ocamldoc'
directly, because ocamlfind will run the native code program
'ocamldoc.opt' if it is available.

This change approximately halves the time taken to compile the ocaml
bindings.
2015-09-30 13:33:39 +01:00
Richard W.M. Jones
84598ef6f5 daemon: Compile stubs.c first.
This shaves about 20% off the compile time for the daemon subdirectory.

See also:
https://rwmj.wordpress.com/2015/09/30/make-and-queuing-theory/#content
2015-09-30 13:33:39 +01:00
Richard W.M. Jones
538c5d5eb7 java: Only build the tests when running 'make check'.
Make the tests 'check_DATA' so they only get built when running the
tests.
2015-09-30 13:33:39 +01:00
Richard W.M. Jones
f6a790b67d ocaml: Only build the tests when running 'make check'.
Make the tests 'check_DATA' so they only get built when running the
tests.  This saves a couple of seconds on the build time.
2015-09-30 13:33:39 +01:00
Richard W.M. Jones
3b17152ec3 lib: Remove unused header files.
I used ESR's deheader program to look for unused includes.  I then
examined each instance by hand, and also test-compiled (on Linux).
2015-09-30 13:32:42 +01:00
Richard W.M. Jones
ada85d1566 lib: Don't need to include <rpc/types.h>.
It is already included by <rpc/xdr.h>.
2015-09-30 13:32:42 +01:00
Richard W.M. Jones
c938202bc8 lib: Move <libintl.h> -> files that use it.
Don't include <libintl.h> (for gettext etc) in <guestfs-internal.h>.
Include include it only in files that use internationalized strings.
2015-09-30 13:32:42 +01:00
Pino Toscano
2ff115a736 copy-in: error out early if the localpath does not exist 2015-09-30 10:55:38 +02:00
Cédric Bosdonnat
4bb4c0f4f7 builder: add opensuse images sources 2015-09-30 10:55:37 +02:00
Richard W.M. Jones
8571c1298a haskell: Remove whitespace in Makefile.am. 2015-09-29 22:45:19 +01:00
Richard W.M. Jones
491b3d4f44 Version 1.31.8. 2015-09-29 19:02:33 +01:00
Cédric Bosdonnat
66efad4172 customize: get zypper to eat licenses and gpg keys
Without these flags --install will most likely fail as the GPG key
may no be imported in the guest image.
2015-09-29 17:48:19 +01:00
Richard W.M. Jones
bbc4a649b4 copy-in/copy-out: Capture errors from tar subprocess (RHBZ#1267032).
Modify the copy-in/copy-out APIs to use the new guestfs_int_cmd_pipe
internal API.

This new API allows us to capture the stderr from the tar subprocess
if it fails, fixing RHBZ#1267032.  The user will now see errors like
this:

$ guestfish -N fs -m /dev/sda1 copy-in '/tmp/d/*' / : ll /
libguestfs: error: tar subprocess failed: tar: *: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
2015-09-29 12:51:14 +01:00
Richard W.M. Jones
e98bb86929 cmd: New internal API for read/writing to a subprocess via a pipe.
Roughly equivalent to popen(...,"r"|"w") the new internal API allows
you to run a subprocess and either read its stdout, or write to its
stdin.
2015-09-29 12:51:13 +01:00
Richard W.M. Jones
2fc1e14625 cmd: Move all the common processing code for running the child into a subfunction.
Anything that doesn't involve pipes [parent-child communication] is
moved into the run_child function, so we can reuse the same code when
writing the new pipe APIs (see following commit).  Anything involving
setting up pipes stays in the existing run_command function.

This is just refactoring.
2015-09-29 12:45:22 +01:00
Richard W.M. Jones
60aa4238c4 lib: Move read_whole_file function into separate library.
Allow this useful function to be called from elsewhere.

This commit is almost, but not completely refactoring.  I made a minor
change to the function so that it \0-terminates the returned data,
which is convenient for some callers.
2015-09-29 12:44:25 +01:00
Richard W.M. Jones
73928e9e35 lib: Whitespace cleanups. 2015-09-29 11:16:38 +01:00
Richard W.M. Jones
1b6f0daa9a Revert "cmd: add a way to run (and wait) asynchronously commands"
This reverts commit c5d3d198dc.
2015-09-29 11:06:10 +01:00
Richard W.M. Jones
3c27f3d91e Revert "cmd: add the possibility to get a fd to the process stdin"
This reverts commit db055262d4.
2015-09-29 11:05:07 +01:00
Richard W.M. Jones
5786191718 v2v: Further information on using ovftool to create OVA files.
c9291a91b0 (commitcomment-13440884)

Thanks: GitHub user https://github.com/angystardust
2015-09-25 20:24:21 +01:00
Richard W.M. Jones
f37d363f18 v2v: Update /etc/sysconfig/kernel DEFAULTKERNEL (RHBZ#1176801). 2015-09-25 13:55:46 +01:00
Richard W.M. Jones
c9291a91b0 v2v: Mention ovftool in the man page as a way to create OVA files. 2015-09-25 10:36:36 +01:00
Richard W.M. Jones
2d1d485265 installcheck: Use 'make check -k' option.
Run all the tests, even if some of them fail, so you can easily see
the complete list of failures.  This still exits with an error if any
test fails.
2015-09-22 14:16:54 +01:00
Richard W.M. Jones
cc1c010aa0 Version 1.31.7. 2015-09-20 15:26:15 +01:00
Richard W.M. Jones
3fa674df5f Remove make-check-on-installed.pl from EXTRA_DIST.
Removed in commit f2540d68e4.
2015-09-18 17:31:21 +01:00
Richard W.M. Jones
dd61872582 configure: Require OCaml and findlib if we need to run the generator.
When building from git, you need OCaml to compile the generator to
build the generated files.  Previously configure didn't detect that
situation, resulting in failed builds.  This commit causes the
configure script to error out if the generated files are not present
and OCaml is not installed.

Note that you can still build without OCaml, if you get the generated
files from somewhere else.  The source tarballs distributed on the
website contain the generated files.
2015-09-18 15:55:57 +01:00
Richard W.M. Jones
bc0ea59587 v2v: documentation: Add link to import-to-ovirt.pl script. 2015-09-18 14:12:17 +01:00
Richard W.M. Jones
dda1a7c37c v2v: documentation: Add 'OTHER TOOLS' section.
This currently contains just a link to rhevm-image-uploader.
2015-09-18 14:12:17 +01:00
Richard W.M. Jones
38be2da9be python: Set program name to the true name instead of 'python'.
As in commit e102bcf3cf (for Perl), any
Python program has the handle program name field set to 'python'.  Set
it to the true name (derived from sys.argv[0]).
2015-09-18 14:12:17 +01:00
Richard W.M. Jones
bb7d088eda python: Allow bindings to be compiled with different version of libguestfs (RHBZ#1262983).
When compiling the libguestfs bindings as a pip module, it's helpful
if you can compile the bindings with a different version of libguestfs
(eg. installed 1.28, pip module 1.30).

That broke the previous assumption that we were always compiling
against precisely the same version of libguestfs (which made sense
because the python bindings are part of the libguestfs source tree).

Python distutils has no way to check a C library to find out if
functions are defined.  Therefore we have to rely on GUESTFS_HAVE_*
macros from <guestfs.h>.
2015-09-18 14:12:17 +01:00
Richard W.M. Jones
ac5b3a050d header: Define GUESTFS_HAVE_STRUCT_* for each struct defined in the header. 2015-09-18 14:12:17 +01:00
Richard W.M. Jones
a17627cdd2 header: Define GUESTFS_HAVE_* for every function.
Previously we only defined GUESTFS_HAVE_* macros for functions that
were not deprecated, test or debug functions.  The reasoning for that
is given in this commit message [note that 'LIBGUESTFS_HAVE_' is the
old/deprecated macro]:

  commit 2d8fd7dacd
  Author: Richard Jones <rjones@redhat.com>
  Date:   Thu Sep 2 22:45:54 2010 +0100

    Define LIBGUESTFS_HAVE_<shortname> for C API functions.

    The actions each have a corresponding define, eg:

      #define LIBGUESTFS_HAVE_VGUUID 1
      extern char *guestfs_vguuid (guestfs_h *g, const char *vgname);

    However functions which are for testing, debugging or deprecated do
    not have the corresponding define.  Also a few functions are so
    basic (eg. guestfs_create) that there is no point defining a symbol
    for them.

This wasn't in fact carried through very consistently, since when we
replaced s/LIBGUESTFS_HAVE_/GUESTFS_HAVE_/, we kept the old
LIBGUESTFS_HAVE_* macros, but defined them for every function.  Oops.

This commit defines GUESTFS_HAVE_* for every function in <guestfs.h>,
making it easier to write the Python language bindings (see following
commits).
2015-09-18 14:12:17 +01:00
Richard W.M. Jones
f2540d68e4 Add 'make installcheck' rule to test installed packages.
Allow the tests to be run on the installed libguestfs.so library and
on installed programs (but not installed language bindings, yet).

To run the tests, you have to have a copy of the libguestfs source
tree with exactly the same version as the installed libguestfs.  You
have to build the libguestfs source tree.  Then you do:

  make installcheck

I investigated making automake 'make installcheck' work, but it's
basically broken (no surprise there).

This is derived from the old 'make-check-on-installed.pl'
script (which is also removed in this patch).
2015-09-18 14:12:17 +01:00
Pino Toscano
59a9101e44 daemon: initrd: print return value from failing process
If either zcat or cpio fails when spawned in initrd-list, pclose will
return the actual return value of it, but reply_with_perror still uses
errno regardless; thus, the reported error is:

  libguestfs: error: initrd_list: pclose: Success

which is not much helpful.

Instead, when pclose returns > 0, extract the actual return value of the
subprocess, and print that. Thus now we get for example:

  libguestfs: error: initrd_list: pclose: command failed with return code 1
2015-09-15 10:19:58 +02:00
Richard W.M. Jones
e102bcf3cf perl: Set program name to the true name instead of 'perl'.
Currently any Perl program has the handle program name field set
to 'perl'.  Set it to the true name (derived from $0).
2015-09-13 13:45:32 +01:00
Shahar Lev
1b856a20ba v2v: fix provides list whitespace trim
Tabs should not be doubly-escaped in regexp.

Signed-off-by: Shahar Lev <shahar@stratoscale.com>
2015-09-13 11:47:52 +01:00
Richard W.M. Jones
7fb21afff6 Version 1.31.6. 2015-09-11 15:28:39 +01:00
Richard W.M. Jones
edcd02a965 launch: libvirt: Better error when bridge / virbr0 doesn't exist (RHBZ#1262127).
The current diagnostic is terrible.  This one tells the user how to
diagnose and fix the problem.
2015-09-10 23:06:20 +01:00
Richard W.M. Jones
0ed3855098 v2v: Add --dcpath parameter to allow dcPath to be overridden (RHBZ#1256823).
It's currently impossible to correctly predict the dcPath parameter
from the data that libvirt gives us.  So allow the user to override
--dcpath themselves.

Eventually we will get better support in libvirt for this, and this
option will no longer be needed:

  https://www.redhat.com/archives/libvir-list/2015-September/thread.html#00201

This enhances commit 51bc573d0c
and commit 20f1eb400b.
2015-09-10 12:38:56 +01:00
Pino Toscano
1b8dd2150b builder: fix prototype virt_builder_yajl_tree_parse
Declare the prototype depending whether libyajl is available, and if it
isn't add also the noreturn attribute.

Fixes commit 87a42174f9.
2015-09-10 11:12:53 +02:00
Pino Toscano
32d19e3289 inspect: try to use /etc/os-release on Linux guests
If a Linux guest has /etc/os-release (mandatory for systemd, so all the
recent Linux distributions have it), try to parse it for the distro, its
version, and its product name.  If we cannot get all of them, the
detection as done so far continues.

Other than changes in the product_name string (which is free-form
anyway, and already documented to not be parseable), there should be no
regressions in the detected distro and version.
2015-09-09 16:17:59 +02:00
Richard W.M. Jones
e3aee9c14d v2v: -o rhev, -o vdsm: Set DefaultDisplayType back to 1 (RHBZ#1260590).
In commit c4bc8116d9, the DefaultDisplayType
was changed from 1 -> 2.  However this is in fact wrong.  See
https://bugzilla.redhat.com/show_bug.cgi?id=1260590#c17 for details.

This reverts the code back to what it was in
commit 829e3fe7a6.

Thanks: Omer Frenkel
2015-09-09 13:47:19 +01:00
Richard W.M. Jones
d68be534ea v2v: Detect AVG Technologies as AV software (RHBZ#1261436).
Thanks: Junqin Zhou
2015-09-09 13:33:12 +01:00
Richard W.M. Jones
6734fce8c8 v2v: Move anti-virus (AV) detection code to a separate module.
This is just code refactoring of earlier
commit 8e28d6b188.
2015-09-09 13:33:12 +01:00
Pino Toscano
27becc7e2f builder: handle output filenames with ':'
Use qemu_input_filename for the output file in the qemu-img convert
invocation.

See also commit 1709263613 for
virt-sparsify.
2015-09-09 13:19:57 +02:00
Pino Toscano
87a42174f9 builder: add noreturn for yajl functions without libyajl
caml_invalid_argument will not return, and GCC warns (or errors out with
-Werror) when the function is not marked as such.
2015-09-09 10:50:01 +02:00
Pino Toscano
1b4c1d74d3 customize: password: use SHA-512 on openSUSE >= 11.0
openSUSE 11.0 has glibc 2.8, which supports the SHA-512 method.
Fallback to an explicit MD5 for older versions.
2015-09-08 19:07:23 +02:00
Pino Toscano
f788b3c48d inspect: recognize the Frugalware distribution
Just basic identification, name and version.
2015-09-08 19:05:49 +02:00
Richard W.M. Jones
6c3bc24f90 Version 1.31.5. 2015-09-08 14:20:28 +01:00
Pino Toscano
6d08da07dc build: improve maintainer-check-extra-dist target
Filter out from the git ls-files output the files we don't care they
appeared (gnulib and intltools stuff), and use comm to only show the
remaining added files (i.e. files not being distributed).

The output of comm is redirected to file and then printed, so we can
check it is empty (failing the target if not).
2015-09-08 12:08:43 +02:00
Cédric Bosdonnat
fb9c17c8d4 Allow curl to follow redirects.
download.opensuse.org uses redirects to point to the relevant mirror.
Adding -L --max-redirs 5 to curl options will get us the requested
images.
2015-09-08 12:08:43 +02:00
Pino Toscano
268de62db6 builder: distribute simplestreams test files
Fixes commit b024aef6fb.
2015-09-08 11:51:49 +02:00
Pino Toscano
c8436df4a2 builder: replace colons in simplestreams test files
Colons won't be handled by make at all, so replace them with underscore
to be able to distribute them.
2015-09-08 11:51:49 +02:00
Richard W.M. Jones
c4bc8116d9 v2v: -o rhev, -o vdsm: Use correct DefaultDisplayType for qxl (RHBZ#1260590).
This fixes commit 829e3fe7a6.
2015-09-08 09:11:36 +01:00
Richard W.M. Jones
5ed4388ecd customize: Create .ssh as 0700 and .ssh/authorized_keys as 0600 (RHBZ#1260778).
Both ssh-copy-id and ssh create .ssh as 0700.  ssh-copy-id creates
.ssh/authorized_keys as 0600.

Thanks: Ryan Sawhill for finding the bug.
2015-09-08 09:09:40 +01:00
Pino Toscano
b024aef6fb builder: support Simple Streams v1.0 as index metadata
Add a new "simplestreams" repository type, and a simple parser for
fetching and reading the JSON indexes of the Simple Streams v1.0
format.

Read only datatype=image-downloads contents, and only the latest
versions of each content available as disk image (disk.img or
disk1.img).

Add a simple test, using the "released" images from the CirrOS project.
2015-09-08 09:51:49 +02:00
Pino Toscano
13eac43e28 build: expose HAVE_YAJL to automake
This way it can be used in automake conditionals.
2015-09-08 09:51:49 +02:00
Pino Toscano
23d1719105 builder: add simple libyajl binding
Only yajl_val and yajl_tree_parse are exposed for now.
2015-09-08 09:51:49 +02:00
Pino Toscano
7dfbb1f11c builder: add non-int revisions
Add support for non-integer revisions of entries, comparing them as
integer when possible.
2015-09-08 09:51:48 +02:00
Richard W.M. Jones
8e28d6b188 v2v: windows: Warn if Group Policy or AV software may result in 7B boot failure (RHBZ#1260689).
Check if the Windows guest has Group Policy Objects installed, or one
of several popular pieces of anti-virus software.  If we are
installing a virtio block driver, then experience has shown this may
cause a 7B boot failure.

Print a warning when this combination happens.

The warnings look like this:

[  19.9] Converting Windows Server 2008 R2 Enterprise to run on KVM
virt-v2v: warning: this guest has Windows Group Policy Objects (GPO) and a
new virtio block device driver was installed.  In some circumstances, Group
Policy may prevent new drivers from working (resulting in a 7B boot error).
 If this happens, try disabling Group Policy before doing the conversion.
virt-v2v: warning: this guest has Anti-Virus (AV) software and a new virtio
block device driver was installed.  In some circumstances, AV may prevent
new drivers from working (resulting in a 7B boot error).  If this happens,
try disabling AV before doing the conversion.
virt-v2v: This guest has virtio drivers installed.
2015-09-07 17:47:21 +01:00
Richard W.M. Jones
8f889f0c3e v2v: windows: Refactor Xen uninstaller detection code.
No change, just refactoring.
2015-09-07 17:17:49 +01:00
Richard W.M. Jones
4335088d74 dib: Move 'isdigit' utility function to common code.
No change, just simple refactoring.
2015-09-07 16:53:17 +01:00
Richard W.M. Jones
4ded4430bf v2v: -o rhev, -o vdsm: Add sound card to OVF output.
For the two sound card types that RHEV can emulate, add
them to the output.
2015-09-07 15:00:50 +01:00
Richard W.M. Jones
829e3fe7a6 v2v: -o rhev, -o vdsm: Review XML based on oVirt description of format.
After reviewing http://www.ovirt.org/images/8/86/Ovirt_ovf_format.odt
this commit makes some small revisions to the OVF that we generate.

Possible fix for https://bugzilla.redhat.com/show_bug.cgi?id=1260590
2015-09-07 15:00:44 +01:00
Richard W.M. Jones
e271992746 v2v: Error if certain options appear twice on the command line.
Change the handling of -ic, -if, -oc, -of, -on, -os, --password-file,
--vdsm-vm-uuid, --vdsm-ovf-output, --vmtype options, so that if any
appear multiple times on the command line we error out:

$ virt-v2v -i disk /tmp/centos-6.img -o null -of qcow2 -of raw
virt-v2v: error: -of option used more than once on the command line

Thanks: Juquin Zhou for finding the bug.
2015-09-07 12:18:21 +01:00
Richard W.M. Jones
0afe4773d0 Version 1.31.4. 2015-09-03 21:49:56 +01:00
Richard W.M. Jones
7e63d3680f v2v: test-harness: Allow test boot at fixed dates in the past.
Turns out that some of the Windows guests in the test suite try to
reactivate if the date is more than some time delta (maybe 1 year?)
after the previous activation.  Just disabling the network wasn't
enough to prevent this.

qemu allows us to boot guests with the clock set to a particular date
in the past, and libvirt exposes this (albeit very clumsily):

https://docs.fedoraproject.org/en-US/Fedora/18/html/Virtualization_Administration_Guide/sect-Virtualization-Tips_and_tricks-Libvirt_Managed_Timers.html

Allow guests to be booted with the date set to a particular past date,
by setting the test_plan.guest_clock field.

This required adding some more libxml2 bindings.
2015-09-03 20:11:07 +01:00
Richard W.M. Jones
6246bebf82 p2v: Clear previous version and driver information when testing connection (RHBZ#1227609).
When calling test_connection to test the connection to a conversion
server, we also query for the remote server's version and driver
information (using 'virt-v2v --version' and
'virt-v2v --machine-readable').

However we didn't clear the existing information from previous runs.

One consequence of this was that if you used the back button in the
GUI, the list of output drivers would be repopulated two or more
times.  https://bugzilla.redhat.com/show_bug.cgi?id=1227609

Another is that connecting to a different server could confuse
test_connection into thinking the connection was successful (because
of data from the previous run) when in fact it was not.

Thanks: Tingting Zheng for finding the original bug.
2015-09-03 16:12:22 +01:00
Richard W.M. Jones
302ea2aa5b p2v: Use gtk_list_store_clear instead of loop.
The model implements GtkListStore, so an easier way to clear the list
is simply to call the clear method.
2015-09-03 16:06:59 +01:00
Richard W.M. Jones
314713c3b0 p2v: Use GtkComboBoxText instead of deprecated gtk_combo_box_new_text.
Requires Gtk >= 2.24, which is the same version that RHEL 6 has.
2015-09-03 15:56:19 +01:00
Pino Toscano
cf3d93c826 get-kernel: respect -q
Now that virt-get-kernel has -q/--quiet, support it by printing the
download messages only if not specified.
2015-09-02 00:25:55 +02:00
Pino Toscano
45f6cfe1a1 get-kernel: refactor list and download code
Split in an own function the code dong the mounting, the inspection of
the kernel files, and the downloading, including a per-OS function for
the actual kernel files.  This gives few advantages:
- the download phease is not repeated for all the files to fetch
- it is easier to eventually support multi-root disk images
- it is possible to support OSes different than Linux; virt-get-kernel
  now will just report the unsupported OS, instead of a generic
  "no kernel found" message

This is mostly code refactoring, with (on Linux) no actual behaviour
change.
2015-09-02 00:25:55 +02:00
Pino Toscano
997c59139e get-kernel: split command line handling in own function
Simple refactoring, no actual behaviour changes.
2015-09-02 00:25:55 +02:00
Pino Toscano
b360e99ff6 builder, dib, get-kernel: document new -q/--quiet options
Provided as common options for all the OCaml-based tools.
2015-09-02 00:25:55 +02:00
Pino Toscano
2ec0332e5e mllib: move -q/--quiet as common option
Most of the OCaml-based tools had it already, except from virt-dib and
virt-get-kernel.
2015-09-02 00:25:55 +02:00
Pino Toscano
875f46fddc mllib: make few command line options stuff private
Make print_version_and_exit, long_options, display_short_options, and
display_long_options private, as set_standard_options now takes care of
handling the job for the common command line options.
2015-09-02 00:25:55 +02:00
Richard W.M. Jones
51bc573d0c v2v: Fix handling of extra slashes in dcPath calculation (RHBZ#1258342).
This updates commit 20f1eb400b.

Thanks: Tingting Zheng
2015-09-01 14:56:10 +01:00
Pino Toscano
4cc3cc3fbd mllib: set --debug-gc as common option
Move --debug-gc as common option for all the OCaml-based tools, even a
couple of them which didn't have it previously.

As implementation note, make set_debug_gc private to
set_standard_options, as it needed to be moved otherwise, and it is no
more required as public function.
2015-08-31 18:34:37 +02:00
Pino Toscano
2af6e48ba3 mllib: add and use set_standard_options
Introduce a new common helper to add the common options for libguestfs
tools (short/long options, version, verbose, trace), and sort them.
All the OCaml-based tools had these options already, so there are no
functional changes in the interface they provide.

The only difference is that now the options are always sorted, while
some tools didn't had them like that previously: because of this, a
couple of ditto markers (as descriptions) don't match what's above them
anymore, and thus their full description is put instead.
2015-08-31 18:25:48 +02:00
Pino Toscano
7bdb3e0df9 customize: fix running commands on the same architecture
Wrap the command around an heredoc only if setarch needs to be used;
otherwise the heredoc will not be run at all.

Fix commit d875346ad4.
2015-08-31 17:55:14 +02:00
Richard W.M. Jones
2596b78bcb Version 1.31.3. 2015-08-28 19:34:15 +01:00
Richard W.M. Jones
95233a8eee p2v: Add test-virt-p2v-pxe.sshd_config.in to EXTRA_DIST.
Fixes commit afe3c77014.
2015-08-28 19:32:15 +01:00
Richard W.M. Jones
d875346ad4 customize: Use setarch when running commands on i686 guest (RHBZ#1256405).
When running (eg) dnf on a 32 bit i686 guest when the host is 64 bit
x86_64, dnf believes it is running on a 64 bit machine and so tries to
install x86_64 packages.  We can 'trick' dnf into believing it's a 32
bit machine using the setarch program.

$ virt-builder fedora-22 --arch i686 --install 'gperf'
...
[  27.4] Installing packages: gperf
...
Running transaction test
Error: Transaction check error:
  package libgcc-5.1.1-4.fc22.x86_64 is intended for a different architecture
...

The use of a heredoc to solve quoting issues comes from:
http://stackoverflow.com/a/3435460

Thanks: Jan Sedlák for finding the solution.
2015-08-28 19:09:17 +01:00
Richard W.M. Jones
18b019e3dd v2v: -i libvirtxml: Map empty network or bridge name to default (RHBZ#1257895).
As with the -i ova driver, if an unnamed network is found, map it to
"eth0", "eth1" etc.
2015-08-28 19:09:17 +01:00
Richard W.M. Jones
261d05749f v2v: Convert xpath_to_* to use xpath convenience functions.
In -i libvirtxml, -i ova and -o libvirt drivers, replace the ad hoc
xpath_to_* functions with use of the new xpath convenience functions
introduced in the previous commit.

This is not entirely refactoring because I fixed a few bugs found by
type safety.
2015-08-28 19:09:17 +01:00
Richard W.M. Jones
00e1260d34 v2v: Add convenience functions for parsing xpath expressions. 2015-08-28 19:09:17 +01:00
Richard W.M. Jones
20f1eb400b v2v: vcenter: Calculate dcPath correctly (RHBZ#1256823).
Previously given a path such as:

  vpx://vcenter/Folder/Datacenter/esxi

we calculated dcPath=Folder.  However this is obviously wrong.  We
should chop the path at the final (esxi) element to give
dcPath=Folder/Datacenter.
2015-08-28 17:53:41 +01:00
Richard W.M. Jones
1585bb5bee v2v: vcenter: Change function get_datacenter -> get_dcPath.
In vCenter, the datacenter is identified by a path, and the parameter
used for this is called 'dcPath'.  Rename the function to avoid any
confusion about what we're getting here.

This is just renaming function/variable names and has no other effect.
2015-08-28 17:53:41 +01:00
Roman Kagan
a628fb65fa handle --debug-gc universally via at_exit hook
Several tools handle --debug-gc command-line option, by explicitly
forcing GC on every exit path.  This is tedious and prone to forgetting
some of the exit paths.

Instead, add a generic handler for --debug-gc, which installs an at_exit
hook to do the GC consistency check, and which can be called right in
the command-line parser.  Also adjust all users of --debug-gc to use
that handler.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-08-28 17:53:41 +01:00
Richard W.M. Jones
afe3c77014 p2v: Add a test for the PXE boot path (RHBZ#1256222).
Build the P2V disk image and boot it.  We don't actually use PXE
specifically, but we do test the whole PXE / kernel command line path
much more thoroughly.

This is a 'check-slow' test because it takes ages to run.
2015-08-27 15:42:55 +01:00
Richard W.M. Jones
ca4725e1c7 p2v: Add SSH Identity URL.
Allow SSH identities (ie. secret keys) to be used for authentication
instead of passwords.
2015-08-27 15:42:55 +01:00
Richard W.M. Jones
3c30fb4a79 Revert "p2v: Add tip about the root password of the virt-v2v conversion server appliance."
This reverts commit 35efaf8208.
2015-08-27 15:42:55 +01:00
Richard W.M. Jones
4c34d240a1 p2v: Wait for network to come online before testing connection (RHBZ#1256222).
When using the virt-p2v ISO in command line mode, we did not wait for
the network to come online before starting virt-p2v.  Therefore
virt-p2v could exit with an error when testing the ssh connection (or
on the other hand, it might work randomly).  If the user logs in and
runs 'launch-virt-p2v' by hand, then it would usually work because the
network had been brought online in the meantime.

Fix this by waiting for NetworkManager to bring the connection online
before calling test_connection().  Note that the obvious way to fix
this (changing the systemd service to wait for network-online.target)
does *not* work - I added a comment to the service about this.

Thanks: Tingting Zheng
2015-08-27 15:42:55 +01:00
Pino Toscano
c1e1e23285 osinfo: add altlinux and mageia distributions 2015-08-25 17:39:26 +02:00
Pino Toscano
70579d08cd inspect: recognize the ALT Linux distribution
Check its presence ahead of /etc/redhat-release, as the distro provides
it and thus previously it was recognized as "redhat-based".
2015-08-25 16:17:59 +02:00
Pino Toscano
74f0b45ddf v2v: ignore missing kernels from grub (RHBZ#1230412)
Raise a warning for each kernel specified in grub which does not
actually exist, keep going on with the conversion using the remaining
(existing) kernels.
2015-08-24 18:25:10 +02:00
Pino Toscano
baa4ec6e45 ocaml: Add handling for errno ENOENT. 2015-08-24 18:11:18 +02:00
Pino Toscano
649f439cb7 ocaml: dynamically generate the content of Guestfs.Errno
Put in a list the errnos to expose, filling the content of the
Guestfs.Errno submodule from that.
Also, generate a separate guestfs-c-errnos.c with the implementations of
the functions returning the errno codes.

Only code motion and refactoring, no actual changes on the content of
the ocaml Guestfs module.
2015-08-24 17:57:10 +02:00
Pino Toscano
0dcb862943 configure: look for "java" as directory for Java in lib64 too
On 64-bit openSUSE versions, /usr/lib64/jvm/java provides the symlink to
the default Java version.
2015-08-20 17:25:34 +02:00
Pino Toscano
e6dd9b5d6b appliance: explicitly add libyajl on Mageia
It seems yajl was bringing it, but seems not on Mageia 5.  Leave yajl
for older versions.
2015-08-19 14:46:39 +02:00
Richard W.M. Jones
97bd64f588 FAQ: the -> and in previous commit.
This fixes commit 571fca8e71.
2015-08-13 22:54:30 +01:00
Richard W.M. Jones
571fca8e71 FAQ: Further improve debugging section. 2015-08-13 22:51:43 +01:00
Richard W.M. Jones
8828005691 Version 1.31.2. 2015-08-13 16:46:08 +01:00
Richard W.M. Jones
08b57ae1f4 builder/website: Fix EXTRA_DIST.
This fixes commit 190a9f4534 and
commit 864ca489ac.
2015-08-13 16:45:30 +01:00
Richard W.M. Jones
c9ad61b37b p2v: Modify some partial match regexps to work with pcre 7.8.
pcre < 8 has limitations on the types of partial matching
possible.  As noted in the pcrepartial(3) man page, these can
be worked around by adding non-capturing parentheses around
various subexpressions, as I have done here.
2015-08-13 15:48:36 +01:00
Richard W.M. Jones
92e155dbdd p2v: For pcre < 8 (RHEL 6), abort if partial matching cannot be used on a regexp. 2015-08-13 15:48:36 +01:00
Richard W.M. Jones
1d082d127e p2v: Print an error if gtk_init_check fails.
Apparently gtk_init_check doesn't (always?) print an error message
when it returns false, so virt-p2v just exits without any message.

This was observed on RHEL 6 when $DISPLAY was not set.
2015-08-13 14:13:49 +01:00
Richard W.M. Jones
2bfb9ff9ea p2v: Call g_thread_init with old glib2 as used by RHEL 6. 2015-08-13 13:51:11 +01:00
Richard W.M. Jones
00bceec421 v2v: Help RHEL 6 OCaml to determine type of class.
File input_libvirt_other.ml, line 1, characters 0-1:
Error: The implementation input_libvirt_other.ml
       does not match the interface input_libvirt_other.cmi:
       Class declarations do not match:
         class virtual input_libvirt :
           'a ->
           string option ->
           string ->
           object
             method adjust_overlay_parameters : Types.overlay -> unit
             method as_options : string
             method virtual source : unit -> Types.source
           end
       does not match
         class virtual input_libvirt :
           string option ->
           string option ->
           string ->
           object
             method adjust_overlay_parameters : Types.overlay -> unit
             method as_options : string
             method virtual source : unit -> Types.source
           end
       A parameter has type 'a but is expected to have type string option
2015-08-13 13:23:59 +01:00
Richard W.M. Jones
b0cd6917ca v2v: Hide StringMap functions we're not actually using.
In RHEL 6 OCaml, some of these functions were not part of the Map
class, giving an error.  Hide the ones we aren't using.
2015-08-13 13:23:59 +01:00
Richard W.M. Jones
437cb7b6ff handle: Move #pragma out of functions.
RHEL 6 gcc did not support #pragma within functions.
2015-08-13 13:23:59 +01:00
Richard W.M. Jones
06e92bffd4 p2v: Add replacement for xmlBufferDetach function not available in RHEL 6. 2015-08-13 13:23:59 +01:00
Richard W.M. Jones
42b6bb12dc v2v: -oa preallocated for qcow2 output now fully allocates the file (RHBZ#1251909).
When the output format is qcow2 and -oa preallocated is used,
previously it would only allocate the metadata.  That was a regression
over previous behaviour of virt-v2v 0.9.  Change it so it allocates
the full file size in this case.
2015-08-13 13:23:59 +01:00
Richard W.M. Jones
66daad38f3 disk-create: Allow preallocation off/metadata/full.
For raw, this allows "off" as a synonym for "sparse" (to make it
consistent with qcow2).

For qcow2, this allows "sparse" as a synonym for "off".

It also adds qcow2 "full" preallocation, which is actually mapped to
the qemu option "falloc" (see arguments about this on the qemu-devel
mailing list, which we lost).

This also updates the test.
2015-08-13 13:23:58 +01:00
Pino Toscano
d78f685c0e builder: normalize architectures
Normalize the target architecture, and also each architecture when
checking for a compatible image.

This sort of reverts the effects of
commit 8864c47b94, but at least it is
possible to build e.g. Debian-based amd64 images on any x86_64 system
without being considered as foreign architecture.
2015-08-12 18:22:34 +02:00
Pino Toscano
0bbb903f42 mllib: add normalize_arch helper
Small helper to normalize an architecture string, so it is easier to
compare them and check for compatibilities.

Make use of it in guest_arch_compatible, simplifying it.
2015-08-12 18:22:34 +02:00
Pino Toscano
90b459a5db dib: expand doc on external dependencies for appliance 2015-08-12 18:21:08 +02:00
John Eckersberg
c2bb87e8f2 dib: handle unsetting functions in environment
If a function name, with its trailing parentheses, is in the
environment , trying to unset it will error out with a message of "not
a valid identifier".  Handle this as a special case, and unset it with
the -f option which can handle the parentheses in the supplied
identifier.
2015-08-12 17:20:38 +02:00
Pino Toscano
70d020f074 inspect: support the APK package manager and its format
Associate the Alpine Linux distribution with it.
2015-08-12 16:23:45 +02:00
Pino Toscano
120f06a8a1 inspect: recognize the Alpine Linux distribution
Just basic identification, name and version.
2015-08-12 16:23:45 +02:00
Richard W.M. Jones
190a9f4534 builder: Add script for building RHEL for aarch64. 2015-08-12 14:00:24 +01:00
Richard W.M. Jones
f3a7cf994b customize: firstboot: Place firstboot.service file in systemd unit directory (RHBZ#1250955).
It turns out that -- some of the time -- systemd ignores unit files
which are not placed in one of the official unit directories.  This
caused the service to be timed out and killed when the systemd daemon
was reloaded, as could happen for long-running package installs at
first boot.

Thanks: Marius Vollmer for diagnosing the problem and finding the
solution.
2015-08-12 10:42:57 +01:00
Richard W.M. Jones
75006fc27c p2v: Add mesa-dri-drivers.
Requires on Fedora 22 to work around:
https://bugzilla.redhat.com/show_bug.cgi?id=1242195
2015-08-11 16:27:49 +01:00
Richard W.M. Jones
bfd151b8bf p2v: Add tar to the kickstart.
Work around https://bugzilla.redhat.com/show_bug.cgi?id=1182362
2015-08-11 15:49:28 +01:00
Richard W.M. Jones
6f74d8044b p2v: Add a note about building a 32- or 64-bit virt-p2v ISO. 2015-08-11 15:38:07 +01:00
Richard W.M. Jones
864ca489ac builder: Add script for building Fedora i686 (32 bit) images. 2015-08-11 13:56:55 +01:00
Richard W.M. Jones
8cb82aec12 builder: fedora: Use os variant fedora22. 2015-08-11 13:34:27 +01:00
Pino Toscano
4e5d9962ce builder: improve "converting" message on unknown format
If the format of the disk image of the template is not specified in the
index, virt-builder would print
  Converting auto to qcow2
when asking to generate a qcow2 image.  Instead, in this case print only
the destination format, like
  Converting to qcow2
2015-08-10 13:22:27 +02:00
Richard W.M. Jones
068443843d v2v: vCenter: Suggest using %20 to escape spaces in Datacenter paths (RHBZ#1250715). 2015-08-06 17:29:56 +01:00
Richard W.M. Jones
fc70ea696b docs: Document CVE-2015-5745 qemu vulnerability. 2015-08-06 16:41:09 +01:00
Richard W.M. Jones
f8a81d6bae update-bugs.sh: Remove comment. 2015-08-06 16:24:56 +01:00
Pino Toscano
1c43c0800f get-kernel: remove extra progname from error messages
error() prints it already
2015-08-06 15:15:40 +02:00
Richard W.M. Jones
16e6378a5b customize: Make dnf upgrade to the latest versions of packages.
I discovered that 'dnf upgrade' doesn't actually upgrade to the latest
versions of packages unless you also supply the '--best' flag.

This also changes update -> upgrade, since apparently 'dnf update'
is deprecated.
2015-08-05 13:01:12 +01:00
Richard W.M. Jones
91c06391c1 automake: Admit defeat and use 'subdir-objects'.
Because this 'feature' is broken (since 2013):

  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13928

we have to replace all instances of $(top_srcdir) in *_SOURCES lines
with a relative path.  According to what I read, this shouldn't break
split builds, but I didn't test it.

The only things automake moans about now are:

* Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /usr/bin/automake line 3936.

  - This is another bug in automake

* autoreconf: configure.ac: AM_GNU_GETTEXT is used, but not AM_GNU_GETTEXT_VERSION

  - This is a feature, not a bug.
2015-08-05 13:01:12 +01:00
Richard W.M. Jones
f3ed65525c p2v: Display full package version (including extra string) in p2v.ks file. 2015-08-05 13:01:12 +01:00
Richard W.M. Jones
da87760407 p2v: Allow 'virt-p2v-make-kickstart rhel-7.1' to set up RHEL repos. 2015-08-05 13:01:12 +01:00
Richard W.M. Jones
007004a536 p2v: Disable ssh service in the ISO (RHBZ#1248678).
We don't want people to be able to ssh into the p2v ISO while it is
running, with a simple, known root password.
2015-08-05 13:01:12 +01:00
Richard W.M. Jones
d9c6370831 sysprep: Allow test-virt-sysprep.sh to be skipped.
It fails in Fedora Rawhide because LVM is broken (RHBZ#1237136).
2015-08-02 17:33:07 +01:00
Richard W.M. Jones
12898a8862 dib: Fix typo in documentation.
Thanks: Yuri Chornoivan
2015-07-31 08:30:00 +01:00
Richard W.M. Jones
3e71e8ee93 Version 1.31.1. 2015-07-30 14:50:11 +01:00
Richard W.M. Jones
380002b133 README: Add the dnf builddep command (for Fedora >= 22). 2015-07-30 14:45:21 +01:00
Cédric Bosdonnat
2d2a65504d appliance init: find NIC name for dhcpcd
dhcpcd requires an interface name as parameter to work. We are now
getting it from /proc/sys/net/ipv4/conf/ folder children. dhclient
on Debian also has the problem, thus use the guessed interface name
for it too.
2015-07-29 17:31:33 +01:00
Pino Toscano
37a0378556 sysprep: machine_id: handle /var/lib/dbus/machine-id
Another machine-id file, used by D-Bus.
2015-07-29 13:47:08 +02:00
Pino Toscano
bc598ff52a sysprep: machine_id: simplify implementation
Instead of rm + touch, just truncate the file if existing.
In case there was no file previously, now nothing is created, as most
probably the system was fine even without it.

Also, turn the single path into a list, so more machine-id files can be
handled at once.
2015-07-29 13:36:23 +02:00
Richard W.M. Jones
dbbf4b8afe customize: Combine separate -a and -d option synopses (RHBZ#1246882) 2015-07-28 14:13:03 +01:00
Pino Toscano
ae9954e0b4 builder: add Sigchecker.verify_and_remove_signature
New helper to remove the signature from a file, returning a temporary
file without the signature.
2015-07-28 13:30:39 +02:00
Pino Toscano
51d40267d7 builder: expose Sigchecker.verifying_signatures
Useful to know whether a Sigchecker instance is verifying signatures,
hence it is possible to decide whether download signed content or not.
2015-07-28 13:30:39 +02:00
Pino Toscano
3b44b7d878 builder: split Index_parser.index in an own module
Move the index and entry definitions in an own Index module, together
with the (previously internal to Index_parser) print_entry debugging
function.
2015-07-28 13:30:39 +02:00
Pino Toscano
6a86a3d8ff builder: allow signatures from subkeys
When importing a key, read the list of the valid subkeys of it, and use
it to check whether a signature was done by one of them.
This allows index provides to sign them using a subkey instead of the
main key.
2015-07-28 13:30:39 +02:00
Pino Toscano
63175fb3c3 builder: internally use a list of checksums for indexes
Extend Index_parser.entry to hold a list of checksums to validate, and
validate all of them.

This does change nothing currently, as only sha512 is read, while still
allowing us to fetch more checksums if needed.
2015-07-28 13:30:39 +02:00
Pino Toscano
43499579bf builder: add SHA256 support in Checksums 2015-07-28 13:30:39 +02:00
Pino Toscano
7056af81bd builder: create and use a new Checksums module
Introduce a new Checksums module to handle the check of checksums,
moving part of the Sigchecker code to it.

Adapt the rest of virt-builder to this new module.
2015-07-28 13:30:39 +02:00
Pino Toscano
a1a1e8e508 builder: add format=FMT in repository .conf files
First step in allow different formats for indexes of images, aside the
current one.

The only accepted value is "native".
2015-07-28 13:30:39 +02:00
Pino Toscano
6c9ea0471e customize: password: improve unknown default crypto message
When warning that there is no known default password encryption for the
current guest, print also its minor version (help debugging unsupported
guests).

Also, fix wrapping (and indentation) of the message.
2015-07-24 16:40:11 +02:00
Pino Toscano
563b388b8e customize: random_seed: add CirrOS location
CirrOS has its random-seed file in /etc.
2015-07-24 15:25:28 +02:00
Richard W.M. Jones
7eed43da6c appliance: Exclude /usr/lib/modules as well as /lib/modules.
It normally makes no difference to the final size of the appliance,
because 'supermin --build' will copy back the host kernel modules.
2015-07-23 16:41:06 +01:00
Richard W.M. Jones
0c7b957c13 appliance: exclude /lib/firmware
Brings the size of the appliance down to 95 MB [xz-compressed], which
is the same as for libguestfs 1.28.
2015-07-23 16:40:52 +01:00
Richard W.M. Jones
46600019b1 appliance: exclude /usr/share/fonts and /usr/share/icons.
I also sorted the list.

Between libguestfs 1.28 and 1.30, the appliance grew from 95MB to 213MB.

Using guestmount and filelight (see link below) I could see that the
main contributor was these two directories, which should not be
necessary.

With this change, the size goes down to 119MB.

See also:
https://rwmj.wordpress.com/2015/07/23/why-has-the-libguestfs-appliance-grown-by-118-mb/
2015-07-23 14:47:33 +01:00
Pino Toscano
c60cd11e73 actions: tar_in: add xattrs, selinux, and acls optargs
Add additional arguments for tar, so extended attributes and/or SELinux
contexts and/or POSIX ACLs can be restored from input tars.
2015-07-21 18:12:52 +02:00
Pino Toscano
afb5db7837 actions: tar_out: add xattrs, selinux, and acl optargs
Add additional arguments for tar, so extended attributes and/or SELinux
contexts and/or POSIX ACLs can be saved in output tars.
2015-07-21 18:12:52 +02:00
Richard W.M. Jones
499678a8a6 build: Add virt-dib.1.html and virt-get-kernel.1.html to HTMLFILES. 2015-07-21 17:00:24 +01:00
Pino Toscano
a6433aff70 tests/nbd: pass --format to qemu-nbd if possible
Run `qemu-nbd --help` to know whether it supports --format, and if so
pass it explicitly.  This avoids warnings with newer qemu versions,
where they really recommends to explicit the format of disk images being
specified on command line.
2015-07-21 16:56:00 +02:00
Pino Toscano
42ff22a909 tests/syslinux: add /usr/lib/SYSLINUX as directory for mbr.bin
Yet another new location (found on recent Debian/sid) for mbr.bin.
2015-07-21 16:54:29 +02:00
Richard W.M. Jones
1a9e06b228 docs: Finish off release notes for 1.30. 2015-07-21 13:34:56 +01:00
Richard W.M. Jones
8ac2c4da9f Version 1.31.0. 2015-07-21 13:30:40 +01:00
Richard W.M. Jones
251c608e48 Version 1.30.0. 2015-07-21 13:13:38 +01:00
Richard W.M. Jones
95fde969ea Pull translations from Zanata. 2015-07-21 12:33:48 +01:00
Richard W.M. Jones
5a28634bdc Update gnulib to latest. 2015-07-21 11:55:01 +01:00
Richard W.M. Jones
83a0b4b37c p2v: tests: Don't fail when test machine has only a single hard disk.
virt-p2v looks in /sys/block to find disks, and ignores the hard disk
containing the root device.  This is correct when virt-p2v runs off
the ISO, but when running the tests on a machine that has a single
hard disk, all_disks would be NULL, resulting in a test failure.

Fix this by allowing all_disks to be NULL, but adding an extra check
later so that we don't perform the conversion with no hard disks (the
gui.c path already has this check, so it is only needed in the
kernel.c path).
2015-07-21 10:54:52 +01:00
Pino Toscano
7c470c1179 tests: fix string comparison
Use 'eq' for comparing strings instead of '=='.
2015-07-21 11:13:45 +02:00
Pino Toscano
19020ea3f8 appliance: adding qemu-img and which dependencies for more distros
In particular, add them for Archlinux, openSUSE, Frugalware, and Mageia.
2015-07-21 09:38:11 +02:00
Pino Toscano
44f71d0782 customize: add basic subscription-manager operations
Add simple operations for RHEL guests using subscription-manager, so it
is possible to e.g. install software on them.
2015-07-17 17:03:04 +02:00
Pino Toscano
b357553cd6 mllib: add and use read_first_line_from_file
Move the read_password_from_file helper in Password to mllib with a more
generic name, and use it in place of the former.

Also, use it in v2v instead of reading the whole file contaning a
password: given that the documentation says that the whole content is
used, there will not be newlines in the password file, so the behaviour
will be preserved. The oly difference is that newline is no more an
acceptable character for passwords, but that is a really unlikely
(if not impossible at all) situation.
2015-07-17 17:03:04 +02:00
Chen Hanxiao
d29337605a daemon: add a space after func/macro to fit code-style
more daemon codes covered

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-07-17 13:27:13 +01:00
Pino Toscano
9d3447ad7a dib: handle --name with path
Make sure to write in the directory of the specified image name, using
just the basename where needed (e.g. for $IMAGE_NAME).
2015-07-14 11:11:29 +02:00
Chen Hanxiao
c3edd076b9 daemon: add a space after func name to fit code-style
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-07-13 12:31:52 +01:00
Richard W.M. Jones
08bfad986a v2v: windows: Set gcaps_video correctly (RHBZ#1233093).
Depending on whether we found a QXL driver and installed it in the
guest, set gcaps_video to either Cirrus or QXL.
2015-07-13 10:12:29 +01:00
Richard W.M. Jones
b7fcfb59ef v2v: OVF: Add a comment about always using QXL. 2015-07-13 10:12:29 +01:00
Pino Toscano
ad4067a508 Improvements to the 1.30 release notes 2015-07-10 14:41:08 +02:00
Richard W.M. Jones
e6404be6ee Version 1.29.50. 2015-07-09 18:31:47 +01:00
Richard W.M. Jones
42cee8f8fc docs: When making a stable release, run ./configure --without-libvirt. 2015-07-09 17:55:23 +01:00
Richard W.M. Jones
6561c96fb7 v2v: domainxml: Fix missing functions in the !HAVE_LIBVIRT case.
This also uses a C macro to simplify the error functions in this case.

This fixes commit badfc2e9b2.
2015-07-09 17:54:17 +01:00
Richard W.M. Jones
ae5844cc54 Draft release notes for 1.30 release. 2015-07-09 16:57:21 +01:00
Richard W.M. Jones
350dfe1fa2 v2v: Remove RHEL 7 conversion server.
We are no longer planning to ship virt-v2v as an appliance.  In RHEL 7.2
it will be included in the base RHEL Server product.

This reverts commit 4e4ece5364.
2015-07-09 15:36:31 +01:00
Richard W.M. Jones
95bb1916eb appliance: Exclude more log files (RHBZ#1239154).
This removes further possible log files from the appliance, but
without removing any subdirectories.
2015-07-09 15:36:31 +01:00
Richard W.M. Jones
2080f4b0dd appliance: Remove typo $@ at beginning of line.
This fixes commit 82b486a908.
2015-07-09 15:36:31 +01:00
Richard W.M. Jones
c238a9caa1 appliance: Rebuild appliance if excludefiles changes. 2015-07-09 15:36:31 +01:00
Pino Toscano
85fe0abdd0 New tool: virt-dib
virt-dib is a new tool to run the elements of diskimage-builder using
libguestfs.
2015-07-09 14:55:43 +02:00
Chen Hanxiao
46be6934fc labels: return ENOTSUP if could not set label for specific fs
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-07-08 13:02:42 +02:00
Chen Hanxiao
d9b53a2752 labels: use existing do_xfs_admin for xfslabel
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-07-08 12:26:59 +02:00
Chen Hanxiao
5c6be8846f labels: move ntfslabel to ntfs.c
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-07-08 12:26:52 +02:00
Chen Hanxiao
d5a60f2148 labels: move e2label to ext2.c and call it directly
ext2 should not call function in labels

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-07-08 12:26:47 +02:00
Chen Hanxiao
16232ffd58 labels: move btrfslabel to btrfs.c
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-07-08 09:56:56 +02:00
Chen Hanxiao
de93c690a1 doc: add missing ms-dos fs section in set_label
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-07-07 09:55:00 +02:00
Chen Hanxiao
105fa8bf31 uuids: return ENOTSUP if could not set UUID for specific fs
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-07-07 09:20:38 +02:00
Richard W.M. Jones
b04f39bf10 v2v: Add a check before copying that UEFI is supported (RHBZ#1184690).
If UEFI is required by the guest, but not supported by the host, then
you wouldn't see an error message until after copying.

Add an additional method to the output object so we can check this
before copying, to avoid a long wait.

Thanks: Junqin Zhou
https://bugzilla.redhat.com/show_bug.cgi?id=1184690#c22
2015-07-06 12:37:23 +01:00
Richard W.M. Jones
74e87a970b v2v: -o libvirt: Add readonly=yes to UEFI <loader> attribute (RHBZ#1184690).
Thanks: Junqin Zhou for diagnosing the bug and finding the correct
solution.  https://bugzilla.redhat.com/show_bug.cgi?id=1184690#c22

This fixes commit 40558450dd.
2015-07-06 12:20:48 +01:00
Richard W.M. Jones
659d56db3c v2v: Catch real exception thrown by failing aug_get (RHBZ#1239053).
When converting the old Perl virt-v2v code, I made a silly mistake
with the exception that aug_get throws when it doesn't find any node.
It throws a 'Guestfs.Error' exception, not 'Not_found'.

As a result of this, the exception was escaping and the proper error
message was not displayed.  With a malformed grub configuration you
would see this error:

  $ virt-v2v -i disk centos-6.img -o null
  [...]
  virt-v2v: error: libguestfs error: aug_get: no matching node

After applying this patch:

  $ virt-v2v -i disk centos-6.img -o null
  [...]
  virt-v2v: error: no kernels were found in the grub configuration.

  This probably indicates that virt-v2v was unable to parse the grub
  configuration of this guest.

which is the correct error message.
2015-07-06 10:47:45 +01:00
Chen Hanxiao
a477e282db New API: set_uuid_random
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-07-03 11:31:41 +02:00
Richard W.M. Jones
db9bd61585 Version 1.29.49. 2015-07-02 18:06:15 +01:00
Richard W.M. Jones
ccdbbc7fe4 Fix various -Wformat problems.
Updating gnulib has caused -Wformat-signedness to be enabled.  This
has revealed many problems in C format strings.  The fixes here fall
into the following main categories:

 - Using %d with an unsigned parameter.

 - %x and %o expect an unsigned argument.

 - uid_t and gid_t are unsigned on Linux.  The safe way to print these
   is to cast them to uintmax_t and then print them using the %ju
   modifier (see http://stackoverflow.com/a/1401581).

 - Using %d to print an enum.  Since enums may be either char or int,
   I fixed this by casting the enum to int.

 - strtol_error & lzma_ret are both unsigned types.
2015-07-02 16:08:44 +01:00
Richard W.M. Jones
b263035c1a Update gnulib to latest. 2015-07-02 15:35:48 +01:00
Richard W.M. Jones
fba82456a9 Pull latest translations from Zanata. 2015-07-02 14:49:37 +01:00
Richard W.M. Jones
f5698c3793 v2v: TODO: Add note about -i ova / -o rhev and removable device slots. 2015-07-02 14:17:24 +01:00
Richard W.M. Jones
afd80a27ef v2v: Remove some items from TODO file which we've implemented. 2015-07-02 14:17:24 +01:00
Richard W.M. Jones
b7166e1a9e v2v: Add a regression test for RHBZ#1238053. 2015-07-02 14:17:23 +01:00
Richard W.M. Jones
309e14189f v2v: Pass target_buses to output object (RHBZ#1238053).
Pass the target_buses assignment to the output#create_metadata method.

Now output modes have a choice: they can either ignore the new
parameter and continue to use the flat list of targets.  This is
suitable for output modes that cannot model multiple buses (eg.
-o glance) or can model it but don't bother (currently -o rhev).

Or they can ignore the flat targets parameter and use the new
target_buses parameter, translating that into the appropriate list of
devices.  This is implemented in this commit for these modes:

 -o libvirt
 -o local
 -o qemu
2015-07-02 14:17:23 +01:00
Richard W.M. Jones
ce83f2751b v2v: Introduce the concept of target buses.
The target VM will have several buses to which disks can be attached.
Commonly it will have an IDE bus, and possibly a virtio-blk "bus" (not
really a bus) and/or a SCSI bus.

Virt-v2v does not model this at the moment.  Disks are just added to
the output XML in the order that we write them, and so they can move
around with respect to the target VM.

This commit introduces the idea that we should model the target disk
buses, and we should try to assign fixed and removable disks to slots
on each of those buses.  In this commit, the modelling is not used by
any output mode, but that will be fixed in the next commit.
2015-07-02 14:17:23 +01:00
Richard W.M. Jones
847c303a15 v2v: -i libvirt and -i ova: Record the slot number of removable drives.
When we see libvirt source XML for a removable drive like this:

   <disk type='file' device='cdrom'>
     <driver name='qemu' type='raw'/>
     <target dev='hdc' bus='ide'/>
   </disk>

as well as recording the bus (s_removable_controller) as we do at the
moment, also record the slot number (eg. hdc == 2 in the example
above).

Do the same for OVA input files.
2015-07-02 14:11:29 +01:00
Richard W.M. Jones
4ef80f28c8 v2v: Add a binding for guestfs_int_drive_index and a unit test. 2015-07-02 14:11:29 +01:00
Richard W.M. Jones
36e22d1e8e v2v: Add unit test of Utils.drive_name function. 2015-07-02 14:11:29 +01:00
Richard W.M. Jones
c8a9e4b928 v2v: Refactor ~printer parameter in unit tests.
Simple refactoring, no functional change.
2015-07-02 14:11:29 +01:00
Richard W.M. Jones
a54fef132a utils: Add guestfs_int_drive_index and unit test.
Add guestfs_int_drive_index which does basically the opposite of
guestfs_int_drive_name.  This commit also includes a unit test.
2015-07-02 14:11:29 +01:00
Richard W.M. Jones
625eae504d utils: Add a test of the guestfs_int_drive_name function.
This function didn't have a unit test before.
2015-07-02 14:11:29 +01:00
Pino Toscano
d9fc0656b2 tests: do not init a partition for btrfs-image tests
They create an own partition layout, so don't do that over the
testing-created layout.

At least for me, this fixes parted issues when creating the new
partition layout and the old one is still reported as in use.

Followup/fix for commit 52d1b0c593.
2015-07-02 11:25:06 +02:00
Chen Hanxiao
4e8ef1ae37 uuid: use newly introduced swap_set_uuid
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-07-02 11:08:52 +02:00
Chen Hanxiao
80cf46e110 uuid: add support to change uuid of btrfs partition
btrfs-progs v4.1 add support to change uuid of btrfs fs.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-07-02 11:08:42 +02:00
Pino Toscano
261be1f952 sysprep: rework and fix cron-spool operation (RHBZ#1229305)
When cleaning the directories with cron/at jobs, remove only files
there, as subdirectories might be used by other systems; for example
in Debian under /var/spool/cron/ there is the atjobs subdirectory with
the actual at queue.

Make sure to not remove .SEQ files anymore, as they represent the at job
counter which is needed by the at daemon. Instead, reset these files to
0.

Furthermore, add also the path to the .SEQ location in Debian-based
systems.
2015-07-01 17:17:58 +02:00
Pino Toscano
a614f3451d mllib: add and use last_part_of
Collect this small snippet to get the part of a string after the last
occurrency of a character; replace with it the current snippets doing
the same.

Should be just code motion.
2015-07-01 17:17:58 +02:00
Pino Toscano
775e68c461 mllib: add an optional filter for rm_rf_only_files
This way it is possible to use rm_rf_only_files, but not removing
specific files.
2015-07-01 16:36:25 +02:00
Richard W.M. Jones
9f0036a026 v2v: Match any non-"Client" variant, instead of just "Server" (RHBZ#1234351, RHBZ#1237869).
When checking if a Windows variant is a server variant, assume it is a
server variant unless the i_product_variant field is "Client".

Windows 2008 and Windows 2008R2 does not have an InstallationType key
in the registry at all, so for these the product variant is returned
as "unknown".

Windows "Core" would have, according to the reference below,
"Server Core".

https://msdn.microsoft.com/en-us/library/ee391629%28v=vs.85%29.aspx

This fixes commit 47b5f245be.
2015-07-01 11:14:23 +01:00
Richard W.M. Jones
a324ae2ad7 v2v: Fix detection of Win2008R2 drivers (RHBZ#1234351).
This fixes commit 47b5f245be.
2015-07-01 11:01:43 +01:00
Pino Toscano
e1e4d8648d tests: add/expand UUID and label tests for swap and xfs 2015-06-30 16:42:52 +02:00
Chen Hanxiao
d0c067df87 daemon: add get_random_uuid
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-06-30 15:54:57 +02:00
Chen Hanxiao
5166388914 uuid: use newly introduced xfs_set_uuid of xfs
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-06-30 14:48:12 +02:00
Chen Hanxiao
ad21fb8acf uuid: use existing function of ext2
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-06-30 14:48:06 +02:00
Chen Hanxiao
98e1e9bcc2 tests: fix two minor warnings
"my" variable $output masks earlier declaration in same scope at /home/libguestfs/tests/daemon/test-btrfs.pl line 66.
"my" variable @r masks earlier declaration in same scope at /home/libguestfs/tests/daemon/test-btrfs.pl line 72.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-06-30 11:08:32 +01:00
Richard W.M. Jones
2b67342bda Version 1.29.48. 2015-06-29 23:20:54 +01:00
Richard W.M. Jones
93cf45cadf tests: Add a test of btrfs-qgroup-show using the captive daemon. 2015-06-29 23:08:47 +01:00
Richard W.M. Jones
336b8f6b16 tests: Add a test of btrfs-subvolume-list using the captive daemon. 2015-06-29 23:08:47 +01:00
Richard W.M. Jones
f2438b75a2 tests: daemon: Cleanly shut down the daemon on exit.
This refines the previous commit by shutting down the daemon cleanly
at the end of the test (assuming the test was successful).  It
repurposes the 'internal_exit' API for this, which was previously used
by the now defunct --enable-valgrind-daemon functionality.
2015-06-29 23:08:46 +01:00
Richard W.M. Jones
9f85477cba tests: Add tests using a captive daemon process.
This allows us to test the daemon running as a host process, allowing
us to meaningfully test it using valgrind.

This commit only adds a single test that check that the daemon starts
up, can be pinged, and exits.
2015-06-29 23:08:46 +01:00
Richard W.M. Jones
8cb1a35d75 daemon: Move all the kernel command line parsing to the init script.
Instead of parsing /proc/cmdline from the daemon, move all of that
parsing into the init script, and pass the argument via the daemon
command line.

For example, previously the daemon and init script both looked for
guestfs_network=1 in /proc/cmdline.  Now the init script still looks
for it, and if found it runs `guestfsd --network'.
2015-06-29 23:08:43 +01:00
Richard W.M. Jones
64ff631127 daemon: Add -l / --listen flag.
This option, used for testing, causes the daemon to create the Unix
domain socket (from guestfs_channel), listen on it, and accept a
single connection.
2015-06-29 23:06:21 +01:00
Richard W.M. Jones
9e0e2247ff daemon: Add undocumented --test / -t option to enable test mode.
This is a catch-all mode for turning off daemon features which
interfere with our testing of the daemon.
2015-06-29 23:06:21 +01:00
Richard W.M. Jones
4b721a1e0b configure: Remove test for valgrind --vgdb option.
We'll now just require that valgrind is new enough.

As best as I can tell from the valgrind subversion(!) repository, this
option was added to valgrind in around 2011.
2015-06-29 23:06:21 +01:00
Richard W.M. Jones
3888582da8 v2v: Free XML objects in the correct order.
If you free an xmlDocPtr before any xmlXPathObjectPtrs that reference
the doc, you'll get valgrind errors like this:

  ==7390== Invalid read of size 4
  ==7390==    at 0x4EB8BC6: xmlXPathFreeNodeSet (xpath.c:4185)
  ==7390==    by 0x4EB8CC5: xmlXPathFreeObject (xpath.c:5492)
  ==7390==    by 0x400A56: main (in /tmp/test)
  ==7390==  Address 0x60c0928 is 8 bytes inside a block of size 120 free'd
  ==7390==    at 0x4C29D2A: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==7390==    by 0x4E8784F: xmlFreeNodeList (tree.c:3683)
  ==7390==    by 0x4E87605: xmlFreeDoc (tree.c:1242)
  ==7390==    by 0x400A4A: main (in /tmp/test)

The following simple test program demonstrates the problem:

  #include <stdio.h>
  #include <stdlib.h>
  #include <assert.h>
  #include <libxml/xpath.h>

  int
  main (int argc, char *argv[])
  {
    xmlDocPtr doc;
    xmlXPathContextPtr xpathctx;
    xmlXPathObjectPtr xpathobj;

    doc = xmlReadMemory ("<test/>", 7, NULL, NULL, XML_PARSE_NONET);
    assert (doc);
    xpathctx = xmlXPathNewContext (doc);
    assert (xpathctx);
    xpathobj = xmlXPathEvalExpression (BAD_CAST "/test", xpathctx);
    assert (xpathobj);
    xmlFreeDoc (doc);
    xmlXPathFreeObject (xpathobj);
    xmlXPathFreeContext (xpathctx);
    exit (EXIT_SUCCESS);
  }

In virt-v2v we were not freeing up objects in the correct order,
because we didn't express the dependency between objects at the C
level into the OCaml, where the OCaml garbage collector could see
those dependencies.  For example code like:

  let doc = ... in
  let xpathctx = xpath_new_context doc in
  let xpathobj = xpath_eval_expression xpathctx "/foo" in

might end up freeing the 'doc' (xmlDocPtr) if, say, there were no
further references to it in the code, even though the 'xpathobj'
(xmlXPathObjectPtr) remains live.

To avoid this, we change the OCaml-level representation of objects
like xpathobj so they contain a reference back to the higher-level
objects (xpathctx & doc).  Therefore holding an xpathobj means that
the doc cannot be freed.

However that alone is not quite sufficient.  There is a further
problem when the program calls Gc.full_major, Gc.compact etc., or even
just when xpathctx & doc happen to be freed at the same time.  The GC
won't necessarily free them in the right order as it knows both need
to be freed but doesn't know that one must be freed before the other.

To solve this we have to move the finalisers into OCaml code, since
the OCaml Gc.finalise function comes with an explicit ordering
guarantee (that finalisers are always called in reverse order that
they were created), which the C-level finaliser does not.
2015-06-29 19:59:59 +01:00
Cao jin
36a197e2cc New API: btrfs_replace
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
2015-06-29 16:39:13 +02:00
Richard W.M. Jones
52ca4d5dd4 v2v: OVF: If actual_size field is estimated, add a comment to the output.
The 'note:' comment is added, as below:

  <Section xsi:type='ovf:DiskSection_Type'>
    <Info>List of Virtual Disks</Info>
    <!-- note: actual_size field is estimated -->
    <Disk ovf:actual_size='7' [...]/>
  </Section>
2015-06-29 10:43:42 +01:00
Richard W.M. Jones
801832e676 v2v: Increase the timeout of VMware curl connections (RHBZ#1146007).
On certain webservers these appear to go beyond even 600 seconds (10
minutes).
2015-06-29 10:43:42 +01:00
Richard W.M. Jones
800e501e1e v2v: test-harness: Build dependencies correctly. 2015-06-25 21:22:37 +01:00
Chen Hanxiao
1d58cd4e1d do_btrfs_subvolume_list: fix a bad return value
don't return a value which is to be freed.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-06-23 21:31:32 +01:00
Chen Hanxiao
268c425791 do_btrfs_qgroup_show: fix a bad return value
We should not use temporary lines buffer as return value,
for lines buffer will be freed.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-06-23 21:31:32 +01:00
Richard W.M. Jones
445d20c117 lib: Add optional 'append' parameter to copy-(device|file)-to-file APIs.
This allows you to append one file to another:

  copy-file-to-file /input.txt /output.txt append:true

will append the contents of /input.txt to /output.txt.
2015-06-23 21:31:31 +01:00
Richard W.M. Jones
47b5f245be v2v: Support loading virtio-win drivers from virtio-win.iso (RHBZ#1234351).
This makes several changes to the handling of virtio-win drivers:

The VIRTIO_WIN_DIR environment variable has been renamed
VIRTIO_WIN (but you can still use the old name).

You can point the VIRTIO_WIN either at a RHEL virtio-win directory
(ie. /usr/share/virtio-win), OR at a loopback-mounted virtio-win ISO,
OR at the virtio-win.iso file itself.  In the latter case, libguestfs
is used to open the ISO file and read drivers from it.

The code is more flexible about the pathnames of drivers, because the
paths in the ISO are completely different from the paths in RHEL
/usr/share/virtio-win.
2015-06-23 21:31:31 +01:00
Richard W.M. Jones
57ae2a5cc3 daemon: Rewrite prog_exists so it uses the actual PATH, not hard-coded list. 2015-06-23 21:31:31 +01:00
Cao jin
68ed6dd88a Modify the function: analyze_line, make it more flexible
Modify the function from a fixed delimiter to a variable. So,
it can be used in more APIs later. Also modified the existing
callers

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
2015-06-23 13:28:31 +02:00
Chen Hanxiao
35710595c1 btrfs: remove redundant whitespace
s/  =/ =

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-06-23 11:51:40 +02:00
Richard W.M. Jones
a1f3404516 v2v: test-harness: Add Config module to library.
Missing dependency.
2015-06-22 18:49:10 +01:00
Richard W.M. Jones
158204529f appliance: Make uefi_firmware variable static.
It is not used outside the compilation unit.

This fixes commit 544a731482.
2015-06-22 18:09:22 +01:00
Richard W.M. Jones
029fc60ee5 launch: Refactor guestfs_int_get_cpu_model code.
Shorter and does the same thing.
2015-06-20 15:06:46 +01:00
Richard W.M. Jones
544a731482 aarch64: appliance: Use kraxel's edk2.git repo if available.
Gerd is making EDK2 builds available here:

https://www.kraxel.org/repos/

These are convenient for Fedora/aarch64 users, so use this firmware if
available.

This commit also refactors the UEFI searching code.
2015-06-20 15:05:39 +01:00
Chen Hanxiao
74f5bb17a1 btrfs: fix leak in btrfs_balance_status
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-06-19 11:26:59 +01:00
Pino Toscano
abf0df6884 v2v: remove unused sources and libraries 2015-06-18 18:22:27 +01:00
Pino Toscano
9f683fbf0f btrfs: fix leak in btrfs_scrub_status
Properly free the output buffer.
2015-06-18 14:04:43 +02:00
Richard W.M. Jones
d8ab90cdd6 Version 1.29.47. 2015-06-18 12:59:53 +01:00
Richard W.M. Jones
c4f8d1d1a3 v2v: Improve handling when one of the input disks is blank (RHBZ#1232192).
In commit 4c73d1d4f1, I changed the
behaviour of virt-v2v so it ignores all errors from the
g#part_get_parttype method.  However that would ignore I/O errors and
similar.

Only ignore the "unrecognised disk label" error from parted, by
testing if the return code is EINVAL.

This fixes commit 4c73d1d4f1.
2015-06-18 10:26:53 +01:00
Richard W.M. Jones
94ea635fb1 ocaml: Add handling for errno EINVAL. 2015-06-18 10:26:53 +01:00
Richard W.M. Jones
b467afb621 daemon: parted: Always use -s option even with -m.
See: https://bugzilla.redhat.com/show_bug.cgi?id=1232241#c3

However adding the -s parameter changes the error code returned by
parted when it processes a blank disk (or other unrecognized partition
table).  Without -s it prints an error but returns a non-error exit
code (0).  With -s it prints an error and returns an error exit code.

Because it's useful to be able to catch this case in user code, turn
"unrecognised disk label" into EINVAL.

Change virt-alignment-scan to catch this error and ignore it.
2015-06-18 10:26:46 +01:00
Chen Hanxiao
3ae5f72743 error log: keep more calloc and its error messages match
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-06-18 10:19:41 +01:00
Pino Toscano
6118e2239c daemon: add split_lines_sb
Mold split_lines_sb from split_lines, so it returns the strings buffer
with the result of the split. This way, we can have the number of lines
in the array, with no need to count them again later.

split_lines is rewritten to take the ownership of the result of
split_lines_sb.
2015-06-17 17:43:13 +02:00
Pino Toscano
23ac997d06 daemon: add take_stringsbuf 2015-06-17 17:43:13 +02:00
Pino Toscano
fd6a66fde4 daemon: add CLEANUP_FREE_STRINGSBUF 2015-06-17 17:43:13 +02:00
Pino Toscano
26a0ccdb4e daemon: introduce free_stringsbuf
Simple shortcut to easily cleanup a stringsbuf.
2015-06-17 17:43:13 +02:00
Chen Hanxiao
596b8f85a9 btrfs: use CLEANUP_FREE_STRING_LIST for list free
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-06-17 11:05:36 +02:00
Chen Hanxiao
9c24314f6f btrfs: keep calloc and its error message match
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-06-17 11:05:32 +02:00
Pino Toscano
3f4ba2e98d btrfs: use calloc instead of malloc+memset
Small optimization, and eases the code.
2015-06-16 17:31:43 +02:00
Pino Toscano
9574e793e2 btrfs: remove unused 'out' variables
If we are not interested in output of a command being run, then there's
no need to still capture it in a (automatically freed, but still)
variable.

If any of those outputs is needed, a variable for it can be easily added
back.
2015-06-16 17:07:47 +02:00
Pino Toscano
993140219c Improve fixed appliance documentation
Move the "FIXED APPLIANCE" section from
libguestfs-make-fixed-appliance(1) to the "INTERNALS" section of
guestfs(3), so it's more visible and less hidden in the documentation
of a rarely-used tool.  Also slightly improve it.

Expand the FAQ question about libguestfs without supermin, mentioning
the build options needed and pointing to the aforementioned new section.
2015-06-16 14:57:19 +02:00
Chen Hanxiao
d11857aa87 guestfs.pod: fix a typo
s/caling/calling

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-06-16 14:57:19 +02:00
Richard W.M. Jones
4c73d1d4f1 v2v: Don't fail if one of the input disks is blank (RHBZ#1232192).
This also adds a regression test since it is probably easy to break
this in future.

Thanks: Junqin Zhou
2015-06-16 12:24:34 +01:00
Pino Toscano
99dc53bba7 resize: make available expand method warnings more prominent
When hitting a filesystem which we cannot or don't know how to expand,
instead of print a warning in verbose mode only, print it always when
showing the summary of the changes.

In the virt-resize documentation, add a paragraph about this warning.

Thanks to: Luigi Toscano.
2015-06-15 18:15:40 +02:00
Pino Toscano
54c7d3f61e get-kernel: add --prefix
New --prefix option to specify a prefix for the extracted file names.
2015-06-15 18:07:52 +02:00
Pino Toscano
cdb1e6eeca get-kernel: add --unversioned-names
New --unversioned-names option to save extracted files just with their
base name (i.e. "vmlinux", "initrd.img").
2015-06-15 18:07:52 +02:00
Pino Toscano
1183809f4d (Almost) new tool: virt-get-kernel
Extract the guest kernel/ramdisk extraction from virt-builder into a
separate utility, so it can be used and improved without cluttering
virt-builder.

Currently it does what virt-builder --get-kernel did, adding also the
options for remote disks and libvirt access, much like other libguestfs
tools.

virt-builder --get-kernel now just spawns virt-get-kernel.
2015-06-15 18:07:03 +02:00
Richard W.M. Jones
533901409e pod: Use F<> for filenames instead of C<>.
Done using a sequence of regular expressions like this:

  perl -pi.bak -e 's{C</}{F</}g' `git ls-files \*.pod` generator/actions.ml
  perl -pi.bak -e 's{C<C:\\}{F<C:\\}g' `git ls-files \*.pod` generator/actions.ml
  [etc]

and then tediously checking every change by hand.
2015-06-15 15:42:46 +01:00
Richard W.M. Jones
47e9a3d739 FAQ: Add sections about libguestfs NTFS & XFS support.
Both popular questions.
2015-06-14 16:35:52 +01:00
Richard W.M. Jones
dafb4bf283 v2v: Document 7B boot problems with Windows Group Policy. 2015-06-13 22:21:28 +01:00
Richard W.M. Jones
54fe6d369d p2v: Add proper test for command line parsing.
This also adds a couple of deliberately undocumented (and unsupported)
command line parameters to make testing simpler:

p2v.skip_test_connection  - don't try to test the connection
p2v.dump_config_and_exit  - after parsing command line, print it and exit

This updates commit 716244c337.
2015-06-10 14:06:03 +01:00
Richard W.M. Jones
a716adac35 p2v: Make sure command is printed before running it.
This updates commit b45f6a0435.
2015-06-10 14:04:49 +01:00
Richard W.M. Jones
4c8bbc45be p2v: Refactor code that dumps the configuration for debugging.
This is just code motion.
2015-06-10 14:03:43 +01:00
Richard W.M. Jones
bb5b23c151 p2v: Fix parsing of p2v.memory parameter (RHBZ#1229262).
The sscanf call always failed because we checked for the wrong return
code.

We don't need to allocate two characters for the mem_code field since
sscanf doesn't append a nul byte.

This commit also allows you to use lowercase 'm' or 'g' as a memory
unit.

Also clarify the documentation: the memory unit must be given.
2015-06-10 13:39:26 +01:00
Richard W.M. Jones
b45f6a0435 p2v: Add p2v.pre, p2v.post, p2v.fail commands (RHBZ#1229385).
The default p2v.post command, when run from the ISO, is to poweroff
the machine after successful conversion.
2015-06-09 18:17:04 +01:00
Richard W.M. Jones
716244c337 p2v: Correct parsing of /proc/cmdline, including quoting.
Fix the parsing of /proc/cmdline, including allowing double quoting of
parameters.

This allows you to pass parameters to p2v on the command line which
include spaces.
2015-06-09 18:17:04 +01:00
Richard W.M. Jones
154251b3f0 p2v: Modify /etc/issue with clearer instructions. 2015-06-09 15:27:55 +01:00
Richard W.M. Jones
cca4343203 p2v: Update documentation.
- How to configure virt-p2v for PXE boot.

- How to test PXE boot using qemu.
2015-06-09 15:27:55 +01:00
Richard W.M. Jones
fc554d422a p2v: Chomp kernel command line (fix) (RHBZ#1229340).
Calculate the length of the string, not the length of the buffer.

This fixes commit 6114c10df0.
2015-06-09 15:27:55 +01:00
Pino Toscano
aa50d02f36 builder: add a doc snippet about firstboot scripts
Document basic information about them for Linux and Windows guests.
2015-06-09 15:30:16 +02:00
Pino Toscano
d8f1962bd2 podwrapper: simplify external references pointing to self
When convering a POD documentation, possibily combining various
sub-documents together, simplify the L<> links that explicitly point to
the very same documentation being generated.

For example, when generating the virt-builder documentation, links like
  L<virt-builder(1)/SECTION>
will be turned into
  L</SECTION>
thus not making Pod::Simple parse them as external reference.

While it is a slightly crude hack, it seems there's no easy way to
process the link parsing with Pod::Simple subclasses.
2015-06-09 10:54:13 +02:00
Richard W.M. Jones
6114c10df0 p2v: Chomp kernel command line (RHBZ#1229340).
When using the kernel command line to configure virt-p2v, if any p2v.*
parameter appeared right at the end of the kernel command line, then a
bogus \n would be appended.  Remove this.

This is essentially the same fix as:
4819655b3c
2015-06-08 14:49:22 +01:00
Richard W.M. Jones
9b9be6d1c6 Version 1.29.46. 2015-06-06 18:34:15 +01:00
Richard W.M. Jones
61ac4233b5 Update translations from Zanata. 2015-06-06 18:32:38 +01:00
Nikos Skalkotos
4f020682ee Use safe_realloc() in favor of realloc overall. 2015-06-06 14:30:29 +01:00
Chen Hanxiao
7429b6b261 sysprep_operation: fix a typo
s/rathern/rather

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-06-06 14:21:34 +01:00
Richard W.M. Jones
47a15da2e7 lib: command: Fix leak in the per-child-process rlimit structures.
This fixes commit 9db0f807a9.

Bug found by valgrind.
2015-06-06 14:08:34 +01:00
Richard W.M. Jones
8b1b3a10b3 fuse: Use SKIP_TEST_FUSE_SH consistently.
This fixes commit 96a02f0864.
2015-06-06 14:08:24 +01:00
Richard W.M. Jones
4ce94cede6 proto: Don't set g->last_errnum directly.
I'm trying to think if there was any reason why we would have set
g->last_errnum directly instead of using the proper function
(guestfs_int_error_errno), but I cannot think of one.

Since error (g, ...) is just a macro that calls
guestfs_int_error_errno (g, 0, ...), this code is equivalent.
2015-06-06 14:07:14 +01:00
Richard W.M. Jones
34439a04f1 appliance: Make sure /tmp and /var/tmp are real directories.
Currently if /tmp (on the host) is a symlink, then the symlink is
copied into the appliance, probably pointing to a non-existent
directory, and everything goes downhill from there.

Avoid this by making sure that /tmp and /var/tmp are real directories.
2015-06-06 14:04:40 +01:00
Nikos Skalkotos
ee87fdaf8f inspector: tests: Enable the Arch Linux test 2015-06-03 18:59:44 +01:00
Pino Toscano
fa80f88c9c mllib: use Unix.gettimeofday instead of Unix.time
Unix.gettimeofday returns a finer resolution than seconds, which is what
we need since deciseconds of timestamps are printed.
2015-06-03 16:13:43 +02:00
Richard W.M. Jones
14a8461a5c Version 1.29.45. 2015-06-02 17:43:02 +01:00
Pino Toscano
1ff463e869 inspection: fix CentOS 7 detection
In newer CentOS 7 versions /etc/redhat-release says that the distro is
derived from RHEL, so we need to look at /etc/centos-release for
actually identifying it as CentOS.

The old code is needed as sub-case of /etc/redhat-release, as on
CentOS < 7 that file is a symlink to /etc/centos-release.
2015-06-02 17:43:02 +01:00
Pino Toscano
a50af9e148 inspection: lift size limit for RHEL icons
In RHEL-based distros, the provided icons have (obviously) different
sizes than the RHEL ones, used in icon_rhel as reference.

Since 100K should be a reasonable threshold for avoid keeping a
per-distro list of limits, just use it as only size limit.
2015-06-02 17:43:02 +01:00
Nikos Skalkotos
25ca08f490 Add tests for CoreOS
Signed-off-by: Nikos Skalkotos <skalkoto@grnet.gr>
2015-06-02 17:40:01 +01:00
Nikos Skalkotos
8cc36215f9 inspection: Add support for CoreOS
* Implement coreos distro
* Detect CoreOS images

Signed-off-by: Nikos Skalkotos <skalkoto@grnet.gr>
2015-06-02 17:40:01 +01:00
Nikos Skalkotos
721cd0d66e inspection: Add func for merging fs inspections
Add a new guestfs_int_merge_fs_inspections() function that merges the OS
inspection information of two inspect_fs instances into one. This
function is useful if the inspection information for an OS are gathered
by inspecting multiple filesystems.

Signed-off-by: Nikos Skalkotos <skalkoto@grnet.gr>
2015-06-02 17:40:01 +01:00
Richard W.M. Jones
467cd4b760 p2v: Introduce a common file to store virt-p2v ISO dependencies.
Instead of having virt-p2v-make-disk and virt-p2v-make-kickstart
separately contain a list of the virt-p2v ISO dependencies, combine
the dependencies into a single file ('p2v/dependencies.m4') and use
that to generate the respective dependencies in each script.
2015-06-02 16:27:13 +01:00
Richard W.M. Jones
3e9a0fac14 p2v: Set status to "Conversion cancelled by user" when user cancels (RHBZ#1226794).
Thanks: Tingting Zheng.
2015-06-02 13:51:47 +01:00
Richard W.M. Jones
2dc88ba8cb FAQ: Document using libguestfs to access live guest disk images.
Gets asked on the mailing list several times a year.
2015-06-01 11:58:22 +01:00
Richard W.M. Jones
0bf4be64ee v2v: -o libvirt: Remove unnecessary comment. 2015-05-31 22:30:18 +01:00
Richard W.M. Jones
2e2f016ce9 v2v: Add a <!-- generated by .. --> comment in output XML files. 2015-05-31 22:22:20 +01:00
Richard W.M. Jones
284d220091 v2v: OVF: Add comment that 'IsInitilized' is not a typo. 2015-05-31 21:49:49 +01:00
Richard W.M. Jones
98e40a0cc8 perl: XML::XPath and XML::XPath::XMLParser are not required. 2015-05-29 15:07:31 +01:00
Pino Toscano
c31c077aa5 java: doc: add the version (if available) of APIs 2015-05-28 16:47:21 +02:00
Pino Toscano
db1b0bc508 ocaml: doc: add the version (if available) of APIs
Make sure to not add more newline's than needed.
2015-05-28 16:47:21 +02:00
Pino Toscano
0a18465c23 gobject: doc: add the version (if available) of APIs 2015-05-28 16:47:21 +02:00
Pino Toscano
fc1f6deab1 generator: move api_version to a common version_added
This way the version string of each API can be used also in other
generator modules.

Mostly code motion, no actual behaviour changes.
2015-05-28 16:47:21 +02:00
Maros Zatko
33d2b4a734 inspector: recognize ppc64 and ppc64le archs (RHBZ#1211996) 2015-05-28 12:49:04 +01:00
Richard W.M. Jones
0645cd3655 builder: Add Fedora 22 (armv7l) image. 2015-05-27 21:26:01 +01:00
Richard W.M. Jones
c0e7bb5ef2 builder: armv7l: Fix build script for Fedora 22 release.
(The same change as was made in
commit c4a54e00a3).
2015-05-27 17:36:49 +01:00
Richard W.M. Jones
54f54697b9 Version 1.29.44. 2015-05-26 21:47:42 +01:00
Richard W.M. Jones
41ce78f02e builder: Add Fedora 22 aarch64 image. 2015-05-26 21:13:44 +01:00
Richard W.M. Jones
9db0f807a9 lib: Limit space and time used by 'qemu-img info' subprocess.
After fuzzing 'qemu-img info' I found that certain files can cause the
command to use lots of memory and time.  Modify the command
mini-library to allow us to place resource limits on subprocesses, and
use these to limit the amount of space and time used by 'qemu-img info'.
2015-05-26 21:13:44 +01:00
Richard W.M. Jones
9c773962c5 Remove src/api-support and generate this information from actions added field. 2015-05-26 21:13:44 +01:00
Richard W.M. Jones
b59c81d9e8 generator: Check 'added' field is set for each API. 2015-05-26 20:21:16 +01:00
Richard W.M. Jones
8816f06cdc generator: Move version first added to generator.
This change was generated automatically using the following Perl
script, with a few hand corrections afterwards.

use strict;
my %map;
open ADDED, "src/api-support/added" or die "added: $!";
while (<ADDED>) {
    chomp;
    if (/^guestfs_(.*)_(argv|va|opts) /) {
        # ignore _argv, _va, _opts entries.
    }
    elsif (/^guestfs_(compare|copy)_/) {
        # ignore guestfs_compare_*, guestfs_copy_* struct functions.
    }
    elsif (/^guestfs_(.*) [01]\.(\d+)\.(\d+)$/) {
        $map{$1} = [1, $2, $3];
    }
    elsif (/^guestfs_(.*) 0\.(\d+)$/) {
        $map{$1} = [0, 0, $2];
    }
    else {
        die "cannot parse line: `$_'\n"
    }
}
close ADDED;
open ACTIONS, "generator/actions.ml" or die "actions.ml: $!";
open ACTIONS_OUT, ">generator/actions.ml.out" or die "actions.ml.out: $!";
while (<ACTIONS>) {
    chomp;
    if (/name = "(.*)";$/ && exists $map{$1}) {
        my @v = @{$map{$1}};
        $_ .= sprintf (" added = (%d, %d, %d);", $v[0], $v[1], $v[2]) ;
        delete $map{$1};
    }
    print ACTIONS_OUT "$_\n";
}
close ACTIONS_OUT;
close ACTIONS;
2015-05-26 20:21:16 +01:00
Richard W.M. Jones
d0d492def2 generator: Add 'added' (version when added) field. 2015-05-26 20:21:16 +01:00
Richard W.M. Jones
41cf78f36b Update API support. 2015-05-26 20:21:16 +01:00
Richard W.M. Jones
a59fc8ee32 api-support: Ignore guestfs_impl_* symbols. 2015-05-26 20:21:15 +01:00
Richard W.M. Jones
c919f6f75c api: Don't truncate /dev/stdout or /dev/stderr when used as FileOut.
In APIs such as guestfs_download, when the FileOut parameter exactly
matches "/dev/stdout" or "/dev/stderr", don't reopen the possibly
redirected output file with O_TRUNC (truncate).  Instead dup the file
descriptor.

This magic behaviour doesn't happen for /dev/fd/* (or any other output
file) allowing callers the choice of using /dev/stderr or /dev/fd/2
depending on whether or not they want truncation.

This works around an annoying virt-builder bug.  If you do:

  $ virt-builder fedora-21 --install no_such_package -v -x >& /tmp/log

then when the `--install' command fails, virt-builder will download
the log file using `guestfs_download (g, log, "/dev/stderr")'.  Since
this truncates the redirected /dev/stderr, the final log file is
truncated and corrupted.

With this patch the log file is no longer corrupted.
2015-05-26 20:21:15 +01:00
Richard W.M. Jones
c4a54e00a3 builder: aarch64: Fix build script for Fedora 22 release. 2015-05-26 20:21:15 +01:00
Richard W.M. Jones
aa4dee7b7c builder: Add Fedora 22 image. 2015-05-26 20:21:15 +01:00
Richard W.M. Jones
aa7fa1cf00 v2v: RHEL 7 virt-v2v conversion server requires virtio-win. 2015-05-21 21:58:08 +01:00
Richard W.M. Jones
3a63ee2aaf v2v: Fix confusion over rhel-7 virt-v2v conversion server / appliance.
This fixes commit 4c7fb62f4a
and updates commit 4e4ece5364.
2015-05-20 07:40:22 -04:00
Richard W.M. Jones
10cb9b9545 p2v: Force systemd default target to be multi-user (text mode). 2015-05-19 17:41:16 +01:00
Richard W.M. Jones
f6dd8a3221 p2v: Explicitly depend on nm-connection-editor.
Previously it was only being pulled in implicitly.  However virt-p2v
runs this binary from the "Configure Network" button.

This fixes commit e464774a79.
2015-05-19 17:32:16 +01:00
Richard W.M. Jones
63cd28974e p2v: kickstart: Try harder to stop systemd from renaming network devices. 2015-05-19 14:44:32 +01:00
Chen Hanxiao
0fbe8fb3e0 resize: add sector size in debug_partition
This patch will add fields of sector size for:
  - partition sector data size
  - target partition sector data size

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-05-18 13:36:53 +01:00
Richard W.M. Jones
ce9f059dce Version 1.29.43. 2015-05-15 21:16:38 +01:00
Richard W.M. Jones
58c24a6bf8 builder: sigchecker: Fix error message.
Error messages are automatically wrapped, and don't require a newline
at the end.
2015-05-15 20:34:28 +01:00
Richard W.M. Jones
ef4f0fc8f9 sparsify: Use message function instead of printf. 2015-05-15 20:30:43 +01:00
Richard W.M. Jones
f2aa9261a8 ocaml tools: Translate a few messages which were not internationalized. 2015-05-15 19:10:28 +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
71854a56c1 builder: Remove a few unnecessary 'virt-builder' strings from error messages. 2015-05-15 15:26:11 +01:00
Richard W.M. Jones
a43e8405ef customize: Allow --selinux-relabel flag to work on cross-architecture builds (RHBZ#1212807). 2015-05-15 15:18:20 +01:00
Richard W.M. Jones
8864c47b94 customize: Give a clear error message if host_cpu not compatible with guest arch.
In cases where we are asked to run commands in the guest (eg.  options
such as --run-command or --install), give a clear error in the cases
where the guest arch is not compatible with the host arch.

Similar code existed in virt-builder, but I have removed that.  Users
will still get an error message, it will just happen a bit later on.

There is a slight change in semantics here, in that architectures are
no longer normalized when matching, but that's probably fine since
`virt-builder -l' prints the exact arch string that people should use.
2015-05-15 15:18:20 +01:00
Richard W.M. Jones
ab7197476d ocaml tools: Only tell people to use -v -x if they're not already set (RHBZ#1167623).
When you get an error in tools, it will print a message like:

  If reporting bugs, run virt-v2v with debugging enabled and include the
  complete output:

    virt-v2v -v -x [...]

Only print this message if -v or -x were not already specified on the
command line.
2015-05-15 15:18:19 +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
e35605ad8d ocaml tools: Define Common_utils.prog and don't pass it to every function.
This large commit is just code refactoring.  Instead of having
every OCaml tool define 'prog' the same way, always as:

  let prog = Filename.basename Sys.executable_name

move that into a single place, Common_utils.prog.  Then we can use
that global value everywhere else, instead of having to pass it as a
parameter into a dozen different functions.
2015-05-15 15:18:19 +01:00
Richard W.M. Jones
a255e283d0 resize: Remove unnecessary 'prog' from error message.
The common error function already prints the program name, so
we don't need to print it twice.

Before:

  $ virt-resize --expand ""
  virt-resize: error: virt-resize: empty --expand option

After:

  $ virt-resize --expand ""
  virt-resize: error: empty --expand option
2015-05-15 15:18:19 +01:00
Richard W.M. Jones
7800fbda19 builder: Fix expand partition for fedora-21 armv7l image.
Thanks: d.marlin
2015-05-15 10:09:25 +01:00
Richard W.M. Jones
0833c192b6 p2v: Display network card MAC address and vendor in conversion dialog (RHBZ#855059).
This displays the MAC address and vendor next to each network
interface, aiding users in determining which network cards they want
to transfer to the virtualized machine.
2015-05-14 13:57:41 +01:00
Richard W.M. Jones
5bf7f770b6 When calling getline first time, initialize length to zero.
The man page for getline says:

   ssize_t getline(char **lineptr, size_t *n, FILE *stream);
 [...]
   If  *lineptr  is set to NULL and *n is set 0 before the call, then get‐
   line() will allocate a buffer for storing the line.  This buffer should
   be freed by the user program even if getline() failed.

which seems to indicate that we must initialize both line and len to 0
before the first call to getline.

In several places we were not initializing len.  The program still
worked fine, but it seems better to initialize the length anyway.
2015-05-14 13:22:00 +01:00
Chen Hanxiao
7eb1ed8cb4 resize: show sector infor in debug_partition
Show partition sector data and target partition sector data
in debug_partition.
Also, if --verbose, call debug_partition again before
parted partitions.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>

RWMJ: Changed ~sectsize:sectsize => ~sectsize
2015-05-14 12:22:21 +01:00
Richard W.M. Jones
6574134feb Version 1.29.42. 2015-05-14 10:49:53 +01:00
Richard W.M. Jones
82cc8a8f8f build: Add ocaml-link.sh to EXTRA_DIST.
This fixes commit 13dd632301.
2015-05-14 10:49:24 +01:00
Pino Toscano
fd85a2a22b mllib: link tests with automake
Add a dummy C source, otherwise automake tries to look for e.g.
common_utils_tests.c.

Also, set check_PROGRAMS properly with them.
2015-05-13 16:45:41 +02:00
Pino Toscano
13dd632301 build: factor out the OCaml link.sh scripts
Create a single ocaml-link.sh script, which supports a -cclib parameter
so it can be used instead of the per-project link.sh scripts.
As result, the libraries for each OCaml application can be moved back to
each Makefile.am.
2015-05-13 15:30:39 +02:00
Pino Toscano
0e5ccabd83 configure: simplify check for oUnit v2
Instead of parsing the version, try to look for the OUnit2 module within
the oUnit package.

Followup of commit 46bc79109b.
2015-05-13 10:42:13 +02:00
Richard W.M. Jones
85347e32e0 v2v: Close libvirt connection after fetching libvirt capabilities.
Memory leak found by valgrind.

This fixes commit e7833a5eea.
2015-05-12 22:19:08 +01:00
Richard W.M. Jones
96a02f0864 fuse: Add more consistent SKIP_* environment variables.
The new behaviour is as follows:

Skip all of the fuse tests:

  SKIP_TEST_FUSE_SH=1

Individual tests can be skipped by setting:

  SKIP_TEST_FUSE_UMOUNT_RACE_SH=1
  SKIP_TEST_GUESTMOUNT_FD=1
  SKIP_TEST_GUESTUNMOUNT_FD=1
  SKIP_TEST_GUESTUNMOUNT_NOT_MOUNTED_SH=1
2015-05-12 11:48:44 +01:00
Pino Toscano
41df8a2c46 builder: enable batch mode when validating non-verbose (RHBZ#1180170)
When running gpg to validate a signature, use also --batch in
non-verbose mode to avoid the extra "Good signature" messages that are
printed by gpg2 even in quiet mode.
We are parsing the status output anyway to check the validation result,
so this should be harmless (and the full gpg output is printed in
verbose mode anyway).
2015-05-12 09:13:34 +02:00
Pino Toscano
6442bcb7eb builder: trust the imported keys
In every SigChecker, trust by default the keys imported.
This should make gpg happier when using the keys later, used only when
validating the signatures of index files.
2015-05-12 09:13:34 +02:00
Pino Toscano
a1a165e3c4 builder: move gpg status parsing within import_keyfile
Parse the gpg status output directly within import_keyfile, returning
just the key fingerprint.

Just code motion, no actual behaviour changes.
2015-05-12 09:13:34 +02:00
Richard W.M. Jones
46bc79109b configure: Ensure oUnit version >= 2 before using it.
This fixes commit e12c0dfe1f.
2015-05-11 20:44:22 +01:00
Richard W.M. Jones
e9ea21b27d Version 1.29.41. 2015-05-11 13:22:24 +01:00
Richard W.M. Jones
43e3a4e37f v2v: Add v2v_unit_tests.ml to EXTRA_DIST.
This fixes commit e12c0dfe1f.
2015-05-11 13:21:56 +01:00
Richard W.M. Jones
e12c0dfe1f v2v: OVF: Add unit tests for modified OVF.get_ostype function.
This adds unit tests for commit 6f9d5dce47.
2015-05-11 10:38:22 +01:00
Richard W.M. Jones
936ddfbb38 mllib: Require OUnit2 for tests.
OUnit2 has an OUnit (v1) compatibility module.  Unfortunately it
is rather gravely broken:
https://forge.ocamlcore.org/tracker/?func=detail&aid=1392&group_id=162&atid=730

Since there is no new release fixing this, it's easier to switch to
using OUnit2 for unit tests.
2015-05-11 10:26:53 +01:00
Richard W.M. Jones
6f9d5dce47 v2v: OVF: Fix list of operating system variants for RHEV >= 3.3 (RHBZ#1219857).
Since RHEV 3.3, OS variant names like "RHEL6x64" were deprecated and
replaced by names like "rhel_6x64".  "RHEL7x64" was never valid, and
we should have used "rhel_7x64".  "Windows2012R2x64" was also never
valid and should have been "windows_2012R2x64".

For backwards compatibility, RHEV still understands the old names, and
we still pass them for compatiblity with old RHEV.

However for the new OS variants supported by virt-v2v in RHEL 7.2, use
the new names.

This commit also adds support for SLES and ppc64.

This updates commit 3c51302d69
and also RHBZ#1213324.
2015-05-10 16:15:56 +01:00
Richard W.M. Jones
61a021713e p2v: Update documentation for Configure network button.
This updates commit e464774a79.
2015-05-09 17:59:26 +01:00
Richard W.M. Jones
35efaf8208 p2v: Add tip about the root password of the virt-v2v conversion server appliance. 2015-05-09 17:53:57 +01:00
Richard W.M. Jones
a3edef9295 v2v: Remove obsolete README.RHEV-M file. 2015-05-09 17:41:57 +01:00
Richard W.M. Jones
4c7fb62f4a v2v: Rename virt-v2v appliance to "conversion server".
This is for consistency with the rest of the documentation.

This commit also adds the files to EXTRA_DIST so they are shipped in
the tarball.

This updates commit 4e4ece5364.
2015-05-09 17:40:42 +01:00
Richard W.M. Jones
4e4ece5364 v2v: Add scripts for building RHEL 7 virt-v2v appliance. 2015-05-08 15:46:11 +01:00
Richard W.M. Jones
4f489b28fe Try to discourage people from using 'make install' because it causes
endless support troubles.
2015-05-07 22:19:13 +01:00
Richard W.M. Jones
dcd382d9d4 Version 1.29.40. 2015-05-06 17:10:07 +01:00
Richard W.M. Jones
e464774a79 p2v: Add Configure Network button (RHBZ#1167921).
The old version of virt-p2v had a whole custom-written dialog which
interacted with NetworkManager over dbus.  After trying that approach,
it's really complex to get right.

Instead this button simply opens NetworkManager's connection editor.

This also adds nm-applet to the disk and starts it.  However nm-applet
does not display any visible indication -- probably because we are
lacking a system tray.
2015-05-06 16:20:36 +01:00
Richard W.M. Jones
9b2ca08ab5 p2v: Switch from matchbox-window-manager to metacity.
Matchbox only supports a single window on screen.  This worked fine
until we added the NetworkManager connection dialog -- which tries to
open in a new top level window, and of course fails.

Metacity supports multiple top-level windows so doesn't suffer this
problem.

Apart from that it's hard to tell the difference between the two.
2015-05-06 15:14:04 +01:00
Richard W.M. Jones
d5305c9672 p2v: Use "About virt-p2v [VERSION]" on the about button.
This makes it clearer what the button does.

This updates commit a743f57cb8.
2015-05-05 21:02:27 +01:00
Richard W.M. Jones
badfc2e9b2 v2v: -o libvirt: Check if the domain exists on the target (RHBZ#889082). 2015-05-05 20:14:15 +01:00
Richard W.M. Jones
e7833a5eea v2v: Add a C function to fetch libvirt hypervisor capabilities.
Instead of having to run external 'virsh capabilities' command and
parsing the output.
2015-05-05 15:55:53 +01:00
Richard W.M. Jones
1189d5919e p2v: Warn if vcpus or memory would be larger than supported by RHEL (RHBZ#823758).
Display a warning if the number of vCPUs or memory selected in the GUI
would be larger than the limits currently supported on RHEL 6 and RHEL 7.

This is just a warning -- the user is free to ignore it and continue
anyway.

This warning does not apply if the selections were made through the
kernel command line, because there is no place to display the warning
for automated conversions.
2015-05-05 15:10:27 +01:00
Richard W.M. Jones
b1336f26e6 p2v: Factor out code for parsing vcpus & memory from conversion dialog.
No functional change, just code refactoring.
2015-05-05 15:09:33 +01:00
Richard W.M. Jones
ed19af781f tests/data: Add IA64 (Intel Itanium II) test binaries. 2015-05-03 14:58:59 +01:00
Richard W.M. Jones
f1b7e1b58b Version 1.29.39. 2015-05-02 09:21:47 +01:00
Richard W.M. Jones
4f414c7299 v2v: docs: General updates to the manual. 2015-05-01 22:19:58 +01:00
Richard W.M. Jones
9246d75eeb v2v: docs: Replace "VMware ESX" with more accurate VMware vCenter/ESXi.
"VMware ESX" is no longer a VMware product.  The hypervisor is
called VMware ESXi and the management software is VMware vCenter.
2015-05-01 22:19:30 +01:00
Richard W.M. Jones
1b74e90de8 tests/data: Add ppc64/ppc64le binaries to the test ISO.
This fixes commit 58bbb93a25.
2015-05-01 14:30:46 +01:00
Richard W.M. Jones
ac04939309 tests/data: Add mipsel (32 bit MIPS little endian) test binaries. 2015-05-01 14:29:23 +01:00
Richard W.M. Jones
40558450dd v2v: efi: Support output of UEFI guests, for some output drivers (RHBZ#1184690).
Add the Types.target_firmware type, which stores our final decision
for whether the guest requires BIOS or UEFI on the target.

Not all output modes support UEFI.  In order to fail as early as
possible if conversion isn't going to be possible, there is an
output#supported_firmware method which returns the list of supported
target_firmware.

Add the target_firmware parameter to output#create_metadata so it can
select the correct firmware in the final metadata.
2015-04-30 17:40:21 +01:00
Richard W.M. Jones
086f71c7d8 v2v: Dump inspect and guestcaps structs when running in verbose mode.
This helps with debugging.
2015-04-30 17:40:21 +01:00
Richard W.M. Jones
6a76d6d780 v2v: efi: Detect if the guest could boot with UEFI.
Use a heuristic to detect if the guest could boot with UEFI.

This is only used where we have missing metadata (in the
source.s_firmware == UnknownFirmware case).  Currently that only
applies for `-i disk' and `-i libvirt/libvirtxml'.

Eventually we'll be able to get this information from the libvirt
metadata (RHBZ#1217444), so it'll only be used for `-i disk'.
2015-04-30 17:38:49 +01:00
Richard W.M. Jones
ef77725081 v2v: efi: Model firmware in source metadata.
Also modify the input_* drivers so they pull out the firmware from the
metadata.  Currently this is only possible for `-i ova', since libvirt
does not expose it (RHBZ#1217444).
2015-04-30 17:38:49 +01:00
Richard W.M. Jones
9a45508f23 v2v: efi: linux: Add support for grub2-efi. 2015-04-30 17:38:48 +01:00
Richard W.M. Jones
051f1f1a3f v2v: efi: linux: Remove EFI hacks.
Old virt-v2v had a bunch of code for removing EFI configuration from a
Linux guest, and replacing it with grub.  I copied this code to new
virt-v2v but it was never tested.

Now that OVMF exists, we can simply boot EFI guests directly on KVM.

Thus these hacks can finally be removed.
2015-04-30 17:38:32 +01:00
Richard W.M. Jones
06e93bf3ea mips: Ignore missing prototypes in flex-generated code. 2015-04-30 11:20:45 +01:00
Pino Toscano
1f514f3466 inspector: fix formatting of xpath result (RHBZ#1212680)
Discard blank nodes when reading the XML from stdin, while enabling
formatting in output nodes.
2015-04-29 14:57:22 +02:00
Pino Toscano
22686d2cfd customize: add a "touch" operation (RHBZ#1212808) 2015-04-28 15:22:45 +02:00
Richard W.M. Jones
63e0045926 builder: Fix release notes for Debian 8.
Editing inittab is not required for this version since it
uses systemd.

This fixes commit be81fbb323.
2015-04-28 10:01:42 +01:00
Richard W.M. Jones
be81fbb323 builder: Add Jessie (Debian 8). 2015-04-28 09:39:27 +01:00
Richard W.M. Jones
21764ec7c2 Version 1.29.38. 2015-04-27 20:29:37 +01:00
Richard W.M. Jones
b70aec11c6 random_seed: Don't try to create random seed if no parent directory.
Partial fix for https://bugzilla.redhat.com/show_bug.cgi?id=1215803
2015-04-27 20:28:26 +01:00
Richard W.M. Jones
2841400721 firstboot: Don't create very long filenames for --firstboot-command (RHBZ#1212152). 2015-04-27 16:19:33 +01:00
Richard W.M. Jones
aa8d66e755 firstboot: Factor out regular expression constant.
Don't need to evaluate this every time we call the function.
2015-04-27 16:19:33 +01:00
Pino Toscano
8c26ef91f9 v2v: convert old-style libvirt listen configuration (RHBZ#1174073)
Use the listen configuration from the "listen" attribute of <graphics>,
in case <listen> is missing.

Followup of commit 9360675dc2.
2015-04-27 10:16:40 +02:00
Richard W.M. Jones
2dd01c5d2d v2v: Remove warning when compiling --without-libvirt. 2015-04-25 22:27:50 +01:00
Richard W.M. Jones
e3443a7549 v2v: -o libvirt: Minor refactoring of arch sanity check. 2015-04-25 22:11:07 +01:00
Richard W.M. Jones
4546d3f21d v2v: Replace polymorphic variant source_hypervisor with ordinary variant.
See commit 3a080c3fbf.
2015-04-25 21:46:26 +01:00
Richard W.M. Jones
946d49cbbc v2v: Remove further uses of polymorphic variants.
See commit 3a080c3fbf.
2015-04-25 21:40:49 +01:00
Richard W.M. Jones
ce630dfc33 valgrind: Add suppression for libvirt memory leak.
Related to RHBZ#1215042.
2015-04-24 09:04:38 +01:00
Richard W.M. Jones
e9910b4887 Version 1.29.37. 2015-04-23 19:57:56 +01:00
Richard W.M. Jones
578c7c0868 builder: Add rhel-ppc64.sh & rhel-ppc64le.sh to EXTRA_DIST.
This fixes commit c5f0d39c64.
2015-04-23 19:57:06 +01:00
Richard W.M. Jones
b02980d5af fuse: tests: Add some debugging to test-fuse-umount-race.sh.
This test fails on recent kernels, sometimes.

Apparently calling 'fusermount -u mp' can exit with an EBUSY error,
but still unmount the filesystem.  Or possibly guestmount crashes
coincidentally.  It's impossible to debug because debugging tools like
strace prevent fuse from working at all.
2015-04-23 19:03:36 +01:00
Richard W.M. Jones
6dee5a4152 fuse: guestunmount: Make the -v (verbose) option do something useful.
guestunmount had a -v / --verbose option, but it didn't change the
behaviour of the program in any way.

Make it print the invocations of the underlying fusermount program.
2015-04-23 19:02:41 +01:00
Richard W.M. Jones
0e4c351bb4 mllib: Link config.ml to the test program.
This fixes commit a1646fa65c.
2015-04-23 17:56:28 +01:00
Richard W.M. Jones
4f021006e9 v2v: When debugging, dump OVF to stderr.
Useful for debugging problems like RHBZ#1213701.
2015-04-23 10:53:04 +01:00
Richard W.M. Jones
c5f0d39c64 builder: Add scripts for generating RHEL 7 ppc64 & ppc64le images. 2015-04-22 22:16:52 +01:00
Richard W.M. Jones
2b0c6e8565 v2v: Pass sound card information from the source to the target (RHBZ#1176493).
Collect sound card information from the source, and where possible,
create a compatible sound card on the target.

Notes:

* VMware's libvirt driver, and also OVF files, do not appear to
  contain any sound card information, so it cannot be collected from
  VMware sources.

* Xen does emulate sound cards and makes that information available
  through libvirt XML.

* There are no paravirt drivers for sound that I'm aware of.
  Therefore we can just copy the same sound model to the target (so
  the sound device does not appear to change).  If the target, KVM,
  does not support the device, it is dropped.  But ...

* ... Unfortunately we cannot easily tell which sound cards are
  supported by KVM on the target.  This is especially a problem for
  RHEL, where many sound drivers have been removed.  There is a
  convenience function, `Utils.qemu_supports_sound_card', which can be
  modified by packagers to hard code the list of supported sound
  cards.

* If a sound card is dubious / not supported by the target / has any
  other problem, then we drop it, since it is more important that the
  guest boots on the target than that sound works.
2015-04-20 22:14:16 +01:00
Richard W.M. Jones
3834a1064f v2v: tests: Don't need to generate test-v2v-networks-and-bridges.xml.
virt-v2v understands relative paths in libvirt XML (even though they
are not legal and libvirt itself wouldn't generate it).  We don't need
to generate this file.
2015-04-20 21:07:47 +01:00
Pino Toscano
a1646fa65c build: create and use a full version string
Create a version string that includes the "extra" string as well, and
make use of it in print_version_and_exit (which can avoid creating a new
Guestfs handle).

Folloup of commit 478a552ab4.
2015-04-20 15:38:32 +02:00
Pino Toscano
4268865a78 build: require Config before Common_utils
Build the Config mllib module before Common_utils, as the latter will
soon make use of the former.
2015-04-20 15:38:31 +02:00
Richard W.M. Jones
0576fdd0b6 v2v: Only emit fstrim warning when debugging (RHBZ#1168144).
fstrim is an optimization.  If it fails, it's not fatal (although
virt-v2v will run a lot more slowly).

We also expect that it will fail for non-aligned NTFS partitions found
on old versions of Windows, and in that case there's nothing that can
be done about it.

Therefore only emit the warning when we are debugging.
2015-04-20 13:12:08 +01:00
Richard W.M. Jones
3c51302d69 v2v: OVF: Add more Windows operating system variants (RHBZ#1213324).
When generating OVF (eg. for -o rhev, -o vdsm) we have to put the
operating system type into a particular field of the output, in a
format that oVirt/RHEV will understand.  Add further Windows OS
variants to this list.  The variants are derived by examining
ovirt-engine sources.

Thanks: Tingting Zheng for testing Windows conversions to RHEV and
finding this bug.
2015-04-20 12:07:18 +01:00
Richard W.M. Jones
86a91d6c65 p2v: Make --version output consistent with other tools (RHBZ#1213247). 2015-04-20 08:55:03 +01:00
Richard W.M. Jones
3b3f06d224 virt-win-reg: Make output of --version flag consistent (RHBZ#1213247). 2015-04-20 08:51:13 +01:00
Richard W.M. Jones
478a552ab4 Common function to implement --version flag in all OCaml tools (RHBZ#1213247).
Add a common function print_version_and_exit ~prog () and use this
function to display the version in all OCaml tools, to ensure
consistent output.
2015-04-20 08:48:08 +01:00
Richard W.M. Jones
921a3b8be2 fish: Whitespace changes. 2015-04-20 08:47:45 +01:00
Richard W.M. Jones
1d78b312bf builder: Add CentOS 7.1 image. 2015-04-18 11:26:03 +01:00
Richard W.M. Jones
58bbb93a25 tests/data: Add ppc64 & ppc64le test binaries. 2015-04-17 20:46:13 +01:00
Richard W.M. Jones
b2fbd88d9f builder: As TCG is single threaded, use 1 vCPU for Fedora ppc64 guests. 2015-04-17 16:11:18 +01:00
Richard W.M. Jones
0debc0b3a7 builder: Set expand=/dev/sda3 for Fedora 21 ppc64 images. 2015-04-17 11:28:43 +01:00
Richard W.M. Jones
0e73a97ef4 builder: Fedora 21 ppc64 images are now raw not qcow2.
Fixes commit f2109068e5.
2015-04-17 11:17:01 +01:00
Richard W.M. Jones
f2109068e5 builder: Upload new ppc64/ppc64le images which try to resolve console and partitioning problems. 2015-04-17 09:56:10 +01:00
Richard W.M. Jones
8670c784db Version 1.29.36. 2015-04-16 14:04:54 +01:00
Richard W.M. Jones
49867a22ba filearch: Fix memory leak.
Found by 'make check-valgrind'.

This fixes commit 20acc1f124.
2015-04-16 14:04:53 +01:00
Richard W.M. Jones
0f4ad9cd84 builder: Use console=hvc0 for serial console in ppc64 guests, and change partitioning type to LVM. 2015-04-16 10:31:33 +01:00
Richard W.M. Jones
b4be660ed6 Version 1.29.35. 2015-04-15 22:30:52 +01:00
Richard W.M. Jones
cc44a5b511 builder: Add fedora-ppc64le.sh script to EXTRA_DIST. 2015-04-15 22:30:25 +01:00
Pino Toscano
8f55030965 v2v: test-v2v-i-ova-formats.sh: test ova as tar.gz and tar.xz
Extend test-v2v-i-ova-formats.sh to test for tarballs compressed as gzip
or xz; followup of commit 3c582cfb8d.
2015-04-15 15:28:14 +02:00
Pino Toscano
454220ab43 v2v: generalize test-v2v-i-ova-zip.sh
Rename test-v2v-i-ova-zip.sh (and associated data) to
test-v2v-i-ova-formats, and generalize it a bit so it can test different
compression types for the ova "envelope".
2015-04-15 15:28:14 +02:00
Richard W.M. Jones
eab054a574 builder: website: Set format=qcow2 for Fedora 21 ppc64 images.
Since I created these with virt-builder without specifying the format,
they have format=qcow2 (not raw).  Instead of tediously recreating or
reuploading these images, just change the metadata.
2015-04-15 13:32:45 +01:00
Richard W.M. Jones
f358d3d1ed builder: In new virt-install, you must specify the format when creating disk images.
New virt-install defaults to qcow2 format unless specified.
Previously it defaulted to raw.  Specify the format explicitly.
2015-04-15 13:32:05 +01:00
Pino Toscano
11450a2d36 v2v: tests: add port='-1' to test-v2v-i-ova.xml reference
Followup of commit 1db249a0cc, as it
outputs a new port attribute.
2015-04-15 14:28:05 +02:00
Pino Toscano
8049474636 v2v: use .ovf and .mf files anywhere within ova files
Do not rely on .ovf and .mf files being in the top-level of the ova
archive, but search them anywhere within the content of the ova.

This also changes the result of the search of the .ovf file: previously,
one (random) file was picked in case there were more than one, while now
this situation triggers an error.

Related to RHBZ#1186800.
2015-04-15 14:24:13 +02:00
Pino Toscano
3c582cfb8d v2v: support tar.gz and tar.xz ova files
When dealing with a ova detected as gzip of xz, uncompress few bytes of
it to check whether it is a compressed tarball, and if so untar it.

Related to RHBZ#1186800.
2015-04-15 14:24:13 +02:00
Richard W.M. Jones
05f5d069ba builder: Upload second revision of ppc64/ppc64le templates.
The serial console should be fixes in these versions.
2015-04-15 12:45:40 +01:00
Pino Toscano
08b1ba35cf v2v: start importing "volume" disk types (RHBZ#1146832)
Import disks stored as "file"-type volumes.

Side effect: a guest converted to libvirt using virt-v2v can be
converted again using virt-v2v.
2015-04-15 09:36:33 +02:00
Pino Toscano
f7529522ab v2v: pass libvirt connection URI to parse_libvirt_xml
This makes it possible to connect to the right libvirt.
2015-04-15 09:36:33 +02:00
Pino Toscano
5da2ed95c1 v2v: domainxml: add vol_dumpxml
Add a new vol_dumpxml to get the XML dump of a pool's volume.
2015-04-15 09:36:33 +02:00
Pino Toscano
9001f61a40 v2v: domainxml: factor out connect and pool loading
Factor out the connection and pool loading out of v2v_pool_dumpxml, so
it can be used in later implementations requiring a pool.

Should be just code motion.
2015-04-15 09:36:32 +02:00
Richard W.M. Jones
eee28390ff builder: Add Fedora 21 ppc64 & ppc64le images.
This also corrects the size= field on all Fedora images.  It should
be 6GB but was 4GB.
2015-04-14 18:20:09 +01:00
Richard W.M. Jones
c65bba313d builder: Add fedora-ppc64le script and build ppc64le template. 2015-04-14 18:20:09 +01:00
Richard W.M. Jones
c5b5442315 builder: Update fedora-ppc64 script and build ppc64 big endian template. 2015-04-14 18:20:09 +01:00
Pino Toscano
1db249a0cc v2v: convert libvirt display port configuration
Read the port configuration from the XML of libvirt domains, restoring
it when writing new libvirt XMLs instead of always setting the
"autoport" option.
2015-04-14 13:22:10 +02:00
Pino Toscano
7291b226d1 filearch: support gzip/xz-compressed files
Extract them to find out the architecture of the data they hold.
Useful to detect the architecture of e.g. compressed Linux modules.

Provide in the test.iso two samples (compressing existing test data) of
binaries compressed with gzip and xz.
2015-04-14 11:13:23 +02:00
Pino Toscano
9360675dc2 v2v: convert libvirt display listen configuration (RHBZ#1174073)
Read the listen configuration from the XML of libvirt domains, restoring
it when writing new libvirt XMLs.
2015-04-14 11:12:23 +02:00
Pino Toscano
20acc1f124 filearch: move libmagic code in an own function
Also use a cleanup attribue to ease the close of the magic_t handle.

This is mostly code motion, hopefully with no actual behaviour changes.
2015-04-13 13:40:21 +02:00
Richard W.M. Jones
e062093881 v2v: Add a man page section on importing from OVA files. 2015-04-13 12:01:22 +01:00
Richard W.M. Jones
abf23ece49 v2v: Document that vCenter >= 5.0 is required (RHBZ#1174200).
vCenter 5.0 was released in 2011.  We have not tested against any
earlier versions, but it was reported that it does not work with
vCenter 4.

Thanks: Sokratis
2015-04-13 11:47:22 +01:00
Richard W.M. Jones
80fcbe6eee v2v: Document that Windows up to 8.1 / 2012R2 now supported.
Commit 2817824bd3 added support for
converting more recent versions of Windows, but neglected to document
it.
2015-04-11 16:39:53 +01:00
Richard W.M. Jones
d23134c5b8 php: Clean up more intermediate files. 2015-04-10 13:55:07 +01:00
Richard W.M. Jones
2e6b14e046 Version 1.29.34. 2015-04-10 13:48:02 +01:00
Richard W.M. Jones
3f98018b43 v2v: test-harness: Describe how to get the test harness.
I don't think it's worth building the test harness as a separate
Fedora package.  It just means the harness gets out of date
quickly and is hard to install.  Instead the test cases can now
be configured to use the libguestfs source directory to get the
test harness.
2015-04-10 13:10:13 +01:00
Richard W.M. Jones
2817824bd3 v2v: Support conversion of Windows >= 8 (RHBZ#1190669).
Tested on:

- Windows 8.1 Pro 64 bit
- Windows Server 2012 R2 64 bit
2015-04-10 12:04:02 +01:00
Richard W.M. Jones
7260b0fc08 v2v: test-harness: Don't send key to wake up guest from blank unless the display is black.
Grub2 in RHEL 6 responds to any key including shift keys by entering
the grub menu (and thus waiting for the 'user' to press Enter).  This
means our previous strategy of always hitting the shift key before
taking a screenshot didn't work well.

Instead, take a screenshot, if it's all (or mostly) black, hit a shift
key and take another screenshot.
2015-04-10 12:04:02 +01:00
Richard W.M. Jones
12be9f831e v2v: test-harness: Match on subimages instead of screenshots.
Previously we fuzzy-matched on screenshots of the entire display.

There were several problems:

 - dates/times in images required fuzzy matching, but it's not clear
   how much fuzz to use (Windows 8.1/2012R2 timestamp is huge,
   requiring an enormous amount of fuzz)

- cannot cope with Windows 7 irregular placement of windows on
  the desktop

It's better to match on subimages.

This requires some changes to the test data, using gimp to clip the
images and remove any changing elements (dates/times/etc) but in the
long run it's more flexible than fuzzy matching on the whole display.

Note that because of peculiarities in 'compare' we still need to have
a little bit of fuzz in the matching.  Seemingly bit-for-bit identical
images still have a similarity > 0.
2015-04-10 12:03:08 +01:00
Richard W.M. Jones
ddeec8b504 v2v: test-harness: Improve boot loop.
Take screenshots each time around the loop (every 10 seconds).  These
are very useful for debugging.

Check for the final screenshot on every iteration.  If the final
screenshot is encountered then the guest is terminated immediately.

Reverse a few loop tests to try to make the code more readable.
2015-04-09 19:03:11 +01:00
Richard W.M. Jones
1fabb99f11 v2v: test-harness: Rearrange 'in' in function definition.
Just a whitespace change.
2015-04-09 17:40:31 +01:00
Richard W.M. Jones
6c27ce649b v2v: test-harness: Use xzcat instead of unxz --keep.
unxz --keep fails on the symlinks used by git-annex with this
rather unnecessary error:

  unxz --keep 'rhel_511_x86_64_pv.img.xz'
  unxz: rhel_511_x86_64_pv.img.xz: Is a symbolic link, skipping

Use xzcat instead.
2015-04-09 15:08:53 +01:00
Richard W.M. Jones
a23f82a5ac v2v: test-harness: New repository URLs, and details of using git-annex. 2015-04-09 15:08:53 +01:00
Richard W.M. Jones
4fd70eab4f v2v: Add support for REG_MULTI_SZ (multiple strings) to registry editor. 2015-04-07 16:58:40 +01:00
Richard W.M. Jones
e264317b04 v2v: test-harness: Update the man page. 2015-04-01 13:57:11 +01:00
Richard W.M. Jones
3034f9a658 v2v: test-harness: Send different shift keys to wake up guests from screen blank.
See:
https://rwmj.wordpress.com/2015/03/30/tip-wake-up-a-guest-from-screen-blank/
2015-04-01 13:24:42 +01:00
Richard W.M. Jones
3cb2b9da25 Version 1.29.33. 2015-04-01 10:06:46 +01:00
Roman Kagan
b8cb5c0d69 v2v: allow configurable location for virtio drivers
Make the location of the Windows virtio drivers overridable with the
environment variable VIRTIO_WIN_DIR, in the same vein as is done for
virt-tools.

Signed-off-by: Roman Kagan <rkagan@parallels.com>
2015-03-31 14:41:49 +01:00
Chen Hanxiao
26b9134450 actions.ml: fix a typo
s/inclding/including

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-03-31 13:03:02 +01:00
Chen Hanxiao
6e989fd709 resize: add p_mbr_p_type as member of type partition
Add p_mbr_p_type as member of type partition
to describe mbr partition type.

Currently we use:
List.filter (fun p -> parttype <> MBR || p.G.part_num <= 4_l)
to filter out logical partitions.

Commit 0c396a4bce
introduce API part_get_mbr_part_type,
we could use this to know the part_type.
Furthermore, we could also use p_mbr_p_type for resizing
logical partitions.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-03-30 18:59:52 +01:00
Richard W.M. Jones
309f7062e8 v2v: test-harness: Don't need to use Unix. prefix, since module is opened. 2015-03-30 13:27:17 +01:00
Richard W.M. Jones
6f53c6c026 v2v: test-harness: Send shift key to wake up screen from blank before taking screenshots. 2015-03-30 13:27:17 +01:00
Richard W.M. Jones
453db7e210 v2v: RHEL 4: You have to update lvm2, device-mapper to get virtio support.
Also include the updated selinux policy that goes with RHEL 4.8.

Also mention that policycoreutils should be updated - see previous
commit.
2015-03-30 13:27:17 +01:00
Richard W.M. Jones
d4ab702dad v2v: Add note about RHEL 4 conversions hanging during SELinux relabelling. 2015-03-30 13:27:17 +01:00
Richard W.M. Jones
f3c17ab0d8 builder: Fix arch= field in previous commit.
Fixes commit 8ddc564730.
2015-03-30 09:43:34 +01:00
Richard W.M. Jones
8ddc564730 builder: Update index for new armv7 Fedora guest. 2015-03-30 09:09:22 +01:00
Richard W.M. Jones
2cb691e46e builder: Add script for building Fedora armv7l (32 bit ARM) guests. 2015-03-30 09:05:07 +01:00
Richard W.M. Jones
5c65b9108d ruby: Only rebuild rdoc when absolutely necessary.
Rebuilding the ruby documentation takes 51 seconds on my laptop, and
that's a significant fraction of the entire build.  Make sure we only
rebuild the documentation when necessary.
2015-03-28 18:08:21 +00:00
Richard W.M. Jones
e86df90e52 guestfs-performance: Suggest using 'ts' instead of annotate.
'ts' allows incremental timings which is a lot more useful.
2015-03-28 17:53:35 +00:00
Richard W.M. Jones
f1007fc26d lib: Fix static linking by forcing launch-*.o objects to be always linked.
Because the launch-*.o objects only contain statically scoped
declarations, the linker doesn't need to link them in.  This causes a
problem when static linking as they will be left out of the final
binary, and so no backends will be available.

This is essentially the same problem as described here:

https://stackoverflow.com/questions/1202494/why-doesnt-attribute-constructor-work-in-a-static-library
2015-03-28 10:20:44 +00:00
Richard W.M. Jones
7906c34a0f build: Fix ./configure --without-libvirt option. 2015-03-27 22:45:08 +00:00
Richard W.M. Jones
c370ca75c8 lib: Remove bogus visibility declaration (GUESTFS_DLL_PUBLIC) from internal function. 2015-03-27 22:45:02 +00:00
Richard W.M. Jones
a1a42d0002 Version 1.29.32. 2015-03-27 11:02:18 +00:00
Richard W.M. Jones
403e32df23 fuse: Add a note about preserving inode numbers using -o use_ino.
Thanks: David Juran
2015-03-27 11:01:00 +00:00
Maros Zatko
e6dadd6aca customize: fix --upload to FAT partition (RHBZ#1196101)
Some filesystems, such as FAT doesn't support file
ownership, so show warning instead of error on EPERM.
2015-03-27 10:05:12 +00:00
Richard W.M. Jones
d308d0f703 builder: Fix rhel 5 repository location.
RHEL 5 was unusual in having separate sub-repositories (Server, VT,
Cluster etc) within the main RHEL-5-Server directory.  Thankfully no
other version of RHEL does this.  Previously we set up the repository
baseurl incorrectly so it didn't include .../Server in the path.

In commit 1a1cb1ec3c, I tried to fix the
RHEL 5 repo location to include .../Server.  However that broke the
virt-install --location parameter.

Use a separate baseurl path, which should fix both problems.

This fixes commit 1a1cb1ec3c and
commit 3bc9ba6c84.
2015-03-26 11:19:47 +00:00
Richard W.M. Jones
6f7c1663c1 Revert "builder: Fix RHEL 5 download location."
This reverts commit 1a1cb1ec3c.
2015-03-26 11:18:16 +00:00
Richard W.M. Jones
6c5451b34f v2v: test-harness: Rebuild v2v_test_harness.cmi if OCaml API changes.
The error you would have seen before was:

File "v2v_test_harness.ml", line 1:
Error: The files ../../ocaml/guestfs.cmi and v2v_test_harness.cmi
       make inconsistent assumptions over interface Guestfs
2015-03-26 09:44:23 +00:00
Richard W.M. Jones
6297534091 ocaml: Add Guestfs.Errno.errno_EPERM. 2015-03-26 09:16:44 +00:00
Chen Hanxiao
0c396a4bce New API: part_get_mbr_part_type for showing partition type
This patch will add support for getting partition type
of a partiton numbered device.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-03-24 13:44:16 +00:00
Chen Hanxiao
af9aa2eb05 parted: introduce enum for whether parted has option -m
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>

RWMJ: Use enum consistently, don't assign the result to int.
2015-03-24 13:35:29 +00:00
Chen Hanxiao
52d1b0c593 New API: btrfs-image
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-03-24 13:35:28 +00:00
Maros Zatko
ea6d4e5535 customize: add --move (RHBZ#1203817).
This adds --move SOURCE:DEST, equivalent of calling g#mv src dst.

RFE: RHBZ#1203817
2015-03-24 13:27:44 +00:00
Maros Zatko
943fec0399 customize: add --copy (RHBZ#1203817).
This adds --copy SOURCE:DEST, equivalent of calling g#cp_a src dst.

RFE: RHBZ#1203817
2015-03-24 13:27:40 +00:00
Richard W.M. Jones
c227cbcc14 Version 1.29.31. 2015-03-23 14:03:14 +00:00
Richard W.M. Jones
d48615577c builder: Add test-virt-index-validate-good-3 to EXTRA_DIST
Fixes commit fc6c16af0b.
2015-03-23 13:59:08 +00:00
Chen Hanxiao
039ba9cf19 btrfs-qgroup-show: add check for "--raw"
btrfs-prog commit:
58a39524619f38d193b8adc3d57888ec07b612aa
change the default output to binary prefix,
and introduced a new option '--raw'
to keep the traditional behaviour.

This patch will add a check function to determine
whether to add '--raw' option to 'btrfs show qgroup'.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-03-23 12:50:33 +00:00
Pino Toscano
fc6c16af0b builder: handle empty lines in indexes before first section (RHBZ#1201526)
Properly skip empty lines before the first section, otherwise they will
trigger a syntax error in parsing.

Add a simple test for it, so it doesn't regress.
2015-03-23 12:49:27 +00:00
Chen Hanxiao
09e239a726 tests: add test case of set-label and vfs-label for btrfs
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-03-23 12:49:00 +00:00
Chen Hanxiao
017f1c6729 guestfs.pod: don't encourage 'make syntax-check'
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-03-23 12:46:26 +00:00
Maros Zatko
7e8ed7cb21 customize: add --truncate-recursive option
Allows user to recursively truncate files in PATH. e.g.:
virt-builder --truncate-recursive /var/log

Relates to RHBZ#119673
2015-03-23 12:34:05 +00:00
Maros Zatko
ce144c4d7a virt-copy, virt-tar: show help for --help 2015-03-23 12:24:59 +00:00
Richard W.M. Jones
5a445c2e40 docs: You normally need to set SUPERMIN_KERNEL_VERSION as well. 2015-03-23 12:14:59 +00:00
Richard W.M. Jones
762c0bdab9 docs: Remove some rogue references to 'febootstrap'. 2015-03-23 12:12:23 +00:00
Richard W.M. Jones
5ac87b975f v2v: test-harness: Add support for OVA.
This makes VMware testing easier, since it means you don't need to
test against a live server.
2015-03-20 12:14:42 +00:00
Pino Toscano
04f1f1b741 generator: small optimization of pod2text cache memoization
Instead of save every time there's a new element in the cache, batch the
saving to disk every 100 changes, saving the unsaved remainder at the
exit.

While not a big optimization, this reduces a bit the disk usage during
generator run.
2015-03-12 18:08:25 +01:00
Richard W.M. Jones
078bd8ad06 v2v: test harness: Add list of FILES to the manual page. 2015-03-12 15:02:59 +00:00
Chen Hanxiao
c3fa537aeb guestfs.pod: fix a typo
s/applicance/appliance

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-03-12 08:30:38 +00:00
Richard W.M. Jones
32e5056f4a Revert "launch: libvirt: In debug messages use ls --lcontext instead of ls -Z."
The --lcontext option was removed from coreutils ls (in 2007, cough).

Fedora carried a patch re-adding these options [I believe
unintentionally], but that patch was dropped in Fedora 23, so the
--lcontext option is gone for good.

This reverts commit f9c5b4aa2a.
2015-03-11 17:28:19 +00:00
Richard W.M. Jones
ffa8584699 tests: mount-local: Print some more debugging along error paths.
Trying to track down a memory leak somewhere.
2015-03-11 15:08:40 +00:00
Richard W.M. Jones
0827b006e4 v2v: test-harness: Fix boot loop so it detects disk inactivity properly. 2015-03-11 15:05:13 +00:00
Richard W.M. Jones
a3beda8b77 v2v: test-harness: Measure similarity between images when comparing screenshots.
Since wallclock time differs between boots, we cannot just compare two
screenshots by checking if they are identical -- if the screenshot
contains any time information, then that will be different, and it
turns out that VMs print the current time at boot.

Therefore parse out and use the "similarity" metric printed by the
ImageMagick "compare" command when it compares the screenshots, and
allow a small epsilon for the case where a few oixels are different.
2015-03-11 15:02:58 +00:00
Richard W.M. Jones
f052270039 Version 1.29.30. 2015-03-10 21:47:15 +00:00
Richard W.M. Jones
ccb3894915 v2v: Add the test-harness used by external tests.
See the new man page virt-v2v-test-harness(1) added in this commit for
details of this library/harness, and also how to get the external
tests.
2015-03-10 19:39:23 +00:00
Chen Hanxiao
35916e700b gui: fix a syntax-check issue of bindtextdomain
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-03-10 19:39:23 +00:00
Richard W.M. Jones
8873c51475 po-docs: Update list of manual pages to be translated.
There should be an automatic way to keep this list updated, but while
there isn't, keep it updated by hand ...
2015-03-10 16:51:06 +00:00
Richard W.M. Jones
1fba1d1edc builder: Fix path to RHEL source RPMs in internal repo.
Thanks: Jan Scotka
2015-03-10 10:15:42 +00:00
Richard W.M. Jones
ce56c7d30e FAQ: Don't refer to RHEL 7 in future tense.
Thanks: orc_emacs on IRC.
2015-03-09 17:51:36 +00:00
Richard W.M. Jones
3053785db8 builder: Fix comparison between signed/unsigned in parallel xzcat.
block.header_size is uint32_t so cannot be compared directly with n (ssize_t).

pxzcat-c.c: In function 'worker_thread':
pxzcat-c.c:602:21: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     if (n >= 0 && n != block.header_size-1) {
                     ^
2015-03-09 13:13:16 +00:00
Richard W.M. Jones
c807546619 v2v: xml: Add some more bindings to libxml2.
These are not used by libguestfs, but are used by the external
virt-v2v tests.
2015-03-06 17:05:50 +00:00
Richard W.M. Jones
ce5a51a34c v2v: xml: Remove dependency on libguestfs internals.
This is just so I can share the code with the virt-v2v external tests.
2015-03-06 17:03:01 +00:00
Richard W.M. Jones
4ee6e4ddc8 Version 1.29.29. 2015-03-05 13:42:20 +00:00
Richard W.M. Jones
025f1d2bc7 bugs: Ignore bugs in RELEASE_PENDING state.
It's effectively the same as CLOSED.
2015-03-05 13:41:21 +00:00
Richard W.M. Jones
4592caedd4 builder: Add fedora-ppc64.sh script to EXTRA_DIST.
This updates commit 7867abc5c2.
2015-03-05 13:39:21 +00:00
Pino Toscano
1d93cb9e4b actions: improve man page links
Switch from C<> to L<> for links to man pages, where wasn't done before.
2015-03-05 12:31:57 +00:00
Maros Zatko
7867abc5c2 builder: add build script for PPC64 Fedora 2015-03-05 12:30:10 +00:00
Maros Zatko
a084758e83 customize: add --truncate option (RHBZ#119673) 2015-03-05 12:29:21 +00:00
Richard W.M. Jones
e51420c61f arm: Ignore -Wpointer-to-int-cast in c-pointer API.
This API converts the C guestfs_h pointer to a 64 bit integer,
which should always be possible on reasonable architectures.
Therefore silence a GCC warning (which only occurs on 32 bit ARM).
2015-03-05 12:18:23 +00:00
Richard W.M. Jones
af762e4342 arm: Use -M virt on 32 bit ARM, don't pass -dtb parameter.
Note this means all the dtb code in libguestfs & supermin is
obsolete/unused, and may be deleted at some point in future.
2015-03-05 10:28:59 +00:00
Chen Hanxiao
7fb85dcde3 actions.ml: fix a typo
s/tto/to

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-03-03 08:45:01 +00:00
Richard W.M. Jones
e6445e982a ocaml: Don't run check-valgrind on run-bindtests (bash script).
Fix the 'make check-valgrind' rule in the ocaml subdirectory so it
doesn't run '$VG run-bindtests', effectively running valgrind on bash.

Bash in Fedora Rawhide has added a new memory leak, resulting in a
failure, but we don't want to test bash anyway.
2015-03-02 17:46:06 +00:00
Richard W.M. Jones
1cdb5a103a Version 1.29.28. 2015-03-02 13:54:13 +00:00
Richard W.M. Jones
064628632b build: Fix 'maintainer-check-extra-dist' to only list relevant files. 2015-03-02 13:53:12 +00:00
Chen Hanxiao
250db12c24 New API: btrfstune_enable_skinny_metadata_extent_refs
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-03-02 10:27:27 +00:00
Chen Hanxiao
aa70209558 New API: btrfstune_enable_extended_inode_refs
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-03-02 10:27:27 +00:00
Chen Hanxiao
fa14c3d6bc New API: btrfstune_seeding
Use btrfstune_seeding to enable or disable seeding.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-03-02 10:27:27 +00:00
Richard W.M. Jones
78e1a1472c builder: Fix 'os-version' in man page examples. 2015-03-02 09:11:47 +00:00
Michael Scherer
e4944043fb Use a debian distribution for the apt example 2015-03-02 09:10:29 +00:00
Richard W.M. Jones
4e9bda4598 appliance: Create /etc/mtab in init script to work around util-linux nuttiness. 2015-02-28 11:10:31 +00:00
Richard W.M. Jones
41d4d606e5 Version 1.29.27. 2015-02-27 14:38:07 +00:00
Richard W.M. Jones
ecbbfc9ddd po-docs: Ship some untranslated PO files.
Add untranslated PO files to EXTRA_DIST.
2015-02-27 14:37:07 +00:00
Roman Kagan
6c7823b9a9 convert_windows: split firstboot into steps
Instead of doing all firstboot actions in a single script, take the
advantage of the firstboot infrastructure and store and run unrelated
actions as individual steps.

This facilitates troubleshooting and fault recovery; besides it makes
adding more actions easier.

Signed-off-by: Roman Kagan <rkagan@parallels.com>
2015-02-27 13:25:45 +00:00
Roman Kagan
58eb977c0d firstboot: make script naming descriptive
The firstboot infrastructure used to give the firstboot scripts some
cryptic names which were impossible to relate to the actions they were
supposed to take.

This patch reworks the scheme such that the caller registering a
firstboot script has to provide a descriptive name for the action.  That
name, with non-alphanumeric characters replaced with dashes, prefixed by
the serial number, is then used as the name of the script, e.g.

  0004-install-gcc

or

  0002-msiexec--i-foo-msi.bat

OTOH the numbering becomes internal to the API, i.e. the scripts are
numbered and executed in the order they are registered.

This greatly facilitates debugging and troubleshooting in case when
there are multiple firstboot scripts.

Signed-off-by: Roman Kagan <rkagan@parallels.com>
2015-02-27 13:25:45 +00:00
Roman Kagan
7aa9d63674 firstboot: enhance firstboot driver script for Windows
This patch is an attempt to enhance the firstboot driver script for
Windows, and make it somewhat closer in functionality to what is done
for Linux guests.

Specifically, for every firstboot script it now will log its exit
status, and, if the script reported success, move it to -done directory.

Signed-off-by: Roman Kagan <rkagan@parallels.com>
2015-02-27 13:25:45 +00:00
Roman Kagan
3edd770b09 firstboot: consolidate line ending conversion
This patch moves line ending conversion for windows scripts into a
separate helper function.

This simplifies code a bit, and fixes the problem that actual firstboot
scripts used to remain with unix-style line endings.

Signed-off-by: Roman Kagan <rkagan@parallels.com>
2015-02-27 13:25:45 +00:00
Pino Toscano
be79bdfd3a builder: handle -v and -x flags like in other tools (RHBZ#1196100)
Make sure that -x enables tracing and -v enables verbose mode, just like
other tools do.

Kind of followup of commit b6b9b90dd7.
2015-02-26 10:01:14 +01:00
Pino Toscano
652af7a33a builder: use mkdir_p to create the cachedir (RHBZ#1195204) 2015-02-23 14:08:02 +01:00
Pino Toscano
d54132f94d mllib: add helper mkdir_p
Small function to create in OCaml-based code a directory and its
parents, much like `mkdir -p`.
2015-02-23 14:04:00 +01:00
Pino Toscano
ef992c2b07 build: fix distfiles for zanata
Followup of commit c328ac9e04.
2015-02-23 10:58:58 +01:00
Richard W.M. Jones
2acf98c784 Update translations from Zanata.
I added the new linguas for the po/ directory.  But not for the
po-docs/ directory, since the new po files hardly contain any
translations there.
2015-02-22 14:33:17 +00:00
Richard W.M. Jones
c328ac9e04 Move upstream translations from Tranifex to Zanata.
This is at the request of the Fedora localization team.
For further information see:

https://www.redhat.com/archives/libguestfs/2015-February/msg00168.html
2015-02-22 14:10:50 +00:00
Nikos Skalkotos
6200abf92e Fix a bug in e2fsck execution code
Use commandrvf() instead of commandvf() to execute e2fsck. A non-zero
exit status does not always indicate a failure.

Signed-off-by: Nikos Skalkotos <skalkoto@grnet.gr>
2015-02-18 14:43:15 +00:00
Pino Toscano
869b9fcf97 builder: when not checking sigs, ignore --fingerprint args (RHBZ#1193237)
When the user chooses to not verify the signatures on the indexes
(using --no-check-signature), there is no point in requiring as many
--fingerprint as --source (or even just one), as they will not be used
anyway.

In this case just ignore all the values of the specified --fingerprint
arguments.
2015-02-18 15:19:58 +01:00
Pino Toscano
17dabd57c7 builder: process --source sources before
Process the sources specified via the --source command line arguments
before sources read from repositories, so the former have a chance to
"override" the latter.

Related to RHBZ#1193238.
2015-02-18 15:19:44 +01:00
Richard W.M. Jones
fa36b70b20 Version 1.29.26. 2015-02-17 12:11:41 +00:00
Richard W.M. Jones
c7de22b0d3 aarch64: Add fedora-aarch64.sh builder script to EXTRA_DIST.
This fixes commit 5809a5a802.
2015-02-17 12:11:12 +00:00
Maros Zatko
568a33d7ef inspector: add /reactos as systemroot
Fixes RHBZ#709326
Related bug RHBZ#709327 seems to be already fixed in ReactOS 0.4.
2015-02-16 19:32:30 +00:00
Hu Tao
f265371868 New API: btfs_scrub_status
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-02-16 18:05:30 +00:00
Hu Tao
88dbae4cbf New API: btrfs_balance_status
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-02-16 18:05:30 +00:00
Richard W.M. Jones
6c6ce85f94 v2v: -o libvirt: Prevent possible XPath injection.
Ensure the arch string is sane before using it in the following XPath
expression.  Since the arch string can be derived from untrusted guest
data [see src/filearch.c], this prevents a possible XPath injection
vulnerability.
2015-02-14 18:46:05 +00:00
Richard W.M. Jones
c3566da409 python: Call PyErr_Clear() on non-error paths out of the Python bindings.
We also need to be more careful about PyString_FromString and similar
functions returning NULL on failure.  Currently we don't check this
every time.  This commit adds more checks, but is still not complete.
2015-02-14 18:46:05 +00:00
Richard W.M. Jones
0f029a5f58 Whitespace changes arising from the previous two commits. 2015-02-14 18:46:05 +00:00
Richard W.M. Jones
1efd8aa8f1 Change guestfs__* to guestfs_impl_*
libguestfs has used double and triple underscores in identifiers.
These aren't valid for global names in C++.

The second step is to replace all guestfs__* (2 underscores) with
guestfs_impl_*.

These functions are used where a libguestfs API call is implemented on
the library side.  The generator creates a wrapper function which
calls guestfs_impl_* to do the work.  (Libguestfs APIs which are
passed directly by the daemon work differently and don't require a
guestfs_impl_* function).

This is an entirely mechanical change done using:
  git ls-files | xargs perl -pi.bak -e 's/guestfs___/guestfs_impl_/g'

Reference: http://stackoverflow.com/a/228797
2015-02-14 18:46:04 +00:00
Richard W.M. Jones
bfbcc01403 Change guestfs___* to guestfs_int_*
libguestfs has used double and triple underscores in identifiers.
These aren't valid for global names in C++.

The first step is to replace all guestfs___* (3 underscores) with
guestfs_int_*.  We've used guestfs_int_* elsewhere already as a prefix
for internal identifiers.

This is an entirely mechanical change done using:
  git ls-files | xargs perl -pi.bak -e 's/guestfs___/guestfs_int_/g'

Reference: http://stackoverflow.com/a/228797
2015-02-14 18:46:04 +00:00
Richard W.M. Jones
46010912ef Update gnulib to latest. 2015-02-14 18:46:04 +00:00
Richard W.M. Jones
98aa470bc6 Update TODO.
Remove some things which have been implemented already.
2015-02-14 18:46:04 +00:00
Margaret Lewicka
5f67d23cf5 fuse: Alternatives for Linux-specific commands
* fusermount is Linux-only; on BSD and OS X umount should be used
* fuser has no -v flag on BSD/OSX, and -c is the
  POSIX-compatible equivalent of -m
* Does not solve the lack of pretty output of fuser -v, but does make it
  work on Mac OS X.
2015-02-14 09:39:49 +00:00
Richard W.M. Jones
88d16e6fb9 aarch64: builder: Fix metadata so virt-builder --size works.
The wrong partition was being expanded.

This fixes commit 5809a5a802.
2015-02-13 14:47:15 +00:00
Pino Toscano
f71168497d php: skip bindtests on 32bit platforms
bindtests checks also 64bit int values, which won't work when the
underlying platform has sizeof(long) < 8 (like on 32bit architectures).
2015-02-13 14:37:46 +01:00
Richard W.M. Jones
a34416091e daemon: btrfs: Remove full stop from end of error message.
This fixes commit 56732ed6a0.
2015-02-13 10:48:10 +00:00
Richard W.M. Jones
cae7909f5e ./run: Use 'prepend' function to build paths.
Add a bash function 'prepend' for intelligently prepending elements to
paths.  eg:

  prepend PYTHONPATH "/foo"

would set PYTHONPATH to "/foo" or "/foo:<previous-contents-of-PYTHONPATH>"

Tested by:

(1) Building and testing libguestfs twice: first without libguestfs
installed as a system library, and then with it installed.

(2) Examining the output of './run printenv' by hand and comparing
environment variables to the expected values.
2015-02-13 10:26:22 +00:00
Chen Hanxiao
928430f111 actions.ml: fix a typo
s/scannning/scanning

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-02-13 09:02:43 +00:00
Margaret Lewicka
b969be72cd lib: Check if crypt() comes from a separate library
Mac OS X includes crypt() in libc.
2015-02-13 08:55:44 +00:00
Margaret Lewicka
cc4baac815 run: Set DYLD_LIBRARY_PATH along with LD_LIBRARY_PATH
Mac OS X uses DYLD_LIBRARY_PATH rather than LD_LIBRARY_PATH.
2015-02-13 08:55:43 +00:00
Margaret Lewicka
5fc07e87bb macosx: Includes/defines for byteswap operations 2015-02-12 20:34:40 +00:00
Margaret Lewicka
e39ab27dea lib: Add third, zero parameter to xdrproc_t
As advised by Daniel P. Berrange, the third parameter can be passed on all
platforms rather than specifically Mac.

Quoting a libvirt commit rationale after Daniel:

 commit 9fa3a8ab6fd82ad2f5a14b490696085061418718
 Author: Doug Goldstein <cardoe@cardoe.com>
 Date:   Wed Oct 30 11:22:58 2013 -0500

   MacOS: Handle changes to xdrproc_t definition

   With Mac OS X 10.9, xdrproc_t is no longer defined as:

   typedef bool_t (*xdrproc_t)(XDR *, ...);

   but instead as:

   typedef bool_t (*xdrproc_t)(XDR *, void *, unsigned int);

   For reference, Linux systems typically define it as:

   typedef bool_t (*xdrproc_t)(XDR *, void *, ...);

   The rationale explained in the header is that using a vararg is
   incorrect and has a potential to change the ABI slightly do to compiler
   optimizations taken and the undefined behavior. They decided
   to specify the exact number of parameters and for compatibility with old
   code decided to make the signature require 3 arguments. The third
   argument is ignored for cases that its not used and its recommended to
   supply a 0.
2015-02-12 20:28:20 +00:00
Margaret Lewicka
bbc8c20a2d builder: Check HAVE_POSIX_FADVISE before using it 2015-02-12 20:27:41 +00:00
Richard W.M. Jones
5809a5a802 aarch64: builder: Add script for building Fedora aarch64 images. 2015-02-12 17:29:38 +00:00
Pino Toscano
a0892aa29e ocaml: hide internal methods from apidocs 2015-02-12 15:07:58 +01:00
Pino Toscano
3dff1582d4 actions: fix a couple of docs references 2015-02-12 14:42:57 +01:00
Pino Toscano
8c91a68b80 gobject: generate deprecation markers
Generate proper deprecation markers for API documentation and
introspection annotations.
2015-02-12 14:42:57 +01:00
Richard W.M. Jones
ab8a442952 Version 1.29.25. 2015-02-11 17:03:05 +00:00
Richard W.M. Jones
fb24d7405a tests/charsets: Fix bogus comparison of STRNEQ() == -1.
gcc 5 rightly flags this code as bogus.
2015-02-11 15:30:55 +00:00
Pino Toscano
e157226064 java: further <p> fixes
javadoc's HTML parser seems more limited, so just close <p> blocks
before opening <pre> or <ol>.

Followup of commit f4186a7a49.
2015-02-11 15:46:19 +01:00
Pino Toscano
3b8d56d491 php: add a simple bindtests test
Generate a simple bindtests test for the PHP binding, so it is possible
to easily test all the argument types.

Unlike the bindtests for other languages, optional arguments are not
tested, due to the limitations of optional arguments in PHP (or maybe
they way we implement them).
2015-02-11 15:02:57 +01:00
Pino Toscano
2b06c27fd7 php: fix memory leak in OStringList optargs
Make sure to free the char** created to convert the arguments.
2015-02-11 15:02:56 +01:00
Pino Toscano
8e4bf5cf9e php: fix invalid memory access with stringlist params
Make sure to copy the strings we add to the char** array, otherwise they
are stale pointers which we'll try to free later.

Also, properly destruct the temporary zval.
2015-02-11 15:02:56 +01:00
Pino Toscano
ee65fabd97 php: move common code in helper functions
Simple code motion.
2015-02-11 15:02:56 +01:00
Pino Toscano
4debb44a44 php: fix invalid memory access with OptString
OptString maps to a "s!" argument, which makes zend_parse_parameters not
touch the variables (char* and length) when NULL is passed as parameter.
Hence, set both to NULL/0, and check for non-NULL char* variable before
checking its length.
2015-02-11 15:02:56 +01:00
Pino Toscano
85b6b5e589 java: add @Deprecated annotation for deprecated methods 2015-02-11 15:02:56 +01:00
Pino Toscano
f4186a7a49 java: fix/improve slightly the javadoc
- use <p>..</p> for text paragraphs, instead of just using <p> to
  separate them
- slightly improve the metadata in eventToString and set_event_callback
- fix the textual @see in set_event_callback, so it is accepted also in
  JDK 8
- escape the doc text, so &, <, and > will not be considered as HTML
  tags but actual text
- use the @deprecated tag instead of adding the customary deprecation
  note to the doc text
2015-02-11 15:02:56 +01:00
Pino Toscano
8b268bd897 generator: add a simple HTML escaping function 2015-02-11 15:02:56 +01:00
Pino Toscano
4905d6eb95 Revert "java: Turn off doclint to prevent errors on JDK 8"
The errors will be fixed for good, together will other small javadoc
improvements.

This reverts commit 8940b03658.
2015-02-11 15:02:56 +01:00
Margaret Lewicka
28462caacc macosx/bsd: Use getprogname() where available 2015-02-11 13:50:33 +00:00
Margaret Lewicka
8940b03658 java: Turn off doclint to prevent errors on JDK 8
On JDK 8, doclint is enabled by default with strict validation of HTML
tags, which causes the build to fail. See
http://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html
2015-02-11 13:49:47 +00:00
Pino Toscano
668c4784a9 perl: tests: reenable set_path tests
guestfs_set_path now does a copy of the passed string, so bindings don't
need to take care of the lifetime of strings parameters for it.
2015-02-09 11:00:47 +01:00
Richard W.M. Jones
5cafedaa45 lib: Change 'program_name' macro to avoid conflict with gnulib.
The gnulib 'error' module uses 'program_name'.  On some platforms --
but not Linux / glibc -- it references it as:

  extern char *program_name;

This means when you compile libguestfs on non-glibc (eg. Mac OS X)
gnulib requires 'program_name' as an external string reference, which
we don't provide.

This change doesn't define this string reference for gnulib, but it
does change the name of the macro we use to avoid conflicts if we
eventually need to export 'program_name' as a string.

Thanks: Margaret Lewicka
2015-02-07 16:30:28 +00:00
Margaret Lewicka
7ddf6bcbfd macosx: Include <sys/un.h> and define SOCK_* for Mac OS X. 2015-02-06 10:01:28 +00:00
Margaret Lewicka
eaae0b614c macosx: ruby: Use correct dllib extension instead of assuming '.so'. 2015-02-06 09:53:45 +00:00
Richard W.M. Jones
f630677c14 resize: Preserve GPT GUID so we don't break EFI bootloaders (RHBZ#1189284).
When copying disks that use EFI, we created a new partition table,
randomizing the GPT GUID of the first partition.  Since EFI may store
the GUID in its NVRAM variables, this could make the guest unbootable.
2015-02-05 08:19:19 +00:00
Richard W.M. Jones
40c133b2c8 New APIs: part-set-gpt-guid and part-get-gpt-guid
In GPT, each partition has a GUID assigned randomly.  Allow this GUID
to be written and read.

Note this is different from the GUID type code which is used to
identify the type of the partition.
2015-02-05 08:19:19 +00:00
Richard W.M. Jones
b3e3750b13 daemon: Fix whitespace. 2015-02-05 08:01:48 +00:00
Richard W.M. Jones
ff1cf989fd builder: Fix large performance regression in pxzcat (RHBZ#1188866).
Commit 9135129b0f changed
two stack buffers to pointers:

-  uint8_t buf[BUFFER_SIZE];
-  unsigned char outbuf[BUFFER_SIZE];
+  CLEANUP_FREE uint8_t *buf = NULL;
+  CLEANUP_FREE uint8_t *outbuf = NULL;

but we were still using sizeof buf to calculate the size of the
buffer.  sizeof buf == 8 so the original code which used large buffers
for reading/writing the file changed to using 8 byte buffers.
2015-02-04 13:17:40 +00:00
Cédric Bosdonnat
5f663c2082 customize: Invoke zypper correctly. 2015-02-03 14:38:02 +00:00
Richard W.M. Jones
8fd4231051 btrfs: Proper error when output of 'btrfs qgroup show' command cannot be parsed.
sscanf doesn't set errno in these cases so it's wrong to call perror
here.

This fixes commit 2b7f7810ed.
2015-02-03 08:53:43 +00:00
Richard W.M. Jones
725d95422b Version 1.29.24. 2015-02-02 20:01:45 +00:00
Pino Toscano
573fe962b9 customize: add copy-in operation (RHBZ#1135585).
Add the copy-in operation to virt-customize/builder/sysprep, so it is
possible to easily copy directories at once in the guest.
2015-02-02 18:55:10 +00:00
Pino Toscano
5efce8c56d fish: use copy-in and copy-out
Simply the copy-in & copy-out commands of guestfish using the new
implementations of copy-in & copy-out in the library.
2015-02-02 18:44:52 +00:00
Pino Toscano
fb9bc908f8 New APIs: copy-in and copy-out
Currently implemented as guestfish commands, provide them instead as
single source -> destination functions for the library, so they can be
used also in other places.

These functions are not added to guestfish, since guestfish has its own
implementation (which will soon switch to call copy-in and copy-out for
multiple paths).
2015-02-02 18:44:52 +00:00
Pino Toscano
8aadde50b3 generator: add VPublicNoFish visibility type
Usable to have public functions, i.e. like VPublic, but do not showing
them in guestfish.
2015-02-02 18:44:52 +00:00
Pino Toscano
db055262d4 cmd: add the possibility to get a fd to the process stdin
Add the possibility to forward to the stdin of the process, and get the
fd for it; only in async mode for now.
2015-02-02 18:44:52 +00:00
Pino Toscano
449fab3ed1 cmd: add a child-setup callback
Easy way to do pre-exec setup in the child process.
2015-02-02 18:44:52 +00:00
Pino Toscano
c5d3d198dc cmd: add a way to run (and wait) asynchronously commands 2015-02-02 18:44:52 +00:00
Pino Toscano
4bb3c44a28 sparsify: ignore read-only devices
In copy mode, make sure to not zero-free-space devices mounted as
read-only, as we cannot write to them.

Related to RHBZ#1079625.
2015-02-02 15:02:31 +01:00
Pino Toscano
864c2ee371 sparsify: ignore read-only btrfs snapshots (RHBZ#1079625)
In copy mode, make sure to not zero-free-space read-only btrfs
snapshots, as we cannot write to them.
2015-02-02 14:50:52 +01:00
Richard W.M. Jones
8d83f57799 sparsify: Ignore read-only LVs (RHBZ#1185561). 2015-02-02 13:32:24 +00:00
Richard W.M. Jones
7d784fb9c9 mllib: Add function for comparing LVM2 UUIDs, ignoring '-' characters. 2015-02-02 13:32:24 +00:00
Richard W.M. Jones
ab950f8290 mllib: Add a better List.assoc function.
You can specify what comparison function is used; and instead of
having it raise 'Not_found', it returns a ~default value.
2015-02-02 13:32:24 +00:00
Pino Toscano
83eea0b197 tests: don't add test-dlopen twice
test-dlopen needs to be added only when libdl is available, and it is
like that already (within if HAVE_LIBDL); hence don't unconditionally
add it as well.
2015-01-29 12:00:32 +01:00
Pino Toscano
e57ed7cd34 build: use libintl where needed
Followup of commit a5426cce5f.
2015-01-29 12:00:01 +01:00
Pino Toscano
2313f28895 daemon: parted: use --part-type with recent sfdisk
Check whether --part-type is supported (in the rewritten sfdisk in
util-linux >= 2.26), and use it instead of --print-id & --change-id.

The actual result should be the same, just not using a (recently)
deprecated command line API.
2015-01-28 15:34:49 +01:00
Richard W.M. Jones
6a195d0f95 v2v: -i ova: Make error message "unsupported file format" clearer.
Thanks: Moran Goldboim
2015-01-28 13:30:55 +00:00
Pino Toscano
282a131677 customize: handle Arg.Set parameters in commands file
When reading commands from a file, handle also Arg.Set parameters, so
they can be enabled as well.
2015-01-28 09:59:27 +01:00
Richard W.M. Jones
d0cecca272 Version 1.29.23. 2015-01-26 17:15:51 +00:00
Richard W.M. Jones
d6cfd24feb .gitignore: Ignore mllib/oUnit-anon.cache file from oUnit.
This updates commit d19eb31060.
2015-01-26 17:15:51 +00:00
Pino Toscano
d0a2ba40c8 mllib: fix JSON_tests
Properly write int64 values, so they are handled correctly also on 32bit
architectures.
2015-01-26 16:36:26 +01:00
Shahar Havivi
889e555168 v2v: -o vdsm should assume data domain at -os path
Unlike -o rhev which have only one data domin, -o vdsm can and usually
does have multiple data domain.
The path to vdsm is pre mounted so no need to assume nfs path with -os
Example:
-o vdsm -os /rhev/data-center/<data-center-uuid>/<data-domain-uuid>

Bug-Url: https://bugzilla.redhat.com/1176591
Signed-off-by: Shahar Havivi <shaharh@redhat.com>
2015-01-26 10:31:14 +00:00
Richard W.M. Jones
c24f242521 aarch64: Increase default appliance memory size on aarch64.
Kernel 3.19 has problems uncompressing the RAM disk with <= 500 MB.
(This is likely to be a kernel bug)

64 KB pages are common on aarch64, so treat this case the same as ppc,
and use a larger default appliance memory size.

Thanks: Laszlo Ersek for help and reproducing the bug.
2015-01-24 15:40:05 +00:00
Richard W.M. Jones
987273ebd0 launch: libvirt: When debugging the appliance dir, use 'ls -R'.
Since libguestfs >= 1.26 / supermin 5, the appliance has lived in a
subdirectory of $TMPDIR/.guestfs-$UID.  As a result using 'ls -l'
didn't display any information about the files in the appliance.

Using '-R' causes this information to be displayed again.
2015-01-24 08:47:00 +00:00
Richard W.M. Jones
f9c5b4aa2a launch: libvirt: In debug messages use ls --lcontext instead of ls -Z.
ls -Z stops ls from displaying the size field.  --lcontext uses longer
lines but has the advantage of still displaying the size field as well
as the SELinux context.
2015-01-24 08:45:48 +00:00
Richard W.M. Jones
b6cd5c3a2b p2v: Add NetworkManager in the hope of getting working network.
I know "working network" and "NetworkManager" are oxymorons, but
sometimes we have to live in hope.
2015-01-23 15:34:51 +00:00
Richard W.M. Jones
9638b13ba0 p2v: Set root password of virt-p2v ISO to 'p2v'.
It is documented as 'p2v', but in fact this was not implemented
so there is no way to log in as root on the console.

On RHEL we also have to add the 'passwd' package, else you get:

  Error creating Live CD : Unable to set unencrypted password due to lack of /usr/bin/passwd
2015-01-23 15:34:51 +00:00
Pino Toscano
515c3e3e73 mllib: do not show --short-options among the long options
--long-options is ignored because it is only meant as aid for shell
completers, so --short-options should be too for the same reason.
2015-01-23 14:15:09 +01:00
Pino Toscano
6bc9976886 mllib: add simple tests for the JSON module 2015-01-23 11:23:35 +01:00
Pino Toscano
6f14cae1ba mllib: tests: add tests for string_lines_split 2015-01-23 11:08:27 +01:00
Pino Toscano
d19eb31060 mllib: convert common_utils_tests to oUnit
Covert common_utils_tests to use oUnit as testing framework, replacing
the hand-made assert in favour of structured unit tests and better
error reporting.

common_utils_tests is now built only when the oUnit module has been
found.
2015-01-23 10:57:23 +01:00
Pino Toscano
1f5e525533 configure: look for the oUnit OCaml module
It will be used for the OCaml unit tests.
2015-01-23 10:57:23 +01:00
Pino Toscano
eda4126868 customize: add --commands-from-file
Pass to --commands-from-file the name of a file containing customization
commands in each line, as if they were specified as command line
arguments.

This eases the reuse of commands among different
builder/customize/sysprep invocations.
2015-01-22 17:07:02 +01:00
Pino Toscano
09f76fd2a9 mllib: add string_lines_split
Introduce an helper function to split a text into lines, keeping into
accout continuation lines (i.e. with \ at the end).
2015-01-22 17:06:56 +01:00
Richard W.M. Jones
145db4f629 test: fuse: Add debugging of commands run in the test. 2015-01-22 10:44:32 +00:00
Richard W.M. Jones
34b118a25a Version 1.29.22. 2015-01-21 20:45:17 +00:00
Hu Tao
d4c8433e6e New API: add btrfs_rescue_super_recover
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2015-01-21 14:28:10 +00:00
Hu Tao
15c75eaace New API: add btrfs_rescue_chunk_recover
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2015-01-21 14:28:10 +00:00
Hu Tao
e32b59c926 New API: add btrfs_filesystem_defragment
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2015-01-21 14:28:10 +00:00
Hu Tao
fd7df408d1 New API: btrfs_balance_resume
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2015-01-21 14:28:10 +00:00
Hu Tao
a72204bde7 New API: btrfs_balance_cancel
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2015-01-21 14:28:10 +00:00
Hu Tao
9f11ddd29e New API: btrfs_balance_pause
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2015-01-21 14:28:10 +00:00
Hu Tao
47f0336e09 btrfs: replace "btrfs filesystem balance" with "btrfs balance"
"btrfs filesystem balance" is deprecated in favor of "btrfs balance".

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2015-01-21 14:28:10 +00:00
Hu Tao
9e6122265e New API: btrfs_scrub_resume
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2015-01-21 14:28:10 +00:00
Hu Tao
55bfd127d4 New API: btrfs_scrub_cancel
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2015-01-21 14:28:10 +00:00
Hu Tao
a4d6cc525a New API: btrfs_scrub
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2015-01-21 14:28:10 +00:00
Richard W.M. Jones
7e4b7a346a aarch64: launch: libvirt: As a workaround, pass -cpu parameter to qemu.
When libguestfs is running using TCG on aarch64, we need to pass the
-cpu cortex-a57 parameter to qemu.  Libvirt doesn't let us do this,
complaining "Unable to find CPU definition".

As a temporary workaround only, use <qemu:commandline> to pass this
argument directly to qemu.  When libvirt is fixed we can remove this
hack.

This is a workaround for libvirt bug RHBZ#1184411.

See:
https://www.redhat.com/archives/libvirt-users/2014-August/msg00043.html
https://bugzilla.redhat.com/show_bug.cgi?id=1184411
2015-01-21 14:28:10 +00:00
Richard W.M. Jones
7dc837c7be aarch64: appliance: Use AAVMF (UEFI) if available for running the appliance.
AAVMF is an open source UEFI implementation for aarch64 based on OVMF.
As aarch64 is heading for requiring UEFI even inside guests, if the
AAVMF firmware is installed on the host, use it as a hint that we
should boot the guest using AAVMF instead of the default "empty
machine".

Note this requires very recent AAVMF, libvirt, qemu.  However that's
OK since it's only applicable to aarch64.  On non-aarch64, this patch
does nothing.

Thanks: Laszlo Ersek for a lot of help getting this right.
2015-01-21 14:28:09 +00:00
Pino Toscano
cb0c2c3357 launch: libvirt: do not leak the backend string on error
Make sure to free the backend string after using it.
2015-01-20 16:23:12 +01:00
Pino Toscano
bff99cec4d fish: remove extra "prompt" checks
The code is already within a "if (prompt) {...}" block, so checking for
"prompt" again is redundant.
2015-01-20 16:09:53 +01:00
Pino Toscano
7618e41d33 daemon: readdir: fix invalid memory access on error
If "strdup (d->d_name)" fails with "i" > 0, then both "p" and
"ret->guestfs_int_dirent_list_val" are non-null pointers, but the latter
is no more valid (since "p" is the new realloc'ed buffer). Hence, trying
to free both will access to invalid memory.

Make sure to free only one of them, "p" if not null or
"ret->guestfs_int_dirent_list_val" otherwise.
2015-01-20 16:09:53 +01:00
Pino Toscano
0eedddad2f fuse: test-fuse: free "acl_text"
Make sure to free the buffer returned by acl_to_any_text.
2015-01-20 16:09:53 +01:00
Richard W.M. Jones
91c34ff8ff p2v: Fix wait_qemu_nbd to use getaddrinfo.
wait_qemu_nbd would fail in Rawhide where /etc/hosts contains:

  127.0.0.1   localhost [...]
  ::1         localhost [...]

This peculiar mapping caused qemu-nbd to always select an IPv6
address.  However since we used the obsolete inet_pton function and
forced AF_INET, we were always trying to connect to the IPv4
localhost.

As this was never going to work anyway, fix the code to use
getaddrinfo to resolve "localhost", and use a loop to connect to all
possible addresses.

Also: Add a short sleep in the reconnection loop so that we don't
hammer the qemu-nbd server while it is starting up.
2015-01-20 09:49:31 +00:00
Richard W.M. Jones
0b54e111e4 p2v: Move debug message earlier.
This ensures we can see the port numbers even when the
connection fails.
2015-01-20 09:49:31 +00:00
Richard W.M. Jones
3ca0ce45af p2v: Correct garbled comments in test script. 2015-01-20 09:49:31 +00:00
Richard W.M. Jones
f45b6928c5 aarch64: python: Skip test that requires IDE.
This test launches a dummy guest using IDE.  Aarch64 doesn't support
IDE, and because it also doesn't support PCI (virtio-mmio instead)
it's hard to formulate libvirt XML that will work on both x86 and
virtio-mmio.

Since this bug is not architecture specific (RHBZ#912499), skip it on
non-x86.  The test will print:

  skipping test: arch is not x86 and does not support IDE
2015-01-20 09:49:31 +00:00
Richard W.M. Jones
9bf6f7f056 Version 1.29.21. 2015-01-19 19:19:12 +00:00
Pino Toscano
cfc142399f gobject: fix printf conversion specifier
Use PRIu64 to correctly handle uint64_t.
2015-01-19 19:05:23 +00:00
Richard W.M. Jones
52528729f6 gcc5: test-tool: Initialize local variable.
gcc 5 cannot prove that the variable is always initialized
and therefore prints a warning.
2015-01-19 16:06:16 +00:00
Pino Toscano
fceab82647 build: check for single libsystemd before libsystemd-journal
Since systemd 209, all the functionalities of the former libsystemd-*
(including libsystemd-journal) have been merged into a single
libsystemd, with the former libraries left as compatibility ones.

Thus, first look for libsystemd, and if not found try again with the
libsystemd-journal as used before.
2015-01-19 16:47:54 +01:00
Pino Toscano
1709263613 sparsify: handle output filenames with ':'
With commit a594b7f90a the checks for
input and output files with ':' were removed; while the input file is
handled correctly by the disk_create API, an output filename with ':'
could still be handled as specifying a transport, failing the last
"qemu-img convert" call.

Use the new qemu_input_filename helper to handle the output filename
correctly.
2015-01-19 16:47:54 +01:00
Pino Toscano
c796280a8e mllib: add simple qemu filename sanitizing function
It mimics a bit in OCaml the logic used in
commit a95214b198 (for the main library)
and commit 588af1953e (in disk-create),
so in OCaml tools direct calls to qemu/qemu-img with filenames provided
by the user can properly handle filenames with e.g. ':'.
2015-01-19 16:47:53 +01:00
Pino Toscano
8b9ca28e11 mknod: filter modes in mkfifo, mknod_b, mknod_c (RHBZ#1182463).
Since mkfifo, mknod_b, and mknod_c add the correct file type to the
modes of the resulting file, make sure the specified mode contains only
permissions bits.
2015-01-19 16:47:53 +01:00
Pino Toscano
8ad667f198 daemon: use ntfslabel(1) to get ntfs labels
blkid(1) (or actually, libblkid) seems to handle filesystem labels up
to 127 characters. Considering that btrfs labels can be up to 128
characters, this means long labels are not read correctly (i.e. get
truncated) by blkid.  Furthermore, ntfs labels are actually unicode,
and libblkid seems to not decode them correctly.

Hence, if ntfsprogs is available invoke `ntfslabel` to get the label
of ntfs filesystems.

Related to RHBZ#1164708.
2015-01-19 16:47:53 +01:00
Pino Toscano
6db3c100e7 daemon: use btrfs(1) to get btrfs labels
blkid(1) (or actually, libblkid) seems to handle filesystem labels up
to 127 characters. Considering that btrfs labels can be up to 255
characters, this means long labels are not read correctly (i.e. get
truncated) by blkid.

Get the filesystem type, and if btrfs is available invoke
`btrfs filesystem` to get the label of btrfs filesystems.

Related to RHBZ#1164708.
2015-01-19 16:47:53 +01:00
Pino Toscano
d7abf5c8f2 format, make-fs: specify the label on mkfs
If specified, pass the label for the new filesystem directly to the
mkfs (or mkfs_btrfs) call.

This saves one set_label call, mostly.
2015-01-19 16:47:53 +01:00
Pino Toscano
7723614a91 mkfs: add 'label' optional argument
Add the 'label' optional argument to the mkfs action, so it is possible
to set a filesystem label direct when creating it. There may be
filesystems not supporting changing the label of existing filesystems
but only setting it at creation time, so this new optarg will help.

Implement it for the most common filesystems (ext*, fat, ntfs, btrfs,
xfs), giving an error for all the others, just like set_label does.
2015-01-19 16:47:53 +01:00
Richard W.M. Jones
19c09bcdee tests/lvm: Remove use of deprecated sfdiskM API.
See: https://bugzilla.redhat.com/show_bug.cgi?id=1183236
for the sorry tale.
2015-01-19 15:01:37 +00:00
Richard W.M. Jones
eb85ac6a0d valgrind: Remove suppression for fixed memory leak in libselinux.
This memory leak has been fixed since libselinux 2.1.13.

Thanks: Daniel Walsh
2015-01-19 13:03:24 +00:00
Richard W.M. Jones
4f3c288a1b lua: Define luaL_checkint which was deprecated in lua 5.3. 2015-01-18 07:38:58 +00:00
Richard W.M. Jones
5ab3a75e1d tests/lvm: Allow test-lvm-mapping.pl to be skipped. 2015-01-17 14:24:35 +00:00
Richard W.M. Jones
9d9ef2960c Version 1.29.20. 2015-01-17 11:45:31 +00:00
Richard W.M. Jones
c5800dc97d Update copyright dates for 2015. 2015-01-17 09:08:15 +00:00
Richard W.M. Jones
378ed3be5e ocaml: Convert debug_logging example from C to OCaml.
Continue gradual conversion of C examples to other languages.
2015-01-17 07:14:33 +00:00
Kashyap Chamarthy
4bd0d17047 virt-buider: doc: Use osinfo-query to get OS variants
Upstream dropped[1] support for '--os-variant list' in favor of using
`osinfo-query` tool provided by the libosinfo project.

To get a list of all accepted operating systems, invoke:

  osinfo-query os

[1] https://git.fedorahosted.org/cgit/virt-manager.git/commit/?id=bcb60f0
2015-01-14 13:16:21 +01:00
Pino Toscano
ea761df687 builder: export the "osinfo" attribute to json
Thanks to: Federico Simoncelli.
2015-01-09 11:14:35 +01:00
Pino Toscano
4f51519c9f ocaml: findlib is required when building from git
Update README according to the current requirement.

Thanks to: Gabriele Cerami.
2015-01-07 15:07:07 +01:00
Hilko Bengen
e6f77d2345 Fix out-of-tree build: Don't create empty .y file in builddir 2014-12-31 13:57:25 +00:00
Shahar Havivi
14d11916fa v2v: adding --vdsm-ovf-output option
This option is needed by vdsm for writing the ovf to a specific directory.
The default is current directory.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1176598
Signed-off-by: Shahar Havivi <shaharh@redhat.com>
2014-12-25 09:59:56 +00:00
Richard W.M. Jones
3a080c3fbf v2v: Reduce use of polymorphic variants.
Ordinary variants prevent coding errors.
2014-12-24 18:10:37 +00:00
Richard W.M. Jones
70c28f3d5e v2v: -i libvirtxml: Only handle NBD source with host 'localhost', for virt-p2v.
We only care/support virt-p2v for network disks.  Give a warning about
anything else.

This avoids a potential quoting issue.
2014-12-24 17:58:36 +00:00
Richard W.M. Jones
45bd4f604d v2v: Update TODO. 2014-12-24 17:09:57 +00:00
Richard W.M. Jones
c5e11785af v2v: DOM: Fix quoting of XML comments.
We need to quote at least & and > in XML comments.
2014-12-24 16:51:15 +00:00
Richard W.M. Jones
86a08d860a v2v: Hide implementation of 'element'.
Following the previous commit, the implementation of 'element'
does not need to be public.
2014-12-24 13:34:26 +00:00
Richard W.M. Jones
47b54a7ba5 v2v: Move append_* functions to DOM module.
Just code motion.
2014-12-24 13:32:18 +00:00
Richard W.M. Jones
791db53b10 Version 1.29.19. 2014-12-23 15:30:06 +00:00
Richard W.M. Jones
29df51d9bc v2v: Add a note about escaping username like DOMAIN\user.
Thanks: Ben Hooper.
2014-12-23 15:30:06 +00:00
Richard W.M. Jones
91b5863a7d aarch64: builder: Silence gcc warnings from flex-generated code. 2014-12-23 12:10:10 +00:00
Richard W.M. Jones
fdf6221f33 fish: c-pointer: Print the pointer in hexadecimal.
$ guestfish
><fs> c-pointer
0x1fb4f80

This updates commit d8c43d556b.
2014-12-22 11:00:32 +00:00
Richard W.M. Jones
92575d0eab errors: Even clearer error message.
Obviously no one reads the FAQ, so make the error message
even clearer.

The new error messages are variation on this:

libguestfs: error: /bin/false exited with error status 1.
To see full error messages you may need to enable debugging.
Do:
  export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1
and run the command again.  For further information, read:
  http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs
You can also run 'libguestfs-test-tool' and post the *complete* output
into a bug report or message to the libguestfs mailing list.
2014-12-19 19:40:04 +00:00
Richard W.M. Jones
f6e74ecd73 ping-daemon: Fix error in the description of this API (RHBZ#1175676).
Thanks: Lingfei Kong
2014-12-18 10:59:15 +00:00
Richard W.M. Jones
47d909808a v2v: -o libvirt: Replace List.mapi with mapi.
Don't depend on OCaml >= 4.00.

https://bugs.gentoo.org/show_bug.cgi?id=532698

Thanks: Fabian Ohler
2014-12-18 08:30:18 +00:00
Richard W.M. Jones
045dcfbd18 v2v: Treat "oraclelinux" as if it was plain RHEL (RHBZ#1174280). 2014-12-17 15:50:44 +00:00
Richard W.M. Jones
f1ecd6af80 fish: Add regression test for RHBZ#1175196. 2014-12-17 14:38:44 +00:00
Richard W.M. Jones
5f6677ebd0 environment: Use guestfs___is_true when parsing various boolean environment variables (RHBZ#1175196).
You can now use LIBGUESTFS_DEBUG=true (etc.)

You can disable debugging/tracing by setting LIBGUESTFS_DEBUG=0 (etc.)
2014-12-17 14:38:44 +00:00
Richard W.M. Jones
bdcd2fabe9 fish: Move 'is_true' function to library utilities.
The 'is_true' function can be useful elsewhere, not just for parsing
guestfish command parameters.

This is just code motion.
2014-12-17 14:38:44 +00:00
Richard W.M. Jones
d375b7818a v2v: -o qemu: Replace List.iteri with iteri.
So we don't have to depend on OCaml >= 4.00 which is when this
function was added to the stdlib.

https://bugs.gentoo.org/show_bug.cgi?id=532698
2014-12-17 14:38:44 +00:00
Richard W.M. Jones
abf51ec70b is-blockdev: Clarify documentation (RHBZ#1175035). 2014-12-17 10:28:33 +00:00
Pino Toscano
1f7db85b30 builder: recommend use of --selinux-relabel
Add a small documentation paragraph in the "SELINUX" section
recommending the usage of --selinux-relabel for guests using SELinux.
2014-12-16 15:52:32 +01:00
Richard W.M. Jones
6264c255d4 Version 1.29.18. 2014-12-16 13:25:35 +00:00
Richard W.M. Jones
8e0fc5fb46 python: Fix regression test so it works when KVM is not available.
The test assumed (for no particular reason) that it could always run a
KVM guest.  When run on a machine without KVM, or in a VM without
nested KVM, you get this error:

libvirt: Domain Config error : internal error: no supported architecture for os type 'hvm'
Traceback (most recent call last):
  File "./t/820-rhbz912499.py", line 77, in <module>
    dom = conn.createXML (xml, libvirt.VIR_DOMAIN_START_AUTODESTROY)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 3523, in createXML
    if ret is None:raise libvirtError('virDomainCreateXML() failed', conn=self)
libvirt.libvirtError: internal error: no supported architecture for os type 'hvm'
FAIL: ./t/820-rhbz912499.py

Use a qemu guest instead, which should have a better chance of working
on all hosts.
2014-12-16 13:16:07 +00:00
Richard W.M. Jones
974216f612 p2v: Document that virt-p2v-make-kickstart copies the virt-p2v binary into the kickstart. 2014-12-16 11:06:43 +00:00
Richard W.M. Jones
54f85f8482 p2v: virt-p2v-make-kickstart(1): Fix various typos in the man page. 2014-12-16 11:06:15 +00:00
Richard W.M. Jones
cf979dd796 p2v: virt-p2v-make-kickstart: Add URL example to the man page.
It turns out this is required for Fedora 21 (or perhaps livecd-creator
is broken yet again, who knows).
2014-12-16 09:45:29 +00:00
Richard W.M. Jones
2912fa7a43 Version 1.29.17. 2014-12-15 22:45:35 +00:00
Richard W.M. Jones
2162d09b2c Use -fno-strict-overflow throughout the build.
Builds of bison-generated files currently fail with:

index-parse.y: In function 'yyparse':
index-parse.c:1256:6: error: assuming pointer wraparound does not occur when comparing P +- C1 with P +- C2 [-Werror=strict-overflow]
     if (yyss + yystacksize - 1 <= yyssp)
        ^

This error only occurred on one machine, and it was unclear why.  It
turned out to be because the other build machines I use had:

  CFLAGS="-Wall" ./configure ...

whereas on the failing machine I was just using ./configure w/o CFLAGS.

This caused the compile flags of index-parse.c to be changed from:

  gcc -Wstrict-overflow ... index-parse.c

to:

  gcc -Wstrict-overflow -Wall ... index-parse.c

but since -Wstrict-overflow is short for -Wstrict-overflow=2, and
-Wall is short for -Wstrict-overflow=1, and since the error only
occurs at level >= 2, using CFLAGS="-Wall" was effectively turned off
the warning.

Anyway, I believe the optimizations that GCC does when
-fstrict-overflow is enabled to be dubious, frequently dangerous, and
useless.  They are only done because we want C99 to work on
architectures that don't exist in reality (and which even if they did
exist, libguestfs would probably not support).

The Linux kernel uses -fno-strict-overflow, and we should too, for the
same reasons.
2014-12-15 22:26:51 +00:00
Richard W.M. Jones
8a33d534e5 Version 1.29.16. 2014-12-15 18:46:31 +00:00
Gabriele Cerami
5a4fd83176 diff/diff.c: diff output to show correct file handles and presence symbol 2014-12-15 18:46:31 +00:00
John Eckersberg
09080a2887 p2v: avoid connecting to ourself while probing qemu-nbd (RHBZ#1167774) 2014-12-15 18:46:31 +00:00
Richard W.M. Jones
f843abe400 tests: Fix memory leaks in test-add-libvirt-dom.
Found by valgrind.

This fixes commit df9782ec3a
and commit 96158d42f5.
2014-12-15 17:28:30 +00:00
Hu Tao
e74bd45111 New API: btrfs_qgroup_remove
btrfs_qgroup_remove removes a qgroup from its parent qgroup.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-12-15 16:22:46 +00:00
Hu Tao
bd4a114272 New API: btrfs_qgroup_assign
btrfs_qgroup_assign adds a qgroup to a parent qgroup.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-12-15 16:22:46 +00:00
Hu Tao
2b7f7810ed New API: btrfs_qgroup_show
btrfs_qgroup_show shows all qgroups on a btrfs filesystem.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-12-15 16:22:46 +00:00
Hu Tao
3617938b48 New API: btrfs_qgroup_destroy
btrfs_qgroup_destroy destroys a qgroup.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-12-15 16:22:46 +00:00
Hu Tao
1144c692dc New API: btrfs_qgroup_create
btrfs_qgroup_create creates a new qgroup.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-12-15 16:22:46 +00:00
Hu Tao
a325f887b3 New API: btrfs_qgroup_limit
btrfs_qgroup_limit limits the size of a qgroup.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-12-15 16:22:46 +00:00
Hu Tao
4e145bb44d New API: btrfs_quota_rescan
btrfs_quota_rescan trashs all qgroup numbers and scans the metadata
again with the current config.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-12-15 16:22:45 +00:00
Hu Tao
29812b8fd6 New API: btrfs_quota_enable
btrfs_quota_enable enables or disables quota for btrfs filesystems.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-12-15 16:22:45 +00:00
Hu Tao
7a25a6d141 New API: btrfs_subvolume_show
btrfs_subvolume_show shows the detailed information of a subvolume or
snapshot.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-12-15 16:22:45 +00:00
Hu Tao
56732ed6a0 New API: btrfs_subvolume_get_default
btrfs_subvolume_get_default is for getting the default subvolume of
a btrfs filesystem.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-12-15 16:22:45 +00:00
Hu Tao
152d17ddbf daemon: btrfs: add helper functions mount and umount
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-12-15 16:22:45 +00: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
7a218cbdf6 v2v: Password attr in domain XML should be 'passwd=' (RHBZ#1174123). 2014-12-15 13:43:34 +00:00
Richard W.M. Jones
dfded7c941 v2v: Get passwords in domain XML (RHBZ#1174123).
Thanks: Tingting Zheng
2014-12-15 08:55:12 +00:00
Richard W.M. Jones
9c4af17add v2v: Whitespace change. 2014-12-15 08:54:59 +00:00
Richard W.M. Jones
da34797987 p2v: Add more authors. 2014-12-13 19:34:29 +00:00
Richard W.M. Jones
5a964144b2 p2v: Rename authors.c, copying.c -> about-* to avoid confusion.
Just file renaming, no other change.
2014-12-13 19:30:47 +00:00
Richard W.M. Jones
f9e0aee149 sysprep: Use automake to build the library.
Normally this requires the program to have at least one C source file.
virt-sysprep doesn't have this, but it uses C sources from other
directories, and therefore we can make it work.
2014-12-13 18:10:58 +00:00
Richard W.M. Jones
604bb7fd7b mllib: Use automake to build the library. 2014-12-13 14:56:30 +00:00
Richard W.M. Jones
ccb1f2a4a0 recipes: Tidy up section about hex-dumping and hex-editing sectors. 2014-12-13 14:49:50 +00:00
Richard W.M. Jones
603d0fbd95 p2v: Test two disk guest.
Make the test harder (evil grin).
2014-12-12 17:41:47 +00:00
Richard W.M. Jones
402bba3505 Version 1.29.15. 2014-12-12 17:13:51 +00:00
Richard W.M. Jones
f4b846445e builder: Try again to fix the infinitely recursive index-parse.h rule.
I ran 'make clean && make' hundreds of times in the builder
subdirectory and it didn't fail.
2014-12-12 16:00:58 +00:00
Richard W.M. Jones
b547b62789 v2v: C files are located in srcdir, not builddir. 2014-12-12 15:50:08 +00:00
Richard W.M. Jones
9d3a02792f sparsify: C files are located in srcdir, not builddir. 2014-12-12 15:50:08 +00:00
Richard W.M. Jones
d8c43d556b New API: guestfs_c_pointer
This returns the C pointer to the guestfs_h handle (ie. guestfs_h *).

The purpose of this API is to interwork with other non-C libraries.
See RHBZ#1075164 for the rationale when applied to another library.
2014-12-12 15:50:08 +00:00
Richard W.M. Jones
1e7a6d9f10 perl: Implement Pointer ("virDomainPtr", _).
This allows the Perl binding of guestfs_add_libvirt_dom to work.

This relies on the internal Perl representation of virDomainPtr, but
Dan assures me this isn't going to change.
2014-12-12 15:50:07 +00:00
Richard W.M. Jones
df9782ec3a tests: Enable and fix test-add-libvirt-dom test.
Commit 96158d42f5 enabled the previously
private guestfs_add_libvirt_dom API.  It also tried to enable the
existing test for this API, but failed to do that correctly.  Also the
test was broken.  Fix all of this.

This fixes commit 96158d42f5.
2014-12-12 15:50:07 +00:00
Richard W.M. Jones
741403d718 v2v: Replace .. with $(top_builddir)
No functional change.
2014-12-12 15:50:07 +00:00
Richard W.M. Jones
85b664dacd builder: index-parse: Remove unused destructor.
YACC     index-parse.c
index-parse.y:97.34-41: warning: type <fields> is used, but is not associated to any symbol [-Wother]
 %destructor { field_free ($$); } <fields>
                                  ^^^^^^^^
index-parse.y:95.36-45: warning: type <sections> is used, but is not associated to any symbol [-Wother]
 %destructor { section_free ($$); } <sections>
                                    ^^^^^^^^^^
2014-12-12 15:50:07 +00:00
Richard W.M. Jones
9135129b0f builder: Use automake to build the binary.
As this has the side effect of enabling warnings in the C code, I had
to fix a lot of C problems in this commit too.
2014-12-12 15:50:07 +00:00
Richard W.M. Jones
e87df1d581 customize: Use automake to build the binary. 2014-12-12 15:12:17 +00:00
Richard W.M. Jones
bd74c6f09a resize: Use automake to build the binary. 2014-12-12 13:24:24 +00:00
Richard W.M. Jones
5a1204594c Version 1.29.14. 2014-12-11 16:29:29 +00:00
Richard W.M. Jones
90e9ad7ff9 python: Add a regression test for disk labelling. 2014-12-11 15:16:42 +00:00
Richard W.M. Jones
39f7eaea80 launch: libvirt: Fix labelling of overlay files.
We had code (added for RHBZ#912499) which labels overlay files
correctly so that libvirt can read them.  Unfortunately this code was
broken by subsequent commits: the new backend setting for the
imagelabel is only copied to the 'data' struct during launch, but the
create_cow_overlay callback is called before launch (when adding
drives).

The fix is easy: ensure create_cow_overlay_libvirt checks for the
backend setting and initializes the 'data' struct.

This change also means we need to free (data->selinux_imagelabel)
before setting it in launch (and we do the same for
data->selinux_label, although that's not strictly necessary).

For background on this, see:
https://bugzilla.redhat.com/show_bug.cgi?id=912499#c10
2014-12-11 15:16:42 +00:00
Richard W.M. Jones
f4b4dcc03a debug: add-domain: Dump XML of original domain.
Useful for debugging labelling issues.
2014-12-11 15:16:42 +00:00
Richard W.M. Jones
2c9f6da034 python: Implement Pointer ("virDomainPtr", _) (RHBZ#1075164).
This allows the Python binding of guestfs_add_libvirt_dom to work.

There is a regression test to ensure this keeps working.

Note this requires a patched libvirt-python, supporting the
c_pointer() method.
2014-12-11 15:16:42 +00:00
Richard W.M. Jones
db1c8a6436 python: Improve harness for running Python tests.
It now understands exit code 77 == skip, amongst other improvements.
2014-12-11 14:15:00 +00:00
Richard W.M. Jones
96158d42f5 New(ish) API: guestfs_add_libvirt_dom.
This API already existed (as guestfs___add_libvirt_dom), and was used
by a few tools.

This commit changes it to a public API.

Note that for reasons outlined in the previous commit message, it is
impossible to call this from guestfish or from non-C language
bindings.
2014-12-11 14:15:00 +00:00
Richard W.M. Jones
fd9ac7f47d generator: Implement Pointer arguments.
This implements Pointer arguments properly, at least for certain
limited definitions of "implements" and "properly".

'Pointer' as an argument type is meant to indicate a pointer passed to
an API.  The canonical example is the following proposed API:

  int guestfs_add_libvirt_dom (guestfs_h *g, virDomainPtr dom, ...);

where 'dom' is described in the generator as:

  Pointer ("virDomainPtr", "dom")

Pointer existed already in the generator, but the implementation was
broken.  It is not used by any existing API.

There are two basic difficulties of implementing Pointer:

(1) In language bindings there is no portable way to turn (eg.) a Perl
Sys::Virt 'dom' object into a C virDomainPtr.

(2) We can't rely on <libvirt/libvirt.h> being included (since it's an
optional dependency).

In this commit, we solve (2) by using a 'void *'.

We don't solve (1), really.  Instead we have a macro
POINTER_NOT_IMPLEMENTED which is used by currently all the non-C
language bindings.  It complains loudly and passes a NULL to the
underlying function.  The underlying function detects the NULL and
safely returns an error.  It is to be hoped that people will
contribute patches to make each language binding work, although in
some bindings it will always remain impossible to implement.
2014-12-11 14:15:00 +00:00
John Eckersberg
841aa0faf3 p2v: show error dialog if virt-v2v fails (RHBZ#1167601)
Ensure the control connection exits with the same status code as
virt-v2v, and return an error from start_conversion if virt-v2v
failed.
2014-12-11 14:15:00 +00:00
Richard W.M. Jones
3d7ea11272 lib: Don't mention whitelist in guestfs_modprobe documentation.
There is no such whitelist any longer.  All modules are copied into
the appliance.
2014-12-10 13:28:35 +00:00
Richard W.M. Jones
e1fd9615cc v2v: linux: Fix modifications to default kernel for legacy grub.
This didn't work at all because the regular expression did not match
the returned Augeas path.

In future if the regular expression doesn't match, this will give an
internal error instead of continuing with a bogus value.

Thanks: Junqin Zhou for providing the test case and debug information.
2014-12-10 13:09:59 +00:00
Richard W.M. Jones
7a34855265 builder: Add Fedora 21 image, remove RHEL 7 RC image. 2014-12-09 19:16:57 +00:00
Kashyap Chamarthy
6468b9d601 arm: Use -cpu host on KVM. 2014-12-09 16:58:11 +00:00
Richard W.M. Jones
bdf772db32 inspection: Not an installer if there are multiple partitions (RHBZ#1171666).
Regular EFI disks have /EFI on the first (VFAT) partition, but they
are not installers.

Fix this by only considering something to be an installer if it has a
single partition (or whole disks like ISOs).

Implementing this is quite complex since when checking a filesystem,
we don't have information about whether we are even looking at a
partition, nor about whether it's the first partition out of how many.
The majority of the commit is changing the code to collect that
information.
2014-12-09 14:07:39 +00:00
Hu Tao
9d6f0b6a86 resize: fix 'No space left on device' problem when copying to an extended partition (RHBZ#1169015)
Because of the size of an extended partition reported by Linux is always 1024
bytes, so it will always fail to copy to an extended partition.

This patch fixes this problem by copying to the offset of an extended
partition in the destination disk.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-12-08 11:00:54 +00:00
John Eckersberg
33098d2302 p2v: wait for qemu-nbd before starting conversion (RHBZ#1167774)
Wait up to 10 seconds for qemu-nbd to start up and respond to clients.
Otherwise the conversion server may attempt to connect before qemu-nbd
is ready to serve it.
2014-12-08 10:55:37 +00:00
Richard W.M. Jones
ee57b5f45a Version 1.29.13. 2014-12-05 16:16:23 +00:00
Pino Toscano
d4ffaad983 sysprep: user-account: mark "changed file" if users were removed
Removing an user causes /etc/passwd, /etc/shadow, and /etc/group to
change, so mark the side effects as such if any user has been removed.
2014-12-05 16:10:56 +01:00
Pino Toscano
acb6e8f344 sysprep: add a "changed file" side effect 2014-12-05 16:10:56 +01:00
Pino Toscano
1ea9b684b2 customize, sysprep: add a short SELinux note
Add a short paragraph about SELinux, mostly to point to the
documentation about it provided in the documentation of virt-builder.
2014-12-05 16:10:56 +01:00
Richard W.M. Jones
be73b1750f v2v: Add documentation about what to do about BSOD 0x0000007B (RHBZ#1161333).
After a very long and trying episode with a Windows guest that refused
to boot after conversion, we managed to successfully boot it by
disabling Windows Group Policy.  It appears that Group Policy
prevented the virtio driver from being used.

Document this in the manual.
2014-12-05 15:04:03 +00:00
Richard W.M. Jones
a542389767 v2v: Remove documentation about Windows Recovery Console not supported.
We have now successfully converted guests using WRC, so this statement
is no longer necessary.
2014-12-05 14:29:26 +00:00
Richard W.M. Jones
1bd779c983 v2v: Fix missing loop device which breaks conversion of RHEL 3 guests (RHBZ#1171130). 2014-12-05 13:52:25 +00:00
Richard W.M. Jones
205a8c7ca1 v2v: Don't use epoch prefix on RPM command line for RHEL <= 4 (RHBZ#1170685).
See the explanation here:
https://bugzilla.redhat.com/show_bug.cgi?id=1170685#c7
2014-12-05 13:09:10 +00:00
Hu Tao
eddc8862e0 fish: fix build warning when readline-devel is missing
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-12-05 12:41:34 +00:00
Richard W.M. Jones
212660f70f builder: Add support for RHEL 3, RHEL 4. 2014-12-05 12:38:58 +00:00
Nikos Skalkotos
20098d4534 Add freebsd and netbsd distros
Prior to this commit the distro for a FreeBSD or a NetBSD system, in
conjuction to what happened for OpenBSD, was shown as 'unknown'.
*BSDs are complete OSes, not a kernel like Linux, but theoritically you
could have FreeBSD as ostype and PC-BSD as distro.

Signed-off-by: Nikos Skalkotos <skalkoto@grnet.gr>
2014-12-04 22:08:09 +00:00
Nikos Skalkotos
b58022eca7 Fix fstab block device resolution for FreeBSD
Take into granted that partition 'c' has a special purpose. It has
always the same size as the enclosing slice and is not mapped under
Linux.

This is a best effort try. The mapping will be incorrect if there is a
gap in the disklabel partitions sequence, e.g. 'b' (swap) partition is
missing but 'd' partition is defined.

Signed-off-by: Nikos Skalkotos <skalkoto@grnet.gr>
2014-12-04 22:08:09 +00:00
Nikos Skalkotos
af6ea8fa8f Support fstab block device resolution for NetBSD
Make a best effort try to map NetBSD disklabel partitions to Linux
partitions. The mapping will be incorrect if there is a gap in the
disklabel partitions sequence, e.g. 'b' (swap) partition is missing but
'e' partition is defined.

Signed-off-by: Nikos Skalkotos <skalkoto@grnet.gr>
2014-12-04 22:08:09 +00:00
Nikos Skalkotos
7adbf72f1b inspect_os: Add support for detecting OpenBSD
Signed-off-by: Nikos Skalkotos <skalkoto@grnet.gr>
2014-12-04 22:08:09 +00:00
Richard W.M. Jones
0c2e676f6c v2v: When picking a default kernel, favour non-debug kernels over debug kernels (RHBZ#1170073). 2014-12-04 22:00:56 +00:00
Richard W.M. Jones
c712f880db mllib: Add Common_utils.string_suffix function and extend test coverage. 2014-12-04 22:00:56 +00:00
Richard W.M. Jones
39d64121ec v2v: Disable autoreboot when converting Windows guests.
This allows users to see stop errors, so we can get an accurate report
when things go wrong.
2014-12-04 17:39:11 +00:00
Pino Toscano
1033847f00 gobject: link against uninstalled libraries
Make sure to link the gobject library and the gir using the in-tree
built libguestfs, so a system library won't be used accidentally.
2014-12-04 17:09:32 +01:00
Nikos Skalkotos
7c7755eb60 Remove extra space in inspect-fs-unix.c
Signed-off-by: Nikos Skalkotos <skalkoto@grnet.gr>
2014-12-02 23:06:50 +00:00
Richard W.M. Jones
de0b7c4e66 build: Map host CPU 'powerpc64le' to qemu-system-ppc64.
Make the corresponding change in libguestfs-test-tool as well.

Thanks: Dan Horák
2014-12-02 09:51:41 +00:00
Hu Tao
a21ab21b1a fish: show synopsis if command syntax is wrong
This patch lets guestfish show command synopsis if the syntax of command issued
by user is wrong, rather than telling user that the number of parameters is wrong.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-12-02 08:37:46 +00:00
Richard W.M. Jones
391d90d9e7 p2v: Refer to virt-v2v resource requirements in virt-p2v man page. 2014-11-29 18:20:52 +00:00
Richard W.M. Jones
1b52139339 p2v: Mention sshd_config setting in the manual page.
The precise sshd configuration has confused some users of virt-p2v.
Only one setting (AllowTcpForwarding=yes) is required, so document it.
2014-11-29 18:20:00 +00:00
Richard W.M. Jones
4d9a14fc75 configure: Require yajl >= 2.0.4 (RHBZ#1169045).
Earlier versions fail to parse integers from 'qemu-img info' output
correctly, resulting in bugs like
https://bugzilla.redhat.com/show_bug.cgi?id=1169045

Thanks: muued @ IRC
2014-11-29 12:03:08 +00:00
Richard W.M. Jones
2990db8d1a tests/c-api: Test that the library can really be loaded with dlopen.
Answer is yes, but it was good to know.
2014-11-28 22:26:57 +00:00
Richard W.M. Jones
3a5613eb22 Version 1.29.12. 2014-11-28 19:51:47 +00:00
Richard W.M. Jones
4a63cddae4 Add HACKING file to EXTRA_DIST.
Updates commit 3d3694610f.
2014-11-28 19:50:56 +00:00
Richard W.M. Jones
d0a676c91c lib: Add COMPILE_REGEXP macro to hide regexp constructors/destructors. 2014-11-28 15:04:19 +00:00
Nikos Skalkotos
282132c58b inspect: Fix a bug in the *BSD root detection
The assumption that Linux will map the MBR partition to /dev/sda1
and the BSD 'a' partition to /dev/sda5 is not always correct.

Signed-off-by: Nikos Skalkotos <skalkoto@grnet.gr>
2014-11-28 14:56:07 +00:00
Hu Tao
b53ba64a26 uuid: make alias get-uuid for vfs_uuid
Because get-uuid looks more like a counterpart to set-uuid, and is
more likely come to mind if one knows set-uuid.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-11-28 14:19:27 +00:00
Hu Tao
45266e3d49 uuid: cannot change btrfs filesystem's UUID
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-11-28 14:19:27 +00:00
Hu Tao
95644f33cd uuid: add support to change uuid of swap partition
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-11-28 14:19:27 +00:00
Richard W.M. Jones
196813ea74 v2v: Fix command line --help output for --no-trim option. 2014-11-27 17:41:13 +00:00
Pino Toscano
6faa7b4c84 bash: add a completion module for virt-v2v 2014-11-27 16:26:14 +01:00
Pino Toscano
e3834188a9 bash: complete some params for resize, sparsify, and builder
Hardcode the list of fixed arguments for some of the parameters of these
tools.
2014-11-27 16:26:13 +01:00
Pino Toscano
1784cd2633 bash: complete also short options
Propose both short and long options when trying to complete a single
dash ("-").
2014-11-27 16:26:13 +01:00
Pino Toscano
4b792354f0 bash: execute --long-options only when needed
Delay the execution of $tool --long-options only when really using its
output.
2014-11-27 16:26:13 +01:00
Pino Toscano
b00adf3b78 tools: implement --short-options
Just like --long-options, it makes it possible to know which short
options are supported by each tool; this can help improving the bash
completion, for example.
2014-11-27 16:26:13 +01:00
Richard W.M. Jones
3d3694610f p2v: Add HACKING file. 2014-11-27 14:39:31 +00:00
Richard W.M. Jones
7ee6977f7e Version 1.29.11. 2014-11-27 12:04:30 +00:00
Pino Toscano
5e81c838e8 Update gobject/Makefile.inc and POTFILES
Followup of commit a120449c979993f4b5bd458ece00fadb339546d3.
2014-11-26 17:22:02 +01:00
Hu Tao
1622e3d218 btrfs: add optional parameter `qgroupid' to btrfs_subvolume_create
Parameter `qgroupid' is for adding the created subvolume to a qgroup.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-11-26 17:22:02 +01:00
Hu Tao
9e7b9ef97f btrfs: add optional parameter `qgroupid' to btrfs_subvolume_snapshot
Parameter `qgroupid' is for adding the created snapshot to a qgroup.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-11-26 17:22:01 +01:00
Pino Toscano
5f608f0735 Update gobject/Makefile.inc and POTFILES
Followup of commit 0b3c1762965f339915fd080884a61dbb36545204.
2014-11-26 17:22:01 +01:00
Hu Tao
b349076aee btrfs: add optional parameter `ro' to btrfs_subvolume_snapshot
Parameter `ro' is for creating readonly btrfs snapshot.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-11-26 17:22:01 +01:00
Richard W.M. Jones
8cd2620448 Add debug APIs: bmap-file, bmap-device, bmap.
Add *interim* support for a block mapping API, used by the 'virt-bmap'
tool.  These are debug APIs so they will eventually be replaced by
real APIs along the lines described here:

https://www.redhat.com/archives/libguestfs/2014-November/msg00197.html
2014-11-26 16:15:47 +00:00
Hu Tao
dc1f15aa3e typo fix: commmand -> command
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-11-26 13:22:36 +01:00
Hu Tao
b6f6454678 typo fix: preceeding -> preceding
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-11-26 13:22:32 +01:00
Richard W.M. Jones
55f6dc7f3d Version 1.29.10. 2014-11-25 19:38:44 +00:00
Nikos Skalkotos
f3dbf340b8 Add tests for Arch Linux
Signed-off-by: Nikos Skalkotos <skalkoto@gmail.com>
2014-11-25 15:25:45 +00:00
Pino Toscano
7ce73d8980 mllib: check the right out channel for tty
Make sure to check whether the given output channel is a tty before
sending ANSI terminal codes to it, instead of always check what stdout
is.
2014-11-25 15:40:49 +01:00
Pino Toscano
b2b65bcefb mllib: remove the TTY module
The only function provided is isatty_stdout, which is no more used now
in favour of Unix.isatty.
2014-11-25 15:40:49 +01:00
Pino Toscano
8a56fc8e08 mllib: use Unix.isatty
Make use of Unix.isatty instead of our TTY.isatty_stdout, as the
supported OCaml provides the former already.
2014-11-25 15:40:49 +01:00
Hu Tao
bd61f25625 generator: force longdesc to begin with uppercase
As contrast to shortdesc which is forced to begin with lowercase, this
patch forces longdesc to begin with uppercase.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-11-25 14:35:40 +00:00
Richard W.M. Jones
7030635e51 v2v: -i ova: Small correction to warning message.
Thanks: Pino Toscano
2014-11-25 14:34:27 +00:00
Richard W.M. Jones
350b6eec4d New API: guestfs_blockdev_setra: Adjust readahead for filesystems and devices.
This adds a binding for 'blockdev --setra', allowing you to adjust the
readahead parameter for filesystems and devices.
2014-11-25 14:34:27 +00:00
Richard W.M. Jones
dbdfa79d91 daemon: blockdev: Allow extraarg to be 0.
No change, since extraarg is not actually used.
2014-11-25 14:31:42 +00:00
Richard W.M. Jones
79fb3debc4 v2v: -i ova: Remove incorrect warning for disks that have no parent controller (RHBZ#1167302).
Don't assume every disk <Item> has a <Parent> field.  For floppy disks
this is not the case.

Thanks: Junqin Zhou
2014-11-24 19:02:34 +00:00
Richard W.M. Jones
dc845c9a66 ntfsresize: Capture errors sent to stdout (RHBZ#1166618).
ntfsresize sends error messages to stdout.  Capture those error
messages.
2014-11-24 19:02:34 +00:00
Richard W.M. Jones
e90ab1530e lib: guestfs_disk_create: Allow vmdk as a valid backingformat.
Commit 588af1953e started with a very
conservative list of permitted backing formats (just "raw" or
"qcow2").  We can allow almost any format permitted by qemu, but this
commit just adds "vmdk" to this whitelist.
2014-11-23 22:15:42 +00:00
Hu Tao
5a84407f57 btrfs: correct words about subvolume and snapshot
btrfs_subvolume_create creates only subvolumes. btrfs_subvolume_delete
deletes subvolumes or snapshots.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-11-21 18:11:44 +01:00
Pino Toscano
99263616ca src: inspect: move read_package within the -Wno-cast-align block
Starting from commit e260460a8f be32toh is
used, which means possible "unaligned cast" warnings (already covered in
get_rpm_header_tag).
2014-11-21 16:10:33 +01:00
Pino Toscano
2305fe3fc6 build: mllib: put $(LIBTINFO_LIBS) within '...'
This helps when $(LIBTINFO_LIBS) contains spaces (i.e. more than one
"word").
2014-11-21 16:08:50 +01:00
Richard W.M. Jones
c64467a4c1 p2v: Include version and md5sum in kickstart.
Include the version of virt-p2v and its MD5 checksum in the source
kickstart.  This is useful for working out which version of virt-p2v
the kickstart corresponds to.
2014-11-20 22:22:49 +00:00
Richard W.M. Jones
ac1b4bcd7d Version 1.29.9. 2014-11-20 21:49:03 +00:00
Richard W.M. Jones
25b979a0c4 p2v: Make the "Cancel Conversion" button work (RHBZ#1165569).
This relies on the remote to keep sending us data.  If it hangs, then
the cancel button won't work.  This could also be fixed by introducing
a timeout to the read syscall.
2014-11-20 16:11:19 +00:00
Richard W.M. Jones
98dd01728f p2v: Disable "Cancel Conversion" button after the conversion (RHBZ#1165569).
Actually this bug does nothing and remains cancelled all the
way through.  The next commit makes it function.
2014-11-20 16:11:19 +00:00
Richard W.M. Jones
141832e2b2 p2v: Add 'Reboot' button to the GUI (RHBZ#1165564). 2014-11-20 16:11:19 +00:00
Richard W.M. Jones
5d695d37a5 p2v: gui: Get the correct button for cancel_button.
I was fetching cancel_button from the wrong dialog (conv_dlg, not
run_dlg), and therefore getting the wrong button.

This explains why the back button on the conversion dialog was always
insensitive.  It's because cancel_button was assigned to this button,
and then I was setting cancel_button to insensitive.
2014-11-20 16:11:19 +00:00
Richard W.M. Jones
11347db576 p2v: Remove --fullscreen option.
It did nothing and was left over from an earlier attempt to add
fullscreen mode.  That is not needed any longer since we now run
virt-p2v under the matchbox window manager.
2014-11-20 16:11:19 +00:00
Richard W.M. Jones
3dabc7a7ba appliance: When running systemd-tmpfiles, pass --boot option (RHBZ#1165785).
This causes all tmpfiles to be created.
2014-11-20 13:05:26 +00:00
Richard W.M. Jones
8e78a83067 appliance: Create tmpfiles before running udev.
This is the same order as systemd would run them.
2014-11-20 13:04:45 +00:00
Richard W.M. Jones
63d67ac8ac v2v: linux: Delete the LVM cache which may reference old devices (RHBZ#1164853).
Thanks: Bryn M. Reeves
2014-11-20 11:22:32 +00:00
Richard W.M. Jones
7b8c6e762e v2v: linux: Remap device names in /boot/grub2/device.map (RHBZ#1165975).
Thanks: Junquin Zhou
2014-11-20 10:08:51 +00:00
Richard W.M. Jones
171e6383a2 v2v: linux: In verbose mode, add dracut --verbose parameter.
So we can see exactly what dracut is doing in the debug output.
2014-11-19 13:20:13 +00:00
Nikos Skalkotos
6aaff1fffa inspection: deb: Seperate epoch field from version
Return it in the app2_epoch field of the guestfs_application2 struct

Signed-off-by: Nikos Skalkotos <skalkoto@gmail.com>
2014-11-18 20:41:05 +00:00
Richard W.M. Jones
28f2cb7e3a Version 1.29.8. 2014-11-18 16:55:21 +00:00
Richard W.M. Jones
467bbf72f7 v2v: linux: Refactor device replacement code.
No functional change.  This should be equivalent to previously.
2014-11-18 14:38:14 +00:00
Richard W.M. Jones
b1053150a2 v2v: linux: Always match partition number in regexp.
Change the rex_device_p regular expression to always include a
partition number.

There should be no functional change here.
2014-11-18 14:38:14 +00:00
Richard W.M. Jones
e25f68c47e v2v: linux: Print block device map in verbose mode.
Very useful for debugging device mapping problems.
2014-11-18 14:38:14 +00:00
Richard W.M. Jones
4c7026fb7a v2v: Don't change Augeas device entries unless the value has changed.
When remapping block devices, don't change an entry unless its value
has changed.  This avoids unnecessary Augeas writes.
2014-11-18 14:38:14 +00:00
Richard W.M. Jones
9ebc125723 v2v: Don't use <target dev> attribute, use <target bus> instead.
The <target dev> attribute in libvirt isn't very informative.  What we
really want to know is whether the source disk used IDE or SCSI, as
that allows us to remap block devices accurately during conversion.
For example, if the source was IDE and RHEL 5, and after conversion
virtio will be supported, then we know that we need to remap
"/dev/hda" to "/dev/vda".

Drop the s_target_dev and s_removable_target_dev fields and replace
them with s_controller and s_removable_controller.

For -i libvirt, use the <target bus> attribute to get this information.

For -i ova, use the OVF disk controller's ResourceType.
(http://blogs.vmware.com/vapp/2009/11/virtual-hardware-in-ovf-part-1.html)
2014-11-18 13:34:57 +00:00
Richard W.M. Jones
78f6d3aff5 v2v: -i ova: XML is case-sensitive, so replace 'InstanceId' with 'InstanceID'. 2014-11-18 12:35:38 +00:00
Nikos Skalkotos
01bdfe7d81 list-applications: Add support for pacman
Extend the guestfs_inspect_list_applications2 API call to work on Arch
Linux guest images.

Signed-off-by: Nikos Skalkotos <skalkoto@gmail.com>
2014-11-17 19:54:45 +00:00
Richard W.M. Jones
e260460a8f inspection: rpm: Return Epoch field of RPMs in application data.
Bug found by: Nikos Skalkotos
2014-11-17 13:17:07 +00:00
Richard W.M. Jones
4239191328 inspection: Allow /etc/favicon.png to be a symbolic link (RHBZ#1164619).
If /etc/favicon.png is a symbolic link, follow it.

Unfortunately RHEL 7 and Fedora have crappy 16x16 /etc/favicon.png
symlinks in the base distro.  It would be nice to ignore this symlink,
but it's almost impossible to determine if the symlink is part of the
base distro or was added by the user.  (This is a bug in those
distros.)  virt-inspector and virt-mananger both ignore favicons.
2014-11-17 10:33:35 +00:00
Richard W.M. Jones
c8a608ecf8 inspection: Get icons from RHEL and CentOS 7 (RHBZ#1164619). 2014-11-17 10:25:33 +00:00
Richard W.M. Jones
6dd371f913 Fix description of 'set_append' and 'get_append' APIs (RHBZ#1164732).
These should refer to the libguestfs appliance kernel command
line, not the guest kernel command line.

Thanks: Lingfei Kong
2014-11-17 10:07:28 +00:00
Richard W.M. Jones
88f2bc1a7b Fix minor typo in release notes (RHBZ#1164697). 2014-11-17 09:31:55 +00:00
Richard W.M. Jones
40cd76eb79 v2v: Simplify calculation of Mbps in verbose output. 2014-11-17 08:58:19 +00:00
Richard W.M. Jones
e02b261e48 v2v: Comment change. 2014-11-17 08:58:19 +00:00
Richard W.M. Jones
a5bb1a4ccb v2v: Make source s.hypervisor field type-safe. 2014-11-15 18:26:54 +00:00
Richard W.M. Jones
5920f7a568 v2v: Rename source field 's_dom_type' to 's_hypervisor'.
Also the source hypervisor cannot be "kvm".  Choose another example
for the comment.

For disks, set the source hypervisor string to "unknown".
2014-11-15 17:45:22 +00:00
Richard W.M. Jones
f421c7cae8 ocaml: Remove *.annot files when doing 'make clean'.
Commit fd70cdc3c5 passes the -annot flag
to the compiler, generating *.annot files (containing type information
used by emacs and IDEs).  Remove these files when doing 'make clean'.
2014-11-15 17:39:01 +00:00
Richard W.M. Jones
52dfb831db Version 1.29.7. 2014-11-15 17:09:59 +00:00
Pino Toscano
643162a61a appliance: explicitly add libyajl2 on openSUSE
While it has always been needed, it has been implicitly pulled in by
some other package. Hence, make it sure to always have it.
2014-11-14 18:04:12 +01:00
Richard W.M. Jones
891959cf7f df: Allow policykit and SASL authentication when reading list of domains.
Use virConnectOpenAuth instead of virConnectOpenReadOnly.

See also:
https://www.redhat.com/archives/libguestfs/2014-November/thread.html#00035
2014-11-13 15:33:21 +00:00
Pino Toscano
57547dcdcf daemon: check xfs label lengths (RHBZ#1162966).
Similar to commit 52f9cd4882, but for xfs
filesystems.
2014-11-13 14:32:01 +01:00
Pino Toscano
e698daabbc configure: simplify the qemu cpu mapping
Use AS_CASE to properly map from the host cpu to the qemu cpu suffix;
this avoids doing multiple string replacements using sed, and it is
possible to use case-like syntax.
2014-11-13 14:32:00 +01:00
Richard W.M. Jones
34d6851574 Rename LIBNCURSES* to LIBTINFO*.
We actually depend on libtinfo or libtermcap, not curses, so
rename the variable.

This updates commit 96add4d5b3.
2014-11-13 13:22:21 +00:00
Mike Frysinger
96add4d5b3 use pkg-config to look up ncurses
Hardcoding -ltinfo breaks on distros that do not build the sep library
(which is the default ncurses behavior).  Use pkg-config to look up the
right libraries regardless of how the distro built things.
2014-11-13 13:19:55 +00:00
Richard W.M. Jones
7407c0ae14 v2v: -o glance: Fix metadata for disk type and NIC (RHBZ#1161575).
The labels 'hw_disk_bus' and 'hw_vif_model' were swapped.  This
happened to work for virtio guests.  For non-virtio guests you ended
up with absurdities like requiring an rtl8139 driver for the disk.

Thanks: Junquin Zhou
2014-11-07 11:25:06 +00:00
Richard W.M. Jones
75b37b7589 Version 1.29.6. 2014-11-06 22:07:26 +00:00
Richard W.M. Jones
4a187b7faf v2v: Warn if a kernel-* package is found containing no files. 2014-11-06 18:55:04 +00:00
Richard W.M. Jones
377bc302f1 v2v: Fix kernel detection when multiple kernels are installed (RHBZ#1161250).
Previously we used to try to find the 'vmlinuz' file by running 'rpm
-ql kernel' and looking for any file called 'vmlinuz-*'.

If there were multiple 'kernel' packages installed, the rpm command
would list files from all of them, resulting in a random 'vmlinuz-*'
being chosen, not necessarily the one corresponding to the kernel
package we were looking at.

Use 'rpm -ql kernel-<VERSION>-<RELEASE>' instead so that we only look
for files in the right kernel package.

Thanks: James Mighion
2014-11-06 18:55:04 +00:00
Richard W.M. Jones
bd589a1d53 test-tool: Map powerpc64 -> ppc64 when searching for qemu.
Consequence of the previous commit.

This also adjusts the whitespace to make the generated script
a bit nicer.
2014-11-06 15:15:39 +00:00
David Sommerseth
a550ecb5f1 configure: Map powerpc64 -> ppc64. 2014-11-06 15:14:04 +00:00
Richard W.M. Jones
5de06a3571 v2v: Document minimum free filesystem space requirements. 2014-11-06 09:52:32 +00:00
Richard W.M. Jones
918dd3705d v2v: Ignore small filesystems when checking for sufficient free space. 2014-11-06 09:47:21 +00:00
Richard W.M. Jones
ea04bcbc84 Use -ltinfo instead of -lncurses.
In tools except guestfish, we don't use ncurses, or even curses, just
2 termcap functions and a global variable.  These are provided by
libtinfo, so just link to that.

In guestfish we use readline which needs ncurses.  Leave that alone.
2014-11-05 21:34:58 +00:00
Richard W.M. Jones
8c2f27518a Version 1.29.5. 2014-11-05 15:41:32 +00:00
Richard W.M. Jones
f27e242649 daemon: strings: Use -a option to avoid using BFD to parse files.
Avoids hitting CVE-2014-8484 and CVE-2014-8485 and similar problems
with BFD parsing on untrusted files.
2014-11-05 14:50:54 +00:00
Pino Toscano
a5426cce5f build: check for libintl, and use it
Look for libint/gettext and link to it; this properly detects whether
libint is part of libc.
2014-11-05 13:45:17 +01:00
Richard W.M. Jones
c58d335952 v2v: -i libvirt vcenter: Change 'esx:' to 'vcenter:' in errors/warnings.
'esx' is inaccurate.
2014-11-04 21:21:20 +00:00
Pino Toscano
1fab78c7b2 tests/qemu: isolate MD5 calculation in an own shared function
md5sum(1) does not exist everywhere, so wrap it in an own function so
the right implementation can be chosen on each OS.  Also, wrapping it
avoid using awk everytime.
2014-11-04 18:02:20 +01:00
Pino Toscano
3d02e53c48 ruby: fix detection of ruby library
Query RbConfig::CONFIG for "libdir", and use that when trying to link to
the ruby library.  This fixes the libruby detection when it is installed
in a non-standard library directory.
2014-11-04 18:02:20 +01:00
Pino Toscano
9deafea846 test-charset-fidelity: use and link against gnulib
It uses error() which is specific to GNU libc, but supplied by gnulib if
not available.
2014-11-04 18:02:04 +01:00
Pino Toscano
a293ac1e91 build: isolate the libdb tools search in an own autoconf macro
Create an autoconf macro to deal with the possible combinations of names
and versions of the libdb tools. This also eases the addition of a libdb
version, or a new pattern for the names of tools.

There is no functional change.
2014-11-04 17:59:55 +01:00
Pino Toscano
aba82825a3 builder: fix inclusion of <config.h> in lex-generated source
Use a %top block for including <config.h>, so it is included prior to
any other include, even for system ones. This makes sure its definitions
are properly used in gnulib replacement headers.
2014-11-04 17:59:55 +01:00
Pino Toscano
d1634799e3 src: launch: cast the sockaddr args to sockaddr*
This matches what generally done for passing socket addresses to e.g.
socket and bind, and already done in other parts of libguestfs.
2014-11-04 15:33:23 +01:00
Pino Toscano
8c8e089ad1 build: check for UNIX_PATH_MAX, and properly define it if not
Do a configure check to see whether UNIX_PATH_MAX is defined; if it is
not defined, provide it with the size of sun_path in the struct
sockaddr_un, thus with the proper size for any libc.
2014-11-04 15:33:22 +01:00
Pino Toscano
65a54c6c92 bash: fix build/clean when srcdir==builddir
Use CLEANFILES to remove the generated symlinks, and just ignore the
errors when copying the scripts in srcdir!=builddir situations.

Followup of commit 40ac54829d.
2014-11-04 10:50:59 +01:00
Hilko Bengen
40ac54829d Fix, simplify out-of-tree build/install for bash completions 2014-11-04 09:40:13 +00:00
Pino Toscano
25cad1e62f customize: firstboot: fix Linux log output
Pass -a to each tee invocation, otherwise just the last one (so only for
the last script executed) will appear in the log file.
2014-11-04 09:16:17 +01:00
Pino Toscano
f8ed15462f customize: firstboot: make sure to run Linux scripts only once
If a script does not finish, hangs, etc, it would be executed again at
the next boot, since the injected firstboot.sh helper removes it only
after it finished.

Before executing a script, move it to another internal subdirectory
(scripts-done) and execute it from there, so it is not run again by
firstboot.sh.  The downside is that now scripts are executed only once
at all, so if a script fails it will not be attempted at the next boot.

Also, remove all the files found in scripts-done, as they have been run
(or at least attempted) in a previous boot.

This fixes RHBZ#1159651.
2014-11-03 21:15:59 +01:00
Pino Toscano
3d6c2af450 customize: Add --ssh-inject option for injecting SSH keys.
This adds a customize option:

  virt-customize --ssh-inject USER
  virt-customize --ssh-inject USER:string:KEY_STRING
  virt-customize --ssh-inject USER:file:FILENAME

(ditto for virt-builder and virt-sysprep)

In each case this injects into the guest user USER
a) the current (host) user's ssh pubkey
b) the key specified as KEY_STRING
c) the key in FILENAME
adding it to ~USER/.ssh/authorized_keys in the guest.

For example:

  virt-builder fedora-20 --ssh-inject root

will add the local user's ssh pubkey into the root account of the
newly created guest.  Or:

  virt-customize -a disk.img \
     --ssh-inject 'mary:string:ssh-rsa AAAA.... mary@localhost'

adds the given ssh pubkey to mary's account in the guest.

This doesn't set the SELinux labels correctly on newly created files
and directories, so you have to use --selinux-relabel (probably we
should fix this as part of the general effort to fix SELinux
relabelling).  However it should preserve the labels if the
~/.ssh/authorized_keys file already exists.

Most of this work is based on a patch sent to the mailing list by
Richard W.M. Jones <rjones@redhat.com>:
https://www.redhat.com/archives/libguestfs/2014-November/msg00000.html
2014-11-03 20:47:38 +01:00
Richard W.M. Jones
39f524d79b v2v: Ensure --bridge and --network args are documented correctly in --help output. 2014-11-03 19:38:37 +00:00
Richard W.M. Jones
0121f4fd56 generator: customize: Insert whitespace between entries.
Just a whitespace change.
2014-11-01 21:08:53 +00:00
Richard W.M. Jones
0701b24e5c daemon: No longer needs its own copy of gnulib.
Since the daemon has long since used the same build system as the rest
of libguestfs, it no longer needs its own gnulib.

This arcane bit of code was left over from
commit e05ddc70f1 (added 2009-08-03 !)
2014-10-31 18:30:36 +00:00
Richard W.M. Jones
a6b3943783 Version 1.29.4. 2014-10-31 17:47:18 +00:00
Richard W.M. Jones
6d6644d52d launch: libvirt: Implement drive secrets (RHBZ#1159016).
Implement the GUESTFS_ADD_DRIVE_OPTS_SECRET argument of
guestfs_add_drive_opts.  For libvirt we have to save the secret in
libvirtd first, get a UUID, and then pass the UUID back through the
domain XML.
2014-10-31 17:24:54 +00:00
Richard W.M. Jones
68dc488a44 v2v: -o libvirt: Get the <features/> right in the output XML (RHBZ#1159258).
Implement what old virt-v2v did (from
lib/Sys/VirtConvert/Connection/LibVirtTarget.pm)

Thanks: Tingting Zheng, Matthew Booth
2014-10-31 17:24:53 +00:00
Pino Toscano
7ba102dc4c fish: complete symlink properly
When an entry is a symlink, check whether it points to a directory, so
the entry for it can be completed correctly.
2014-10-31 17:49:54 +01:00
Pino Toscano
a8b95a5535 fish: fix dir completion on filesystems w/o dirent.d_type (RHBZ#1153844).
On filesystems whose dirent.d_type is DT_UNKNOWN or some unknown value,
manually check whether an entry is a directory, thus completing in the
proper way.
2014-10-31 17:49:54 +01:00
Pino Toscano
d082cd6ae5 builder: pass Sources.source objects directly
Instead of passing the (uri, key, proxy) tuple around, pass the whole
Sources.source record; this requires creating proper Sources.source also
for uri+fingerprint passed via command line.

No functional changes.
2014-10-31 17:49:46 +01:00
Pino Toscano
56bd781b76 builder: use gpgkey_type for the gpgkey field in sources 2014-10-31 17:46:14 +01:00
Pino Toscano
3987bbcd91 builder: move the gpgkey_type type from Sigchecker to Utils
No functional change, just code motion.
2014-10-31 17:46:14 +01:00
Richard W.M. Jones
1470be7f3b v2v: Add bounds check to Xml.xpathobj_node function.
I accidentally called it with an out-of-bounds index, and it caused a
core dump.  Add a bounds check to stop this from happening in
production.
2014-10-31 15:58:43 +00:00
Richard W.M. Jones
c085a0ba73 builder: Updated CentOS image to 6.6. 2014-10-31 13:57:26 +00:00
Richard W.M. Jones
847465a794 src/info.c: Remove incorrect comment. 2014-10-31 10:50:20 +00:00
Richard W.M. Jones
3e4024a1ea Version 1.29.3. 2014-10-30 22:21:47 +00:00
Richard W.M. Jones
65abc44203 v2v: Add --password-file parameter (RHBZ#1158526).
This allows you to send passwords to virt-v2v input modes without
being interactive.
2014-10-30 13:47:54 +00:00
Richard W.M. Jones
b35b84684c v2v: vmware: Use 'curl --config' to pass arguments securely to curl.
Instead of making up an ordinary curl command line, write a temporary
config file and use 'curl --config tmpfile' to pass the arguments.

The advantage is that it's more secure if we want to supply passwords
to curl, since a '--user username:password' parameter on the command
line could be read (eg. by 'ps ax'), but the temporary file has mode
0600 and cannot be read by other users.

This is mostly code motion, but it also passes the '-q' option to curl
to stop it from reading default configuration files.
2014-10-30 13:47:37 +00:00
Richard W.M. Jones
d82c5fb5a0 v2v: Remove useless parentheses around expression. 2014-10-30 13:47:36 +00:00
Richard W.M. Jones
8efbe49df6 p2v: kickstart: Add rpm to list of packages.
Avoids RHBZ#1089566.
2014-10-29 18:02:29 +00:00
Richard W.M. Jones
26952db56f p2v: kickstart: Remove 'install' line.
'install' is the default operation, it doesn't have to be specified.
2014-10-29 18:02:28 +00:00
Richard W.M. Jones
c48114cd24 p2v: kickstart: Add firewalld to the ISO to allow firewall to be enabled. 2014-10-29 18:02:28 +00:00
Richard W.M. Jones
439bf5e42a p2v: kickstart: Name the ISO 'virt-p2v'. 2014-10-29 18:02:28 +00:00
Richard W.M. Jones
a03bffa15a v2v: Add a support matrix to the manual page.
This explains what does and doesn't work.
2014-10-29 18:02:28 +00:00
Richard W.M. Jones
6d338ae4e6 builder: Document that --edit option can be split across lines. 2014-10-28 22:49:58 +00:00
Richard W.M. Jones
cb291d7e46 p2v: Ensure we are using virt-v2v >= 1.28.
Must NOT use:

- One of the interim versions of virt-v2v (1.27.x) that we published
  during development.

- Old virt-v2v (0.9.x).

Also use the --version option (instead of -V) since old virt-v2v
required it:

  $ virt-v2v -V
  Option v is ambiguous (version, vmtype)
  Usage:
  [...]
  $ virt-v2v --version
  0.9.1
2014-10-28 11:21:34 +00:00
Hu Tao
d0eba7f260 sysprep: remove /var/spool/mail/username
remove /var/spool/mail/username if --enable user-account.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-10-28 11:21:33 +00:00
Richard W.M. Jones
7f7c153347 Document three (fixed) security problems in the main manual page.
Previously these were only covered in the release notes, but not in
the "SECURITY" section of guestfs(3).
2014-10-27 17:51:40 +00:00
Richard W.M. Jones
777e2175ab Add warnings about using guestfs_strings* APIs because of CVE-2014-8484 and CVE-2014-8485. 2014-10-27 17:44:54 +00:00
Richard W.M. Jones
b09b60c987 p2v: Add usb-storage module and rebuild initrd (RHBZ#1157679).
Include the usb-storage kernel module, to permit booting from USB
keys.

Rerun dracut to rebuild the initramfs.  This is complicated because by
default dracut will try to build an initramfs for the running
(ie. appliance) kernel, which is completely useless.  We need to find
the latest installed kernel and rebuild the initramfs for that
instead, which is hairy.

This also does a small refactoring of the distro-specific code,
removing the $selinux_relabel variable and replacing it with a generic
$extra_args variable.

I only added this to the virt-builder script, since one assumes that
livecd-creator/whatever should make the kickstart ISO bootable by
installing whatever drivers and modules are necessary.
2014-10-27 16:56:13 +00:00
Richard W.M. Jones
4c31cae279 Revert "p2v: Add usb-storage dracut module to allow boot from USB key (RHBZ#1157679)."
Running 'dracut -f' installs a dracut for the running kernel (of the
appliance) not the installed kernel.  Stupid stupid stupid.

This reverts commit 7a6d44ebfe.
2014-10-27 16:10:28 +00:00
Richard W.M. Jones
7a6d44ebfe p2v: Add usb-storage dracut module to allow boot from USB key (RHBZ#1157679).
I only added this to the virt-builder script, since one assumes that
livecd-creator/whatever should make the kickstart ISO bootable by
installing whatever drivers and modules are necessary.
2014-10-27 16:02:38 +00:00
Richard W.M. Jones
91788cd76f p2v: Add "Hardware Support" group to the P2V images (RHBZ#1157679).
Thanks: Chris Adams
2014-10-27 13:52:06 +00:00
Richard W.M. Jones
fab95a52bd p2v: Explain in the man page why the virt-p2v ISO is used. 2014-10-26 19:35:36 +00:00
Richard W.M. Jones
5862a4391d Version 1.29.2. 2014-10-25 17:56:45 +01:00
Richard W.M. Jones
09584a8bc6 sparsify: Add Utils module and use common error/warning/info functions.
This program needs quite a lot more work, in particular to make the
regular messages use 'make_message_function' instead of 'printf'.
2014-10-25 15:35:49 +01:00
Richard W.M. Jones
b01582623d resize: Tidy up messages.
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.
2014-10-25 15:28:58 +01:00
Richard W.M. Jones
6049fbdddb sysprep: Use common error/warning/info functions. 2014-10-25 15:13:27 +01:00
Richard W.M. Jones
7c9293fff0 v2v: Add Utils.warning and Utils.info that don't require ~prog parameter. 2014-10-25 15:06:08 +01:00
Richard W.M. Jones
f7664b7f76 customize: Add Customize_utils module and use common error/warning/info functions.
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.
2014-10-25 15:00:21 +01:00
Richard W.M. Jones
b99983480a builder: Add Utils module and use common error/warning/info functions.
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
2014-10-25 14:57:51 +01:00
Richard W.M. Jones
4ff6ba3550 test-tool: Handle mapping other architectures to qemu-system-* binaries. 2014-10-24 16:55:36 +01:00
Menanteau Guy
5018e00129 ppc64le: test-tool: Use correct qemu-system-ppc64 binary when creating qemu wrapper. 2014-10-24 16:51:02 +01:00
Richard W.M. Jones
a61d190ed3 ppc64le: configure: Look for qemu-system-ppc64 binary (RHBZ#1156449). 2014-10-24 14:40:57 +01:00
Richard W.M. Jones
62c84c6a55 inspector: Document that -a option can take a URI for remote storage (RHBZ#1156301). 2014-10-24 10:32:25 +01:00
Richard W.M. Jones
a5a0c2f3b0 bash-completion: Install symbolic links instead of copies of files (RHBZ#1156298). 2014-10-24 10:32:25 +01:00
Richard W.M. Jones
68ac0afc8d bash-completion: Replace 'ln -sf' commands with rm; $(LN_S). 2014-10-24 10:32:25 +01:00
Pino Toscano
46f9dd5290 configure: map also amd64 as host_cpu to x86_64 qemu 2014-10-23 19:03:12 +02:00
Pino Toscano
7fcac5f59f tests: switch from get_current_dir_name to getcwd(0, NULL)
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.
2014-10-23 19:03:12 +02:00
Pino Toscano
3784a42d03 customize, mllib: use the libvirt CFLAGS
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.
2014-10-23 19:03:12 +02:00
Pino Toscano
0a2534c4f1 actions: mark as IfNotCrossAppliance tests of command and command_lines
All these tests copy to the appliance a tool built on the host, and run
it.
2014-10-23 19:03:12 +02:00
Pino Toscano
349536bf70 tests/c-api: add a way to skip test when host and appliance differ
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.
2014-10-23 19:03:12 +02:00
Pino Toscano
3de9fa7ba9 build: use $(SED) instead of sed when possible
Make use of the sed executable set at configure time.
2014-10-23 19:03:12 +02:00
Pino Toscano
ea9b225480 Include stdint.h where needed
Required for using int64_t, etc. Apparently implicitly pulled so far.
2014-10-23 19:03:12 +02:00
Pino Toscano
abd93812ca tests: isolate iso_system_id baseline string
Move the reference iso_system_id for the isoinfo_device test to an own
define for Linux, with an error for unknown OSes.
2014-10-23 19:03:12 +02:00
Pino Toscano
d2c853f414 builder: rename "program_name" into "progname"
"program_name" is already used as shorthand define for
program_invocation_short_name.
2014-10-23 19:03:12 +02:00
Pino Toscano
57512e7785 normalize iconv handling
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.
2014-10-23 19:03:12 +02:00
Pino Toscano
b44bf21702 p2v: remove unused variable 2014-10-23 19:03:12 +02:00
Pino Toscano
471ed473cf fuse: test-fuse: enclose acl vars within HAVE_ACL
Enclose the acl-related variables within a #ifdef HAVE_ACL block, so
when building without acl support and -Werror it can build.
2014-10-23 19:03:12 +02:00
Pino Toscano
c1ad89170d build: look for and use sys/endian.h
Some OSes have sys/endian.h instead of glibc's endian.h.
2014-10-23 19:03:11 +02:00
Pino Toscano
b7d2226926 Include sys/wait.h where needed
Required for using WIFEXITED, WEXITSTATUS, etc. Apparently implicitly
pulled so far.
2014-10-23 19:03:11 +02:00
Pino Toscano
78b27cc0b6 Include string.h where needed
Required for using strlen, memcpy, etc. Apparently implicitly pulled so
far.
2014-10-23 19:03:11 +02:00
Pino Toscano
65f830b84c build: use the ptsname_r gnulib module
virt-p2v uses ptsname_r, which is not portable but implemented by
gnulib.
2014-10-23 19:03:11 +02:00
Richard W.M. Jones
fd70cdc3c5 ocaml: Pass -annot flag to compiler.
This generates .annot files that contain type information.
In emacs + tuareg mode, using C-c C-t displays the type of the
underlying expression.
2014-10-23 15:43:25 +01:00
Richard W.M. Jones
90dc8942bf ocaml: Factor out flags into configure script.
No change, just refactoring.
2014-10-23 15:41:49 +01:00
Richard W.M. Jones
fdaaa00513 Version 1.29.1. 2014-10-22 14:40:02 +01:00
Richard W.M. Jones
ad78d1492b v2v: -i libvirtxml: Fix handling of nbd sources (RHBZ#1153589).
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.
2014-10-22 12:46:08 +01:00
Richard W.M. Jones
dbe35729a3 v2v: Add some assertions to check the source was created correctly. 2014-10-22 12:45:14 +01:00
Richard W.M. Jones
e1eccae2da v2v: -i ova: Don't fail when given a relative path to an OVA directory (RHBZ#1155121). 2014-10-21 13:36:55 +01:00
Richard W.M. Jones
496d0c45bc v2v: vcenter: Hoist readahead configurables to top of file.
No change, just code motion.
2014-10-20 22:23:23 +01:00
Richard W.M. Jones
b8f826b7ac v2v: Inline and simplify Xen and vCenter input methods.
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.
2014-10-20 21:12:57 +01:00
Richard W.M. Jones
a468fde016 v2v: Refactor Xen and vCenter code.
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.
2014-10-20 20:36:06 +01:00
Richard W.M. Jones
9281dc7d44 v2v: vCenter: Adjust readahead parameter between conversion and copying phases (RHBZ#1151033) (RHBZ#1153589).
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.
2014-10-20 18:34:48 +01:00
Richard W.M. Jones
0084736f5f v2v: Add input#adjust_overlay_parameters method.
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.
2014-10-20 18:21:38 +01:00
Richard W.M. Jones
63387fd8d0 v2v: Add a unique number to source disks.
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.
2014-10-20 18:18:54 +01:00
Richard W.M. Jones
3596165282 v2v: -i libvirt: Refactor map_source* functions.
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.
2014-10-20 18:02:57 +01:00
Richard W.M. Jones
9596fc44ff v2v: -i libvirt: Create three specialized subclasses for handling vCenter/Xen/other.
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.
2014-10-20 17:37:04 +01:00
Richard W.M. Jones
9ddfbad814 v2v: Increase vCenter https timeout to 10 minutes. 2014-10-20 14:05:10 +01:00
Richard W.M. Jones
0b49defc2b appliance: Set udev.event-timeout to override default too low udev setting.
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.
2014-10-20 14:05:00 +01:00
Pino Toscano
3276845df1 diff: do not pad uid/gid in CSV mode 2014-10-20 10:06:25 +01:00
Pino Toscano
87941d183f cat, diff: avoid double slashes in paths (RHBZ#1151910).
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.
2014-10-20 10:05:45 +01:00
Pino Toscano
e5befcacc5 ls: in CSV mode, always have a checksum field (RHBZ#1151900).
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.
2014-10-20 10:01:52 +01:00
Richard W.M. Jones
9019c4eb06 v2v: -i ova: Add a test for *.vmdk.gz compressed files (RHBZ#1152998). 2014-10-18 21:57:54 +01:00
Richard W.M. Jones
f27a582b6d v2v: -i ova: Add a test for ZIP as a container (RHBZ#1152998). 2014-10-18 21:57:53 +01:00
Richard W.M. Jones
ede39a7591 v2v: Handle *.vmdk.gz compressed files (RHBZ#1152998).
The OVA spec allows the disk images to be gzipped within the OVA
container.
2014-10-18 21:57:46 +01:00
Richard W.M. Jones
60405e5aa1 v2v: -i ova: Allow directories and ZIP files to be used as input (RHBZ#1152998).
OVA is not a particularly well-specified format.  The specification
allows a directory to be an OVA, so enable that.  The spec doesn't
mention that ZIP can be used in place of tar, but since we have seen
these in the wild, allow that too.
2014-10-18 21:45:56 +01:00
Richard W.M. Jones
d8e26d0e4d mllib: Enhance and rename 'detect_compression' function so it can detect a few more file types. 2014-10-18 19:01:44 +01:00
Richard W.M. Jones
a7a5a223d4 v2v: Change --help text URLs so they don't reference esx as main server. 2014-10-18 13:53:19 +01:00
Richard W.M. Jones
1f97a5df76 p2v: Test did not recognize '1.XX.0' as a valid version number.
Thus breaking when we changed the version number to 1.28.0.
2014-10-18 10:27:23 +01:00
Richard W.M. Jones
cbad8e6d51 Version 1.29.0. 2014-10-18 09:45:04 +01:00
Richard W.M. Jones
305f0050eb Version 1.28.0. 2014-10-18 09:26:37 +01:00
Richard W.M. Jones
3b3b507a1e Update translations from Transifex. 2014-10-18 09:12:27 +01:00
Richard W.M. Jones
d57660d5d6 Update release notes for 1.28 release. 2014-10-18 09:12:24 +01:00
Richard W.M. Jones
d3548012e9 Update API support for 1.28 release. 2014-10-18 09:12:03 +01:00
Richard W.M. Jones
6e5039d1ef Version 1.27.64. 2014-10-17 17:38:07 +01:00
Richard W.M. Jones
288bc73bb0 v2v: Add test files to EXTRA_DIST.
This fixes commit 852f2e8e3c.
2014-10-17 17:37:37 +01:00
Richard W.M. Jones
97c96ed670 v2v: Windows: Add &REV_00 variant, which is used by W2K8R2. 2014-10-17 17:18:25 +01:00
Richard W.M. Jones
4f6033c3f4 v2v: Windows: Fix quoting and type of viostor ImagePath parameter.
The way to fix these bugs -- for future reference -- is as follows:

(1) Install the corresponnding Windows version with virtio enabled.
See:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Deployment_and_Administration_Guide/chap-KVM_Para_virtualized_virtio_Drivers.html

(the ".vfd" method)

(2) Download the SYSTEM and SOFTWARE registries from the
virtio-enabled guest.

(3) Examine each registry using 'hivexsh', especially the keys which
we modify during virt-v2v (see v2v/convert_windows.ml).  Remember to
use both the 'ls' and 'lsval' commands in hivexsh.

(4) Download the SYSTEM and SOFTWARE registries from the guest that
fails to boot.

(5) Examine the same registry keys from each registry using 'hivexsh'.

(6) Work out what the differences are, paying particular attention to
quoting and the type of each key (eg. str(1), str(2), etc).

Thanks: Matthew Booth.
2014-10-17 17:14:52 +01:00
Richard W.M. Jones
ca6d7d9c34 v2v: Print version of virt-v2v in debug output.
Easier than asking users to send us this information, which they often don't.
2014-10-17 13:44:35 +01:00
Richard W.M. Jones
e2e1705574 v2v: Add new section on resource requirements of virt-v2v to the manual. 2014-10-16 18:02:46 +01:00
Richard W.M. Jones
852f2e8e3c tests: v2v: Test -i ova with two input disks. 2014-10-16 16:00:34 +01:00
Richard W.M. Jones
d8849fadbd v2v: -i ova: Fix it so it actually verifies SHA-1 hashes from manifest files.
There were two large bugs before: (1) It only found one manifest file
(meaning that multi-volume OVAs would be broken).  (2) The regular
expression didn't work so it wouldn't check the hash.  Bugs (1) + (2)
combined so that the check just didn't do anything at all, which is
why we didn't notice the multi-volume problem.

Actually I suspect we shouldn't be doing this check at all, since I
bet there are OVAs out there with broken SHA-1's.
2014-10-16 16:00:34 +01:00
Richard W.M. Jones
249aae0c2f handle: Process empty LIBGUESTFS_* environment variables correctly (RHBZ#1153515).
Ignore an environment variable:

 - if an environment variable is an empty string, AND

 - if an empty string would have no meaning for that environment
   variable (eg. LIBGUESTFS_BACKEND can only take on certain values,
   and an empty string is not one of them).

Note that LIBGUESTFS_BACKEND_SETTINGS is meaningful as an empty
string, and for this case I have removed the STRNEQ (str, "") test.

Previously:

$ LIBGUESTFS_BACKEND="" guestfish -a /dev/null run
libguestfs: error: invalid backend:

After this commit:

$ LIBGUESTFS_BACKEND="" guestfish -a /dev/null run

(no error message is printed)
2014-10-16 08:49:57 +02:00
Richard W.M. Jones
93c2769e2b Version 1.27.63. 2014-10-15 22:19:19 +02:00
Richard W.M. Jones
4511137c05 tests: v2v: Check -i ova generates the same XML each time. 2014-10-15 21:51:29 +02:00
Richard W.M. Jones
717c73d22b v2v: -i ova: Try hard to preserve the order of floppies and CDROMs from the original OVF.
Remove the common 'add_resource' function.

Duplicate that function into code for adding disks, and separate code
for adding removables (floppies & CDROMs).

The removables code should look for all removable devices
(ResourceType 14, 15, 16) in a single query, so that the order doesn't
depend on the order in which we do the queries.
2014-10-15 21:43:42 +02:00
Richard W.M. Jones
59015939ab v2v: -i ova: Preserve the order of disks/removable/NICs from the source OVF.
Because we built the lists up backwards, we ought to reverse them
before passing them out of the module.
2014-10-15 21:04:33 +02:00
Richard W.M. Jones
516a95824a v2v: -i ova: Mainly whitespace and formatting changes.
Mainly tidy up the indentation and comments to match the "house
style".  No significant functional change.
2014-10-15 21:03:18 +02:00
Pino Toscano
94f2eb8b26 bash: add virt-log completion entry (RHBZ#1151766).
Thanks: Lingfei Kong
2014-10-13 15:06:30 +02:00
Richard W.M. Jones
88a482dd9f v2v: Add 'exit' choice to --root ask.
If the user does ^C then this leaves temporary overlay files around
(possibly a bug?).  Offer an 'exit' choice to the user which exits
cleanly.

The new message looks like this:

  Dual- or multi-boot operating system detected.  Choose the root filesystem
  that contains the main operating system from the list below:

   [1] /dev/sda3 (Fedora release 20 (Heisenbug))
   [2] /dev/sdb3

  Enter a number between 1 and 2, or 'exit': exit
2014-10-13 13:12:27 +02:00
Richard W.M. Jones
04de9d3df0 v2v: When choosing a root from several, print an info message. 2014-10-13 11:42:44 +02:00
Richard W.M. Jones
2ba45489a1 v2v: Add an 'info' function for info messages, and use it for virtio message. 2014-10-13 11:42:44 +02:00
Richard W.M. Jones
2b4ba9d692 v2v: --root ask: Number the guests in the list correctly.
Thanks: Junqin Zhou
2014-10-13 11:42:44 +02:00
Pino Toscano
145a188f70 edit: fix --format documentation (RHBZ#1151738).
Use only --format=FMT as a way to specify a format, as the version
without the equal sign will not work for that.
2014-10-13 11:02:14 +02:00
Richard W.M. Jones
e372225229 Version 1.27.62. 2014-10-10 16:58:48 +01:00
Pino Toscano
5c7cb0ac7c builder: use the JSON module
Switch to the JSON OCaml module for JSON output.

The resulting output is the same, except from an indentation level more
within lists.
2014-10-10 17:08:56 +02:00
Pino Toscano
901de75ff4 mllib: improve JSON: more types, indented output style
Improve the homebrew JSON writer:
- add more types (including also nested dictionaries and lists)
- format in a compact way (single line), or indented (multilines)
2014-10-10 17:08:56 +02:00
Pino Toscano
bb0d7edfa0 Move JSON to mllib
Move the simple OCaml JSON writer to mllib, so that can be enhanced and
used also outside v2v.
2014-10-10 15:10:20 +02:00
Pino Toscano
75b45143f0 appliance: remove few duplicates from Mageia's list 2014-10-10 15:09:27 +02:00
Richard W.M. Jones
7893a2cfb1 FAQ: Add a section on debugging libvirtd. 2014-10-10 11:47:26 +01:00
Richard W.M. Jones
6328038567 v2v: Rename some modules to remove lib_ prefix.
v2v/lib_ovf.ml -> v2v/OVF.ml
v2v/lib_ovf.mli -> v2v/OVF.mli
v2v/lib_linux.ml -> v2v/linux.ml
v2v/lib_linux.mli -> v2v/linux.mli
v2v/lib_esx.ml -> v2v/vCenter.ml
v2v/lib_esx.mli -> v2v/vCenter.mli
v2v/lib_xen.ml -> v2v/xen.ml
v2v/lib_xen.mli -> v2v/xen.mli
2014-10-09 18:09:49 +01:00
Richard W.M. Jones
88a381b2a0 v2v: Increase readahead window for vCenter transfers (RHBZ#1151033). 2014-10-09 16:04:36 +01:00
Pino Toscano
8f3a2ca535 appliance: add dhcp-client on Mageia
dhcp-client replaces the non-existing dhclient.
2014-10-09 14:53:53 +02:00
Pino Toscano
979e7a4914 appliance: add dhcpcd and gptfdisk on Archlinux
dhcpcd replaces the non-existing dhclient.
2014-10-09 14:53:10 +02:00
Richard W.M. Jones
e21a4e5a90 Version 1.27.61. 2014-10-09 10:30:01 +01:00
Richard W.M. Jones
626d85d80b v2v: -i libvirt/libvirtxml: Give a better warning for local displays (RHBZ#1150880). 2014-10-09 10:15:55 +01:00
Richard W.M. Jones
4d4cada65a daemon: copy-file-to-file: Unlink destination file on failure (RHBZ#1150867).
When copying from file to file, don't leave the destination file
around if the copy fails.

However in the same code don't try unlinking the destination device on
failure.
2014-10-09 09:34:11 +01:00
Richard W.M. Jones
fbbcc6c629 sparsify: Fix documentation of --check-tmpdir option (RHBZ#1150858). 2014-10-09 09:29:31 +01:00
Richard W.M. Jones
9d6efb4966 diff: Remove copy and paste mistake from the documentation (RHBZ#1150815).
Originated from copying this section out of the virt-ls man page.
2014-10-09 09:21:06 +01:00
Richard W.M. Jones
f8f6250612 v2v: Allow -b/-n as alias for --bridge/--network.
This was permitted by old virt-v2v too.
2014-10-08 22:32:03 +01:00
Richard W.M. Jones
e66138fbe7 v2v: Enable trimming of data disks and non-mountpoints (RHBZ#1150701).
This also modifies the --no-trim option so you can specify a device
name, since this is necessary if fstrim can apply to non-mountpoints.
2014-10-08 21:17:43 +01:00
Richard W.M. Jones
69fe3945b7 v2v: Fix the --no-trim option so it works.
We never updated the no_trim variable in the case where this option
was supplied, so it never did anything, proving once again that unless
you have a test case, the feature won't work.
2014-10-08 21:16:48 +01:00
Richard W.M. Jones
36ce0e65f6 v2v: Print virtual and real copying rates.
Useful to diagnose speed issues in the qemu block drivers.
2014-10-08 20:21:36 +01:00
Richard W.M. Jones
7b8ed81560 v2v: Print mountpoint stats in debugging output.
Useful for debugging speed / fstrim issues.
2014-10-08 20:21:06 +01:00
Richard W.M. Jones
1e9b707e9b Version 1.27.60. 2014-10-08 15:44:01 +01:00
Richard W.M. Jones
6d0f46bacb v2v: Add README.RHEV-M to EXTRA_DIST.
This fixes commit 8adc32cae8.
2014-10-08 15:41:44 +01:00
Richard W.M. Jones
c4bad9deaf v2v: -o rhev, -o vdsm: Fix export with multiple disks (RHBZ#1150475).
When translating the original virt-v2v code, I misunderstood how image
directories are created.  There is one directory under images/ per
disk image, not one for all the disks in a single guest.

Note this requires that -o vdsm uses multiple --vdsm-image-uuid
options, one per disk image of the guest.

Reported by: Alain Vondra
Thanks: Tingting Zheng
2014-10-08 15:19:48 +01:00
Richard W.M. Jones
43e150c212 mllib: Add 'combine3' function. 2014-10-08 15:19:48 +01:00
Richard W.M. Jones
8adc32cae8 v2v: Add notes about layout of Export Storage Domain for multi-disk guests. 2014-10-08 15:19:48 +01:00
Pino Toscano
2de1602b70 log: tests: switch to a temporary file for outputs
Using a pipe to redirect the output of virt-log will lose his return
value, so use a temporary file to collect the virt-log output.
2014-10-08 13:53:38 +02:00
Richard W.M. Jones
371744bc59 Revert "log: tests: fix appending the virt-log output"
This reverts commit cfe2daabb2.

The pipe hides the return code from virt-log or valgrind.
2014-10-08 12:40:32 +01:00
Richard W.M. Jones
7c97b01f27 v2v: Add missing disk <rasd:Caption>.
Possible fix for RHBZ#1150475.
2014-10-08 12:38:56 +01:00
Pino Toscano
cfe2daabb2 log: tests: fix appending the virt-log output
virt-log uses /dev/stdout as output file for guestfs_download, which
will open the output file in truncate mode, truncating the output of
test-virt-log.sh.

Make sure to redirect the output of virt-log so it does not clobber the
test output.

Thanks to Richard for the hint.
2014-10-08 11:14:28 +02:00
Richard W.M. Jones
aa42bcf54d Version 1.27.59. 2014-10-07 15:30:28 +01:00
Richard W.M. Jones
fd421ebf88 p2v: Fix virt-p2v-make-kickstart so it won't fail when using a custom repo.
Because of `set -e', using the `((i++))' expression causes bash to
fail, unless we tell it to ignore the error code on that line.
2014-10-07 15:30:27 +01:00
Richard W.M. Jones
b81256581b Update API support. 2014-10-07 15:04:43 +01:00
Richard W.M. Jones
a97b3b6ae4 Update gnulib to latest upstream. 2014-10-07 13:54:50 +01:00
Richard W.M. Jones
09384e8164 Update translations from Transifex. 2014-10-07 13:34:16 +01:00
Richard W.M. Jones
6e204f6ccc Update BUGS. 2014-10-07 13:34:16 +01:00
Richard W.M. Jones
8ddae163e4 Update release notes. 2014-10-07 13:34:16 +01:00
Richard W.M. Jones
a48ade569d v2v: Further documentation fixes.
Replace more instances of 'esx.example.com' with
'vcenter.example.com', and rearrange command line arguments
semantically.
2014-10-07 12:40:41 +01:00
Richard W.M. Jones
f796435628 FAQ: Need to set SUPERMIN_KERNEL_VERSION in recent supermin. 2014-10-07 10:17:33 +01:00
Richard W.M. Jones
0f023a080b v2v: Improve VMware import documentation.
Additional information about URIs, which may contain cluster and/or
folder names (thanks: James Mighion).

Replace esx.example.com with vcenter.example.com to reduce confusion
about vCenter vs ESXi.
2014-10-07 09:28:25 +01:00
Pino Toscano
c92734b209 log: tests: skip fedora.img if journal is not available 2014-10-06 18:05:53 +02:00
Pino Toscano
cb1b7cbdd5 tools: fix free -m invocation
Since procps 3.3.10, free does not output the "-/+ buffers/cache" line
anymore. On the other hand, the data from it can be calculated from the
memory values, so just do the calculation manually (with awk).
2014-10-06 16:10:44 +02:00
Richard W.M. Jones
c4bc416820 lib: Enable detection of ARM (32 bit).
This includes some empty binaries to use for detection testing.
2014-10-06 13:17:35 +01:00
Richard W.M. Jones
07f87a7c91 lib: Document output of 'file-architecture' API for aarch64 binaries. 2014-10-06 13:09:46 +01:00
Pino Toscano
56cfb8a926 sysprep: remove more logs
- remove firewalld, grubby, and proftpd logs
- extend the cups log removal also to its timestamped rotated logs
- remove also the libvirt/libxl logs
2014-10-03 14:24:48 +02:00
Richard W.M. Jones
0823416925 tests: Fix SKIP_ environment variable in a couple of scripts.
I checked and bug 690819 has nothing to do with either of these
tests.  It was just a copy and paste error.
2014-10-02 17:02:21 +01:00
Richard W.M. Jones
7ff5d51815 Version 1.27.58. 2014-10-02 15:55:51 +01:00
Richard W.M. Jones
4323907575 tests: Disable UML tests in 'check-release'.
This effectively demotes UML to unsupported status.  This has happened
because UML has regressed quite a lot upstream.  There are multiple
grave bugs revealed by running the test suite and I don't have the
inclination to fix them.
2014-10-02 15:31:50 +01:00
Richard W.M. Jones
765dc6237c tests: rsync: Skip this test when the backend is libvirt.
It would work, except if you have a host firewall which will block
inbound connections on virbr0 to non-standard ports.
2014-10-02 15:31:50 +01:00
Richard W.M. Jones
07c0926b58 appliance: Change example ping lines to ping 8.8.8.8.
This are commented out (still) so this change does nothing.
2014-10-02 15:31:50 +01:00
Richard W.M. Jones
224de20b9a launch: libvirt: Use qemu-bridge-helper to implement a full network (RHBZ#1148012).
When using the libvirt backend, don't use the SLIRP.  Use
qemu-bridge-helper via libvirt to give us a full network connection.

One consequence of this is that 'ping' works in
'virt-builder --run-command'.

A less useful consequence is that the host firewall will prevent
connections on non-standard ports to the host.  So you can't (eg)
connect to a rsync daemon on the host listening on an arbitrary port,
which worked before.

The default bridge is 'virbr0', but you can override this by setting
LIBGUESTFS_BACKEND_SETTINGS=network_bridge=<some_bridge>

Note: this does not fix virt-rescue (since it overrides the default
backend and uses 'direct' for various reasons).
2014-10-02 15:31:50 +01:00
Richard W.M. Jones
67e6f32a24 appliance: Use dhclient or dhcpcd instead of hard-coding IP address of appliance.
qemu in SLIRP mode offers DHCP services to the appliance.  We don't
use them, but use a fixed IP address intead.  This changes the
appliance to get its IP address using DHCP.

Note: This is only used when the network is enabled.  dhclient is
somewhat slower, but the penalty (a few seconds) is only paid for
network users.

On SuSE or other distros, dhcpcd could be used if available.
2014-10-02 15:31:49 +01:00
Richard W.M. Jones
9018a23828 mllib: Coloured messages, errors, warnings.
Uses ANSI terminal codes to colour the output.
2014-10-02 15:31:49 +01:00
Richard W.M. Jones
25274b4f75 v2v: Print the difference between our disk size estimate and actual size. 2014-10-02 13:51:49 +01:00
Richard W.M. Jones
ae19e8f29f v2v: 'du -b' doesn't show real (sparse) size.
This caused the actual size to be wrong (in OVF output).
Use --block-size=1 instead.
2014-10-02 13:51:49 +01:00
Richard W.M. Jones
62159d5d48 Version 1.27.57. 2014-10-01 16:49:57 +01:00
Richard W.M. Jones
f23759c330 v2v: Copy post-conversion tasks section from old virt-v2v documentation.
Copied verbatim, apart from some minor reformatting.
2014-10-01 13:40:54 +01:00
Richard W.M. Jones
d0110a4e23 v2v: Copy -o rhev information from old virt-v2v manual page. 2014-10-01 13:36:47 +01:00
Richard W.M. Jones
886c566756 lib: Avoid rewriting LV names when creating canonical device name (RHBZ#1148355).
Thanks: Timothée Ravier
2014-10-01 12:11:50 +01:00
Richard W.M. Jones
c9c65e08eb v2v: Add note to man page about removing VMware tools before conversion.
Thanks: Matthew Booth.
2014-10-01 10:07:50 +01:00
Pino Toscano
d39744a030 sysprep: add no-op --no-selinux-relabel (RHBZ#1148072)
Add a no-op --no-selinux-relabel option, to be compatible with
virt-sysprep < 1.26.
2014-10-01 10:12:38 +02:00
Richard W.M. Jones
011b5da6f5 p2v: Fix reference to virt-v2v(1) in manual page. 2014-09-30 13:28:31 +01:00
Richard W.M. Jones
7357dcd878 resize: Don't test MBR extended partitions while virt-resize handling is broken.
The intention is to fix virt-resize and then revert this commit.
2014-09-30 13:25:25 +01:00
Richard W.M. Jones
6f196df414 resize: Rewrite the tests to use a stochastic testing method.
The previous tests were very limited, and ran the same two tests
on every run.

Randomly test:
 - MBR vs GPT
 - Primary, extended partitions
 - Expanding vs shrinking
 - Use of multiple --resize parameters
 - Source and target raw vs qcow2 formats
 - Resizing various different filesystem types
 - LV expand
 - extra partition or no extra partition

To run the test over and over again (useful for finding regressions in
virt-resize), do:

  while (cd resize; LIBGUESTFS_TRACE=1 ../run ./test-virt-resize.pl) >&/tmp/log ; do echo -n .; done

If it fails, you can see the failure in /tmp/log.

To rerun a specific test, search for the 'seed:' in the output of the
original test, and specify it on the command line:

  (cd resize; ../run ./test-virt-resize.pl --seed=<SEED>)
2014-09-30 13:25:25 +01:00
Pino Toscano
225257b67a inspect: document also MINIX as OS
Followup of commit 5b65d05d5a.
2014-09-30 13:51:16 +02:00
Richard W.M. Jones
23d4cec345 Version 1.27.56. 2014-09-29 16:20:04 +01:00
Richard W.M. Jones
42775561aa v2v: Add v2v/HACKING file to EXTRA_DIST.
This updates commit ce814c6b6c.
2014-09-29 16:20:03 +01:00
Richard W.M. Jones
6495b07cc0 resize: docs: --expand is above, not below, the current point. 2014-09-29 14:49:34 +01:00
Richard W.M. Jones
a0dad3621f resize: Using qemu-img create -c doesn't create a compressed qcow2 file.
Remove inaccuracy from the manual page.
2014-09-29 14:49:34 +01:00
Pino Toscano
35daabed8f customize: fix attributes of /etc/shadow (RHBZ#1146275)
When saving a configuration file, Augeas creates a new file and
replaces the old one with it; this creates a /etc/shadow file without
the SELinux xattrs, since they are missing.

Thus, create a temporary file with all the attributes of /etc/shadow, so
all the attributes of it (permissions and xattrs, among others) can be
restored properly on the new /etc/shadow.

As side effect, if a guest is already properly SELinux-labelled, then
there should be no more need to relabel it to make sure /etc/shadow
still has the right SELinux xattrs.
2014-09-29 14:19:23 +02:00
Pino Toscano
5f9437ca4b builder, customize: disable SELinux
Having SELinux enabled (even if not enforcing) in the appliance causes
troubles to applications/libraries that read/write SELinux attributes.
2014-09-29 14:19:23 +02:00
Richard W.M. Jones
49ee9a2133 resize: Simplify if-conditional in mbr_part_type function.
This should be equivalent to the previous code, but it makes it easier
for the compiler to pick up errors (eg. missing cases).

This updates commit fc34e2d16c.
2014-09-29 12:16:55 +01:00
Hu Tao
fc34e2d16c resize: add function mbr_part_type
Function mbr_part_type returns one of "primary", "extended" and
"logical". The type is used by parted when adding partitions.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-29 12:05:33 +01:00
Richard W.M. Jones
80bd9082b5 resize: Fix whitespace in calculate_target_partitions function.
This updates commit 21677c5b46.
2014-09-29 12:04:32 +01:00
Hu Tao
21677c5b46 resize: add function calculate_target_partitions
And introduce parameter create_surplus to indicate whether to
create surplus partition or not. Later this parameter will be
used by when calculating positions for target logical partitions.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-29 12:03:19 +01:00
Hu Tao
5aa7e99cb9 resize: add function find_partitions
find_partitions can find partitions of given type.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-29 12:03:18 +01:00
Pino Toscano
cbb54a3849 diff: flatten also atime nanoseconds
When not considering atime changes, flatten also the nanoseconds.

Followup of commit 8664337cc3.
2014-09-29 11:18:56 +02:00
Richard W.M. Jones
bdbe2f42ae v2v: Document when you need to run virt-v2v as root, and how to avoid it. 2014-09-28 21:18:55 +01:00
Richard W.M. Jones
ca71b7c169 v2v: Use Glance (capitalized) consistently in documentation. 2014-09-28 21:13:12 +01:00
Richard W.M. Jones
5be7263760 p2v: docs: Change boilerplate in description to reflect reality of hypervisors we support (continued). 2014-09-27 22:28:53 +01:00
Richard W.M. Jones
e5fcb6e5db p2v: Fix documentation for p2v.of kernel command line option.
Copy and paste errors.
2014-09-27 21:51:22 +01:00
Richard W.M. Jones
ae8b283038 p2v: Revise virt-p2v(1) manual page. 2014-09-27 21:21:57 +01:00
Richard W.M. Jones
b8130786bd p2v: Use "panel" consistently through documentation. 2014-09-27 19:35:55 +01:00
Richard W.M. Jones
4456d64e8f p2v, v2v: docs: Change boilerplate in description to reflect reality of hypervisors we support. 2014-09-27 19:35:13 +01:00
Richard W.M. Jones
2ae0e32da6 p2v: Document the virt-p2v GUI dialogs. 2014-09-27 18:39:48 +01:00
Richard W.M. Jones
c9f2e4e7f1 p2v: Rename guest.xml -> physical.xml. 2014-09-27 17:11:51 +01:00
Richard W.M. Jones
ce814c6b6c p2v, v2v: Document how it works for hackers. 2014-09-27 17:10:15 +01:00
Richard W.M. Jones
4c1ca9f880 Fix update-bugs.sh script so it doesn't write an empty BUGS file. 2014-09-26 20:09:44 +01:00
Richard W.M. Jones
5498d021d0 v2v: Don't warn about being unable to rewrite /dev/cdrom (RHBZ#1146815).
Old virt-v2v probably emitted the same warning.

However it seems unlikely that /dev/cdrom needs to be remapped, as
udev or the user should be able to supply a suitable symlink from
/dev/cdrom to the removable device.  Therefore suppress this warning.
2014-09-26 19:30:57 +01:00
Richard W.M. Jones
b03c2a971a v2v: Generate qemu-0.10 compatible qcow2 files for RHEV-M.
RHEV nodes running on RHEL 6 cannot read the new qcow2 compat=1.1
(a.k.a qcow2 v3) format.

Thanks: Junqin Zhou, Tingting Zheng
2014-09-26 19:26:14 +01:00
Richard W.M. Jones
159d246b1d v2v: Add documentation for diagnosing RHEV-M import problems. 2014-09-26 19:14:57 +01:00
Richard W.M. Jones
7ebab44793 Version 1.27.55. 2014-09-26 17:14:19 +01:00
Richard W.M. Jones
dc6bba8338 v2v: -o qemu: Add a display to the shell script. 2014-09-26 14:11:10 +01:00
Richard W.M. Jones
f7cd8b4d10 v2v: -o qemu: Only add a serial console to Linux guests.
Makes no sense for Windows guests.
2014-09-26 14:11:10 +01:00
Richard W.M. Jones
630ab4c22a v2v: -o qemu: Refactor end of line handling. 2014-09-26 14:11:10 +01:00
Richard W.M. Jones
2365c2dbcc v2v: Add a source 'window' display type.
This maps to SDL/GTK, ie. qemu opening a window on the desktop.
We only use it for -i disk -o qemu to help with debugging.
2014-09-26 14:11:10 +01:00
Richard W.M. Jones
ea015319b0 v2v: Add --no-trim option, allowing fstrim to be suppressed.
Mainly useful for testing whether fstrim is responsible for various
unexplained boot failures.  We can also suggest it in the field.
2014-09-26 14:11:10 +01:00
Pino Toscano
ad300fcd5e fuse: test-fuse: use acl_to_any_text
Switch from acl_to_text to acl_to_any_text, so it is possible to specify
options, like forcing the numeric IDs for users/groups. This ensure the
resulting string has always numberic IDs, so the comparison can always
succeed.

Adapt the comparison string to the lack of final endline now.
2014-09-26 14:32:32 +02:00
Richard W.M. Jones
0db22ee7a7 v2v: windows: Sort files before uploading.
This makes it easier to compare the trace output from different runs
of virt-v2v.
2014-09-26 10:22:12 +01:00
Richard W.M. Jones
03ef91aa46 v2v: Add --debug-overlays option.
You can use this to accelerate testing:

  $ virt-v2v --no-copy --debug-overlays [etc]
  [...]
  [  82.0] Converting Windows 7 Ultimate to run on KVM
  This guest has virtio drivers installed.
  [  86.0] Closing the overlay
  [  91.0] Creating output metadata
  Overlay saved as /var/tmp/win7-test-sda.qcow2 [--debug-overlays]
  [  91.0] Finishing off

No disk format conversion/copying is done, so it's very fast.

The overlay file is preserved and can be tested directly (it uses the
source file as backing).
2014-09-26 10:20:57 +01:00
Richard W.M. Jones
dbff48de39 v2v: Don't use Unix.unlink since Unix module is open in this file.
Minor code refactor.
2014-09-26 10:05:30 +01:00
Richard W.M. Jones
35634e20e7 v2v: Disable extended debugging of hivex_open.
It's not really necessary: we have never needed this for debugging
inspection for example, and if hive open failures did occur we would
ask the user to send us the hive files.  And it causes huge amounts of
debugging messages to be printed which fills up the log.
2014-09-25 17:35:02 +01:00
Richard W.M. Jones
9a9d10d2a0 v2v: Put overlay on LIBGUESTFS_CACHEDIR, not /tmp (RHBZ#1146017).
Since the overlay could grow very large (because of copy-on-read) it
is not suitable for /tmp.
2014-09-25 14:30:37 +01:00
Richard W.M. Jones
401ee58ae1 v2v: windows: Print product variant in virtio drivers warning message.
The inspection product variant field is used to determine which
drivers to install, so print it in case we couldn't find any drivers.
2014-09-24 23:48:02 +01:00
Richard W.M. Jones
df77553f4e v2v: windows: Rearrange the order of virtio drivers match clause.
No functional change.
2014-09-24 23:44:19 +01:00
Richard W.M. Jones
fc56757d39 Version 1.27.54. 2014-09-24 19:03:42 +01:00
Richard W.M. Jones
f6e40498a9 v2v: windows: Give a better message when Fast Restart is found (RHBZ#1145995).
Thanks: Tingting Zheng
2014-09-24 18:30:00 +01:00
Richard W.M. Jones
4cc0677da7 v2v: Failure to mount the root partition is a hard error.
For other partitions, it is a warning.
2014-09-24 18:30:00 +01:00
Richard W.M. Jones
0ba0692fda v2v: Update list of virtio-win drivers to latest (RHBZ#1145908).
Update with latest list from:
- virtio-win-1.7.2-1.el7.noarch
- https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
2014-09-24 18:30:00 +01:00
Richard W.M. Jones
97b96af54c v2v: windows: Set filename correctly when uploading virtio drivers (RHBZ#1145916).
Thanks: Jeff Forbes, Alain Vondra, Junqin Zhou
2014-09-24 18:29:59 +01:00
Richard W.M. Jones
e1407b3690 v2v: tests: Don't care about the <model> XML when testing network and bridge mapping. 2014-09-24 18:29:59 +01:00
Richard W.M. Jones
7806e8667b tests: Add drivers directory to phony Windows image.
Allows virt-v2v to upload drivers.
2014-09-24 17:59:28 +01:00
Richard W.M. Jones
6e9dd6752f v2v: Remap device in /etc/sysconfig/grub boot= entry.
Old virt-v2v did not remap this device, so after conversion from Xen
the file would have something like:

  boot=/dev/xvda

Although this does not appear to affect anything, better to remap it.
2014-09-23 22:16:24 +01:00
Richard W.M. Jones
79501d1a55 Version 1.27.53. 2014-09-23 16:54:26 +01:00
Hu Tao
8e0ae6560e syntax-check: fix prohibit_getopt_without_use check
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-23 16:38:13 +01:00
Hu Tao
21e2b29e60 syntax-check: fix prohibit_dirent_without_use check
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-23 16:36:46 +01:00
Hu Tao
54c95ed332 syntax-check: fix prohibit_c_ctype_without_use check
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-23 16:36:40 +01:00
Hu Tao
dfa9efce4b syntax-check: fix prohibit_assert_without_use check
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-23 16:36:28 +01:00
Richard W.M. Jones
c9fdfe021c v2v: -o rhev: chmod the image so we will definitely be able to write to it.
NFS sucks.
2014-09-23 15:47:24 +01:00
Richard W.M. Jones
0f4044b58f v2v: -o rhev: On failure path, use forking wrapper to clean up images dir.
Otherwise you get lots of errors like:

rm: cannot remove ‘/var/tmp/mm/42f5e571-21af-44bd-8164-3ebe6bbc9f5a/images/7b28b0e6-79ce-4d78-a6cb-769760a3d373/31e2b06b-85cb-46ed-aac3-8bcef93dc704.meta’: Permission denied
rm: cannot remove ‘/var/tmp/mm/42f5e571-21af-44bd-8164-3ebe6bbc9f5a/images/7b28b0e6-79ce-4d78-a6cb-769760a3d373/31e2b06b-85cb-46ed-aac3-8bcef93dc704’: Permission denied

because the code is running as root.
2014-09-23 15:47:24 +01:00
Richard W.M. Jones
06b04e5676 v2v: -o rhev: Use a random name when testing UID:GID mapping.
Using a fixed name is risky if there are multiple parallel virt-v2v
processes running.
2014-09-23 15:47:24 +01:00
Richard W.M. Jones
ebb5de6a1f v2v: -o rhev/vdsm: Remove the test that the storage domain is writable.
For '-o rhev' this is likely to fail (although for obscure reasons it
*doesn't* fail on a real RHEV server, I don't quite understand why).
The reason is because virt-v2v may be running as root, and with root
squashing we don't have permissions to write into the storage domain
directory.

For '-o vdsm', VDSM is supposed to make sure we are running as the
correct user, so there's no reason to doubt things will work.
2014-09-23 15:47:24 +01:00
Richard W.M. Jones
44e523d9cb valgrind: Add suppression for another libvirt/selinux leak. 2014-09-23 15:47:24 +01:00
Richard W.M. Jones
02c220a6f1 v2v: Disable valgrind tests that are confused by -o rhev forking.
This updates commit 0dfa96c043.
2014-09-23 15:47:23 +01:00
Richard W.M. Jones
d1145f20cb v2v: Add -o qemu output mode and --qemu-boot flag.
This lets you write a shell script that runs the guest under qemu.
Specifying the --qemu-boot flag also boots the guest after conversion.
2014-09-23 15:47:23 +01:00
Richard W.M. Jones
91c1f58e21 v2v: docs: Change examples so -i input comes before -o options.
Make the input/output ordering of command line arguments clearer by
changing:

 virt-v2v -i disk -o local -os /var/tmp disk.img

to:

 virt-v2v -i disk disk.img -o local -os /var/tmp
2014-09-23 15:47:23 +01:00
Pino Toscano
8cb30d1027 configure: switch from "java-default-runtime" to "default"
Archlinux switched to "default" as directory for the default JDK
version.
2014-09-23 15:03:55 +02:00
Pino Toscano
316c91c140 inspect: map Hurd devices, and enable fstab introspection
Add a mapping for the Hurd device names, so it is possible to enable the
inspection of /etc/fstab.
2014-09-23 15:01:53 +02:00
Pino Toscano
5b65d05d5a inspect: basic Minix support
Add a basic support for identifying Minix, extracting its version and
hostname.

Related to RHBZ#1144137.
2014-09-23 10:13:50 +02:00
Richard W.M. Jones
0035a57dd1 Version 1.27.52. 2014-09-22 22:41:33 +01:00
Richard W.M. Jones
0dfa96c043 v2v: -o rhev: Write files and directories as user:group 36:36 (RHBZ#1143887).
We need to write files and directories as user:group 36:36, else
RHEV-M cannot import the VM.  Doing this in the presence of NFS is
difficult.  See v2v/kvmuid.mli for how it is done in this commit.
2014-09-22 22:20:41 +01:00
Richard W.M. Jones
c9c5353223 v2v: Allow the output mode to override disk_create.
Also we allow the output mode to actually create the disk image.  This
lets the output mode set ownership and permissions correctly if
required.

The default method just calls Guestfs#disk_create, so there is no
actual change in this commit.
2014-09-22 22:11:41 +01:00
Richard W.M. Jones
15556b614d v2v: lib_ovf: Change create_meta_files so it doesn't write the files.
Change Lib_ovf.create_meta_files so that instead of writing the
.meta files, it just returns the content.  Output_rhev and
Output_vdsm are correspondingly changed so that they write the
content to the .meta files.

This is just code refactoring, there is no functional change.
2014-09-22 19:31:37 +01:00
Richard W.M. Jones
6d09ff3600 Version 1.27.51. 2014-09-22 18:28:07 +01:00
Richard W.M. Jones
7b428603e3 v2v: Windows: Uploading viostor driver needs upload method, not copy.
Thanks: Jeff Forbes
2014-09-22 18:25:51 +01:00
Richard W.M. Jones
1b12c6d46b fuse: Remove test-fuse.sh (rewritten script) from EXTRA_DIST.
This fixes commit aca076e2e2.
2014-09-22 18:25:26 +01:00
Richard W.M. Jones
1b9b4af724 Revert "v2v: -o rhev: Chown the image files and metadata after the upload."
This reverts commit dd58cde929.
2014-09-22 18:13:34 +01:00
Richard W.M. Jones
2e3e254e95 Revert "v2v: -o rhev: Use chown --reference instead of 36.36 (RHBZ#1143887)."
This reverts commit 70444670ac.
2014-09-22 18:13:22 +01:00
Hu Tao
cd86bc5100 resize: simplify the code to filter parts
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-22 16:48:18 +01:00
Richard W.M. Jones
cee9a4993d v2v: For grub legacy, edit grub config file instead of using grubby (RHBZ#1141145).
The old virt-v2v code would either edit the grub config file (grub
legacy) or use grubby --set-default (grub2).

When translating this code, I figured we could use grubby in both
cases, since grubby exists for grub legacy guests.

However it doesn't appear to work for grub legacy guests.  Use the
configuration file editing method for these, same as old virt-v2v.

Thanks: Tingting Zheng
2014-09-22 16:44:19 +01:00
Richard W.M. Jones
58eaf258c1 fuse: Enable futimens test (RHBZ#1144766). 2014-09-22 15:47:48 +01:00
Richard W.M. Jones
8664337cc3 New APIs: Implement stat calls that return nanosecond timestamps (RHBZ#1144891).
The existing APIs guestfs_stat, guestfs_lstat and guestfs_lstatlist
return a stat structure that contains atime, mtime and ctime fields
that store only the timestamp in seconds.

Modern filesystems can store timestamps down to nanosecond
granularity, and the ordinary glibc stat(2) wrapper will return these
in "hidden" stat fields:

  struct timespec st_atim;            /* Time of last access.  */
  struct timespec st_mtim;            /* Time of last modification.  */
  struct timespec st_ctim;            /* Time of last status change.  */

with the following macros defined for backwards compatibility:

  #define st_atime st_atim.tv_sec
  #define st_mtime st_mtim.tv_sec
  #define st_ctime st_ctim.tv_sec

It is not possible to redefine guestfs_stat to return a longer struct
guestfs_stat with room for the extra nanosecond fields, because that
would break the ABI of guestfs_lstatlist as it returns an array
containing consecutive stat structs (not pointers).  Changing the
return type of guestfs_stat would break API.  Changing the generator
to support symbol versioning is judged to be too intrusive.

Therefore this adds a new struct (guestfs_statns) and new APIs:

  guestfs_statns
  guestfs_lstatns
  guestfs_lstatnslist

which return the new struct (or array of structs in the last case).

The old APIs may of course still be used, forever, but are deprecated
and shouldn't be used in new programs.

Because virt tools are compiled with -DGUESTFS_WARN_DEPRECATED=1, I
have updated all the places calling the deprecated functions.  This
has revealed some areas for improvement: in particular virt-diff and
virt-ls could be changed to print the nanosecond fields.

FUSE now returns nanoseconds in stat calls where available, fixing
https://bugzilla.redhat.com/show_bug.cgi?id=1144891

Notes about the implementation:

- guestfs_internal_lstatlist has been removed and replaced by
  guestfs_internal_lstatnslist.  As the former was an internal API no
  one should have been calling it, or indeed can call it unless they
  start defining their own header files.

- guestfs_stat and guestfs_lstat have been changed into library-side
  functions.  They, along with guestfs_lstatlist, are now implemented
  as wrappers around the new functions which just throw away the
  nanosecond fields.
2014-09-22 15:47:48 +01:00
Richard W.M. Jones
aca076e2e2 fuse: Rewrite test-fuse.sh in C.
This gives us finer control over how system calls are done,
and also potentially lets us test more.

Currently two tests are disabled:

 - utimens because of https://bugzilla.redhat.com/show_bug.cgi?id=1144766

 - utimes because our stat call does not return the nanosecond fields
2014-09-21 22:15:37 +01:00
Richard W.M. Jones
5bb26dcd3c tests/data: Remove abssymlink.
This file causes the test ISO to be rebuilt every time.

Instead of including it as a Makefile dependency, create it just
before making the ISO, which has the same effect.

A test in fish/ also used this file.  Change it so it doesn't need it.
2014-09-20 17:32:18 +01:00
Richard W.M. Jones
5fa568f686 tests/guests: Don't calculate checksums of generated images.
Turns out not to be useful, and takes a long time.

This reverts commit 0c605eb94f.
2014-09-20 15:57:44 +01:00
Richard W.M. Jones
cd9c0fc9a4 v2v: Move mpstat type definition.
It's only used by the core v2v.ml code, so move it to that file.

This is just code motion.
2014-09-20 11:56:13 +01:00
Richard W.M. Jones
eed49ac897 v2v: Move target actual size computation into core v2v.ml code.
This was only calculated for RHEV, but might benefit other output
modes in future, and is generic code, so move it into the core code.
2014-09-20 11:56:12 +01:00
Richard W.M. Jones
c1a32f5c11 v2v: Clarify description of ov_sd field in comment. 2014-09-20 11:56:12 +01:00
Richard W.M. Jones
0869f579fd aarch64: Add support to file_architecture API.
Add support for aarch64 to the file_architecture API, so we can
detect aarch64 guests correctly.

Add a test binary and library.  These were generated on an aarch64
machine by doing:

  echo 'main(){}' > bin.c
  gcc bin.c -o bin-aarch64-dynamic
  strip --strip-all bin-aarch64-dynamic
  echo '' > lib.c
  gcc -shared lib.c -o lib-aarch64.so
  strip --strip-all lib-aarch64.so
2014-09-20 11:56:12 +01:00
Richard W.M. Jones
f61832b17a v2v: Remove source.s_arch field and find architecture through inspection.
Previously we required that the source hypervisor knew the
architecture of the guest, and passed that through to KVM.

However this was error-prone for several reasons:

 - OVF (-i ova) doesn't define the architecture

 - Disk images (-i disk) don't have an associated architecture

 - Libvirt XML sometimes lacks the <type arch=...> field, especially
   for RHEL 5-era libvirt.

 - It might not be set correctly for the guest.

We know the real architecture from inspection of the guest, so use
that instead.
2014-09-20 11:56:12 +01:00
Richard W.M. Jones
95b7e716ca v2v: Fix typo in comment. 2014-09-20 08:12:41 +01:00
Hilko Bengen
a36dde9889 appliance: Add libsystemd0 (and systemd as an alternative for sysvinit) on Debian-based systems 2014-09-19 20:52:43 +02:00
Richard W.M. Jones
b2a1d4ce45 Version 1.27.50. 2014-09-19 14:52:16 +01:00
Hu Tao
1e6dd6d2a3 resize: add function expand_partition_content
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-19 14:23:40 +01:00
Hu Tao
b9063b7c2f resize: add function set_partition_bootable_and_id
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-19 14:22:53 +01:00
Hu Tao
51f67a9c81 resize: add function copy_partition
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-19 14:21:52 +01:00
Hu Tao
4e6526c076 resize: add function print_summmary
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-19 14:03:25 +01:00
Hu Tao
d9f8746ea5 add function div_roundup64
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-19 13:54:44 +01:00
Hu Tao
b05b9ba8bf resize: convert sectsize to int64
Because sectsize is used as int64 everywhere.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-09-19 13:54:44 +01:00
Richard W.M. Jones
816d7cf941 fish: Restore text to default when exiting (RHBZ#1144201).
The escape sequence \e[0;30m sets the colour to black.  This is fine
if you use a black-on-white terminal, but fails rather badly if you
use a white-on-black terminal.

Instead use the escape sequence \e[0m which restores the terminal to
the defaults, and works in both cases.
2014-09-19 13:18:45 +01:00
Richard W.M. Jones
4aa38bba2c v2v: Clean the RPM database early on (RHBZ#1143866).
If the RPM database in the source guest is corrupt, then subsequent
operations will fail randomly.

Old virt-v2v appears to have avoided this by cleaning the RPM database
very early on.  When translating the code I inadvertantly moved this
cleanup to a later stage -- in particular, after inspection of kernels
was done which requires running rpm commands.  Move this back to the
start.
2014-09-19 12:37:28 +01:00
Richard W.M. Jones
6db2ff52f9 v2v: Move initialization of Augeas after inspection housekeeping.
Just cleanup, it should have no effect on the way that the
conversion works.
2014-09-19 12:37:28 +01:00
Pino Toscano
7d9db86cab appliance: move e2fsprogs as common for all distros
All distro-specific sections have it, so just make it really common.
2014-09-19 13:33:21 +02:00
Pino Toscano
70768239fd appliance: remove duplicate packages in OpenSUSE, Frugalware, Mageia
From some lists of distro-specific packages, remove the ones that
appear already in the common list.
2014-09-19 13:26:37 +02:00
Richard W.M. Jones
9572907956 Version 1.27.49. 2014-09-18 18:08:43 +01:00
Richard W.M. Jones
c573feb4d1 v2v: Print a message if the guest is virtio-capable after conversion. 2014-09-18 17:45:12 +01:00
Richard W.M. Jones
70444670ac v2v: -o rhev: Use chown --reference instead of 36.36 (RHBZ#1143887).
When chowning the final directories, instead of chowning them to 36.36
(ie. hard-coding those UID/GIDs), use a --reference chown so it should
take the ownership from the parent directory.

Unfortunately chowning is very complex because of:

 - NFSv3 vs NFSv4

 - root squash

 - idmap

which creates approximately 8 different ways for this to fail.
2014-09-18 15:07:32 +01:00
Richard W.M. Jones
035f47cdde v2v: Fix code for editing grub2 console=... parameter (RHBZ#1143883).
When presented with a RHEL 7 guest, virt-v2v would print the following
warning message:

  virt-v2v: warning: could not update grub2 console: aug_get: no matching
  node (ignored)

This happened because on RHEL 7, /etc/sysconfig/grub is a symlink to
/etc/default/grub, and the Augeas grub2 lens returns entries under
/files/etc/default/grub/*, but the code was checking for
/files/etc/sysconfig/grub/*.

The fix is to check all the possible Augeas paths until one matches.
(Only the first match gets updated however).

Also, don't rebuild the grub2 config unless we've actually changed it.
This avoids doing a potentially failure-prone operation when it's not
necessary.

I suspect that the old virt-v2v code did not work correctly for RHEL 7
guests, but old virt-v2v didn't print a warning here, it just failed
to update silently.
2014-09-18 14:55:33 +01:00
Richard W.M. Jones
e5dd3b08de customize: Make usage of --password-crypto option clearer (RHBZ#1143949). 2014-09-18 13:56:58 +01:00
Richard W.M. Jones
c68b510be2 Update release notes. 2014-09-18 13:36:41 +01:00
Richard W.M. Jones
32736857b3 v2v: Document the input: output: and convert: features in --machine-readable output. 2014-09-17 21:34:10 +01:00
Richard W.M. Jones
3562a81683 generator: Change type of 'tests' to 'c_api_tests'.
Just a code refactoring, has no functional effect.
2014-09-17 17:31:50 +01:00
Richard W.M. Jones
e85a976c5a tests: Don't use relative paths to binaries in tests.
All tests run under the ./run binary.  For a long time the ./run
binary has set the $PATH environment variable to contain all of the
directories with binaries in them.

Therefore there is no reason to use ../fish/guestfish instead of just
plain guestfish (and the same applies to other built binaries).
2014-09-17 17:31:50 +01:00
Richard W.M. Jones
bced8f5289 FAQ: Note that update-guestfs-appliance is not needed with libguestfs >= 1.26. 2014-09-17 16:33:55 +01:00
Richard W.M. Jones
58a285b5b3 Version 1.27.48. 2014-09-17 15:51:30 +01:00
Richard W.M. Jones
0fabe1a2ed daemon: parted: Fix error message when part-get-name is called on non-GPT (RHBZ#1142416).
The error message was bogus, fix it.

This fixes commit 0316d24770.

Found by: Lingfei Kong
2014-09-17 15:36:15 +01:00
Richard W.M. Jones
5fcc584c34 daemon: parted: Don't crash if part-get-name called on non-partitioned device (RHBZ#1142158).
If do_part_get_parttype returns NULL, then return from the function
instead of dereferencing the NULL pointer and crashing.  Note that
do_part_get_parttype has already called reply_with_error in this case.

This fixes commit 0316d24770.

Found by: Lingfei Kong
2014-09-17 15:34:03 +01:00
Richard W.M. Jones
0710510732 v2v: Reconfigure /etc/modprobe.conf (RHBZ#1141145).
More code that was omitted during the translation of old virt-v2v.
2014-09-17 15:13:33 +01:00
Richard W.M. Jones
f982ce2703 v2v: Rebuild initrd last.
Old virt-v2v rebuilt the initrd late.  Currently we rebuild the initrd
right after choosing a kernel, but it's best to update the initrd
at the end since mkinitrd may depend on other configuration files
that we are changing (especially see next commit).
2014-09-17 15:13:21 +01:00
Richard W.M. Jones
5fed8dfae1 v2v: -o rhev: Don't quote 'root' in error message. 2014-09-17 13:59:39 +01:00
Richard W.M. Jones
dd58cde929 v2v: -o rhev: Chown the image files and metadata after the upload. 2014-09-17 13:59:26 +01:00
Richard W.M. Jones
d5001304e4 v2v: Fix OVF VmType field, which should be 0 or 1 (RHBZ#1142008).
Thanks: Shahar Havivi.
2014-09-17 13:07:17 +01:00
Richard W.M. Jones
05f665166c v2v: Fix capitalization of ovf:volume-type (RHBZ#1142008).
Thanks: Shahar Havivi.
2014-09-17 13:07:17 +01:00
Richard W.M. Jones
fe36b2ce95 v2v: -o rhev/vdsm: Fix ovf:size and ovf:actual_size fields (RHBZ#1142008).
These are integers in gigabytes (2^30).

Thanks: Shahar Havivi.
2014-09-17 13:07:17 +01:00
Richard W.M. Jones
7739a6d357 v2v: If virtio is enabled, map device names to vd* (RHBZ#1142004).
The old virt-v2v code had:

    my $prefix;
    if ($virtio) {
        $prefix = 'vd';
    } elsif ($libata) {
        $prefix = 'sd';
    } else {
        $prefix = 'hd'
    }

The translated code dropped the test for virtio by accident, which
meant that device names would be mapped to sd* or hd* even if the
virtio-blk driver was enabled for the guest.

Thanks: Tingting Zheng
2014-09-17 12:13:42 +01:00
Richard W.M. Jones
4178bdc9b4 sysprep: Clarify the documentation for 'flag-reconfiguration'.
It was quite obscure what this actually did.  Make it clear
in the documentation.
2014-09-17 11:52:34 +01:00
Richard W.M. Jones
f722571c73 sysprep: Clarify when --mount-options is used and what it does (RHBZ#1142186). 2014-09-16 16:46:34 +01:00
Richard W.M. Jones
9aeaace779 Version 1.27.47. 2014-09-16 16:43:28 +01:00
Richard W.M. Jones
01b25d7fc6 v2v: Add xvda -> sda etc mappings (RHBZ#1142004).
For Xen guests, a device can be presented twice as (eg) xvda and sda,
and therefore we should map any otherwise unmapped xvdX.

For non-Xen guests, this should have no effect.
2014-09-16 16:20:15 +01:00
Richard W.M. Jones
d86016da8e v2v: Fix for 'grubby: bad argument --set-kernel: unknown option' (RHBZ#1141145).
I made a mistake while translating the Perl conversion code and
transcribed --set-default as --set-kernel.  grubby has no --set-kernel
option so it failed.

Thanks: Tingting Zheng
2014-09-16 15:49:34 +01:00
Richard W.M. Jones
a7147ce9ff run: Add p2v to the PATH. 2014-09-16 08:38:05 +01:00
Richard W.M. Jones
8856fadadb v2v: Prevent conversion of "blocked" and "paused" domains also.
Previously only "running" domains were blocked from conversion.
However "blocked" is essentially the same as running (on Xen it just
means the domain is running but waiting on an I/O resource).  And
"paused" domains probably shouldn't be converted either since their
disks are only crash-consistent.
2014-09-16 08:38:04 +01:00
Richard W.M. Jones
77b371b18b v2v: Clarify the missing input format error message (RHBZ#1141723). 2014-09-15 11:31:55 +01:00
Richard W.M. Jones
21c6c70378 Version 1.27.46. 2014-09-15 11:03:35 +01:00
Richard W.M. Jones
1dd485e500 v2v: Allow pool UUID to be used in -os parameter (RHBZ#1141631).
Thanks: Zhou Junqin.
2014-09-15 10:17:01 +01:00
Richard W.M. Jones
47251a3599 v2v: Allow domain UUID to be used in place of libvirt guest name (RHBZ#1141680).
Thanks: Zhou Junqin.
2014-09-15 10:15:54 +01:00
Richard W.M. Jones
a417287e0a v2v: domainxml: Rework libvirt error handling.
Don't rely on libvirt's implicit print-to-stderr.  Instead make sure
that libvirt error messages are raised in the exception message.

Also allow error strings to be translated.
2014-09-15 10:13:09 +01:00
Richard W.M. Jones
be1385d2cb Revert "v2v: -i libvirtxml: Give an error if local disks are not readable (RHBZ#1140946)."
This commit breaks remote disks.  See:
https://bugzilla.redhat.com/show_bug.cgi?id=1141654

This reverts commit 73c1f1cf7e.
2014-09-15 09:46:30 +01:00
Hilko Bengen
7039d0e7f6 Generate *.cmx targets only if a native OCaml compiler exists 2014-09-14 21:21:25 +02:00
Richard W.M. Jones
50d5d4b723 v2v: Add stringMap.mli (interface).
Hopefully this should fix the incorrect build problem.  See discussion
here:

https://www.redhat.com/archives/libguestfs/2014-September/msg00071.html

The interface was generated using 'ocamlc -i'.
2014-09-14 19:03:28 +01:00
Richard W.M. Jones
a18c2aca14 Revert "Use ocamldep -all option."
This reverts commit a3881445ef.

See discussion on the mailing list:

https://www.redhat.com/archives/libguestfs/2014-September/msg00069.html
2014-09-14 18:46:49 +01:00
Richard W.M. Jones
48604913db Version 1.27.45. 2014-09-14 14:02:12 +01:00
Richard W.M. Jones
4515413217 daemon: Run udev_settle after pwrite-device finishes (RHBZ#1141451).
When you call close on any block device, udev kicks off a rule which
runs blkid to reexamine the device.  We need to wait for this rule to
finish running since it holds the device open and can cause other
operations to fail, notably mkfs.

(cherry picked from commit a9c8123c72)
2014-09-14 12:57:53 +01:00
Richard W.M. Jones
974c4cd015 appliance: Add comment with udev debugging option. 2014-09-14 12:26:37 +01:00
Richard W.M. Jones
88dea54803 v2v: -o rhev/vdsm: In --no-copy case, use estimate for ovf:actual_size (RHBZ#1140156). 2014-09-14 12:19:56 +01:00
Richard W.M. Jones
3e2f89a74f v2v: Fix variable name usage_mb -> usage_gb.
It's actually storing usage in gigabytes, not megabytes.
2014-09-14 12:19:56 +01:00
Richard W.M. Jones
5a620137bf v2v: Estimate the amount of space required on the target.
Estimate the amount of space required on the target by each source
disk after conversion.  The estimate is approximately a ceiling on
this, and actual use should be considerably lower.

Provide an extra output method (#check_target_free_space) which output
modules may use to check that there is sufficient free space to
proceed, before conversion starts.  None of the output modules
actually implement this at the moment.
2014-09-14 12:19:56 +01:00
Richard W.M. Jones
f084fec381 v2v: Introduce Types.mpstats struct storing mountpoint statistics.
This is just code refactoring.
2014-09-13 14:54:39 +01:00
Richard W.M. Jones
b7bdb63d89 tools: Check for dangling --format parameters (RHBZ#1140894).
In most C tools, virt-sysprep and virt-customize, you have to put the
--format parameter before the corresponding -a parameter.  ie.  The
following is correct:

  guestfish --format qcow2 -a disk1 -a disk2

But the following is incorrect.  The --format parameter is dangling
and prior to this commit would have been silently ignored:

  guestfish -a disk1 -a disk2 --format qcow2

After this change, dangling --format parameters now lead to an error:

  guestfish: --format parameter must appear before -a parameter

In virt-customize, also check that --attach-format parameter appears
before --attach parameter.

Thanks: Lingfei Kong
2014-09-13 10:49:58 +01:00
Richard W.M. Jones
7845bcc20f Version 1.27.44. 2014-09-12 22:44:07 +01:00
Richard W.M. Jones
764cbd5f69 sysprep: Use 'error' function consistently throughout the program. 2014-09-12 22:29:49 +01:00
Richard W.M. Jones
f1390d3d7a sysprep: Ensure error handler surrounds all the code so we catch and print all errors. 2014-09-12 22:20:17 +01:00
Richard W.M. Jones
7bd7dabbd7 v2v: esx: Clarify that username can be specified in vpx:// URI (RHBZ#1141113).
If there is an authentication error when getting the session cookie,
emphasize in the error message that the username can be specified in
the URI.

Unfortunately libvirt asks for the username previously, but we cannot
access that.
2014-09-12 22:06:06 +01:00
Richard W.M. Jones
7836aa523b v2v: Add -o null mode.
In theory this discards the output.  Unfortunately in practice we have
to write the output to a temporary file and delete it (because of
limitations in qemu-img convert).
2014-09-12 20:30:34 +01:00
Richard W.M. Jones
73c1f1cf7e v2v: -i libvirtxml: Give an error if local disks are not readable (RHBZ#1140946). 2014-09-12 19:37:03 +01:00
Richard W.M. Jones
3729bc1fe1 sysprep: Check --{keep,remove}-user-accounts parameters are not used when operation is disabled (RHBZ#1141157).
You will see an error like this:

$ virt-sysprep --remove-user-accounts foo,bar -a /dev/null
virt-sysprep: error: user-accounts: --remove-user-accounts parameter was
used, but the "user-account" operation is not enabled
2014-09-12 16:41:24 +01:00
Richard W.M. Jones
5066fde8f2 sysprep: Add an optional method for checking if unused arguments were passed to disabled operations. 2014-09-12 16:41:24 +01:00
Richard W.M. Jones
0513a91d2e sysprep: Replace --user-accounts option with --{remove,keep}-user-accounts.
The --user-accounts option, with its double-negative '-' prefix on
user names, is confusing.  Replace it with '--remove-user-accounts'
and '--keep-user-accounts' options.

This updates commit 128d474095.
2014-09-12 16:41:24 +01:00
Richard W.M. Jones
e1ed66e2b1 v2v: If non-Xen and Xen initrds match a kernel, take shortest name (RHBZ#1141145).
Thanks: Tingting Zheng.
2014-09-12 15:51:12 +01:00
Richard W.M. Jones
44907763a6 v2v: Fix --help documentation of -o glance option.
Thanks: Junqin Zhou
2014-09-12 12:41:26 +01:00
Richard W.M. Jones
8f1ce3a72f Version 1.27.43. 2014-09-11 19:38:10 +01:00
Richard W.M. Jones
b67da2524f v2v: Split off -o vdsm mode from -o rhev (RHBZ#1140156).
-o rhev: This is "traditional" output to a RHEV-M Export Storage Domain.
It requires no cooperation from RHEV itself, and in all other respects
works the same way as old virt-v2v did.

-o vdsm: This is the new mode which requires VDSM cooperation.  VDSM
manages the conversion, creating the directories, suggesting UUIDs,
and cleaning up on failure.  This allows direct import into a Data
Domain.

The --rhev* command arguments now only apply to -o vdsm, and therefore
have been renamed to --vdsm*

The --vmtype command line argument may be used with -o rhev or -o vdsm.
2014-09-11 19:38:00 +01:00
Richard W.M. Jones
4c25f48bba v2v: Move some utility functions into Lib_ovf module.
This is just code refactoring and has no functional effect.
2014-09-11 16:23:00 +01:00
Richard W.M. Jones
694dc695b8 v2v: Remove unused struct (Types.output_rhev_params). 2014-09-11 16:16:10 +01:00
Richard W.M. Jones
04206fb3c0 v2v: Rename module Output_RHEV to Output_rhev.
This is just code refactoring, and has no functional change to the
program.
2014-09-11 16:16:10 +01:00
Richard W.M. Jones
de3614e0ff builder: Fix documentation of --list --list-format option (RHBZ#1140547).
Also give an error if users use the incorrect one:

$ virt-builder --list --format json
virt-builder: virt-builder --list: use '--list-format', not '--format'.
2014-09-11 10:14:24 +01:00
Richard W.M. Jones
b047feafa9 Update BUGS file. 2014-09-10 22:31:06 +01:00
Richard W.M. Jones
4fb3009a42 Version 1.27.42. 2014-09-10 22:11:01 +01:00
Pino Toscano
c862dc3d20 fish: fix small memory leak in completion
Do not leak the small memory buffer with the path.
2014-09-10 18:47:51 +02:00
Pino Toscano
55f70c13e3 resize: print FSes which cannot be expanded
Should ease a bit the discovery of a filesystem which cannot be
expanded.
2014-09-10 18:47:51 +02:00
Pino Toscano
a67845bfa0 test-charset-fidelity: set iocharset in vfat/msdos FSes
The default charset for these filesystems depends on how the kernel was
configured with, so explicitly set the default one (as specified in
Linux sources), eventually setting later a new one for the tests.
2014-09-10 18:47:51 +02:00
Richard W.M. Jones
c49d35a919 v2v: Clearer error message if ssh-agent authentication is not set up (RHBZ#1139973). 2014-09-10 17:01:10 +01:00
Richard W.M. Jones
516faa1bcb v2v: Fall back to virDomainGetInfo if remote libvirtd does not support virDomainGetState (RHBZ#1138586).
RHEL 5 Xen doesn't support the relatively new virDomainGetState API.
Instead you will see a warning message on stderr:

  libvirt: Remote Driver error : unknown procedure: 212

If we detect that virDomainGetState is not supported, then fall back
to calling virDomainGetInfo instead, which works everywhere.

This updates commit 096c05a750.

See also:
https://bugzilla.redhat.com/show_bug.cgi?id=1139973#c2
https://bugzilla.redhat.com/show_bug.cgi?id=1138586
2014-09-10 16:35:58 +01:00
Richard W.M. Jones
b6099f4aee v2v: Report error when multiple conflicting command line options are used (RHBZ#1140050).
$ virt-v2v -i disk -i libvirt
virt-v2v: error: -i option used more than once on the command line
2014-09-10 11:24:25 +01:00
Richard W.M. Jones
a6279f5c7b v2v: List convert modules in --machine-readable output.
$ virt-v2v --machine-readable
[...]
convert:enterprise-linux
convert:windows
2014-09-10 11:16:59 +01:00
Richard W.M. Jones
3d2e2bb445 v2v: Abstract Convert_* modules from core v2v code.
Previously the core virt-v2v code had to know which Convert_* module
to call for each guest type (based on inspection).  After this change
the core code doesn't need to know that, but instead Convert_* modules
register their interest in particular guest types.
2014-09-10 11:16:59 +01:00
Richard W.M. Jones
102e9a8c05 sysprep: Don't use --option=arg in documentation.
Fedora patches OCaml's Arg module to support --option=arg.  Since this
won't work on other distros or upstream OCaml, don't include such
examples in the documentation.
2014-09-09 23:27:51 +01:00
Richard W.M. Jones
c22d86870c v2v: Allow -o local as an alias for -o disk.
This is symmetrical with -i disk / -i local.
2014-09-09 23:14:27 +01:00
Richard W.M. Jones
49fa6912ed v2v: Sort the -i options alphabetically in the man page. 2014-09-09 23:14:27 +01:00
Richard W.M. Jones
68e58e5814 v2v: Update documentation credits.
Shahar Havivi and Tingting Zheng for development & testing respectively.
2014-09-09 23:13:57 +01:00
Richard W.M. Jones
334dee64a2 FAQ: Repeat advice to use ./run.
The two adjacent sections can be read separately, and the second
section doesn't mention not using make install / using ./run, so
repeat it a second time.
2014-09-09 20:27:33 +01:00
Richard W.M. Jones
163eb3b7a1 resize: Support for expanding XFS filesystems. 2014-09-09 17:06:39 +01:00
Richard W.M. Jones
aebe00e5c6 Version 1.27.41. 2014-09-09 16:02:44 +01:00
Richard W.M. Jones
a2107981a6 daemon: Run 'udevadm settle' with debugging and warn if the command fails. 2014-09-09 15:48:41 +01:00
Richard W.M. Jones
6b379ab598 Version 1.27.40. 2014-09-09 15:42:05 +01:00
Richard W.M. Jones
59136518f1 v2v: Calculate dracut/mkinitrd kernel version correctly (RHBZ#1138182).
Thanks: Tingting Zheng.
2014-09-09 15:23:25 +01:00
Pino Toscano
e89ab6dde4 tests: sysprep: slightly improve output
Add minor spacing changes, and report the image being sysprep'ed, so it
is easier to spot which image caused some warning message.
2014-09-09 15:10:33 +02:00
Richard W.M. Jones
be1c696500 v2v: Check if there is sufficient free space for conversion (RHBZ#1139543).
Before trying to perform the conversion, estimate if there is
sufficient free space on the guest filesystem(s) for the conversion to
be successful.

If not, you will see an error similar to this one:

[   6.0] Checking for sufficient free disk space in the guest
virt-v2v: error: not enough free space for conversion on filesystem '/'.
4354048 bytes free < 20000000 bytes needed
2014-09-09 10:46:55 +01:00
Richard W.M. Jones
4fc333d0ef p2v: Use matchbox (window manager) in the virt-p2v ISO.
virt-p2v can run without a window manager.  However it then sits in
the top left corner of the screen.  Add a lightweight window manager
to the ISO so that position and geometry hints work.
2014-09-08 13:13:01 +01:00
Richard W.M. Jones
e52ec0a3df p2v: Whitespace change in options list. 2014-09-08 11:07:03 +01:00
Richard W.M. Jones
a12745a481 Version 1.27.39. 2014-09-06 20:51:55 +01:00
Richard W.M. Jones
0866d22381 p2v: Add scripts to make disk or kickstart-based P2V ISO.
Two scripts are added, replacing the make targets from the
previous commit:

virt-p2v-make-disk: Builds a virt-p2v disk or USB key using
virt-builder.

virt-p2v-make-kickstart: Builds a kickstart file (only) which can be
fed to livecd-creator or similar tools on Red Hat-derived distros.

Kickstart generation is slightly different: Instead of requiring the
downstream 'libguestfs-pvhelper' package, the kickstart now embeds the
virt-p2v binary(!) making it self-contained and downstream packaging
simpler.

In addition there are documentation changes.
2014-09-06 20:51:54 +01:00
Richard W.M. Jones
8e6478dc7d p2v: Remove p2v-iso directory.
As part of reworking the scripts that are used to build the P2V ISO,
first remove the separate p2v-iso directory.  Similar scripts and
documentation will be introduced back into the p2v/ directory in
following commits.
2014-09-06 19:50:38 +01:00
Richard W.M. Jones
e1ee037096 p2v: Temporarily remove Configure Network button.
We will ship 1.28 without the capability of configuring the network
(ie. DHCP will always be used).
2014-09-06 19:50:38 +01:00
Richard W.M. Jones
a743f57cb8 p2v: Ensure the current version of virt-p2v is always displayed.
This will help with debugging customer problems.
2014-09-06 19:50:37 +01:00
Richard W.M. Jones
d7edde6b6d p2v: Success message should have info logo, not error logo. 2014-09-06 13:49:42 +01:00
Richard W.M. Jones
d82cf08ce1 daemon: Check return value of end_stringsbuf.
Found by Coverity.
2014-09-05 20:05:40 +01:00
Richard W.M. Jones
255ec57875 Version 1.27.38. 2014-09-05 15:24:38 +01:00
Richard W.M. Jones
d85c38155a appliance: Add guestfs_shadow.aug to EXTRA_DIST.
Fixes commit 61917136f5.
2014-09-05 15:19:07 +01:00
Pino Toscano
553677398b customize: use augeas to change passwords
Make use of augeas to load and edit /etc/shadow, now that we have
(either from upstream or by ourselves) a lens handling it.
2014-09-05 15:57:56 +02:00
Pino Toscano
a0cf4b3407 sysprep: remove comment and notes about /etc/shadow lens
We are either using the upstream lens, or our copy of it, to handle
/etc/shadow, so now removing entries from it works.
2014-09-05 15:57:56 +02:00
Pino Toscano
61917136f5 appliance: daemon: import and use upstream shadow lens
Import the upstream lens for the shadow file, just with a different
identifier and not matching /etc/shadow by default. Instead, apply a
transformation to have it match /etc/shadow only if the version of
augeas is at least 1.2.1 [1].

[1] While the last upstream version is 1.2.0, all the development seems
to happen in master, so whatever the next version is going to be
numbered (e.g. 1.2.1 or 1.3.0), the check will be fine anyway.
2014-09-05 15:57:56 +02:00
Pino Toscano
d01fbe8666 daemon: add a way to check for the version of augeas
Query augeas for its version when required, i.e. only once when using
the new augeas_is_version function.
2014-09-05 15:57:56 +02:00
Richard W.M. Jones
54e32eb8e2 v2v: -i libvirt, -i libvirtxml: Print libvirt XML when debugging. 2014-09-05 14:44:48 +01:00
Richard W.M. Jones
35d49cd9de v2v: When locating initramfs, ignore kdump initramfs images (RHBZ#1138184).
Thanks: Tingting Zheng.
2014-09-05 14:13:34 +01:00
Richard W.M. Jones
096c05a750 v2v: -i libvirt: Check the domain is not running (RHBZ#1138586).
It will print an error like this:

  virt-v2v: error: internal error: invalid argument: libvirt domain 'windows'
  is running, it must be shut down in order to perform virt-v2v conversion

This only works for libvirt domains, and is explicitly disabled for
test:/// URIs since these domains are always "running", but we use
these URIs for testing.
2014-09-05 13:44:41 +01:00
Pino Toscano
de93b9060d daemon: make aug_close cleanup available for all
Just code motion, no behaviour changes.
2014-09-05 11:30:19 +02:00
Pino Toscano
a935db30e5 v2v: R_OK is in Unix module 2014-09-05 11:30:18 +02:00
Richard W.M. Jones
922da70651 v2v: -i disk: Add a clearer error message if the disk doesn't exist or is not readable. 2014-09-05 09:54:32 +01:00
Richard W.M. Jones
d12f1ee99c v2v: -i disk: Don't fail if filename has no extension.
Unhelpfully, Filename.chop_extension throws an exception if the
filename has no extension (instead of just returning the filename).
Therefore the -i disk option would fail if you passed any filename
that didn't have an extension.
2014-09-05 09:49:39 +01:00
Richard W.M. Jones
54995514cb Update gnulib to latest. 2014-09-04 16:14:35 +01:00
Pino Toscano
0fc7cbe99b v2v: skip test-v2v-i-ova.sh if rhsrvany.exe is not installed 2014-09-04 17:09:13 +02:00
Richard W.M. Jones
03c9834cf3 Version 1.27.37. 2014-09-04 14:58:04 +01:00
Richard W.M. Jones
c3b3f68397 v2v: Add test OVF file to EXTRA_DIST.
This fixes commit 90b1e9845f.
2014-09-04 14:57:35 +01:00
Pino Toscano
ba65af3435 customize: fix locking accounts with passwords
When setting the password for a locked account, make sure to still write
the password after the "!!" marker, otherwise the account will have no
password.
2014-09-04 15:31:02 +02:00
Richard W.M. Jones
5edb78d1ae v2v: docs: Clarify how ESX & Xen imports happen through libvirt. 2014-09-04 12:55:40 +01:00
Richard W.M. Jones
f243418d23 v2v: Add support for access to remote RHEL 5 Xen hosts over ssh. 2014-09-04 12:55:35 +01:00
Richard W.M. Jones
0c295c8e23 v2v: -i libvirtxml: Detect disk format using any <driver type=...> field.
Previously we only looked for <driver name=qemu type=...>.  However
for Xen imports, the name field could be name=tap (or other values in
fact).  Since there can only be one <driver/> element under <disk/>,
look for any <driver type=...> in order to get the disk format.

A further complication for Xen is that type=aio means "raw" (for
obscure historical reasons), so map that.

Thanks: Dan Berrangé.
2014-09-04 12:39:38 +01:00
Richard W.M. Jones
27a5ef9131 v2v: Move json-generating code into separate module.
Just code motion so we can reuse the same code for making
`json:' remote SSH URLs.
2014-09-04 12:09:02 +01:00
Richard W.M. Jones
d5662fe035 -i ova: Tidy up the description in the manual page.
This updates commit 90b1e9845f.
2014-09-04 11:19:24 +01:00
Shahar Havivi
90b1e9845f v2v: adding input -i ova
Adding ability for v2v to get Vmware ova file as an input.

Signed-off-by: Shahar Havivi <shaharh@redhat.com>
2014-09-04 09:59:14 +01:00
Richard W.M. Jones
44ca9d563a launch: libvirt / p2v: Fix empty_element macro.
The empty_element macro was not safe when used in a "naked" if
statement such as:

  if (config->flags & FLAG_ACPI) empty_element ("acpi");

Fix the macro so it uses do { ... } while (0) to make it safe here.
2014-09-03 14:01:20 +01:00
Richard W.M. Jones
5791197642 v2v: Don't hard-code list of -i and -o options in help output.
We can now get it from Modules_list.
2014-09-03 12:37:40 +01:00
Richard W.M. Jones
82b7385292 v2v: Update TODO. 2014-09-03 12:37:40 +01:00
Richard W.M. Jones
941ebaa5e4 mllib: error: Clearer message about how to enable debugging. 2014-09-03 12:37:40 +01:00
Richard W.M. Jones
711c32b0d9 mllib: Wrap errors at column 76 instead of column 72.
Allows for slightly wider, better looking error messages.
2014-09-03 12:37:40 +01:00
Richard W.M. Jones
bb362f6878 OCaml virt-* tools: Handle pretty printing of exceptions through a common library function. 2014-09-03 12:37:39 +01:00
Pino Toscano
e52742e6d3 sysprep: user-account: remove the correct home
Query using augeas for the home directory of an user, instead of
hardcoding /home/<username>.
2014-09-03 11:13:54 +02:00
Richard W.M. Jones
ee5470d083 v2v: Clarify documentation for -o local. 2014-09-02 23:40:28 +01:00
Richard W.M. Jones
11b1e2862b v2v: Update TODO. 2014-09-02 22:40:13 +01:00
Richard W.M. Jones
e0506486b0 v2v: Review 3-X comments in TODO file and remove any which are not short-term goals to fix. 2014-09-02 22:05:46 +01:00
Richard W.M. Jones
03ed5a790b p2v/v2v: List output drivers in `virt-v2v --machine-readable', and use that in virt-p2v.
The new output of virt-v2v --machine-readable now lists the input and
output drivers available in the binary:

  $ virt-v2v --machine-readable
  virt-v2v
  libguestfs-rewrite
  input:disk
  input:libvirt
  input:libvirtxml
  output:glance
  output:libvirt
  output:local
  output:rhev

With this information, we can now pre-populate the virt-p2v GUI
combo box.
2014-09-02 22:03:43 +01:00
Richard W.M. Jones
03d848ab68 Version 1.27.36. 2014-09-02 17:06:45 +01:00
Richard W.M. Jones
10f6206202 p2v: Support for interface to network map.
Instead of having all interfaces connect to the "default" network on
the hypervisor target, you can now create a map of interface to target
network, either on the kernel command line, eg:

  p2v.network=em1:rhevm
  p2v.network=em1:rhevm,em2:management,other

or through the GUI.
2014-09-02 16:51:02 +01:00
Richard W.M. Jones
1ce65eeaef p2v: Print config->output_connection field in conversion debug.
This fixes commit 81d3aee071.
2014-09-02 16:51:02 +01:00
Pino Toscano
128d474095 sysprep: user-account: select which users to remove or keep
Enhance the user-account sysprep operation, so it is possible to select
which user accounts should be removed only (instead of all), or which to
eventually keep.
2014-09-02 16:35:43 +02:00
Richard W.M. Jones
c902ede1cd p2v: Use libxml2 to write the libvirt XML document instead of printfs.
Solves quoting issues.  This is just code reorganization, there is no
substantive change in the output.
2014-09-02 15:03:25 +01:00
Richard W.M. Jones
fc52f98c76 v2v: Update TODO file. 2014-09-02 15:03:14 +01:00
Richard W.M. Jones
f0e1f580b1 p2v: Add some spacing on the conversion dialog. 2014-09-02 15:03:13 +01:00
Richard W.M. Jones
750e819034 p2v: Add GUI controls for -o, -oc etc options on virt-v2v command line. 2014-09-02 15:03:13 +01:00
Richard W.M. Jones
81d3aee071 p2v: Change p2v.output -> p2v.o etc and add p2v.oc
Name these the same as the virt-v2v options, so for example
'-oa' -> 'p2v.oa'.

Also add the missing p2v.oc (-oc) option.

This updates commit c516d2d07d.
2014-09-02 15:03:13 +01:00
Richard W.M. Jones
379f335059 v2v: Give a reasonable, early failure if output format is not raw or qcow2.
See comment in the code for reasoning.

Thanks: Shahar Havivi for discovering this.
2014-09-02 15:03:13 +01:00
Pino Toscano
c004e4648d appliance: exclude a lvm2 rule on Ubuntu (RHBZ#1111662).
On Ubuntu, exclude the Ubuntu-only 85-lvm2.rules since it causes the
automatic activation of volume groups on addition or change. This
interferes with libguestfs, as vgs which are disables suddently get
enabled.
2014-09-02 12:54:20 +01:00
Richard W.M. Jones
6582231510 generator: Don't use ocamldep -all option in this directory.
ocamldep -all (introduced in commit a3881445ef) creates a dependency
rule

  optgroups.cmi ... : utils.cmx ...

Because we never build a native code version of the generator,
utils.cmx can never be remade, and so this results in optgroups.cmi
being always rebuilt and hence rebuilding the whole directory.

It's unclear how to fix this, but reverting the ocamldep -all change
in this directory works around it.

Partially reverts commit a3881445ef.
2014-09-02 09:07:59 +01:00
Richard W.M. Jones
a3881445ef Use ocamldep -all option.
In v2v, 'stringMap.ml' has no corresponding *.mli file.  ocamldep does
not generate a *.cmi dependency for such modules, and this can result
in parallel builds failing rarely because:

 (1) stringMap.ml is built (which has the side-effect of generating
     stringMap.cmi)

 (2) at the same time, types.mli is compiled.  types.mli depends on
     stringMap.cmi, but it is half way through being created by (1).

There is no dependency to serialize (1) and (2).

The resulting error is:

  File "types.mli", line 1:
  Error: Corrupted compiled interface
  stringMap.cmi

Using 'ocamldep -all' generates extra deps for the *.cmi files, and
otherwise appears to be safe, so use it.

There are currently a few upstream OCaml bugs with dependencies and
parallel builds:

http://caml.inria.fr/mantis/view.php?id=3190
http://caml.inria.fr/mantis/view.php?id=4991
http://caml.inria.fr/mantis/view.php?id=5000

It's not clear which of these apply here.
2014-09-01 22:24:14 +01:00
Richard W.M. Jones
c435053b34 Improve diagrams on various manual pages using Unicode box drawing characters. 2014-09-01 21:29:13 +01:00
Richard W.M. Jones
3c1b81d2af Version 1.27.35. 2014-09-01 17:40:56 +01:00
Richard W.M. Jones
22a556099a p2v: Add a test of virt-p2v. 2014-09-01 17:26:27 +01:00
Richard W.M. Jones
c516d2d07d p2v: Add p2v.output* controls so we can control where the output ends up.
This still needs to be implemented through the GUI.
2014-09-01 17:26:27 +01:00
Richard W.M. Jones
b16e98ba14 p2v: Fix p2v.disks (etc) parsing on kernel command line.
The parsing of p2v.disks, p2v.removable and p2v.interfaces did not
correctly end at the first space, and therefore any other parameters
that happened to be on the command line afterwards would be consumed
as a list of disks or interfaces.
2014-09-01 17:26:27 +01:00
Richard W.M. Jones
0136f50f06 p2v: Add a status message for when we detect the control connection has been closed. 2014-09-01 17:20:08 +01:00
Richard W.M. Jones
04740c5a35 p2v: Send SIGHUP (not SIGTERM) to kill child process.
One reason is that when testing the child process will be bash (not
ssh), and bash is documented to ignore SIGTERM when it is running
interactively.
2014-09-01 17:20:08 +01:00
Richard W.M. Jones
b1125a9db7 p2v: Allow -EIO error when reading pty to mean the writer has closed the connection.
This is apparently normal behaviour for ptys.
2014-09-01 17:20:08 +01:00
Richard W.M. Jones
8e5233741f v2v: Update TODO file. 2014-09-01 17:19:26 +01:00
Richard W.M. Jones
9fb2b82dbe v2v: Add some defensive code to test for the broken qcow2 overlay bug.
In commit 53e0d3ea5f I fixed a cause of
disk corruption in the overlay file during conversion.

To ensure this doesn't occur again unexpectedly, add a simple test to
the virt-v2v code and to the tests.
2014-09-01 13:06:15 +01:00
Pino Toscano
431cdfd983 fish: edit: write to the real file name
When saving, resolve the path of the file being edited and use that as
real target to write to. Otherwise, if the file name is a symlink then
it will be replaced by a regular file with the new content, leaving the
old file untouched.

Extend test-edit.sh to check for this situation.
2014-09-01 11:46:57 +02:00
Pino Toscano
ca9930ef16 test-tool: stop printing the FEBOOTSTRAP_* envvars
Stop printing the FEBOOTSTRAP_* environment variables, since they are
not used anymore.
2014-09-01 10:28:00 +02:00
Pino Toscano
356fe582b8 fish: edit: centralize the EDITOR handling
Allow null as value for the editor parameter of edit_file_editor, which
will then get it from the EDITOR envvar (falling back on vi).

This is basically code motion from the two edit_file_editor users to it.
2014-09-01 10:19:10 +02:00
Pino Toscano
b1a6488875 fish: edit: factor out download and reupload phases
Share some code between edit_file_editor and edit_file_perl; mostly code
motion, with no actual behaviour change.
2014-09-01 10:19:09 +02:00
Richard W.M. Jones
510329939b v2v: -o glance: Write potentially huge temporary images to /var/tmp by default.
Instead of /tmp.  This can be controlled by setting
$LIBGUESTFS_CACHEDIR or $TMPDIR.
2014-08-31 14:09:51 +01:00
Richard W.M. Jones
705e4bfd11 builder: Add test of the --edit option. 2014-08-31 13:37:51 +01:00
Richard W.M. Jones
1fb19fcad3 customize: perl_edit: Type of Guestfs_val() param is a Guestfs.t not the object wrapper.
This fixes commit c6b7e6cdda.
2014-08-31 13:37:42 +01:00
Richard W.M. Jones
94cffee541 -o glance: Multiple fixes.
Now tested and working on a glance server.

This fixes commit f01f641fbb.
2014-08-31 11:36:57 +01:00
Richard W.M. Jones
5c487541be Version 1.27.34. 2014-08-29 22:43:10 +01:00
Richard W.M. Jones
0d2f4c5074 v2v: Minor correction to -o glance documentation.
This fixes commit f01f641fbb.
2014-08-29 21:14:49 +01:00
Richard W.M. Jones
f01f641fbb v2v: Output to OpenStack Glance (-o glance option). 2014-08-29 21:07:30 +01:00
Richard W.M. Jones
1ce930ed27 v2v: Use copy_on_read in the overlays.
To speed up conversions by storing everything we read during
conversion in the overlay instead of having to reread it from the
remote server during copying.

Thanks: Matthew Booth.
2014-08-29 18:27:34 +01:00
Richard W.M. Jones
180e3c30de Add support for qemu copy_on_read feature.
When drives are added with this flag, reads from the backing file are
copied into the overlay, improving performance of reads to the same
area of disk (at the expense of local storage).  This is excellent for
reading remote / slow sources like HTTP.
2014-08-29 18:27:34 +01:00
Richard W.M. Jones
6a3147a5a0 v2v: esx: Add note to documentation about being asked for the password twice. 2014-08-29 16:26:45 +01:00
Richard W.M. Jones
8aea6d8fac v2v: More esx:// -> vpx:// changes.
This updates commit 155a6f0482.
2014-08-29 11:28:44 +01:00
Pino Toscano
c6b7e6cdda customize: use the common perl file editing code
Wrap edit_file_perl to OCaml, and use it instead of the OCaml version
of it.
2014-08-29 11:30:17 +02:00
Pino Toscano
57b3a35764 fish: edit: add verbose parameter 2014-08-29 11:30:16 +02:00
Pino Toscano
2d217eb00e edit: switch to common editing functions
Switch virt-edit to the common edit_file_editor and edit_file_perl.
2014-08-29 11:30:16 +02:00
Pino Toscano
b53126efb0 fish: edit: add perl file editing
Add the perl file editing, mostly based in the virt-edit implementation.

This introduces a mild code duplication with edit_file_editor; will deal
with it in a later commit.
2014-08-29 11:30:16 +02:00
Pino Toscano
f1c6d5d7f2 fish: edit: bring the fast-time-edit protection
Bring from virt-edit the small hack of putting the ctime of the
temporary file few seconds back to notice file changes also on fast
editing.
2014-08-29 11:30:16 +02:00
Pino Toscano
c9b6c8dac1 fish: edit: return 1 for unchanged file
Change the return value of edit_file_editor to 1, in case the editor did
not change the (temporary) file.
2014-08-29 11:30:16 +02:00
Pino Toscano
f79ee54722 fish: edit: bring backup extension to file editing w/ editor
Bring the backup extension feature from the perl-like file mode
implementation, although currently not making use of it.
2014-08-29 11:30:16 +02:00
Pino Toscano
511275acb1 fish: edit: improve the editor execution
Dynamically allocate the buffer for the command, and check also its exit
status.

Improvements taken from the current implementation in virt-edit.
2014-08-29 11:30:16 +02:00
Pino Toscano
7b9f0cf777 fish: isolate file editing (w/ editor) code in own file
Move the implementation of file editing using editor to an own file, so
that can be shared by different tools.

Mostly code motion.
2014-08-29 11:30:16 +02:00
Pino Toscano
582a8fcd84 cat: use the common Windows path handling code 2014-08-29 11:30:16 +02:00
Pino Toscano
73ed3171be fish, edit: move the exit-on-case-sensitive-error behaviour to virt-edit
Do not unconditionally exit if guestfs_case_sensitive_path, but let
windows_path still return null. Make virt-edit then check for that, and
eventually exit on its own.
2014-08-29 11:30:16 +02:00
Pino Toscano
de62583529 fish, edit: specifies whether mount Windows as readonly 2014-08-29 11:30:16 +02:00
Pino Toscano
7523e308fa edit: move windows path code to common file
Move the code handling Windows paths from virt-edit to a common file,
so that can be shared by various tools.

Mostly code motion, with a minimum touch (the additional guestfs_h*
parameter in mount_drive_letter) to make it build and work.
2014-08-29 11:30:16 +02:00
Richard W.M. Jones
2ab7906f7c Version 1.27.33. 2014-08-29 09:50:40 +01:00
Richard W.M. Jones
ed6173f610 v2v: Fix real conversions test by setting architecture in libvirt XML. 2014-08-29 09:41:33 +01:00
Richard W.M. Jones
591911f4bf Add suppression for memory leak in libvirt testDomainGenerateIfnames.
See: https://bugzilla.redhat.com/show_bug.cgi?id=1135388
2014-08-29 09:09:32 +01:00
Richard W.M. Jones
620d20c4bb Version 1.27.32. 2014-08-28 22:00:33 +01:00
Richard W.M. Jones
d8e04d454a v2v: Fix bugs in conversion when uninstalling VMware drivers.
- Don't uninstall open-vm-tools (the old virt-v2v didn't).

 - Do fix the library replacement code so it works the same way as
   old virt-v2v.
2014-08-28 21:49:48 +01:00
Richard W.M. Jones
155a6f0482 v2v: esx: Add / fix ability to import guests from vCenter Server.
See additional information in the manual page for details.
2014-08-28 19:26:35 +01:00
Richard W.M. Jones
3fa4fff9b4 v2v: -i libvirt: Allow map_source* functions to map the format as well as the path.
For ESX we need to map the format (which is usually unspecified) to raw.
2014-08-28 15:09:33 +01:00
Richard W.M. Jones
04121c40a1 v2v: -i libvirt: Add whitespace to make the code clearer. 2014-08-28 14:59:45 +01:00
Richard W.M. Jones
abbb636e75 v2v: Display a %-done progress bar when copying the disk image to the target.
This isn't quite the progress bar we have in mind, but it's sufficient
for now.

When --quiet is used, the progress bar is not displayed.
2014-08-27 20:40:43 +01:00
Richard W.M. Jones
e3a02c4153 sparsify: Remove obsolete comment.
We don't need to use compat=1.1 with modern qemu, and
lazy_refcounts may be dangerous.
2014-08-27 20:30:40 +01:00
Richard W.M. Jones
53e0d3ea5f v2v: Remove lazy_refcounts option.
This seems* to cause disk corruption in the overlay files.  A
manifestation of this is that the qcow2 header is not written back
correctly to disk, resulting in the backing file of the overlay
"disappearing" and hence hardly any data being copied over to the
target.

* Note this could be for a variety of reasons and doesn't necessarily
indicate a fault in qemu or qcow2.
2014-08-27 20:30:39 +01:00
Richard W.M. Jones
7aced6ffb2 v2v: -i libvirt/libvirtxml: Check that domain type, name, arch are not missing.
This can lead to incorrect output.
2014-08-27 14:43:46 +01:00
Richard W.M. Jones
e112e9a7b2 v2v: -o libvirt: Fix <features> XML in output.
It was writing each feature as PCData (ie. text), not as a separate
element, resulting in corrupt <features> output.
2014-08-27 14:36:03 +01:00
Richard W.M. Jones
4132680aea v2v: -i libvirt: Don't access remote -ic URIs during object creation.
Previously if you used `-i libvirt -ic [a remote URI]' then the remote
URI would be opened during object creation, which occurs during
command line parsing.  The practical effect was that virt-v2v could
appear to hang or give an error (eg if the remote URI is inaccessible)
before printing any log messages.  This could be very confusing for
the user.

Split out -i libvirtxml into a separate module, containing the libvirt
XML to source parsing code as a function called
Input_libvirtxml.parse_libvirt_xml.

Modify -i libvirt so it does all initialization and calls the helper
function during the #source method, and not at object creation time.
2014-08-27 12:57:41 +01:00
Richard W.M. Jones
f54aff9e9f v2v: utils: Permit more safe/unquoted characters in url_quote function. 2014-08-26 22:57:18 +01:00
Richard W.M. Jones
a18629ce40 v2v: utils: Don't need to use module name (Common_utils.) here. 2014-08-26 22:54:45 +01:00
Richard W.M. Jones
715020e264 v2v: Remove bogus %systemroot%\Drivers path.
This was based an incorrect translation of what the old virt-v2v was
doing.  %systemroot%\Drivers is not expected to exist already, and
indeed does not exist in a real Windows 7 guest.
2014-08-26 22:54:45 +01:00
Richard W.M. Jones
f527c22b00 v2v: Implement binding for `virsh pool-dumpxml'.
Add a mini-binding to libvirt virStoragePoolGetXMLDesc to get the pool
XML directly using the libvirt API.  Change existing external calls to
`virsh pool-dumpxml' to use this API instead.
2014-08-26 17:49:24 +01:00
Richard W.M. Jones
8dc45325a6 v2v: Work around buggy `virsh dumpxml'.
The `virsh dumpxml' command doesn't work properly when the libvirt
source requires authentication.  This is because the authentication
prompts are sent to stdout, but stdout is also the place where we are
reading the output XML from.

Add a mini-binding to libvirt virDomainGetXMLDesc which avoids this,
getting the XML directly using the libvirt API.  Change existing
external calls to `virsh dumpxml' to use this API instead.
2014-08-26 17:49:23 +01:00
Richard W.M. Jones
53999bddf4 v2v: -o libvirt: Mistakenly we were calling virsh dumpxml' instead of virsh pool-dumpxml'. 2014-08-26 17:49:23 +01:00
Pino Toscano
c916ea5b68 daemon: lvm-filter: use augeas for setting the filter
The way to set the filter for lvm devices was to open lvm.conf, look
for uncommented "filter =" lines and replace the configuration there.
This had the issue that if there is no uncommented filter line, then the
filter cannot be changed at all; considering newer lvm2 releases ship a
sample configuration with no uncommented filter lines, then the old way
became wrong and not sufficient.

Instead, take a copy of the upstream lvm.aug lens, with a simple change
to allow parsing also negative values in configuration, and install it
in the daemon. When asking to change the lvm filter, use augeas making
sure to use this custom lens for the lvm.conf copy used within the
appliance.
2014-08-26 17:44:31 +02:00
Pino Toscano
abb0b47e3f daemon: move AUGEAS_ERROR to the common header
Other than for current aug_* API, it will be useful for further code
using augeas directly.
2014-08-26 17:44:31 +02:00
Pino Toscano
9b501fa5c6 daemon: add add_sprintf
Bring the add_sprintf function for stringsbuf from the library.
2014-08-26 17:44:31 +02:00
Shahar Havivi
b56b90bf6e v2v: add xmlXPathRegisterNs for libxml2 binding
Signed-off-by: Shahar Havivi <shaharh@redhat.com>
2014-08-26 16:04:48 +01:00
Richard W.M. Jones
3f315f54e8 Enable warnings in C code linked to virt-sparsify and virt-v2v.
The C code didn't have -Werror enabled (when configured) and didn't
enable the full set of warnings we would want.

However OCaml-C bindings commonly declare functions which are
called directly from OCaml, eg:

  external parse_memory : string -> doc = "v2v_xml_parse_memory"

  value v2v_xml_parse_memory (value xmlv)

These do not require prototypes as no other C code will call them, so
we have to switch off the GCC -Werror=missing-prototypes flag for
these files.

Also fixes some confusion between _CPPFLAGS and _CFLAGS.
2014-08-26 16:02:27 +01:00
Richard W.M. Jones
880bf5f2ef v2v: -i libvirtxml: Add example libvirt XML. 2014-08-26 15:45:11 +01:00
Richard W.M. Jones
8e7cf61a40 v2v: -o local: Use /var/tmp instead of /tmp for examples.
In case people are suffering from broken tmp-on-tmpfs setups.
2014-08-26 15:43:52 +01:00
Richard W.M. Jones
97f634e5fb v2v: Split Types.overlay into Types.target and Types.overlay structures.
Move the fields from Types.overlay which were related to the target
file out.  Now Types.overlay is only concerned with the actual qcow2
overlay files, not with a mixture of both files.

For every guest disk, there is one chain which looks like this:

   source_disk         overlay                 target
  +------------+      +----------------+      +---------------+
  | s_qemu_uri |<------ ov_source      |<------ target_overlay|
  | etc        |      | ov_overlay_file|      | target_file   |
  +------------+      | ov_sd          |      | target_format |
                      | ov_virtual_size|      +---------------+
                      +----------------+

   describes source    describes temp.         describes target
   disk file           overlay (qcow2)         file

This is just refactoring.
2014-08-26 08:48:52 +01:00
Richard W.M. Jones
29b8fb6c15 v2v: types.mli: Fix typo in comment. 2014-08-25 21:42:15 +01:00
Richard W.M. Jones
4d30b82ea3 v2v: Change "Trimming the filesystems" message to something less scary.
Avoid copying unused and blank areas.  Avoid alarm and support calls too.
2014-08-25 21:36:28 +01:00
Richard W.M. Jones
93943a0f77 v2v: Simplify conversion dispatch code.
Refactoring, no functional change.
2014-08-25 21:31:05 +01:00
Richard W.M. Jones
0f2b503394 v2v: Update TODO. 2014-08-25 20:35:55 +01:00
Richard W.M. Jones
862a27c92d v2v: Inline the initialize_target function.
This function had got smaller and smaller until now we might as well
just inline it.  Having it after the main function just obscured the
order that the code runs.

No functional change, just refactoring.
2014-08-25 20:31:27 +01:00
Richard W.M. Jones
5800d96e7a v2v: Remove the Types.overlay ov_source_format field.
Not used by anything and unlikely to be useful.
2014-08-25 20:27:44 +01:00
Richard W.M. Jones
938fe047d0 v2v: Remove Types.overlay ov_preallocation field.
The ov_preallocation field was essentially an implementation detail of
the V2v module.  There was no need to carry it around in the overlay
struct, and nothing else used it.  This also allows us to simplify
other code.
2014-08-25 20:22:19 +01:00
Richard W.M. Jones
4c492e21ac v2v: Add comments to DOM module. 2014-08-25 20:15:53 +01:00
Richard W.M. Jones
613ae49319 v2v: -o rhev: Move inspection functions.
This is pure refactoring, no functional change.
2014-08-25 20:08:56 +01:00
Richard W.M. Jones
86a1f55810 v2v: Trivial fix to documentation in internal interface to libxml2. 2014-08-25 15:45:38 +01:00
Richard W.M. Jones
ce59aa8c84 Version 1.27.31. 2014-08-24 21:21:10 +01:00
Richard W.M. Jones
066eb69625 v2v: int64 -> int fix for previous commit.
This fixes commit 318a1b17a6
(thanks Pino Toscano).
2014-08-22 09:47:09 +01:00
Richard W.M. Jones
318a1b17a6 v2v: -i libvirt: Select sensible defaults if <memory> or <vcpu> is missing from input XML.
If the <memory> or <vcpu> elements was missing from the source
metadata then we would choose useless defaults, resulting in (for
example) <vcpu>0</vcpu> being written to the output.

Choose sensible defaults for these integer values.
2014-08-21 23:38:34 +01:00
Richard W.M. Jones
78f725ffd5 v2v: Store original vnet, and add comment to output metadata when mapping it.
When we map the network or bridge names (using --network or --bridge
command line options), this commit keeps the original name and adds it
as a comment to the output metadata.

The comment will look something like this:

    <interface type='bridge'>
      <!-- bridge mapped from "VM Network" to "bridge1" -->
      <source bridge='bridge1'/>
      <model type='rtl8139'/>
    </interface>
2014-08-21 23:28:15 +01:00
Richard W.M. Jones
d629b5252b v2v: DOM: Add XML comments (<!-- .. -->) to the model.
This allows us to insert comments into the output libvirt XML or OVF.
2014-08-21 23:24:39 +01:00
Richard W.M. Jones
6e1e9604b6 v2v: Add a test of --network and --bridge command line options.
This enhances commit aaf84abca9.
2014-08-21 23:08:18 +01:00
Richard W.M. Jones
02b653496d v2v: -o rhev: Improve the error message when you pass a bogus -os parameter. 2014-08-21 22:37:05 +01:00
Richard W.M. Jones
9fa27d4f79 v2v: -o libvirt: <source file=...> must always be an absolute path. 2014-08-21 22:24:34 +01:00
Richard W.M. Jones
53e788890d v2v: DOM: Produce pretty-printed XML. 2014-08-21 22:22:24 +01:00
Richard W.M. Jones
1e1605d937 mllib: Export output_spaces function.
This was already in Common_utils, but was only used internally
not exported.
2014-08-21 22:22:24 +01:00
Richard W.M. Jones
b9e591f7f0 v2v: Tests can use guests.xml not guests-all-good.xml. 2014-08-21 21:46:45 +01:00
Richard W.M. Jones
350e3285f3 v2v: Update documentation for input & output classes. 2014-08-21 21:26:19 +01:00
Richard W.M. Jones
f71d62fa78 Version 1.27.30. 2014-08-21 19:38:27 +01:00
Richard W.M. Jones
4389702e5c v2v: Remove build path which inadvertently appeared in test data. 2014-08-21 19:28:41 +01:00
Richard W.M. Jones
1e1ceb5273 Version 1.27.29. 2014-08-21 17:08:35 +01:00
Richard W.M. Jones
1d0ef02b36 v2v: Fix check-valgrind on --print-source option.
This updates commit 3a6dc32342.
2014-08-21 17:06:53 +01:00
Richard W.M. Jones
f5fda273b1 v2v: Remove ov_vol_uuid hack.
Now that we're using classes for outputs, we can hide the RHEV volume
UUIDs in the output_rhev class.
2014-08-21 15:00:53 +01:00
Richard W.M. Jones
3903f97cb3 v2v: Replace strings with variants for extra type safety.
No functional change.
2014-08-21 14:49:43 +01:00
Richard W.M. Jones
c3dda31492 v2v: Pass verbose flag into every input and output subclass. 2014-08-21 13:37:41 +01:00
Richard W.M. Jones
d1c8240b76 v2v: Print log message when opening the source. 2014-08-21 13:37:41 +01:00
Richard W.M. Jones
ca05d757b0 v2v: Change input and output variants into classes.
Previously Types.input and Types.output were variants, resulting in
the main v2v.ml code having to have knowledge of all the input and
output types.  So you would end up with code in v2v.ml like:

  match output with
  | OutputLibvirt -> (* call some libvirt-specific code *)
  | OutputRHEV -> (* call some RHEV-specific code *)

This changes these types to be abstract superclasses, with specific
implementations provided by (and hidden inside) each input/output
module.  The above code in v2v.ml now becomes:

  output#call ... (* no backend-specific knowledge needed *)

Although this commit is very large, it is just refactoring.  There is
no functional change in the code.
2014-08-21 13:37:41 +01:00
Pino Toscano
c7e56a5306 appliance: add glibc-locale on OpenSUSE
Provides the gconv modules, needed for iconv to work.
2014-08-21 13:20:25 +02:00
Richard W.M. Jones
640109e1e5 v2v: Reorder sections in the manual more logically. 2014-08-21 11:02:37 +01:00
Richard W.M. Jones
3a6dc32342 v2v: Add --print-source option. 2014-08-21 11:02:15 +01:00
Richard W.M. Jones
aaf84abca9 v2v: Add --network and --bridge options to perform network name mapping. 2014-08-21 10:21:01 +01:00
Richard W.M. Jones
e787c7f213 v2v: Let source.s_name be the renamed guest name (in case we use -on option).
The original guest name is saved in s_orig_name, although I checked
all uses of s_name and nothing needs it at the moment.
2014-08-21 09:12:04 +01:00
Richard W.M. Jones
cf714fc08d v2v: Update TODO. 2014-08-20 22:24:12 +01:00
Richard W.M. Jones
ccb47f93ff v2v: Add support for remote ESX connections.
This allows `-ic esx://...' to work because we map the strange source
URI used by ESX to a remote HTTPS connection.

Example disk section that this handles:

    <disk type='file' device='disk'>
      <source file='[datastore1] Windows/Windows.vmdk'/>
      <target dev='sda' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
2014-08-20 22:24:11 +01:00
Richard W.M. Jones
0539c2044c v2v: VMware returns MAC all zeroes. Map this to None. 2014-08-20 22:24:11 +01:00
Richard W.M. Jones
bc037d9ded v2v: source_libvirt: Replace create_xml ?dir parameter hack.
Instead of the ?dir parameter which was essentially a hack, allow
callers of create_xml to provide functions that map
<source file="..."> or <source dev="..."> to qemu URIs.

The default for these mappings is the identity function.

For -i libvirtxml we replace the old absolute_path_of_disk function
with a source file mapping function which does the same thing.

There is no functional change in this patch.
2014-08-20 22:24:11 +01:00
Richard W.M. Jones
2fc9fdda98 v2v: Don't attempt to make block device paths absolute.
<source dev=...> in the libvirt XML should always refer to a block
device, eg. /dev/sda1.  Don't attempt to make these paths absolute
(they should already be absolute paths, and if they are not it's wrong
to try to make them).
2014-08-20 22:24:11 +01:00
Richard W.M. Jones
7800150d06 v2v: Add binding for libxml2 xmlParseURI.
There is already a partial binding for this in fish/uri.c &
mllib/uri-c.c.  However it is specialized to parsing the -a parameter
on the command line and we want access to the full underlying
functionality of xmlParseURI.
2014-08-20 22:24:11 +01:00
Pino Toscano
c5c3a23294 appliance: add mkisofs on OpenSUSE
Needed for isoinfo.
2014-08-20 18:56:39 +02:00
Pino Toscano
3ceff73915 appliance: add cdrkit-isotools and mtools for Mageia
- cdrkit-isotools provides isoinfo, used by the daemon
- mtools is used by syslinux without being a dependency
2014-08-20 18:51:39 +02:00
Richard W.M. Jones
b6ba844992 v2v: Add some examples to the manual page. 2014-08-19 22:24:45 +01:00
Richard W.M. Jones
bcce760166 Version 1.27.28. 2014-08-19 19:46:24 +01:00
Richard W.M. Jones
3d1cb74b3e v2v: Add display, removable disks, and network interfaces.
These are now collected from the source metadata and (where
possible) passed through to the destination.

For reference, see the metadata structure of the old virt-v2v (roughly
equivalent to Types.source in the new code):

https://git.fedorahosted.org/cgit/virt-v2v.git/tree/metadata-format.txt

As you can see the new code now covers all the metadata features of
the old code.
2014-08-19 16:51:13 +01:00
Richard W.M. Jones
df471095ef v2v: Update TODO file. 2014-08-19 16:51:13 +01:00
Richard W.M. Jones
8b3b7cc0da daemon: Fix echo-daemon so it doesn't fail on empty array input. 2014-08-19 16:51:13 +01:00
Pino Toscano
0ed91a7399 appliance: initial packagelist for OpenSUSE
Mostly complete and making most of the features work.

The notable lack is ntfsprogs and ntfs-3g, which due to the way
mount.ntfs is handled (i.e. using alternatives) do not work properly.
2014-08-19 17:11:05 +02:00
Pino Toscano
4a4256b807 tests: make the scratch disk used for scratch much larger
50M can be not enough when uploading various copies of unstripped
static binaries from the system, which can fill up such a small disk.
2014-08-19 17:11:05 +02:00
Pino Toscano
6b2bf2c7ac builder: do not use xz --block-size for the test images
Do not use the --block-size parameter of xz when compressing the test
images, as that option does not exist in xz < 5.1.
2014-08-19 14:22:07 +02:00
Richard W.M. Jones
0fd95e2b9f drives: Add comments about fragile string handling.
GC FTW.
2014-08-19 12:11:06 +01:00
Pino Toscano
b53286a643 drives: fix deletion of servers on error
Make sure to not skip any of the created server, and to always free
the "server" array.
2014-08-19 12:03:56 +01:00
Pino Toscano
06aa1bff0f daemon: zfile: call pclose instead of fclose
fp was opened with popen, so close it properly.
2014-08-18 11:18:23 +02:00
Richard W.M. Jones
54887a3eea v2v: Update instructions for uploading a volume.
The previous instructions didn't include the need to change
<disk type='file' ...> to  <disk type='volume' ...>
2014-08-15 20:02:50 +01:00
Richard W.M. Jones
1866fc47a2 v2v: Add some more man pages that may be relevant to "SEE ALSO" section. 2014-08-15 19:58:10 +01:00
Richard W.M. Jones
c5b0e59dcc v2v: Fix formatting of --vmtype option in the man page. 2014-08-15 19:57:52 +01:00
Richard W.M. Jones
0327036b2f v2v: Fix typo in manual page.
This fixes commit 7c7caae7c1.
2014-08-15 19:51:09 +01:00
Richard W.M. Jones
25b33344b9 v2v: Make -i local be an alias for -i disk.
Analogous to -o local.
2014-08-15 19:50:43 +01:00
Richard W.M. Jones
7c7caae7c1 v2v: Add new -i disk to allow direct import of disk images with no metadata.
This is simpler to use and more convenient than -i libvirtxml, because
users don't need to bother with writing libvirt XML.  However it is
less expressive because many source capabilities such as memory and
number of vCPUs cannot be specified this way.
2014-08-15 18:39:46 +01:00
Richard W.M. Jones
eaadf5c130 v2v: Rename -o (target) tests.
No functional change.
2014-08-15 18:39:46 +01:00
Richard W.M. Jones
cca6f25de9 Version 1.27.27. 2014-08-15 16:39:14 +01:00
Richard W.M. Jones
a5e2485426 website: Add virt-p2v(1) and guestfs-p2v-iso(1) to the website. 2014-08-15 16:38:48 +01:00
Pino Toscano
787c42d6eb tests/syslinux: add /usr/lib/syslinux/bios as directory for mbr.bin
On Archlinux that is the location of mbr.bin.
2014-08-15 16:24:09 +01:00
Pino Toscano
df88e30ff1 appliance: add mtools to Archlinux' packagelist
It is an optional dependency but syslinux uses it, so pull it always in
the appliance.
2014-08-15 16:24:09 +01:00
Richard W.M. Jones
3243da393b v2v: Add a test of -o libvirt target. 2014-08-15 15:04:11 +01:00
Richard W.M. Jones
e2fcc2304c v2v: Add -o libvirt target (creates guest directly in libvirt). 2014-08-15 15:02:06 +01:00
Richard W.M. Jones
8ba605cad0 v2v: Display message when intializing the target.
As initializing the target (-o ...) is a distinct operation, which can
fail if the user supplied the wrong command line arguments, make sure
we display an explicit message before we perform this step.

It prints something like this:

  [   5.0] Initializing the target -o libvirt -os default
2014-08-15 14:37:19 +01:00
Richard W.M. Jones
e95a1c75d8 v2v: Move libvirt XML generation into common module, and use DOM module.
Since `-o local' and `-o libvirt' both need to generate libvirt XML
they should share the same code to generate it.

Also generate it using the DOM module instead of printing the XML
directly.  This is cleaner and avoids quoting issues.

No functional change here.
2014-08-15 10:08:29 +01:00
Richard W.M. Jones
7ab495b458 v2v: When outputting XML, write "<element/>" for nodes with no children. 2014-08-15 10:07:27 +01:00
Richard W.M. Jones
5e872dbd2e v2v: Pass acpi, apic, pae features through to libvirt XML output.
Notes:

 - Drop the acpi feature for RHEL 3.  Old virt-v2v says there is
   a problem presenting ACPI to RHEL 3 guests although it is not
   specific about what this is.

 - Old virt-v2v does not pass features through to OVF at all.
2014-08-15 08:53:22 +01:00
Richard W.M. Jones
991c4e36dd p2v: Find ACPI, APIC and PAE flags and add them to target libvirt XML. 2014-08-15 08:53:22 +01:00
Richard W.M. Jones
9fa9d39d71 utils: Add new CLEANUP_PCLOSE cleanup. It calls pclose(3). 2014-08-15 08:53:22 +01:00
Richard W.M. Jones
93c7842367 p2v: Rewrite /proc/cmdline reading code to use getline. 2014-08-15 08:53:22 +01:00
Richard W.M. Jones
483b4b7bbd v2v: Update TODO. 2014-08-15 08:53:21 +01:00
Pino Toscano
ddfe82e823 configure: look for "java-default-runtime" as directory for Java
This seems to be the new way [1] in Archlinux to specify, as symlink,
the default version of Java.

Thanks to Peter Wu for the notice about it.

[1] https://wiki.archlinux.org/index.php/Java
2014-08-14 19:06:20 +02:00
Pino Toscano
1d9388b800 configure: add java-8-openjdk and java-7-openjdk as locations for java
This helps some distros (e.g. Archlinux) where openjdk is installed in
java-MAJOR-openjdk directories, without any "default version" symlink.
2014-08-14 18:40:52 +02:00
Richard W.M. Jones
9609521734 launch: direct: Only issue Debian /dev/kvm group warning if /dev/kvm wasn't openable (RHBZ#1130189).
This warning was meant for the case where /dev/kvm is inaccessible and
the user must add themselves to a special group.

However we didn't take into account whether /dev/kvm was openable in
this test.  If it's openable, no point issuing the warning.

Move the is_openable ("/dev/kvm") test earlier, and don't issue the
warning if that was successful.
2014-08-14 15:16:06 +01:00
Pino Toscano
c211763860 appliance: add libc-bin to Debian's packagelist
It provides libc binaries like ldconfig and its configuration.
2014-08-14 14:00:35 +02:00
Pino Toscano
d9a4c481c9 appliance: update distros in comments
Update the list of recognized names of distributions in the comments.

No functional changes.
2014-08-14 13:46:18 +02:00
Richard W.M. Jones
6f045f8401 v2v: Skip virt-v2v tests if rhsrvany.exe is not installed. 2014-08-14 10:02:33 +01:00
Richard W.M. Jones
6ae0e9641b Version 1.27.26. 2014-08-13 22:32:06 +01:00
Richard W.M. Jones
8a23c1d79e lib: Missing include of <locale.h>.
Required by setlocale.  For some reason you only see the error
when compiling with -O0.
2014-08-13 22:23:04 +01:00
Richard W.M. Jones
d1e56118dd Add a separate TODO file for virt-v2v and virt-p2v. 2014-08-13 22:10:31 +01:00
Richard W.M. Jones
ef10da8b3a v2v: Add tests.
The virt-v2v tests here are not meant to be thorough tests of guest
conversion.  There is a test suite used to test conversion which is
kept outside libguestfs because it contains lots of proprietary
unredistributable guests like Windows.

The tests here instead are testing:

- virt-v2v command line arguments
- virt-v2v reads and writes files to the correct places
- valgrind & memory leaks
- any conversion properties that can be tested using just the
  phony guests (but we don't go out of our way here)
- that up to date guests don't crash virt-v2v
2014-08-13 22:10:31 +01:00
Richard W.M. Jones
7beb9f2cb5 tests/guests: Add Windows/Drivers directory to phony Windows guest.
Allows virt-v2v to complete.
2014-08-13 22:10:31 +01:00
Richard W.M. Jones
5b6a2e68b8 tests/guests: Fix RPM database in phony Fedora guest.
Fix the Name and Packages database so it looks enough like a modern
RPM database to fool inspection.  I'm not sure whether or not the old
version ever worked, but it doesn't work now.

The format is not documented, but in brief:

The Name database contains (Name, link) pairs.  The link is an
arbitrary 32 bit integer.

The Packages database contains (link, RPM-blob) pairs.

The RPM-blob is a binary blob formatted like this:

 * Number of fields               4 bytes, big endian
 * Size in bytes of the store     4 bytes, big endian
 * Field descriptions:
     list of (RPMTAG, 0, offset in store, 0)
                                  4 * 4 * nr_fields bytes, big endian
 * The store                      binary data containing ASCIIZ strings

For the values of RPMTAG_* that we understand, see src/inspect-apps.c.
2014-08-13 22:10:31 +01:00
Richard W.M. Jones
f0b71818a6 v2v: Add fedora to "RHEL family".
The calling code allows Fedora guests to be used when calling
Convert_linux.  However Convert_linux itself would fail with an
assertion error when you did this.
2014-08-13 22:10:30 +01:00
Richard W.M. Jones
b743fe2c3e tests/guests: Define the disk format of our test guests in the test XML. 2014-08-13 22:10:30 +01:00
Richard W.M. Jones
89417216b9 v2v: Fix libvirt source to parse the format of a disk properly.
Missing '@' means it wasn't looking for the attribute.
2014-08-13 22:10:30 +01:00
Richard W.M. Jones
cec3b42ad6 v2v: Add --no-copy option.
This option allows callers to generate the metadata without copying
the disks.
2014-08-13 22:10:30 +01:00
Richard W.M. Jones
bfcda1ba6a v2v: Nothing uses ov_target_file_tmp, remove this.
Previous virt-v2v would write to a temporary destination file then
atomically rename everything at the end.

However this appears to be unnecessary since we write the OVF file
after copying the disks, so (I assume) RHEV-M won't see the disks
before then.

In any case nothing used ov_target_file_tmp so we can remove this
feature to simplify the code.
2014-08-13 22:10:30 +01:00
Richard W.M. Jones
295086e934 v2v: Allow RHEV UUIDs to be specified on the command line.
Currently various UUIDs used by `-o rhev' are generated randomly.
This means they are different on every run of the program.

Allow some of them to be specified on the command line.  (If not
specified they are still generated randomly).

This allows RHEV-M to run virt-v2v several times (eg to examine the
OVF output) while having paths to files and OVF be stable across runs.
2014-08-13 22:10:30 +01:00
Richard W.M. Jones
ba63916960 v2v: Combine miscellaneous RHEV command line options into a single structure.
At the moment there is just one "miscellaneous RHEV command line
option" (--vmtype), but we may add more in future.  Put them in a
single struct for convenience.

This is just code motion.
2014-08-13 22:10:30 +01:00
Richard W.M. Jones
83c314d5c0 v2v: -o rhev: Fix error message. 2014-08-13 22:10:30 +01:00
Richard W.M. Jones
3f53dc4680 v2v: -o ovirt' is an alias for -o rhev', document it. 2014-08-13 22:10:30 +01:00
Richard W.M. Jones
0a816c020c v2v: Don't disable trace/debug set by environment variables.
If the environment variables LIBGUESTFS_TRACE=1 or LIBGUESTFS_DEBUG=1
were set, then the current code would end up disabling trace/debug if
the command line arguments did not contain -x/-v.

Fix this so the effect of enabling trace/debug is cumulative.
2014-08-13 22:10:29 +01:00
Richard W.M. Jones
5d89c0fd14 p2v: Clean up and fix the code for excluding the root device. 2014-08-13 22:10:29 +01:00
Richard W.M. Jones
67da00d540 p2v: Call the remote libvirt XML file 'guest.xml'.
Previously it was called 'libvirt.conf' which is more than a little
bit confusing.

This is only an internal name, so there is no visible change in
functionality.
2014-08-13 22:10:29 +01:00
Pino Toscano
40fbd447ee build: manually drop flex-/bison-generated files from dist
It seems that Automake cannot handle properly the files generated by
flex and bison, leaving them in the dist tarball.

For now, add a dist-hook to manually prune them from distdir.
2014-08-13 16:43:19 +02:00
Pino Toscano
577ec51a4c fish: add test-invalid-params.sh to EXTRA_DIST
Followup of commit 7912759fc3.
2014-08-13 15:16:55 +02:00
Richard W.M. Jones
6a51ae503c builder: Missing include of <locale.h>.
Required by setlocale.  For some reason you only see the error
when compiling with -O0.
2014-08-13 13:52:48 +01:00
Richard W.M. Jones
34feb37879 lib: Typo in comment. 2014-08-13 13:52:48 +01:00
Pino Toscano
841b20c39c python: fix possible free on uninit memory with OStringList optargs
When using optional arguments of type OStringList, the code free'ing
the member in the optargs_s struct corresponding to that optional
argument would just check for a non-PyNone PyObject for that argument.
If before that optional argument there are other arguments which can
cause an earlier error return from that binding function, the free'ing
code will then act on garbage values.

Enhance the check by also checking whether the optargs struct has the
bitmask with the element for that argument, meaning that the
corresponding struct member was initialized.
2014-08-12 10:16:18 +02:00
Pino Toscano
abbbc832d5 p2v: check results of strndup and sscanf 2014-08-11 17:36:51 +02:00
Richard W.M. Jones
bbae6136ab p2v: Move libutils before libxml2 in the list of libraries (RHBZ#1102447).
The error is:

../src/.libs/libutils.a(
libutils_la-cleanup.o): In function `guestfs___cleanup_xmlBufferFree':
cleanup.c:(.text+0x79): undefined reference to `xmlBufferFree'
../src/.libs/libutils.a(libutils_la-cleanup.o): In function
`guestfs___cleanup_xmlFreeDoc':
cleanup.c:(.text+0x99): undefined reference to `xmlFreeDoc'
[etc.]

Thanks: Arnaud Gaboury
2014-08-11 14:53:19 +01:00
Pino Toscano
a26a9e6881 df: unlock retire_mutex on early exit
If pthread_cond_wait fails and the thread worker ends, make sure to
unlock retire_mutex, which has been locked for the condition.

The return value of pthread_mutex_unlock is ignored, as there's nothing
that can be done with it at that point.
2014-08-08 17:13:02 +02:00
Pino Toscano
bb12455215 daemon: use CLEANUP_CLOSE 2014-08-08 15:35:02 +02:00
Pino Toscano
4249ddd8bb daemon: add CLEANUP_CLOSE
Just call close on the specified fd, if valid.
2014-08-08 15:34:07 +02:00
Pino Toscano
ad4ba5997b daemon: blkid: fix memory issues in "no -p/-i" mode
Fix the memory issues in the implementation that uses no -p nor -i:
- use add_string_nodup to add results from get_blkid_tag (which returns
  new strings), so those strings are not leaked
- use free_stringslen to clean the hash on error, as in such case the
  stringbuf will not be terminated with a null entry, thus causing
  free_strings to crash
2014-08-08 14:58:08 +02:00
Pino Toscano
fef0881b3a tests: c-api: do not crash w/ missing hash entry
If an hash does not have the requested key, just error out cleanly
instead of crashing when trying to compare a null string.
2014-08-08 14:56:27 +02:00
Pino Toscano
8d23fb31f1 daemon: initialize memory when handling DeviceList params
When dealing with DeviceList parameters, the generator produces code
similar to the following:

  CLEANUP_FREE_STRING_LIST char **devices = NULL;
  [...]
  devices = malloc (sizeof (char *) * (args.devices.devices_len+1));
  {
    size_t i;
    for (i = 0; i < args.devices.devices_len; ++i)
      RESOLVE_DEVICE (args.devices.devices_val[i], devices[i],
                      , goto done);
    devices[i] = NULL;
  }

The block hidden within the RESOLVE_DEVICE macro is supposed to
assign something to devices[i]; on the other hand, the code in
RESOLVE_DEVICE can cause to just end (with an error) the current RPC,
which would cause the cleanup of the "devices" array... whose members
from the i-th to the (args.devices.devices_len-1)-th would be garbage
pointers, causing random memory to be free'd (and thus crashing the
daemon).

Avoid the access to garbage memory just by having a cleaned "devices"
array, so there will be always a NULL element after the initialized
members.

Add a test for vgcreate which passes a wrong device path causing the
situation above, to test that vgcreate would fail gracefully.
2014-08-08 13:49:59 +02:00
Pino Toscano
d1f580550b rescue: fix sscanf placeholders for --smp and --memsize
Use %d to parse them as int (since the variables for them as int)
instead of %u, even if they both need to be at least > 0; the library
will check for the validity of them anyway.
2014-08-08 11:20:19 +02:00
Pino Toscano
7912759fc3 src: always check value passed to set_memsize
Move the minimum memory check from the environment parsing to
set_memsize, so the limit is actually enforced also when using the API.

Adapt the rhbz557655.sh test to the invalid memsize values being
rejected now, and add a new test for checking invalid parameters
explicitly.
2014-08-08 11:20:12 +02:00
Pino Toscano
5fddd93205 lua: always return luaL_error in actions
Even if luaL_error is a "no return" function for the Lua runtime, adopt
also in action functions the "return" idiom recommeded for it.

This also helps code analyzers in not thinking that "g" might still be
null after the null check followed by luaL_error.
2014-08-08 09:48:36 +02:00
Richard W.M. Jones
5ce1234007 aarch64: Add common function for getting the CPU model.
And force a 64 bit CPU model when running on aarch64 with TCG.
2014-08-07 14:54:52 +01:00
Pino Toscano
f5c74637e3 daemon: add and use a reply_with_unavailable_feature macro
Handy macro to reply the right way for an unavailable feature.
While generally used so far in generated code, it can shorten that a
bit, and avoid copy&paste when wanting to do manual feature checking.
2014-08-07 10:45:04 +02:00
Richard W.M. Jones
59584e1814 Version 1.27.25. 2014-08-05 18:06:22 +01:00
Richard W.M. Jones
40cecb4b9c v2v: Add RHEV target.
Use:

  virt-v2v [..] -o rhev -os nfs:/export

or:

  virt-v2v [..] -o rhev -os /mountpoint

to write to a RHEV-M / oVirt Export Storage Domain.
2014-08-05 16:46:55 +01:00
Richard W.M. Jones
95c3b78f08 v2v: Keep more inspection data in the inspect struct.
Just code motion, no functional change.
2014-08-05 10:07:54 +01:00
Richard W.M. Jones
e82c0c5e55 v2v: Fix bytecode build. 2014-08-04 17:20:03 +01:00
Richard W.M. Jones
b6cb67d958 ./run: chcon the tmp directory in the builddir.
Not just some random tmp directory which happens to be in the
local directory.
2014-08-04 14:51:30 +01:00
Richard W.M. Jones
e1c508c29f launch: Close file descriptors after fork (RHBZ#1123007).
This refactors existing code to close file descriptors in the recovery
process, and also adds code to close file descriptors between the
fork() and exec() of QEMU or User-Mode Linux.

The reason is to avoid leaking main process file descriptors where the
main process (or other libraries in the main process) are not setting
O_CLOEXEC at all or not setting it atomically.  Python is a particular
culprit.

See also this OpenStack Nova bug report:
https://bugs.launchpad.net/nova/+bug/1313477

Thanks: Qin Zhao for identifying and characterizing the problem in Nova.

This is version 2 of this commit.  This commit is identical to the
reverted commit 115fcc3432 except that
we don't close stderr.
2014-07-30 14:24:46 +01:00
Richard W.M. Jones
e0ba7855f4 html: Don't build HTMLFILES for disabled features. 2014-07-30 14:19:30 +01:00
Richard W.M. Jones
286f116691 Revert "launch: Close file descriptors after fork (RHBZ#1123007)."
This attempted fix for RHBZ#1123007 causes the qemu command line to be
lost when verbose mode is enabled.  Since this is essential for
debugging many problems, I am reverting the patch.

This reverts commit 115fcc3432.
2014-07-29 22:27:29 +01:00
Richard W.M. Jones
1d596eb7e6 tests: qemu-speed-test: Allow test time to be adjusted with -t option.
This is useful when analysing with `perf' since it allows us to
increase the amount of time in the test versus the amount of time
spent starting the appliance.
2014-07-29 20:27:53 +01:00
Richard W.M. Jones
1c7da06327 tests: qemu-speed-test: Allow tests to be run selectively. 2014-07-29 12:36:43 +01:00
Richard W.M. Jones
f342cfc69d tests: qemu-boot: Error if extra command line arguments are given. 2014-07-29 12:36:43 +01:00
Pino Toscano
043cf4fbe3 launch: direct: check for null paths in make_uri
Some protocols may pass a null path to make_uri, so make sure to handle
that gracefully.
2014-07-28 19:29:14 +02:00
Pino Toscano
8ea6b3e03c make-fs: do not leak the fd from mkstemp 2014-07-28 17:27:30 +02:00
Pino Toscano
2fe93bda9f make-fs: respect libguestfs' temporary dir
Do not hardcode /tmp.
2014-07-28 17:24:02 +02:00
Richard W.M. Jones
50e3ef3357 Version 1.27.24. 2014-07-26 21:37:59 +01:00
Richard W.M. Jones
1b925a0efb build: Add `maintainer-commit' rule to create a new version commit. 2014-07-26 21:27:16 +01:00
Pino Toscano
08bfd9e41b p2v: close the mexp handle if mexp_spawnv fails 2014-07-26 18:24:52 +01:00
Pino Toscano
9c3ce6535c make-fs: use CLEANUP_FCLOSE 2014-07-26 18:24:52 +01:00
Pino Toscano
9e7f5300c9 cleanups: add CLEANUP_FCLOSE (fclose on FILE*) 2014-07-26 18:24:52 +01:00
Pino Toscano
d8b9ce65c2 p2v: properly call va_end 2014-07-26 18:24:52 +01:00
Richard W.M. Jones
7378edb9fa Add qemu-speed-test program to test speed of qemu.
Currently it tests the upload and download speed of virtio-serial and
the read and write speed of the block device (eg. virtio-scsi).
2014-07-25 22:48:09 +01:00
Richard W.M. Jones
115fcc3432 launch: Close file descriptors after fork (RHBZ#1123007).
This refactors existing code to close file descriptors in the recovery
process, and also adds code to close file descriptors between the
fork() and exec() of QEMU or User-Mode Linux.

The reason is to avoid leaking main process file descriptors where the
main process (or other libraries in the main process) are not setting
O_CLOEXEC at all or not setting it atomically.  Python is a particular
culprit.

See also this OpenStack Nova bug report:
https://bugs.launchpad.net/nova/+bug/1313477

Thanks: Qin Zhao for identifying and characterizing the problem in Nova.
2014-07-25 16:28:09 +01:00
Richard W.M. Jones
f18464995f tests: builder: Allow test to be skipped. 2014-07-25 16:06:46 +01:00
Richard W.M. Jones
81cafdcfd5 virt-resize: Unmount filesystem after testing size.
We were mounting different filesystems on top of each other.  In fact
this is not a problem, but it's nicer to unmount each filesystem
properly after examining it.
2014-07-25 16:04:18 +01:00
Richard W.M. Jones
fc7da04ccd daemon: Add extra debugging to umount_all command.
No functional change, just prints some more debug messages.
2014-07-25 16:03:09 +01:00
Richard W.M. Jones
146cc78b7d aarch64: Use a smaller test file for test-cancellation-upload-daemoncancels.sh
This test worked by uploading a 100MB file into a 100MB container and
seeing the inevitable crash.  Unfortunately virtio-mmio (used on
aarch64) is quite slow.  Since this test is not testing the speed of
virtio-mmio, use a smaller test file so the test finishes in a
reasonable time.
2014-07-25 15:28:46 +01:00
Richard W.M. Jones
d268de9394 tests: hotplug: Allow tests to be skipped.
They don't work on aarch64.
2014-07-25 14:43:06 +01:00
Richard W.M. Jones
64498034bb tests: lvm: Allow test to be skipped. 2014-07-25 10:04:44 +01:00
Richard W.M. Jones
7f826e1296 Version 1.27.23. 2014-07-23 17:40:16 +01:00
Richard W.M. Jones
d682dad186 aarch64: Add comment about efi-rtc=noprobe option.
This updates commit 5326689d50.
2014-07-23 17:09:59 +01:00
Richard W.M. Jones
bcdbe6405c v2v: Add support for converting Windows guests.
This completes commit f296d34f3b.
2014-07-23 17:02:49 +01:00
Richard W.M. Jones
f4698575cc customize: Add the ability to use --firstboot for Windows guests.
This allows you to add potentially multiple --firstboot
scripts to a Windows guest.
2014-07-23 17:02:49 +01:00
Richard W.M. Jones
199fa26950 mllib: Add regedit mini-library.
This library replaces Win::Hivex::Regedit, or at least enough for us
to be able to make the simple Registry modifications needed for
installing firstboot scripts.
2014-07-23 17:02:43 +01:00
Richard W.M. Jones
9c49590d42 customize: firstboot: Move Linux-specific functions into Linux submodule.
No functional change.
2014-07-23 15:09:56 +01:00
Richard W.M. Jones
12b54ef5e3 sparsify: Relax requirement that output device cannot be block device (RHBZ#1122557).
To fix RHBZ#1056290, I prevented virt-sparsify being used if the
output device is a block device.

I have now retested this scenario and it does work (in both copying
and in-place mode), and does not delete the output device, and
therefore we can relax this restriction so only char devices are
banned.

This is useful for oVirt which uses a qcow2 formatted block device to
store virtual machines.
2014-07-23 15:09:48 +01:00
Richard W.M. Jones
897b136aa8 Update translations from Transifex. 2014-07-22 19:10:22 +01:00
Richard W.M. Jones
e7ae071f60 Version 1.27.22. 2014-07-21 14:36:53 +01:00
Richard W.M. Jones
5326689d50 aarch64: efi-rtc=noprobe is needed to fix boot of upstream kernel on VM. 2014-07-21 13:54:43 +01:00
Pino Toscano
f4026d779e configure: look for "default-java" as directory for Java
In Debian-based systems, /usr/lib/jvm/default-java is a symlink
pointing to the location of the default Java version.
2014-07-18 09:57:04 +02:00
Richard W.M. Jones
de5924a229 tests: Add test program to run qemu/appliance repeatedly.
For example:

  $ time ./run ./tests/qemu/qemu-boot -n 100
  real 1m19.794s
  user 0m10.001s
  sys  0m5.928s

will run 100 appliance start/stops, from multiple threads.
2014-07-17 22:31:59 +01:00
Richard W.M. Jones
83790960d6 valgrind: Tweak the suppression matching OCaml leak in caml_search_in_path.
In OCaml 4.02 this still leaks, but the stack trace is slightly
different so the old suppression didn't match it.
2014-07-17 11:40:41 +01:00
Richard W.M. Jones
333ddf208b tests: Add a protocol regression test for long error messages. 2014-07-17 11:40:41 +01:00
Richard W.M. Jones
4106c97934 daemon: Truncate long error messages so XDR encoding doesn't fail. 2014-07-17 11:40:41 +01:00
Richard W.M. Jones
4d3953f092 Warn about large stack frames, and fix a few places with excessive stack usage. 2014-07-17 11:40:40 +01:00
Richard W.M. Jones
00c94d808b tests: Remove tests/protocol/test-qemudie-launchfail.sh
This test has not been run since 2012 as it depends on specifics of
how supermin and new-style appliances work (see
commit 2d89aef897).

This commit removes the test entirely.
2014-07-17 11:40:40 +01:00
Richard W.M. Jones
fa3d6e55b2 tests: qemu: Fix TCG test.
$guestfish was not defined, so the UML test/skip did not do anything.
2014-07-16 13:40:37 +01:00
Richard W.M. Jones
9cdaaeee40 tests: regressions: Allow non-exec stack test to be skipped.
Currently fails on aarch64 because of a buggy GCC.
2014-07-15 22:56:22 +01:00
Richard W.M. Jones
9e01541e48 tests: 9p: aarch64 also uses virtio-mmio (instead of virtio-pci). 2014-07-15 22:56:22 +01:00
Richard W.M. Jones
2d01e06fc9 tests: regressions: Skip test on aarch64 which also does not support IDE. 2014-07-15 22:56:22 +01:00
Richard W.M. Jones
fe9d3f7a90 ocaml: Ignore Warning 3: deprecated feature: String.* functions.
In OCaml 4.02, the 'string' type can be made immutable.  All String.*
functions that are concerned with creating or mutating strings now
give a warning like this:

  Warning 3: deprecated feature: String.unsafe_set

Disable this warning since we don't want to turn on immutable strings
yet.
2014-07-15 17:51:52 +01:00
Richard W.M. Jones
d71ec218ea aarch64: Add some earlyprintk debugging. 2014-07-15 17:44:37 +01:00
Richard W.M. Jones
57c7417f89 aarch64: Use console=ttyAMA0 instead of console=ttyS0.
This still only prints early console messages.  Output stops
after:

  bootconsole [earlycon0] disabled

but I have not found any way to get later kernel messages.
2014-07-15 17:44:37 +01:00
Richard W.M. Jones
9d8ede1ae4 sysprep: Standard exception handling, taken from virt-builder & virt-v2v. 2014-07-15 17:38:32 +01:00
Richard W.M. Jones
f913ca5ebc customize: Use Common_utils.error function instead of failwith.
This is just code refactoring.
2014-07-15 17:38:32 +01:00
Richard W.M. Jones
82cf3c9d68 customize: Update copyright messages.
No functional change.
2014-07-15 17:38:32 +01:00
Richard W.M. Jones
f955fec760 docs: Remove useless "SHELL QUOTING" section from manual pages. 2014-07-15 17:38:31 +01:00
Richard W.M. Jones
9b47a53a4b sparsify: Add --tmp prebuilt:file option.
This option allows oVirt to pass a prebuilt qcow2 file to use as the
temporary overlay.  The file must be qcow2, and must have indisk as a
backing file - the code does minimal checks to ensure this is correct.

Example usage:

  qemu-img create -f qcow2 -b indisk overlay.qcow2
  virt-sparsify indisk --tmp prebuilt:overlay.qcow2 outdisk

Note this only applies in copying mode.
2014-07-15 17:38:31 +01:00
Pino Toscano
66aa98265d appliance: init: run ldconfig
Run ldconfig early in the init script, so libraries outside standard
library paths but with a proper ld.so configuration file pointing at
them can be found.
2014-07-15 11:06:32 +02:00
Richard W.M. Jones
a791e08163 RHEL 6: p2v: Add fix for older PCRE.
RHEL 6 pcre did not define PCRE_PARTIAL_SOFT.  However PCRE_PARTIAL is
a synonym so use that.
2014-07-11 10:40:06 +01:00
Richard W.M. Jones
17bf3ce21c Version 1.27.21. 2014-07-08 14:11:57 +01:00
Richard W.M. Jones
f296d34f3b v2v: Add partial support for converting Windows guests.
This is not yet complete.
2014-07-08 14:11:48 +01:00
Richard W.M. Jones
2ee1fb6472 builder: CentOS 7.0 2014-07-08 10:12:10 +01:00
Pino Toscano
71ac957d4a Use Mkdtemp.temp_dir instead of Mkdtemp.mkdtemp 2014-07-07 19:33:44 +02:00
Pino Toscano
c8f3e99302 mllib: introduce Mkdtemp.temp_dir
Add a simple function to ease the usage of Mkdtemp.mkdtemp.
2014-07-07 19:30:29 +02:00
Pino Toscano
3fc6983b16 inspect: ignore /etc/fstab with no entries (RHBZ#1113156).
Just like no /etc/fstab is not an error, having one with no entries
shouldn't be an issue either.

With systemd, this could be a valid setup, with mount points set its own
way.
2014-07-07 11:40:19 +02:00
Richard W.M. Jones
3f2e18efde valgrind: Add suppress for libvirt memory leak in virFileFindResourceFull.
https://bugzilla.redhat.com/show_bug.cgi?id=1116427
2014-07-04 15:48:36 +01:00
Richard W.M. Jones
2fe74642f4 launch: direct: Use -cpu host when using KVM on x86.
This is the same as what the libvirt backend does.
2014-07-03 12:16:32 +01:00
Richard W.M. Jones
fc9647bb4d mllib: Remove trailing whitespace.
This fixes commit b24b0b17a8.
2014-07-02 23:09:53 +01:00
Richard W.M. Jones
bf47ed1b6a tests: qemu: Test force_tcg setting is effective. 2014-07-02 18:20:51 +01:00
Richard W.M. Jones
2369e9c2d6 log: Pass correct parameter to localtime_r on 32 bit platforms.
We were passing an int64_t which happens to be the same as time_t, but
only on 64 bit.  This didn't work on 32 bit (or rather, it works on
little endian, but only by accident).

This fixes commit fb546eaee0.
2014-07-02 16:51:36 +01:00
Richard W.M. Jones
a2747578eb journal: Fix binding of sd_journal_get_realtime_usec on 32 bit machines.
sd_journal_get_realtime_usec is defined as:

    int sd_journal_get_realtime_usec(sd_journal* j, uint64_t* usec);

Unfortunately we passed size_t* as the second argument.  This happened
to work on 64 bit machines because size_t is 64 bit there, but failed
on 32 bit machines, where we didn't pass a sufficiently large result
buffer.

This fixes commit 2d996df66c.
2014-07-02 16:51:36 +01:00
Richard W.M. Jones
1e1d7cf6af excludefiles: Exclude various common log files when building the appliance.
These log files can get pretty big, and that causes problems
like this one:

http://linuxforum.ru/viewtopic.php?id=35381

and this one:

https://bugzilla.redhat.com/show_bug.cgi?id=1099172

In both cases the problem was /var/log/lastlog which is apparently a
large sparse file.  Supermin cannot cope with sparseness, so it copies
the whole file non-sparse.  But since this could affect other log
files this commit covers various common log file names and patterns.

Thanks: semperN
2014-07-02 14:27:53 +01:00
Richard W.M. Jones
f40e11ace4 Version 1.27.20. 2014-07-02 13:54:16 +01:00
Richard W.M. Jones
5d48f7a792 Update gnulib to latest version. 2014-07-02 13:22:18 +01:00
Richard W.M. Jones
144a86ac8c v2v: Change fstrim message to warning.
This also ensures it is flushed and translated.
2014-07-01 16:21:55 +01:00
Richard W.M. Jones
dbe0b69f24 v2v: Remap block device names in grub & /etc/fstab.
eg. Change /dev/hda to /dev/vda
2014-07-01 16:21:55 +01:00
Richard W.M. Jones
120d61cf56 v2v: Kill kudzu dead. 2014-07-01 16:21:55 +01:00
Richard W.M. Jones
838dce6557 v2v: When converting Linux guests, rebuild the initrd.
It probably needs to be rebuilt to add virtio drivers.
2014-07-01 16:21:55 +01:00
Richard W.M. Jones
a32d92e420 v2v: When inspecting Linux guests, collect kernel version & location of initrd file too. 2014-07-01 16:21:54 +01:00
Richard W.M. Jones
5cf5c3f1c7 v2v: Change source disk into a struct.
Simple code refactoring, allowing us to collect the target/@dev
attribute in this (now) structure.
2014-07-01 16:21:54 +01:00
Richard W.M. Jones
544b087d4b generator: Sort the structs.
Sort the structs when generating code.  Since the structs are
logically indepedent of each other, this should have no effect except
to make generated files list the structs in a different order.

However this also fixes the following build problem:

  File "convert_linux.ml", line 322, characters 43-50:
  Error: This expression has type G.stat = Guestfs.stat
    but an expression was expected of type G.dirent = Guestfs.dirent

It turns out the OCaml bindings don't like the fact that we have
two structs with a common field name (dirent.ino and stat.ino).

In OCaml < 4.01, this means that any attempt to reference stat.ino
would fail because dirent.ino appears second in the file, overriding
stat.ino.

Sorting the structs has the side effect of making stat.ino appear
second, thus resolving the build failure above.

In OCaml >= 4.01 the compiler now uses some disambiguation rules based
on the known types to resolve this problem, so accessing either field
would work no matter what order they are listed in.

See:

http://ocaml.org/releases/4.01.0.html
http://www.lexifi.com/blog/type-based-selection-label-and-constructors
http://www.lexifi.com/blog/ocaml-extensions-lexifi-overidding-record-labels-and-constructors
2014-07-01 16:21:54 +01:00
Richard W.M. Jones
16e817456c v2v: Modify conversion step to first do proper inspection and data
gathering about the guest.
2014-06-25 13:58:32 +01: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
5d3ec4474c mllib: Rewrite text wrapping function so it can handle newlines within the text. 2014-06-24 16:19:23 +01:00
Richard W.M. Jones
9aa0969d8d virt-cat, virt-ls, virt-edit: Fix typo in documentation.
This fixes the following:
 commit aad3c467fb
 commit de5e7331af
 commit 86706907af
2014-06-24 12:24:53 +01:00
Richard W.M. Jones
e46bbb45d1 Version 1.27.19. 2014-06-24 08:28:28 +01:00
Richard W.M. Jones
77a963886f v2v: Refactor common code for listing files in packages.
At some point we should make these into real libguestfs inspection
APIs.  However they are fairly hard to implement, at least for RPM.
2014-06-23 21:58:11 +01:00
Richard W.M. Jones
7a68afed14 v2v: Move app2_version comparison functions to utils.
Refactoring.
2014-06-23 21:58:11 +01:00
Richard W.M. Jones
5b29d9a1a8 v2v: Create apps_map when doing inspection step. 2014-06-23 21:58:11 +01:00
Richard W.M. Jones
6705be2379 v2v: Create a shared StringMap module. 2014-06-23 21:58:11 +01:00
Richard W.M. Jones
9975bf8eb3 v2v: Rename Convert_linux_enterprise -> Convert_linux.
Just module rename.
2014-06-23 21:58:11 +01:00
Richard W.M. Jones
76bf3f7289 v2v: Rename Convert_linux_common -> Lib_linux.
Just library name refactor.
2014-06-23 21:58:10 +01:00
Richard W.M. Jones
6f73266363 mllib: Add a common 'warning' utility function.
This commit changes many places in OCaml utilities that print
warnings to use the warning function instead.
2014-06-23 21:58:10 +01:00
Richard W.M. Jones
b24b0b17a8 mllib: Add an interface for Common_utils library.
It turned out that Common_utils was exporting the 'G' module (an alias
for Guestfs).  We want any code that uses G as a shortcut to declare:

  module G = Guestfs

at the top, since that avoids confusion for newbie (or experienced)
OCaml programmers.
2014-06-23 21:58:10 +01:00
Richard W.M. Jones
273f346465 v2v: Warn only if virtio packages are missing from the guest.
In this version of virt-v2v you have to install a virtio
capable kernel before doing the conversion.
2014-06-23 21:58:10 +01:00
Richard W.M. Jones
8ed27e7865 v2v: In convert function, add a hash of app name -> app structure.
For quicker lookups than searching the linear list.
2014-06-23 21:58:10 +01:00
Richard W.M. Jones
7b89f657c4 mllib: Move common code for comparing version strings to library. 2014-06-23 21:58:10 +01:00
Richard W.M. Jones
90bf3422c5 v2v: When parsing input libvirt XML, get correct disk image format.
Old Xen PV guests had:

      <driver name='tap' type='aio'/>

The previous xpath expression matched any driver type attribute in
order to pick up the format.  However we only want to match:

      <driver name='qemu' type='raw'/>

so we need to check the name attribute as well.
2014-06-23 21:58:09 +01:00
Richard W.M. Jones
af31670d03 v2v: Avoid segfault if xpath expression doesn't match any nodes.
I'm not sure if this indicates that the xpath expression is wrong, but
in any case it can be that xpathobj->nodesetval is NULL.  In this
case, return 0 from xpathobj_nr_nodes instead of segfaulting.
2014-06-23 21:58:09 +01:00
Richard W.M. Jones
877583a6f4 v2v: In -o local mode, name disks <name>-sda instead of disk-sda.
This allows us to use the same shared output directory for multiple
parallel tests.
2014-06-23 21:58:09 +01:00
Richard W.M. Jones
8ad5698d02 v2v: Print \n after warnings.
Using eprintf so this is not implicit (unlike 'error' function).
2014-06-23 21:58:09 +01:00
Richard W.M. Jones
beef28fe96 v2v: Dump out 'source' structure when debugging. 2014-06-23 21:58:09 +01:00
Richard W.M. Jones
2f61634215 v2v: string_of_overlay already has trailing \n, don't need to add one. 2014-06-23 21:58:09 +01:00
Richard W.M. Jones
437e387c4d v2v: Print qemu-img source overlay command when using -v. 2014-06-23 21:58:08 +01:00
Richard W.M. Jones
c62dbb8afd run: Add v2v/ subdirectory to $PATH. 2014-06-23 21:58:08 +01:00
Richard W.M. Jones
27e1b6ca8b v2v: Allow relative paths to appear in -i libvirtxml input.
When writing libvirt XML by hand, or for tests, this is
immensely useful.
2014-06-23 21:58:08 +01:00
Richard W.M. Jones
c3c659e996 rescue: Use guestfs_add_drive_scratch to implement the --scratch option. 2014-06-23 21:58:08 +01:00
Richard W.M. Jones
bb3ba0c43a options: Compile out part of union which cannot be used when not compiling guestfish. 2014-06-23 21:58:08 +01:00
Pino Toscano
86706907af edit: add -m option
Implement the -m/--mount as available in guestfish to override the
automatic introspection and specify which partitions to mount instead.
2014-06-23 15:56:15 +02:00
Pino Toscano
de5e7331af cat: add -m option
Implement the -m/--mount as available in guestfish to override the
automatic introspection and specify which partitions to mount instead.
2014-06-23 15:54:00 +02:00
Pino Toscano
aad3c467fb ls: add -m option
Implement the -m/--mount as available in guestfish to override the
automatic introspection and specify which partitions to mount instead.
2014-06-23 14:44:40 +02:00
Richard W.M. Jones
54c77f99cc builder: Update centos.sh to add CentOS 7 QA. 2014-06-20 11:08:24 +01:00
Richard W.M. Jones
8d6cbd05ca website: Install HTML version of the virt-log(1) man page on the website. 2014-06-17 17:40:48 +01:00
Richard W.M. Jones
cd111bd0e3 virt-v2v: Remove text from README, moved into test data repo.
There is (will be) a new repository containing the large/proprietary
test images.  Move the README related to this to the new repo.
2014-06-17 17:40:00 +01:00
Richard W.M. Jones
e6a067e183 Version 1.27.18. 2014-06-16 12:49:02 +01:00
Richard W.M. Jones
98a1392849 virt-log: Fix memory leak because of wrong type of CLEANUP_* function.
This fixes commit a3475cf9bbbbd3514b117d5edd75d9c0e239d43a.
2014-06-16 12:25:05 +01:00
Richard W.M. Jones
cd15b2ead6 Version 1.27.17. 2014-06-16 10:53:59 +01:00
Richard W.M. Jones
c1dd8e80ba tests/guests: Add new file debian-syslog to EXTRA_DIST.
This fixes commit 026342a7ee.
2014-06-16 10:50:58 +01:00
Richard W.M. Jones
0c38cd4d25 virt-log: Add support for displaying the Windows Event Log.
Uses the external program python-evtx, and this only works
for Windows >= Vista.
2014-06-16 10:32:10 +01:00
Richard W.M. Jones
d167da86d9 virt-log: do_log_journal: return instead of exiting immediately.
This cleans up commit a3475cf9bbbbd3514b117d5edd75d9c0e239d43a.
2014-06-16 10:32:10 +01:00
Richard W.M. Jones
fb546eaee0 New tool: virt-log: It lists log files from within the guest.
See 'TODO' file for suggested future improvements.
2014-06-14 13:58:45 +01:00
Richard W.M. Jones
026342a7ee tests: guests: Add a text syslog file to the phony Debian guest. 2014-06-14 13:38:56 +01:00
Richard W.M. Jones
2d996df66c New API: journal_get_realtime_usec
This adds a binding for sd_journal_get_realtime_usec(3).
2014-06-14 13:38:56 +01:00
Richard W.M. Jones
e5276e4455 Version 1.27.16. 2014-06-13 22:48:18 +01:00
Richard W.M. Jones
31c07bc9d8 podwrapper: Put =encoding line before first POD directive.
=head isn't always the first POD directive.

This fixes commit 1148bd91ce.
2014-06-13 22:44:38 +01:00
Richard W.M. Jones
1148bd91ce podwrapper: Put the =encoding line at the correct place in the input (RHBZ#1109174).
Commit c4dc70f8c4 broke the man pages
for the Perl scripts in the tools/ directory.

It inserted the =encoding line at the top of the file, instead of in
front of the first =head1 entry, and this meant that the #!/usr/bin/perl
and the prologue became a part of the POD, which was not intended.
2014-06-13 19:59:22 +01:00
Richard W.M. Jones
870c17e99a sparsify: Add --tmp option to allow specifying temp directory or block device.
Add the virt-sparsify --tmp option.

This works in two ways.  Either you can specify a temporary directory,
in which case it's just the same as setting $TMPDIR before:

  virt-sparsify indisk outdisk --tmp /var/tmp

Or, as a new feature, you can specify a block device which is directly
used (and OVERWRITTEN):

  virt-sparsify indisk outdisk --tmp /dev/sdX

This is useful for oVirt nodes, where there is limited temporary
space, but a block device can be assigned to the node.

In both cases it is only used in copying mode.  In-place
sparsification doesn't require large amounts of temporary space.
2014-06-13 19:59:22 +01:00
Richard W.M. Jones
893bfe2e36 mllib: Create a common utility function is_directory.
This is a wrapper around Sys.is_directory which doesn't throw
exceptions.
2014-06-13 19:59:22 +01:00
Richard W.M. Jones
9b5cdc8747 fuse: UID 0 should override all permissions checks (RHBZ#1106548).
Previously if you were root, and you tried to change directory into a
directory which was not owned by you and not readable (eg. 0700
bin:bin), it would fail.

This doesn't fail on regular directories because when you are root the
kernel just ignores permissions.

Although libguestfs in general tries not to duplicate kernel code, in
the case where we emulate the FUSE access(2) system call,
unfortunately we have to do it by stat-ing the object and performing
some (half-arsed) heuristics.

This commit modifies the FUSE access(2) system call, so root is now
able to chdir to any directory.

It also adds some debugging so we can debug these complex permissions
checks in the field if some other problem arises in future.
2014-06-13 19:59:22 +01:00
Richard W.M. Jones
87ac1c186e builder: Don't copy *.xz files to WEBSITEDIR. 2014-06-12 22:18:02 +01:00
Richard W.M. Jones
bacc7fd0a3 builder: Rebuild Fedora 19 disk image with Xen drivers. 2014-06-12 22:13:25 +01:00
Richard W.M. Jones
005316b7d8 builder: Get rid of remaining disk image signatures.
These were deprecated and replaced in virt-builder 1.24.1.
2014-06-12 15:48:55 +01:00
Richard W.M. Jones
58ea77e79b builder: Update Fedora 20 image, with Xen drivers.
This commit also removes the disk image signature.  These have not
been needed since virt-builder 1.24.1.  No one should be running that
version of virt-builder since there are newer 1.24 branch versions.
2014-06-12 15:48:55 +01:00
Richard W.M. Jones
0fa52e4e45 builder: Fedora: Enable Xen driver support.
See:
https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045

Notes:

(1) Edit dracut configuration to make sure the change is permanent, in
case kickstart, virt-builder or something else installs a kernel or
runs dracut.

(2) We need to run dracut on the just-installed kernel, not on the
running kernel.  The snippet to do this was copied from the Fedora
cloud kickstart.

Thanks: Olaf Hering, George Dunlap, Dario Faggioli.
2014-06-12 15:48:54 +01:00
Richard W.M. Jones
d4d6540b24 builder: virt-install now requires '--serial pty' parameter.
This updates commit 73ebaa3066.
2014-06-12 15:48:54 +01:00
Richard W.M. Jones
73ebaa3066 builder: virt-install now seems to require '--serial pty' option. 2014-06-11 12:43:03 +01:00
Richard W.M. Jones
99472ab2e9 builder: Further updates to RHEL 7 GA script.
The location of the trees have moved ... again.
2014-06-11 12:42:08 +01:00
Richard W.M. Jones
24800d2e96 builder: Update rhel.sh script for RHEL 7 GA.
Set the rootfs for RHEL 7.x to xfs.  (/boot is ext4)

Remove old RHEL 7 beta & rc releases.
2014-06-11 08:21:34 +01:00
Richard W.M. Jones
0dbdc470ed Version 1.27.15. 2014-06-10 21:10:27 +01:00
Richard W.M. Jones
7faa602e8f launch: libvirt: Only use serial BIOS (sgabios) on x86.
This device is not present at least on ARM.  Unfortunately libvirt
doesn't give us any way to query when the device is present.

This fixes commit bed592498d.
2014-06-10 19:31:06 +01:00
Pino Toscano
e6a858907f appliance: init: properly set PS1 and TERM for virt-rescue (RHBZ#812970).
Setting environment variables such as PS1 for bash before starting it
might not be effective when the startup scripts provided by the
distribution unconditionally change it.
Hence, set PS1 and TERM in a ~/.bashrc, which will be source'd last and
thus be able to set them the way we want.
2014-06-10 19:09:43 +01:00
Pino Toscano
844066597d daemon: grub: show grub-install's output on error if verbose 2014-06-10 19:09:43 +01:00
Pino Toscano
45db96b00d daemon: print parameters for vgchange in error messages 2014-06-10 19:09:43 +01:00
Pino Toscano
134ac97d22 daemon: retire the augeas feature
Augeas has been a mandatory dependency of libguestfs for quite some
time, so the aug_* functions could have been always called (without even
checking the augeas feature). Thus retire the feature, marking it as
always available with no more functions depending on it.
2014-06-10 11:15:50 +01:00
Pino Toscano
b28ef8791a builder: handle duplicated images (RHBZ#1092753).
Filter the available images, removing the versions with an older
revisions, and duplicates.
2014-06-10 11:14:04 +01:00
Pino Toscano
aeb8792474 inspect: tighten NetBSD detection
It seems recent (?) NetBSD versions have their kernel as /netbsd, so
also check for it to detect NetBSD installations.

The current detection so far basically relied on generic files and
directories which can potentially be in every UNIX system, misdetecting
them if a /etc/release file is present in them.
2014-06-10 11:12:35 +01:00
Pino Toscano
5efbc8922f fish: list also aliases in the guestfish help (RHBZ#1103877).
Output also the aliases (telling which function they refer to) in
`guestfish -h`, together with non-alias functions.
2014-06-10 11:08:28 +01:00
Pino Toscano
6577f34a68 appliance: remove extra comma in Mageia's list
Followup of commit 00d94d95c8.

Thanks Thierry Vignaud for the notice.
2014-06-09 09:59:20 +02:00
Richard W.M. Jones
0196724330 Version 1.27.14. 2014-05-30 18:08:26 +01:00
Pino Toscano
4d8ecb0d30 generator: fix daemon functions with optional params but no mandatory params
The
  struct guestfs_$function_args args;
declaration was not emitted in that case, leading to build failure.
2014-05-29 10:32:15 +02:00
Joseph Wang
00d94d95c8 appliance: Update packagelist for Mageia (RHBZ#1102448). 2014-05-29 08:46:20 +01:00
Richard W.M. Jones
ef49b297cc appliance: Increase udev timeout to 6000s (RHBZ#1096579).
If the image is located on NFS, and the NFS mount is performing a
large copy, then all other NFS operations stop.  This delay can be
large enough that we hit the current 10 minute timeout in udev.

Increasing this to 100 minutes is reported to cure the problem (in
reality we want udev to wait indefinitely).
2014-05-27 11:50:59 +01:00
Pino Toscano
917ca11a76 ruby: add :nodoc: comment for internal methods
This way they are ignored by rdoc.
2014-05-27 11:02:58 +02:00
Pino Toscano
e4005bd530 builder: support aliases for images (RHBZ#1098718). 2014-05-27 10:57:13 +02:00
Richard W.M. Jones
bed592498d launch: libvirt: Add -device sga (sgabios).
This feature was added to libvirt in 2011-07-08 so we can assume it
exists.

Thanks: Jiri Jaburek
2014-05-26 15:27:09 +01:00
Richard W.M. Jones
1fbf0a88f6 fuse: Make all the skip messages consistent in this test. 2014-05-25 22:34:51 +01:00
Richard W.M. Jones
f32aef2971 fuse: Skip test-fuse-umount-race.sh if backing file does not exist. 2014-05-25 22:34:04 +01:00
Richard W.M. Jones
068455f210 fuse: Skip guestmount --fd test if /dev/fuse does not exist.
When we run guestmount (eg. in Koji) it will fail anyway, so don't run
the test.
2014-05-25 22:28:27 +01:00
Richard W.M. Jones
2c460ac52f Version 1.27.13. 2014-05-24 19:17:46 +01:00
Richard W.M. Jones
32f5d99873 fuse: Add a test of guestmount --fd option (RHBZ#1100498). 2014-05-24 18:11:20 +01:00
Richard W.M. Jones
145c7ed5ee fuse: Add guestmount --fd option (RHBZ#1100498).
This implements the guestmount --fd option to allow you to run
guestmount captive under another process (typically using
`guestmount --fd=<FD> --no-fork').

See: https://bugzilla.redhat.com/show_bug.cgi?id=1100498
2014-05-24 18:11:20 +01:00
Hilko Bengen
a60212ee99 golang: Fix for out-of-tree builds
RWMJ:

This is half of a downstream Debian patch to fix out-of-tree builds
for golang.
2014-05-24 18:11:19 +01:00
Richard W.M. Jones
ee9981714f Version 1.27.12. 2014-05-23 11:04:20 +01:00
Pino Toscano
5d5e66ce33 daemon: scrub-file: resolve the path before calling scrub (RHBZ#1099490).
Resolve the given path within the chroot, so scrub can be invoked
outside the chroot on an already-resolved path.

Add few tests in scrub-file for this and other similar issues.
2014-05-21 15:03:17 +02:00
Pino Toscano
d7aec9c0d3 daemon: add sysroot_realpath
Similar to sysroot_path, but first resolves (using realpath) the given
path within sysroot.
2014-05-21 15:01:50 +02:00
Pino Toscano
05f84f4c21 Make realpath mandatory
commit a86eb0e0d2 made it an optional
feature, as on Windows it was not available; on the other hand, realpath
has been used unconditionally already for quite some time, so having
just the "realpath" command conditional on the presence of it does not
make much sense.

Drop the configure/build system handling of it, make the "realpath"
command no more optional, and keep the "realpath" feature as
unconditionally available now.
2014-05-21 14:58:40 +02:00
Pino Toscano
50ed922a02 generator: add always-available optgroups
Support the possibility to have optional groups always enabled (e.g.
because they were present in the past, and they need to be kept for
users).
Add and use few helper optgroups-related functions to deal also with
them.
2014-05-21 14:51:42 +02:00
Richard W.M. Jones
865f64006e ppc64: Use console=hvc0 console=ttyS0.
console=ttyS0 used to work.  Now it's broken again, and the correct
setting appears to be console=hvc0.  Since we can pass multiple
console settings, do that to try and catch the right console.
2014-05-21 09:36:34 +01:00
Richard W.M. Jones
84189b370a Update guestfs-release-notes.txt.
This updates commit a21dfc483c.
2014-05-20 13:13:39 +01:00
Pino Toscano
697b0d4678 fish: simplify output of 'supported'
Print each line at once, making use of the padding features of printf
instead of doing it manually.
2014-05-20 13:09:27 +01:00
Richard W.M. Jones
a21dfc483c Fix some spelling mistakes and typos in documentation (RHBZ#1099284). 2014-05-20 10:45:33 +01:00
Richard W.M. Jones
e014ef33ab Update BUGS. 2014-05-20 10:40:17 +01:00
Richard W.M. Jones
f49e003a87 p2v-iso: Add a kickstart target.
This also changes the old p2v-iso/README file into a POD file
which is installed as a manual page.
2014-05-19 22:26:53 +01:00
Richard W.M. Jones
1939cd4849 p2v-iso: unset CDPATH, set -e at the top of the virt-builder-target script. 2014-05-17 11:49:13 +01:00
Richard W.M. Jones
c65fbeebb8 configure: Move --with-default-backend test later in configure.ac.
For some reason this test was right at the top of the script.
2014-05-17 11:49:13 +01:00
Richard W.M. Jones
c5106511e0 build: Use AC_PROG_AWK to define the right awk to call.
We actually call plain 'awk' in many different scripts, but this
commit does not change all of those.
2014-05-17 11:49:13 +01:00
Richard W.M. Jones
044ecdb903 builder: Make the summary printed at the end easier to read.
This is just a whitespace change.  The new output looks like this:

                   Output file: fedora-20.img
                   Output size: 4.0G
                 Output format: raw
            Total usable space: 5.2G
                    Free space: 4.5G (86%)
2014-05-17 10:38:59 +01:00
Richard W.M. Jones
467bddd3b7 p2v-iso: Use xorg-x11-drivers meta-package to install Xorg drivers.
Thanks: Andrew Price.
2014-05-16 12:54:46 +01:00
Richard W.M. Jones
8e6ddbdf70 Version 1.27.11. 2014-05-16 11:10:06 +01:00
Richard W.M. Jones
a09146386c virt-p2v: Install the binary in libexecdir.
Previously it wasn't installed at all.  However it makes sense to
install it somewhere so that it can be placed in a package (a
requirement if we're going to create a kickstart).  By placing it in
libexecdir it is hopefully clear that it should not be used.

Note on Red Hat distros, libexecdir is usually /usr/libexec.  On
Debian it is usually /usr/lib/libguestfs.
2014-05-16 10:57:48 +01:00
Pino Toscano
45971ab952 build: bump the libsystemd-journal needed version to 196
Bump to >= v196 the minimum version of libsystemd-journal needed for the
journal integration, since that version provides
sd_journal_get_data_threshold and sd_journal_set_data_threshold.
2014-05-16 11:05:40 +02:00
Richard W.M. Jones
77166308fa Version 1.27.10. 2014-05-15 23:00:46 +01:00
Richard W.M. Jones
047b6d3050 Add p2v-iso directory containing scripts for building the virt-p2v ISO.
It is not possible to have the ISO be built automatically when the
user runs 'make'.  The README file describes how you should go about
building the ISO or disk image.
2014-05-15 22:05:39 +01:00
Richard W.M. Jones
fd82bb12fd New tool: virt-p2v.
This is a graphical standalone front-end to virt-v2v which can be run
on physical machines (usually linked into a ISO or PXE boot image) to
convert the physical machine to a virtual machine.
2014-05-15 22:05:39 +01:00
Richard W.M. Jones
0131d6f666 New tool: virt-v2v.
This is a rewrite of the original virt-v2v tool.  The original was
written by Matt Booth et al in Perl between 2009 and 2013.
2014-05-15 22:05:39 +01:00
Maros Zatko
40d9609b29 generator: Change link to OCaml tutorials. 2014-05-15 14:45:00 +01:00
Richard W.M. Jones
1a1cb1ec3c builder: Fix RHEL 5 download location.
This fixes commit 3bc9ba6c84.
2014-05-15 14:45:00 +01:00
Pino Toscano
d2bfe2cb24 builder: respect the proxy also when downloading images (RHBZ#1096465).
Missing from commit 87d79c2ee2.
2014-05-14 17:59:31 +02:00
Pino Toscano
b6c8afaee6 builder: save the proxy for each entry
Copy the information about the proxy of a source in all the entries of
that source; this way it is possible to use it later when accessing to
the actual image of an entry.
2014-05-14 17:28:13 +02:00
Richard W.M. Jones
3bc9ba6c84 builder: Fix RHEL script for RHEL 5.
Root partition is on /dev/sda2:

$ virt-filesystems -a rhel-5.10 --all --long -h
Name       Type        VFS   Label      MBR  Size  Parent
/dev/sda1  filesystem  ext2  /boot      -    510M  -
/dev/sda2  filesystem  ext4  /          -    4.5G  -
/dev/sda3  filesystem  swap  SWAP-hda3  -    1.0G  -
/dev/sda1  partition   -     -          83   510M  /dev/sda
/dev/sda2  partition   -     -          83   4.5G  /dev/sda
/dev/sda3  partition   -     -          82   1.0G  /dev/sda
/dev/sda   device      -     -          -    6.0G  -

It would be better if we could mount by label in guestfish ...

There is another problem with RHEL 5 guests in that the
yum URL is slightly wrong.
2014-05-10 20:20:56 +01:00
Hilko Bengen
75022489c8 appliance: update Debian-specific package list 2014-05-10 15:36:11 +02:00
Richard W.M. Jones
944a601020 builder: Add Ubuntu 14.04 disk image.
Also remove the Ubuntu 13.10 image, since it's not an LTS image.
2014-05-10 12:40:03 +01:00
Richard W.M. Jones
a1fcd2ca5f builder: ubuntu: Allow virt-install --os-variant to be specified on the command line.
Current virt-builder in F20 does not know about --os-variant=ubuntutrusty
so to build that you can now do:

  ./ubuntu.sh 14.04 trusty ubuntusaucy
2014-05-10 10:47:05 +01:00
Pino Toscano
c7888ac618 configure: always add the extra warnings
Get rid of --enable-gcc-warnings and just add all the warnings in any
case; they are tested anyway, so only warnings supported by the compiler
will be used.

Regarding -Werror, add a new --enable-werror which enables its use.
2014-05-09 15:06:50 +02:00
Pino Toscano
a880bc1eb0 tests/syslinux: add new syslinux 6+ path of mbr.bin
Reported in https://bugs.debian.org/746748.
2014-05-09 12:20:33 +02:00
Pino Toscano
f46d53be18 tests/syslinux: factorize search for mbr.bin 2014-05-09 12:19:47 +02:00
Richard W.M. Jones
5e574bb304 Version 1.27.9. 2014-05-07 14:56:15 +01:00
Pino Toscano
a651990fb1 test-charset-fidelity: allow to skip testing specific FSes
Allow to skip testing the filesystem "foo" if the environment variable
SKIP_TEST_CHARSET_FIDELITY_foo=1 is set. This way it possible to not
test one or more filesystems without disabling the test altogether.
2014-05-07 15:45:07 +02:00
Pino Toscano
3633109ff3 Fix handling of passwords in URLs
So far, passwords in URLs (eg http://user:password@host..) have been
handled as part of the username, and thus passing
  add-drive path username:username:password ...
instead of
  add-drive path username:username secret:password ...

Fix the parsing of URLs to handle passwords as separate elements,
properly passing it as "secret" parameter for add-drive, and properly
readd it when building URLs in the direct backend.

Furthmore, to keep curl- and ssh-based qemu drivers working with
authenticated resources, make sure they can accept secrets.

Reported in comment #1 of RHBZ#1092583.
2014-05-07 15:06:51 +02:00
Nikos Skalkotos
c24ce0811d inspect: Add support for Oracle Linux
Prior to this patch the library would return "rhel" instead of
"oraclelinux" for Oracle Linux OSes.
2014-05-07 10:03:00 +01:00
Richard W.M. Jones
9e82936393 New API: cpio-out converts a directory to cpio format.
This is useful for generating Linux initramfses from other types of
filesystems.  For example:

 guestfish --ro -a disk.img -i cpio-out / - | gzip -9 > initrd.img
2014-05-07 09:05:29 +01:00
Richard W.M. Jones
c67e16734c sparsify: Add a note about qcow2 internal snapshots not being copied (RHBZ#1094746). 2014-05-07 09:05:29 +01:00
Richard W.M. Jones
2bd75a1ea1 customize: random-seed file has moved again.
Thanks, systemd.
2014-05-07 09:02:21 +01:00
Pino Toscano
845daded5f lib: xmlParse{File,Memory} -> xmlRead{File,Memory}
Switch from xmlParse* to xmlRead* so we can explicitly specify parsing
flags, including no network usage and no entity resolution.
The two behaviours mentioned above were not done before either, so this
should not introduce behaviour changes in libguestfs.
2014-05-06 19:22:14 +02:00
Richard W.M. Jones
4dc42693f2 guestfs-recipes: Fix language. 2014-05-04 20:57:41 +01:00
Richard W.M. Jones
be874d7f50 Version 1.27.8. 2014-05-02 11:25:48 +01:00
Richard W.M. Jones
c2488b6ed8 builder: Add RHEL 7 signature to EXTRA_DIST.
This fixes commit fea553778a.
2014-05-02 11:25:48 +01:00
Richard W.M. Jones
0c1a4b1781 launch: direct: Turn gdb into a backend setting.
You can now use LIBGUESTFS_BACKEND_SETTINGS=gdb in order to enable gdb
debugging of the appliance.  This only works with the direct backend.
2014-05-02 11:25:48 +01:00
Hilko Bengen
c4a91a1866 launch: direct: Supply -M option when testing qemu for devices.
qemu-system-arm 2.0 as currently available through Debian/unstable
doesn't want to tell us anything about available devices unless we
specify a machine type.
2014-05-02 11:25:47 +01:00
Pino Toscano
1550a80d6c daemon: xattr: factorize do_getxattr and do_lgetxattr
Move all the common code to a new _getxattr function, much like done for
other xattrs operations.

Mostly code motion, no functional changes.
2014-04-30 15:52:49 +02:00
Richard W.M. Jones
fea553778a builder: Add RHEL 7RC disk image. 2014-04-29 23:00:40 +01:00
Richard W.M. Jones
df5bd5741b builder: Fix parallel builds of index-parse.o.
When parallel builds are enabled it was possible for index-parse.c to
be compiled before the file had been completely written by bison.  The
usual symptom was that the 'do_parse' symbol was missing -- this
simply happened because that symbol is defined at the end of this
file, and the compiler compiled the file before the end part was
written out.  But you could also see other strange & random compile
failures as you would expect.

This was tested by running this script on an 8 core server:

 cd builder/
 export MAKEFLAGS=-j9
 while make clean >/dev/null; make all V=1 >& /tmp/log; do echo -n . ; done

Previously it would fail after <= 5 iterations.  With this change it
runs for at least 100 iterations.
2014-04-29 15:43:20 +01:00
Richard W.M. Jones
50b207ca45 Add a regression test for RHBZ#1091803. 2014-04-28 09:52:22 +01:00
Richard W.M. Jones
efd159a063 tar-in: Fix places where we didn't cancel the receive (FileIn) correctly along error paths (RHBZ#1091803).
Thanks: Bo Fan.
2014-04-28 09:51:48 +01:00
Richard W.M. Jones
8df792d4a7 Version 1.27.7. 2014-04-23 19:50:37 +01:00
Pino Toscano
ae891bc5f5 builder: isolate all the cache handling to a new Cache module
While there is not that much in it, it groups together the small
scattered-around bits handling the cache directory.
2014-04-23 10:39:51 +02:00
Richard W.M. Jones
101d728e80 configure: Make sure grep matches qemu 2.x version string. 2014-04-22 22:47:06 -04:00
Pino Toscano
4f5dc4afdc builder: add "[ignored]" to parsing errors for .conf files
Parsing sources .conf files is not a fatal error (that file would just
be ignored), so explicitly state that such parsing errors are ignored.

This should address the last bit in RHBZ#1077817.
2014-04-22 17:58:27 +02:00
Pino Toscano
e7c746854b builder: add an optional suffix string for INI parsing errors 2014-04-22 17:57:05 +02:00
Richard W.M. Jones
3f4903e53a Version 1.27.6. 2014-04-22 14:14:12 +01:00
Richard W.M. Jones
b176bde942 FAQ: Describe better how to compile libguestfs from source using alternate qemu/supermin/kernel. 2014-04-22 13:32:49 +01:00
Pino Toscano
2f5e9066db ruby: tests: convert from Test::Unit to MiniTest (RHBZ#1085029)
Convert the tests to the MiniTest test framework, but keeping the usage
of the old Test::Unit as fallback in case MiniTest is not available.
In the latter case, use a bit of "glue" to make the old API look like
the new API, so we can just rely on the newer MiniTest API.
2014-04-22 14:02:35 +02:00
Pino Toscano
fbae7f3e69 ruby: tests: isolate boilerplate in common file
Isolate in a common file all the standard boilerplate in tests, i.e. the
import of the test framework and the guestfs module (including the
import path hack needed for the latter).

Thanks to Vít Ondruch for the precious hints and suggestions.
2014-04-22 14:02:29 +02:00
Pino Toscano
0316d24770 daemon: parted: part-get-name: switch from sgdisk to parted (RHBZ#1088424).
Use parted to get the name of partitions in GPT layouts instead of
sgdisk, to reduce the possible discrepancy between output of tools.

The actual case here is that recent parted versions fixed/improved their
UTF-16 handling of partition names in GPT, and sgdisk seems to not be
properly handling them, returning also unicode control bytes.
Since parted can provide partition names already, just make use of it.

Since sgdisk is no more needed for part_get_name, the function is no
more optional on it.
2014-04-22 13:59:59 +02:00
Richard W.M. Jones
909c10d758 sparsify: If using -v (verbose), ensure #disk_create runs verbose too. 2014-04-16 21:12:52 +01:00
Richard W.M. Jones
e1a82bb130 builder: If using -v (verbose), ensure #disk_create runs verbose too. 2014-04-16 21:12:30 +01:00
Richard W.M. Jones
9515345bbd builder: Suggest using virt-install --os-variant option in virt-builder man page. 2014-04-16 20:09:39 +01:00
Richard W.M. Jones
27355c9b0b disk-create: Fix this API so it works correctly with block devices (RHBZ#1088262).
When you call guestfs_disk_create on a block device with format=raw
then it will try to discard the blocks on the device.
2014-04-16 12:01:17 +01:00
Richard W.M. Jones
1898d457bd Version 1.27.5. 2014-04-15 23:29:03 +01:00
Richard W.M. Jones
3c260f23d4 configure: Fix tests of qemu on ARM.
qemu-system-arm now requires that you pass '-machine virt' (or some
-machine type) explicitly.

Change the configure test so it works on upstream ARM.
2014-04-15 18:13:43 -04:00
Pino Toscano
87d79c2ee2 builder: add per-repository proxy configuration
Add the possibility to configure the proxy in each repository .conf
file, specifying whether use no proxy at all, follow the system
configuration or use a specific proxy.
2014-04-15 15:55:51 +01:00
Richard W.M. Jones
040694ab79 Version 1.27.4. 2014-04-15 14:23:34 +01:00
Pino Toscano
8ae2a8a936 sysprep: remove also hidden files/dirs in temporary dirs
List manually and remove the content left (hidden files/directories) in
temporary directories after the glob listing & removal.
2014-04-14 14:18:41 +02:00
Richard W.M. Jones
8f3959e581 sparsify: Fix automake build.
Previous commit 97c57a8887 added a
potential bug in the sparsify build.  If virt-sparsify had used a
*.mli file then it would have tried to run a command like:

 ocamlc mlguestfs.cmxa -c foo.mli -o foo.cmi

This would fail because ocamlc doesn't know about native code
libraries (*.cmxa).  In fact virt-sparsify was not affected by this
because it doesn't use any *.mli files.

Fix this by adjusting the automake variables.
2014-04-14 11:42:33 +01:00
Pino Toscano
c78b932199 builder: set an empty XDG_CONFIG_HOME in tests
This way they are affected less by the environment.
2014-04-11 16:15:13 +02:00
Richard W.M. Jones
47ec61e9af listfs: If LDM not available, don't inhibit partition detection (RHBZ#1079182).
If a disk has type 0x42 partition (which would indicate LDM), but LDM
is not available then try parsing the partition anyway.  It might be
parseable as plain old NTFS.
2014-04-09 21:46:01 +01:00
Richard W.M. Jones
97c57a8887 sparsify: Use automake to build and link virt-sparsify binary.
There are two observations which make this possible: (1) virt-sparsify
contains at least one C unit, so automake thinks it is compiling a C
program.  (2) Automake lets us add a *_LINK rule to override linking.

We list the C sources of virt-sparsify as virt_sparsify_SOURCES, so
automake thinks it is building a C program as normal.

We override virt_sparsify_LINK to make it actually link an OCaml
program.

We add virt_sparsify_DEPENDENCIES listing the OCaml objects so that
they get built before linking.

We need a small linker script (link.sh) which adds some options at the
end of the linker command line which are impossible to add using pure
automake.

Inspired by the same idea in supermin:
https://github.com/libguestfs/supermin/blob/master/src/Makefile.am
2014-04-09 21:45:54 +01:00
Pino Toscano
65b8edda0a sysprep: remove ConsoleKit logs 2014-04-09 15:54:54 +02:00
Pino Toscano
54d1f6e611 sysprep: remove the exim logs 2014-04-09 15:54:54 +02:00
Pino Toscano
f7d2738902 sysprep: remove apt and aptitude logs 2014-04-09 15:54:54 +02:00
Pino Toscano
d413c94fa6 sysprep: remove debug, syslog and faillog logs 2014-04-09 15:54:53 +02:00
Pino Toscano
ccf84d7b80 sysprep: remove debian-installer files 2014-04-09 15:54:53 +02:00
Pino Toscano
b08955e76a sysprep: remove the lightdm logs 2014-04-09 15:54:53 +02:00
Pino Toscano
fc9a4221ba sysprep: remove more anaconda configs/logs 2014-04-09 15:54:53 +02:00
Pino Toscano
0c35c3addd sysprep: remove systemd journals 2014-04-09 15:54:53 +02:00
Richard W.M. Jones
ffffe71c16 build: Remove code coverage and code profiling options.
This reverts commit 5a2e320ec9.
2014-04-09 14:51:59 +01:00
Richard W.M. Jones
595bd5022a sparsify: Relax test constraint (RHBZ#1079210).
As long as over ~300MB is recovered, declare sparsification to be
successful in this test.

It looks as if the journal or other metadata takes up a variable
amount of space after sparsification.
2014-04-08 10:05:34 +01:00
Richard W.M. Jones
466885b226 configure: Add message about GNUlib tests.
Output was:

  yes

Now the output is:

  checking if we should run the GNUlib tests... yes
2014-04-07 13:18:34 +01:00
Pino Toscano
f63d827819 customize: add the chmod command
Add the chmod customize command to change the permissions of files.
2014-04-07 09:42:48 +02:00
Richard W.M. Jones
df0d197812 Version 1.27.3. 2014-04-06 16:19:33 +01:00
Richard W.M. Jones
7173883154 recipes: Update the section on installing packages.
Libguestfs >= 1.26 makes this easy.
2014-04-03 20:27:43 +01:00
Richard W.M. Jones
55437e459b mllib: utils: Add mapi function.
This is List.mapi from the stdlib.  RHEL 6 did not have this function.
2014-04-03 17:59:54 +01:00
Richard W.M. Jones
82b486a908 appliance: Avoid touching appliance/supermin.d directory.
We must avoid touching appliance/supermin.d unless it is necessary, so
that we avoid unnecessary rebuilds of the full appliance.
Unfortunately since we created temporary files there, even if we
didn't decide to keep those temporary files they would still end up
touching supermin.d.  To stop this, move the temporary files out.
2014-04-03 17:59:54 +01:00
Pino Toscano
b7ad029536 appliance: exclude pkg-config, doc-base, and reportbug stuff
Exclude the arch-independent pkg-config files (no pkg-config available
in the appliance).

Exclude also the doc-base and reportbug files, typically found in Debian
systems.
2014-04-03 15:26:26 +02:00
Richard W.M. Jones
d268cfd13e builder: Add test of virt-index-validate. 2014-04-03 08:58:46 +01:00
Richard W.M. Jones
358c6571d0 builder: Rearrange EXTRA_DIST in alphabetical order.
No functional change.
2014-04-03 08:45:31 +01:00
Richard W.M. Jones
795a162cee builder: Don't use configure to generate test-index file.
The file contained no replacement patterns so generating it
with configure did nothing.
2014-04-03 08:44:24 +01:00
Pino Toscano
9cbb619db2 builder: better handle some index parsing errors
Add a new lexer token, unused in the grammar, for the unknown lines in
index files; this should allow to better handle such kind of parsing
errors, removing the need to exit() directly (and leave things in an
unclean state).
2014-04-03 08:41:06 +01:00
Richard W.M. Jones
3fa5096f48 customize: Add a "finishing" message at the end.
Useful, mainly because it tells you the total time spent running.
2014-04-02 17:33:37 +01:00
Richard W.M. Jones
8c46a644bc customize: Add customize/*.ml files for translation. 2014-04-02 14:06:38 +01:00
Pino Toscano
84f646a41a src/launch: improve the addition of the no-hpet option
Since HPET is specific to x86, we can safely add it its option only on
x86 and x86_64 when creating the libvirt XML (no more hitting the
launching failures due to that on other architectures).

Regarding the direct qemu launch, since qemu 1.1 (which is our current
minimum) "-ho-hpet" appears in the help only where actually supported,
so we could just checking for it and adding it only if present. This
should fix the architecture issues on this backend as well.
2014-04-01 18:01:19 +02:00
Richard W.M. Jones
b03b3f6f46 sparsify: Reorder external programs in SEE ALSO section. 2014-04-01 14:56:32 +01:00
Richard W.M. Jones
07dff756a7 sparsify: Remove duplicate "EXIT STATUS" sections from man page. 2014-04-01 14:55:20 +01:00
Richard W.M. Jones
c58bef5125 Version 1.27.2. 2014-03-31 18:07:08 +01:00
Richard W.M. Jones
7c1d95cca0 rescue: Fix the --suggest regression test so it works when using UML backend.
The boot partition name is /dev/ubda1 in this case, so use a small sed
script to canonicalize it for the test comparison.

This fixes commit f6a37740f2.
2014-03-31 18:00:07 +01:00
Lee Yarwood
cf31656923 Add the now mandatory arch=ARCH field to the index file examples.
61323fa introduced a mandatory arch field within index files to
identify the architecture of the OS installed within a given template.
This change simply documents the requirement within the relevant
section of the virt-builder man page.

Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
2014-03-31 17:43:27 +01:00
Richard W.M. Jones
4916806bdf Version 1.27.1. 2014-03-31 15:13:16 +01:00
Richard W.M. Jones
957afde13b python: Add README.txt to EXTRA_DIST. 2014-03-31 15:13:16 +01:00
Richard W.M. Jones
0d9a61a91d src: Fix test-utils.c to test the validate_guid function again.
This fixes commit 768ab2e01d.
2014-03-31 14:21:45 +01:00
Richard W.M. Jones
7e39cd4600 Remove internal libvirt_setlinux* APIs and use backend settings instead.
This removes the internal APIs internal_set_libvirt_selinux_label and
internal_set_libvirt_selinux_norelabel_disks.  The communication
between the libvirt domain and the backend now uses the backend
settings.
2014-03-31 14:21:45 +01:00
Richard W.M. Jones
5d4e4e7eca ocaml: Add ESRCH to Guestfs.Errno module. 2014-03-31 14:21:45 +01:00
Richard W.M. Jones
d137ad52c5 New APIs: set-backend-setting, get-backend-setting, clear-backend-setting.
Currently the backend settings are treated as a list of strings.  You
can set the whole list (clearing any strings there previously), but
you cannot search for an individual string or replace an individual
string.

This adds further APIs allowing you to do that.  We treat the backend
settings as a list of environment-like strings (ie.  name=value), and
add the following functions:

 - set-backend-setting (name, value)

   Set name=value.  Any previous settings of name are cleared.

 - get-backend-setting (name)

   Search for name or name=value and return the value.

 - clear-backend-setting (name)

   Remove any name or name=value settings.

This also adds a regression test.
2014-03-31 13:33:53 +01:00
Richard W.M. Jones
1893eaded0 handle: Free g->backend_settings.
This was not being freed, resulting in a memory leak if you used
LIBGUESTFS_BACKEND_SETTINGS.

Found by valgrind.
2014-03-31 13:33:53 +01:00
Richard W.M. Jones
6af2306730 python: Remove unnecessary library dependencies.
We can remove the deps on libxml2, libvirt and gnulib, by only linking
with utils.o (instead of utils.a).
2014-03-29 18:52:32 +00:00
Richard W.M. Jones
fcbfc4775f python: Add a Python setup.py script.
This is not used by libguestfs right now, but it does allow you to
build a python "distribution" of libguestfs, like this:

  make -C python sdist

The distribution tarball will be in python/dist/

You can copy the distribution tarball somewhere, unpack it, and use
regular 'python setup.py' commands such as:

  python setup.py build
  python setup.py install [--prefix=...]
  python setup.py --name

In future we hope to be able to upload the distribution tarball to
PyPi, but licensing issues prevent this at present.
2014-03-29 17:36:16 +00:00
Richard W.M. Jones
768ab2e01d utils: Move guestfs___validate_guid out of utils.c.
guestfs___validate_guid was a new function added to utils.c in
commit beef77403c.

However utils.c should not include <guestfs-internal.h> since the
other functions in this file can be used by all front-end code, not
just libguestfs.so.

This function is only needed in libguestfs.so, so move it to another
source file, and remove include of <guestfs-internal.h> from utils.c.

Also: use 'size_t' for counting, not 'int'.

This fixes commit beef77403c.
2014-03-29 17:12:47 +00:00
Richard W.M. Jones
bc1a415794 utils: Remove for-loop variable decl.
Breaks Python distutils which doesn't use C99:

utils.c: In function ‘guestfs___copy_string_list’:
utils.c:79:7: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for (size_t j = 0; j < i; ++j)
       ^
utils.c:79:7: note: use option -std=c99 or -std=gnu99 to compile your code
2014-03-29 17:12:47 +00:00
Richard W.M. Jones
ebda77b647 virt-builder: Add --machine-readable option, as in virt-resize and virt-sparsify.
This makes it easier to query the virt-builder binary capabilities,
from external programs.
2014-03-29 15:09:19 +00:00
Richard W.M. Jones
30bdadf032 builder: Disable internal parallel xzcat on RHEL 6. 2014-03-29 14:55:01 +00:00
Richard W.M. Jones
eff7aed6cf builder: Remove recursive include of index-parse.h.
This breaks on Bison < 2.7, and seems unnecessary in any case since
the same file is included earlier.
2014-03-29 14:47:28 +00:00
Richard W.M. Jones
f6a37740f2 rescue: Add a regression test for virt-rescue --suggest option. 2014-03-28 14:38:06 +00:00
Richard W.M. Jones
c8657535fd rescue: Don't leak various variables when using --suggest option with multi-boot guests.
This fixes a leak which was introduced in
commit 4255db65e5.

Found by Coverity.
2014-03-28 14:37:58 +00:00
Richard W.M. Jones
15b06d6100 make-fs: Close FILE* along error path.
Found by Coverity.
2014-03-28 14:01:19 +00:00
Richard W.M. Jones
410aae4b6f make-fs: Check for error return from guestfs_statvfs.
Found by Coverity.
2014-03-28 13:59:56 +00:00
Richard W.M. Jones
4cea94a958 daemon: parted: part-get-name: Don't leak partition type string.
Found by './configure --enable-valgrind-daemon'.

This fixes commit 820b870167.
2014-03-28 12:35:25 +00:00
Richard W.M. Jones
a7a239f7ab builder: Use libgnu.la instead of -lgnu.
This updates commit effcb99f83.
2014-03-28 09:57:07 +00:00
Olaf Hering
effcb99f83 builder: Link virt-index-validate with gnulib.
[Gnulib tries to replace getopt because of the bug shown below.
However because -lgnu was not used in the Makefile, the replacement
failed. -- RWMJ]

from config.log:

             /* This code dumps core on glibc 2.14.  */
             {
               static char program[] = "program";
               static char w[] = "-W";
               static char dummy[] = "dummy";
               char *argv[] = { program, w, dummy, NULL };
               optind = opterr = 1;
               if (getopt (3, argv, "W;") != 'W')
                 result |= 64;
             }

gdb --quiet --readnow ./conftest -ex r -ex bt -ex detach -ex q
Reading symbols from /usr/src/packages/BUILD/libguestfs-1.26.0/conftest...expanding to full symbols...done.
Starting program: /usr/src/packages/BUILD/libguestfs-1.26.0/conftest
Missing separate debuginfo for /lib64/ld-linux-x86-64.so.2
Try: zypper install -C "debuginfo(build-id)=5d1a12e6f0e95331cc4e39df74ecbd5adb76a1f7"
Missing separate debuginfo for /lib64/libc.so.6
Try: zypper install -C "debuginfo(build-id)=a06caa12df8f953a453befa827c3145adaf6269a"
main(323) result 0
main(344) result 0
main(357) result 0
main(370) result 0

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b2dbf8 in _getopt_internal_r () from /lib64/libc.so.6
Detaching from program: /usr/src/packages/BUILD/libguestfs-1.26.0/conftest, process 31042

This change actually fixes build for me on sles11sp3 and 11.4.
2014-03-28 09:53:39 +00:00
Richard W.M. Jones
a78cd210c3 Version 1.27.0. 2014-03-27 15:47:16 +00:00
Richard W.M. Jones
996eca5da7 Version 1.26.0.
New stable version.
2014-03-27 12:04:44 +00:00
Richard W.M. Jones
a20e368fea fish: Check return values from a couple of API calls.
Found by Coverity.
2014-03-27 11:34:40 +00:00
Richard W.M. Jones
be250948bc fish: Ignore return value from guestfs_user_cancel.
As we are in a signal handler, there's nothing else we can do.

Found by Coverity.
2014-03-27 11:34:05 +00:00
Richard W.M. Jones
4099880643 examples: Check return value from guestfs_list_filesystems.
Found by Coverity.
2014-03-26 20:25:05 +00:00
Richard W.M. Jones
7792278e05 virt-diff: Free memory along error path.
Found by Coverity.
2014-03-26 20:23:19 +00:00
Richard W.M. Jones
8da50e5a3f daemon: md: Whitespace fix. 2014-03-26 20:08:36 +00:00
Richard W.M. Jones
4caa2ea5ff daemon: ldm: Initialize glob_t struct before passing to glob.
Some implementations of glob might use fields in the struct, although
not glibc as far as I know.

Issue identified by Coverity.
2014-03-26 20:07:43 +00:00
Richard W.M. Jones
fe97d5ed9c builder: pxzcat: Ignore return value from posix_fadvise.
Quiets warning from Coverity.
2014-03-26 20:03:15 +00:00
Richard W.M. Jones
21390bc4aa Pull latest translations from Transifex. 2014-03-26 16:53:37 +00:00
Richard W.M. Jones
f566f176c6 Remove the ROADMAP file.
I don't think it provides any value now.  There is a list of bugs in
'BUGS' and a set of ideas in 'TODO'.
2014-03-26 16:48:37 +00:00
Richard W.M. Jones
0febb59afa Final updates to release notes for 1.26. 2014-03-26 13:35:05 +00:00
2295 changed files with 1274967 additions and 431867 deletions

267
.gitignore vendored
View File

@@ -1,5 +1,6 @@
*~
*.a
*.annot
*.bak
*.class
*.cma
@@ -9,24 +10,23 @@
*.cmxa
*.diff
*.eml
*.gcda
*.gcno
*.gcov
*.hi
*.jar
*.la
*.lo
*.log
*.o
*.orig
*.patch
*.rej
*.swp
*.trs
bindtests.tmp
cscope.out
.deps
.dirstamp
.gdb_history
gmon.out
.libs
Makefile
Makefile.in
@@ -52,31 +52,48 @@ Makefile.in
/bash/virt-filesystems
/bash/virt-format
/bash/virt-inspector
/bash/virt-log
/bash/virt-ls
/bash/virt-sysprep
/bash/virt-sparsify
/build-aux
/build-aux/.gitignore
/build-aux/ar-lib
/build-aux/compile
/build-aux/config.guess
/build-aux/config.sub
/build-aux/depcomp
/build-aux/install-sh
/build-aux/ltmain.sh
/build-aux/missing
/build-aux/snippet/
/build-aux/test-driver
/build-aux/ylwrap
/builder/.depend
/builder/index-parse.c
/builder/index-parse.h
/builder/index-scan.c
/builder/libguestfs.conf
/builder/opensuse.conf
/builder/oUnit-*
/builder/*.qcow2
/builder/stamp-virt-builder.pod
/builder/stamp-virt-index-validate.pod
/builder/test-config/virt-builder/repos.d/test-index.conf
/builder/test-index
/builder/test-simplestreams/virt-builder/repos.d/cirros.conf
/builder/test-website/virt-builder/repos.d/libguestfs.conf
/builder/virt-builder
/builder/virt-builder.1
/builder/virt-index-validate
/builder/virt-index-validate.1
/builder/*.xz
/builder/yajl_tests
/cat/stamp-virt-*.pod
/cat/virt-cat
/cat/virt-cat.1
/cat/virt-filesystems
/cat/virt-filesystems.1
/cat/virt-log
/cat/virt-log.1
/cat/virt-ls
/cat/virt-ls.1
/ChangeLog
@@ -119,9 +136,31 @@ Makefile.in
/df/stamp-virt-df.pod
/df/virt-df
/df/virt-df.1
/dib/.depend
/dib/stamp-virt-dib.pod
/dib/virt-dib
/dib/virt-dib.1
/diff/stamp-virt-diff.pod
/diff/virt-diff
/diff/virt-diff.1
/docs/guestfs-building.1
/docs/guestfs-faq.1
/docs/guestfs-hacking.1
/docs/guestfs-internals.1
/docs/guestfs-performance.1
/docs/guestfs-recipes.1
/docs/guestfs-release-notes.1
/docs/guestfs-security.1
/docs/guestfs-testing.1
/docs/stamp-guestfs-building.pod
/docs/stamp-guestfs-faq.pod
/docs/stamp-guestfs-hacking.pod
/docs/stamp-guestfs-internals.pod
/docs/stamp-guestfs-performance.pod
/docs/stamp-guestfs-recipes.pod
/docs/stamp-guestfs-release-notes.pod
/docs/stamp-guestfs-security.pod
/docs/stamp-guestfs-testing.pod
/edit/stamp-virt-*.pod
/edit/virt-edit
/edit/virt-edit.1
@@ -138,18 +177,10 @@ Makefile.in
/examples/debug-logging
/examples/display-icon
/examples/guestfs-examples.3
/examples/guestfs-faq.1
/examples/guestfs-performance.1
/examples/guestfs-recipes.1
/examples/guestfs-testing.1
/examples/inspect-vm
/examples/libvirt-auth
/examples/mount-local
/examples/stamp-guestfs-examples.pod
/examples/stamp-guestfs-faq.pod
/examples/stamp-guestfs-performance.pod
/examples/stamp-guestfs-recipes.pod
/examples/stamp-guestfs-testing.pod
/examples/virt-dhcp-address
/fish/cmds.c
/fish/cmds-gperf.c
@@ -186,12 +217,18 @@ Makefile.in
/fuse/guestunmount.1
/fuse/stamp-guestmount.pod
/fuse/stamp-guestunmount.pod
/fuse/test-fuse
/fuse/test-guestmount-fd
/fuse/test-guestunmount-fd
/generator/.depend
/generator/files-generated.txt
/generator/generator
/generator/.pod2text.data*
/generator/stamp-generator
/get-kernel/.depend
/get-kernel/stamp-virt-get-kernel.pod
/get-kernel/virt-get-kernel
/get-kernel/virt-get-kernel.1
/.gitattributes
/.git-module-status
/gnulib
@@ -203,7 +240,6 @@ Makefile.in
/golang/examples/guestfs-golang.3
/golang/examples/stamp-guestfs-golang.pod
/golang/pkg
/guestfs-release-notes.1
/guestfsd-in-wine.log
/haskell/Bindtests
/haskell/Bindtests.hs
@@ -211,58 +247,12 @@ Makefile.in
/haskell/Guestfs030Config
/haskell/Guestfs050LVCreate
/haskell/Guestfs.hs
/html/guestfish.1.html
/html/guestfs.3.html
/html/guestfs-erlang.3.html
/html/guestfs-examples.3.html
/html/guestfs-faq.1.html
/html/guestfs-golang.3.html
/html/guestfs-java.3.html
/html/guestfs-lua.3.html
/html/guestfs-ocaml.3.html
/html/guestfs-performance.1.html
/html/guestfs-perl.3.html
/html/guestfs-python.3.html
/html/guestfs-recipes.1.html
/html/guestfs-release-notes.1.html
/html/guestfs-ruby.3.html
/html/guestfs-testing.1.html
/html/guestfsd.8.html
/html/guestmount.1.html
/html/guestunmount.1.html
/html/libguestfs-make-fixed-appliance.1.html
/html/libguestfs-test-tool.1.html
/html/libguestfs-tools.conf.5.html
/html/virt-alignment-scan.1.html
/html/virt-builder.1.html
/html/virt-cat.1.html
/html/virt-copy-in.1.html
/html/virt-copy-out.1.html
/html/virt-customize.1.html
/html/virt-df.1.html
/html/virt-diff.1.html
/html/virt-edit.1.html
/html/virt-filesystems.1.html
/html/virt-format.1.html
/html/virt-index-validate.1.html
/html/virt-inspector.1.html
/html/virt-list-filesystems.1.html
/html/virt-list-partitions.1.html
/html/virt-ls.1.html
/html/virt-make-fs.1.html
/html/virt-rescue.1.html
/html/virt-resize.1.html
/html/virt-sparsify.1.html
/html/virt-sysprep.1.html
/html/virt-tar.1.html
/html/virt-tar-in.1.html
/html/virt-tar-out.1.html
/html/virt-win-reg.1.html
/inspector/actual-*.xml
/inspector/stamp-virt-inspector.pod
/inspector/test-xmllint.sh
/inspector/virt-inspector
/inspector/virt-inspector.1
/installcheck.sh
/install-sh
/java/api
/java/Bindtests.java
@@ -298,19 +288,23 @@ Makefile.in
/mllib/.depend
/mllib/common_gettext.ml
/mllib/common_utils_tests
/mllib/config.ml
/mllib/dummy
/mllib/guestfs_config.ml
/mllib/JSON_tests
/mllib/libdir.ml
/mllib/oUnit-*
/ocaml/bindtests.bc
/ocaml/bindtests.opt
/ocaml/bindtests.ml
/ocaml/.depend
/ocaml/dllmlguestfs.so
/ocaml/examples/create_disk
/ocaml/examples/debug_logging
/ocaml/examples/guestfs-ocaml.3
/ocaml/examples/inspect_vm
/ocaml/examples/stamp-guestfs-ocaml.pod
/ocaml/guestfs-c-actions.c
/ocaml/guestfs-c-errnos.c
/ocaml/guestfs.ml
/ocaml/guestfs.mli
/ocamlinit-stamp
@@ -318,17 +312,43 @@ Makefile.in
/ocaml/stamp-mlguestfs
/ocaml/t/*.bc
/ocaml/t/*.opt
/p2v/dependencies.archlinux
/p2v/dependencies.debian
/p2v/dependencies.redhat
/p2v/dependencies.suse
/p2v/launch-virt-p2v
/p2v/stamp-test-virt-p2v-pxe-hostkey
/p2v/stamp-test-virt-p2v-pxe-kernel
/p2v/stamp-test-virt-p2v-pxe-userkey
/p2v/stamp-virt-p2v.pod
/p2v/stamp-virt-p2v-make-disk.pod
/p2v/stamp-virt-p2v-make-kickstart.pod
/p2v/test-virt-p2v-pxe.id_rsa
/p2v/test-virt-p2v-pxe.id_rsa.pub
/p2v/test-virt-p2v-pxe.img
/p2v/test-virt-p2v-pxe.initramfs
/p2v/test-virt-p2v-pxe.sshd_config
/p2v/test-virt-p2v-pxe.ssh_host_rsa_key
/p2v/test-virt-p2v-pxe.ssh_host_rsa_key.pub
/p2v/test-virt-p2v-pxe.vmlinuz
/p2v/virt-p2v
/p2v/virt-p2v.1
/p2v/virt-p2v.i686
/p2v/virt-p2v-make-disk
/p2v/virt-p2v-make-disk.1
/p2v/virt-p2v-make-kickstart
/p2v/virt-p2v-make-kickstart.1
/perl/_build
/perl/bindtests.pl
/perl/blib
/perl/Build
/perl/Build.PL
/perl/examples/guestfs-perl.3
/perl/examples/stamp-guestfs-perl.pod
/perl/Guestfs.bs
/perl/Guestfs.c
/perl/Guestfs.xs
/perl/lib/Sys/Guestfs.bs
/perl/lib/Sys/Guestfs.c
/perl/lib/Sys/Guestfs.xs
/perl/lib/Sys/Guestfs.pm
/perl/Makefile-pl
/perl/Makefile.PL
/perl/Makefile-pl.old
/perl/MYMETA.json
/perl/MYMETA.yml
/perl/pm_to_blib
@@ -365,6 +385,7 @@ Makefile.in
/php/extension/php-for-tests.sh
/php/extension/php_guestfs_php.h
/php/extension/run-tests.php
/php/extension/tests/guestfs_php_bindtests.phpt
/php/extension/tmp-php.ini
/pick-guests.pl
/po-docs/*/*.1
@@ -377,13 +398,23 @@ Makefile.in
/podwrapper.pl
/po/*.gmo
/python/bindtests.py
/python/build
/python/config.h
/python/dist
/python/examples/guestfs-python.3
/python/examples/stamp-guestfs-python.pod
/python/guestfs.py
/python/guestfs-py.c
/python/guestfs.pyc
/python/guestfs.pyo
/python/guestfs-internal-all.h
/python/guestfs-internal-frontend-cleanups.h
/python/guestfs-internal-frontend.h
/python/MANIFEST
/python/__pycache__
/python/setup.py
/python/stamp-extra-files
/python/utils.c
/qemu-wrapper.sh
/rescue/stamp-virt-rescue.pod
/rescue/virt-rescue
@@ -403,6 +434,7 @@ Makefile.in
/ruby/ext/guestfs/_guestfs.so
/ruby/ext/guestfs/mkmf.log
/ruby/Rakefile
/ruby/stamp-rdoc
/run
/sparsify/.depend
/sparsify/stamp-virt-sparsify.pod
@@ -436,7 +468,6 @@ Makefile.in
/src/structs-copy.c
/src/structs-free.c
/src/test-utils
/stamp-guestfs-release-notes.pod
/stamp-h1
/sysprep/.depend
/sysprep/stamp-script1.sh
@@ -447,14 +478,14 @@ Makefile.in
/sysprep/sysprep-operations.pod
/sysprep/virt-sysprep
/sysprep/virt-sysprep.1
/test.err
/test.out
/tests/c-api/test-add-drive-opts
/tests/c-api/test-add-libvirt-dom
/tests/c-api/test-backend-settings
/tests/c-api/test-command
/tests/c-api/test-config
/tests/c-api/test-create-handle
/tests/c-api/test-debug-to-file
/tests/c-api/test-dlopen
/tests/c-api/test-environment
/tests/c-api/test-event-string
/tests/c-api/test*.img
@@ -469,50 +500,84 @@ Makefile.in
/tests/c-api/test*.tmp
/tests/c-api/test-user-cancel
/tests/charsets/test-charset-fidelity
/tests/data/100kallnewlines
/tests/data/100kallspaces
/tests/data/100kallzeroes
/tests/data/100krandom
/tests/data/10klines
/tests/data/abssymlink
/tests/data/blank-disk-*
/tests/data/blank-disk-*
/tests/data/hello.b64
/tests/data/initrd
/tests/data/initrd-x86_64.img
/tests/data/initrd-x86_64.img.gz
/tests/data/test-grep.txt.gz
/tests/data/test.iso
/tests/daemon/captive-daemon.pm
/tests/disks/test-qemu-drive-libvirt.xml
/tests/events/test-libvirt-auth-callbacks
/tests/guests/blank-*.img
/tests/guests/debian.img
/tests/guests/fedora.img
/tests/guests/fedora-btrfs.img
/tests/guests/fedora-md1.img
/tests/guests/fedora-md2.img
/tests/guests/guests.xml
/tests/guests/guests-all-good.xml
/tests/guests/guest-aux/fedora-name.db
/tests/guests/guest-aux/fedora-packages.db
/tests/guests/guest-aux/windows-software
/tests/guests/guest-aux/windows-system
/tests/guests/stamp-fedora-md.img
/tests/guests/ubuntu.img
/tests/guests/windows.img
/tests/mount-local/test-parallel-mount-local
/tests/mountable/test-internal-parse-mountable
/tests/parallel/test-parallel
/tests/protocol/test-error-messages
/tests/qemu/qemu-boot
/tests/qemu/qemu-speed-test
/tests/regressions/rhbz501893
/tests/regressions/rhbz790721
/tests/regressions/rhbz914931
/tests/regressions/rhbz1044014.out
/tests/regressions/rhbz1055452
/tests/regressions/test-big-heap
/tests/rsync/rsyncd.pid
/tests/syslinux/extlinux-guest.img
/tests/syslinux/syslinux-guest.img
/test-data/test.iso
/test-data/blank-disks/blank-disk-*
/test-data/fake-virtio-win/fake-virtio-win.iso
/test-data/files/100kallnewlines
/test-data/files/100kallspaces
/test-data/files/100kallzeroes
/test-data/files/100krandom
/test-data/files/10klines
/test-data/files/abssymlink
/test-data/files/bin-x86_64-dynamic.gz
/test-data/files/hello.b64
/test-data/files/initrd
/test-data/files/initrd-x86_64.img
/test-data/files/initrd-x86_64.img.gz
/test-data/files/lib-i586.so.xz
/test-data/files/test-grep.txt.gz
/test-data/phony-guests/archlinux.img
/test-data/phony-guests/blank-*.img
/test-data/phony-guests/coreos.img
/test-data/phony-guests/debian.img
/test-data/phony-guests/fedora.img
/test-data/phony-guests/fedora-btrfs.img
/test-data/phony-guests/fedora-md1.img
/test-data/phony-guests/fedora-md2.img
/test-data/phony-guests/fedora-name.db
/test-data/phony-guests/fedora-packages.db
/test-data/phony-guests/guests.xml
/test-data/phony-guests/guests-all-good.xml
/test-data/phony-guests/stamp-fedora-md.img
/test-data/phony-guests/ubuntu.img
/test-data/phony-guests/windows.img
/test-data/phony-guests/windows-software
/test-data/phony-guests/windows-system
/test-tool/libguestfs-test-tool
/test-tool/libguestfs-test-tool.1
/test-tool/libguestfs-test-tool-helper
/test-tool/stamp-libguestfs-test-tool.pod
/tools/stamp-virt-*.pod
/tools/virt-*.1
/v2v/.depend
/v2v/centos-6.img
/v2v/centos-7.0.img
/v2v/fedora-20.img
/v2v/fake-virtio-win.iso
/v2v/oUnit-*
/v2v/rhel-5.10.img
/v2v/rhel-6.5.img
/v2v/rhel-7.0.img
/v2v/stamp-virt-v2v.pod
/v2v/stamp-virt-v2v-copy-to-local.pod
/v2v/test-harness/.depend
/v2v/test-harness/META
/v2v/test-harness/dllv2v_test_harness.so
/v2v/test-harness/stamp-virt-v2v-test-harness.pod
/v2v/test-harness/virt-v2v-test-harness.1
/v2v/v2v_unit_tests
/v2v/virt-v2v
/v2v/virt-v2v.1
/v2v/virt-v2v-copy-to-local
/v2v/virt-v2v-copy-to-local.1
/website/*.html
/website/README.txt
/website/TODO.txt

Submodule .gnulib updated: ce457d622d...5ac0e2ba90

View File

@@ -1,12 +0,0 @@
[main]
host = https://www.transifex.com
[libguestfs.libguestfspot]
file_filter = po/<lang>.po
source_file = po/libguestfs.pot
source_lang = en
[libguestfs.libguestfsdocspot]
file_filter = po-docs/<lang>.po
source_file = po-docs/libguestfs-docs.pot
source_lang = en

View File

@@ -1,4 +1,4 @@
^tests/data/
^test-data/
^COPYING(.LIB)?$
^\.gitmodules$
(^|\/)ChangeLog[^/]*$

View File

@@ -1,2 +1,2 @@
tests/data/bin-win64.exe
test-data/binaries/bin-win64.exe
*.pod

19
AUTHORS
View File

@@ -2,33 +2,48 @@ Adam Huffman
Angus Salkeld
Ani Peter
Bastien ROUCARIÈS
Cao jin
Charles Duffy
Chen Hanxiao
Cole Robinson
Colin Walters
Cédric Bosdonnat
Dan Lipsitt
Daniel Berrange
Daniel Cabrera
Daniel Exner
Dave Vasilevsky
David Sommerseth
Dawid Zamirski
Douglas Schilling Landgraf
Eric Blake
Erik Nolte
Evaggelos Balaskas
Gabriele Cerami
Geert Warrink
Guido Günther
Hilko Bengen
Hu Tao
infernix
Jaswinder Singh
Jim Meyering
Jiri Popelka
John Eckersberg
Joseph Wang
Karel Klíč
Kashyap Chamarthy
Lee Yarwood
Marcin Gibula
Margaret Lewicka
Maros Zatko
Martin Kletzander
Masami HIRATA
Matthew Booth
Maxim Koltsov
Maxim Perevedentsev
Menanteau Guy
Michael Scherer
Mike Frysinger
Mike Kelly
Nicholas Strugnell
Nikita A Menkovich
@@ -42,7 +57,11 @@ Piotr Drąg
Qin Guan
Rajesh Ranjan
Richard W.M. Jones
Robert Antoni Buj Gelonch
Roman Kagan
Sandeep Shedmake
Shahar Havivi
Shahar Lev
Shankar Prasad
Thomas S Hatch
Török Edwin

738
BUGS
View File

@@ -1,5 +1,5 @@
NOTE: This file is automatically generated from "update-bugs.sh".
Last updated: 2014-03-26
Last updated: 2016-02-08
This contains a local list of the bugs that are open against
libguestfs. Bugs are tracked in the Red Hat Bugzilla database
@@ -20,12 +20,6 @@ When reporting a new bug, please check:
--------------------------------------------------
Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
507278 NEW https://bugzilla.redhat.com/show_bug.cgi?id=507278
libguestfs fails to build on Fedora sparc64
547488 NEW https://bugzilla.redhat.com/show_bug.cgi?id=547488
guestfish cannot tab complete filenames that contain spaces
554829 NEW https://bugzilla.redhat.com/show_bug.cgi?id=554829
SELinux handling could be done better.
@@ -35,21 +29,12 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
578103 NEW https://bugzilla.redhat.com/show_bug.cgi?id=578103
[RFE] Tool to Compare Windows Registry Entries
604041 NEW https://bugzilla.redhat.com/show_bug.cgi?id=604041
guestmount absolute symlinks don't work
637251 NEW https://bugzilla.redhat.com/show_bug.cgi?id=637251
virt-inspector fails to recognize data-only NTFS disk image
693064 NEW https://bugzilla.redhat.com/show_bug.cgi?id=693064
Symbolic links on ntfs-3g are not followed correctly by some commands
709326 NEW https://bugzilla.redhat.com/show_bug.cgi?id=709326
virt-inspector cannot detect ReactOS
737261 NEW https://bugzilla.redhat.com/show_bug.cgi?id=737261
libguestfs grub-install API needs grub1
745576 NEW https://bugzilla.redhat.com/show_bug.cgi?id=745576
libguestfs (or qemu?) hangs if sparse file runs out of disk space
@@ -65,30 +50,12 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
790837 NEW https://bugzilla.redhat.com/show_bug.cgi?id=790837
Use of atexit to clean up handles is wrong in multithreaded programs
803643 NEW https://bugzilla.redhat.com/show_bug.cgi?id=803643
inspect-is-multipart return false when inspection results should be true
803650 NEW https://bugzilla.redhat.com/show_bug.cgi?id=803650
inspect-is-live return false when inspection results should be true
803657 NEW https://bugzilla.redhat.com/show_bug.cgi?id=803657
[RFE] inspect-is-netinst : support more distributions
812970 NEW https://bugzilla.redhat.com/show_bug.cgi?id=812970
virt-rescue cannot set ><rescue> prompt, on Ubuntu 12.04
813290 NEW https://bugzilla.redhat.com/show_bug.cgi?id=813290
mdadm (md-detail) test occasionally fails with 'md device /dev/md125 does not appear to be active.'
822538 NEW https://bugzilla.redhat.com/show_bug.cgi?id=822538
libguestfs tools hang on qcow2 encrypted disks
824021 NEW https://bugzilla.redhat.com/show_bug.cgi?id=824021
inspection cannot recognize guest which uses btrfs subvolumes for root
824782 NEW https://bugzilla.redhat.com/show_bug.cgi?id=824782
virt-resize cannot resize PowerPC guests
832602 NEW https://bugzilla.redhat.com/show_bug.cgi?id=832602
"error in chunked encoding" when trying to extract (tar-out) a truncated ISO image
@@ -98,12 +65,15 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
835622 NEW https://bugzilla.redhat.com/show_bug.cgi?id=835622
RFE: virt-sparsify should be able to sparsify onto a thin-provisioned LV
845234 NEW https://bugzilla.redhat.com/show_bug.cgi?id=845234
RFE: virt-ls on Windows guest doesn't support drive letters
848464 NEW https://bugzilla.redhat.com/show_bug.cgi?id=848464
gobject javascript bindings cannot use 64 bit integers
848926 NEW https://bugzilla.redhat.com/show_bug.cgi?id=848926
virt-v2v should verify that the RHEV-M domain is an export storage domain
855058 NEW https://bugzilla.redhat.com/show_bug.cgi?id=855058
RFE: virt-p2v: display more information about storage devices
857763 NEW https://bugzilla.redhat.com/show_bug.cgi?id=857763
libguestfs 'file-architecture' returns 'ARM' for arm binaries
@@ -134,6 +104,9 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
910115 NEW https://bugzilla.redhat.com/show_bug.cgi?id=910115
RFE: support ntfsresize --bad-sectors option in virt-resize
910117 NEW https://bugzilla.redhat.com/show_bug.cgi?id=910117
virt-v2v removes serial console from securetty list
910269 NEW https://bugzilla.redhat.com/show_bug.cgi?id=910269
Tracker: Bugs in other packages that stop libguestfs working
@@ -146,30 +119,18 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
920617 NEW https://bugzilla.redhat.com/show_bug.cgi?id=920617
RFE: virt-inspector (or another tool) should produce OVF output for oVirt / RHEV
927447 NEW https://bugzilla.redhat.com/show_bug.cgi?id=927447
[suse] virt tools hang on disk image, but libguestfs-test-tool runs OK
921604 NEW https://bugzilla.redhat.com/show_bug.cgi?id=921604
RFE: virt-v2v: add option to specify spice or VNC and whether to add USB connections
972292 NEW https://bugzilla.redhat.com/show_bug.cgi?id=972292
lgetxattrs can't show the file attribute list with ntfs FS in rhel7
972294 NEW https://bugzilla.redhat.com/show_bug.cgi?id=972294
lsetxattr/lgetxattr doesn't work to softlink file with ntfs FS in rhel7
963232 NEW https://bugzilla.redhat.com/show_bug.cgi?id=963232
RFE: v2v: a --no-cleanup would be useful for debugging of disk images that guestfs has issues converting
973138 NEW https://bugzilla.redhat.com/show_bug.cgi?id=973138
RFE: sh & debug sh should be able to capture all output and error return code
979392 NEW https://bugzilla.redhat.com/show_bug.cgi?id=979392
[abrt] virt-manager crash from libguestfs launch_libvirt
980790 NEW https://bugzilla.redhat.com/show_bug.cgi?id=980790
fstrim returns error "FITRIM ioctl failed: Inappropriate ioctl for device"
982516 NEW https://bugzilla.redhat.com/show_bug.cgi?id=982516
sh "rpm -Va" fails because apparently /dev/shm is not created/bind-mounted correctly
982979 NEW https://bugzilla.redhat.com/show_bug.cgi?id=982979
Disable fstrim API/command in RHEL 6
983969 NEW https://bugzilla.redhat.com/show_bug.cgi?id=983969
RFE: virt-sysprep should be SELinux-aware
@@ -179,9 +140,6 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
987829 NEW https://bugzilla.redhat.com/show_bug.cgi?id=987829
virt-resize error: "lvm_set_filter: vgchange: Couldn't find device with uuid .. Refusing activation of partial LV"
988100 NEW https://bugzilla.redhat.com/show_bug.cgi?id=988100
RFE: journal reader in guestfish
991641 NEW https://bugzilla.redhat.com/show_bug.cgi?id=991641
virt-sysprep fs-uuids plugin doesn't update UUIDs in fstab, elsewhere
@@ -191,18 +149,9 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
994965 NEW https://bugzilla.redhat.com/show_bug.cgi?id=994965
libguestfs doesn't work on armv7hl
997160 NEW https://bugzilla.redhat.com/show_bug.cgi?id=997160
virt-sysprep prints: filesize: /etc/mdadm.conf: No such file or directory
998065 NEW https://bugzilla.redhat.com/show_bug.cgi?id=998065
libguestfs kernel hang in RHEL 6.5
1019388 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1019388
firstboot scripts (virt-builder, virt-sysprep) don't work for Debian 6 & 7 guests
1021149 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1021149
Rebase libguestfs to 1.24 in RHEL 7.1
1023630 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1023630
enable-valgrind-daemon option breaks UML
@@ -212,90 +161,327 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1027526 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1027526
RFE: Labels for logical partitions lost in Windows 2003 after virt-resize for primary partition
1028676 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1028676
Add virt-builder to RHEL 7.1
1029134 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1029134
Broken links in virt-builder web man page
1033573 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1033573
libguestfs inspection does not recognize NAS4Free OS installed on QCOW2 image
1035320 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1035320
test faild during build
1040912 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1040912
[ARM] mount-local / FUSE support does not seem to work at all
1041552 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1041552
virt-sysprep should remove Pegasus certificates
1042780 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1042780
Support the virt-sysprep --delete option
1051694 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1051694
libguestfs FTBFS on Ubuntu saucy
1056047 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1056047
virt-df generates no output for Solaris 11 x86_64 guest.
1056558 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1056558
virt-sparsify overwrites block devices if used as output files
1057510 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1057510
mount-local should give a clearer error if root is not mounted
1057873 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1057873
libguestfs df/ subdirectory tests fail occasionally
1059428 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1059428
Failed dependencies installing libguestfs with glibc ppc64p7
1060423 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1060423
Support setting xattrs via FUSE
1061040 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1061040
RFE: Enable ZFS support
1064041 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1064041
virt-sparsify fails if a btrfs filesystem contains readonly snapshots
1069966 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1069966
can't disable accel=kvm:tcg
1072863 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1072863
libguestfs failed with guestfs_launch failed error while accessing disk
1072898 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1072898
inspect-os fails to find any operating systems
1074005 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1074005
java bindings inspect_list_applications2 throws java.lang.ArrayIndexOutOfBoundsException:
1075164 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1075164
RFE: allow passing in a pre-opened libvirt connection from python
1075594 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1075594
RFE: python-libguestfs should be available on pypi
1076478 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1076478
FTBFS: libguestfs-1.22.6-15.el7
1077817 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1077817
virt-builder error: "syntax error at line 3: syntax error"
1079182 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1079182
virt-df cannot report used disk space of windows guest when updated to 6.5
1079210 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1079210
i686: virt-sparsify --in-place cannot sparsify as much as it should
1079625 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1079625
virt-sparsify fails if a btrfs filesystem contains readonly snapshots
1079734 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1079734
Tiny Core Linux is not recognized by libguestfs inspection
1089100 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1089100
NetworkManager avc unlink denied for resolv.conf after using --selinux-relabel
1092583 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1092583
guestfish removes query string from URI
1097272 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1097272
Ruby bindings should use RB_GC_GUARD (instead of volatile) for enhanced safety
1099292 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1099292
sfdisk failed by "Device or resource busy" when using one command line
1099475 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1099475
sfdisk: BLKRRPART: Device or resource busy
1100138 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1100138
some operation cause "lvremove" can not find the object
1100140 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1100140
some operation cause "lvremove" can not find the object
1102241 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1102241
[RFE] libguestfs should detect OSTree (project-atomic) qcow2 disk image
1102619 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1102619
lvm-clear-filter failed when has two same name but different uuid's VG
1102620 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1102620
lvm-clear-filter failed when has two same name but different uuid's VG
1103444 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1103444
virt-v2v of RHEL AS release 3(Taroon) VMware VM fails because rpm binary segfaults
1107317 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1107317
Ubuntu package fails to depend on linux-image-extra (causes missing virtio-serial)
1108171 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1108171
RFE: virt-builder should be able to build PXE images for baremetal installation
1114012 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1114012
"yum install guestfish" on fresh Fedora 20 results in broken libguestfs
1118305 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1118305
RFE: Ability to set iSCSI-Initiator-IQN for iSCSI connections
1129110 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1129110
Libguestfs NTFS not setting ACLs
1134726 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1134726
[RFE] virt-builder should support args with the --run command
1136371 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1136371
add apt-rpm support to supermin
1139785 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1139785
virt-sysprep should change UUID fields in /etc/sysconfig/network-scripts/ifcfg-* files
1144137 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1144137
virt-inspector fails on Minix 3 guest
1150298 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1150298
ARM 32 bit on Ubuntu: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
1151902 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1151902
RFE: virt-v2v should do something with <interface type='direct'> (either virtualize it or give an error)
1151903 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1151903
virt tools --csv output should have a meaningful output
1152533 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1152533
RFE: virt-v2v should do something with <disk device='lun'> (either virtualize it or give an error)
1152818 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1152818
llz give ? for the security context of a file, which is wrong
1152819 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1152819
Can not end a running command in virt-rescue by press ^C or other keys, the only way is to exit virt-rescue
1152821 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1152821
Can not end a running command in virt-rescue by press ^C or other keys, the only way is to exit virt-rescue
1152825 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1152825
virt-rescue --selinux can not work well, when enable selinux in the command line the value of 'getenforce' is still Disabled in virt-rescue appliance
1152832 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1152832
virt-rescue --selinux can not work well, when enable selinux in the command line the value of 'getenforce' is still Disabled in virt-rescue appliance
1152833 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1152833
llz give ? for the security context of a file, which is wrong
1153702 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1153702
Using "upload - XXX" doesn't work with remote
1154408 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1154408
libguestfs does not allow registering a qemu+tcp backend
1155229 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1155229
RFE: Allow uploading virt-v2v converted images directly to Cinder
1161019 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1161019
Remove rhev related files(rhsrvany.exe and rhev-apt.exe) after conversion of windows guests to kvm
1164765 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1164765
[RFE] Add a new API to scan devices for a btrfs filesystem
1167916 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1167916
P2V: invalid conversion server prints unexpected end of file waiting for password prompt.
1170771 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1170771
virt-sparsify fails to sparsify CentOS 7 SWAP
1171654 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1171654
Modify a file in virt-rescue with vi on some linux terminal such as yakuake, can lead to abnormal display in virt-rescue shell
1172425 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1172425
[RFE]virt-v2v failed to convert VMware ESX VM with snapshot
1173462 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1173462
virt-resize on RHEL 5.7 fails to resize the raw format disk image
1176526 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1176526
virt-resize cannot shrink ext filesystem by a small amount
1177460 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1177460
virt-customize does not work with fedora atomic
1183493 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1183493
RFE: virt-rescue: add a flag to autorun the suggested mount commands and chroot, suggested with --suggest
1186935 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1186935
libguestfs cannot inspect recent Fedora / RHEL >= 7 when /usr is a separate partition
1190666 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1190666
virt-builder should get RHEL images from RHN
1193238 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1193238
Specifying a --source option doesn't overwrite the built-in templates
1195278 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1195278
libguestfs-test-tool fails in nested environment
1195881 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1195881
virt-builder can't docker pull
1197786 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1197786
virt-builder fails --get-kernel on F21 PPC64 iso
1203595 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1203595
No error messages output if append '--format qcow2' after '-a guest.img', guest.img is a raw format image file
1203816 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1203816
virt-sysprep should error if a command line flag is not used because the operation is disabled
1203898 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1203898
Support inspecting docker images without /etc/fstab
1212507 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1212507
sfdisk-disk-geometry fails to display the disk geometry from the partition
1212546 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1212546
rsync-out fails to synchronize filesystem with remote filesystem
1212556 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1212556
The system release info get from 'utsname' is different from the host
1212679 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1212679
Failed to create a augeas handle with flag=8 because of custom lens (guestfs_lvm_conf.aug)
1213274 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1213274
Improve the misunderstanding error messages of virt-tar-in/virt-tar-out/virt-copy-in/virt-copy-out
1213319 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1213319
[RFE]virt-v2v support convert guest with all interface types to others
1213701 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1213701
Fail to import win8/win2012 to rhev with error "selected display type is not supported"
1213844 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1213844
guestfish should reset the console on ^Z
1215803 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1215803
'/var/lib/random-seed: No such file or directory' with virt-tools on images with bind-mount of /var
1217959 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1217959
journal logging support
1220751 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1220751
fusermount returns EBUSY, but unmounts the disk anyway, confusing guestunmount
1221569 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1221569
aarch64: add-drive-opts fails to hot plug a disk
1224795 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1224795
On Ubuntu, virt-builder --install and --update cannot use the network
1224903 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1224903
'guestmount: no operating system was found on this disk' for rhel7 be guest on ppc64le host
1227599 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1227599
P2V invalid password prints unexpected end of file waiting for command prompt.
1229386 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1229386
virt-p2v in non-GUI mode doesn't show any conversion progress or status
1230414 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1230414
Windows inspection fails with hivex_close: do_hivex_close: you must call 'hivex-open' first to initialize the hivex handle
1232477 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1232477
guestfs_add_drive_opts incorrectly quotes query parameters
1233093 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1233093
QXL driver is not installed for some version of windows guest after convert to RHEV
1237250 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1237250
aarch64: libguestfs should now prefer virtio-pci
1242028 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1242028
virt-make-fs cannot set g+s bit on vfat
1245326 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1245326
virt-v2v tests: warning: the target hypervisor does not support a x86_64 KVM guest
1250670 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1250670
libguestfs-test-tool succeeds but guestmount fails
1251499 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1251499
virt-builder --hostname should replace FQDN in /etc/hosts on Ubuntu
1252701 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1252701
virt-p2v cannot convert older HP Smart Array servers which require cciss driver
1253593 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1253593
[RFE]virt-p2v support conversion of citrix xen guest
1255610 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1255610
W2K8R2 FC guest has no VGA driver on RHEV
1262491 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1262491
virt-builder fail to resize or recognize coreos
1264332 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1264332
Parameter '--no-trim all' doesn't work when converting guest via virt-v2v command
1265588 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1265588
Windows guest with dynamic disk cannot show RAID(E:) Disk on rhev after conversion by virt-p2v
1270686 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1270686
libguestfs-1.31.15-1.fc24 FTBFS: cp: missing file operand
1272119 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1272119
virt-v2v on W2K3 32-bit image fails
1273991 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1273991
write-append doesn't expand new lines properly when used in guestfish command line
1277744 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1277744
When a virtual machine from VirtualBox is launched, virt-filesystems shows error, instead of displaying partitions
1284191 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1284191
virt-builder cgroup error when running docker
1291339 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1291339
[RFE] Add support for layered/composable images in virt-builder repos
1291715 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1291715
test suite failure: libguestfs: error: mkfs_btrfs: /dev/sda1: not enough free space
1292710 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1292710
i686 qemu guest install of Fedora 23 fails or does not boot properly
1293271 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1293271
virt-sysprep --delete fails to delete a symbolic link to a dir
1293516 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1293516
rm-rf can not delete files and dirs in symbolic link dir
1294955 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1294955
set-label fails to set some unicode characters as the NTFS filesystem label
1296595 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1296595
libhivex: use on Windows 7 NTUSER.DAT causes damage that manifests itself with folder rename errors
1301525 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1301525
ll fails to list a symbolic link pointing to a non-existing file
1301593 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1301593
Windows inspection fails with: guestfsd: error: readdir: Invalid or incomplete multibyte or wide character
1305526 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1305526
Backport virt-v2v pull dcpath from libvirt <vmware:datacenterpath>
503134 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=503134
guestfish's list splitting does not recognize internal quoting
@@ -305,197 +491,203 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
541618 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=541618
guestfish not able to mount freebsd ufs2 partitions automatically
547488 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=547488
guestfish cannot tab complete filenames that contain spaces
604041 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=604041
guestmount absolute symlinks don't work
619334 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=619334
RFE: Enable coredump capture in the appliance
624335 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=624335
blockdev-setbsz succeeds, but does not affect blockdev-getbsz
691389 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=691389
SELinux labels don't work over guestmount (FUSE)
965495 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=965495
New APIs required in libguestfs for virt-v2v in RHEL 6.5
824782 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=824782
virt-resize cannot resize PowerPC guests
1025269 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1025269
libguestfs tests hang in libguestfs-1.20.11/tests/guests/guest-aux/make-fedora-img.pl
845234 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=845234
RFE: virt-ls on Windows guest doesn't support drive letters
(100 bugs)
988100 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=988100
RFE: journal reader in guestfish
1069966 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1069966
RFE: let virt-builder etc build ARM guests on x86 host
1109144 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1109144
virt-builder --get-kernel doesn't fetch the dtb from images
1113153 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1113153
RFE: Inspection should support systemd mount units
1130506 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1130506
RFE: virt-sparsify in copying mode should support qemu detect-zeroes
1141631 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1141631
[RFE] virt-v2v should support convert a guest to a dir-pool with using pool's uuid
1143887 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1143887
virt-v2v: warning: cannot write files to the NFS server as 36:36
1144138 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1144138
virt-inspector fails on FreeBSD 9.3 guest
1152369 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1152369
virt-v2v failed to convert RHEL 6.7 UEFI guest: no grub1/grub-legacy or grub2 configuration file was found
1190669 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1190669
Support virt-v2v conversion of Windows > 7
1198344 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1198344
[RFE] virt-builder should support download resume
(174 bugs)
--------------------------------------------------
Bugs in MODIFIED, POST or ON_QA state are fixed.
You can help by testing the fixes.
1028650 POST https://bugzilla.redhat.com/show_bug.cgi?id=1028650
virt-* argument parser doesn't accept --arg=value (you have to use --arg value)
1099976 POST https://bugzilla.redhat.com/show_bug.cgi?id=1099976
virt-builder gives GPG warning message with gnupg2
1072062 POST https://bugzilla.redhat.com/show_bug.cgi?id=1072062
Ruby bindings for libguestfs throws an error periodically
1164708 POST https://bugzilla.redhat.com/show_bug.cgi?id=1164708
set-label can only set <=127 bytes for btrfs and <=126 bytes for ntfs filesystem which not meet the help message. Also for ntfs it should give a warning message when the length >128 bytes
1073917 POST https://bugzilla.redhat.com/show_bug.cgi?id=1073917
java bindings inspect_list_applications2 throws java.lang.ArrayIndexOutOfBoundsException:
1174551 POST https://bugzilla.redhat.com/show_bug.cgi?id=1174551
"lstatnslist" and "lstatlist" don't give an error if the API is used wrongly
1053847 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1053847
Recommended default clock/timer settings
1064041 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1064041
virt-sparsify fails if a btrfs filesystem contains readonly snapshots
1156298 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1156298
Remove files in package libguestfs-bash-completion, these files are bash completion files, some of the virt tool completion are already implement in another file, so can remove its completion file
1166057 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1166057
btrfs filesystem will not work well if you create the filesystem with multiple disks at the same time, such as: mkfs-btrfs "/dev/sda1 /dev/sdb1"
1167623 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1167623
Remove "If reporting bugs, run virt-v2v with debugging enabled .." message when running virt-p2v
1173695 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1173695
RFE: allow passing in a pre-opened libvirt connection from python
1176801 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1176801
File /etc/sysconfig/kernel isn't updated when convert XenPV guest with regular kernel installed
1180769 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1180769
Security context on image file gets reset
1218766 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1218766
Rebase libguestfs in RHEL 7.3
1225789 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1225789
Wrong video driver is installed for rhel5.11 guest after conversion to libvirt
1227609 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1227609
virt-p2v: Using "Back" button causes output list to be repopulated multiple times
1229119 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1229119
Unrelated info in fstab makes virt-v2v fail with unclear error info
1238053 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1238053
v2v:Duplicate disk target set when convert guest with cdrom attached
1239154 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1239154
appliance fails to start with "supermin: ext2fs_file_write: /var/log/tallylog: Could not allocate block in ext2 filesystem"
1242853 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1242853
mount-loop failed to setup loop device: No such file or directory
1260801 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1260801
virt-builder --ssh-inject doesn't set proper permissions on created files
1264835 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1264835
ppc64le: virt-customize --install fail to detect the guest arch
1267032 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1267032
guestfish copy-in command behaves oddly/unexpectedly with wildcards
1277074 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1277074
Virt-p2v client shouldn't present the vdsm option because it's not usable
1277122 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1277122
RFE: virt-sparsify: make '--in-place' sparsification safe to abort (gracefully or ungracefully)
1287826 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1287826
Remove virt-v2v support for ppc64le
1290755 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1290755
guestfish should be able to handle LVM thin layouts
1292437 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1292437
Backport virt-v2v pull dcpath from libvirt <vmware:datacenterpath>
1293527 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1293527
There should be a reminder to avoid user to edit a guest image by multiple tools at the same time in guestfish man page
1296606 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1296606
virt-v2v doesn't remove VirtualBox additions correctly because of file quoting
1020950 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1020950
CVE-2013-4419 libguestfs: insecure temporary directory handling for guestfish's network socket [epel-5]
(5 bugs)
1213324 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1213324
virt-v2v: warning: unknown guest operating system: windows windows 6.3 when converting win8,win8.1,win2012,win2012R2 to rhev
1213691 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1213691
Win2012R2 guest fails to boot on iscsi data domain after conversion by virt-v2v
1293276 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1293276
guestfish can not ll a symbolic link dir or edit a file in it
1294956 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1294956
set-label returns wrong error message when set the ext3/ext4 filesystem label
(33 bugs)
--------------------------------------------------
These bugs are in the VERIFIED state.
672485 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=672485
[RFE] virt-edit/tar-in/tar-out/inspector do not support encrypted system
1164729 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1164729
set-label can only set <=63 bytes for btrfs and ntfs filesystem which not meet the help message. Also for btrfs and ntfs it should give a warning message when the length exceed the limited length
869179 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=869179
libguestfs fail to startup on latest rhel7 tree
1165564 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1165564
Provide Reboot/Shutdown button after virt-p2v
880806 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=880806
virt-df with two -a options displays incorrect disk image name
1165569 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1165569
Disable "cancel conversion" button after virt-p2v conversion finished
889536 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=889536
[RFE]It's better to emphasize "libguestfs-winsupport" in V2V manpage or error output
1167601 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1167601
"Conversion was successful" pop out even virt-p2v fails
889537 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=889537
Libguestfs live support should be disabled in RHEL 7 packages
1167774 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1167774
virt-p2v fails with error:"nbd.c:nbd_receive_negotiate():L501: read failed"
889538 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=889538
libguestfs can not be installed with recent iptables
1216298 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1216298
'inspect-get-icon' fails to get the icon form the rhel7.1 image
892271 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=892271
virt-format fail to format the same disk more than twice with lvm enable
1216305 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1216305
virt-inspector fails to detect the rhel7 images
892275 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=892275
checksums-out fail to compute the checksums of all regular files in directory
1218934 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1218934
virt-sparsify: read all the output from 'qemu-img --help'
894241 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=894241
aug-init fail with the newest augeas package
1229305 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1229305
virt-sysprep at cleanup deletes /var/spool/at/.SEQ which results in failing at
905322 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=905322
"hivex-commit" should fail with a relative path
1261242 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1261242
virt-v2v should prevent using '-of' option appears twice on the command line
909573 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=909573
patch libguestfs to use 'supermin' instead of 'febootstrap' in RHEL 7
1261436 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1261436
No warning shows when convert a win7 guest with AVG AntiVirus installed
909667 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=909667
Unexpected non-tail recursion in recv_from_daemon results in stack overflow in very long-running API calls that send progress messages
1262959 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1262959
virt-builder/virt-customize set password does not work
921710 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=921710
9p support should be disabled in libguestfs in RHEL 7
947438 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=947438
Some obsolete tools should be removed from libguestfs RHEL 7 package
949486 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=949486
libguestfs-1.20.5-3.el7.x86_64 dependency problem
957616 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=957616
libguestfs-1.21.31-1.1.el7.1.1.x86_64 won't install due to missing dependency
957796 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=957796
tar-out and base64-out quoting error
962113 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=962113
Disable libguestfs block drivers which are not supported by RHEL 7 qemu + libvirt
974490 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=974490
Regression: Fedora inspection broken by change from guestfs_exists to guestfs_is_file
975573 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=975573
virt-sysprep is in the wrong subpackage
975771 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=975771
Specifying virtio interface ('iface' parameter) breaks the direct backend - libguestfs hangs
976250 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=976250
Make xfs filesystem failed with specified blocksize, gives "unknown option -b" error
976299 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=976299
mke2fs-J should give a meaningful error when specified type is anything except 'ext{2,3,4}'
980338 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=980338
disk-format "qemu-img info: JSON parse error" when target file does not exist
983691 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=983691
libguestfs double free when kernel link fails during launch
985856 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=985856
Can't set acl value for a specified user with 'acl-set-file'
988862 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=988862
virt-sysprep --firstboot option writes incorrect "99" (instead of "S99") sysv-init-style start up script
989356 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=989356
cap-get-file will return error if the file has not be set capabilities
995176 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=995176
RFE: Implement set-uuid command
995712 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=995712
list-filesystems command fails if there are no block devices
998109 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=998109
Let's enable kvmclock in RHEL 7
998485 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=998485
guestfish remote prints "libguestfs: error: waitpid (qemu): No child processes"
998750 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=998750
guestfish does not work due to conflict of remote and interactive mode
1000123 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1000123
'sh' command before mount causes daemon to segfault
1000428 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1000428
virt-format uses wrong partition type for vfat filesystems
1001875 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1001875
Argument 'excludes' of tar-out does not work
1001876 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1001876
Update "rsync-out" helpout for using wildcard
1002032 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1002032
mke2fs can't return the correct filesystem type when blockscount is less than 2048 for ext3
1003291 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1003291
Backport cachemode patch to RHEL 7
1008417 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1008417
Need update helpout of part-set-gpt-type
1011922 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1011922
Use host-passthrough instead of host-model
1016465 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1016465
blockdev-setbsz succeeds, but does not affect blockdev-getbsz
1019891 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1019891
libguestfs-tools.conf should have a man page
1020021 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1020021
Drop php-libguestfs subpackage
1037795 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1037795
libguestfs rebuild needed due to broken ABI compatibility (caused by procps-ng update to 3.3.9)
1056556 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1056556
virt-sparsify overwrites block devices if used as output files
1057492 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1057492
mount-local should give a clearer error if root is not mounted
1061155 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1061155
Incorrect *.py[co] files placement
1061160 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1061160
libguestfs source has bogus COPYING file
1072079 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1072079
Ruby bindings for libguestfs throws an error periodically
(50 bugs)
(12 bugs)
End of BUGS file.

View File

@@ -1,5 +1,5 @@
# libguestfs
# Copyright (C) 2009-2014 Red Hat Inc.
# Copyright (C) 2009-2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,17 +19,31 @@ include $(top_srcdir)/common-rules.mk
ACLOCAL_AMFLAGS = -I m4
# The generator - must be before anything else.
SUBDIRS = generator
# Must be the first tests that run.
if ENABLE_APPLIANCE
SUBDIRS += tests/qemu
endif
# Files and other test data used by the tests. Must be before any
# tests run, except tests/qemu.
SUBDIRS += test-data
# Gnulib - must be built and tested before the library.
SUBDIRS = gnulib/lib
SUBDIRS += gnulib/lib
if ENABLE_GNULIB_TESTS
SUBDIRS += gnulib/tests
endif
# Basic source for the library.
SUBDIRS += tests/data generator src examples po
SUBDIRS += src docs examples po
# The daemon and the appliance.
if ENABLE_DAEMON
SUBDIRS += daemon
SUBDIRS += tests/daemon
endif
if ENABLE_APPLIANCE
SUBDIRS += appliance
@@ -37,8 +51,6 @@ endif
# Tests - order is important.
if ENABLE_APPLIANCE
SUBDIRS += tests/qemu
SUBDIRS += tests/guests
SUBDIRS += tests/c-api
SUBDIRS += tests/tmpdirs
SUBDIRS += tests/protocol
@@ -68,8 +80,8 @@ SUBDIRS += tests/nbd
SUBDIRS += tests/http
SUBDIRS += tests/syslinux
SUBDIRS += tests/journal
SUBDIRS += tests/fuzz
SUBDIRS += tests/relative-paths
SUBDIRS += tests/gdisk
SUBDIRS += tests/regressions
endif
@@ -81,6 +93,9 @@ SUBDIRS += fish
# virt-tools in C.
SUBDIRS += align cat diff df edit format inspector make-fs rescue
if HAVE_P2V
SUBDIRS += p2v
endif
# bash-completion
SUBDIRS += bash
@@ -130,9 +145,15 @@ SUBDIRS += \
mllib \
customize \
builder builder/website \
dib \
get-kernel \
resize \
sparsify \
sysprep
sysprep \
v2v
if HAVE_OCAML_PKG_LIBVIRT
SUBDIRS += v2v/test-harness
endif
endif
# Perl tools.
@@ -151,11 +172,10 @@ SUBDIRS += po-docs
endif
EXTRA_DIST = \
BUGS HACKING ROADMAP TODO \
BUGS HACKING TODO \
.gitignore \
.lvimrc \
.mailmap \
.tx/config \
bootstrap \
bugs-in-changelog.sh \
autogen.sh \
@@ -173,7 +193,6 @@ EXTRA_DIST = \
contrib/intro/vmm-icons-t.png \
contrib/intro/vmm-icons.png \
contrib/intro/win7.xml \
contrib/make-check-on-installed.pl \
contrib/README \
contrib/visualize-alignment/.gitignore \
contrib/visualize-alignment/guestfish-add-mount.qtr \
@@ -186,23 +205,33 @@ EXTRA_DIST = \
contrib/visualize-alignment/README \
contrib/visualize-alignment/tracetops.ml \
contrib/windows-icons.pl \
guestfs-release-notes.pod \
guestfs-release-notes.txt \
html/draft.png \
html/draft.svg \
html/pod.css \
html/virt-builder.svg \
libtool-kill-dependency_libs.sh \
logo/fish.svg logo/fish.png \
logo/fish-5yrs.svg logo/fish-5yrs.png \
logo/virt-builder.svg \
m4/.gitignore \
tests/run-xml-to-junit.sh \
tests/run-xml-to-junit.xsl \
ocaml-link.sh \
tests/automake2junit.ml \
tmp/.gitignore \
tx-pull.sh \
update-bugs.sh \
valgrind-suppressions \
website/bugs.png \
website/communicate.png \
website/documentation.png \
website/download.png \
website/draft.png \
website/draft.svg \
website/easytoread.css \
website/feed.css \
website/fish-5yrs.svg \
website/fish.png \
website/git.png \
website/index.css \
website/index.html.in \
website/pod.css \
website/standard.css \
zanata.xml \
zanata-pull.sh \
.x-sc_avoid_ctype_macros \
.x-sc_prohibit_have_config_h \
.x-sc_prohibit_magic_number_exit \
@@ -211,83 +240,28 @@ EXTRA_DIST = \
.x-sc_TAB_in_indentation \
.x-sc_trailing_blank
# The website.
HTMLFILES = \
html/guestfs.3.html \
html/guestfs-examples.3.html \
html/guestfs-erlang.3.html \
html/guestfs-faq.1.html \
html/guestfs-golang.3.html \
html/guestfs-java.3.html \
html/guestfs-lua.3.html \
html/guestfs-ocaml.3.html \
html/guestfs-performance.1.html \
html/guestfs-perl.3.html \
html/guestfs-python.3.html \
html/guestfs-recipes.1.html \
html/guestfs-release-notes.1.html \
html/guestfs-ruby.3.html \
html/guestfs-testing.1.html \
html/guestfsd.8.html \
html/guestfish.1.html \
html/guestmount.1.html \
html/guestunmount.1.html \
html/libguestfs-make-fixed-appliance.1.html \
html/libguestfs-test-tool.1.html \
html/virt-alignment-scan.1.html \
html/virt-builder.1.html \
html/virt-cat.1.html \
html/virt-copy-in.1.html \
html/virt-copy-out.1.html \
html/virt-customize.1.html \
html/virt-df.1.html \
html/virt-diff.1.html \
html/virt-edit.1.html \
html/virt-filesystems.1.html \
html/virt-format.1.html \
html/virt-inspector.1.html \
html/virt-list-filesystems.1.html \
html/virt-list-partitions.1.html \
html/virt-ls.1.html \
html/virt-make-fs.1.html \
html/virt-rescue.1.html \
html/virt-resize.1.html \
html/virt-sparsify.1.html \
html/virt-sysprep.1.html \
html/virt-tar.1.html \
html/virt-tar-in.1.html \
html/virt-tar-out.1.html \
html/virt-win-reg.1.html
HTMLSUPPORTFILES = \
html/draft.png \
html/pod.css \
html/virt-builder.svg
TEXTFILES = BUGS README ROADMAP TODO
# XXX Eventually move builder/website under website/ top level directory.
BUILDERFILES = \
builder/website/README \
builder/website/index \
builder/website/index.asc \
builder/website/*.xz \
builder/website/*.xz.sig
builder/website/index.asc
WEBSITEDIR = $(HOME)/d/websites/libguestfs
# For reasons not fully understood, we need to rebuild all the
# man pages and HTMLFILES from scratch here.
website: $(HTMLFILES) $(HTMLSUPPORTFILES) $(TEXTFILES) $(BUILDERFILES)
find -name 'stamp-*.pod' -delete
$(MAKE)
cp $(HTMLFILES) $(HTMLSUPPORTFILES) $(WEBSITEDIR)
for f in $(TEXTFILES); do cp $$f $(WEBSITEDIR)/$$f.txt; done
noinst_DATA = \
website/index.html \
website/README.txt \
website/TODO.txt
website/README.txt: README
cp $< $@
website/TODO.txt: TODO
cp $< $@
maintainer-upload-website:
cp website/*.{css,html,png,svg,txt} $(WEBSITEDIR)/
cp $(BUILDERFILES) $(WEBSITEDIR)/download/builder/
cd $(WEBSITEDIR) && \
date=`date +%F`; \
sed -e "s/SUBST_VERSION/$(VERSION)/" \
-e "s/SUBST_DATE/$$date/" \
< index.html.in > index.html
# When doing 'make dist' update a few files automatically.
dist-hook:
@@ -296,7 +270,7 @@ dist-hook:
$(top_srcdir)/update-bugs.sh > BUGS-t
mv BUGS-t BUGS
cp BUGS $(distdir)/BUGS
git shortlog -s | awk -F'\t' '{print $$2}' | sort -f > AUTHORS-t
git shortlog -s | $(AWK) -F'\t' '{print $$2}' | sort -f > AUTHORS-t
mv AUTHORS-t AUTHORS
cp AUTHORS $(distdir)/AUTHORS
@@ -314,31 +288,32 @@ dist-hook:
all-local:
cd $(srcdir); \
find $(DIST_SUBDIRS) -name '*.c' -o -name '*.pl' -o -name '*.pm' | \
grep -v -E '^(examples|gnulib|perl/(blib|examples)|po-docs|tests)/' | \
grep -v -E '^(examples|gnulib|gobject/docs|perl/(blib|examples)|po-docs|tests|test-data)/' | \
grep -v -E '/((guestfs|rc)_protocol\.c)$$' | \
grep -v -E '^python/utils\.c$$' | \
LC_ALL=C sort > po/POTFILES
cd $(srcdir); \
find builder mllib resize sparsify sysprep -name '*.ml' | \
find builder customize dib get-kernel mllib resize sparsify sysprep v2v -name '*.ml' | \
LC_ALL=C sort > po/POTFILES-ml
# Manual pages in top level directory.
# Try to stop people using 'make install' without 'DESTDIR'.
install:
@if test "x$(DESTDIR)" != "x" || test "x$(REALLY_INSTALL)" = "xyes"; \
then \
$(MAKE) install-recursive; \
else \
echo "***"; \
echo "*** Using 'make install' is usually a very bad idea."; \
echo "*** Use the './run' script instead - see the README."; \
echo "***"; \
echo "*** You can override this by setting REALLY_INSTALL=yes, but don't do that."; \
echo "***"; \
exit 1; \
fi
man_MANS = \
guestfs-release-notes.1
noinst_DATA = \
$(top_builddir)/html/guestfs-release-notes.1.html
guestfs-release-notes.1 guestfs-release-notes.txt $(top_builddir)/html/guestfs-release-notes.1.html: stamp-guestfs-release-notes.pod
stamp-guestfs-release-notes.pod: guestfs-release-notes.pod
$(PODWRAPPER) \
--section 1 \
--man guestfs-release-notes.1 \
--text guestfs-release-notes.txt \
--html $(top_builddir)/html/guestfs-release-notes.1.html \
--license GPLv2+ \
$<
touch $@
# Test installed packages.
installcheck-local: installcheck.sh
$(builddir)/installcheck.sh
# NB. podwrapper is an internal tool, so the man page mustn't be installed.
noinst_MANS = podwrapper.1
@@ -354,19 +329,24 @@ podwrapper.1: podwrapper.pl
CLEANFILES = \
*~ \
html/*.html \
pod2htm?.tmp \
podwrapper.1 \
qemu-wrapper.sh \
stamp-guestfs-release-notes.pod \
tmp/disk* \
tmp/run-* \
tmp/valgrind-*.log
tmp/valgrind-*.log \
website/*~ \
website/*.html
clean-local:
-rm -rf tmp/libguestfs??????
-rm -rf tmp/guestfs.*
-rm -rf tmp/.guestfs-*
-rm -rf tmp/null.*
-find tmp -type s -delete
-find . -name '*~' -delete
-find . -name '*.bak' -delete
-find . -name '*.orig' -delete
# If you don't want to run all of the tests ('make check') then this
# will just run libguestfs-test-tool for a quick check. Note this
@@ -396,9 +376,6 @@ check-release:
check-valgrind \
check-direct \
check-valgrind-direct
$(MAKE) -j1 LIBGUESTFS_HV=$(HOME)/d/linux-um/vmlinux \
check-uml \
check-valgrind-uml
$(MAKE) -j1 \
check-slow
@@ -487,7 +464,7 @@ check-slow: build-test-guests
exit $$(( $$errors ? 1 : 0 ))
build-test-guests:
$(MAKE) -C tests/guests check
$(MAKE) -C test-data/phony-guests check
# Print subdirs.
#
@@ -504,6 +481,12 @@ build-test-guests:
print-subdirs:
@echo $(SUBDIRS)
# Commit everything in current directory to HEAD, and set commit
# message to current version (only for maintainer).
maintainer-commit:
git commit -a -m "Version $(VERSION)."
# Tag HEAD with current version (only for maintainer).
maintainer-tag:
@@ -515,10 +498,15 @@ maintainer-tag:
maintainer-check-extra-dist:
zcat $(PACKAGE_NAME)-$(VERSION).tar.gz | tar tf - | sort | \
sed 's,^$(PACKAGE_NAME)-$(VERSION)/,,' > tmp/tarfiles
git ls-files | sort > tmp/gitfiles
diff -ur tmp/tarfiles tmp/gitfiles | grep '^\+' | \
grep -v src/api-support/[0-9]
rm tmp/tarfiles tmp/gitfiles
git ls-files | \
grep -v '^intltool-.*\.in' | \
grep -v '^\.gitmodules' | \
grep -v '^\.gnulib' | \
sort > tmp/gitfiles
comm -13 tmp/tarfiles tmp/gitfiles > tmp/comm-out
cat tmp/comm-out
[ ! -s tmp/comm-out ]
rm tmp/tarfiles tmp/gitfiles tmp/comm-out
# Provide help on common Makefile targets.
@@ -542,6 +530,8 @@ help:
@echo "make check-all Runs all 'check*' rules."
@echo "make check-release Runs 'check*' rules required for release."
@echo
@echo "make installcheck Test installed libguestfs packages."
@echo
@echo "make syntax-check -j1 -k Check syntax and style problems in the code."
@echo "make print-subdirs Print subdirectories."
@echo
@@ -552,5 +542,5 @@ help:
@echo "To run programs without installing:"
@echo " ./run ./fish/guestfish [or any other program]"
@echo
@echo "For more information, see EXTENDING LIBGUESTFS in guestfs(3); and README."
@echo "For more information, see guestfs-hacking(1); and README."
@echo

391
README
View File

@@ -8,392 +8,15 @@ list:
http://www.redhat.com/mailman/listinfo/libguestfs
To find out how to build libguestfs from source, read:
Requirements
----------------------------------------------------------------------
docs/guestfs-building.pod
http://libguestfs.org/guestfs-building.1.html
man docs/guestfs-building.1
Running ./configure will check you have all the requirements installed
on your machine.
Fedora/RHEL users:
A useful tip is to run:
yum-builddep libguestfs
which will install all build dependencies automatically. If that is
successful, you don't need to bother with the rest of this section.
Debian/Ubuntu users:
Use:
apt-get build-dep libguestfs
to install all build dependencies. If that doesn't work, take a
look at the Debian source package:
http://packages.debian.org/source/libguestfs
at the list of 'build-depends' and 'build-depends-indep', and
install everything listed there.
If either of those techniques is successful, you don't need to
bother with the rest of this section.
The full requirements are described below.
R = Required
O = Optional
+==============+=============+===+=========================================+
| Package name | Min.version | | Notes |
+==============+=============+===+=========================================+
| Install as many packages listed in appliance/packagelist.in as possible. |
| This installs the disk management tools required by the appliance. The |
| list below is *additional* packages needed on the host. |
+--------------+-------------+---+-----------------------------------------+
| qemu | 1.2.0 | R | 1.1 may work, but has broken virtio-scsi|
+--------------+-------------+---+-----------------------------------------+
| qemu-img | | R | |
+--------------+-------------+---+-----------------------------------------+
| kernel | 2.6.34 | R | Make sure the following are enabled |
| | | | compiled in or as a module: |
| | | | - virtio-pci |
| | | | - virtio-serial |
| | | | - virtio-block |
| | | | - virtio-net |
+--------------+-------------+---+-----------------------------------------+
| supermin | 5.1.0 | R | This is required on all distros. |
| | | | 'supermin' is the new name for |
| | | | 'febootstrap'. |
| | | | For alternatives, see: |
| | | | libguestfs.org/download/binaries/appliance/
+--------------+-------------+---+-----------------------------------------+
| glibc | | R | We use various glibc-isms. |
| | | | Also glibc provides XDR, rpcgen. |
+--------------+-------------+---+-----------------------------------------+
| GCC or LLVM | | R | We use __attribute__((cleanup)). |
+--------------+-------------+---+-----------------------------------------+
| Perl | | R | Various build and test programs need |
| | | | Perl. Not needed at runtime except if |
| | | | you need to run a handful of virt-* |
| | | | tools that are still written in Perl. |
+--------------+-------------+---+-----------------------------------------+
| Pod::Man | | R | Part of Perl core. |
+--------------+-------------+---+-----------------------------------------+
| Pod::Simple | | R | Part of Perl core. |
+--------------+-------------+---+-----------------------------------------+
| OCaml | |R/O| Required if compiling from git. |
| | | | Optional if compiling from tarball. |
| | | | To build generated files and OCaml bindings.
+--------------+-------------+---+-----------------------------------------+
| autotools | |R/O| Required if compiling from git. |
| | | | Optional if compiling from tarball. |
| | | | Autotools-based build system. |
+--------------+-------------+---+-----------------------------------------+
| cpio | | R | |
+--------------+-------------+---+-----------------------------------------+
| gperf | | R | |
+--------------+-------------+---+-----------------------------------------+
| flex | | R | flex & bison are required for virt- |
+--------------+-------------+---| builder. We could make these |
| bison | | R | optional but automakes makes it hard. |
+--------------+-------------+---+-----------------------------------------+
| PCRE | | R | Perl-compatible Regular Expression lib. |
+--------------+-------------+---+-----------------------------------------+
| genisoimage | | R | mkisofs may work. |
+--------------+-------------+---+-----------------------------------------+
| libxml2 | | R | Popular XML library. |
+--------------+-------------+---+-----------------------------------------+
| augeas | 1.0.0 | R | |
+--------------+-------------+---+-----------------------------------------+
| xz | | R | Used to compress disk images. |
| | | | Used by virt-builder for compression. |
+--------------+-------------+---+-----------------------------------------+
| po4a | |R/O| Required if compiling from git. |
| | | | Optional if compiling from tarball. |
| | | | For localizing man pages. |
+--------------+-------------+---+-----------------------------------------+
| hivex | 1.2.7 |R/O| Require if compiling from git. |
| | | | Windows Registry hive parser. |
+--------------+-------------+---+-----------------------------------------+
| libmagic | | O | The library used by the 'file' command. |
+--------------+-------------+---+-----------------------------------------+
| libvirt | | O | >= 0.10.2 is needed if you want to use |
| | | | libvirt to manage transient VMs. |
+--------------+-------------+---+-----------------------------------------+
| xmllint | | O | Part of libxml2. Used for tests only. |
+--------------+-------------+---+-----------------------------------------+
| libconfig | | O | Used to parse libguestfs's own config |
| | | | files eg. /etc/libguestfs-tools.conf. |
+--------------+-------------+---+-----------------------------------------+
| libselinux | | O | Used by the libvirt backend to securely |
| | | | confine the appliance (sVirt). |
+--------------+-------------+---+-----------------------------------------+
| db utils | | O | db_dump, db_load etc. Usually found in |
| | | | a package called db-utils, db4-utils, |
| | | | db4.X-utils, Berkeley DB utils, etc. |
+--------------+-------------+---+-----------------------------------------+
| systemtap | | O | For userspace probes. |
+--------------+-------------+---+-----------------------------------------+
| readline | | O | For nicer command line in guestfish. |
+--------------+-------------+---+-----------------------------------------+
| acl | | O | Library (libacl) and programs for |
| | | | handling POSIX ACLs. |
+--------------+-------------+---+-----------------------------------------+
| libcap | | O | Library (libcap) and programs for |
| | | | handling Linux capabilities. |
+--------------+-------------+---+-----------------------------------------+
| libldm | | O | Library (libldm) and 'ldmtool' for |
| | | | handling Windows Dynamic Disks. |
+--------------+-------------+---+-----------------------------------------+
| sd-journal | | O | systemd journal library |
+--------------+-------------+---+-----------------------------------------+
| yajl | 2 | O | JSON parser for parsing output of |
| | | | ldmtool and qemu-img info commands. |
+--------------+-------------+---+-----------------------------------------+
| gdisk | | O | GPT disk support. |
+--------------+-------------+---+-----------------------------------------+
| netpbm | | O | Render icons from guests. |
+--------------+-------------+---+-----------------------------------------+
| icoutils | | O | Render icons from Windows guests. |
+--------------+-------------+---+-----------------------------------------+
| Expect | | O | Perl module used to test virt-rescue. |
+--------------+-------------+---+-----------------------------------------+
| FUSE | | O | fusermount, libfuse, and kernel module |
| | | | are all needed if you want guestmount |
| | | | and/or 'mount-local' support. |
+--------------+-------------+---+-----------------------------------------+
| static glibc | | O | Used for testing only. |
+--------------+-------------+---+-----------------------------------------+
| qemu-nbd | | O | Used for testing only. |
+--------------+-------------+---+-----------------------------------------+
| uml_mkcow | | O | For the UML backend. |
+--------------+-------------+---+-----------------------------------------+
| curl | | O | Used by virt-builder for downloads |
+--------------+-------------+---+-----------------------------------------+
| gpg | | O | Used by virt-builder for digital |
| | | | signatures |
+--------------+-------------+---+-----------------------------------------+
| liblzma | | O | Can be used by virt-builder for fast |
| | | | uncompression of templates. |
+--------------+-------------+---+-----------------------------------------+
| findlib | | O | For the OCaml bindings. |
+--------------+-------------+---+-----------------------------------------+
| ocaml-gettext| | O | For localizing OCaml virt-* tools. |
+--------------+-------------+---+-----------------------------------------+
| Python | 2.2 | O | For the Python bindings. |
+--------------+-------------+---+-----------------------------------------+
| Ruby | | O | >= 1.9 is better than 1.8. |
+--------------+-------------+---+-----------------------------------------+
| rake | | O | For the Ruby bindings. |
+--------------+-------------+---+-----------------------------------------+
| rubygem-minitest | O | For the Ruby bindings. |
+--------------+-------------+---+-----------------------------------------+
| Java | 1.6 | O | Java + JNI + jpackage-utils are needed |
| | | | for the Java bindings. |
+--------------+-------------+---+-----------------------------------------+
| GHC | | O | For the Haskell bindings. |
+--------------+-------------+---+-----------------------------------------+
| PHP | | O | For the PHP bindings. |
+--------------+-------------+---+-----------------------------------------+
| phpize | | O | For the PHP bindings. |
+--------------+-------------+---+-----------------------------------------+
| glib2 | | O | For the GObject bindings. |
+--------------+-------------+---+-----------------------------------------+
| gobject-introspection | O | For the GObject bindings. |
+--------------+-------------+---+-----------------------------------------+
| gjs | | O | For testing the GObject bindings. |
+--------------+-------------+---+-----------------------------------------+
| LUA | | O | For the LUA bindings. |
+--------------+-------------+---+-----------------------------------------+
| Erlang | | O | For the Erlang bindings. |
+--------------+-------------+---+-----------------------------------------+
| erl_interface| | O | For the Erlang bindings. |
+--------------+-------------+---+-----------------------------------------+
| golang | 1.1.1 | O | For the Go bindings. |
+--------------+-------------+---+-----------------------------------------+
| valgrind | | O | For testing for memory problems. |
+--------------+-------------+---+-----------------------------------------+
| Sys::Virt | | O | Perl bindings for libvirt. |
+--------------+-------------+---+-----------------------------------------+
| Win::Hivex | | O | Perl bindings for hivex. |
+--------------+-------------+---+-----------------------------------------+
| Pod::Usage | | O | Perl module used by tests. |
+--------------+-------------+---+-----------------------------------------+
| Test::More | | O | Perl module used by tests. |
+--------------+-------------+---+-----------------------------------------+
| XML::XPath | | O | Perl module used by some virt-* tools. |
+--------------+-------------+---+-----------------------------------------+
| XML::XPath::XMLParser | O | Perl module used by some virt-* tools. |
+--------------+-------------+---+-----------------------------------------+
| perl-libintl | | O | Perl module for localization. |
+--------------+-------------+---+-----------------------------------------+
| bash-completion | O | For tab-completion of commands in bash. |
+==============+=============+===+=========================================+
R = Required
O = Optional
Building
----------------------------------------------------------------------
Build the daemon, library and root filesystem:
building from tarball building from git
--------------------- -----------------
./configure ./autogen.sh
make make
Run the tests:
make check
Also:
make check-valgrind
runs a subset of the test suite under valgrind (requires valgrind to
be installed obviously).
make check-all
runs check-valgrind + even more tests, but these require that you have
some libvirt guests installed, that these guests' disks are accessible
by the current user, and these tests may fail for other reasons which
are not necessarily because of real problems.
make help
lists all 'make' targets.
You may install the library by running the following command as root.
However *most users should probably not do this*. Instead, './run'
the programs from the build directory as described below.
make install
Distro packagers should use this instead:
make INSTALLDIRS=vendor [DESTDIR=...] install
You can run guestfish, guestmount and the virt tools without needing
to install, using the "./run" script in the top directory. This
script sets up some environment variables. For example:
./run guestfish [usual guestfish args ...]
./run virt-inspector [usual virt-inspector args ...]
If you are already in the fish/ subdirectory, then the following
command will also work:
../run guestfish [...]
The ./run script adds every libguestfs binary to the $PATH, so the
above example runs guestfish from the build directory (not the
globally installed guestfish if there is one).
You can also run the C programs under valgrind like this:
./run valgrind [valgrind opts...] virt-cat [virt-cat opts...]
or under gdb:
./run gdb --args virt-cat [virt-cat opts...]
This also works with sudo (eg. if you need root access for libvirt or
to access a block device):
sudo ./run virt-cat -d LinuxGuest /etc/passwd
qemu
----------------------------------------------------------------------
By far the most common problem is with broken or incompatible
qemu releases.
Different versions of qemu have problems booting the appliance for
different reasons. This varies between versions of qemu, and Linux
distributions which add their own patches.
If you find a problem, you could try using your own qemu built from
source (qemu is very easy to build from source), with a 'qemu
wrapper'. Qemu wrappers are described in the guestfs(3) manpage.
Note on using KVM
----------------------------------------------------------------------
By default the configure script will look for qemu-kvm (KVM support).
You will need a reasonably recent processor for this to work. KVM is
much faster than using plain Qemu.
You may also need to enable KVM support for non-root users, by following
these instructions:
http://www.linux-kvm.org/page/FAQ#How_can_I_use_kvm_with_a_non-privileged_user.3F
On some systems, this will work too:
chmod 0666 /dev/kvm
On some systems, the chmod will not survive a reboot, and you will
need to make edits to the udev configuration.
Mirroring tip
----------------------------------------------------------------------
On my machines I can usually rebuild the appliance in around 3
minutes. If it takes much longer for you, use a local distro mirror
or squid.
To use squid to cache yum downloads, read this first:
https://lists.dulug.duke.edu/pipermail/yum/2006-August/009041.html
(In brief, because yum chooses random mirrors each time, squid doesn't
work very well with default yum configuration. To get around this,
choose a Fedora mirror which is close to you, set this with
'./configure --with-mirror=[...]', and then proxy the whole lot
through squid by setting http_proxy environment variable).
You will also need to substantially increase the squid configuration
limits:
http://fedoraproject.org/wiki/Using_Mock_to_test_package_builds#Using_Squid_to_Speed_Up_Mock_package_downloads
Porting to other Linux distros / non-Linux
----------------------------------------------------------------------
libguestfs itself should be fairly portable to other Linux
distributions. Non-Linux ports are trickier, but we will accept
patches if they aren't too invasive.
The main porting issues are with the dependencies needed to build the
appliance. You will need to port febootstrap first
(http://people.redhat.com/~rjones/febootstrap/).
Note on using clang (from LLVM) instead of GCC
----------------------------------------------------------------------
export CC=clang
./configure --disable-probes
make
SystemTap/DTrace-style userspace probe points don't work under the
clang compiler, which is why you may need to disable them.
Don't enable GCC warnings (ie. *don't* use
'./configure --enable-gcc-warnings').
Copyright and license information
----------------------------------------------------------------------
Copyright (C) 2009-2014 Red Hat Inc.
Copyright (C) 2009-2016 Red Hat Inc.
The library is distributed under the LGPLv2+. The programs are
distributed under the GPLv2+. Please see the files COPYING and
COPYING.LIB for full license information.
The examples are under a very liberal license.
COPYING.LIB for full license information. The examples are under a
very liberal license.

35
ROADMAP
View File

@@ -1,35 +0,0 @@
Roadmap for future releases
---------------------------
Before you read this:
(1) To see what's in the current release, read 'guestfs-release-notes(1)'.
(2) To see the list of bugs, read 'BUGS'.
(3) To understand libguestfs versioning, read this:
http://libguestfs.org/guestfs.3.html#libguestfs_version_numbers
(4) For general "might be good to have" items, see 'TODO'.
For next major stable release (1.26)
------------------------------------
Bugs assigned to 1.26 (put "1.26" in the Devel Whiteboard field in
Bugzilla):
https://bugzilla.redhat.com/buglist.cgi?query_format=advanced&field0-0-0=cf_devel_whiteboard&bug_status=NEW&bug_status=ASSIGNED&bug_status=MODIFIED&bug_status=ON_DEV&bug_status=ON_QA&bug_status=VERIFIED&bug_status=FAILS_QA&bug_status=RELEASE_PENDING&bug_status=POST&bug_status=PASSES_QA&type0-0-0=anywords&value0-0-0=1.26&component=libguestfs&product=Virtualization%20Tools
Beyond 1.26
-----------
* Make 'guestfish --ro' be the default, and get users to use
'guestfish --rw' for write access (but allow the default to be
overridden in a configuration file). This was originally planned
for 1.10 but there's not nearly enough adoption of the new
'guestfish --rw' option out there to do this yet.
* Write a new partition handling library to replace parted, and use it
instead of parted. (RHBZ#593511, RHBZ#642821).
See TODO and BUGS files.

40
TODO
View File

@@ -501,12 +501,6 @@ this approach works, it doesn't solve the MBR problem, so likely we'd
have to write a library for that (or perhaps go back to sfdisk but
using a very abstracted interface over sfdisk).
virt-sparsify should use discard
--------------------------------
This requires some changes to qemu to make discard work properly
throughout the entire stack.
Reimplement some APIs to avoid protocol limits
----------------------------------------------
@@ -538,34 +532,18 @@ Ruby 1.8, and/or maintain volatile VALUEs on the stack.
virt-builder
------------
- set keyboard
- set default timezone and language
- set permissions on uploaded files & created directories
- how can we give users a shell for debugging purposes?
- allow non-xz-compressed templates (faster)
- let notes etc be localized, ie. notes[en]=...
- add a CLI option to print the in-built path/fingerprint(s)
- allow public keys to come from local file paths
- doing virt-builder then running (eg. via qemu, libvirt?) is common; is
it possible to make this more automatic?
- more common code between virt-sysprep & virt-builder:
* virt-sysprep should have --run, --run-command,
--firstboot-command options with common code from virt-builder
- document:
* how to integrate with ansible, puppet, chef
* how to import to OpenStack / Glance
* how to integrate with ansible, chef [puppet documented already]
* how to import to EC2
- /etc/resolv.conf handling works but is best described as a hack:
@@ -585,8 +563,16 @@ Write an extension for mc that would let people browse into
filesystems. See
http://repo.or.cz/w/midnight-commander.git/tree/HEAD:/misc/ext.d
Python
------
Improvements in virt-log
------------------------
It seems as if we should call PyErr_Clear() somewhere in every
Python binding.
- Make it faster, especially if the user wants to grep the output.
- Support Windows guests, see
http://rwmj.wordpress.com/2011/04/17/decoding-the-windows-event-log-using-guestfish/
Subsecond handling in virt-diff, virt-ls
----------------------------------------
Handle nanoseconds properly. You should be able to specify them on
the command line and display them.

View File

@@ -22,7 +22,9 @@ EXTRA_DIST = \
test-virt-alignment-scan-guests.sh \
virt-alignment-scan.pod
CLEANFILES = stamp-virt-alignment-scan.pod
CLEANFILES = \
stamp-virt-alignment-scan.pod \
virt-alignment-scan.1
bin_PROGRAMS = virt-alignment-scan
@@ -58,7 +60,6 @@ virt_alignment_scan_CPPFLAGS = \
virt_alignment_scan_CFLAGS = \
-pthread \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(GPROF_CFLAGS) $(GCOV_CFLAGS) \
$(LIBCONFIG_CFLAGS) \
$(LIBXML2_CFLAGS) \
$(LIBVIRT_CFLAGS)
@@ -69,20 +70,22 @@ virt_alignment_scan_LDADD = \
$(top_builddir)/src/libguestfs.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
../gnulib/lib/libgnu.la \
-lm
# Manual pages and HTML files for the website.
man_MANS = virt-alignment-scan.1
noinst_DATA = $(top_builddir)/html/virt-alignment-scan.1.html
noinst_DATA = $(top_builddir)/website/virt-alignment-scan.1.html
virt-alignment-scan.1 $(top_builddir)/html/virt-alignment-scan.1.html: stamp-virt-alignment-scan.pod
virt-alignment-scan.1 $(top_builddir)/website/virt-alignment-scan.1.html: stamp-virt-alignment-scan.pod
stamp-virt-alignment-scan.pod: virt-alignment-scan.pod
$(PODWRAPPER) \
--man virt-alignment-scan.1 \
--html $(top_builddir)/html/virt-alignment-scan.1.html \
--html $(top_builddir)/website/virt-alignment-scan.1.html \
--license GPLv2+ \
--warning safe \
$<
touch $@

View File

@@ -71,28 +71,27 @@ usage (int status)
{
if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
guestfs_int_program_name);
else {
fprintf (stdout,
_("%s: check alignment of virtual machine partitions\n"
"Copyright (C) 2011 Red Hat Inc.\n"
"Usage:\n"
" %s [--options] -d domname\n"
" %s [--options] -a disk.img [-a disk.img ...]\n"
"Options:\n"
" -a|--add image Add image\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" -d|--domain guest Add disks from libvirt guest\n"
" --format[=raw|..] Force disk format for -a option\n"
" --help Display brief help\n"
" -P nr_threads Use at most nr_threads\n"
" -q|--quiet No output, just exit code\n"
" -v|--verbose Verbose messages\n"
" -V|--version Display version and exit\n"
" -x Trace libguestfs API calls\n"
"For more information, see the manpage %s(1).\n"),
program_name, program_name, program_name,
program_name);
printf (_("%s: check alignment of virtual machine partitions\n"
"Copyright (C) 2011 Red Hat Inc.\n"
"Usage:\n"
" %s [--options] -d domname\n"
" %s [--options] -a disk.img [-a disk.img ...]\n"
"Options:\n"
" -a|--add image Add image\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" -d|--domain guest Add disks from libvirt guest\n"
" --format[=raw|..] Force disk format for -a option\n"
" --help Display brief help\n"
" -P nr_threads Use at most nr_threads\n"
" -q|--quiet No output, just exit code\n"
" -v|--verbose Verbose messages\n"
" -V|--version Display version and exit\n"
" -x Trace libguestfs API calls\n"
"For more information, see the manpage %s(1).\n"),
guestfs_int_program_name, guestfs_int_program_name,
guestfs_int_program_name, guestfs_int_program_name);
}
exit (status);
}
@@ -115,6 +114,7 @@ main (int argc, char *argv[])
{ "help", 0, 0, HELP_OPTION },
{ "long-options", 0, 0, 0 },
{ "quiet", 0, 0, 'q' },
{ "short-options", 0, 0, 0 },
{ "uuid", 0, 0, 0, },
{ "verbose", 0, 0, 'v' },
{ "version", 0, 0, 'V' },
@@ -122,6 +122,7 @@ main (int argc, char *argv[])
};
struct drv *drvs = NULL;
const char *format = NULL;
bool format_consumed = true;
int c;
int option_index;
int exit_code;
@@ -142,16 +143,16 @@ main (int argc, char *argv[])
case 0: /* options which are long only */
if (STREQ (long_options[option_index].name, "long-options"))
display_long_options (long_options);
else if (STREQ (long_options[option_index].name, "short-options"))
display_short_options (options);
else if (STREQ (long_options[option_index].name, "format")) {
if (!optarg || STREQ (optarg, ""))
format = NULL;
else
format = optarg;
OPTION_format;
} else if (STREQ (long_options[option_index].name, "uuid")) {
uuid = 1;
} else {
fprintf (stderr, _("%s: unknown long option: %s (%d)\n"),
program_name, long_options[option_index].name, option_index);
guestfs_int_program_name,
long_options[option_index].name, option_index);
exit (EXIT_FAILURE);
}
break;
@@ -170,7 +171,8 @@ main (int argc, char *argv[])
case 'P':
if (sscanf (optarg, "%zu", &max_threads) != 1) {
fprintf (stderr, _("%s: -P option is not numeric\n"), program_name);
fprintf (stderr, _("%s: -P option is not numeric\n"),
guestfs_int_program_name);
exit (EXIT_FAILURE);
}
break;
@@ -211,6 +213,8 @@ main (int argc, char *argv[])
if (optind != argc)
usage (EXIT_FAILURE);
CHECK_OPTION_format_consumed;
/* virt-alignment-scan has two modes. If the user didn't specify
* any drives, then we do the scan on every libvirt guest. That's
* the if-clause below. If the user specified domains/drives, then
@@ -226,13 +230,13 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
#else
fprintf (stderr, _("%s: compiled without support for libvirt.\n"),
program_name);
guestfs_int_program_name);
exit (EXIT_FAILURE);
#endif
} else { /* Single guest. */
if (uuid) {
fprintf (stderr, _("%s: --uuid option cannot be used with -a or -d\n"),
program_name);
guestfs_int_program_name);
exit (EXIT_FAILURE);
}
@@ -279,11 +283,17 @@ scan (guestfs_h *g, const char *prefix, FILE *fp)
for (i = 0; devices[i] != NULL; ++i) {
CLEANUP_FREE char *name = NULL;
CLEANUP_FREE_PARTITION_LIST struct guestfs_partition_list *parts = NULL;
CLEANUP_FREE_PARTITION_LIST struct guestfs_partition_list *parts =
guestfs_part_list (g, devices[i]);
if (parts == NULL)
return -1;
guestfs_push_error_handler (g, NULL, NULL);
parts = guestfs_part_list (g, devices[i]);
guestfs_pop_error_handler (g);
if (parts == NULL) {
if (guestfs_last_errno (g) == EINVAL) /* unrecognised disk label */
continue;
else
return -1;
}
/* Canonicalize the name of the device for printing. */
name = guestfs_canonical_device_name (g, devices[i]);
@@ -350,15 +360,15 @@ scan (guestfs_h *g, const char *prefix, FILE *fp)
static int
scan_work (guestfs_h *g, size_t i, FILE *fp)
{
struct guestfs___add_libvirt_dom_argv optargs;
struct guestfs_add_libvirt_dom_argv optargs;
optargs.bitmask =
GUESTFS___ADD_LIBVIRT_DOM_READONLY_BITMASK |
GUESTFS___ADD_LIBVIRT_DOM_READONLYDISK_BITMASK;
GUESTFS_ADD_LIBVIRT_DOM_READONLY_BITMASK |
GUESTFS_ADD_LIBVIRT_DOM_READONLYDISK_BITMASK;
optargs.readonly = 1;
optargs.readonlydisk = "read";
if (guestfs___add_libvirt_dom (g, domains[i].dom, &optargs) == -1)
if (guestfs_add_libvirt_dom_argv (g, domains[i].dom, &optargs) == -1)
return -1;
if (guestfs_launch (g) == -1)

View File

@@ -23,10 +23,10 @@ if [ -n "$SKIP_TEST_VIRT_ALIGNMENT_SCAN_GUESTS_SH" ]; then
exit 77
fi
guestsdir="$(cd ../tests/guests && pwd)"
guestsdir="$(cd ../test-data/phony-guests && pwd)"
libvirt_uri="test://$guestsdir/guests-all-good.xml"
$VG ./virt-alignment-scan -c "$libvirt_uri"
$VG virt-alignment-scan -c "$libvirt_uri"
r=$?
# 0, 2 and 3 are reasonable non-error exit codes. Others are errors.

View File

@@ -18,7 +18,7 @@
export LANG=C
$VG ./virt-alignment-scan -a ../tests/guests/fedora.img
$VG virt-alignment-scan -a ../test-data/phony-guests/fedora.img
r=$?
# 0, 2 and 3 are reasonable non-error exit codes. Others are errors.

View File

@@ -67,7 +67,7 @@ program. The columns are:
=item col 1
The device and partition name (eg. C</dev/sda1> meaning the
The device and partition name (eg. F</dev/sda1> meaning the
first partition on the first block device).
When listing all libvirt domains (no I<-a> or I<-d> option given) this
@@ -151,12 +151,12 @@ For example:
virt-alignment-scan --format=raw -a disk.img
forces raw format (no auto-detection) for C<disk.img>.
forces raw format (no auto-detection) for F<disk.img>.
virt-alignment-scan --format=raw -a disk.img --format -a another.img
forces raw format (no auto-detection) for C<disk.img> and reverts to
auto-detection for C<another.img>.
forces raw format (no auto-detection) for F<disk.img> and reverts to
auto-detection for F<another.img>.
If you have untrusted raw-format guest disk images, you should use
this option to specify the disk format. This avoids a possible
@@ -250,13 +250,13 @@ Partitions which are not aligned correctly to the underlying
storage cause extra I/O. For example:
sect#63
+--------------------------+------
| guest |
| filesystem block |
---+------------------+------+-------------------+-----+---
| host block | host block |
| | |
---+-------------------------+-------------------------+---
┌──────────────────────────┬ ─ ─ ─ ─
guest
filesystem block
─ ┬──────────────────┴──────┬───────────────────┴─────┬ ─ ─
host block host block
─ ┴─────────────────────────┴─────────────────────────┴ ─ ─
In this example, each time a 4K guest block is read, two blocks on the
host must be accessed (so twice as much I/O is done). When a 4K guest
@@ -347,13 +347,6 @@ contains an explicit C<%pre> section that creates aligned partitions
using L<parted(8)>. Do not use the Kickstart C<part> command. The
NetApp document above contains an example.
=head1 SHELL QUOTING
Libvirt guest names can contain arbitrary characters, some of which
have meaning to the shell such as C<#> and space. You may need to
quote or escape these characters on the command line. See the shell
manual page L<sh(1)> for details.
=head1 EXIT STATUS
This program returns:

View File

@@ -1,5 +1,5 @@
# libguestfs
# Copyright (C) 2009-2014 Red Hat Inc.
# Copyright (C) 2009-2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,8 @@ include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = \
99-guestfs-serial.rules \
excludefiles.in \
guestfsd.suppressions \
guestfs_lvm_conf.aug \
guestfs_shadow.aug \
hostfiles.in \
init \
libguestfs-make-fixed-appliance.in \
@@ -42,7 +43,7 @@ superminfs_DATA = \
supermin.d/udev-rules.tar.gz
supermin.d/base.tar.gz supermin.d/packages: stamp-supermin
stamp-supermin: make.sh packagelist
stamp-supermin: make.sh packagelist supermin.d/excludefiles
rm -f $@ supermin.d/base.tar.gz supermin.d/packages
./make.sh
$(MAKE) \
@@ -64,9 +65,6 @@ make.sh: make.sh.in $(top_builddir)/config.log $(top_builddir)/config.status
rm -f $@-t
PACKAGELIST_CPP_FLAGS = -D$(DISTRO)=1 -DEXTRA_PACKAGES="$(EXTRA_PACKAGES)"
if VALGRIND_DAEMON
PACKAGELIST_CPP_FLAGS += -DVALGRIND_DAEMON=1
endif
packagelist: packagelist.in Makefile
m4 $(PACKAGELIST_CPP_FLAGS) $< | \
@@ -74,27 +72,31 @@ packagelist: packagelist.in Makefile
cmp -s $@ $@-t || mv $@-t $@
rm -f $@-t
supermin.d/daemon.tar.gz: ../daemon/guestfsd guestfsd.suppressions
supermin.d/daemon.tar.gz: ../daemon/guestfsd guestfs_lvm_conf.aug guestfs_shadow.aug
rm -f $@ $@-t
rm -rf tmp-d
mkdir -p tmp-d$(DAEMON_SUPERMIN_DIR) tmp-d/etc
mkdir -p tmp-d$(DAEMON_SUPERMIN_DIR) tmp-d/etc tmp-d/usr/share/guestfs
ln ../daemon/guestfsd tmp-d$(DAEMON_SUPERMIN_DIR)/guestfsd
ln $(srcdir)/guestfsd.suppressions tmp-d/etc/guestfsd.suppressions
ln $(srcdir)/guestfs_lvm_conf.aug tmp-d/usr/share/guestfs/guestfs_lvm_conf.aug
ln $(srcdir)/guestfs_shadow.aug tmp-d/usr/share/guestfs/guestfs_shadow.aug
( cd tmp-d && tar zcf - * ) > $@-t
rm -r tmp-d
mv $@-t $@
# Note we must avoid touching supermin.d if possible, so don't create
# the temporary files inside the supermin.d directory.
supermin.d/excludefiles: excludefiles.in Makefile
m4 $(PACKAGELIST_CPP_FLAGS) $< | \
grep -v '^[[:space:]]*$$' | grep -v '^#' > $@-t
cmp -s $@ $@-t || mv $@-t $@
rm -f $@-t
grep -v '^[[:space:]]*$$' | grep -v '^#' > excludefiles-t
cmp -s $@ excludefiles-t || mv excludefiles-t $@
rm -f excludefiles-t
supermin.d/hostfiles: hostfiles.in Makefile
m4 $(PACKAGELIST_CPP_FLAGS) $< | \
grep -v '^[[:space:]]*$$' | grep -v '^#' > $@-t
cmp -s $@ $@-t || mv $@-t $@
rm -f $@-t
grep -v '^[[:space:]]*$$' | grep -v '^#' > hostfiles-t
cmp -s $@ hostfiles-t || mv hostfiles-t $@
rm -f hostfiles-t
supermin.d/init.tar.gz: init
rm -f $@ $@-t
@@ -125,13 +127,14 @@ sbin_SCRIPTS = libguestfs-make-fixed-appliance
man_MANS = libguestfs-make-fixed-appliance.1
libguestfs-make-fixed-appliance.1 $(top_builddir)/html/libguestfs-make-fixed-appliance.1.html: stamp-libguestfs-make-fixed-appliance.pod
libguestfs-make-fixed-appliance.1 $(top_builddir)/website/libguestfs-make-fixed-appliance.1.html: stamp-libguestfs-make-fixed-appliance.pod
stamp-libguestfs-make-fixed-appliance.pod: libguestfs-make-fixed-appliance.pod
$(PODWRAPPER) \
--man libguestfs-make-fixed-appliance.1 \
--html $(top_builddir)/html/libguestfs-make-fixed-appliance.1.html \
--html $(top_builddir)/website/libguestfs-make-fixed-appliance.1.html \
--license GPLv2+ \
--warning safe \
$<
touch $@
@@ -143,5 +146,7 @@ CLEANFILES = \
stamp-libguestfs-make-fixed-appliance.pod
DISTCLEANFILES = \
make.sh \
packagelist \
stamp-supermin \
supermin.d/*

View File

@@ -11,6 +11,9 @@ dnl REDHAT=1 For Fedora, RHEL, EPEL and workalikes.
dnl DEBIAN=1 For Debian.
dnl UBUNTU=1 For Ubuntu.
dnl ARCHLINUX=1 For Archlinux.
dnl SUSE=1 For OpenSUSE.
dnl FRUGALWARE=1 For Frugalware.
dnl MAGEIA=1 For Mageia.
dnl
dnl Note that any matching file will be dropped from the appliance.
dnl Of course, this may break the appliance, so be careful.
@@ -18,17 +21,52 @@ dnl Of course, this may break the appliance, so be careful.
dnl The right kernel modules are added back by supermin.
-/boot/*
-/lib/modules/*
-/usr/lib/modules/*
dnl Firmware blobs should not be required by a virtual machine.
dnl Because of UsrMove nonsense, we need to list both directories.
-/lib/firmware/*
-/usr/lib/firmware/*
-/usr/lib/locale/*
-/usr/share/cracklib/*
-/usr/share/doc/*
-/usr/share/fonts/*
-/usr/share/gnome/help/*
-/usr/share/i18n/*
-/usr/share/icons/*
-/usr/share/info/*
-/usr/share/locale/*
-/usr/share/man/*
-/usr/share/doc/*
-/usr/share/info/*
-/usr/share/gnome/help/*
-/usr/share/cracklib/*
-/usr/share/i18n/*
-/usr/share/pkgconfig/*
-/var/log/?tmp
-/var/log/*.gz
-/var/log/*.log*
-/var/log/cron*
-/var/log/lastlog*
-/var/log/maillog*
-/var/log/messages*
-/var/log/secure*
-/var/log/syslog*
-/var/log/tallylog*
-/var/log/*/*.gz
-/var/log/*/*.log*
-/var/log/*/syslog*
-/var/log/sa/*
dnl For Debian:
-/usr/share/lintian/*
-/usr/share/initramfs-tools/*
-/usr/share/doc-base/*
-/usr/share/bug/*
-/etc/initramfs-tools/*
dnl For Ubuntu:
ifelse(UBUNTU,1,
dnl This lvm2 rule automatically re-enables vgs when they are added
dnl or changed
-/lib/udev/rules.d/85-lvm2.rules
)

View File

@@ -0,0 +1,74 @@
(*
Module: LVM
Parses LVM metadata.
Author: Gabriel de Perthuis <g2p.code+augeas@gmail.com>
About: License
This file is licensed under the LGPL v2+.
About: Configuration files
This lens applies to files in /etc/lvm/backup and /etc/lvm/archive.
About: Examples
The <Test_LVM> file contains various examples and tests.
*)
module Guestfs_LVM_conf =
autoload xfm
(* See lvm2/libdm/libdm-config.c for tokenisation;
* libdm uses a blacklist but I prefer the safer whitelist approach. *)
(* View: identifier
* The left hand side of a definition *)
let identifier = /[a-zA-Z0-9_-]+/
(* strings can contain backslash-escaped dquotes, but I don't know
* how to get the message across to augeas *)
let str = [label "str". Quote.do_dquote (store /([^\"]|\\\\.)*/)]
let int = [label "int". store Rx.relinteger]
(* View: flat_literal
* A literal without structure *)
let flat_literal = int|str
(* allow multiline and mixed int/str, used for raids and stripes *)
(* View: list
* A list containing flat literals *)
let list = [
label "list" . counter "list"
. del /\[[ \t\n]*/ "["
.([seq "list". flat_literal . del /,[ \t\n]*/ ", "]*
. [seq "list". flat_literal . del /[ \t\n]*/ ""])?
. Util.del_str "]"]
(* View: val
* Any value that appears on the right hand side of an assignment *)
let val = flat_literal | list
(* View: nondef
* A line that doesn't contain a statement *)
let nondef =
Util.empty
| Util.comment
(* Build.block couldn't be reused, because of recursion and
* a different philosophy of whitespace handling. *)
(* View: def
* An assignment, or a block containing definitions *)
let rec def = [
Util.indent . key identifier . (
del /[ \t]*\{\n/ " {\n"
.[label "dict".(nondef | def)*]
. Util.indent . Util.del_str "}\n"
|Sep.space_equal . val . Util.comment_or_eol)]
(* View: lns
* The main lens *)
let lns = (nondef | def)*
let filter =
incl "/etc/lvm/archive/*.vg"
. incl "/etc/lvm/backup/*"
. Util.stdexcl
let xfm = transform lns filter

View File

@@ -0,0 +1,72 @@
(*
Module: Shadow
Parses /etc/shadow
Author: Lorenzo M. Catucci <catucci@ccd.uniroma2.it>
Original Author: Free Ekanayaka <free@64studio.com>
About: Reference
- man 5 shadow
- man 3 getspnam
About: License
This file is licensed under the LGPL v2+, like the rest of Augeas.
About:
Each line in the shadow files represents the additional shadow-defined attributes
for the corresponding user, as defined in the passwd file.
*)
module Guestfs_Shadow =
autoload xfm
(************************************************************************
* USEFUL PRIMITIVES
*************************************************************************)
let eol = Util.eol
let comment = Util.comment
let empty = Util.empty
let dels = Util.del_str
let colon = Sep.colon
let word = Rx.word
let integer = Rx.integer
let sto_to_col = Passwd.sto_to_col
let sto_to_eol = Passwd.sto_to_eol
(************************************************************************
* Group: ENTRIES
*************************************************************************)
(* View: entry *)
let entry = [ key word
. colon
. [ label "password" . sto_to_col? . colon ]
. [ label "lastchange_date" . store integer? . colon ]
. [ label "minage_days" . store integer? . colon ]
. [ label "maxage_days" . store integer? . colon ]
. [ label "warn_days" . store integer? . colon ]
. [ label "inactive_days" . store integer? . colon ]
. [ label "expire_date" . store integer? . colon ]
. [ label "flag" . store integer? ]
. eol ]
(************************************************************************
* LENS
*************************************************************************)
let lns = (comment|empty|entry) *
let filter
= incl "/shadow"
. Util.stdexcl
let xfm = transform lns filter

View File

@@ -1,27 +0,0 @@
# This file is only used when libguestfs is configured with
#
# ./configure --enable-valgrind-daemon
#
# (only used for development, and only used in the regular supermin
# appliance, not libguestfs live).
#
# If there are any valgrind errors in the base libraries such as
# glibc, then we can suppress them here, so we only see errors in
# libguestfs daemon code.
# libdl
{
libdl_index_cond
Memcheck:Cond
fun:index
fun:expand_dynamic_string_token
fun:_dl_map_object
}
# aug_setm memory leak
{
aug_setm_leak
Memcheck:Leak
...
fun:aug_setm
}

View File

@@ -9,6 +9,9 @@ dnl REDHAT=1 For Fedora, RHEL, EPEL and workalikes.
dnl DEBIAN=1 For Debian.
dnl UBUNTU=1 For Ubuntu.
dnl ARCHLINUX=1 For Archlinux.
dnl SUSE=1 For OpenSUSE.
dnl FRUGALWARE=1 For Frugalware.
dnl MAGEIA=1 For Mageia.
/lib/lsb/*
/usr/share/augeas/lenses/*.aug

View File

@@ -10,6 +10,17 @@ RUNLEVEL=S
PREVLEVEL=N
export RUNLEVEL PREVLEVEL
# Make sure /tmp /var/tmp are real directories, not symlinks.
if [ ! -d /tmp ] || [ ! -d /var/tmp ]; then
rm -f /tmp /var/tmp
mkdir /tmp /var/tmp
chmod 1777 /tmp /var/tmp
fi
# Make sure to find all the libraries, also those in non-standard place
# but with a proper ld.so configuration pointing at them
ldconfig
# Try to print a stack trace for segfaults inside the appliance.
for d in /lib64 /lib; do
f=$d/libSegFault.so
@@ -34,9 +45,22 @@ mount -t tmpfs -o "nosuid,size=20%,mode=0755" tmpfs /run
mkdir -p /run/lock
ln -s ../run/lock /var/lock
# On Fedora 23, util-linux creates /etc/mtab in %post .. stupid
# and e2fsprogs fails if the link doesn't exist .. stupid stupid
ln -s /proc/mounts /etc/mtab
# devtmpfs is required since udev 176
mount -t devtmpfs /dev /dev
# Static nodes must happen before udev is started.
# Set up kmod static-nodes (RHBZ#1011907).
mkdir -p /run/tmpfiles.d
kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf
# Set up tmpfiles (must run after kmod.conf is created above).
systemd-tmpfiles --prefix=/dev --create --boot
# Find udevd and run it directly.
for f in /sbin/udevd /lib/udev/udevd \
/lib/systemd/systemd-udevd /usr/lib/systemd/systemd-udevd \
@@ -47,7 +71,7 @@ if [ -z "$UDEVD" ]; then
echo "udev not found! Things will probably not work ..."
fi
$UDEVD --daemon
$UDEVD --daemon #--debug
udevadm trigger
udevadm settle --timeout=600
@@ -55,13 +79,6 @@ if grep -sq selinux=1 /proc/cmdline; then
mount -t selinuxfs none /sys/fs/selinux
fi
# Set up kmod static-nodes (RHBZ#1011907).
mkdir -p /run/tmpfiles.d
kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf
# Set up tmpfiles (must run after kmod.conf is created above).
systemd-tmpfiles --prefix=/dev --create
# Disk optimizations.
# Increase the SCSI timeout so we can read remote images.
for f in /sys/block/sd*/device/timeout; do echo 300 > $f; done
@@ -71,16 +88,33 @@ for f in /sys/block/{h,s,ub,v}d*/queue/scheduler; do echo noop > $f; done
# Update the system clock.
hwclock -u -s
# Parse the kernel command line.
if grep -sq guestfs_verbose=1 /proc/cmdline; then
guestfs_verbose=1
fi
if grep -sq guestfs_network=1 /proc/cmdline; then
guestfs_network=1
fi
if grep -sq guestfs_rescue=1 /proc/cmdline; then
guestfs_rescue=1
fi
if grep -sq guestfs_noreboot=1 /proc/cmdline; then
guestfs_noreboot=1
fi
eval `grep -Eo 'guestfs_channel=[^[:space:]]+' /proc/cmdline`
# Set up the network.
ip addr add 127.0.0.1/8 brd + dev lo scope host
ip link set dev lo up
ip addr add 169.254.2.10/16 brd + dev eth0 scope global
ip link set dev eth0 up
ip route add default via 169.254.2.2
echo nameserver 169.254.2.3 > /etc/resolv.conf
if test "$guestfs_network" = 1; then
iface=$(ls -I all -I default -I lo /proc/sys/net/ipv4/conf)
if dhclient --version >/dev/null 2>&1; then
dhclient $iface
else
dhcpcd $iface
fi
fi
# Scan for MDs.
mdadm -As --auto=yes --run
@@ -95,7 +129,7 @@ lvm vgchange -aay --sysinit
ldmtool create all
# These are useful when debugging.
if grep -sq guestfs_verbose=1 /proc/cmdline; then
if test "$guestfs_verbose" = 1; then
uname -a
ls -lR /dev
cat /proc/mounts
@@ -109,42 +143,35 @@ if grep -sq guestfs_verbose=1 /proc/cmdline; then
date
echo -n "clocksource: "
cat /sys/devices/system/clocksource/clocksource0/current_clocksource
#ping -n -v -c 5 10.0.2.2
#ping -n -v -c 5 10.0.2.4
#ping -n -v -c 5 8.8.8.8
echo -n "uptime: "; cat /proc/uptime
fi
if ! grep -sq guestfs_rescue=1 /proc/cmdline; then
if ! test "$guestfs_rescue" = 1; then
# Run the daemon.
# Run the daemon under valgrind if ./configure --enable-valgrind-daemon
if grep -sq guestfs_valgrind_daemon=1 /proc/cmdline; then
if [ -r /etc/guestfsd.suppressions ]; then
suppressions="--suppressions=/etc/guestfsd.suppressions"
fi
vg="valgrind --leak-check=full --error-exitcode=119 --max-stackframe=8388608 --child-silent-after-fork=yes $suppressions"
echo "enabling valgrind: $vg"
cmd="guestfsd"
if test "x$guestfs_channel" != "x"; then
cmd="$cmd --channel $guestfs_channel"
fi
# Run guestfsd, under valgrind if asked.
$vg guestfsd
if [ $? -eq 119 ]; then
echo "DAEMON VALGRIND FAILED"
# Sleep so valgrind messages are seen by the host. Note this
# only happens in non-production builds
# (--enable-valgrind-daemon) + on an error path.
sleep 10
if test "$guestfs_verbose" = 1; then
cmd="$cmd --verbose"
fi
if test "$guestfs_network" = 1; then
cmd="$cmd --network"
fi
echo $cmd
$cmd
else
# Run virt-rescue shell.
# Remove LD_PRELOAD=libSegFault set above.
unset LD_PRELOAD
eval $(grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline)
PS1='><rescue> '
export TERM PS1
:> $HOME/.bashrc
grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline >> $HOME/.bashrc
echo "PS1='><rescue> '" >> $HOME/.bashrc
echo "export TERM PS1" >> $HOME/.bashrc
echo
echo "------------------------------------------------------------"
@@ -163,7 +190,7 @@ fi
sync
if ! grep -sq guestfs_noreboot=1 /proc/cmdline; then
if ! test "$guestfs_noreboot" = 1; then
# qemu has the -no-reboot flag, so issuing a reboot here actually
# causes qemu to exit gracefully.
reboot -f

View File

@@ -38,8 +38,8 @@ L<guestfs-performance(1)>).
=back
For deeper understanding of why you might need this tool, read the
section L</FIXED APPLIANCE> below.
For deeper understanding of why you might need this tool, read
L<guestfs(3)/FIXED APPLIANCE>.
Instead of running this tool, you can download fixed appliances from
L<http://libguestfs.org/download/binaries/appliance/>. These
@@ -112,7 +112,7 @@ Display the version number and exit.
Instead of creating the appliance in an output directory, create a
compressed tarball of the appliance in the current directory called
C<appliance-I<VERSION>.tar.xz> where C<VERSION> is the version of
F<appliance-I<VERSION>.tar.xz> where C<VERSION> is the version of
libguestfs.
Using I<--xz> can take some time. If working normally, the tool is
@@ -120,30 +120,6 @@ completely silent when it is running.
=back
=head1 FIXED APPLIANCE
When libguestfs (or libguestfs tools) are run, they search a path
looking for an appliance. The path is built into libguestfs, or can
be set using the C<LIBGUESTFS_PATH> environment variable.
Normally a supermin appliance is located on this path (see
L<supermin(1)/SUPERMIN APPLIANCE>). libguestfs reconstructs this
into a full appliance by running C<supermin --build>.
However, a simpler "fixed appliance" can also be used. libguestfs
detects this by looking for a directory on the path containing four
files called C<kernel>, C<initrd>, C<root> and C<README.fixed> (note
the C<README.fixed> file must be present as well).
If the fixed appliance is found, libguestfs skips supermin entirely
and just runs qemu with the kernel, initrd and root disk from the
fixed appliance.
Thus the fixed appliance can be used when a platform or Linux distro
does not support supermin. You build the fixed appliance on a
platform that does support supermin, and copy it over, and use that
to run libguestfs.
=head1 LICENSING
The fixed appliance is a complete Linux binary distro. If you
@@ -175,4 +151,4 @@ Richard W.M. Jones (C<rjones at redhat dot com>)
=head1 COPYRIGHT
Copyright (C) 2009-2014 Red Hat Inc.
Copyright (C) 2009-2016 Red Hat Inc.

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# @configure_input@
# Copyright (C) 2009-2014 Red Hat Inc.
# Copyright (C) 2009-2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@@ -8,6 +8,9 @@ dnl REDHAT=1 For Fedora, RHEL, EPEL and workalikes.
dnl DEBIAN=1 For Debian.
dnl UBUNTU=1 For Ubuntu.
dnl ARCHLINUX=1 For Archlinux.
dnl SUSE=1 For OpenSUSE.
dnl FRUGALWARE=1 For Frugalware.
dnl MAGEIA=1 For Mageia.
dnl
dnl There is also a list of packages which are excluded if they appear
dnl as dependencies of the packages below. See: excludelist.in
@@ -24,9 +27,7 @@ ifelse(REDHAT,1,
btrfs-progs
cryptsetup
cryptsetup-luks dnl old name used before Fedora 17
e2fsprogs
dnl e4fsprogs only exists on RHEL 5, will be ignored everywhere else.
e4fsprogs
dhclient
genisoimage
gfs-utils
gfs2-utils
@@ -57,18 +58,27 @@ ifelse(DEBIAN,1,
bsdmainutils
btrfs-tools
cryptsetup
e2fsprogs
extlinux
genisoimage
dnl gfs-tools, gfs2-tools have been renamed to gfs2-utils
gfs-tools
gfs2-tools
gfs2-utils
grub2-common
hfsplus
dnl iproute has been renamed to iproute2
iproute
iproute2
iputils-ping
iputils-arping
iputils-tracepath
isc-dhcp-client
libaugeas0
libc-bin
libcap2
libhivex0
libpcre3
libsystemd0
libsystemd-id128-0
libsystemd-journal0
libyajl2
@@ -80,10 +90,12 @@ ifelse(DEBIAN,1,
openssh-client
reiserfsprogs
sysvinit dnl for /sbin/reboot
systemd dnl alternative for /sbin/reboot
ufsutils
vim-tiny
xz-utils
zfs-fuse
uuid-runtime
)
ifelse(ARCHLINUX,1,
@@ -91,7 +103,8 @@ ifelse(ARCHLINUX,1,
btrfs-progs
cdrkit
cryptsetup
e2fsprogs
dhcpcd
gptfdisk
grub
hivex
iproute2
@@ -99,6 +112,9 @@ ifelse(ARCHLINUX,1,
libcap
linux
lrzip
dnl syslinux has mtools as optional dependency, but in reality it's
dnl a hard one:
mtools
nilfs-utils
ntfsprogs
ntfs-3g
@@ -111,12 +127,35 @@ ifelse(ARCHLINUX,1,
zfs-fuse
)
ifelse(SUSE,1,
augeas
dnl It seems no other augeas package depends on it.
augeas-lenses
btrfsprogs
cryptsetup
dhcpcd
genisoimage
glibc-locale
gptfdisk
hivex
iproute2
iputils
libcap2
libselinux1
libyajl2
mkisofs
reiserfs
systemd
vim
xz
)
ifelse(FRUGALWARE,1,
augeas
btrfs-progs
cryptsetup-luks
e2fsprogs
cdrkit
dhclient
grub2
hfsplus
iproute2
@@ -128,57 +167,45 @@ ifelse(FRUGALWARE,1,
openssh
pcre
reiserfsprogs
syslinux
systemd
vim
xz
yajl
xfsprogs-acl
xfsprogs-attr
bash
binutils
bzip2
coreutils
cpio
diffutils
dosfstools
file
findutils
gawk
gptfdisk
grep
gzip
jfsutils
kmod
less
libxml2
lsof
lsscsi
lvm2
mdadm
module-init-tools
parted
procps
psmisc
rsync
sed
strace
syslinux
tar
util-linux
xfsprogs
)
ifelse(MAGEIA,1,
augeas
btrfs-progs
cryptsetup
chkconfig /* for /etc/init.d */
cdrkit-genisoimage
cdrkit-isotools
dhcp-client
extlinux
gfs2-utils
grub
hfsplus-tools
hivex
libaugeas0
lib64augeas0
libcryptsetup4
lib64cryptsetup4
libpcre1
lib64pcre1
libselinux1
lib64selinux1
iproute2
iputils
libcap
libyajl
dnl syslinux uses mtools without depending on it
mtools
nilfs-utils
ntfsprogs
ntfs-3g
openssh-clients
pcre
reiserfs-utils
libselinux
systemd /* for /sbin/reboot and udevd */
vim-minimal
xz
yajl
)
acl
@@ -190,6 +217,7 @@ coreutils
cpio
diffutils
dosfstools
e2fsprogs
file
findutils
gawk
@@ -225,7 +253,33 @@ util-linux-ng
xfsprogs
zerofree
ifelse(VALGRIND_DAEMON,1,valgrind)
dnl tools needed by virt-dib
ifelse(REDHAT,1,
qemu-img
which
)
ifelse(DEBIAN,1,
qemu-utils
)
ifelse(ARCHLINUX,1,
qemu
which
)
ifelse(SUSE,1,
qemu-tools
which
)
ifelse(FRUGALWARE,1,
qemu
which
)
ifelse(MAGEIA,1,
qemu-img
which
)
curl
dnl (virt-dib) tools optionally used for elements
debootstrap
dnl Define this by doing: ./configure --with-extra-packages="..."
EXTRA_PACKAGES

View File

@@ -21,6 +21,11 @@ scripts = \
guestfish \
guestmount \
virt-alignment-scan \
virt-rescue \
virt-resize \
virt-v2v
symlinks = \
virt-builder \
virt-cat \
virt-df \
@@ -28,44 +33,44 @@ scripts = \
virt-filesystems \
virt-format \
virt-inspector \
virt-log \
virt-ls \
virt-rescue \
virt-resize \
virt-sparsify \
virt-sysprep
# Note: Don't distribute the symbolic links, only the real files.
EXTRA_DIST = \
README \
$(scripts)
# Some of the scripts are simply symbolic links.
virt-cat:
ln -sf virt-alignment-scan $@
virt-df:
ln -sf virt-alignment-scan $@
virt-edit:
ln -sf virt-alignment-scan $@
virt-filesystems:
ln -sf virt-alignment-scan $@
virt-format:
ln -sf virt-alignment-scan $@
virt-inspector:
ln -sf virt-alignment-scan $@
virt-ls:
ln -sf virt-alignment-scan $@
virt-sysprep:
ln -sf virt-alignment-scan $@
CLEANFILES = \
$(symlinks)
virt-builder:
ln -sf virt-resize $@
virt-sparsify:
ln -sf virt-resize $@
# Some of the scripts are simply symbolic links.
virt-cat virt-df virt-edit virt-filesystems virt-format virt-inspector \
virt-log virt-ls virt-sysprep:
rm -f $@
$(LN_S) virt-alignment-scan $@
virt-builder virt-sparsify:
rm -f $@
$(LN_S) virt-resize $@
if HAVE_BASH_COMPLETION
# Bash completion script.
bashcompletiondir = $(BASH_COMPLETIONS_DIR)
bashcompletion_DATA = $(scripts)
#bashcompletion_DATA = $(scripts)
all-local: $(scripts) $(symlinks)
-test $(srcdir) != $(builddir) && cd $(srcdir) && cp $(scripts) $(abs_builddir)/
install-data-local:
$(mkdir_p) $(DESTDIR)$(bashcompletiondir)
cp -d $(scripts) $(symlinks) $(DESTDIR)$(bashcompletiondir)
clean-local:
-test $(srcdir) != $(builddir) && rm -f $(scripts)
endif

View File

@@ -1,5 +1,5 @@
# guestfish bash completion script -*- shell-script -*-
# Copyright (C) 2010-2014 Red Hat Inc.
# Copyright (C) 2010-2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,12 +31,10 @@ _guestfs_virsh_list ()
_guestfish ()
{
local cur prev words cword split
local longopts flag_ro=0 c=1 word cmds doms
local shortopts longopts flag_ro=0 c=1 word cmds doms
_init_completion -s || return
longopts="$(guestfish --long-options)"
# See if user has specified certain options anywhere on the
# command line before the current word.
while [ $c -lt $COMP_CWORD ]; do
@@ -60,8 +58,15 @@ _guestfish ()
case "$cur" in
--*)
# --options
longopts="$(guestfish --long-options)"
COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
return ;;
-*)
# -o and --options
shortopts="$(guestfish --short-options)"
longopts="$(guestfish --long-options)"
COMPREPLY=( $(compgen -W "$shortopts $longopts" -- "$cur") )
return ;;
*)
# Might be a guestfish command.
cmds=$(guestfish -h| head -n -1 | tail -n +2 | awk '{print $1}')

View File

@@ -1,5 +1,5 @@
# guestmount bash completion script -*- shell-script -*-
# Copyright (C) 2010-2014 Red Hat Inc.
# Copyright (C) 2010-2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,12 +31,10 @@ _guestfs_virsh_list ()
_guestmount ()
{
local cur prev words cword split
local longopts flag_ro=0 c=1 word doms
local shortopts longopts flag_ro=0 c=1 word doms
_init_completion -s || return
longopts="$(guestmount --long-options)"
# See if user has specified certain options anywhere on the
# command line before the current word.
while [ $c -lt $COMP_CWORD ]; do
@@ -57,8 +55,15 @@ _guestmount ()
case "$cur" in
--*)
# --options
longopts="$(guestmount --long-options)"
COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
return ;;
-*)
# -o and --options
shortopts="$(guestmount --short-options)"
longopts="$(guestmount --long-options)"
COMPREPLY=( $(compgen -W "$shortopts $longopts" -- "$cur") )
return ;;
*)
COMPREPLY=( $(compgen "$cur") )
return ;;

View File

@@ -1,5 +1,5 @@
# virt-tools bash completion script -*- shell-script -*-
# Copyright (C) 2010-2014 Red Hat Inc.
# Copyright (C) 2010-2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ _guestfs_virsh_list ()
_guestfs_virttools ()
{
local cur prev words cword split
local longopts="$1" flag_ro="$2" doms
local shortopts longopts tool="$1" flag_ro="$2" doms
_init_completion -s || return
@@ -45,8 +45,15 @@ _guestfs_virttools ()
case "$cur" in
--*)
# --options
longopts="$($tool --long-options)"
COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
return ;;
-*)
# -o and --options
shortopts="$($tool --short-options)"
longopts="$($tool --long-options)"
COMPREPLY=( $(compgen -W "$shortopts $longopts" -- "$cur") )
return ;;
*)
COMPREPLY=( $(compgen "$cur") )
return ;;
@@ -55,54 +62,60 @@ _guestfs_virttools ()
_virt_alignment_scan ()
{
_guestfs_virttools "$(virt-alignment-scan --long-options)" 1
_guestfs_virttools "virt-alignment-scan" 1
} &&
complete -o default -F _virt_alignment_scan virt-alignment-scan
_virt_cat ()
{
_guestfs_virttools "$(virt-cat --long-options)" 1
_guestfs_virttools "virt-cat" 1
} &&
complete -o default -F _virt_cat virt-cat
_virt_df ()
{
_guestfs_virttools "$(virt-df --long-options)" 1
_guestfs_virttools "virt-df" 1
} &&
complete -o default -F _virt_df virt-df
_virt_edit ()
{
_guestfs_virttools "$(virt-edit --long-options)" 0
_guestfs_virttools "virt-edit" 0
} &&
complete -o default -F _virt_edit virt-edit
_virt_filesystems ()
{
_guestfs_virttools "$(virt-filesystems --long-options)" 1
_guestfs_virttools "virt-filesystems" 1
} &&
complete -o default -F _virt_filesystems virt-filesystems
_virt_format ()
{
_guestfs_virttools "$(virt-format --long-options)" 0
_guestfs_virttools "virt-format" 0
} &&
complete -o default -F _virt_format virt-format
_virt_inspector ()
{
_guestfs_virttools "$(virt-inspector --long-options)" 1
_guestfs_virttools "virt-inspector" 1
} &&
complete -o default -F _virt_inspector virt-inspector
_virt_ls ()
{
_guestfs_virttools "$(virt-ls --long-options)" 1
_guestfs_virttools "virt-ls" 1
} &&
complete -o default -F _virt_ls virt-ls
_virt_sysprep ()
{
_guestfs_virttools "$(virt-sysprep --long-options)" 0
_guestfs_virttools "virt-sysprep" 0
} &&
complete -o default -F _virt_sysprep virt-sysprep
_virt_log ()
{
_guestfs_virttools "virt-log" 1
} &&
complete -o default -F _virt_log virt-log

View File

@@ -1,5 +1,5 @@
# virt-rescue bash completion script -*- shell-script -*-
# Copyright (C) 2010-2014 Red Hat Inc.
# Copyright (C) 2010-2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,12 +31,10 @@ _guestfs_virsh_list ()
_virt_rescue ()
{
local cur prev words cword split
local longopts flag_ro=0 c=1 word doms
local shortopts longopts flag_ro=0 c=1 word doms
_init_completion -s || return
longopts="$(virt-rescue --long-options)"
# See if user has specified certain options anywhere on the
# command line before the current word.
while [ $c -lt $COMP_CWORD ]; do
@@ -57,8 +55,15 @@ _virt_rescue ()
case "$cur" in
--*)
# --options
longopts="$(virt-rescue --long-options)"
COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
return ;;
-*)
# -o and --options
shortopts="$(virt-rescue --short-options)"
longopts="$(virt-rescue --long-options)"
COMPREPLY=( $(compgen -W "$shortopts $longopts" -- "$cur") )
return ;;
*)
COMPREPLY=( $(compgen "$cur") )
return ;;

View File

@@ -1,6 +1,6 @@
# virt-resize, virt-builder, virt-sparsify bash completion script
# -*- shell-script -*-
# Copyright (C) 2010-2014 Red Hat Inc.
# Copyright (C) 2010-2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,15 +19,40 @@
_guestfs_options_only ()
{
local cur prev words cword split
local longopts="$1"
local shortopts longopts tool="$1"
_init_completion -s || return
case "$prev" in
--align-first)
COMPREPLY=( $( compgen -W "never always auto" -- "$cur") )
return ;;
--check-tmpdir)
COMPREPLY=( $( compgen -W "ignore i continue cont c warn warning w fail f error" -- "$cur") )
return ;;
--list-format)
COMPREPLY=( $( compgen -W "short long json" -- "$cur") )
return ;;
--password-crypto)
COMPREPLY=( $( compgen -W "md5 sha256 sha512" -- "$cur") )
return ;;
--unknown-filesystems)
COMPREPLY=( $( compgen -W "ignore warn error" -- "$cur") )
return ;;
esac
case "$cur" in
--*)
# --options
longopts="$($tool --long-options)"
COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
return ;;
-*)
# -o and --options
shortopts="$($tool --short-options)"
longopts="$($tool --long-options)"
COMPREPLY=( $(compgen -W "$shortopts $longopts" -- "$cur") )
return ;;
*)
COMPREPLY=( $(compgen "$cur") )
return ;;
@@ -36,18 +61,18 @@ _guestfs_options_only ()
_virt_builder ()
{
_guestfs_options_only "$(virt-builder --long-options)"
_guestfs_options_only "virt-builder"
} &&
complete -o default -F _virt_builder virt-builder
_virt_resize ()
{
_guestfs_options_only "$(virt-resize --long-options)"
_guestfs_options_only "virt-resize"
} &&
complete -o default -F _virt_resize virt-resize
_virt_sparsify ()
{
_guestfs_options_only "$(virt-sparsify --long-options)"
_guestfs_options_only "virt-sparsify"
} &&
complete -o default -F _virt_sparsify virt-sparsify

59
bash/virt-v2v Normal file
View File

@@ -0,0 +1,59 @@
# virt-v2v bash completion script -*- shell-script -*-
# Copyright (C) 2014 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
_virt_v2v ()
{
local cur prev words cword split
local shortopts longopts items
_init_completion -s || return
case "$prev" in
-i)
items="$(virt-v2v --machine-readable | awk -F':' '/input:/ {print $2;}')"
COMPREPLY=( $( compgen -W "$items" -- "$cur") )
return ;;
-o)
items="$(virt-v2v --machine-readable | awk -F':' '/output:/ {print $2;}')"
COMPREPLY=( $( compgen -W "$items" -- "$cur") )
return ;;
-oa)
COMPREPLY=( $( compgen -W "sparse preallocated" -- "$cur") )
return ;;
--vmtype)
COMPREPLY=( $( compgen -W "server desktop" -- "$cur") )
return ;;
esac
case "$cur" in
--*)
# --options
longopts="$(virt-v2v --long-options)"
COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
return ;;
-*)
# -o and --options
shortopts="$(virt-v2v --short-options)"
longopts="$(virt-v2v --long-options)"
COMPREPLY=( $(compgen -W "$shortopts $longopts" -- "$cur") )
return ;;
*)
COMPREPLY=( $(compgen "$cur") )
return ;;
esac
} &&
complete -o default -F _virt_v2v virt-v2v

View File

@@ -34,13 +34,12 @@ libtoolize --copy --install
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
<$gnulib_tool || exit
(cd daemon && mkdir -p tests lib && ../$gnulib_tool --dir=.. --update)
modules='
accept4
areadlink
areadlinkat
arpa_inet
base64
byteswap
c-ctype
cloexec
@@ -64,6 +63,7 @@ gnumakefile
hash
hash-pjw
human
iconv
ignore-value
lock
maintainer-makefile
@@ -77,6 +77,7 @@ openat
perror
pipe2
pread
ptsname_r
read-file
readlink
select
@@ -95,6 +96,7 @@ vc-list-files
warnings
xalloc
xalloc-die
xgetcwd
xstrtol
xstrtoll
xvasprintf

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# bugs-in-changelog.sh
# Copyright (C) 2009-2014 Red Hat Inc.
# Copyright (C) 2009-2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

141
build-aux/guestfs-test-driver Executable file
View File

@@ -0,0 +1,141 @@
#! /bin/sh
# test-driver - basic testsuite driver script.
scriptversion=2013-07-13.22; # UTC
# Copyright (C) 2011-2016 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
# Make unconditional expansion of undefined variables an error. This
# helps a lot in preventing typo-related bugs.
set -u
usage_error ()
{
echo "$0: $*" >&2
print_usage >&2
exit 2
}
print_usage ()
{
cat <<END
Usage:
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
[--expect-failure={yes|no}] [--color-tests={yes|no}]
[--enable-hard-errors={yes|no}] [--]
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
END
}
test_name= # Used for reporting.
log_file= # Where to save the output of the test script.
trs_file= # Where to save the metadata of the test run.
expect_failure=no
color_tests=no
enable_hard_errors=yes
while test $# -gt 0; do
case $1 in
--help) print_usage; exit $?;;
--version) echo "test-driver $scriptversion"; exit $?;;
--test-name) test_name=$2; shift;;
--log-file) log_file=$2; shift;;
--trs-file) trs_file=$2; shift;;
--color-tests) color_tests=$2; shift;;
--expect-failure) expect_failure=$2; shift;;
--enable-hard-errors) enable_hard_errors=$2; shift;;
--) shift; break;;
-*) usage_error "invalid option: '$1'";;
*) break;;
esac
shift
done
missing_opts=
test x"$test_name" = x && missing_opts="$missing_opts --test-name"
test x"$log_file" = x && missing_opts="$missing_opts --log-file"
test x"$trs_file" = x && missing_opts="$missing_opts --trs-file"
if test x"$missing_opts" != x; then
usage_error "the following mandatory options are missing:$missing_opts"
fi
if test $# -eq 0; then
usage_error "missing argument"
fi
if test $color_tests = yes; then
# Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
red='' # Red.
grn='' # Green.
lgn='' # Light green.
blu='' # Blue.
mgn='' # Magenta.
std='' # No color.
else
red= grn= lgn= blu= mgn= std=
fi
do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
trap "st=129; $do_exit" 1
trap "st=130; $do_exit" 2
trap "st=141; $do_exit" 13
trap "st=143; $do_exit" 15
# Test script is run here.
start_t="$(date +'%s')"
"$@" >$log_file 2>&1
estatus=$?
end_t="$(date +'%s')"
if test $enable_hard_errors = no && test $estatus -eq 99; then
tweaked_estatus=1
else
tweaked_estatus=$estatus
fi
case $tweaked_estatus:$expect_failure in
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
0:*) col=$grn res=PASS recheck=no gcopy=no;;
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
esac
# Report the test outcome and exit status in the logs, so that one can
# know whether the test passed or failed simply by looking at the '.log'
# file, without the need of also peaking into the corresponding '.trs'
# file (automake bug#11814).
echo "$res $test_name (exit status: $estatus)" >>$log_file
# Report outcome to console.
echo "${col}${res}${std}: $test_name"
# Register the test result, and other relevant metadata.
echo ":test-result: $res" > $trs_file
echo ":global-test-result: $res" >> $trs_file
echo ":recheck: $recheck" >> $trs_file
echo ":copy-in-global-log: $gcopy" >> $trs_file
echo ":guestfs-time: $(($end_t - $start_t))" >> $trs_file

View File

@@ -1,5 +1,5 @@
# libguestfs virt-builder tool
# Copyright (C) 2013 Red Hat Inc.
# Copyright (C) 2013-2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,117 +18,144 @@
include $(top_srcdir)/subdir-rules.mk
AM_YFLAGS = -d
AM_CFLAGS = \
-I$(shell $(OCAMLC) -where) \
-I$(top_srcdir)/src \
-I$(top_srcdir)/fish \
-pthread \
$(LIBLZMA_CFLAGS)
EXTRA_DIST = \
$(SOURCES) \
$(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \
libguestfs.gpg \
virt-builder.pod \
virt-index-validate.pod \
opensuse.gpg \
test-index \
test-simplestreams/streams/v1/index.json \
test-simplestreams/streams/v1/net.cirros-cloud_released_download.json \
test-virt-builder.sh \
test-virt-builder-list.sh \
test-virt-builder-planner.sh
test-virt-builder-list-simplestreams.sh \
test-virt-builder-planner.sh \
test-virt-index-validate.sh \
test-virt-index-validate-bad-1 \
test-virt-index-validate-good-1 \
test-virt-index-validate-good-2 \
test-virt-index-validate-good-3 \
virt-builder.pod \
virt-index-validate.pod \
yajl_tests.ml
CLEANFILES = *~ *.cmi *.cmo *.cmx *.cmxa *.o virt-builder
CLEANFILES = \
*~ \
*.annot \
*.cache \
*.cmi \
*.cmo \
*.cmx \
*.cmxa \
*.log \
*.o \
virt-builder
# Alphabetical order.
SOURCES = \
architecture.ml \
builder.ml \
cmdline.ml \
SOURCES_MLI = \
cache.mli \
cmdline.mli \
downloader.mli \
downloader.ml \
get_kernel.mli \
get_kernel.ml \
checksums.mli \
index.mli \
index_parser.mli \
index_parser.ml \
index-parser-c.c \
ini_reader.mli \
ini_reader.ml \
languages.mli \
languages.ml \
list_entries.mli \
list_entries.ml \
paths.ml \
pxzcat.ml \
pxzcat.mli \
pxzcat-c.c \
setlocale.ml \
setlocale.mli \
setlocale-c.c \
sigchecker.mli \
sigchecker.ml \
simplestreams_parser.mli \
sources.mli \
yajl.mli
SOURCES_ML = \
utils.ml \
pxzcat.ml \
setlocale.ml \
checksums.ml \
index.ml \
ini_reader.ml \
yajl.ml \
paths.ml \
languages.ml \
cache.ml \
sources.ml \
uname.ml \
uname.mli \
uname-c.c
downloader.ml \
sigchecker.ml \
index_parser.ml \
simplestreams_parser.ml \
list_entries.ml \
cmdline.ml \
builder.ml
SOURCES_C = \
../mllib/fsync-c.c \
../mllib/uri-c.c \
../mllib/mkdtemp-c.c \
../customize/perl_edit-c.c \
../customize/crypt-c.c \
../fish/uri.c \
../fish/file-edit.c \
index-scan.c \
index-struct.c \
index-parse.c \
index-parser-c.c \
pxzcat-c.c \
setlocale-c.c \
yajl-c.c
man_MANS =
noinst_DATA =
bin_PROGRAMS =
if HAVE_OCAML
# Note this list must be in dependency order.
deps = \
$(top_builddir)/mllib/libdir.cmx \
$(top_builddir)/mllib/config.cmx \
$(top_builddir)/mllib/common_gettext.cmx \
$(top_builddir)/mllib/common_utils.cmx \
$(top_builddir)/mllib/fsync-c.o \
$(top_builddir)/mllib/fsync.cmx \
$(top_builddir)/mllib/planner.cmx \
$(top_builddir)/mllib/uri-c.o \
$(top_builddir)/mllib/uRI.cmx \
$(top_builddir)/mllib/mkdtemp-c.o \
$(top_builddir)/mllib/mkdtemp.cmx \
$(top_builddir)/customize/urandom.cmx \
$(top_builddir)/customize/random_seed.cmx \
$(top_builddir)/customize/hostname.cmx \
$(top_builddir)/customize/timezone.cmx \
$(top_builddir)/customize/firstboot.cmx \
$(top_builddir)/customize/perl_edit.cmx \
$(top_builddir)/customize/crypt-c.o \
$(top_builddir)/customize/crypt.cmx \
$(top_builddir)/customize/password.cmx \
$(top_builddir)/customize/customize_cmdline.cmx \
$(top_builddir)/customize/customize_run.cmx \
$(top_builddir)/fish/guestfish-uri.o \
index-scan.o \
index-struct.o \
index-parse.o \
index-parser-c.o \
pxzcat-c.o \
pxzcat.cmx \
setlocale-c.o \
setlocale.cmx \
uname-c.o \
uname.cmx \
architecture.cmx \
ini_reader.cmx \
paths.cmx \
languages.cmx \
get_kernel.cmx \
downloader.cmx \
sigchecker.cmx \
index_parser.cmx \
list_entries.cmx \
sources.cmx \
cmdline.cmx \
builder.cmx
bin_PROGRAMS += virt-builder
if HAVE_OCAMLOPT
OBJECTS = $(deps)
else
OBJECTS = $(patsubst %.cmx,%.cmo,$(deps))
endif
virt_builder_SOURCES = $(SOURCES_C)
virt_builder_CPPFLAGS = \
-I. \
-I$(top_builddir) \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-I$(shell $(OCAMLC) -where) \
-I$(top_srcdir)/gnulib/lib \
-I$(top_srcdir)/src \
-I$(top_srcdir)/fish
virt_builder_CFLAGS = \
-pthread \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
-Wno-unused-macros \
$(LIBLZMA_CFLAGS) \
$(LIBTINFO_CFLAGS) \
$(LIBXML2_CFLAGS) \
$(YAJL_CFLAGS)
bin_SCRIPTS = virt-builder
BOBJECTS = \
$(top_builddir)/mllib/libdir.cmo \
$(top_builddir)/mllib/guestfs_config.cmo \
$(top_builddir)/mllib/common_gettext.cmo \
$(top_builddir)/mllib/common_utils.cmo \
$(top_builddir)/mllib/fsync.cmo \
$(top_builddir)/mllib/planner.cmo \
$(top_builddir)/mllib/regedit.cmo \
$(top_builddir)/mllib/JSON.cmo \
$(top_builddir)/mllib/uRI.cmo \
$(top_builddir)/mllib/mkdtemp.cmo \
$(top_builddir)/customize/customize_utils.cmo \
$(top_builddir)/customize/urandom.cmo \
$(top_builddir)/customize/random_seed.cmo \
$(top_builddir)/customize/hostname.cmo \
$(top_builddir)/customize/timezone.cmo \
$(top_builddir)/customize/firstboot.cmo \
$(top_builddir)/customize/perl_edit.cmo \
$(top_builddir)/customize/crypt.cmo \
$(top_builddir)/customize/password.cmo \
$(top_builddir)/customize/ssh_key.cmo \
$(top_builddir)/customize/subscription_manager.cmo \
$(top_builddir)/customize/customize_cmdline.cmo \
$(top_builddir)/customize/customize_run.cmo \
$(SOURCES_ML:.ml=.cmo)
XOBJECTS = $(BOBJECTS:.cmo=.cmx)
# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
# option to be passed to gcc, so we don't try linking against an
@@ -136,99 +163,139 @@ bin_SCRIPTS = virt-builder
OCAMLPACKAGES = \
-package str,unix \
-I $(top_builddir)/src/.libs \
-I $(top_builddir)/gnulib/lib/.libs \
-I $(top_builddir)/ocaml \
-I $(top_builddir)/mllib \
-I $(top_builddir)/customize
OCAMLPACKAGES_TESTS =
if HAVE_OCAML_PKG_GETTEXT
OCAMLPACKAGES += -package gettext-stub
endif
OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX $(OCAMLPACKAGES)
OCAMLOPTFLAGS = $(OCAMLCFLAGS)
OCAMLCLIBS = \
$(LIBLZMA_LIBS) \
$(LIBXML2_LIBS) \
-L../src/.libs -lutils \
-L../gnulib/lib/.libs -lgnu \
-pthread -lpthread \
-lncurses -lcrypt
if HAVE_OCAMLOPT
virt-builder: $(OBJECTS)
$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
mlguestfs.cmxa -linkpkg $^ \
-cclib '$(OCAMLCLIBS)' \
$(OCAML_GCOV_LDFLAGS) \
-o $@
else
virt-builder: $(OBJECTS)
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) \
mlguestfs.cma -linkpkg $^ \
-cclib '$(OCAMLCLIBS)' \
-custom \
$(OCAML_GCOV_LDFLAGS) \
-o $@
if HAVE_OCAML_PKG_OUNIT
OCAMLPACKAGES_TESTS += -package oUnit
endif
OCAMLCLIBS = \
-pthread -lpthread \
-lutils \
$(LIBTINFO_LIBS) \
$(LIBCRYPT_LIBS) \
$(LIBLZMA_LIBS) \
$(LIBXML2_LIBS) \
$(YAJL_LIBS) \
$(LIBINTL) \
-lgnu
OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR)
if !HAVE_OCAMLOPT
OBJECTS = $(BOBJECTS)
BEST = c
OCAMLLINKFLAGS = mlguestfs.cma -custom
else
OBJECTS = $(XOBJECTS)
BEST = opt
OCAMLLINKFLAGS = mlguestfs.cmxa
endif
virt_builder_DEPENDENCIES = $(OBJECTS) $(top_srcdir)/ocaml-link.sh
virt_builder_LINK = \
$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
$(OBJECTS) -o $@
.mli.cmi:
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
$(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
.ml.cmo:
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
$(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
if HAVE_OCAMLOPT
.ml.cmx:
$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@
$(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
endif
# Manual pages and HTML files for the website.
man_MANS += virt-builder.1
noinst_DATA += $(top_builddir)/html/virt-builder.1.html
noinst_DATA += $(top_builddir)/website/virt-builder.1.html
virt-builder.1 $(top_builddir)/html/virt-builder.1.html: stamp-virt-builder.pod
virt-builder.1 $(top_builddir)/website/virt-builder.1.html: stamp-virt-builder.pod
stamp-virt-builder.pod: virt-builder.pod $(top_srcdir)/customize/customize-synopsis.pod $(top_srcdir)/customize/customize-options.pod
$(PODWRAPPER) \
--man virt-builder.1 \
--html $(top_builddir)/html/virt-builder.1.html \
--html $(top_builddir)/website/virt-builder.1.html \
--insert $(top_srcdir)/customize/customize-synopsis.pod:__CUSTOMIZE_SYNOPSIS__ \
--insert $(top_srcdir)/customize/customize-options.pod:__CUSTOMIZE_OPTIONS__ \
--license GPLv2+ \
--warning safe \
$<
touch $@
CLEANFILES += stamp-virt-builder.pod
CLEANFILES += stamp-virt-builder.pod virt-builder.1
# Tests.
TESTS_ENVIRONMENT = $(top_builddir)/run --test
disk_images := \
$(shell for f in debian fedora ubuntu windows; do if [ -s "../tests/guests/$$f.img" ]; then echo $$f.xz; fi; done) \
$(shell if [ -s "../tests/guests/fedora.img" ]; then echo fedora.qcow2 fedora.qcow2.xz; fi)
$(shell for f in debian fedora ubuntu windows; do if [ -s "../test-data/phony-guests/$$f.img" ]; then echo $$f.xz; fi; done) \
$(shell if [ -s "../test-data/phony-guests/fedora.img" ]; then echo fedora.qcow2 fedora.qcow2.xz; fi)
CLEANFILES += *.qcow2 *.xz
check_DATA = $(disk_images)
fedora.qcow2: ../tests/guests/fedora.img
fedora.qcow2: ../test-data/phony-guests/fedora.img
rm -f $@ $@-t
qemu-img convert -f raw -O qcow2 $< $@-t
mv $@-t $@
fedora.qcow2.xz: fedora.qcow2
rm -f $@ $@-t
xz --best --block-size=16777216 -c $< > $@-t
xz --best -c $< > $@-t
mv $@-t $@
%.xz: ../tests/guests/%.img
%.xz: ../test-data/phony-guests/%.img
rm -f $@ $@-t
xz --best --block-size=16777216 -c $< > $@-t
xz --best -c $< > $@-t
mv $@-t $@
TESTS = test-virt-builder-list.sh
yajl_tests_SOURCES = yajl-c.c
yajl_tests_CPPFLAGS = $(virt_builder_CPPFLAGS)
yajl_tests_BOBJECTS = \
yajl.cmo \
yajl_tests.cmo
yajl_tests_XOBJECTS = $(yajl_tests_BOBJECTS:.cmo=.cmx)
# Can't call the following as <test>_OBJECTS because automake gets confused.
if HAVE_OCAMLOPT
yajl_tests_THEOBJECTS = $(yajl_tests_XOBJECTS)
yajl_tests.cmx: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS)
else
yajl_tests_THEOBJECTS = $(yajl_tests_BOBJECTS)
yajl_tests.cmo: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS)
endif
yajl_tests_DEPENDENCIES = $(yajl_tests_THEOBJECTS) $(top_srcdir)/ocaml-link.sh
yajl_tests_LINK = \
$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) $(OCAMLLINKFLAGS) \
$(yajl_tests_THEOBJECTS) -o $@
TESTS = \
test-virt-builder-list.sh \
test-virt-index-validate.sh
check_PROGRAMS =
TESTS += test-virt-builder-list-simplestreams.sh
if ENABLE_APPLIANCE
TESTS += test-virt-builder.sh
endif ENABLE_APPLIANCE
if HAVE_OCAML_PKG_OUNIT
check_PROGRAMS += yajl_tests
TESTS += yajl_tests
endif
check-valgrind:
$(MAKE) VG="$(top_builddir)/run @VG@" check
@@ -259,13 +326,14 @@ DISTCLEANFILES = .depend
# virt-builder's default repository
repoconfdir = $(sysconfdir)/xdg/virt-builder/repos.d
repoconf_DATA = libguestfs.conf libguestfs.gpg
repoconf_DATA = libguestfs.conf libguestfs.gpg \
opensuse.conf opensuse.gpg
install-exec-hook:
$(LN_S) xdg/virt-builder $(DESTDIR)$(sysconfdir)/virt-builder
$(LN_S) -f xdg/virt-builder $(DESTDIR)$(sysconfdir)/virt-builder
# Build a small C index validator program.
bin_PROGRAMS = virt-index-validate
bin_PROGRAMS += virt-index-validate
virt_index_validate_SOURCES = \
index-parse.y \
@@ -275,18 +343,29 @@ virt_index_validate_SOURCES = \
index-validate.c
virt_index_validate_CPPFLAGS = \
-DLOCALEBASEDIR=\""$(datadir)/locale"\"
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I. \
-I$(top_builddir) \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-I$(top_srcdir)/src
virt_index_validate_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
-Wno-unused-macros
virt_index_validate_LDADD = \
$(LTLIBINTL) \
../gnulib/lib/libgnu.la
man_MANS += virt-index-validate.1
noinst_DATA += $(top_builddir)/html/virt-index-validate.1.html
noinst_DATA += $(top_builddir)/website/virt-index-validate.1.html
virt-index-validate.1 $(top_builddir)/html/virt-index-validate.1.html: stamp-virt-index-validate.pod
virt-index-validate.1 $(top_builddir)/website/virt-index-validate.1.html: stamp-virt-index-validate.pod
stamp-virt-index-validate.pod: virt-index-validate.pod
$(PODWRAPPER) \
--man virt-index-validate.1 \
--html $(top_builddir)/html/virt-index-validate.1.html \
--html $(top_builddir)/website/virt-index-validate.1.html \
--license GPLv2+ \
--warning safe \
$<
touch $@
@@ -294,13 +373,20 @@ CLEANFILES += \
index-parse.c \
index-parse.h \
index-scan.c \
stamp-virt-index-validate.pod
stamp-virt-index-validate.pod \
virt-index-validate.1
if HAVE_OCAML
# Automake-generated makefile has a rule ".l.c:" but lacks a rule ".l.h:".
# Automake-generated makefile has a rule ".y.c" but lacks a rule ".y.h".
index-parse.h: index-parse.y
touch $(srcdir)/index-parse.y
$(MAKE) index-parse.c
# Also it doesn't generate dependencies for the C files that include
# index-parse.h.
index-parser-c.c index-scan.c index-validate.c: index-parse.h
index-parse.h: index-parse.y
$(MAKE) index-parse.c
endif
# Apparently there's no clean way with Automake to not have them
# in the distribution, so just remove them from the distdir.
dist-hook:
rm -f $(distdir)/index-parse.c $(distdir)/index-parse.h $(distdir)/index-scan.c

View File

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013 Red Hat Inc.
* Copyright (C) 2013-2016 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@ module G = Guestfs
open Common_utils
open Password
open Planner
open Utils
open Cmdline
open Customize_cmdline
@@ -30,52 +31,115 @@ open Customize_cmdline
open Unix
open Printf
let quote = Filename.quote
let prog = Filename.basename Sys.executable_name
let () = Random.self_init ()
let remove_duplicates index =
let compare_revisions rev1 rev2 =
match rev1, rev2 with
| Rev_int n1, Rev_int n2 -> compare n1 n2
| Rev_string s1, Rev_int n2 -> compare s1 (string_of_int n2)
| Rev_int n1, Rev_string s2 -> compare (string_of_int n1) s2
| Rev_string s1, Rev_string s2 -> compare s1 s2
in
(* Fill an hash with the higher revision of the available
* (name, arch) tuples, so it possible to ignore duplicates,
* and versions with a lower revision.
*)
let nseen = Hashtbl.create 13 in
List.iter (
fun (name, { Index.arch = arch; revision = revision }) ->
let id = name, arch in
try
let rev = Hashtbl.find nseen id in
if compare_revisions rev revision > 0 then
Hashtbl.replace nseen id revision
with Not_found ->
Hashtbl.add nseen id revision
) index;
List.filter (
fun (name, { Index.arch = arch; revision = revision }) ->
let id = name, arch in
try
let rev = Hashtbl.find nseen (name, arch) in
(* Take the first occurrency with the higher revision,
* removing it from the hash so the other occurrencies
* are ignored.
*)
if revision = rev then (
Hashtbl.remove nseen id;
true
) else
false
with Not_found ->
(* Already taken, so ignore. *)
false
) index
(* Look for the specified os-version, resolving it as alias first. *)
let selected_cli_item cmdline index =
let arg =
(* Try to resolve the alias. *)
try
let item =
List.find (
fun (name, { Index.aliases = aliases }) ->
match aliases with
| None -> false
| Some l -> List.mem cmdline.arg l
) index in
fst item
with Not_found -> cmdline.arg in
let item =
try List.find (
fun (name, { Index.arch = a }) ->
name = arg && cmdline.arch = normalize_arch a
) index
with Not_found ->
error (f_"cannot find os-version '%s' with architecture '%s'.\nUse --list to list available guest types.")
arg cmdline.arch in
item
let main () =
(* Command line argument parsing - see cmdline.ml. *)
let mode, arg,
arch, attach, cache, check_signature, curl, debug,
delete_on_failure, format, gpg, list_format, memsize,
network, ops, output, quiet, size, smp, sources, sync =
parse_cmdline () in
(* Timestamped messages in ordinary, non-debug non-quiet mode. *)
let msg fs = make_message_function ~quiet fs in
let cmdline = parse_cmdline () in
(* If debugging, echo the command line arguments and the sources. *)
if debug then (
eprintf "command line:";
List.iter (eprintf " %s") (Array.to_list Sys.argv);
prerr_newline ();
if verbose () then (
printf "command line:";
List.iter (printf " %s") (Array.to_list Sys.argv);
print_newline ();
iteri (
fun i (source, fingerprint) ->
eprintf "source[%d] = (%S, %S)\n" i source fingerprint
) sources
printf "source[%d] = (%S, %S)\n" i source fingerprint
) cmdline.sources
);
(* Handle some modes here, some later on. *)
let mode =
match mode with
match cmdline.mode with
| `Get_kernel -> (* --get-kernel is really a different program ... *)
Get_kernel.get_kernel ~debug ?format ?output arg;
exit 0
let cmd =
sprintf "virt-get-kernel%s%s%s%s --add %s"
(if verbose () then " --verbose" else "")
(if trace () then " -x" else "")
(match cmdline.format with
| None -> ""
| Some format -> sprintf " --format %s" (quote format))
(match cmdline.output with
| None -> ""
| Some output -> sprintf " --output %s" (quote output))
(quote cmdline.arg) in
if verbose () then printf "%s\n%!" cmd;
exit (Sys.command cmd)
| `Delete_cache -> (* --delete-cache *)
(match cache with
(match cmdline.cache with
| Some cachedir ->
msg "Deleting: %s" cachedir;
let cmd = sprintf "rm -rf %s" (quote cachedir) in
ignore (Sys.command cmd);
message (f_"Deleting: %s") cachedir;
Cache.clean_cachedir cachedir;
exit 0
| None ->
eprintf (f_"%s: error: could not find cache directory. Is $HOME set?\n")
prog;
exit 1
error (f_"could not find cache directory. Is $HOME set?")
)
| (`Install|`List|`Notes|`Print_cache|`Cache_all) as mode -> mode in
@@ -85,99 +149,91 @@ let main () =
(* Check that gpg is installed. Optional as long as the user
* disables all signature checks.
*)
let cmd = sprintf "%s --help >/dev/null 2>&1" gpg in
let cmd = sprintf "%s --help >/dev/null 2>&1" cmdline.gpg in
if Sys.command cmd <> 0 then (
if check_signature then (
eprintf (f_"%s: gpg is not installed (or does not work)\nYou should install gpg, or use --gpg option, or use --no-check-signature.\n") prog;
exit 1
)
else if debug then
eprintf (f_"%s: warning: gpg program is not available\n") prog
if cmdline.check_signature then
error (f_"gpg is not installed (or does not work)\nYou should install gpg, or use --gpg option, or use --no-check-signature.")
else if verbose () then
warning (f_"gpg program is not available")
);
(* Check that curl works. *)
let cmd = sprintf "%s --help >/dev/null 2>&1" curl in
if Sys.command cmd <> 0 then (
eprintf (f_"%s: curl is not installed (or does not work)\n") prog;
exit 1
);
let cmd = sprintf "%s --help >/dev/null 2>&1" cmdline.curl in
if Sys.command cmd <> 0 then
error (f_"curl is not installed (or does not work)");
(* Check that virt-resize works. *)
let cmd = "virt-resize --help >/dev/null 2>&1" in
if Sys.command cmd <> 0 then (
eprintf (f_"%s: virt-resize is not installed (or does not work)\n") prog;
exit 1
);
if Sys.command cmd <> 0 then
error (f_"virt-resize is not installed (or does not work)");
(* Create the cache directory. *)
(* Create the cache. *)
let cache =
match cache with
match cmdline.cache with
| None -> None
| Some dir ->
(* Annoyingly Sys.is_directory throws an exception on failure
* (RHBZ#1022431).
*)
if (try Sys.is_directory dir with Sys_error _ -> false) then
Some dir
else (
(* Try to make the directory. If that fails, warn and continue
* without any cache.
*)
try mkdir dir 0o755; Some dir
with exn ->
eprintf (f_"%s: warning: cache %s: %s\n") prog dir
(Printexc.to_string exn);
eprintf (f_"%s: disabling the cache\n%!") prog;
None
)
try Some (Cache.create ~directory:dir)
with exn ->
warning (f_"cache %s: %s") dir (Printexc.to_string exn);
warning (f_"disabling the cache");
None
in
(* Download the sources. *)
let downloader = Downloader.create ~debug ~curl ~cache in
let repos = Sources.read_sources ~prog ~debug in
let repos = List.map (
fun { Sources.uri = uri; Sources.gpgkey = gpgkey } ->
let gpgkey =
match gpgkey with
| None -> Sigchecker.No_Key
| Some key -> Sigchecker.KeyFile key in
uri, gpgkey
) repos in
let downloader = Downloader.create ~curl:cmdline.curl ~cache in
let repos = Sources.read_sources () in
let sources = List.map (
fun (source, fingerprint) ->
source, Sigchecker.Fingerprint fingerprint
) sources in
let sources = List.append repos sources in
let index : Index_parser.index =
{
Sources.name = source; uri = source;
gpgkey = Utils.Fingerprint fingerprint;
proxy = Downloader.SystemProxy;
format = Sources.FormatNative;
}
) cmdline.sources in
let sources = List.append sources repos in
let index : Index.index =
List.concat (
List.map (
fun (source, key) ->
fun source ->
let sigchecker =
Sigchecker.create ~debug ~gpg ~check_signature ~gpgkey:key in
Index_parser.get_index ~prog ~debug ~downloader ~sigchecker source
Sigchecker.create ~gpg:cmdline.gpg
~check_signature:cmdline.check_signature
~gpgkey:source.Sources.gpgkey in
match source.Sources.format with
| Sources.FormatNative ->
Index_parser.get_index ~downloader ~sigchecker source
| Sources.FormatSimpleStreams ->
Simplestreams_parser.get_index ~downloader ~sigchecker source
) sources
) in
let index = remove_duplicates index in
(* Now handle the remaining modes. *)
let mode =
match mode with
| `List -> (* --list *)
List_entries.list_entries ~list_format ~sources index;
let sources, index =
match cmdline.arg with
| "" -> sources, index (* no template -> all the available ones *)
| arg -> (* just the specified template *)
let item = selected_cli_item cmdline index in
[], [item] in
List_entries.list_entries ~list_format:cmdline.list_format ~sources index;
exit 0
| `Print_cache -> (* --print-cache *)
(match cache with
| Some cachedir ->
printf (f_"cache directory: %s\n") cachedir;
List.iter (
fun (name, { Index_parser.revision = revision; arch = arch; hidden = hidden }) ->
if not hidden then (
let filename = Downloader.cache_of_name cachedir name arch revision in
let cached = Sys.file_exists filename in
printf "%-24s %-10s %s\n" name arch
(if cached then s_"cached" else (*s_*)"no")
)
) index
| Some cache ->
let l = List.filter (
fun (_, { Index.hidden = hidden }) ->
hidden <> true
) index in
let l = List.map (
fun (name, { Index.revision = revision; arch = arch }) ->
(name, arch, revision)
) l in
Cache.print_item_status cache ~header:true l
| None -> printf (f_"no cache directory\n")
);
exit 0
@@ -185,17 +241,17 @@ let main () =
| `Cache_all -> (* --cache-all-templates *)
(match cache with
| None ->
eprintf (f_"%s: error: no cache directory\n") prog;
exit 1
error (f_"no cache directory")
| Some _ ->
List.iter (
fun (name,
{ Index_parser.revision = revision; file_uri = file_uri }) ->
let template = name, arch, revision in
msg (f_"Downloading: %s") file_uri;
let progress_bar = not quiet in
ignore (Downloader.download ~prog downloader ~template ~progress_bar
file_uri)
{ Index.revision = revision; file_uri = file_uri;
proxy = proxy }) ->
let template = name, cmdline.arch, revision in
message (f_"Downloading: %s") file_uri;
let progress_bar = not (quiet ()) in
ignore (Downloader.download downloader ~template ~progress_bar
~proxy file_uri)
) index;
exit 0
);
@@ -203,22 +259,15 @@ let main () =
| (`Install|`Notes) as mode -> mode in
(* Which os-version (ie. index entry)? *)
let item =
try List.find (
fun (name, { Index_parser.arch = a }) ->
name = arg && arch = Architecture.filter_arch a
) index
with Not_found ->
eprintf (f_"%s: cannot find os-version '%s' with architecture '%s'.\nUse --list to list available guest types.\n")
prog arg arch;
exit 1 in
let item = selected_cli_item cmdline index in
let arg = fst item in
let entry = snd item in
let sigchecker = entry.Index_parser.sigchecker in
let sigchecker = entry.Index.sigchecker in
(match mode with
| `Notes -> (* --notes *)
let notes =
Languages.find_notes (Languages.languages ()) entry.Index_parser.notes in
Languages.find_notes (Languages.languages ()) entry.Index.notes in
(match notes with
| notes :: _ ->
print_endline notes
@@ -236,11 +285,13 @@ let main () =
(* Download the template, or it may be in the cache. *)
let template =
let template, delete_on_exit =
let { Index_parser.revision = revision; file_uri = file_uri } = entry in
let template = arg, arch, revision in
msg (f_"Downloading: %s") file_uri;
let progress_bar = not quiet in
Downloader.download ~prog downloader ~template ~progress_bar file_uri in
let { Index.revision = revision; file_uri = file_uri;
proxy = proxy } = entry in
let template = arg, cmdline.arch, revision in
message (f_"Downloading: %s") file_uri;
let progress_bar = not (quiet ()) in
Downloader.download downloader ~template ~progress_bar ~proxy
file_uri in
if delete_on_exit then unlink_on_exit template;
template in
@@ -248,17 +299,17 @@ let main () =
let () =
match entry with
(* New-style: Using a checksum. *)
| { Index_parser.checksum_sha512 = Some csum } ->
Sigchecker.verify_checksum sigchecker (Sigchecker.SHA512 csum) template
| { Index.checksums = Some csums } ->
Checksums.verify_checksums csums template
| { Index_parser.checksum_sha512 = None } ->
| { Index.checksums = None } ->
(* Old-style: detached signature. *)
let sigfile =
match entry with
| { Index_parser.signature_uri = None } -> None
| { Index_parser.signature_uri = Some signature_uri } ->
| { Index.signature_uri = None } -> None
| { Index.signature_uri = Some signature_uri } ->
let sigfile, delete_on_exit =
Downloader.download ~prog downloader signature_uri in
Downloader.download downloader signature_uri in
if delete_on_exit then unlink_on_exit sigfile;
Some sigfile in
@@ -270,35 +321,35 @@ let main () =
(* Planner: Input tags. *)
let itags =
let { Index_parser.size = size; format = format } = entry in
let { Index.size = size; format = format } = entry in
let format_tag =
match format with
| None -> []
| Some format -> [`Format, format] in
let compression_tag =
match detect_compression template with
match detect_file_type template with
| `XZ -> [ `XZ, "" ]
| `GZip | `Tar | `Zip ->
error (f_"input file (%s) has an unsupported type") template
| `Unknown -> [] in
[ `Template, ""; `Filename, template; `Size, Int64.to_string size ] @
format_tag @ compression_tag in
(* Planner: Goal. *)
let output_filename, output_format =
match output, format with
match cmdline.output, cmdline.format with
| None, None -> sprintf "%s.img" arg, "raw"
| None, Some "raw" -> sprintf "%s.img" arg, "raw"
| None, Some format -> sprintf "%s.%s" arg format, format
| Some output, None -> output, "raw"
| Some output, Some format -> output, format in
if is_char_device output_filename then (
eprintf (f_"%s: cannot output to a character device or /dev/null\n") prog;
exit 1
);
if is_char_device output_filename then
error (f_"cannot output to a character device or /dev/null");
let blockdev_getsize64 dev =
let cmd = sprintf "blockdev --getsize64 %s" (quote dev) in
let lines = external_command ~prog cmd in
let lines = external_command cmd in
assert (List.length lines >= 1);
Int64.of_string (List.hd lines)
in
@@ -308,26 +359,22 @@ let main () =
b, sz in
let output_size =
let { Index_parser.size = original_image_size } = entry in
let { Index.size = original_image_size } = entry in
let size =
match size with
match cmdline.size with
| Some size -> size
(* --size parameter missing, output to file: use original image size *)
| None when not output_is_block_dev -> original_image_size
(* --size parameter missing, block device: use block device size *)
| None -> blockdev_size in
if size < original_image_size then (
eprintf (f_"%s: images cannot be shrunk, the output size is too small for this image. Requested size = %s, minimum size = %s\n")
prog (human_size size) (human_size original_image_size);
exit 1
)
else if output_is_block_dev && output_format = "raw" && size > blockdev_size then (
eprintf (f_"%s: output size is too large for this block device. Requested size = %s, output block device = %s, output block device size = %s\n")
prog (human_size size) output_filename (human_size blockdev_size);
exit 1
);
if size < original_image_size then
error (f_"images cannot be shrunk, the output size is too small for this image. Requested size = %s, minimum size = %s")
(human_size size) (human_size original_image_size)
else if output_is_block_dev && output_format = "raw" && size > blockdev_size then
error (f_"output size is too large for this block device. Requested size = %s, output block device = %s, output block device size = %s")
(human_size size) output_filename (human_size blockdev_size);
size in
let goal =
@@ -343,6 +390,8 @@ let main () =
goal_must, goal_must_not in
let cache_dir = (open_guestfs ())#get_cachedir () in
(* Planner: Transitions. *)
let transitions itags =
let is t = List.mem_assoc t itags in
@@ -359,7 +408,7 @@ let main () =
(* Since the final plan won't run in parallel, we don't only need
* to choose unique tempfiles per transition, so this is OK:
*)
let tempfile = Filename.temp_file "vb" ".img" in
let tempfile = Filename.temp_file ~temp_dir:cache_dir "vb" ".img" in
unlink_on_exit tempfile;
(* Always possible to copy from one place to another. The only
@@ -418,10 +467,9 @@ let main () =
* Don't run 'qemu-img resize' on an auto format. This is to
* force an explicit conversion step to a real format.
*)
else if output_size > old_size && is_not `Template && List.mem_assoc `Format itags then (
else if output_size > old_size && is_not `Template
&& List.mem_assoc `Format itags then
tr `Disk_resize 60 ((`Size, Int64.to_string output_size) :: itags);
tr `Disk_resize 60 ((`Size, Int64.to_string output_size) :: itags);
);
(* qemu-img convert is always possible, and quicker. It doesn't
* resize, but it does change the format.
@@ -439,50 +487,49 @@ let main () =
in
(* Plan how to create the disk image. *)
msg (f_"Planning how to build this image");
message (f_"Planning how to build this image");
let plan =
try plan ~max_depth:5 transitions itags goal
with
Failure "plan" ->
eprintf (f_"%s: no plan could be found for making a disk image with\nthe required size, format etc. This is a bug in libguestfs!\nPlease file a bug, giving the command line arguments you used.\n") prog;
exit 1
error (f_"no plan could be found for making a disk image with\nthe required size, format etc. This is a bug in libguestfs!\nPlease file a bug, giving the command line arguments you used.");
in
(* Print out the plan. *)
if debug then (
if verbose () then (
let print_tags tags =
(try
let v = List.assoc `Filename tags in eprintf " +filename=%s" v
let v = List.assoc `Filename tags in printf " +filename=%s" v
with Not_found -> ());
(try
let v = List.assoc `Size tags in eprintf " +size=%s" v
let v = List.assoc `Size tags in printf " +size=%s" v
with Not_found -> ());
(try
let v = List.assoc `Format tags in eprintf " +format=%s" v
let v = List.assoc `Format tags in printf " +format=%s" v
with Not_found -> ());
if List.mem_assoc `Template tags then eprintf " +template";
if List.mem_assoc `XZ tags then eprintf " +xz"
if List.mem_assoc `Template tags then printf " +template";
if List.mem_assoc `XZ tags then printf " +xz"
in
let print_task = function
| `Copy -> eprintf "cp"
| `Rename -> eprintf "mv"
| `Pxzcat -> eprintf "pxzcat"
| `Virt_resize -> eprintf "virt-resize"
| `Disk_resize -> eprintf "qemu-img resize"
| `Convert -> eprintf "qemu-img convert"
| `Copy -> printf "cp"
| `Rename -> printf "mv"
| `Pxzcat -> printf "pxzcat"
| `Virt_resize -> printf "virt-resize"
| `Disk_resize -> printf "qemu-img resize"
| `Convert -> printf "qemu-img convert"
in
iteri (
fun i (itags, task, otags) ->
eprintf "%d: itags:" i;
printf "%d: itags:" i;
print_tags itags;
eprintf "\n";
eprintf "%d: task : " i;
printf "\n";
printf "%d: task : " i;
print_task task;
eprintf "\n";
eprintf "%d: otags:" i;
printf "\n";
printf "%d: otags:" i;
print_tags otags;
eprintf "\n\n%!"
printf "\n\n%!"
) plan
);
@@ -490,7 +537,7 @@ let main () =
* if it's block device, or if --no-delete-on-failure is set.
*)
let delete_output_file =
ref (delete_on_failure && not output_is_block_dev) in
ref (cmdline.delete_on_failure && not output_is_block_dev) in
let delete_file () =
if !delete_output_file then
try unlink output_filename with _ -> ()
@@ -503,22 +550,22 @@ let main () =
| itags, `Copy, otags ->
let ifile = List.assoc `Filename itags in
let ofile = List.assoc `Filename otags in
msg (f_"Copying");
message (f_"Copying");
let cmd = sprintf "cp %s %s" (quote ifile) (quote ofile) in
if debug then eprintf "%s\n%!" cmd;
if verbose () then printf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
| itags, `Rename, otags ->
let ifile = List.assoc `Filename itags in
let ofile = List.assoc `Filename otags in
let cmd = sprintf "mv %s %s" (quote ifile) (quote ofile) in
if debug then eprintf "%s\n%!" cmd;
if verbose () then printf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
| itags, `Pxzcat, otags ->
let ifile = List.assoc `Filename itags in
let ofile = List.assoc `Filename otags in
msg (f_"Uncompressing");
message (f_"Uncompressing");
Pxzcat.pxzcat ifile ofile
| itags, `Virt_resize, otags ->
@@ -529,14 +576,16 @@ let main () =
let osize = Int64.of_string (List.assoc `Size otags) in
let osize = roundup64 osize 512L in
let oformat = List.assoc `Format otags in
let { Index_parser.expand = expand; lvexpand = lvexpand } = entry in
msg (f_"Resizing (using virt-resize) to expand the disk to %s")
let { Index.expand = expand; lvexpand = lvexpand } = entry in
message (f_"Resizing (using virt-resize) to expand the disk to %s")
(human_size osize);
let preallocation = if oformat = "qcow2" then Some "metadata" else None in
(new G.guestfs ())#disk_create ?preallocation ofile oformat osize;
let () =
let g = open_guestfs () in
g#disk_create ?preallocation ofile oformat osize in
let cmd =
sprintf "virt-resize%s%s%s --output-format %s%s%s %s %s"
(if debug then " --verbose" else " --quiet")
sprintf "virt-resize%s%s%s --output-format %s%s%s --unknown-filesystems error %s %s"
(if verbose () then " --verbose" else " --quiet")
(if is_block_device ofile then " --no-sparse" else "")
(match iformat with
| None -> ""
@@ -549,18 +598,18 @@ let main () =
| None -> ""
| Some lvexpand -> sprintf " --lv-expand %s" (quote lvexpand))
(quote ifile) (quote ofile) in
if debug then eprintf "%s\n%!" cmd;
if verbose () then printf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
| itags, `Disk_resize, otags ->
let ofile = List.assoc `Filename otags in
let osize = Int64.of_string (List.assoc `Size otags) in
let osize = roundup64 osize 512L in
msg (f_"Resizing container (but not filesystems) to expand the disk to %s")
message (f_"Resizing container (but not filesystems) to expand the disk to %s")
(human_size osize);
let cmd = sprintf "qemu-img resize %s %Ld%s"
(quote ofile) osize (if debug then "" else " >/dev/null") in
if debug then eprintf "%s\n%!" cmd;
(quote ofile) osize (if verbose () then "" else " >/dev/null") in
if verbose () then printf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
| itags, `Convert, otags ->
@@ -569,29 +618,34 @@ let main () =
try Some (List.assoc `Format itags) with Not_found -> None in
let ofile = List.assoc `Filename otags in
let oformat = List.assoc `Format otags in
msg (f_"Converting %s to %s")
(match iformat with None -> "auto" | Some f -> f) oformat;
(match iformat with
| None -> message (f_"Converting to %s") oformat
| Some f -> message (f_"Converting %s to %s") f oformat
);
let cmd = sprintf "qemu-img convert%s %s -O %s %s%s"
(match iformat with
| None -> ""
| Some iformat -> sprintf " -f %s" (quote iformat))
(quote ifile) (quote oformat) (quote ofile)
(if debug then "" else " >/dev/null 2>&1") in
if debug then eprintf "%s\n%!" cmd;
(quote ifile) (quote oformat) (quote (qemu_input_filename ofile))
(if verbose () then "" else " >/dev/null 2>&1") in
if verbose () then printf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
) plan;
(* Now mount the output disk so we can make changes. *)
msg (f_"Opening the new disk");
message (f_"Opening the new disk");
let g =
let g = new G.guestfs () in
if debug then g#set_trace true;
let g = open_guestfs () in
(match memsize with None -> () | Some memsize -> g#set_memsize memsize);
(match smp with None -> () | Some smp -> g#set_smp smp);
g#set_network network;
may g#set_memsize cmdline.memsize;
may g#set_smp cmdline.smp;
g#set_network cmdline.network;
g#set_selinux ops.flags.selinux_relabel;
(* Make sure to turn SELinux off to avoid awkward interactions
* between the appliance kernel and applications/libraries interacting
* with SELinux xattrs.
*)
g#set_selinux false;
(* The output disk is being created, so use cache=unsafe here. *)
g#add_drive_opts ~format:output_format ~cachemode:"unsafe" output_filename;
@@ -600,7 +654,7 @@ let main () =
List.iter (
fun (format, file) ->
g#add_drive_opts ?format ~readonly:true file;
) attach;
) cmdline.attach;
g#launch ();
@@ -617,14 +671,14 @@ let main () =
List.iter (
fun (mp, dev) ->
try g#mount dev mp
with G.Error msg -> eprintf (f_"%s: %s (ignored)\n") prog msg
with G.Error msg -> warning (f_"%s (ignored)") msg
) mps;
root
| _ ->
eprintf (f_"%s: no guest operating systems or multiboot OS found in this disk image\nThis is a failure of the source repository. Use -v for more information.\n") prog;
exit 1 in
error (f_"no guest operating systems or multiboot OS found in this disk image\nThis is a failure of the source repository. Use -v for more information.")
in
Customize_run.run ~prog ~debug ~quiet g root ops;
Customize_run.run g root cmdline.ops;
(* Collect some stats about the final output file.
* Notes:
@@ -632,7 +686,7 @@ let main () =
* - Never fail here.
*)
let stats =
if not quiet then (
if not (quiet ()) then (
try
(* Calculate the free space (in bytes) across all mounted
* filesystems in the guest.
@@ -651,12 +705,12 @@ let main () =
Some (
String.concat "\n" [
sprintf (f_"Output: %s") output_filename;
sprintf (f_"Output size: %s") (human_size output_size);
sprintf (f_"Output format: %s") output_format;
sprintf (f_"Total usable space: %s")
sprintf "%30s: %s" (s_"Output file") output_filename;
sprintf "%30s: %s" (s_"Output size") (human_size output_size);
sprintf "%30s: %s" (s_"Output format") output_format;
sprintf "%30s: %s" (s_"Total usable space")
(human_size total_bytes);
sprintf (f_"Free space: %s (%Ld%%)")
sprintf "%30s: %s (%Ld%%)" (s_"Free space")
(human_size free_bytes) free_percent;
] ^ "\n"
)
@@ -666,7 +720,7 @@ let main () =
else None in
(* Unmount everything and we're done! *)
msg (f_"Finishing off");
message (f_"Finishing off");
g#umount_all ();
g#shutdown ();
@@ -678,7 +732,7 @@ let main () =
* and therefore bypasses the host cache). In general you should not
* use cache=none.
*)
if sync then
if cmdline.sync then
Fsync.file output_filename;
(* Now that we've finished the build, don't delete the output file on
@@ -690,34 +744,6 @@ let main () =
Pervasives.flush Pervasives.stdout;
Pervasives.flush Pervasives.stderr;
match stats with
| None -> ()
| Some stats -> print_string stats
may print_string stats
let () =
try main ()
with
| Unix_error (code, fname, "") -> (* from a syscall *)
eprintf (f_"%s: error: %s: %s\n") prog fname (error_message code);
exit 1
| Unix_error (code, fname, param) -> (* from a syscall *)
eprintf (f_"%s: error: %s: %s: %s\n") prog fname (error_message code) param;
exit 1
| G.Error msg -> (* from libguestfs *)
eprintf (f_"%s: libguestfs error: %s\n") prog msg;
exit 1
| Failure msg -> (* from failwith/failwithf *)
eprintf (f_"%s: failure: %s\n") prog msg;
exit 1
| Invalid_argument msg -> (* probably should never happen *)
eprintf (f_"%s: internal error: invalid argument: %s\n") prog msg;
exit 1
| Assert_failure (file, line, char) -> (* should never happen *)
eprintf (f_"%s: internal error: assertion failed at %s, line %d, char %d\n") prog file line char;
exit 1
| Not_found -> (* should never happen *)
eprintf (f_"%s: internal error: Not_found exception was thrown\n") prog;
exit 1
| exn -> (* something not matched above *)
eprintf (f_"%s: exception: %s\n") prog (Printexc.to_string exn);
exit 1
let () = run_main_and_handle_errors main

58
builder/cache.ml Normal file
View File

@@ -0,0 +1,58 @@
(* virt-builder
* Copyright (C) 2013-2016 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Common_gettext.Gettext
open Common_utils
open Utils
open Unix
open Printf
let clean_cachedir dir =
let cmd = sprintf "rm -rf %s" (quote dir) in
ignore (Sys.command cmd);
type t = {
directory : string;
}
let create ~directory =
if not (is_directory directory) then
mkdir_p directory 0o755;
{
directory = directory;
}
let cache_of_name t name arch revision =
t.directory // sprintf "%s.%s.%s" name arch (string_of_revision revision)
let is_cached t name arch revision =
let filename = cache_of_name t name arch revision in
Sys.file_exists filename
let print_item_status t ~header l =
if header then (
printf (f_"cache directory: %s\n") t.directory
);
List.iter (
fun (name, arch, revision) ->
let cached = is_cached t name arch revision in
printf "%-24s %-10s %s\n" name arch
(if cached then s_"cached" else (*s_*)"no")
) l

45
builder/cache.mli Normal file
View File

@@ -0,0 +1,45 @@
(* virt-builder
* Copyright (C) 2013-2016 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
(** This module represents a local cache. *)
val clean_cachedir : string -> unit
(** [clean_cachedir dir] clean the specified cache directory. *)
type t
(** The abstract data type. *)
val create : directory:string -> t
(** Create the abstract type. *)
val cache_of_name : t -> string -> string -> Utils.revision -> string
(** [cache_of_name t name arch revision] return the filename
of the cached file. (Note: It doesn't check if the filename
exists, this is just a simple string transformation). *)
val is_cached : t -> string -> string -> Utils.revision -> bool
(** [is_cached t name arch revision] return whether the file with
specified name, architecture and revision is cached. *)
val print_item_status : t -> header:bool -> (string * string * Utils.revision) list -> unit
(** [print_item_status t header items] print the status in the cache
of the specified items (which are tuples of name, architecture,
and revision).
If [~header:true] then display a header with the path of the
cache. *)

58
builder/checksums.ml Normal file
View File

@@ -0,0 +1,58 @@
(* virt-builder
* Copyright (C) 2015 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Common_gettext.Gettext
open Common_utils
open Utils
open Printf
type csum_t =
| SHA256 of string
| SHA512 of string
let string_of_csum_t = function
| SHA256 _ -> "sha256"
| SHA512 _ -> "sha512"
let string_of_csum = function
| SHA256 c -> c
| SHA512 c -> c
let verify_checksum csum filename =
let prog, csum_ref =
match csum with
| SHA256 c -> "sha256sum", c
| SHA512 c -> "sha512sum", c
in
let cmd = sprintf "%s %s" prog (quote filename) in
if verbose () then printf "%s\n%!" cmd;
let lines = external_command cmd in
match lines with
| [] ->
error (f_"%s did not return any output") prog
| line :: _ ->
let csum_actual = fst (String.split " " line) in
if csum_ref <> csum_actual then
error (f_"%s checksum of template did not match the expected checksum!\n found checksum: %s\n expected checksum: %s\nTry:\n - Use the '-v' option and look for earlier error messages.\n - Delete the cache: virt-builder --delete-cache\n - Check no one has tampered with the website or your network!")
(string_of_csum_t csum) csum_actual csum_ref
let verify_checksums checksums filename =
List.iter (fun c -> verify_checksum c filename) checksums

33
builder/checksums.mli Normal file
View File

@@ -0,0 +1,33 @@
(* virt-builder
* Copyright (C) 2015 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
type csum_t =
| SHA256 of string
| SHA512 of string
val verify_checksum : csum_t -> string -> unit
(** Verify the checksum of the file. *)
val verify_checksums : csum_t list -> string -> unit
(** Verify all the checksums of the file. *)
val string_of_csum_t : csum_t -> string
(** Return a string representation of the checksum type. *)
val string_of_csum : csum_t -> string
(** Return a string representation of the checksum value. *)

View File

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013 Red Hat Inc.
* Copyright (C) 2013-2016 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,19 +23,37 @@ open Common_utils
open Customize_cmdline
open Utils
module G = Guestfs
open Unix
open Printf
let prog = Filename.basename Sys.executable_name
type cmdline = {
mode : [ `Cache_all | `Delete_cache | `Get_kernel | `Install | `List
| `Notes | `Print_cache ];
arg : string;
arch : string;
attach : (string option * string) list;
cache : string option;
check_signature : bool;
curl : string;
delete_on_failure : bool;
format : string option;
gpg : string;
list_format : [`Short|`Long|`Json];
memsize : int option;
network : bool;
ops : Customize_cmdline.ops;
output : string option;
size : int64 option;
smp : int option;
sources : (string * string) list;
sync : bool;
}
let parse_cmdline () =
let display_version () =
printf "virt-builder %s\n" Config.package_version;
exit 0
in
let mode = ref `Install in
let list_mode () = mode := `List in
let notes_mode () = mode := `Notes in
@@ -60,7 +78,6 @@ let parse_cmdline () =
let check_signature = ref true in
let curl = ref "curl" in
let debug = ref false in
let delete_on_failure = ref true in
@@ -78,8 +95,9 @@ let parse_cmdline () =
| "long" -> `Long
| "json" -> `Json
| fmt ->
eprintf (f_"%s: invalid --list-format type '%s', see the man page.\n") prog fmt;
exit 1 in
error (f_"invalid --list-format type '%s', see the man page") fmt in
let machine_readable = ref false in
let memsize = ref None in
let set_memsize arg = memsize := Some arg in
@@ -87,10 +105,8 @@ let parse_cmdline () =
let network = ref true in
let output = ref "" in
let quiet = ref false in
let size = ref None in
let set_size arg = size := Some (parse_size ~prog arg) in
let set_size arg = size := Some (parse_size arg) in
let smp = ref None in
let set_smp arg = smp := Some arg in
@@ -133,7 +149,7 @@ let parse_cmdline () =
"--long", Arg.Unit list_set_long, " " ^ s_"Shortcut for --list-format short";
"--list-format", Arg.String list_set_format,
"short|long|json" ^ " " ^ s_"Set the format for --list (default: short)";
"--long-options", Arg.Unit display_long_options, " " ^ s_"List long options";
"--machine-readable", Arg.Set machine_readable, " " ^ s_"Make output machine readable";
"-m", Arg.Int set_memsize, "mb" ^ " " ^ s_"Set memory size";
"--memsize", Arg.Int set_memsize, "mb" ^ " " ^ s_"Set memory size";
"--network", Arg.Set network, " " ^ s_"Enable appliance network (default)";
@@ -143,29 +159,16 @@ let parse_cmdline () =
"--output", Arg.Set_string output, "file" ^ " " ^ s_"Set output filename";
"--print-cache", Arg.Unit print_cache_mode,
" " ^ s_"Print info about template cache";
"--quiet", Arg.Set quiet, " " ^ s_"No progress messages";
"--size", Arg.String set_size, "size" ^ " " ^ s_"Set output disk size";
"--smp", Arg.Int set_smp, "vcpus" ^ " " ^ s_"Set number of vCPUs";
"--source", Arg.String add_source, "URL" ^ " " ^ s_"Set source URL";
"--no-sync", Arg.Clear sync, " " ^ s_"Do not fsync output file on exit";
"-v", Arg.Set debug, " " ^ s_"Enable debugging messages";
"--verbose", Arg.Set debug, " " ^ s_"Enable debugging messages";
"-V", Arg.Unit display_version, " " ^ s_"Display version and exit";
"--version", Arg.Unit display_version, " " ^ s_"Display version and exit";
] in
let customize_argspec, get_customize_ops =
Customize_cmdline.argspec ~prog () in
let customize_argspec, get_customize_ops = Customize_cmdline.argspec () in
let customize_argspec =
List.map (fun (spec, _, _) -> spec) customize_argspec in
let argspec = argspec @ customize_argspec in
let argspec =
let cmp (arg1, _, _) (arg2, _, _) =
let arg1 = skip_dashes arg1 and arg2 = skip_dashes arg2 in
compare (String.lowercase arg1) (String.lowercase arg2)
in
List.sort cmp argspec in
let argspec = Arg.align argspec in
long_options := argspec;
let argspec = set_standard_options argspec in
let args = ref [] in
let anon_fun s = args := s :: !args in
@@ -195,22 +198,32 @@ read the man page virt-builder(1).
let cache = !cache in
let check_signature = !check_signature in
let curl = !curl in
let debug = !debug in
let delete_on_failure = !delete_on_failure in
let fingerprints = List.rev !fingerprints in
let format = match !format with "" -> None | s -> Some s in
let gpg = !gpg in
let list_format = !list_format in
let machine_readable = !machine_readable in
let memsize = !memsize in
let network = !network in
let ops = get_customize_ops () in
let output = match !output with "" -> None | s -> Some s in
let quiet = !quiet in
let size = !size in
let smp = !smp in
let sources = List.rev !sources in
let sync = !sync in
(* No arguments and machine-readable mode? Print some facts. *)
if args = [] && machine_readable then (
printf "virt-builder\n";
printf "arch\n";
printf "config-file\n";
printf "customize\n";
printf "json-list\n";
if Pxzcat.using_parallel_xzcat () then printf "pxzcat\n";
exit 0
);
(* Check options. *)
let arg =
match mode with
@@ -218,28 +231,26 @@ read the man page virt-builder(1).
(match args with
| [arg] -> arg
| [] ->
eprintf (f_"%s: virt-builder os-version\nMissing 'os-version'. Use '--list' to list available template names.\n") prog;
exit 1
error (f_"virt-builder os-version\nMissing 'os-version'. Use '--list' to list available template names.")
| _ ->
eprintf (f_"%s: virt-builder: too many parameters, expecting 'os-version'\n") prog;
exit 1
error (f_"too many parameters, expecting 'os-version'")
)
| `List ->
if format <> None then
error (f_"--list: use '--list-format', not '--format'");
(match args with
| [arg] -> arg
| [] -> ""
| _ ->
eprintf (f_"%s: virt-builder --list does not need any extra arguments.\n") prog;
exit 1
error (f_"too many parameters, at most one 'os-version' is allowed for --list")
)
| `Notes ->
(match args with
| [arg] -> arg
| [] ->
eprintf (f_"%s: virt-builder --notes os-version\nMissing 'os-version'. Use '--list' to list available template names.\n") prog;
exit 1
error (f_"virt-builder --notes os-version\nMissing 'os-version'. Use '--list' to list available template names.")
| _ ->
eprintf (f_"%s: virt-builder: too many parameters, expecting 'os-version'\n") prog;
exit 1
error (f_"--notes: too many parameters, expecting 'os-version'");
)
| `Cache_all
| `Print_cache
@@ -247,18 +258,15 @@ read the man page virt-builder(1).
(match args with
| [] -> ""
| _ ->
eprintf (f_"%s: virt-builder --cache-all-templates/--print-cache/--delete-cache does not need any extra arguments.\n") prog;
exit 1
error (f_"--cache-all-templates/--print-cache/--delete-cache does not need any extra arguments")
)
| `Get_kernel ->
(match args with
| [arg] -> arg
| [] ->
eprintf (f_"%s: virt-builder --get-kernel image\nMissing 'image' (disk image file) argument.\n") prog;
exit 1
error (f_"virt-builder --get-kernel image\nMissing 'image' (disk image file) argument")
| _ ->
eprintf (f_"%s: virt-builder --get-kernel: too many parameters\n") prog;
exit 1
error (f_"--get-kernel: too many parameters")
) in
(* Check source(s) and fingerprint(s). *)
@@ -270,19 +278,21 @@ read the man page virt-builder(1).
let nr_sources = List.length sources in
let fingerprints =
match fingerprints with
| [fingerprint] ->
(* You're allowed to have multiple sources and one fingerprint: it
* means that the same fingerprint is used for all sources.
*)
repeat fingerprint nr_sources
| xs -> xs in
if check_signature then (
match fingerprints with
| [fingerprint] ->
(* You're allowed to have multiple sources and one fingerprint: it
* means that the same fingerprint is used for all sources.
*)
repeat fingerprint nr_sources
| xs -> xs
) else
(* We are not checking signatures, so just ignore any fingerprint
* specified. *)
repeat "" nr_sources in
if List.length fingerprints <> nr_sources then (
eprintf (f_"%s: source and fingerprint lists are not the same length\n")
prog;
exit 1
);
if List.length fingerprints <> nr_sources then
error (f_"source and fingerprint lists are not the same length");
(* Combine the sources and fingerprints into a single list of pairs. *)
List.combine sources fingerprints in
@@ -290,25 +300,9 @@ read the man page virt-builder(1).
(* Check the architecture. *)
let arch =
match arch with
| "" -> Architecture.current_arch
| arch ->
let target_arch = Architecture.filter_arch arch in
if Architecture.arch_is_compatible Architecture.current_arch target_arch <> true then (
let requires_execute_on_guest = List.exists (
function
| `Command _ | `InstallPackages _ | `Script _ | `Update -> true
| `Delete _ | `Edit _ | `FirstbootCommand _ | `FirstbootPackages _
| `FirstbootScript _ | `Hostname _ | `Link _ | `Mkdir _
| `Password _ | `RootPassword _ | `Scrub _ | `Timezone _ | `Upload _
| `Write _ -> false
) ops.ops in
if requires_execute_on_guest then (
eprintf (f_"%s: sorry, cannot run commands on a guest with a different architecture\n")
prog;
exit 1
);
);
target_arch in
| "" -> Guestfs_config.host_cpu
| arch -> arch in
let arch = normalize_arch arch in
(* If user didn't elect any root password, that means we set a random
* root password.
@@ -319,11 +313,15 @@ read the man page virt-builder(1).
) ops.ops in
if has_set_root_password then ops
else (
let pw = Password.parse_selector ~prog "random" in
let pw = Password.parse_selector "random" in
{ ops with ops = ops.ops @ [ `RootPassword pw ] }
) in
mode, arg,
arch, attach, cache, check_signature, curl, debug,
delete_on_failure, format, gpg, list_format, memsize,
network, ops, output, quiet, size, smp, sources, sync
{ mode = mode; arg = arg;
arch = arch; attach = attach; cache = cache;
check_signature = check_signature; curl = curl;
delete_on_failure = delete_on_failure; format = format;
gpg = gpg; list_format = list_format; memsize = memsize;
network = network; ops = ops; output = output;
size = size; smp = smp; sources = sources; sync = sync;
}

44
builder/cmdline.mli Normal file
View File

@@ -0,0 +1,44 @@
(* virt-builder
* Copyright (C) 2013-2016 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
(** Command line argument parsing. *)
type cmdline = {
mode : [ `Cache_all | `Delete_cache | `Get_kernel | `Install | `List
| `Notes | `Print_cache ];
arg : string;
arch : string;
attach : (string option * string) list;
cache : string option;
check_signature : bool;
curl : string;
delete_on_failure : bool;
format : string option;
gpg : string;
list_format : [`Short|`Long|`Json];
memsize : int option;
network : bool;
ops : Customize_cmdline.ops;
output : string option;
size : int64 option;
smp : int option;
sources : (string * string) list;
sync : bool;
}
val parse_cmdline : unit -> cmdline

View File

@@ -19,95 +19,90 @@
open Common_gettext.Gettext
open Common_utils
open Utils
open Unix
open Printf
let quote = Filename.quote
let (//) = Filename.concat
let cache_of_name cachedir name arch revision =
cachedir // sprintf "%s.%s.%d" name arch revision
type uri = string
type filename = string
type t = {
debug : bool;
curl : string;
cache : string option; (* cache directory for templates *)
cache : Cache.t option; (* cache for templates *)
}
let create ~debug ~curl ~cache = {
debug = debug;
type proxy_mode =
| UnsetProxy
| SystemProxy
| ForcedProxy of string
let create ~curl ~cache = {
curl = curl;
cache = cache;
}
let rec download ~prog t ?template ?progress_bar uri =
let rec download t ?template ?progress_bar ?(proxy = SystemProxy) uri =
match template with
| None -> (* no cache, simple download *)
(* Create a temporary name. *)
let tmpfile = Filename.temp_file "vbcache" ".txt" in
download_to ~prog t ?progress_bar uri tmpfile;
download_to t ?progress_bar ~proxy uri tmpfile;
(tmpfile, true)
| Some (name, arch, revision) ->
match t.cache with
| None ->
(* Not using the cache at all? *)
download t ~prog ?progress_bar uri
download t ?progress_bar ~proxy uri
| Some cachedir ->
let filename = cache_of_name cachedir name arch revision in
| Some cache ->
let filename = Cache.cache_of_name cache name arch revision in
(* Is the requested template name + revision in the cache already?
* If not, download it.
*)
if not (Sys.file_exists filename) then
download_to ~prog t ?progress_bar uri filename;
download_to t ?progress_bar ~proxy uri filename;
(filename, false)
and download_to ~prog t ?(progress_bar = false) uri filename =
and download_to t ?(progress_bar = false) ~proxy uri filename =
let parseduri =
try URI.parse_uri uri
with Invalid_argument "URI.parse_uri" ->
eprintf (f_"Error parsing URI '%s'. Look for error messages printed above.\n") uri;
exit 1 in
error (f_"error parsing URI '%s'. Look for error messages printed above.")
uri in
(* Note because there may be parallel virt-builder instances running
* and also to avoid partial downloads in the cachedir if the network
* and also to avoid partial downloads in the cache if the network
* fails, we download to a random name in the cache and then
* atomically rename it to the final filename.
*)
let filename_new = filename ^ "." ^ string_random8 () in
let filename_new = filename ^ "." ^ String.random8 () in
unlink_on_exit filename_new;
(match parseduri.URI.protocol with
| "file" ->
let path = parseduri.URI.path in
let cmd = sprintf "cp%s %s %s"
(if t.debug then " -v" else "")
(if verbose () then " -v" else "")
(quote path) (quote filename_new) in
let r = Sys.command cmd in
if r <> 0 then (
eprintf (f_"%s: cp (download) command failed copying '%s'\n")
prog path;
exit 1
)
| _ -> (* Any other protocol. *)
if r <> 0 then
error (f_"cp (download) command failed copying '%s'") path;
| _ as protocol -> (* Any other protocol. *)
let outenv = proxy_envvar protocol proxy in
(* Get the status code first to ensure the file exists. *)
let cmd = sprintf "%s%s -g -o /dev/null -I -w '%%{http_code}' %s"
let cmd = sprintf "%s%s%s -L --max-redirs 5 -g -o /dev/null -I -w '%%{http_code}' %s"
outenv
t.curl
(if t.debug then "" else " -s -S")
(if verbose () then "" else " -s -S")
(quote uri) in
if t.debug then eprintf "%s\n%!" cmd;
let lines = external_command ~prog cmd in
if List.length lines < 1 then (
eprintf (f_"%s: unexpected output from curl command, enable debug and look at previous messages\n")
prog;
exit 1
);
if verbose () then printf "%s\n%!" cmd;
let lines = external_command cmd in
if List.length lines < 1 then
error (f_"unexpected output from curl command, enable debug and look at previous messages");
let status_code = List.hd lines in
let bad_status_code = function
| "" -> true
@@ -115,25 +110,40 @@ and download_to ~prog t ?(progress_bar = false) uri filename =
| s when s.[0] = '5' -> true (* 5xx *)
| _ -> false
in
if bad_status_code status_code then (
eprintf (f_"%s: failed to download %s: HTTP status code %s\n")
prog uri status_code;
exit 1
);
if bad_status_code status_code then
error (f_"failed to download %s: HTTP status code %s") uri status_code;
(* Now download the file. *)
let cmd = sprintf "%s%s -g -o %s %s"
let cmd = sprintf "%s%s%s -L --max-redirs 5 -g -o %s %s"
outenv
t.curl
(if t.debug then "" else if progress_bar then " -#" else " -s -S")
(if verbose () then "" else if progress_bar then " -#" else " -s -S")
(quote filename_new) (quote uri) in
if t.debug then eprintf "%s\n%!" cmd;
if verbose () then printf "%s\n%!" cmd;
let r = Sys.command cmd in
if r <> 0 then (
eprintf (f_"%s: curl (download) command failed downloading '%s'\n")
prog uri;
exit 1
)
if r <> 0 then
error (f_"curl (download) command failed downloading '%s'") uri;
);
(* Rename the file if the download was successful. *)
rename filename_new filename
and proxy_envvar protocol = function
| UnsetProxy ->
(match protocol with
| "http" -> "env http_proxy= no_proxy=* "
| "https" -> "env https_proxy= no_proxy=* "
| "ftp" -> "env ftp_proxy= no_proxy=* "
| _ -> "env no_proxy=* "
)
| SystemProxy ->
(* No changes required. *)
""
| ForcedProxy proxy ->
let proxy = quote proxy in
(match protocol with
| "http" -> sprintf "env http_proxy=%s no_proxy= " proxy
| "https" -> sprintf "env https_proxy=%s no_proxy= " proxy
| "ftp" -> sprintf "env ftp_proxy=%s no_proxy= " proxy
| _ -> ""
)

View File

@@ -18,21 +18,24 @@
(** This module is a wrapper around curl, plus local caching. *)
val cache_of_name : string -> string -> string -> int -> string
(** [cache_of_name cachedir name arch revision] returns the filename
of the cached file. (Note: It doesn't check if the filename
exists, this is just a simple string transformation). *)
type uri = string
type filename = string
type t
(** The abstract data type. *)
val create : debug:bool -> curl:string -> cache:string option -> t
(** Type of proxy. *)
type proxy_mode =
| UnsetProxy (* The proxy is forced off. *)
| SystemProxy (* The proxy is not changed (follows the
* system configuration).
*)
| ForcedProxy of string (* The proxy is forced to the specified URL. *)
val create : curl:string -> cache:Cache.t option -> t
(** Create the abstract type. *)
val download : prog:string -> t -> ?template:(string*string*int) -> ?progress_bar:bool -> uri -> (filename * bool)
val download : t -> ?template:(string*string*Utils.revision) -> ?progress_bar:bool -> ?proxy:proxy_mode -> uri -> (filename * bool)
(** Download the URI, returning the downloaded filename and a
temporary file flag. The temporary file flag is [true] iff
the downloaded file is temporary and should be deleted by the
@@ -43,5 +46,8 @@ val download : prog:string -> t -> ?template:(string*string*int) -> ?progress_ba
and revision are used for cache control (see the man page for details).
If [~progress_bar:true] then display a progress bar if the file
doesn't come from the cache. In debug mode, progress messages
are always displayed. *)
doesn't come from the cache. In verbose mode, progress messages
are always displayed.
[proxy] specifies the type of proxy to be used in the transfer,
if possible. *)

View File

@@ -1,121 +0,0 @@
(* virt-builder
* Copyright (C) 2013 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Common_gettext.Gettext
open Common_utils
module G = Guestfs
open Printf
let rex_numbers = Str.regexp "^\\([0-9]+\\)\\(.*\\)$"
let rex_letters = Str.regexp_case_fold "^\\([a-z]+\\)\\(.*\\)$"
(* Originally:
* http://rwmj.wordpress.com/2013/09/13/get-kernel-and-initramfs-from-a-disk-image/
*)
let rec get_kernel ~debug ?format ?output disk =
let g = new G.guestfs () in
if debug then g#set_trace true;
g#add_drive_opts ?format ~readonly:true disk;
g#launch ();
let roots = g#inspect_os () in
if Array.length roots = 0 then (
eprintf (f_"virt-builder: get-kernel: no operating system found\n");
exit 1
);
if Array.length roots > 1 then (
eprintf (f_"virt-builder: get-kernel: dual/multi-boot images are not supported by this tool\n");
exit 1
);
let root = roots.(0) in
(* Mount up the disks. *)
let mps = g#inspect_get_mountpoints root in
let cmp (a,_) (b,_) = compare (String.length a) (String.length b) in
let mps = List.sort cmp mps in
List.iter (
fun (mp, dev) ->
try g#mount_ro dev mp
with Guestfs.Error msg -> eprintf "%s (ignored)\n" msg
) mps;
(* Get all kernels and initramfses. *)
let glob w = Array.to_list (g#glob_expand w) in
let kernels = glob "/boot/vmlinuz-*" in
let initrds = glob "/boot/initramfs-*" in
(* Old RHEL: *)
let initrds = if initrds <> [] then initrds else glob "/boot/initrd-*" in
(* Debian/Ubuntu: *)
let initrds = if initrds <> [] then initrds else glob "/boot/initrd.img-*" in
(* Sort by version to get the latest version as first element. *)
let kernels = List.rev (List.sort compare_version kernels) in
let initrds = List.rev (List.sort compare_version initrds) in
if kernels = [] then (
eprintf (f_"virt-builder: no kernel found\n");
exit 1
);
(* Download the latest. *)
let outputdir =
match output with
| None -> Filename.current_dir_name
| Some dir -> dir in
let kernel_in = List.hd kernels in
let kernel_out = outputdir // Filename.basename kernel_in in
printf "download: %s -> %s\n%!" kernel_in kernel_out;
g#download kernel_in kernel_out;
if initrds <> [] then (
let initrd_in = List.hd initrds in
let initrd_out = outputdir // Filename.basename initrd_in in
printf "download: %s -> %s\n%!" initrd_in initrd_out;
g#download initrd_in initrd_out
);
(* Shutdown. *)
g#shutdown ();
g#close ()
and compare_version v1 v2 =
compare (split_version v1) (split_version v2)
and split_version = function
| "" -> []
| str ->
let first, rest =
if Str.string_match rex_numbers str 0 then (
let n = Str.matched_group 1 str in
let rest = Str.matched_group 2 str in
let n =
try `Number (int_of_string n)
with Failure "int_of_string" -> `String n in
n, rest
)
else if Str.string_match rex_letters str 0 then
`String (Str.matched_group 1 str), Str.matched_group 2 str
else (
let len = String.length str in
`Char str.[0], String.sub str 1 (len-1)
) in
first :: split_version rest

View File

@@ -30,6 +30,8 @@
extern void yyerror (YYLTYPE * yylloc, yyscan_t scanner, struct parse_context *context, const char *msg);
extern int yylex (YYSTYPE * yylval, YYLTYPE * yylloc, yyscan_t scanner);
extern int do_parse (struct parse_context *context, FILE *in);
extern void scanner_init (yyscan_t *scanner, struct parse_context *context, FILE *in);
extern void scanner_destroy (yyscan_t scanner);
@@ -58,7 +60,6 @@ concat_newline (const char *str1, const char *str2)
%}
%code requires {
#include "index-parse.h"
#ifndef YY_TYPEDEF_YY_SCANNER_T
#define YY_TYPEDEF_YY_SCANNER_T
typedef void *yyscan_t;
@@ -79,6 +80,7 @@ typedef void *yyscan_t;
%token EMPTY_LINE
%token PGP_PROLOGUE
%token PGP_EPILOGUE
%token UNKNOWN_LINE
%type <section> sections section
%type <field> fields field
@@ -90,9 +92,7 @@ typedef void *yyscan_t;
%parse-param { yyscan_t scanner }
%parse-param { struct parse_context *context }
%destructor { section_free ($$); } <sections>
%destructor { section_free ($$); } <section>
%destructor { field_free ($$); } <fields>
%destructor { field_free ($$); } <field>
%%
@@ -104,10 +104,10 @@ index:
{ context->parsed_index = $2; }
sections:
section emptylines
{ $$ = $1; }
| section EMPTY_LINE emptylines sections
{ $$ = $1; $$->next = $4; }
emptylines section emptylines
{ $$ = $2; }
| emptylines section EMPTY_LINE emptylines sections
{ $$ = $2; $$->next = $5; }
| emptylines
{ $$ = NULL; }
@@ -150,12 +150,16 @@ emptylines:
void
yyerror (YYLTYPE * yylloc, yyscan_t scanner, struct parse_context *context, const char *msg)
{
fprintf (stderr, "%s%s%s%ssyntax error at line %d: %s\n",
context->program_name ? context->program_name : "",
context->program_name ? ": " : "",
int has_suffix = context->error_suffix != NULL && context->error_suffix[0] != 0;
fprintf (stderr, "%s%s%s%ssyntax error at line %d: %s%s%s\n",
context->progname ? context->progname : "",
context->progname ? ": " : "",
context->input_file ? context->input_file : "",
context->input_file ? ": " : "",
yylloc->first_line, msg);
yylloc->first_line, msg,
has_suffix ? " " : "",
has_suffix ? context->error_suffix : "");
}
int

View File

@@ -45,8 +45,10 @@ extern void unix_error (int errcode, char * cmdname, value arg) Noreturn;
extern int do_parse (struct parse_context *context, FILE *in);
extern value virt_builder_parse_index (value progv, value error_suffixv, value filenamev);
value
virt_builder_parse_index (value progv, value filenamev)
virt_builder_parse_index (value progv, value error_suffixv, value filenamev)
{
CAMLparam2 (progv, filenamev);
CAMLlocal5 (rv, v, sv, sv2, fv);
@@ -56,8 +58,9 @@ virt_builder_parse_index (value progv, value filenamev)
FILE *in;
parse_context_init (&context);
context.program_name = String_val (progv);
context.progname = String_val (progv);
context.input_file = String_val (filenamev);
context.error_suffix = String_val (error_suffixv);
in = fopen (String_val (filenamev), "r");
if (in == NULL)

View File

@@ -16,20 +16,34 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
%{
%top{
#include <config.h>
}
%{
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Silence gcc warnings from the generated code. */
#if defined(__GNUC__)
#pragma GCC diagnostic push
/* flex creates macros that it doesn't use */
#pragma GCC diagnostic ignored "-Wunused-macros"
/* on aarch64, flex doesn't know that char is unsigned */
#pragma GCC diagnostic ignored "-Wsign-compare"
/* on debian-mipsel, flex doesn't create prototypes for all functions */
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif
#include "index-struct.h"
#include "index-parse.h"
#define YY_EXTRA_TYPE struct parse_context *
#define YY_USER_ACTION yylloc->first_line = yylloc->last_line = yylineno;
extern void yyerror (YYLTYPE * yylloc, yyscan_t scanner, struct parse_context *context, const char *msg);
extern void scanner_init (yyscan_t *scanner, struct parse_context *context, FILE *in);
extern void scanner_destroy (yyscan_t scanner);
%}
@@ -110,8 +124,7 @@ extern void yyerror (YYLTYPE * yylloc, yyscan_t scanner, struct parse_context *c
/* anything else is an error */
. {
yyerror (yylloc, yyscanner, yyextra, "unexpected character in input");
exit (EXIT_FAILURE);
return UNKNOWN_LINE;
}
%%

View File

@@ -44,7 +44,8 @@ struct parse_context {
*/
int seen_comments;
const char *input_file;
const char *program_name;
const char *progname;
const char *error_suffix;
};
/* Initialize the content of a parse_context. */

View File

@@ -24,6 +24,7 @@
#include <limits.h>
#include <getopt.h>
#include <errno.h>
#include <locale.h>
#include <libintl.h>
#include <guestfs.h>
@@ -38,7 +39,7 @@ extern int do_parse (struct parse_context *context, FILE *in);
static void
usage (int exit_status)
{
printf ("%s index\n", program_name);
printf ("%s index\n", guestfs_int_program_name);
exit (exit_status);
}
@@ -82,13 +83,15 @@ main (int argc, char *argv[])
compat_1_24_1 = 1;
else {
fprintf (stderr, _("%s: unknown long option: %s (%d)\n"),
program_name, long_options[option_index].name, option_index);
guestfs_int_program_name, long_options[option_index].name, option_index);
exit (EXIT_FAILURE);
}
break;
case 'V':
printf ("%s %s\n", PACKAGE_NAME, PACKAGE_VERSION);
printf ("%s %s%s\n",
guestfs_int_program_name,
PACKAGE_VERSION, PACKAGE_VERSION_EXTRA);
exit (EXIT_SUCCESS);
case HELP_OPTION:
@@ -114,20 +117,20 @@ main (int argc, char *argv[])
if (fclose (in) == EOF) {
fprintf (stderr, _("%s: %s: error closing input file: %m (ignored)\n"),
program_name, input);
guestfs_int_program_name, input);
}
if (ret != 0) {
parse_context_free (&context);
fprintf (stderr, _("%s: '%s' could not be validated, see errors above\n"),
program_name, input);
guestfs_int_program_name, input);
exit (EXIT_FAILURE);
}
if (compat_1_24_1 && context.seen_comments) {
parse_context_free (&context);
fprintf (stderr, _("%s: %s contains comments which will not work with virt-builder 1.24.1\n"),
program_name, input);
guestfs_int_program_name, input);
exit (EXIT_FAILURE);
}
@@ -140,7 +143,7 @@ main (int argc, char *argv[])
if (strchr (sections->name, '_')) {
parse_context_free (&context);
fprintf (stderr, _("%s: %s: section [%s] has invalid characters which will not work with virt-builder 1.24.0\n"),
program_name, input, sections->name);
guestfs_int_program_name, input, sections->name);
exit (EXIT_FAILURE);
}
}
@@ -151,7 +154,7 @@ main (int argc, char *argv[])
strchr (fields->key, ']')) {
parse_context_free (&context);
fprintf (stderr, _("%s: %s: section [%s], field '%s' has invalid characters which will not work with virt-builder 1.24.0\n"),
program_name, input, sections->name, fields->key);
guestfs_int_program_name, input, sections->name, fields->key);
exit (EXIT_FAILURE);
}
}
@@ -160,7 +163,7 @@ main (int argc, char *argv[])
strchr (fields->key, ',')) {
parse_context_free (&context);
fprintf (stderr, _("%s: %s: section [%s], field '%s' has invalid characters which will not work with virt-builder 1.24.1\n"),
program_name, input, sections->name, fields->key);
guestfs_int_program_name, input, sections->name, fields->key);
exit (EXIT_FAILURE);
}
}
@@ -171,7 +174,7 @@ main (int argc, char *argv[])
if (compat_1_24_0 && !seen_sig) {
parse_context_free (&context);
fprintf (stderr, _("%s: %s: section [%s] is missing a 'sig' field which will not work with virt-builder 1.24.0\n"),
program_name, input, sections->name);
guestfs_int_program_name, input, sections->name);
exit (EXIT_FAILURE);
}
}

96
builder/index.ml Normal file
View File

@@ -0,0 +1,96 @@
(* virt-builder
* Copyright (C) 2013-2016 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Common_gettext.Gettext
open Common_utils
open Utils
open Printf
open Unix
type index = (string * entry) list (* string = "os-version" *)
and entry = {
printable_name : string option; (* the name= field *)
osinfo : string option;
file_uri : string;
arch : string;
signature_uri : string option; (* deprecated, will be removed in 1.26 *)
checksums : Checksums.csum_t list option;
revision : Utils.revision;
format : string option;
size : int64;
compressed_size : int64 option;
expand : string option;
lvexpand : string option;
notes : (string * string) list;
hidden : bool;
aliases : string list option;
sigchecker : Sigchecker.t;
proxy : Downloader.proxy_mode;
}
let print_entry chan (name, { printable_name = printable_name;
file_uri = file_uri;
arch = arch;
osinfo = osinfo;
signature_uri = signature_uri;
checksums = checksums;
revision = revision;
format = format;
size = size;
compressed_size = compressed_size;
expand = expand;
lvexpand = lvexpand;
notes = notes;
aliases = aliases;
hidden = hidden }) =
let fp fs = fprintf chan fs in
fp "[%s]\n" name;
may (fp "name=%s\n") printable_name;
may (fp "osinfo=%s\n") osinfo;
fp "file=%s\n" file_uri;
fp "arch=%s\n" arch;
may (fp "sig=%s\n") signature_uri;
(match checksums with
| None -> ()
| Some checksums ->
List.iter (
fun c ->
fp "checksum[%s]=%s\n"
(Checksums.string_of_csum_t c) (Checksums.string_of_csum c)
) checksums
);
fp "revision=%s\n" (string_of_revision revision);
may (fp "format=%s\n") format;
fp "size=%Ld\n" size;
may (fp "compressed_size=%Ld\n") compressed_size;
may (fp "expand=%s\n") expand;
may (fp "lvexpand=%s\n") lvexpand;
List.iter (
fun (lang, notes) ->
match lang with
| "" -> fp "notes=%s\n" notes
| lang -> fp "notes[%s]=%s\n" lang notes
) notes;
(match aliases with
| None -> ()
| Some l -> fp "aliases=%s\n" (String.concat " " l)
);
if hidden then fp "hidden=true\n"

41
builder/index.mli Normal file
View File

@@ -0,0 +1,41 @@
(* virt-builder
* Copyright (C) 2013-2016 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
type index = (string * entry) list (* string = "os-version" *)
and entry = {
printable_name : string option; (* the name= field *)
osinfo : string option;
file_uri : string;
arch : string;
signature_uri : string option; (* deprecated, will be removed in 1.26 *)
checksums : Checksums.csum_t list option;
revision : Utils.revision;
format : string option;
size : int64;
compressed_size : int64 option;
expand : string option;
lvexpand : string option;
notes : (string * string) list;
hidden : bool;
aliases : string list option;
sigchecker : Sigchecker.t;
proxy : Downloader.proxy_mode;
}
val print_entry : out_channel -> (string * entry) -> unit

View File

@@ -19,99 +19,20 @@
open Common_gettext.Gettext
open Common_utils
open Utils
open Printf
open Unix
type index = (string * entry) list (* string = "os-version" *)
and entry = {
printable_name : string option; (* the name= field *)
osinfo : string option;
file_uri : string;
arch : string;
signature_uri : string option; (* deprecated, will be removed in 1.26 *)
checksum_sha512 : string option;
revision : int;
format : string option;
size : int64;
compressed_size : int64 option;
expand : string option;
lvexpand : string option;
notes : (string * string) list;
hidden : bool;
sigchecker : Sigchecker.t;
}
let print_entry chan (name, { printable_name = printable_name;
file_uri = file_uri;
arch = arch;
osinfo = osinfo;
signature_uri = signature_uri;
checksum_sha512 = checksum_sha512;
revision = revision;
format = format;
size = size;
compressed_size = compressed_size;
expand = expand;
lvexpand = lvexpand;
notes = notes;
hidden = hidden }) =
let fp fs = fprintf chan fs in
fp "[%s]\n" name;
(match printable_name with
| None -> ()
| Some name -> fp "name=%s\n" name
);
(match osinfo with
| None -> ()
| Some id -> fp "osinfo=%s\n" id
);
fp "file=%s\n" file_uri;
fp "arch=%s\n" arch;
(match signature_uri with
| None -> ()
| Some uri -> fp "sig=%s\n" uri
);
(match checksum_sha512 with
| None -> ()
| Some uri -> fp "checksum[sha512]=%s\n" uri
);
fp "revision=%d\n" revision;
(match format with
| None -> ()
| Some format -> fp "format=%s\n" format
);
fp "size=%Ld\n" size;
(match compressed_size with
| None -> ()
| Some size -> fp "compressed_size=%Ld\n" size
);
(match expand with
| None -> ()
| Some expand -> fp "expand=%s\n" expand
);
(match lvexpand with
| None -> ()
| Some lvexpand -> fp "lvexpand=%s\n" lvexpand
);
List.iter (
fun (lang, notes) ->
match lang with
| "" -> fp "notes=%s\n" notes
| lang -> fp "notes[%s]=%s\n" lang notes
) notes;
if hidden then fp "hidden=true\n"
let get_index ~prog ~debug ~downloader ~sigchecker source =
let get_index ~downloader ~sigchecker
{ Sources.uri = uri; proxy = proxy } =
let corrupt_file () =
eprintf (f_"\nThe index file downloaded from '%s' is corrupt.\nYou need to ask the supplier of this file to fix it and upload a fixed version.\n")
source;
exit 1
error (f_"The index file downloaded from '%s' is corrupt.\nYou need to ask the supplier of this file to fix it and upload a fixed version.") uri
in
let rec get_index () =
(* Get the index page. *)
let tmpfile, delete_tmpfile = Downloader.download ~prog downloader source in
let tmpfile, delete_tmpfile = Downloader.download downloader ~proxy uri in
(* Check index file signature (also verifies it was fully
* downloaded and not corrupted in transit).
@@ -119,7 +40,7 @@ let get_index ~prog ~debug ~downloader ~sigchecker source =
Sigchecker.verify sigchecker tmpfile;
(* Try parsing the file. *)
let sections = Ini_reader.read_ini ~prog tmpfile in
let sections = Ini_reader.read_ini tmpfile in
if delete_tmpfile then
(try Unix.unlink tmpfile with _ -> ());
@@ -138,7 +59,7 @@ let get_index ~prog ~debug ~downloader ~sigchecker source =
fun (n, arch) ->
let id = n, arch in
if Hashtbl.mem nseen id then (
eprintf (f_"virt-builder: index is corrupt: os-version '%s' with architecture '%s' appears two or more times\n") n arch;
eprintf (f_"%s: index is corrupt: os-version '%s' with architecture '%s' appears two or more times\n") prog n arch;
corrupt_file ()
);
Hashtbl.add nseen id true
@@ -154,9 +75,9 @@ let get_index ~prog ~debug ~downloader ~sigchecker source =
if Hashtbl.mem fseen hashkey then (
(match subkey with
| Some value ->
eprintf (f_"virt-builder: index is corrupt: %s: field '%s[%s]' appears two or more times\n") n field value
eprintf (f_"%s: index is corrupt: %s: field '%s[%s]' appears two or more times\n") prog n field value
| None ->
eprintf (f_"virt-builder: index is corrupt: %s: field '%s' appears two or more times\n") n field);
eprintf (f_"%s: index is corrupt: %s: field '%s' appears two or more times\n") prog n field);
corrupt_file ()
);
Hashtbl.add fseen hashkey true
@@ -175,12 +96,12 @@ let get_index ~prog ~debug ~downloader ~sigchecker source =
let file_uri =
try make_absolute_uri (List.assoc ("file", None) fields)
with Not_found ->
eprintf (f_"virt-builder: no 'file' (URI) entry for '%s'\n") n;
eprintf (f_"%s: no 'file' (URI) entry for '%s'\n") prog n;
corrupt_file () in
let arch =
try List.assoc ("arch", None) fields
with Not_found ->
eprintf (f_"virt-builder: no 'arch' entry for '%s'\n") n;
eprintf (f_"%s: no 'arch' entry for '%s'\n") prog n;
corrupt_file () in
let signature_uri =
try Some (make_absolute_uri (List.assoc ("sig", None) fields))
@@ -191,12 +112,11 @@ let get_index ~prog ~debug ~downloader ~sigchecker source =
try Some (List.assoc ("checksum", None) fields)
with Not_found -> None in
let revision =
try int_of_string (List.assoc ("revision", None) fields)
try Rev_int (int_of_string (List.assoc ("revision", None) fields))
with
| Not_found -> 1
| Not_found -> Rev_int 1
| Failure "int_of_string" ->
eprintf (f_"virt-builder: cannot parse 'revision' field for '%s'\n")
n;
eprintf (f_"%s: cannot parse 'revision' field for '%s'\n") prog n;
corrupt_file () in
let format =
try Some (List.assoc ("format", None) fields) with Not_found -> None in
@@ -204,11 +124,10 @@ let get_index ~prog ~debug ~downloader ~sigchecker source =
try Int64.of_string (List.assoc ("size", None) fields)
with
| Not_found ->
eprintf (f_"virt-builder: no 'size' field for '%s'\n") n;
eprintf (f_"%s: no 'size' field for '%s'\n") prog n;
corrupt_file ()
| Failure "int_of_string" ->
eprintf (f_"virt-builder: cannot parse 'size' field for '%s'\n")
n;
eprintf (f_"%s: cannot parse 'size' field for '%s'\n") prog n;
corrupt_file () in
let compressed_size =
try Some (Int64.of_string (List.assoc ("compressed_size", None) fields))
@@ -216,8 +135,8 @@ let get_index ~prog ~debug ~downloader ~sigchecker source =
| Not_found ->
None
| Failure "int_of_string" ->
eprintf (f_"virt-builder: cannot parse 'compressed_size' field for '%s'\n")
n;
eprintf (f_"%s: cannot parse 'compressed_size' field for '%s'\n")
prog n;
corrupt_file () in
let expand =
try Some (List.assoc ("expand", None) fields) with Not_found -> None in
@@ -241,16 +160,28 @@ let get_index ~prog ~debug ~downloader ~sigchecker source =
with
| Not_found -> false
| Failure "bool_of_string" ->
eprintf (f_"virt-builder: cannot parse 'hidden' field for '%s'\n")
n;
eprintf (f_"%s: cannot parse 'hidden' field for '%s'\n")
prog n;
corrupt_file () in
let aliases =
let l =
try String.nsplit " " (List.assoc ("aliases", None) fields)
with Not_found -> [] in
match l with
| [] -> None
| l -> Some l in
let entry = { printable_name = printable_name;
let checksums =
match checksum_sha512 with
| Some c -> Some [Checksums.SHA512 c]
| None -> None in
let entry = { Index.printable_name = printable_name;
osinfo = osinfo;
file_uri = file_uri;
arch = arch;
signature_uri = signature_uri;
checksum_sha512 = checksum_sha512;
checksums = checksums;
revision = revision;
format = format;
size = size;
@@ -259,13 +190,15 @@ let get_index ~prog ~debug ~downloader ~sigchecker source =
lvexpand = lvexpand;
notes = notes;
hidden = hidden;
aliases = aliases;
proxy = proxy;
sigchecker = sigchecker } in
n, entry
) sections in
if debug then (
eprintf "index file (%s) after parsing (C parser):\n" source;
List.iter (print_entry Pervasives.stderr) entries
if verbose () then (
printf "index file (%s) after parsing (C parser):\n" uri;
List.iter (Index.print_entry Pervasives.stdout) entries
);
entries
@@ -273,25 +206,24 @@ let get_index ~prog ~debug ~downloader ~sigchecker source =
(* Verify same-origin policy for the file= and sig= fields. *)
and make_absolute_uri path =
if String.length path = 0 then (
eprintf (f_"virt-builder: zero length path in the index file\n");
eprintf (f_"%s: zero length path in the index file\n") prog;
corrupt_file ()
)
else if string_find path "://" >= 0 then (
eprintf (f_"virt-builder: cannot use a URI ('%s') in the index file\n")
path;
else if String.find path "://" >= 0 then (
eprintf (f_"%s: cannot use a URI ('%s') in the index file\n") prog path;
corrupt_file ()
)
else if path.[0] = '/' then (
eprintf (f_"virt-builder: you must use relative paths (not '%s') in the index file\n") path;
eprintf (f_"%s: you must use relative paths (not '%s') in the index file\n") prog path;
corrupt_file ()
)
else (
(* Construct the URI. *)
try
let i = String.rindex source '/' in
String.sub source 0 (i+1) ^ path
let i = String.rindex uri '/' in
String.sub uri 0 (i+1) ^ path
with
Not_found -> source // path
Not_found -> uri // path
)
in

View File

@@ -16,24 +16,4 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
type index = (string * entry) list (* string = "os-version" *)
and entry = {
printable_name : string option; (* the name= field *)
osinfo : string option;
file_uri : string;
arch : string;
signature_uri : string option; (* deprecated, will be removed in 1.26 *)
checksum_sha512 : string option;
revision : int;
format : string option;
size : int64;
compressed_size : int64 option;
expand : string option;
lvexpand : string option;
notes : (string * string) list;
hidden : bool;
sigchecker : Sigchecker.t;
}
val get_index : prog:string -> debug:bool -> downloader:Downloader.t -> sigchecker:Sigchecker.t -> string -> index
val get_index : downloader:Downloader.t -> sigchecker:Sigchecker.t -> Sources.source -> Index.index

View File

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013-2014 Red Hat Inc.
* Copyright (C) 2013-2016 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,6 +16,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Common_utils
type sections = section list
and section = string * fields (* [name] + fields *)
and fields = field list
@@ -27,10 +29,10 @@ and c_section = string * c_fields (* [name] + fields *)
and c_fields = field array
(* Calls yyparse in the C code. *)
external parse_index : prog:string -> string -> c_sections = "virt_builder_parse_index"
external parse_index : prog:string -> error_suffix:string -> string -> c_sections = "virt_builder_parse_index"
let read_ini ~prog file =
let sections = parse_index ~prog file in
let read_ini ?(error_suffix = "") file =
let sections = parse_index ~prog ~error_suffix file in
let sections = Array.to_list sections in
List.map (
fun (n, fields) ->

View File

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013-2014 Red Hat Inc.
* Copyright (C) 2013-2016 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,4 +21,4 @@ and section = string * fields (* [name] + fields *)
and fields = field list
and field = string * string option * string (* key + subkey + value *)
val read_ini : prog:string -> string -> sections
val read_ini : ?error_suffix:string -> string -> sections

View File

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013-2014 Red Hat Inc.
* Copyright (C) 2013-2016 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@@ -29,16 +29,13 @@ let rec list_entries ~list_format ~sources index =
and list_entries_short index =
List.iter (
fun (name, { Index_parser.printable_name = printable_name;
fun (name, { Index.printable_name = printable_name;
arch = arch;
hidden = hidden }) ->
if not hidden then (
printf "%-24s" name;
printf " %-10s" arch;
(match printable_name with
| None -> ()
| Some s -> printf " %s" s
);
may (printf " %s") printable_name;
printf "\n"
)
) index
@@ -47,31 +44,29 @@ and list_entries_long ~sources index =
let langs = Languages.languages () in
List.iter (
fun (source, key) ->
printf (f_"Source URI: %s\n") source;
(match key with
| Sigchecker.No_Key -> ()
| Sigchecker.Fingerprint fp ->
fun { Sources.uri = uri; gpgkey = gpgkey } ->
printf (f_"Source URI: %s\n") uri;
(match gpgkey with
| Utils.No_Key -> ()
| Utils.Fingerprint fp ->
printf (f_"Fingerprint: %s\n") fp;
| Sigchecker.KeyFile kf ->
| Utils.KeyFile kf ->
printf (f_"Key: %s\n") kf;
);
printf "\n"
) sources;
List.iter (
fun (name, { Index_parser.printable_name = printable_name;
fun (name, { Index.printable_name = printable_name;
arch = arch;
size = size;
compressed_size = compressed_size;
notes = notes;
aliases = aliases;
hidden = hidden }) ->
if not hidden then (
printf "%-24s %s\n" "os-version:" name;
(match printable_name with
| None -> ()
| Some name -> printf "%-24s %s\n" (s_"Full name:") name;
);
may (printf "%-24s %s\n" (s_"Full name:")) printable_name;
printf "%-24s %s\n" (s_"Architecture:") arch;
printf "%-24s %s\n" (s_"Minimum/default size:") (human_size size);
(match compressed_size with
@@ -79,6 +74,11 @@ and list_entries_long ~sources index =
| Some size ->
printf "%-24s %s\n" (s_"Download size:") (human_size size);
);
(match aliases with
| None -> ()
| Some l -> printf "%-24s %s\n" (s_"Aliases:")
(String.concat " " l);
);
let notes = Languages.find_notes langs notes in
(match notes with
| notes :: _ ->
@@ -91,81 +91,69 @@ and list_entries_long ~sources index =
) index
and list_entries_json ~sources index =
let trailing_comma index size =
if index = size - 1 then "" else "," in
let json_string_of_bool b =
if b then "true" else "false" in
let json_string_escape str =
let res = ref "" in
for i = 0 to String.length str - 1 do
res := !res ^ (match str.[i] with
| '"' -> "\\\""
| '\\' -> "\\\\"
| '\b' -> "\\b"
| '\n' -> "\\n"
| '\r' -> "\\r"
| '\t' -> "\\t"
| c -> String.make 1 c)
done;
!res in
let json_optional_printf_string key = function
| None -> ()
| Some str ->
printf " \"%s\": \"%s\",\n" key (json_string_escape str) in
let json_optional_printf_int64 key = function
| None -> ()
| Some n ->
printf " \"%s\": \"%Ld\",\n" key n in
let print_notes = function
| [] -> ()
| notes ->
printf " \"notes\": {\n";
iteri (
fun i (lang, langnotes) ->
let lang =
match lang with
| "" -> "C"
| x -> x in
printf " \"%s\": \"%s\"%s\n"
(json_string_escape lang) (json_string_escape langnotes)
(trailing_comma i (List.length notes))
) notes;
printf " },\n" in
printf "{\n";
printf " \"version\": %d,\n" 1;
printf " \"sources\": [\n";
iteri (
fun i (source, key) ->
printf " {\n";
(match key with
| Sigchecker.No_Key -> ()
| Sigchecker.Fingerprint fp ->
printf " \"fingerprint\": \"%s\",\n" fp;
| Sigchecker.KeyFile kf ->
printf " \"key\": \"%s\",\n" kf;
);
printf " \"uri\": \"%s\"\n" source;
printf " }%s\n" (trailing_comma i (List.length sources))
) sources;
printf " ],\n";
printf " \"templates\": [\n";
iteri (
fun i (name, { Index_parser.printable_name = printable_name;
let json_sources =
List.map (
fun { Sources.uri = uri; gpgkey = gpgkey } ->
let item = [ "uri", JSON.String uri ] in
let item =
match gpgkey with
| Utils.No_Key -> item
| Utils.Fingerprint fp ->
("fingerprint", JSON.String fp) :: item
| Utils.KeyFile kf ->
("key", JSON.String kf) :: item in
JSON.Dict item
) sources in
let json_templates =
List.map (
fun (name, { Index.printable_name = printable_name;
arch = arch;
size = size;
compressed_size = compressed_size;
notes = notes;
aliases = aliases;
osinfo = osinfo;
hidden = hidden }) ->
printf " {\n";
printf " \"os-version\": \"%s\",\n" name;
json_optional_printf_string "full-name" printable_name;
printf " \"arch\": \"%s\",\n" arch;
printf " \"size\": %Ld,\n" size;
json_optional_printf_int64 "compressed-size" compressed_size;
print_notes notes;
printf " \"hidden\": %s\n" (json_string_of_bool hidden);
printf " }%s\n" (trailing_comma i (List.length index))
) index;
printf " ]\n";
printf "}\n"
let item = [ "os-version", JSON.String name ] in
let item =
match printable_name with
| None -> item
| Some str -> ("full-name", JSON.String str) :: item in
let item = ("arch", JSON.String arch) :: item in
let item = ("size", JSON.Int64 size) :: item in
let item =
match compressed_size with
| None -> item
| Some n -> ("compressed-size", JSON.String (Int64.to_string n)) :: item in
let item =
let json_notes =
List.fold_right (
fun (lang, langnotes) acc ->
let lang =
match lang with
| "" -> "C"
| x -> x in
(lang, JSON.String langnotes) :: acc
) notes [] in
if List.length json_notes = 0 then item
else ("notes", JSON.Dict json_notes) :: item in
let item =
match aliases with
| None -> item
| Some l ->
let l = List.map (fun x -> JSON.String x) l in
("aliases", JSON.List l) :: item in
let item =
match osinfo with
| None -> item
| Some str -> ("osinfo", JSON.String str) :: item in
let item = ("hidden", JSON.Bool hidden) :: item in
JSON.Dict (List.rev item)
) index in
let doc = [
"version", JSON.Int 1;
"sources", JSON.List json_sources;
"templates", JSON.List json_templates;
] in
print_string (JSON.string_of_doc ~fmt:JSON.Indented doc);
print_newline ()

View File

@@ -16,4 +16,4 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
val list_entries : list_format:([ `Short | `Long | `Json ]) -> sources:(string * Sigchecker.gpgkey_type) list -> Index_parser.index -> unit
val list_entries : list_format:([ `Short | `Long | `Json ]) -> sources:Sources.source list -> Index.index -> unit

3
builder/opensuse.conf.in Normal file
View File

@@ -0,0 +1,3 @@
[opensuse.org]
uri=http://download.opensuse.org/repositories/Virtualization:/virt-builder-images/images/index
gpgkey=file://@SYSCONFDIR@/xdg/virt-builder/repos.d/opensuse.gpg

21
builder/opensuse.gpg Normal file
View File

@@ -0,0 +1,21 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.5 (GNU/Linux)
mQENBFImAl0BCACkjaXGvVLHBGTVXVP0khtpUVHqFvCRtaIIMHaX/5oTr3nyehDQ
Ex9VLsSRcNa0QxtnCHFRQzjWWqe+i6pBginnSjucgmjnIKyJsF4l6R+rwAiinHQX
C4s6Lqg/wH9xDPRBrMYFqlc/7MVf0Glhk1+lAxgQjolMt+5AbbrWlBbwc/i+++zl
ES3MaeH8aiwup/ogjhmk0SbCQQ/ib21p3XWBwx2oz/KM6Voq9tKDvMczjzNRY3ZT
6Di3FsUSKI7kgljiNiuN+675YwqEqxWEJgdE5a7Zb67giH1Ik08b5wQiF5jSAICD
DxW7/ibWBvZJnqhqQT2xJpLC5VaJqwkN8o83ABEBAAG0PlZpcnR1YWxpemF0aW9u
IE9CUyBQcm9qZWN0IDxWaXJ0dWFsaXphdGlvbkBidWlsZC5vcGVuc3VzZS5vcmc+
iQE7BBMBAgAmBQJSJgJdAhsDBQkEHrAABgsJCAcDAgQVAggDBBYCAwECHgECF4AA
CgkQoZP7tXIXT8ITnwf3SVUUoVjVLFCjhIxdet8BL011cJDwr9TwKEQfq4Ybsq5L
5Y1/Zk86rTzrVOZrODLwNRIC3fMuegZV5f85KMggXu37Di+UvX+dQW9v1hte+hAT
+gsqb60kOnE/Yacgkb6D3xIzRudAB2q/xfvHl/hgfn416yGI8NvntT7n4Hk9wT28
9JSFkun0uaessg77aXlAdsqHwdugm9hELeva89OoYoiZ4d9r4ScTMSj0UkNgnh7g
CyIScZHYqiiOeosUtAX9u1PyUFfFsg9s5snfud7aF48EfXU0RTtZAGKtG4GPDv3q
bYc5TJ2pQzs9y5Bk/jAMR/QQw8CKglBsn1cjYkKViEYEExECAAYFAlImAl0ACgkQ
OzARt2udZSO5yACgr6Ei7QZ+PAmg4Mr5db+4M3aepAEAniU33RaTKBCGkwQi6kHr
4VaII2/E
=l8DH
-----END PGP PUBLIC KEY BLOCK-----

View File

@@ -25,17 +25,17 @@ let xdg_cache_home =
with Not_found ->
None (* no cache directory *)
let xdg_config_home ~prog =
let xdg_config_home () =
try Some (Sys.getenv "XDG_CONFIG_HOME" // prog)
with Not_found ->
try Some (Sys.getenv "HOME" // ".config" // prog)
with Not_found ->
None (* no config directory *)
let xdg_config_dirs ~prog =
let xdg_config_dirs () =
let dirs =
try Sys.getenv "XDG_CONFIG_DIRS"
with Not_found -> "/etc/xdg" in
let dirs = string_nsplit ":" dirs in
let dirs = String.nsplit ":" dirs in
let dirs = List.filter (fun x -> x <> "") dirs in
List.map (fun x -> x // prog) dirs

View File

@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
@@ -34,6 +35,15 @@
#include <caml/memory.h>
#include <caml/mlvalues.h>
#include "guestfs.h"
#include "guestfs-internal-frontend.h"
#include "ignore-value.h"
#if HAVE_LIBLZMA
#include <lzma.h>
#endif
#ifdef HAVE_CAML_UNIXSUPPORT_H
#include <caml/unixsupport.h>
#else
@@ -41,18 +51,34 @@
extern void unix_error (int errcode, char * cmdname, value arg) Noreturn;
#endif
#ifdef HAVE_LIBLZMA
#include <lzma.h>
static void pxzcat (value filenamev, value outputfilev, unsigned nr_threads);
#if defined (HAVE_LIBLZMA) && \
defined (HAVE_LZMA_INDEX_STREAM_FLAGS) && \
defined (HAVE_LZMA_INDEX_STREAM_PADDING)
#define PARALLEL_XZCAT 1
#else
#define PARALLEL_XZCAT 0
#endif
extern value virt_builder_using_parallel_xzcat (value unitv);
value
virt_builder_using_parallel_xzcat (value unitv)
{
return PARALLEL_XZCAT ? Val_true : Val_false;
}
#if PARALLEL_XZCAT
static void pxzcat (value filenamev, value outputfilev, unsigned nr_threads);
#endif /* PARALLEL_XZCAT */
extern value virt_builder_pxzcat (value inputfilev, value outputfilev);
value
virt_builder_pxzcat (value inputfilev, value outputfilev)
{
CAMLparam2 (inputfilev, outputfilev);
#ifdef HAVE_LIBLZMA
#if PARALLEL_XZCAT
/* Parallel implementation of xzcat (pxzcat). */
/* XXX Make number of threads configurable? */
@@ -71,7 +97,7 @@ virt_builder_pxzcat (value inputfilev, value outputfilev)
*/
pxzcat (inputfilev, outputfilev, nr_threads);
#else
#else /* !PARALLEL_XZCAT */
/* Fallback: use regular xzcat. */
int fd;
@@ -80,13 +106,13 @@ virt_builder_pxzcat (value inputfilev, value outputfilev)
fd = open (String_val (outputfilev), O_WRONLY|O_CREAT|O_TRUNC|O_NOCTTY, 0666);
if (fd == -1)
unix_error (errno, "open", outputfilev);
unix_error (errno, (char *) "open", outputfilev);
pid = fork ();
if (pid == -1) {
int err = errno;
close (fd);
unix_error (err, "fork", Nothing);
unix_error (err, (char *) "fork", Nothing);
}
if (pid == 0) { /* child - run xzcat */
@@ -99,16 +125,16 @@ virt_builder_pxzcat (value inputfilev, value outputfilev)
close (fd);
if (waitpid (pid, &status, 0) == -1)
unix_error (errno, "waitpid", Nothing);
unix_error (errno, (char *) "waitpid", Nothing);
if (!WIFEXITED (status) || WEXITSTATUS (status) != 0)
caml_failwith (XZCAT " program failed, see earlier error messages");
#endif
#endif /* !PARALLEL_XZCAT */
CAMLreturn (Val_unit);
}
#ifdef HAVE_LIBLZMA
#if PARALLEL_XZCAT
#define DEBUG 0
@@ -123,8 +149,6 @@ virt_builder_pxzcat (value inputfilev, value outputfilev)
#define XZ_HEADER_MAGIC "\xfd" "7zXZ\0"
#define XZ_HEADER_MAGIC_LEN 6
#define XZ_FOOTER_MAGIC "YZ"
#define XZ_FOOTER_MAGIC_LEN 2
static int check_header_magic (int fd);
static lzma_index *parse_indexes (value filenamev, int fd);
@@ -140,7 +164,7 @@ pxzcat (value filenamev, value outputfilev, unsigned nr_threads)
/* Open the file. */
fd = open (String_val (filenamev), O_RDONLY);
if (fd == -1)
unix_error (errno, "open", filenamev);
unix_error (errno, (char *) "open", filenamev);
/* Check file magic. */
if (!check_header_magic (fd)) {
@@ -163,35 +187,37 @@ pxzcat (value filenamev, value outputfilev, unsigned nr_threads)
if (ofd == -1) {
int err = errno;
close (fd);
unix_error (err, "open", outputfilev);
unix_error (err, (char *) "open", outputfilev);
}
if (ftruncate (ofd, 1) == -1) {
int err = errno;
close (fd);
unix_error (err, "ftruncate", outputfilev);
unix_error (err, (char *) "ftruncate", outputfilev);
}
if (lseek (ofd, 0, SEEK_SET) == -1) {
int err = errno;
close (fd);
unix_error (err, "lseek", outputfilev);
unix_error (err, (char *) "lseek", outputfilev);
}
if (write (ofd, "\0", 1) == -1) {
int err = errno;
close (fd);
unix_error (err, "write", outputfilev);
unix_error (err, (char *) "write", outputfilev);
}
if (ftruncate (ofd, size) == -1) {
int err = errno;
close (fd);
unix_error (err, "ftruncate", outputfilev);
unix_error (err, (char *) "ftruncate", outputfilev);
}
#if defined HAVE_POSIX_FADVISE
/* Tell the kernel we won't read the output file. */
posix_fadvise (fd, 0, 0, POSIX_FADV_RANDOM|POSIX_FADV_DONTNEED);
ignore_value (posix_fadvise (fd, 0, 0, POSIX_FADV_RANDOM|POSIX_FADV_DONTNEED));
#endif
/* Iterate over blocks. */
iter_blocks (idx, nr_threads, filenamev, fd, outputfilev, ofd);
@@ -199,7 +225,7 @@ pxzcat (value filenamev, value outputfilev, unsigned nr_threads)
lzma_index_end (idx, NULL);
if (close (fd) == -1)
unix_error (errno, "close", filenamev);
unix_error (errno, (char *) "close", filenamev);
}
static int
@@ -238,7 +264,7 @@ parse_indexes (value filenamev, int fd)
/* Check file size is a multiple of 4 bytes. */
pos = lseek (fd, 0, SEEK_END);
if (pos == (off_t) -1)
unix_error (errno, "lseek", filenamev);
unix_error (errno, (char *) "lseek", filenamev);
if ((pos & 3) != 0)
caml_invalid_argument ("input not an xz file: size is not a multiple of 4 bytes");
@@ -251,10 +277,10 @@ parse_indexes (value filenamev, int fd)
caml_invalid_argument ("corrupted xz file");
if (lseek (fd, -LZMA_STREAM_HEADER_SIZE, SEEK_CUR) == -1)
unix_error (errno, "lseek", filenamev);
unix_error (errno, (char *) "lseek", filenamev);
if (read (fd, footer, LZMA_STREAM_HEADER_SIZE) != LZMA_STREAM_HEADER_SIZE)
unix_error (errno, "read", filenamev);
unix_error (errno, (char *) "read", filenamev);
/* Skip stream padding. */
if (footer[8] == 0 && footer[9] == 0 &&
@@ -272,7 +298,7 @@ parse_indexes (value filenamev, int fd)
/* Does the stream footer look reasonable? */
r = lzma_stream_footer_decode (&footer_flags, footer);
if (r != LZMA_OK) {
fprintf (stderr, "invalid stream footer - error %d\n", r);
fprintf (stderr, "invalid stream footer - error %u\n", r);
caml_invalid_argument ("invalid stream footer");
}
@@ -286,12 +312,12 @@ parse_indexes (value filenamev, int fd)
/* Seek backwards to the index of this stream. */
if (lseek (fd, pos, SEEK_SET) == -1)
unix_error (errno, "lseek", filenamev);
unix_error (errno, (char *) "lseek", filenamev);
/* Decode the index. */
r = lzma_index_decoder (&strm, &this_index, UINT64_MAX);
if (r != LZMA_OK) {
fprintf (stderr, "invalid stream index - error %d\n", r);
fprintf (stderr, "invalid stream index - error %u\n", r);
caml_invalid_argument ("invalid stream index");
}
@@ -304,7 +330,7 @@ parse_indexes (value filenamev, int fd)
n = read (fd, &buf, strm.avail_in);
if (n == -1)
unix_error (errno, "read", filenamev);
unix_error (errno, (char *) "read", filenamev);
index_size -= strm.avail_in;
@@ -313,7 +339,7 @@ parse_indexes (value filenamev, int fd)
} while (r == LZMA_OK);
if (r != LZMA_STREAM_END) {
fprintf (stderr, "could not parse index - error %d\n", r);
fprintf (stderr, "could not parse index - error %u\n", r);
caml_invalid_argument ("could not parse index");
}
@@ -323,21 +349,21 @@ parse_indexes (value filenamev, int fd)
/* Read and decode the stream header. */
if (lseek (fd, pos, SEEK_SET) == -1)
unix_error (errno, "lseek", filenamev);
unix_error (errno, (char *) "lseek", filenamev);
if (read (fd, header, LZMA_STREAM_HEADER_SIZE) != LZMA_STREAM_HEADER_SIZE)
unix_error (errno, "read stream header", filenamev);
unix_error (errno, (char *) "read stream header", filenamev);
r = lzma_stream_header_decode (&header_flags, header);
if (r != LZMA_OK) {
fprintf (stderr, "invalid stream header - error %d\n", r);
fprintf (stderr, "invalid stream header - error %u\n", r);
caml_invalid_argument ("invalid stream header");
}
/* Header and footer of the stream should be equal. */
r = lzma_stream_flags_compare (&header_flags, &footer_flags);
if (r != LZMA_OK) {
fprintf (stderr, "header and footer of stream are not equal - error %d\n",
fprintf (stderr, "header and footer of stream are not equal - error %u\n",
r);
caml_invalid_argument ("header and footer of stream are not equal");
}
@@ -345,7 +371,7 @@ parse_indexes (value filenamev, int fd)
/* Store the decoded stream flags in this_index. */
r = lzma_index_stream_flags (this_index, &footer_flags);
if (r != LZMA_OK) {
fprintf (stderr, "cannot read stream_flags from index - error %d\n", r);
fprintf (stderr, "cannot read stream_flags from index - error %u\n", r);
caml_invalid_argument ("cannot read stream_flags from index");
}
@@ -354,14 +380,14 @@ parse_indexes (value filenamev, int fd)
*/
r = lzma_index_stream_padding (this_index, stream_padding);
if (r != LZMA_OK) {
fprintf (stderr, "cannot set stream_padding in index - error %d\n", r);
fprintf (stderr, "cannot set stream_padding in index - error %u\n", r);
caml_invalid_argument ("cannot set stream_padding in index");
}
if (combined_index != NULL) {
r = lzma_index_cat (this_index, combined_index, NULL);
if (r != LZMA_OK) {
fprintf (stderr, "cannot combine indexes - error %d\n", r);
fprintf (stderr, "cannot combine indexes - error %u\n", r);
caml_invalid_argument ("cannot combine indexes");
}
}
@@ -438,7 +464,7 @@ iter_blocks (lzma_index *idx, unsigned nr_threads,
global.iter_finished = 0;
err = pthread_mutex_init (&global.iter_mutex, NULL);
if (err != 0)
unix_error (err, "pthread_mutex_init", Nothing);
unix_error (err, (char *) "pthread_mutex_init", Nothing);
global.filename = String_val (filenamev);
global.fd = fd;
@@ -454,7 +480,7 @@ iter_blocks (lzma_index *idx, unsigned nr_threads,
for (u = 0; u < nr_threads; ++u) {
err = pthread_create (&thread[u], NULL, worker_thread, &per_thread[u]);
if (err != 0)
unix_error (err, "pthread_create", Nothing);
unix_error (err, (char *) "pthread_create", Nothing);
}
/* Wait for the threads to exit. */
@@ -473,6 +499,24 @@ iter_blocks (lzma_index *idx, unsigned nr_threads,
caml_invalid_argument ("some threads failed, see earlier errors");
}
static int
xpwrite (int fd, const void *bufvp, size_t count, off_t offset)
{
const char *buf = bufvp;
ssize_t r;
while (count > 0) {
r = pwrite (fd, buf, count, offset);
if (r == -1)
return -1;
count -= r;
offset += r;
buf += r;
}
return 0;
}
/* Iterate over the blocks and uncompress. */
static void *
worker_thread (void *vp)
@@ -482,19 +526,29 @@ worker_thread (void *vp)
lzma_index_iter iter;
int err;
off_t position, oposition;
uint8_t header[LZMA_BLOCK_HEADER_SIZE_MAX];
CLEANUP_FREE uint8_t *header = NULL;
ssize_t n;
lzma_block block;
lzma_filter filters[LZMA_FILTERS_MAX + 1];
CLEANUP_FREE lzma_filter *filters = NULL;
lzma_ret r;
lzma_stream strm = LZMA_STREAM_INIT;
uint8_t buf[BUFFER_SIZE];
unsigned char outbuf[BUFFER_SIZE];
CLEANUP_FREE uint8_t *buf = NULL;
CLEANUP_FREE uint8_t *outbuf = NULL;
size_t i;
lzma_bool iter_finished;
state->status = -1;
header = malloc (sizeof (uint8_t) * LZMA_BLOCK_HEADER_SIZE_MAX);
filters = malloc (sizeof (lzma_filter) * (LZMA_FILTERS_MAX + 1));
buf = malloc (sizeof (uint8_t) * BUFFER_SIZE);
outbuf = malloc (sizeof (uint8_t) * BUFFER_SIZE);
if (header == NULL || filters == NULL || buf == NULL || outbuf == NULL) {
perror ("malloc");
return &state->status;
}
for (;;) {
/* Get the next block. */
err = pthread_mutex_lock (&global->iter_mutex);
@@ -545,7 +599,7 @@ worker_thread (void *vp)
/* Now read and decode the block header. */
n = pread (global->fd, &header[1], block.header_size-1, position);
if (n >= 0 && n != block.header_size-1) {
if (n >= 0 && n != (ssize_t) block.header_size-1) {
fprintf (stderr,
"%s: read: unexpected end of file reading block header\n",
global->filename);
@@ -559,7 +613,7 @@ worker_thread (void *vp)
r = lzma_block_header_decode (&block, NULL, header);
if (r != LZMA_OK) {
fprintf (stderr, "%s: invalid block header (error %d)\n",
fprintf (stderr, "%s: invalid block header (error %u)\n",
global->filename, r);
return &state->status;
}
@@ -570,7 +624,7 @@ worker_thread (void *vp)
r = lzma_block_compressed_size (&block, iter.block.unpadded_size);
if (r != LZMA_OK) {
fprintf (stderr,
"%s: cannot calculate compressed size (error %d)\n",
"%s: cannot calculate compressed size (error %u)\n",
global->filename, r);
return &state->status;
}
@@ -581,21 +635,21 @@ worker_thread (void *vp)
/* Read the block data and uncompress it. */
r = lzma_block_decoder (&strm, &block);
if (r != LZMA_OK) {
fprintf (stderr, "%s: invalid block (error %d)\n", global->filename, r);
fprintf (stderr, "%s: invalid block (error %u)\n", global->filename, r);
return &state->status;
}
strm.next_in = NULL;
strm.avail_in = 0;
strm.next_out = outbuf;
strm.avail_out = sizeof outbuf;
strm.avail_out = BUFFER_SIZE;
for (;;) {
lzma_action action = LZMA_RUN;
if (strm.avail_in == 0) {
strm.next_in = buf;
n = pread (global->fd, buf, sizeof buf, position);
n = pread (global->fd, buf, BUFFER_SIZE, position);
if (n == -1) {
perror (global->filename);
return &state->status;
@@ -609,29 +663,28 @@ worker_thread (void *vp)
r = lzma_code (&strm, action);
if (strm.avail_out == 0 || r == LZMA_STREAM_END) {
size_t wsz = sizeof outbuf - strm.avail_out;
size_t wsz = BUFFER_SIZE - strm.avail_out;
/* Don't write if the block is all zero, to preserve output file
* sparseness. However we have to update oposition.
*/
if (!is_zero (outbuf, wsz)) {
if (pwrite (global->ofd, outbuf, wsz, oposition) != wsz) {
/* XXX Handle short writes. */
perror (global->filename);
if (xpwrite (global->ofd, outbuf, wsz, oposition) == -1) {
perror (global->outputfile);
return &state->status;
}
}
oposition += wsz;
strm.next_out = outbuf;
strm.avail_out = sizeof outbuf;
strm.avail_out = BUFFER_SIZE;
}
if (r == LZMA_STREAM_END)
break;
if (r != LZMA_OK) {
fprintf (stderr,
"%s: could not parse block data (error %d)\n",
"%s: could not parse block data (error %u)\n",
global->filename, r);
return &state->status;
}
@@ -647,4 +700,4 @@ worker_thread (void *vp)
return &state->status;
}
#endif /* HAVE_LIBLZMA */
#endif /* PARALLEL_XZCAT */

View File

@@ -17,3 +17,4 @@
*)
external pxzcat : string -> string -> unit = "virt_builder_pxzcat"
external using_parallel_xzcat : unit -> bool = "virt_builder_using_parallel_xzcat" "noalloc"

View File

@@ -29,3 +29,6 @@ val pxzcat : string -> string -> unit
If liblzma was found at compile time, this uses an internal
implementation of parallel xzcat. Otherwise regular xzcat is
used. *)
val using_parallel_xzcat : unit -> bool
(** Returns [true] iff the implementation uses parallel xzcat. *)

View File

@@ -37,6 +37,8 @@ static const int lc_string_table[7] = {
#define Val_none (Val_int (0))
extern value virt_builder_setlocale (value val_category, value val_name);
value
virt_builder_setlocale (value val_category, value val_name)
{

View File

@@ -19,97 +19,122 @@
open Common_gettext.Gettext
open Common_utils
open Utils
open Printf
open Unix
let quote = Filename.quote
type gpgkey_type =
| No_Key
| Fingerprint of string
| KeyFile of string
type t = {
debug : bool;
gpg : string;
fingerprint : string;
subkeys_fingerprints : string list;
check_signature : bool;
gpghome : string;
}
(* Import the specified key file. *)
let import_keyfile ~gpg ~gpghome ~debug keyfile =
let import_keyfile ~gpg ~gpghome ?(trust = true) keyfile =
let status_file = Filename.temp_file "vbstat" ".txt" in
unlink_on_exit status_file;
let cmd = sprintf "%s --homedir %s --status-file %s --import %s%s"
gpg gpghome (quote status_file) (quote keyfile)
(if debug then "" else " >/dev/null 2>&1") in
if debug then eprintf "%s\n%!" cmd;
(if verbose () then "" else " >/dev/null 2>&1") in
if verbose () then printf "%s\n%!" cmd;
let r = Sys.command cmd in
if r <> 0 then (
eprintf (f_"virt-builder: error: could not import public key\nUse the '-v' option and look for earlier error messages.\n");
exit 1
if r <> 0 then
error (f_"could not import public key\nUse the '-v' option and look for earlier error messages.");
let status = read_whole_file status_file in
let status = String.nsplit "\n" status in
let key_id = ref "" in
let fingerprint = ref "" in
List.iter (
fun line ->
let line = String.nsplit " " line in
match line with
| "[GNUPG:]" :: "IMPORT_OK" :: _ :: fp :: _ -> fingerprint := fp
| "[GNUPG:]" :: "IMPORTED" :: key :: _ -> key_id := key
| _ -> ()
) status;
if trust then (
let cmd = sprintf "%s --homedir %s --trusted-key %s --list-keys%s"
gpg gpghome (quote !key_id)
(if verbose () then "" else " >/dev/null 2>&1") in
if verbose () then printf "%s\n%!" cmd;
let r = Sys.command cmd in
if r <> 0 then
error (f_"GPG failure: could not trust the imported key\nUse the '-v' option and look for earlier error messages.");
);
status_file
let subkeys =
(* --with-fingerprint is specified twice so gpg outputs the full
* fingerprint of the subkeys. *)
let cmd = sprintf "%s --homedir %s --with-colons --with-fingerprint --with-fingerprint --list-keys %s"
gpg gpghome !fingerprint in
if verbose () then printf "%s\n%!" cmd;
let lines = external_command cmd in
let current = ref None in
let subkeys = ref [] in
List.iter (
fun line ->
let line = String.nsplit ":" line in
match line with
| "sub" :: ("u"|"-") :: _ :: _ :: id :: _ ->
current := Some id
| "fpr" :: _ :: _ :: _ :: _ :: _ :: _ :: _ :: _ :: id :: _ ->
(match !current with
| None -> ()
| Some k ->
if String.is_suffix id k then (
subkeys := id :: !subkeys;
);
current := None
)
| _ -> ()
) lines;
!subkeys in
!fingerprint, subkeys
let rec create ~debug ~gpg ~gpgkey ~check_signature =
let rec create ~gpg ~gpgkey ~check_signature =
(* Create a temporary directory for gnupg. *)
let tmpdir = Mkdtemp.mkdtemp (Filename.temp_dir_name // "vb.gpghome.XXXXXX") in
let tmpdir = Mkdtemp.temp_dir "vb.gpghome." "" in
rmdir_on_exit tmpdir;
(* Make sure we have no check_signature=true with no actual key. *)
let check_signature, gpgkey =
match check_signature, gpgkey with
| true, No_Key -> false, No_Key
| x, y -> x, y in
let fingerprint =
let fingerprint, subkeys =
if check_signature then (
(* Run gpg so it can setup its own home directory, failing if it
* cannot.
*)
let cmd = sprintf "%s --homedir %s --list-keys%s"
gpg tmpdir (if debug then "" else " >/dev/null 2>&1") in
if debug then eprintf "%s\n%!" cmd;
gpg tmpdir (if verbose () then "" else " >/dev/null 2>&1") in
if verbose () then printf "%s\n%!" cmd;
let r = Sys.command cmd in
if r <> 0 then (
eprintf (f_"virt-builder: error: GPG failure: could not run GPG the first time\nUse the '-v' option and look for earlier error messages.\n");
exit 1
);
if r <> 0 then
error (f_"GPG failure: could not run GPG the first time\nUse the '-v' option and look for earlier error messages.");
match gpgkey with
| No_Key ->
assert false
| KeyFile kf ->
let status_file = import_keyfile gpg tmpdir debug kf in
let status = read_whole_file status_file in
let status = string_nsplit "\n" status in
let fingerprint = ref "" in
List.iter (
fun line ->
let line = string_nsplit " " line in
match line with
| "[GNUPG:]" :: "IMPORT_OK" :: _ :: fp :: _ -> fingerprint := fp
| _ -> ()
) status;
!fingerprint
import_keyfile gpg tmpdir kf
| Fingerprint fp ->
let filename = Filename.temp_file "vbpubkey" ".asc" in
unlink_on_exit filename;
let cmd = sprintf "%s --yes --armor --output %s --export %s%s"
gpg (quote filename) (quote fp)
(if debug then "" else " >/dev/null 2>&1") in
if debug then eprintf "%s\n%!" cmd;
(if verbose () then "" else " >/dev/null 2>&1") in
if verbose () then printf "%s\n%!" cmd;
let r = Sys.command cmd in
if r <> 0 then (
eprintf (f_"virt-builder: error: could not export public key\nUse the '-v' option and look for earlier error messages.\n");
exit 1
);
ignore (import_keyfile gpg tmpdir debug filename);
fp
if r <> 0 then
error (f_"could not export public key\nUse the '-v' option and look for earlier error messages.");
import_keyfile gpg tmpdir filename
) else
"" in
"", [] in
{
debug = debug;
gpg = gpg;
fingerprint = fingerprint;
subkeys_fingerprints = subkeys;
check_signature = check_signature;
gpghome = tmpdir;
}
@@ -138,6 +163,9 @@ and getxdigit = function
| 'A'..'F' as c -> Some (Char.code c - Char.code 'A')
| _ -> None
let verifying_signatures t =
t.check_signature
let rec verify t filename =
if t.check_signature then (
let args = quote filename in
@@ -148,72 +176,57 @@ and verify_detached t filename sigfile =
if t.check_signature then (
match sigfile with
| None ->
eprintf (f_"virt-builder: error: there is no detached signature file\nThis probably means the index file is missing a sig=... line.\nYou can use --no-check-signature to ignore this error, but that means\nyou are susceptible to man-in-the-middle attacks.\n");
exit 1
error (f_"there is no detached signature file\nThis probably means the index file is missing a sig=... line.\nYou can use --no-check-signature to ignore this error, but that means you are susceptible to man-in-the-middle attacks.")
| Some sigfile ->
let args = sprintf "%s %s" (quote sigfile) (quote filename) in
do_verify t args
)
and do_verify t args =
and verify_and_remove_signature t filename =
if t.check_signature then (
(* Copy the input file as temporary file with the .asc extension,
* so gpg recognises that format. *)
let asc_file = Filename.temp_file "vbfile" ".asc" in
unlink_on_exit asc_file;
let cmd = sprintf "cp %s %s" (quote filename) (quote asc_file) in
if verbose () then printf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1;
let out_file = Filename.temp_file "vbfile" "" in
unlink_on_exit out_file;
let args = sprintf "--yes --output %s %s" (quote out_file) (quote filename) in
do_verify ~verify_only:false t args;
Some out_file
) else
None
and do_verify ?(verify_only = true) t args =
let status_file = Filename.temp_file "vbstat" ".txt" in
unlink_on_exit status_file;
let cmd =
sprintf "%s --homedir %s --verify%s --status-file %s %s"
sprintf "%s --homedir %s %s%s --status-file %s %s"
t.gpg t.gpghome
(if t.debug then "" else " -q --logger-file /dev/null")
(if verify_only then "--verify" else "")
(if verbose () then "" else " --batch -q --logger-file /dev/null")
(quote status_file) args in
if t.debug then eprintf "%s\n%!" cmd;
if verbose () then printf "%s\n%!" cmd;
let r = Sys.command cmd in
if r <> 0 then (
eprintf (f_"virt-builder: error: GPG failure: could not verify digital signature of file\nTry:\n - Use the '-v' option and look for earlier error messages.\n - Delete the cache: virt-builder --delete-cache\n - Check no one has tampered with the website or your network!\n");
exit 1
);
if r <> 0 then
error (f_"GPG failure: could not verify digital signature of file\nTry:\n - Use the '-v' option and look for earlier error messages.\n - Delete the cache: virt-builder --delete-cache\n - Check no one has tampered with the website or your network!");
(* Check the fingerprint is who it should be. *)
let status = read_whole_file status_file in
let status = string_nsplit "\n" status in
let status = String.nsplit "\n" status in
let fingerprint = ref "" in
List.iter (
fun line ->
let line = string_nsplit " " line in
let line = String.nsplit " " line in
match line with
| "[GNUPG:]" :: "VALIDSIG" :: fp :: _ -> fingerprint := fp
| _ -> ()
) status;
if not (equal_fingerprints !fingerprint t.fingerprint) then (
eprintf (f_"virt-builder: error: fingerprint of signature does not match the expected fingerprint!\n found fingerprint: %s\n expected fingerprint: %s\n")
!fingerprint t.fingerprint;
exit 1
)
type csum_t = SHA512 of string
let verify_checksum t (SHA512 csum) filename =
let csum_file = Filename.temp_file "vbcsum" ".txt" in
unlink_on_exit csum_file;
let cmd = sprintf "sha512sum %s | awk '{print $1}' > %s"
(quote filename) (quote csum_file) in
if t.debug then eprintf "%s\n%!" cmd;
let r = Sys.command cmd in
if r <> 0 then (
eprintf (f_"virt-builder: error: could not run sha512sum command to verify checksum\n");
exit 1
);
let csum_actual = read_whole_file csum_file in
let csum_actual =
let len = String.length csum_actual in
if len > 0 && csum_actual.[len-1] = '\n' then
String.sub csum_actual 0 (len-1)
else
csum_actual in
if csum <> csum_actual then (
eprintf (f_"virt-builder: error: checksum of template did not match the expected checksum!\n found checksum: %s\n expected checksum: %s\nTry:\n - Use the '-v' option and look for earlier error messages.\n - Delete the cache: virt-builder --delete-cache\n - Check no one has tampered with the website or your network!\n")
csum_actual csum;
exit 1
)
if not (equal_fingerprints !fingerprint t.fingerprint) &&
not (List.exists (equal_fingerprints !fingerprint) t.subkeys_fingerprints) then
error (f_"fingerprint of signature does not match the expected fingerprint!\n found fingerprint: %s\n expected fingerprint: %s")
!fingerprint t.fingerprint

View File

@@ -18,12 +18,11 @@
type t
type gpgkey_type =
| No_Key
| Fingerprint of string
| KeyFile of string
val create : gpg:string -> gpgkey:Utils.gpgkey_type -> check_signature:bool -> t
val create : debug:bool -> gpg:string -> gpgkey:gpgkey_type -> check_signature:bool -> t
val verifying_signatures : t -> bool
(** Return whether signatures are being verified by this
Sigchecker.t. *)
val verify : t -> string -> unit
(** Verify the file is signed (if check_signature is true). *)
@@ -32,8 +31,6 @@ val verify_detached : t -> string -> string option -> unit
(** Verify the file is signed against the detached signature
(if check_signature is true). *)
type csum_t = SHA512 of string
val verify_checksum : t -> csum_t -> string -> unit
(** Verify the checksum of the file. This is always verified even if
check_signature if false. *)
val verify_and_remove_signature : t -> string -> string option
(** If check_signature is true, verify the file is signed and extract
the content of the file (i.e. without the signature). *)

View File

@@ -0,0 +1,204 @@
(* virt-builder
* Copyright (C) 2015 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Common_gettext.Gettext
open Common_utils
open Yajl
open Utils
open Printf
let ensure_trailing_slash str =
if String.length str > 0 && str.[String.length str - 1] <> '/' then str ^ "/"
else str
let object_find_optional key = function
| Yajl_object o ->
(match List.filter (fun (k, _) -> k = key) (Array.to_list o) with
| [(k, v)] -> Some v
| [] -> None
| _ -> error (f_"more than value for the key '%s'") key)
| _ -> error (f_"the value of the key '%s' is not an object") key
let object_find key yv =
match object_find_optional key yv with
| None -> error (f_"missing value for the key '%s'") key
| Some v -> v
let object_get_string key yv =
match object_find key yv with
| Yajl_string s -> s
| _ -> error (f_"the value for the key '%s' is not a string") key
let object_find_object key yv =
match object_find key yv with
| Yajl_object _ as o -> o
| _ -> error (f_"the value for the key '%s' is not an object") key
let object_find_objects fn = function
| Yajl_object o -> filter_map fn (Array.to_list o)
| _ -> error (f_"the value is not an object")
let object_get_object key yv =
match object_find_object key yv with
| Yajl_object o -> o
| _ -> assert false (* object_find_object already errors out. *)
let object_get_number key yv =
match object_find key yv with
| Yajl_number n -> n
| Yajl_double d -> Int64.of_float d
| _ -> error (f_"the value for the key '%s' is not an integer") key
let objects_get_string key yvs =
let rec loop = function
| [] -> None
| x :: xs ->
(match object_find_optional key x with
| Some (Yajl_string s) -> Some s
| Some _ -> error (f_"the value for key '%s' is not a string as expected") key
| None -> loop xs
)
in
match loop yvs with
| Some s -> s
| None -> error (f_"the key '%s' was not found in a list of objects") key
let get_index ~downloader ~sigchecker
{ Sources.uri = uri; proxy = proxy } =
let uri = ensure_trailing_slash uri in
let download_and_parse uri =
let tmpfile, delete_tmpfile = Downloader.download downloader ~proxy uri in
if delete_tmpfile then
unlink_on_exit tmpfile;
let file =
if Sigchecker.verifying_signatures sigchecker then (
let tmpunsigned =
Sigchecker.verify_and_remove_signature sigchecker tmpfile in
match tmpunsigned with
| None -> assert false (* only when not verifying signatures *)
| Some f -> f
) else
tmpfile in
yajl_tree_parse (read_whole_file file) in
let downloads =
let uri_index =
if Sigchecker.verifying_signatures sigchecker then
uri ^ "streams/v1/index.sjson"
else
uri ^ "streams/v1/index.json" in
let tree = download_and_parse uri_index in
let format = object_get_string "format" tree in
if format <> "index:1.0" then
error (f_"%s is not a Simple Streams (index) v1.0 JSON file (format: %s)")
uri format;
let index = Array.to_list (object_get_object "index" tree) in
filter_map (
fun (_, desc) ->
let format = object_get_string "format" desc in
let datatype = object_get_string "datatype" desc in
match format, datatype with
| "products:1.0", "image-downloads" ->
Some (object_get_string "path" desc)
| _ -> None
) index in
let scan_product_list path =
let tree = download_and_parse (uri ^ path) in
let format = object_get_string "format" tree in
if format <> "products:1.0" then
error (f_"%s is not a Simple Streams (products) v1.0 JSON file (format: %s)")
uri format;
let products_node = object_get_object "products" tree in
let products = Array.to_list products_node in
filter_map (
fun (prod, prod_desc) ->
let arch = object_get_string "arch" prod_desc in
let prods = Array.to_list (object_get_object "versions" prod_desc) in
let prods = filter_map (
fun (rel, rel_desc) ->
let pubname = objects_get_string "pubname" [rel_desc; prod_desc] in
let items = object_find_object "items" rel_desc in
let disk_items = object_find_objects (
function
| (("disk.img"|"disk1.img"), v) -> Some v
| _ -> None
) items in
(match disk_items with
| [] -> None
| disk_item :: _ ->
let printable_name = Some pubname in
let file_uri = uri ^ (object_get_string "path" disk_item) in
let checksums =
let checksums = object_find_objects (
function
| ("sha256", Yajl_string c) -> Some (Checksums.SHA256 c)
| ("sha512", Yajl_string c) -> Some (Checksums.SHA512 c)
| _ -> None
) disk_item in
match checksums with
| [] -> None
| x -> Some x in
let revision = Rev_string rel in
let size = object_get_number "size" disk_item in
let aliases = Some [pubname;] in
let entry = { Index.printable_name = printable_name;
osinfo = None;
file_uri = file_uri;
arch = arch;
signature_uri = None;
checksums = checksums;
revision = revision;
format = None;
size = size;
compressed_size = None;
expand = None;
lvexpand = None;
notes = [];
hidden = false;
aliases = aliases;
sigchecker = sigchecker;
proxy = proxy; } in
Some (rel, (prod, entry))
)
) prods in
(* Select the disk image with the bigger version (i.e. usually
* the most recent one. *)
let reverse_revision_compare (rev1, _) (rev2, _) = compare rev2 rev1 in
let prods = List.sort reverse_revision_compare prods in
match prods with
| [] -> None
| (_, entry) :: _ -> Some entry
) products in
let entries = List.flatten (List.map scan_product_list downloads) in
if verbose () then (
printf "simplestreams tree (%s) after parsing:\n" uri;
List.iter (Index.print_entry Pervasives.stdout) entries
);
entries

View File

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013 Red Hat Inc.
* Copyright (C) 2015 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,4 +16,4 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
val get_kernel : debug:bool -> ?format:string -> ?output:string -> string -> unit
val get_index : downloader:Downloader.t -> sigchecker:Sigchecker.t -> Sources.source -> Index.index

View File

@@ -25,16 +25,21 @@ open Unix
type source = {
name : string;
uri : string;
gpgkey : string option;
gpgkey : Utils.gpgkey_type;
proxy : Downloader.proxy_mode;
format : source_format;
}
and source_format =
| FormatNative
| FormatSimpleStreams
module StringSet = Set.Make (String)
let parse_conf ~prog ~debug file =
if debug then (
eprintf (f_"%s: trying to read %s\n") prog file;
let parse_conf file =
if verbose () then (
printf (f_"%s: trying to read %s\n") prog file;
);
let sections = Ini_reader.read_ini ~prog file in
let sections = Ini_reader.read_ini ~error_suffix:"[ignored]" file in
let sources = List.fold_right (
fun (n, fields) acc ->
@@ -50,31 +55,54 @@ let parse_conf ~prog ~debug file =
try Some (URI.parse_uri (List.assoc ("gpgkey", None) fields)) with
| Not_found -> None
| Invalid_argument "URI.parse_uri" as ex ->
if debug then (
eprintf (f_"%s: '%s' has invalid gpgkey URI\n") prog n;
if verbose () then (
printf (f_"%s: '%s' has invalid gpgkey URI\n") prog n;
);
raise ex in
match k with
| None -> None
| None -> Utils.No_Key
| Some uri ->
(match uri.URI.protocol with
| "file" -> Some uri.URI.path
| "file" -> Utils.KeyFile uri.URI.path
| _ ->
if debug then (
eprintf (f_"%s: '%s' has non-local gpgkey URI\n") prog n;
if verbose () then (
printf (f_"%s: '%s' has non-local gpgkey URI\n") prog n;
);
None
Utils.No_Key
) in
let proxy =
try
(match (List.assoc ("proxy", None) fields) with
| "no" | "off" -> Downloader.UnsetProxy
| "system" -> Downloader.SystemProxy
| _ as proxy -> Downloader.ForcedProxy proxy
)
with
Not_found -> Downloader.SystemProxy in
let format =
try
(match (List.assoc ("format", None) fields) with
| "native" | "" -> FormatNative
| "simplestreams" -> FormatSimpleStreams
| fmt ->
if verbose () then (
eprintf (f_"%s: unknown repository type '%s' in %s, skipping it\n") prog fmt file;
);
invalid_arg fmt
)
with
Not_found -> FormatNative in
{
name = n; uri = uri; gpgkey = gpgkey;
name = n; uri = uri; gpgkey = gpgkey; proxy = proxy;
format = format;
}
in
try (give_source n fields) :: acc
with Not_found | Invalid_argument _ -> acc
) sections [] in
if debug then (
eprintf (f_"%s: ... read %d sources\n") prog (List.length sources);
if verbose () then (
printf (f_"%s: ... read %d sources\n") prog (List.length sources);
);
sources
@@ -91,10 +119,10 @@ let merge_sources current_sources new_sources =
let filter_filenames filename =
Filename.check_suffix filename ".conf"
let read_sources ~prog ~debug =
let dirs = Paths.xdg_config_dirs ~prog in
let read_sources () =
let dirs = Paths.xdg_config_dirs () in
let dirs =
match Paths.xdg_config_home ~prog with
match Paths.xdg_config_home () with
| None -> dirs
| Some dir -> dir :: dirs in
let dirs = List.map (fun x -> x // "repos.d") dirs in
@@ -108,7 +136,7 @@ let read_sources ~prog ~debug =
List.fold_left (
fun acc file ->
try (
let s = merge_sources acc (parse_conf ~prog ~debug (dir // file)) in
let s = merge_sources acc (parse_conf (dir // file)) in
(* Add the current file name to the set only if its parsing
* was successful.
*)
@@ -116,13 +144,13 @@ let read_sources ~prog ~debug =
s
) with
| Unix_error (code, fname, _) ->
if debug then (
eprintf (f_"%s: file error: %s: %s\n") prog fname (error_message code)
if verbose () then (
printf (f_"%s: file error: %s: %s\n") prog fname (error_message code)
);
acc
| Invalid_argument msg ->
if debug then (
eprintf (f_"%s: internal error: invalid argument: %s\n") prog msg
if verbose () then (
printf (f_"%s: internal error: invalid argument: %s\n") prog msg
);
acc
) acc files

View File

@@ -19,7 +19,12 @@
type source = {
name : string;
uri : string;
gpgkey : string option;
gpgkey : Utils.gpgkey_type;
proxy : Downloader.proxy_mode;
format : source_format;
}
and source_format =
| FormatNative
| FormatSimpleStreams
val read_sources : prog:string -> debug:bool -> source list
val read_sources : unit -> source list

View File

@@ -0,0 +1,18 @@
{
"format": "index:1.0",
"updated": "Fri, 08 May 2015 13:20:51 +0000",
"index": {
"net.cirros-cloud:released:download": {
"products": [
"net.cirros-cloud:standard:0.3:i386",
"net.cirros-cloud:standard:0.3:x86_64",
"net.cirros-cloud:standard:0.3:powerpc",
"net.cirros-cloud:standard:0.3:arm"
],
"datatype": "image-downloads",
"format": "products:1.0",
"updated": "Fri, 08 May 2015 13:20:51 +0000",
"path": "streams/v1/net.cirros-cloud_released_download.json"
}
}
}

View File

@@ -0,0 +1,429 @@
{
"products": {
"net.cirros-cloud:standard:0.3:i386": {
"arch": "i386",
"versions": {
"20140908": {
"items": {
"lxc.tar.gz": {
"ftype": "lxc.tar.gz",
"md5": "785c524f55bf2493dcddeedba25172f1",
"sha256": "bc20b950cc20e66e0b915748ad6b1ea2360ec03f08ffe6c68dc1b4a82331ab66",
"size": 3204602,
"path": "0.3.3/cirros-0.3.3-i386-lxc.tar.gz"
},
"disk.img": {
"ftype": "disk.img",
"md5": "283c77db6fc79b2d47c585ec241e7edc",
"sha256": "837cc3c79de14de62b8691c08a6913b7c0c62427870c7c1921ac43b9580748a9",
"size": 12268032,
"path": "0.3.3/cirros-0.3.3-i386-disk.img"
},
"uec.tar.gz": {
"ftype": "uec.tar.gz",
"md5": "861ef94d90ea220ae72b84d258ff5620",
"sha256": "5c7e685d42f0f1c5c70398e8b7388fc21b84dcbb4dc4a37c1c1645fe5c5ed3a4",
"size": 8231317,
"path": "0.3.3/cirros-0.3.3-i386-uec.tar.gz"
}
},
"version": "0.3.3",
"pubname": "cirros-0.3.3-i386"
},
"20150422": {
"items": {
"lxc.tar.gz": {
"ftype": "lxc.tar.gz",
"md5": "ffe02ef2b49cb34881f96e2b4c69383c",
"sha256": "5760cae9b9701dc09f495c3787f1da271800dcbc040eb793ddf4eb636689148a",
"size": 3210378,
"path": "0.3.4/cirros-0.3.4-i386-lxc.tar.gz"
},
"disk.img": {
"ftype": "disk.img",
"md5": "79b4436412283bb63c2cba4ac796bcd9",
"sha256": "48c279ff502ea4c5e3e09d58c9e3a2ab615452dae2ed8fe347f68c136c6a5a0b",
"size": 12506112,
"path": "0.3.4/cirros-0.3.4-i386-disk.img"
},
"uec.tar.gz": {
"ftype": "uec.tar.gz",
"md5": "c1630b33986cc09df2e0cbca7f5c5346",
"sha256": "f1cad519da6632b1d0ebad2f892534b732b5f9dd54d27f532d2963a0748f246e",
"size": 8241360,
"path": "0.3.4/cirros-0.3.4-i386-uec.tar.gz"
}
},
"version": "0.3.4",
"pubname": "cirros-0.3.4-i386"
},
"20140317": {
"items": {
"lxc.tar.gz": {
"ftype": "lxc.tar.gz",
"md5": "55023b89a6121b30603859bb80f5c8d3",
"sha256": "136f8dfff85b8d509a0d0a0264aea79ae94d9b7c3ea5745fbd478ae600adeb20",
"size": 3201206,
"path": "0.3.2/cirros-0.3.2-i386-lxc.tar.gz"
},
"disk.img": {
"ftype": "disk.img",
"md5": "b0a256d40e078d66576f7ae91c296e2b",
"sha256": "f0803c2d179c8a02d029239d35fc3e752cc81ad3436ea52b757e11685ca7c074",
"size": 12336128,
"path": "0.3.2/cirros-0.3.2-i386-disk.img"
},
"uec.tar.gz": {
"ftype": "uec.tar.gz",
"md5": "dcbcc559fc3bc468d9149bd7191aaa0c",
"sha256": "74ba8b67e0dce67f16a6bc5942bee90cbe31381f932aac1ba51bbc774aad5046",
"size": 8221995,
"path": "0.3.2/cirros-0.3.2-i386-uec.tar.gz"
}
},
"version": "0.3.2",
"pubname": "cirros-0.3.2-i386"
},
"20111020": {
"items": {
"lxc.tar.gz": {
"ftype": "lxc.tar.gz",
"md5": "e760bf470841f57c2c1bb426d407d169",
"sha256": "cac7887628527604b65a89e8caa34096d51c2dc1acfe405c15db2fc58495142a",
"size": 1845928,
"path": "0.3.0/cirros-0.3.0-i386-lxc.tar.gz"
},
"disk.img": {
"ftype": "disk.img",
"md5": "90169ba6f09b5906a7f0755bd00bf2c3",
"sha256": "3309675d0d409128b1c2651d576bc8092ca9ab93e15f3d3aa458f40947569b61",
"size": 9159168,
"path": "0.3.0/cirros-0.3.0-i386-disk.img"
},
"uec.tar.gz": {
"ftype": "uec.tar.gz",
"md5": "115ca6afa47089dc083c0dc9f9b7ff03",
"sha256": "b57e0acb32852f89734ff11a511ae0897e8cecb41882d03551649289b6854a1b",
"size": 6596586,
"path": "0.3.0/cirros-0.3.0-i386-uec.tar.gz"
}
},
"version": "0.3.0",
"pubname": "cirros-0.3.0-i386"
},
"20130207": {
"items": {
"lxc.tar.gz": {
"ftype": "lxc.tar.gz",
"md5": "fc404d9fc9dc5f0eb33ebaa03920a046",
"sha256": "70a8c9c175589f7ac7054c6151cf2bb7eb9e210cefbe310446df2fb1a436b504",
"size": 3191593,
"path": "0.3.1/cirros-0.3.1-i386-lxc.tar.gz"
},
"disk.img": {
"ftype": "disk.img",
"md5": "6ba617eafc992e33e7c141c679225e53",
"sha256": "b8aa1ce5d11939eaa01205fc31348532a31b82790921d45ceb397fbe76492787",
"size": 12251136,
"path": "0.3.1/cirros-0.3.1-i386-disk.img"
},
"uec.tar.gz": {
"ftype": "uec.tar.gz",
"md5": "52845de5142e58faf211e135d2b45721",
"sha256": "88dda2e505b862a95d0e0044013addcaa3200e602150c9d73e32c2e29345d6f3",
"size": 8197543,
"path": "0.3.1/cirros-0.3.1-i386-uec.tar.gz"
}
},
"version": "0.3.1",
"pubname": "cirros-0.3.1-i386"
}
},
"stream": "released"
},
"net.cirros-cloud:standard:0.3:x86_64": {
"arch": "x86_64",
"versions": {
"20140908": {
"items": {
"lxc.tar.gz": {
"ftype": "lxc.tar.gz",
"md5": "600363faf89daa6adea87e2dd77263b4",
"sha256": "66255c2f9404484996e646bb825fd2f1fd9d66583fecd3e9e0789376cf055fd4",
"size": 3544884,
"path": "0.3.3/cirros-0.3.3-x86_64-lxc.tar.gz"
},
"disk.img": {
"ftype": "disk.img",
"md5": "133eae9fb1c98f45894a4e60d8736619",
"sha256": "f11286e2bd317ee1a1d0469a6b182b33bda4af6f35ba224ca49d75752c81e20a",
"size": 13200896,
"path": "0.3.3/cirros-0.3.3-x86_64-disk.img"
},
"uec.tar.gz": {
"ftype": "uec.tar.gz",
"md5": "4f3371e52d60e5d47a6fbdd7d6a33973",
"sha256": "6bd27854862c30e25f0312defb9e86f9176b503751f040e323ab83322aa07dae",
"size": 8668951,
"path": "0.3.3/cirros-0.3.3-x86_64-uec.tar.gz"
}
},
"version": "0.3.3",
"pubname": "cirros-0.3.3-x86_64"
},
"20150422": {
"items": {
"lxc.tar.gz": {
"ftype": "lxc.tar.gz",
"md5": "6554ba2d15401c8caa90212ace985593",
"sha256": "e8172c603fad47f4c95e67bd2751c2977e07164c9ebdfcf3f9c1d7ff598ed217",
"size": 3555536,
"path": "0.3.4/cirros-0.3.4-x86_64-lxc.tar.gz"
},
"disk.img": {
"ftype": "disk.img",
"md5": "ee1eca47dc88f4879d8a229cc70a07c6",
"sha256": "34987d0d5702f8813f3ff9efe90e9e39e6926ec78658763580a79face67f3394",
"size": 13287936,
"path": "0.3.4/cirros-0.3.4-x86_64-disk.img"
},
"uec.tar.gz": {
"ftype": "uec.tar.gz",
"md5": "067d511efcc4acd034f7d64b716273bf",
"sha256": "95e77c7deaf0f515f959ffe329918d5dd23e417503d1d45e926a888853c90710",
"size": 8683894,
"path": "0.3.4/cirros-0.3.4-x86_64-uec.tar.gz"
}
},
"version": "0.3.4",
"pubname": "cirros-0.3.4-x86_64"
},
"20140317": {
"items": {
"lxc.tar.gz": {
"ftype": "lxc.tar.gz",
"md5": "174a08e827f22b20ebd774f90f1c9181",
"sha256": "03eff2a3603164fa02c00ca76fdcbd611b2ae8a6a80406753ec35eb275648d2e",
"size": 3538286,
"path": "0.3.2/cirros-0.3.2-x86_64-lxc.tar.gz"
},
"disk.img": {
"ftype": "disk.img",
"md5": "64d7c1cd2b6f60c92c14662941cb7913",
"sha256": "a2ca56aeded5a5bcaa6104fb14ec07b1ceb65222e2890bef8a89b8d2da729ad5",
"size": 13167616,
"path": "0.3.2/cirros-0.3.2-x86_64-disk.img"
},
"uec.tar.gz": {
"ftype": "uec.tar.gz",
"md5": "b369559e3ffa9208b4eb2224c949f579",
"sha256": "f462729fc2f071081dbc55932e07437e265263ef2e688306c353a1f152162b03",
"size": 8655821,
"path": "0.3.2/cirros-0.3.2-x86_64-uec.tar.gz"
}
},
"version": "0.3.2",
"pubname": "cirros-0.3.2-x86_64"
},
"20111020": {
"items": {
"lxc.tar.gz": {
"ftype": "lxc.tar.gz",
"md5": "1a480e5150db4d93be2aa3c9ced94fa1",
"sha256": "0e78796a30641dd7184f752c302a87d66f1eba9985c876911e4f26b4d8ba4a88",
"size": 2115217,
"path": "0.3.0/cirros-0.3.0-x86_64-lxc.tar.gz"
},
"disk.img": {
"ftype": "disk.img",
"md5": "50bdc35edb03a38d91b1b071afb20a3c",
"sha256": "648782e9287288630250d07531fed9944ecc3986764a6664f0bf6c050ec06afd",
"size": 9761280,
"path": "0.3.0/cirros-0.3.0-x86_64-disk.img"
},
"uec.tar.gz": {
"ftype": "uec.tar.gz",
"md5": "f56d3cffa47b7d209d2b6905628f07b9",
"sha256": "043a3e090a5d76d23758a3919fcaff93f77ce7b97594d9d10fc8d00e85f83191",
"size": 6957349,
"path": "0.3.0/cirros-0.3.0-x86_64-uec.tar.gz"
}
},
"version": "0.3.0",
"pubname": "cirros-0.3.0-x86_64"
},
"20130207": {
"items": {
"lxc.tar.gz": {
"ftype": "lxc.tar.gz",
"md5": "38252f1a49fec0ebedebc820854497e0",
"sha256": "a086fcf2758468972d45957dc78ec6317c06f356930dbbc6cad6a8d1855f135e",
"size": 3534564,
"path": "0.3.1/cirros-0.3.1-x86_64-lxc.tar.gz"
},
"disk.img": {
"ftype": "disk.img",
"md5": "d972013792949d0d3ba628fbe8685bce",
"sha256": "e01302fb2d2b13ae65226a0300335172e4487bbe60bb1e5c8b0843a25f126d34",
"size": 13147648,
"path": "0.3.1/cirros-0.3.1-x86_64-disk.img"
},
"uec.tar.gz": {
"ftype": "uec.tar.gz",
"md5": "e1849016cb71a00808093b7bf986f36a",
"sha256": "51eb03b83123a68d4f866c7c15b195204e62db9e33475509a38b79b3122cde38",
"size": 8633554,
"path": "0.3.1/cirros-0.3.1-x86_64-uec.tar.gz"
}
},
"version": "0.3.1",
"pubname": "cirros-0.3.1-x86_64"
}
},
"stream": "released"
},
"net.cirros-cloud:standard:0.3:powerpc": {
"arch": "powerpc",
"versions": {
"20150422": {
"items": {
"lxc.tar.gz": {
"ftype": "lxc.tar.gz",
"md5": "7e3a147b5665a1e14fe6d0ffef9ca410",
"sha256": "b1ab58ebb2a3f253d15cfa13f0cd0de883ce6e80f42ce2e3889e880423e95462",
"size": 3603000,
"path": "0.3.4/cirros-0.3.4-powerpc-lxc.tar.gz"
},
"disk.img": {
"ftype": "disk.img",
"md5": "453b21916c47c6ff8c615f8a5f7b76d2",
"sha256": "5445d77104d19ccdc2dbc943a3d0735c0dadd1227466a3f3e109c19671065f18",
"size": 17145856,
"path": "0.3.4/cirros-0.3.4-powerpc-disk.img"
},
"uec.tar.gz": {
"ftype": "uec.tar.gz",
"md5": "2f8a48928a6b0b2c9afbcb7255ff2aec",
"sha256": "80444c3ac8277d87eed0963567206ea5b009ecf4fdbc71fe8c4df020b42e3215",
"size": 12032417,
"path": "0.3.4/cirros-0.3.4-powerpc-uec.tar.gz"
}
}
}
},
"version": "0.3.4",
"stream": "released",
"pubname": "cirros-0.3.4-powerpc"
},
"net.cirros-cloud:standard:0.3:arm": {
"arch": "arm",
"versions": {
"20140908": {
"items": {
"lxc.tar.gz": {
"ftype": "lxc.tar.gz",
"md5": "7f2fe450d9a0b1688f2a4df6748690f5",
"sha256": "c839db36d5c96651d1dbcfc8a553678b010c7bb49416ac3099282858003fa021",
"size": 3482025,
"path": "0.3.3/cirros-0.3.3-arm-lxc.tar.gz"
},
"uec.tar.gz": {
"ftype": "uec.tar.gz",
"md5": "0437419d2371771b7406fade2d6db7d1",
"sha256": "4a0987818f3a834d9907b93729beb79426e58be9d46b3c207241bc4b1ceec52f",
"size": 7351177,
"path": "0.3.3/cirros-0.3.3-arm-uec.tar.gz"
}
},
"version": "0.3.3",
"pubname": "cirros-0.3.3-arm"
},
"20150422": {
"items": {
"lxc.tar.gz": {
"ftype": "lxc.tar.gz",
"md5": "5fd856d158dc6787264a1b4236126aab",
"sha256": "06c780e8c7166e16154bd0d3a6d1b0031e219269e990c5b8864a82925285486c",
"size": 3489736,
"path": "0.3.4/cirros-0.3.4-arm-lxc.tar.gz"
},
"uec.tar.gz": {
"ftype": "uec.tar.gz",
"md5": "1a2aea370f9f2d95d837f6b84bef658d",
"sha256": "6dd3bad904671aee13317c187d933b3efb1ac39a0d81fd5ac9a1fc694e3cb7ff",
"size": 7357906,
"path": "0.3.4/cirros-0.3.4-arm-uec.tar.gz"
}
},
"version": "0.3.4",
"pubname": "cirros-0.3.4-arm"
},
"20140317": {
"items": {
"lxc.tar.gz": {
"ftype": "lxc.tar.gz",
"md5": "bfb2ecb203cf27f4786b43a558b1ffe8",
"sha256": "a916b3d268793977001e2f09638e4a3e3953cc51d0d53d0bfb8c14cfa7105e86",
"size": 3474403,
"path": "0.3.2/cirros-0.3.2-arm-lxc.tar.gz"
},
"uec.tar.gz": {
"ftype": "uec.tar.gz",
"md5": "171719bfd4b3ec613f5fac321e4216de",
"sha256": "7f74826638e153ec58230bae9eb21805f875ed12eab299140f978e45597cb5cd",
"size": 7340357,
"path": "0.3.2/cirros-0.3.2-arm-uec.tar.gz"
}
},
"version": "0.3.2",
"pubname": "cirros-0.3.2-arm"
},
"20111020": {
"items": {
"lxc.tar.gz": {
"ftype": "lxc.tar.gz",
"md5": "91add49e56cbe6b5004015a4d2f51dbc",
"sha256": "fcd3723c956a1c232730dc28513b466657cbe984232ba2fcc30a4e1f55aa91e9",
"size": 2043822,
"path": "0.3.0/cirros-0.3.0-arm-lxc.tar.gz"
},
"uec.tar.gz": {
"ftype": "uec.tar.gz",
"md5": "c31e05f7829ad45f9d9995c35d232769",
"sha256": "b871823406f818430f57744333b1bb17ce0047e551a316f316641f1bd70d9152",
"size": 5761642,
"path": "0.3.0/cirros-0.3.0-arm-uec.tar.gz"
}
},
"version": "0.3.0",
"pubname": "cirros-0.3.0-arm"
},
"20130207": {
"items": {
"lxc.tar.gz": {
"ftype": "lxc.tar.gz",
"md5": "7ddea367ecb7ecb91554e18bed7c71bd",
"sha256": "2060e59e642b3b2bdf6e34aba3ed15f468bc6f9a8417fc196d01d29b2075493e",
"size": 3466149,
"path": "0.3.1/cirros-0.3.1-arm-lxc.tar.gz"
},
"uec.tar.gz": {
"ftype": "uec.tar.gz",
"md5": "d04e6f26aed123bba2c096581b269e7f",
"sha256": "09dcd3ea6f1d48b3519232973e4dc00fc5e73cbea974cda6b5f7cfa380c6b428",
"size": 7314471,
"path": "0.3.1/cirros-0.3.1-arm-uec.tar.gz"
}
},
"version": "0.3.1",
"pubname": "cirros-0.3.1-arm"
}
},
"stream": "released"
}
},
"datatype": "image-downloads",
"format": "products:1.0",
"updated": "Fri, 08 May 2015 13:20:51 +0000",
"content_id": "net.cirros-cloud:released:download"
}

View File

@@ -0,0 +1,3 @@
[test-cirros]
uri=file://@abs_top_builddir@/builder/test-simplestreams
format=simplestreams

View File

@@ -0,0 +1,108 @@
#!/bin/bash -
# libguestfs virt-builder test script
# Copyright (C) 2015 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
export LANG=C
set -e
abs_builddir=$(pwd)
export XDG_CONFIG_HOME=
export XDG_CONFIG_DIRS="$abs_builddir/test-simplestreams"
short_list=$($VG virt-builder --no-check-signature --no-cache --list)
if [ "$short_list" != "net.cirros-cloud:standard:0.3:i386 i386 cirros-0.3.4-i386
net.cirros-cloud:standard:0.3:x86_64 x86_64 cirros-0.3.4-x86_64
net.cirros-cloud:standard:0.3:powerpc powerpc cirros-0.3.4-powerpc" ]; then
echo "$0: unexpected --list output:"
echo "$short_list"
exit 1
fi
long_list=$(virt-builder --no-check-signature --no-cache --list --long)
if [ "$long_list" != "Source URI: file://$abs_builddir/test-simplestreams
os-version: net.cirros-cloud:standard:0.3:i386
Full name: cirros-0.3.4-i386
Architecture: i386
Minimum/default size: 11.9M
Aliases: cirros-0.3.4-i386
os-version: net.cirros-cloud:standard:0.3:x86_64
Full name: cirros-0.3.4-x86_64
Architecture: x86_64
Minimum/default size: 12.7M
Aliases: cirros-0.3.4-x86_64
os-version: net.cirros-cloud:standard:0.3:powerpc
Full name: cirros-0.3.4-powerpc
Architecture: powerpc
Minimum/default size: 16.4M
Aliases: cirros-0.3.4-powerpc" ]; then
echo "$0: unexpected --list --long output:"
echo "$long_list"
exit 1
fi
json_list=$(virt-builder --no-check-signature --no-cache --list --list-format json)
if [ "$json_list" != "{
\"version\": 1,
\"sources\": [
{
\"uri\": \"file://$abs_builddir/test-simplestreams\"
}
],
\"templates\": [
{
\"os-version\": \"net.cirros-cloud:standard:0.3:i386\",
\"full-name\": \"cirros-0.3.4-i386\",
\"arch\": \"i386\",
\"size\": 12506112,
\"aliases\": [
\"cirros-0.3.4-i386\"
],
\"hidden\": false
},
{
\"os-version\": \"net.cirros-cloud:standard:0.3:x86_64\",
\"full-name\": \"cirros-0.3.4-x86_64\",
\"arch\": \"x86_64\",
\"size\": 13287936,
\"aliases\": [
\"cirros-0.3.4-x86_64\"
],
\"hidden\": false
},
{
\"os-version\": \"net.cirros-cloud:standard:0.3:powerpc\",
\"full-name\": \"cirros-0.3.4-powerpc\",
\"arch\": \"powerpc\",
\"size\": 17145856,
\"aliases\": [
\"cirros-0.3.4-powerpc\"
],
\"hidden\": false
}
]
}" ]; then
echo "$0: unexpected --list --format json output:"
echo "$json_list"
exit 1
fi

View File

@@ -23,9 +23,10 @@ set -e
abs_builddir=$(pwd)
export XDG_CONFIG_HOME=
export XDG_CONFIG_DIRS="$abs_builddir/test-config"
short_list=$($VG ./virt-builder --no-check-signature --no-cache --list)
short_list=$($VG virt-builder --no-check-signature --no-cache --list)
if [ "$short_list" != "phony-debian x86_64 Phony Debian
phony-fedora x86_64 Phony Fedora
@@ -39,7 +40,7 @@ phony-windows x86_64 Phony Windows" ]; then
exit 1
fi
long_list=$(./virt-builder --no-check-signature --no-cache --list --long)
long_list=$(virt-builder --no-check-signature --no-cache --list --long)
if [ "$long_list" != "Source URI: file://$abs_builddir/test-index
@@ -110,86 +111,86 @@ Phony Windows look-alike used for testing." ]; then
exit 1
fi
json_list=$(./virt-builder --no-check-signature --no-cache --list --list-format json)
json_list=$(virt-builder --no-check-signature --no-cache --list --list-format json)
if [ "$json_list" != "{
\"version\": 1,
\"sources\": [
{
\"uri\": \"file://$abs_builddir/test-index\"
}
{
\"uri\": \"file://$abs_builddir/test-index\"
}
],
\"templates\": [
{
\"os-version\": \"phony-debian\",
\"full-name\": \"Phony Debian\",
\"arch\": \"x86_64\",
\"size\": 536870912,
\"notes\": {
\"C\": \"Phony Debian look-alike used for testing.\"
{
\"os-version\": \"phony-debian\",
\"full-name\": \"Phony Debian\",
\"arch\": \"x86_64\",
\"size\": 536870912,
\"notes\": {
\"C\": \"Phony Debian look-alike used for testing.\"
},
\"hidden\": false
},
\"hidden\": false
},
{
\"os-version\": \"phony-fedora\",
\"full-name\": \"Phony Fedora\",
\"arch\": \"x86_64\",
\"size\": 1073741824,
\"notes\": {
\"C\": \"Phony Fedora look-alike used for testing.\"
{
\"os-version\": \"phony-fedora\",
\"full-name\": \"Phony Fedora\",
\"arch\": \"x86_64\",
\"size\": 1073741824,
\"notes\": {
\"C\": \"Phony Fedora look-alike used for testing.\"
},
\"hidden\": false
},
\"hidden\": false
},
{
\"os-version\": \"phony-fedora-qcow2\",
\"full-name\": \"Phony Fedora qcow2\",
\"arch\": \"x86_64\",
\"size\": 1073741824,
\"notes\": {
\"C\": \"Phony Fedora look-alike used for testing.\"
{
\"os-version\": \"phony-fedora-qcow2\",
\"full-name\": \"Phony Fedora qcow2\",
\"arch\": \"x86_64\",
\"size\": 1073741824,
\"notes\": {
\"C\": \"Phony Fedora look-alike used for testing.\"
},
\"hidden\": false
},
\"hidden\": false
},
{
\"os-version\": \"phony-fedora-qcow2-uncompressed\",
\"full-name\": \"Phony Fedora qcow2 uncompressed\",
\"arch\": \"x86_64\",
\"size\": 1073741824,
\"notes\": {
\"C\": \"Phony Fedora look-alike used for testing.\"
{
\"os-version\": \"phony-fedora-qcow2-uncompressed\",
\"full-name\": \"Phony Fedora qcow2 uncompressed\",
\"arch\": \"x86_64\",
\"size\": 1073741824,
\"notes\": {
\"C\": \"Phony Fedora look-alike used for testing.\"
},
\"hidden\": false
},
\"hidden\": false
},
{
\"os-version\": \"phony-fedora-no-format\",
\"full-name\": \"Phony Fedora\",
\"arch\": \"x86_64\",
\"size\": 1073741824,
\"notes\": {
\"C\": \"Phony Fedora look-alike used for testing.\"
{
\"os-version\": \"phony-fedora-no-format\",
\"full-name\": \"Phony Fedora\",
\"arch\": \"x86_64\",
\"size\": 1073741824,
\"notes\": {
\"C\": \"Phony Fedora look-alike used for testing.\"
},
\"hidden\": false
},
\"hidden\": false
},
{
\"os-version\": \"phony-ubuntu\",
\"full-name\": \"Phony Ubuntu\",
\"arch\": \"x86_64\",
\"size\": 536870912,
\"notes\": {
\"C\": \"Phony Ubuntu look-alike used for testing.\"
{
\"os-version\": \"phony-ubuntu\",
\"full-name\": \"Phony Ubuntu\",
\"arch\": \"x86_64\",
\"size\": 536870912,
\"notes\": {
\"C\": \"Phony Ubuntu look-alike used for testing.\"
},
\"hidden\": false
},
\"hidden\": false
},
{
\"os-version\": \"phony-windows\",
\"full-name\": \"Phony Windows\",
\"arch\": \"x86_64\",
\"size\": 536870912,
\"notes\": {
\"C\": \"Phony Windows look-alike used for testing.\"
},
\"hidden\": false
}
{
\"os-version\": \"phony-windows\",
\"full-name\": \"Phony Windows\",
\"arch\": \"x86_64\",
\"size\": 536870912,
\"notes\": {
\"C\": \"Phony Windows look-alike used for testing.\"
},
\"hidden\": false
}
]
}" ]; then
echo "$0: unexpected --list --format json output:"

View File

@@ -21,6 +21,7 @@ set -e
abs_builddir=$(pwd)
export XDG_CONFIG_HOME=
export XDG_CONFIG_DIRS="$abs_builddir/test-config"
if [ ! -f fedora.xz -o ! -f fedora.qcow2 -o ! -f fedora.qcow2.xz ]; then
@@ -28,7 +29,7 @@ if [ ! -f fedora.xz -o ! -f fedora.qcow2 -o ! -f fedora.qcow2.xz ]; then
exit 77
fi
if [ "$(../fish/guestfish get-backend)" = "uml" ]; then
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because backend is UML"
exit 77
fi
@@ -42,8 +43,8 @@ for input in phony-fedora phony-fedora-qcow2 phony-fedora-qcow2-uncompressed pho
if [ "$size" != "none" ]; then args="$args --size $size"; fi
if [ "$format" != "none" ]; then args="$args --format $format"; fi
echo $VG ./virt-builder $input $args
$VG ./virt-builder $input $args
echo $VG virt-builder $input $args
$VG virt-builder $input $args
done
done
done

View File

@@ -21,8 +21,14 @@ set -e
abs_builddir=$(pwd)
export XDG_CONFIG_HOME=
export XDG_CONFIG_DIRS="$abs_builddir/test-config"
if [ -n "$SKIP_TEST_VIRT_BUILDER_SH" ]; then
echo "$0: skipping test because environment variable is set."
exit 77
fi
if [ ! -f fedora.xz ]; then
echo "$0: test skipped because there is no fedora.xz in the build directory"
exit 77
@@ -31,7 +37,7 @@ fi
output=phony-fedora.img
format=qcow2
if [ "$(../fish/guestfish get-backend)" = "uml" ]; then
if [ "$(guestfish get-backend)" = "uml" ]; then
format=raw
# XXX We specifically want virt-builder to work with the UML
@@ -49,7 +55,7 @@ rm -f $output
# Note we cannot test --install, --run since the phony Fedora doesn't
# have a real OS inside just some configuration files. Just about
# every other option is fair game.
$VG ./virt-builder phony-fedora \
$VG virt-builder phony-fedora \
-v --no-cache --no-check-signature $no_network \
-o $output --size 2G --format $format \
--arch x86_64 \
@@ -59,6 +65,7 @@ $VG ./virt-builder phony-fedora \
--mkdir /etc/foo/bar/baz \
--write '/etc/foo/bar/baz/foo:Hello World' \
--upload Makefile:/Makefile \
--edit '/Makefile: s{^#.*}{}' \
--upload Makefile:/etc/foo/bar/baz \
--delete /Makefile \
--link /etc/foo/bar/baz/foo:/foo \
@@ -67,7 +74,7 @@ $VG ./virt-builder phony-fedora \
--firstboot-install "minicom,inkscape"
# Check that some modifications were made.
$VG ../fish/guestfish --ro -i -a $output > test.out <<EOF
$VG guestfish --ro -i -a $output > test-virt-builder.out <<EOF
# Uploaded files
is-file /etc/foo/bar/baz/Makefile
cat /etc/foo/bar/baz/foo
@@ -92,7 +99,7 @@ is-file /etc/shadow
cat /etc/shadow | sed -r '/^root:/!d;s,^(root:\\\$6\\\$).*,\\1,g'
EOF
if [ "$(cat test.out)" != "true
if [ "$(cat test-virt-builder.out)" != "true
Hello World
true
true
@@ -108,9 +115,9 @@ true
true
root:\$6\$" ]; then
echo "$0: unexpected output:"
cat test.out
cat test-virt-builder.out
exit 1
fi
rm $output
rm test.out
rm test-virt-builder.out

View File

@@ -0,0 +1,8 @@
name=Phony Fedora
arch=x86_64
file=fedora.xz
format=raw
size=1073741824
expand=/dev/sda2
lvexpand=/dev/VG/Root
notes=Phony Fedora look-alike used for testing.

View File

@@ -0,0 +1,2 @@
# All lines commented out.
# [foo]

View File

@@ -0,0 +1,4 @@
# Empty lines before the first section
[foo]
key=value

View File

@@ -0,0 +1,25 @@
#!/bin/bash -
# test virt-index-validate
# Copyright (C) 2014 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
export LANG=C
set -e
! $VG virt-index-validate test-virt-index-validate-bad-1
$VG virt-index-validate test-virt-index-validate-good-1
$VG virt-index-validate test-virt-index-validate-good-2
$VG virt-index-validate test-virt-index-validate-good-3

37
builder/utils.ml Normal file
View File

@@ -0,0 +1,37 @@
(* virt-builder
* Copyright (C) 2013-2016 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
(* Utilities/common functions used in virt-builder only. *)
open Printf
open Common_utils
type gpgkey_type =
| No_Key
| Fingerprint of string
| KeyFile of string
and revision =
| Rev_int of int
| Rev_string of string
let quote = Filename.quote
let string_of_revision = function
| Rev_int n -> string_of_int n
| Rev_string s -> s

View File

@@ -16,7 +16,7 @@ virt-builder - Build virtual machine images quickly
[--arch ARCHITECTURE] [--attach ISOFILE]
__CUSTOMIZE_SYNOPSIS__
virt-builder -l|--list [--long] [--list-format short|long|json]
virt-builder -l|--list [--long] [--list-format short|long|json] [os-version]
virt-builder --notes os-version
@@ -77,7 +77,7 @@ The first time this runs it has to download the template over the
network, but this gets cached (see L</CACHING>).
The name of the output file is derived from the template name, so
above it will be C<fedora-20.img>. You can change the output filename
above it will be F<fedora-20.img>. You can change the output filename
using the I<-o> option:
virt-builder fedora-20 -o mydisk.img
@@ -87,7 +87,7 @@ logical volumes.
virt-builder fedora-20 --format qcow2
As above, but write the output in qcow2 format to C<fedora-20.qcow2>.
As above, but write the output in qcow2 format to F<fedora-20.qcow2>.
virt-builder fedora-20 --size 20G
@@ -104,7 +104,7 @@ As above, but using an i386 template, if available.
virt-builder fedora-20 --root-password file:/tmp/rootpw
Create a Fedora 20 image. The root password is taken from the file
C</tmp/rootpw>.
F</tmp/rootpw>.
Note if you I<don't> set I<--root-password> then the guest is given
a I<random> root password.
@@ -164,9 +164,11 @@ the guest boots.
Or:
virt-builder fedora-20 --edit '/etc/yum.conf: s/gpgcheck=1/gpgcheck=0/'
virt-builder fedora-20 \
--edit '/etc/yum.conf:
s/gpgcheck=1/gpgcheck=0/'
which edits C</etc/yum.conf> inside the disk image (during disk image
which edits F</etc/yum.conf> inside the disk image (during disk image
creation, long before boot).
You can combine these options, and have multiple options of all types.
@@ -218,7 +220,7 @@ C<FORMAT> is usually C<raw> or C<qcow2>. Use C<raw> for ISOs.
I<--cache> DIR sets the directory to use/check for cached template
files. If not set, defaults to either
C<$XDG_CACHE_HOME/virt-builder/> or C<$HOME/.cache/virt-builder/>.
F<$XDG_CACHE_HOME/virt-builder/> or F<$HOME/.cache/virt-builder/>.
I<--no-cache> disables template caching.
@@ -278,6 +280,12 @@ For ordinary builds, this selects the output format. The default is I<raw>.
With I<--get-kernel> this specifies the input format.
To create an old-style qcow2 file (for compatibility with RHEL 6 or
very old qemu E<lt> 1.1), after running virt-builder, use this
command:
qemu-img amend -f qcow2 -o compat=0.10 output.qcow2
=item B<--get-kernel> IMAGE
This option extracts the kernel and initramfs from a previously built
@@ -293,7 +301,7 @@ specify it by using the I<--format> option.
In the case where the guest contains multiple kernels, the one with
the highest version number is chosen. To extract arbitrary kernels
from the disk image, see L<guestfish(1)>. To extract the entire
C</boot> directory of a guest, see L<virt-copy-out(1)>.
F</boot> directory of a guest, see L<virt-copy-out(1)>.
=item B<--gpg> GPG
@@ -303,17 +311,18 @@ alternate home directory:
virt-builder --gpg "gpg --homedir /tmp" [...]
=item B<-l>
=item B<-l> [os-version]
=item B<--list>
=item B<--list> [os-version]
=item B<--list --format> format
=item B<--list --list-format> format [os-version]
=item B<--list --long>
=item B<--list --long> [os-version]
List available templates.
List all the available templates if no guest is specified, or only for the
specified one.
It is possible to choose with I<--format> the output format for the list
It is possible to choose with I<--list-format> the output format for the list
templates:
=over 4
@@ -344,6 +353,12 @@ I<--long> is a shorthand for the C<long> format.
See also: I<--source>, I<--notes>, L</SOURCES OF TEMPLATES>.
=item B<--machine-readable>
This option is used to make the output more machine friendly
when being parsed by other programs. See
L</MACHINE READABLE OUTPUT> below.
=item B<-m> MB
=item B<--memsize> MB
@@ -428,7 +443,7 @@ the install).
=item B<--output> filename
Write the output to C<filename>. If you don't specify this option,
Write the output to F<filename>. If you don't specify this option,
then the output filename is generated by taking the C<os-version>
string and adding C<.img> (for raw format) or C<.qcow2> (for qcow2
format).
@@ -443,6 +458,8 @@ directory.
Print information about the template cache. See L</CACHING>.
=item B<-q>
=item B<--quiet>
Don't print ordinary progress messages.
@@ -494,6 +511,10 @@ your bug report.
Display version number and exit.
=item B<-x>
Enable tracing of libguestfs API calls.
=back
=head2 Customization options
@@ -668,7 +689,7 @@ See L<localectl(1)> and
L<https://www.happyassassin.net/2013/11/23/keyboard-layouts-in-fedora-20-and-previously/>
for more details.
=head3 Keyboard layout using C</etc/sysconfig/keyboard>
=head3 Keyboard layout using F</etc/sysconfig/keyboard>
For RHEL E<le> 6, Fedora E<le> 18 and similar, upload or modify the
keyboard configuration file using the I<--upload>, I<--write> or
@@ -681,7 +702,7 @@ The format of this file can be found documented in many places online.
=head3 Keyboard layout with Debian-derived distros
For Debian-derived distros using C</etc/default/keyboard>, upload or
For Debian-derived distros using F</etc/default/keyboard>, upload or
modify the keyboard file using the I<--upload>, I<--write> or
I<--edit> options. For example:
@@ -745,23 +766,140 @@ logged in one of the following locations:
=over 4
=item C</tmp/builder.log>
=item F</tmp/builder.log>
On Linux, BSD and other guests.
=item C<C:\Temp\builder.log>
=item F<C:\Temp\builder.log>
On Windows, DOS guests.
=item C</builder.log>
=item F</builder.log>
If C</tmp> or C<C:\Temp> is missing.
If F</tmp> or F<C:\Temp> is missing.
=back
If you don't want the log file to appear in the final image, then
use the I<--no-logfile> command line option.
=head2 SSH KEYS
The I<--ssh-inject> option is used to inject ssh keys for users in
the guest, so they can login without supplying a password.
The C<SELECTOR> part of the option value is optional; in this case,
I<--ssh-inject> C<USER> means that we look in the I<current>
user's F<~/.ssh> directory to find the default public ID file. That
key is uploaded. "default public ID" is the I<default_ID_file> file
described in L<ssh-copy-id(1)>.
If specified, the C<SELECTOR> can be in one of the following formats:
=over 4
=item B<--ssh-inject> USER:file:FILENAME
Read the ssh key from F<FILENAME>. F<FILENAME> is usually a I<.pub>
file.
=item B<--ssh-inject> USER:string:KEY_STRING
Use the specified C<KEY_STRING>. C<KEY_STRING> is usually a public
string like I<ssh-rsa AAAA.... user@localhost>.
=back
In any case, the F<~USER/.ssh> directory and the
F<~USER/.ssh/authorized_keys> file will be created if not existing
already.
=head2 FIRST BOOT SCRIPTS
The I<--firstboot> and I<--firstboot-command> options allow you to
execute commands at the first boot of the guest. To do so, an init
script for the guest init system is installed, which takes care of
running all the added scripts and commands.
Supported operating systems are:
=over 4
=item Linux
Init systems supported are: systemd, System-V init (known also as sysvinit),
and Upstart (using the System-V scripts).
Note that usually init scripts run as root, but with a more limited
environment than what could be available from a normal shell:
for example, C<$HOME> may be unset or empty.
The output of the first boot scripts is available in the guest as
F<~root/virt-sysprep-firstboot.log>.
=item Windows
F<rhsrvany.exe>, available from sources at
L<https://github.com/rwmjones/rhsrvany>, is installed to run the
first boot scripts. It is required, and the setup of first boot
scripts will fail if it is not present.
F<rhsrvany.exe> is copied from the location pointed to by the
C<VIRT_TOOLS_DATA_DIR> environment variable; if not set, a compiled-in
default will be used (something like F</usr/share/virt-tools>).
The output of the first boot scripts is available in the guest as
F<C:\Program Files\Red Hat\Firstboot\log.txt>.
=back
=head2 SUBSCRIPTION-MANAGER
It is possible to automate the registration and attaching of the
system using C<subscription-manager>. This is typical on
Red Hat Enterprise Linux guests. There are few options which ease
this process, avoid executing commands manually and exposing
passwords on command line.
I<--sm-register> starts the registration process, and requires
I<--sm-credentials> to be specified; the format of the C<SELECTOR>
of I<--sm-credentials> is one of the following formats:
=over 4
=item B<--sm-credentials> USER:file:FILENAME
Read the password for the specified C<USER> from F<FILENAME>.
=item B<--sm-credentials> USER:password:PASSWORD
Use the literal string C<PASSWORD> for the specified C<USER>.
=back
I<--sm-attach> attaches the system to subscriptions; the format
of its C<SELECTOR> is one of the following:
=over 4
=item B<--sm-attach> auto
C<subscription-manager> attaches to the best-fitting subscriptions
for the system.
=item B<--sm-attach> file:FILENAME
Read the pool ID from F<FILENAME>.
=item B<--sm-attach> pool:POOL
Use the literal string C<POOL> as pool ID.
=back
I<--sm-remove> removes all the subscriptions from the guest, while
I<--sm-unregister> completely unregister the system.
=head2 INSTALLATION PROCESS
When you invoke virt-builder, installation proceeds as follows:
@@ -815,7 +953,8 @@ Import the disk image into libvirt using L<virt-install(1)>
I<--import> option.
virt-install --import \
--name guest --ram 2048 --disk path=disk.img,format=raw
--name guest --ram 2048 \
--disk path=disk.img,format=raw --os-variant fedora20
Notes:
@@ -828,6 +967,16 @@ you used virt-builder's I<--format> option.
=item 2.
I<--os-variant> is highly recommended, because it will present optimum
devices to enable the guest to run most efficiently. To get a list
of all variants, do:
osinfo-query os
The above tool is provided by libosinfo package.
=item 3.
You can run virt-install as root or non-root. Each works slightly
differently because libvirt manages a different set of virtual
machines for each user. In particular virt-manager normally shows the
@@ -920,7 +1069,7 @@ Run L<virt-rescue(1)> on the disk image:
virt-rescue -a disk.img
This gives you a rescue shell. You can mount the filesystems from the
disk image on C</sysroot> and examine them using ordinary Linux
disk image on F</sysroot> and examine them using ordinary Linux
commands. You can also chroot into the guest to reinstall the
bootloader. The virt-rescue man page has a lot more information and
examples.
@@ -968,12 +1117,12 @@ with the I<.conf> extension and located in the following paths:
=item *
$XDG_CONFIG_HOME/virt-builder/repos.d/ (C<$XDG_CONFIG_HOME> is
C<$HOME/.config> if not set).
F<$HOME/.config> if not set).
=item *
$XDG_CONFIG_DIRS/virt-builder/repos.d/ (where C<$XDG_CONFIG_DIRS>
means any of the directories in that environment variable, or just C</etc/xdg>
means any of the directories in that environment variable, or just F</etc/xdg>
if not set)
=back
@@ -1004,6 +1153,54 @@ This optional field represents the URI (although only I<file://> URIs
are accepted) of the key used to sign the index file.
If not present, the index file referred by I<uri=..> is not signed.
=item C<proxy=MODE>
This optional field specifies the proxy mode, to be used when downloading
the index file of this repository. The possible values are:
=over 4
=item B<no>, B<off>
No proxy is being used at all, even overriding the system configuration.
=item B<system>
The proxy used is the system one.
=item I<anything else>
Specifies the actual proxy configuration to be used, overriding the system
configuration.
=back
If not present, the assumed value is to respect the proxy settings of the
system (i.e. as if B<system> would be specified).
=item C<format=FORMAT>
This optional field specifies the format of the repository.
The possible values are:
=over 4
=item B<native>
The native format of the C<virt-builder> repository. See also
L</Creating and signing the index file> below.
=item B<simplestreams>
The URI represents the root of a Simple Streams v1.0 tree of metadata.
For more information about Simple Streams, see also
L<https://launchpad.net/simplestreams>.
=back
If not present, the assumed value is C<native>.
=back
For serious virt-builder use, you may want to create your own
@@ -1072,6 +1269,7 @@ digital signature):
[fedora-18]
name=Fedora® 18
osinfo=fedora18
arch=x86_64
file=fedora-18.xz
checksum[sha512]=...
format=raw
@@ -1082,6 +1280,7 @@ digital signature):
[fedora-19]
name=Fedora® 19
osinfo=fedora19
arch=x86_64
file=fedora-19.xz
checksum[sha512]=...
revision=3
@@ -1098,7 +1297,7 @@ using the following command:
gpg --clearsign --armor index
This will create the final file called C<index.asc> which can be
This will create the final file called F<index.asc> which can be
uploaded to the server (and is the I<uri=..> URL). As noted above,
signing the index file is optional, but recommended.
@@ -1116,6 +1315,11 @@ I<--list> output but is otherwise not significant.
This optional field maps the operating system to the associated
libosinfo ID. Virt-builder does not use it (yet).
=item C<arch=ARCH>
The architecture of the operating system installed within the
template. This field is required.
=item C<file=PATH>
The path (relative to the index) of the xz-compressed template.
@@ -1241,6 +1445,14 @@ Using the hidden flag prevents the template from being listed by the
I<--list> option (but it is still installable). This is used for test
images.
=item C<aliases=ALIAS1 ALIAS2 ...>
This optional field specifies a list of aliases, separated by spaces,
for the image. For example, an alias could be used to always point
to the latest version of a certain image, leaving the old versions
available in the index instead of updating the same image (see the
C<revision> field).
=back
=head3 Running virt-builder against multiple sources
@@ -1287,7 +1499,7 @@ A tool called L<virt-index-validate(1)> is available to validate the
index file to ensure it is correct.
Note that the parser and tool can work on either the signed or
unsigned index file (ie. C<index> or C<index.asc>).
unsigned index file (ie. F<index> or F<index.asc>).
The index is always encoded in UTF-8.
@@ -1298,8 +1510,8 @@ The index is always encoded in UTF-8.
Since the templates are usually very large, downloaded templates are
cached in the user's home directory.
The location of the cache is C<$XDG_CACHE_HOME/virt-builder/> or
C<$HOME/.cache/virt-builder>.
The location of the cache is F<$XDG_CACHE_HOME/virt-builder/> or
F<$HOME/.cache/virt-builder>.
You can print out information about the cache directory, including
which guests are currently cached, by doing:
@@ -1346,7 +1558,7 @@ instead of I<--install>.
To install a Fedora guest using a local mirror:
virt-builder fedora 20 \
virt-builder fedora-20 \
--edit '/etc/yum.repos.d/fedora.repo:
s{.*baseurl=.*}{baseurl=http://example.com/mirror/};
s{.*metalink=.*}{};
@@ -1361,10 +1573,10 @@ To install a Fedora guest using a local mirror:
=head4 Using a local mirror with Debian
Assuming that you are using C<apt-proxy> to mirror the repository, you
should create a new C<sources.list> file to point to your proxy (see
should create a new F<sources.list> file to point to your proxy (see
L<https://help.ubuntu.com/community/AptProxy>) and then do:
virt-builder fedora 20 \
virt-builder debian-7 \
--upload sources.list:/etc/apt/sources.list \
--run-command 'apt-get -y update' \
--run-command 'apt-get -y install pkg1 pkg2 ...'
@@ -1531,9 +1743,9 @@ SELinux labels correctly in the disk image.
Sometimes fixfiles is not possible during installation, in which case
this option falls back on:
=item Touching C</.autorelabel>
=item Touching F</.autorelabel>
Guest templates may already contain a file called C</.autorelabel>, or
Guest templates may already contain a file called F</.autorelabel>, or
it is touched if I<--selinux-relabel> cannot run fixfiles.
For guests that use SELinux, this causes fixfiles to run at first
@@ -1542,6 +1754,31 @@ which is normal and harmless.
=back
Please note that if your guest uses SELinux, and you are doing operations
on it which might create new files or change existing ones, you are
recommended to use I<--selinux-relabel>. This will help in making sure
that files have the right SELinux labels.
=head1 MACHINE READABLE OUTPUT
The I<--machine-readable> option can be used to make the output more
machine friendly, which is useful when calling virt-builder from other
programs, GUIs etc.
Use the option on its own to query the capabilities of the
virt-builder binary. Typical output looks like this:
$ virt-builder --machine-readable
virt-builder
arch
config-file
customize
json-list
pxzcat
A list of features is printed, one per line, and the program exits
with status 0.
=head1 ENVIRONMENT VARIABLES
For other environment variables which affect all libguestfs programs,
@@ -1563,6 +1800,28 @@ are actually interpreted by L<curl(1)>, not virt-builder.
Used to determine the location of the template cache, and the location
of the user' sources. See L</CACHING> and L</SOURCES OF TEMPLATES>.
=item C<VIRT_TOOLS_DATA_DIR>
This can point to the directory containing data files used for Windows
firstboot installation.
Normally you do not need to set this. If not set, a compiled-in
default will be used (something like F</usr/share/virt-tools>).
This directory may contain the following files:
=over 4
=item F<rhsrvany.exe>
This is the RHSrvAny Windows binary, used to install a "firstboot"
script in Windows guests. It is required if you intend to use the
I<--firstboot> or I<--firstboot-command> options with Windows guests.
See also: C<https://github.com/rwmjones/rhsrvany>
=back
=item C<XDG_CACHE_HOME>
Used to determine the location of the template cache. See L</CACHING>.

View File

@@ -13,7 +13,7 @@ that it knows how to use. This index file has a specific format which
virt-index-validate knows how to validate.
Note that virt-index-validate can validate either the signed or
unsigned index file (ie. either C<index> or C<index.asc>). It can
unsigned index file (ie. either F<index> or F<index.asc>). It can
only validate a local file, not a URL.
=head1 OPTIONS

View File

@@ -26,19 +26,21 @@ EXTRA_DIST = \
index \
index.asc \
centos.sh \
centos-*.xz.sig \
cirros-*.xz.sig \
debian.preseed \
debian.sh \
debian-*.xz.sig \
fedora.sh \
fedora-*.xz.sig \
fedora-aarch64.sh \
fedora-armv7l.sh \
fedora-i686.sh \
fedora-ppc64.sh \
fedora-ppc64le.sh \
rhel.sh \
rhel-aarch64.sh \
rhel-ppc64.sh \
rhel-ppc64le.sh \
scientificlinux.sh \
scientificlinux-*.xz.sig \
ubuntu.preseed \
ubuntu.sh \
ubuntu-*.*.xz.sig
ubuntu.sh
CLEANFILES = *~

View File

@@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)
iQIcBAABAgAGBQJSovhrAAoJEJFzj3Pht2igwDMP/3kxGo8Uhro4c08/AmARucOn
K8xVFMNth6e70ULit0iBnzsqsRcLXMtcdaIzA3wPNJoa3Uw0ZKzHO1FIP1DZC0Yp
wQgnT/HV70k4YKMbJk2ayk9RPop/tRY/Pet9b0MoBwf/H7QzfQX+rU5WYCkcvr60
t18hgugLfFh4wS5UP8jz1S5f6ftrb4TKQUB95lge+Fs7hCf2eqSy4jOciX92yQA6
ACsh1e8hkWlAuDBesg+vcPFrh0oR05HZykUPOH5jUC9zM7kP2w4Y/mPFMIB6J/Zg
SWOTfQWyKYWpW8MZ3huuB8/4EziOOwmIE9pDMcXIS4Cei08DOvq+/F6nbtpErfDU
GdeypPIAsQPjjYDlPUEgYv6L8egzDGuOYWxgNO+2EaYCRjmtvDIxgnf4Q2fQLAhS
Eir9hgvGH6BnNjaLigG1nA/wT6G0U6Ng1vqVrdGUpW1c6m7QoyjhRt4CyaaK0Rj/
3H4FPPdamw/PXLM9IGVauthx/40umcBEZpSq5FSNGbzfzYPxMExJnu2W2bFF4QBD
I/wnPxk5RCYq/AUmRwNrx4klmXnhZZKHYHTDkMuwoV8eIe9Bb6/+f9BY2ujkeMZR
EbeG4i/E8YQ3fwSDfUpQS6kWZ74gMRfuC8vW2LGKMwKPrCaXJu4mVNYmdJGd3d8v
fQ9MlcBUSfaMkyAQ2gc4
=Phm4
-----END PGP SIGNATURE-----

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# virt-builder
# Copyright (C) 2013 Red Hat Inc.
# Copyright (C) 2013-2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,9 +30,20 @@ version=$1
output=centos-$version
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
# We rebuild this every time there is a new 6.x release, and bump
# the revision in the index.
tree=http://mirror.bytemark.co.uk/centos/$version/os/x86_64/
case $version in
6)
# We rebuild this every time there is a new 6.x release, and bump
# the revision in the index.
tree=http://mirror.bytemark.co.uk/centos/$version/os/x86_64/
major=6
;;
7.*)
major=7
# XXX This always points to the latest CentOS 7, so
# effectively the minor number is always ignored.
tree=http://mirror.centos.org/centos-7/$major/os/x86_64/
;;
esac
rm -f $output $output.old $output.xz
@@ -76,10 +87,11 @@ virt-install \
--name=$tmpname \
--ram=2048 \
--cpu=host --vcpus=2 \
--os-type=linux --os-variant=rhel$version \
--os-type=linux --os-variant=rhel$major \
--initrd-inject=$ks \
--extra-args="ks=file:/`basename $ks` console=tty0 console=ttyS0,115200 proxy=$http_proxy" \
--disk $(pwd)/$output,size=6 \
--disk $(pwd)/$output,size=6,format=raw \
--serial pty \
--location=$tree \
--nographics \
--noreboot

View File

@@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAABAgAGBQJSx//LAAoJEJFzj3Pht2igtekP/11RH1POvryBWsmtjgwviPJV
P8eIGuUBy38BYbEO0jBWTsT6CAfwOCtyUUMWCBPJ3meoRd4C5AGWHUS5F6z6fZWq
Qo+LU1BfPWDa3TMXP9TybexUCI6cIBMlbzbwkSE/fR2JDwl3K58ZWUrI1rxfKKNJ
CM8rcpLVVP19sAiurndqiIU43bEOS7UwKhBYr1LtNQndpaDH2l+9XnC/HlOrAKgR
H/X9GgscJ43MtA3VPY140RKgZ716c/zznd2yLXrXIJ9JJ9DsoPsooZ6cZSoxDl2E
Y16lnQyAcDySPY+NZluQ6xvtk4JiDWxLFqdXMksRtUb14D91bJ2okhjtztg5yuLh
tC1aNiwcZaDynjXec4SnB+06oPZGstO6uPotasb9sBH/Prm1mv1A4jLwwMTOjSLT
svZ2/xy83lZqBBwU2oFTiSL+hSS3zTm8X0JaInZJPXlgDOTrdKb7UlzVEJ6SqOZo
4omjaYnHWIe9H2SPxCH/7/DC9WW1K9fuxkIEjvqbxTC3n/6WziK2Aq2k5s1Aq0Yy
Z0am0Xhi169V8s8BaLFWiHGi/VlCd81/q2bg+3qCZcWE4zonEZDZSNrL1FtDtHRj
Cgzo0su2LYHhdt0+2QYnAfUJN7Q5kGA1apWrmVI2cvvDpx0eHsFKLcdJnzOntabv
fI+rI2o+Lhp1DW7ywVzl
=KKLo
-----END PGP SIGNATURE-----

View File

@@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
iQIcBAABAgAGBQJSgNPNAAoJEJFzj3Pht2igb1MP/2sQeJEznpBguE5bbs+ulGyW
Aa6jHgM+sG90OF0J9YlDZcYWYKiuVt+kdPOCw9WPg/e5AglKOu6FiMdFA/R9uP9i
ga49So8xYQwaGS6GitHT6dI/kDNLSvTny0nNvAtut62mEJ5D5m9xxtXgYrttUByk
DGQNUJizj8KehUbu9G+sVDM4ojyEbQlSWqi+SRK8uSFwINXXMwwimjZsq/BddcC6
5DplyxS4o9EkbJP/QJKjkfyuhyBzMdIbVstPNFefqPn/xRX7h8VZOyVxr5dw0gYd
PUU5aXeNJFiYR+LvJ2dLxjbcMEmFT+zhUOcxFWwZnjSYaRDdz47AeGfMLzEoFN4K
/fYmtlusjLn9TDNsQ85ffXTETQU8CrhAfUvFmSPU1XuyY/G0UfK6LQehhg5tmHVL
sfOBTKm/lOj+DG4CS0uAjY7JhLEn9K88kKgXhRGIcKt8UjgsPLvTq9sI87OlbcEe
e4++ALWkXpfXF3Nf7mFXNwhQQSiiG9NIATsbfxSS9C7b0Y3HGWOy6pp4TyN8SIEi
RNyWq93iOOtg91kuoRdScEn0crNninok7BmNt2MJry3Cujet+wBpBXYxuVdvRTPO
6kBdl48bxvRb6hcwLqVjeWw8FM6sBGaA8mnTzshHu8nk6hl+tNwfk0loFwyO2M18
bx0DKFFg024W/hfFqKkt
=9ZnB
-----END PGP SIGNATURE-----

View File

@@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
iQIcBAABAgAGBQJSgN0FAAoJEJFzj3Pht2igfCAP/RUpnWQd1XjLKyyZjJSLMyPb
oFF5JmQbFLF906L3wj/kuqyVf+VEdPXBSYTCw/5qvcAoNW/4DxtooSztK0P6j8TX
Ez1g/Hamp0brIdBaFaerTMFSMtrHsIfBjSRCZJy2WCmlJH/piefPdRS06GXqLcDO
WwLN5RZ2R5bWsSkS7DU4V/QODX35jFKV5xMwmX622jitDDWyStLESmyzF8E9MwKh
QbRSguMilpszac9+GcaN05UTv4htarcsy5EkHBxZzjrS5srxlBQl5ygt0ZIj9GBh
UUvfrIXnCZz7WhsBrbB72VhyXFnZj6gsPJsxRdvDg0nH9ORbmsnUo+Q3AJm6h8Vg
UlOPMn05eToeDHF7U5Ki1w5G39TovUTLDJ43jTLHEy/im4zIIRSJgKaD8a4xLhib
6wLWV9LHYQXHesoIqpfb5ife4KEFi5OVlioZ4REK0auKVVOA0y0eQnjDGJ0szBpp
2xx+c+v2q5rn5X3S79lugAC0TpNxbM3X7rtli+kwa5l9Y7f5Z0XZJ7iuywoPs/VN
5WxfG6vc0yfCMs8gpLL1TDVWZW6baoALTUkWj3ePn5od4KL/V9RXTnWhjaDQ+XbX
/DEHwg7E+ICMPiZSqkeqfSAmbc+8Njdf77sEFCZF+ZV046BlHy+aFvxAY6rmrQTZ
+d6Z2oiZ3UZ5R8iOqiDB
=HZIe
-----END PGP SIGNATURE-----

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# libguestfs
# Copyright (C) 2013 Red Hat Inc.
# Copyright (C) 2013-2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,6 +33,12 @@ fi
# Some configuration.
version=$1
dist=$2
if [ "$dist" = "jessie" ]; then
# Until virt-install learns about debianjessie.
osvariant=debianwheezy
else
osvariant=debian$dist
fi
location=http://ftp.uk.debian.org/debian/dists/$dist/main/installer-amd64
output=debian-$version
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
@@ -60,10 +66,11 @@ trap cleanup INT QUIT TERM EXIT ERR
virt-install \
--name=$tmpname \
--ram=1024 \
--os-type=linux --os-variant=debian$dist \
--os-type=linux --os-variant=$osvariant \
--initrd-inject=$(pwd)/preseed.cfg \
--extra-args="auto console=tty0 console=ttyS0,115200" \
--disk=$(pwd)/$output,size=4 \
--disk=$(pwd)/$output,size=4,format=raw \
--serial pty \
--location=$location \
--nographics \
--noreboot

View File

@@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
iQIcBAABAgAGBQJSSt3OAAoJEJFzj3Pht2ig8x4QAKoQVfMWxXiFvV3lrHUVsjpG
n+fDcoFJqMKeE/kMLhmlmzF+QDz1qRs3Xlypy7C8B5ii5jbFVCv6q5edeEWrVYE3
HZOeNgUgmVJEiCSgScEXPpVMAOL/zppJ2PjAbg7CNLHQ64HweNkv6F1ePg4NCIoA
Op5yIvzm0gUHN9ONfsJRBLlZGQRu8bdsNhdYOAr3rmdxhuuunIi/17qNrT6eaWFO
2pnGFIyYMn9q2ReXBG8mFIkHlac9ZpT2sR7EKY3LBt0FvGz0qQrNM+9M9bQBwbIQ
dD/IRfSUUQqjCLYLqiFvFVC/pqAAcR1G2rQ20jRLPkpSUFceFL/K5ueI2flEPEJk
mF6WR4MsN4lX4w0iiJvpWwE0jqlLVQ1GnhoE2GDZEHgkth/4l+0pN0Jos8OKINDJ
wB4W1Xc2aXNXaD1JAaebu+CthZNnFEXpa5TrXMFAOnBY4oQ4DgOt/ad1s9Ju4zLX
EI+Zn0Q++l+iMyU2InXnTHoaTagqKqtngvHWGmSuK55dM8jW9HoYsjZZl0oC0lVz
GbXQ/1t1loTBqh+crr4kcP0oKvRFT9YPASadUVThmeYlxOyhvQ0e30IBdz0Te1OR
rqfymVGR8NsGdLW+jCKOfbLEaYShTksTnUmr+yF5w5D2uzZHqZasE7cpwPXAEhuZ
TF7ZoSqz1utSQF9/xBnz
=L4x6
-----END PGP SIGNATURE-----

View File

@@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
iQIcBAABAgAGBQJSSt3WAAoJEJFzj3Pht2igSeMQAI42FK1YU6Fr/LreD9/BdjNH
TUJ3L/B3ZMJwlMT+F4cX9r1uVD5udzpXdClUEcKgdwPdqzPsQvuwLSBS4fn38nZM
mryzNeUjbcNPSPSY6bj/MNuYNlYNaWShhL6UjHBD6XYIhAs6hYp0RGcogcpgRU9Z
0peHFyJBp+uUqCpnBDz00zJht49mgT6ovUA3cGd/vPhHrsrJUusgzzi46X3F90+H
9eRoe6/xzCbmbiD7HUlARnMK8ec0b7H/CWsNNCd0v9KBNyW9QROkbwBMtRcWtQZW
p9h9JGT2N3AmIqRbUbKwfWxGN6AfK+Xtl9YjJb/ugwSlw0Pif055EKNeUZjGUUzk
V4YA9b1Z6mncyL4wxV8VD9w8en+dr5Iu6ga02r7Xr0rIHuTQyQQaKfHvNoWZFmhq
WI2xsSBLr1EYfLEetdqUkEo2f2gpy7f6UKL1bsHi/6oqA3NaOOXiPdVlbVDNOQFe
kXPfjz/8hnzQ/8O/zIiSiDefQObdM4DQDTk5ha/vOu4pt5XevHkusaciPNGUAhx1
JmxEmPF6sqg2Y0xmeFZB2ab5s6VL/CfVGBF5ZFq7QmDj9eNFjrElfv+uN9NqD+ll
YlR/g3f7vFLHSG64ez4yV/Hgmfv1+4DMGi9MNmhFF3u0W5AIxznTsQzj1KFhbvmV
8QUyTDG7lGNqsgsSgb7W
=l9GJ
-----END PGP SIGNATURE-----

View File

@@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)
iQIcBAABAgAGBQJSsHIuAAoJEJFzj3Pht2igimkP/2YaCFAfSDJWMyumZart/ycr
asgCoNFCr/10jlN2jPTRgOg/hPvrqxIxPvoGRhM/S6hrO8BXHl3dxiOEDi3AMmT+
t//IHduIfpQCEbLCwse3sCwKXKN7PI9lcZ83gdg9eMKnGHSNkDWKI+33c66EvpfX
T/j3UWvSgl3bDftOWIDWPAqnZI4N9+jtat16QwihxRFxALUxoW6v9JgUHc3HfICg
cF5iHDvKmVAlwM+LTCCA+loxM8gyIf1rpC7dpGraskJylldZsx+6lcZqEoqlPxhW
w/OR2hi/5Avoasxd1NTJE3MpQ4tJevlOwXLxhsWKiR4mk8ZmZl4RONnwq25xGiGZ
hqP7FyDhv7q7lYtMmClLOKEvysY2F7++s7nQAjIjkMlJY5LNn/LukZg10rU54UpD
HmSfGPRqKnnnRzVzwxNXjoUGsR1hJ81de+ytHE3sG7tSUZJk0WcC7K0ZUhN7Obnw
X8V1Y0PFsSxds+BVIJ8afJzKzwFnx8yGsY8spwkAttoCVbJZnU3sMwcypKY68QOe
EdnQq8HaGgx1e439mykXOD/dxMhIoPe4zG6XOa9DKV0eo7BY8V4mFCmyOd99IZKh
4V2TSTVfXIqxLZf12r4+7r+JzmufdZIuJLgw6k/t+05Wltm2hAo6SVBqr6IwRXbm
/ZKnJe+5HIwb07EVgHNJ
=asUm
-----END PGP SIGNATURE-----

Some files were not shown because too many files have changed in this diff Show More